ReactOS 0.4.16-dev-257-g6aa11ac
evtmsggen.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS EventCreate Command
4 * FILE: base/applications/cmdutils/eventcreate/evtmsggen.c
5 * PURPOSE: Generator for the event message string templates file.
6 * Creates the message string file in the current directory.
7 * PROGRAMMER: Hermes Belusca-Maito
8 *
9 * You can compile this generator:
10 * with GCC : $ gcc -o evtmsggen.exe evtmsggen.c
11 * with MSVC: $ cl evtmsggen.c (or: $ cl /Fe"evtmsggen.exe" evtmsggen.c)
12 */
13
14#include <stdio.h>
15
16/*
17 * Enable/disable this option to use "English" for the message table language.
18 * The default behaviour when the option is disabled selects "Neutral" language.
19 */
20// #define ENGLISH
21
22/* The default End-Of-Line control for the message file */
23#define EOL "\r\n"
24
25
26static void usage(char* name)
27{
28 fprintf(stdout, "Usage: %s ID_min ID_max outfile.mc\n", name);
29}
30
31int main(int argc, char* argv[])
32{
33 FILE* outFile;
34 unsigned int id_min, id_max;
35 unsigned int i;
36
37 /* Validate the arguments */
38 if (argc != 4)
39 {
40 usage(argv[0]);
41 return -1;
42 }
43
44 id_min = (unsigned int)atoi(argv[1]);
45 id_max = (unsigned int)atoi(argv[2]);
46 if (id_min > id_max)
47 {
48 fprintf(stderr, "ERROR: Min ID %u cannot be strictly greater than Max ID %u !\n", id_min, id_max);
49 return -1;
50 }
51
52 /* Open the file */
53 outFile = fopen(argv[3], "wb");
54 if (!outFile)
55 {
56 fprintf(stderr, "ERROR: Could not create output file '%s'.\n", argv[3]);
57 return -1;
58 }
59
60 /* Generate the file */
61
62 /* Write the header */
63 fprintf(outFile,
64 ";/*" EOL
65 "; * %s" EOL
66 "; * Contains event message string templates for the EventCreate Command." EOL
67 "; *" EOL
68 "; * This file is autogenerated, do not edit." EOL
69 "; * Generated with:" EOL
70 "; * %s %u %u %s" EOL
71 "; */" EOL
72 EOL
73#ifdef ENGLISH
74 "LanguageNames=(English=0x409:MSG00409)" EOL
75#else
76 "LanguageNames=(Neutral=0x0000:MSG00000)" EOL
77#endif
78 "MessageIdTypedef=DWORD" EOL
79 EOL,
80 argv[3],
81 argv[0], id_min /* argv[1] */, id_max /* argv[2] */, argv[3]);
82
83 /* Write the message string templates */
84 for (i = id_min; i <= id_max; ++i)
85 {
86 fprintf(outFile,
87 "MessageId=0x%X" EOL
88#ifdef ENGLISH
89 "Language=English" EOL
90#else
91 "Language=Neutral" EOL
92#endif
93 "%%1" EOL
94 "." EOL
95 EOL,
96 i);
97 }
98
99 /* Close the file */
100 fclose(outFile);
101
102 return 0;
103}
104
105/* EOF */
static int argc
Definition: ServiceArgs.c:12
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
int main()
Definition: test.c:6
#define EOL
Definition: evtmsggen.c:23
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define stdout
Definition: stdio.h:99
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define argv
Definition: mplay32.c:18
Definition: name.c:39