2 * PROJECT: ReactOS Build Tools [Keyboard Layout Compiler]
3 * LICENSE: BSD - See COPYING.BSD in the top level directory
4 * FILE: tools/kbdtool/main.c
5 * PURPOSE: Main Logic Loop
6 * PROGRAMMERS: ReactOS Foundation
9 /* INCLUDES *******************************************************************/
16 #include <host/typedefs.h>
18 /* GLOBALS ********************************************************************/
21 ULONG gSubVersion
= 40;
22 BOOLEAN UnicodeFile
, Verbose
, NoLogo
, FallbackDriver
, SanityCheck
, SourceOnly
;
27 /* FUNCTIONS ******************************************************************/
32 /* This is who we are */
33 printf("\nKbdTool v%d.%02d - convert keyboard text file to C file or a keyboard layout DLL\n\n",
34 gVersion
, gSubVersion
);
36 /* This is what we do */
37 printf("Usage: KbdTool [-v] [-n] [-w] [-k] [-n] [-u|a] [-i|x|m|o|s] FILE\n\n");
38 printf("\t[-?] display this message\n");
39 printf("\t[-n] no logo or normal build information displayed\n\n");
40 printf("\t[-a] Uses non-Unicode source files (default)\n");
41 printf("\t[-u] Uses Unicode source files\n\n");
42 printf("\t[-v] Verbose diagnostics (and warnings, with -w)\n");
43 printf("\t[-w] display extended Warnings\n\n");
44 printf("\t[-x] Builds for x86 (default)\n");
45 printf("\t[-i] Builds for IA64\n");
46 printf("\t[-m] Builds for AMD64\n");
47 printf("\t[-o] Builds for WOW64\n");
48 printf("\t[-s] Generate Source files (no build)\n\n");
49 printf("\tFILE The source keyboard file (required)\n\n");
52 printf("\t-u/-a are mutually exclusive; kbdutool will use the last one if you specify more than one.\n");
53 printf("\t-i/-x/-m/-o-s will exhibit the same behavior when than one of them is specified.\n\n");
57 printf("should not be here");
66 CHAR BuildOptions
[16] = {0};
68 /* Loop for parameter */
72 Option
= getopt(argc
, argv
, "aAeEiIkKmMnNOosSuUvVwWxX?");
75 /* Check supported options */
102 /* Fallback driver */
147 /* If you got here, the options are invalid or missing */
153 /* Do we have no options? */
154 if (optind
== argc
) usage();
156 /* Should we announce ourselves? */
159 /* This is who we are */
160 printf("\nKbdTool v%d.%02d - convert keyboard text file to C file or a keyboard layout DLL\n\n",
161 gVersion
, gSubVersion
);
164 /* Save the file name */
165 gpszFileName
= argv
[optind
];
167 /* Open either as binary or text */
169 if (!UnicodeFile
) OpenFlags
= "rt";
171 /* Open a handle to the file */
172 gfpInput
= fopen(gpszFileName
, OpenFlags
);
175 /* Couldn't open it */
176 printf("Unable to open '%s' for read.\n", gpszFileName
);
180 /* Should we print out what we're doing? */
183 /* Are we only building the source files? */
186 /* Then there's no target architecture */
187 strcpy(BuildOptions
, "source files");
191 /* Take a look at the target architecture*/
194 /* Print the appropriate message depending on what was chosen */
196 strcpy(BuildOptions
, "i386/x86");
199 strcpy(BuildOptions
, "ia64");
202 strcpy(BuildOptions
, "amd64/x64");
205 strcpy(BuildOptions
, "wow64");
208 strcpy(BuildOptions
, "unknown purpose");
213 /* Now inform the user */
214 printf("Compiling layout information from '%s' for %s.\n", gpszFileName
, BuildOptions
);
217 /* Now do something... */
218 printf("Like a rock...\n");