Begin implementing Keyboard Layout Compiler Tool, as requested by KJK::Hyperion. This is a UNIX-style (Win32-compatible) command-line tool that will take a standard keyboard layout file (in text) and generate the source, defininition, header and resource data for it. The second part of the tool will spawn off the compiler to build the keyboard DLL, or perhaps generate an .rbuild file to perform the work.

svn path=/trunk/; revision=43880
This commit is contained in:
Arch Blackmann 2009-10-31 18:13:26 +00:00
parent 514a0e7f08
commit 8a28e9ff5e
5 changed files with 216 additions and 0 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../tools/rbuild/project.dtd">
<module name="kbdtool" type="buildtool">
<file>main.c</file>
<file>output.c</file>
<file>parser.c</file>
</module>

View file

@ -0,0 +1,164 @@
/*
* PROJECT: ReactOS Build Tools [Keyboard Layout Compiler]
* LICENSE: BSD - See COPYING.BSD in the top level directory
* FILE: tools/kbdtool/main.c
* PURPOSE: Main Logic Loop
* PROGRAMMERS: ReactOS Foundation
*/
/* INCLUDES *******************************************************************/
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "getopt.h"
#include <host/typedefs.h>
/* GLOBALS ********************************************************************/
ULONG gVersion = 3;
ULONG gSubVersion = 40;
BOOLEAN UnicodeFile, Verbose, NoLogo, FallbackDriver, SanityCheck, SourceOnly;
ULONG BuildType;
/* FUNCTIONS ******************************************************************/
void
usage()
{
/* This is who we are */
printf("\nKbdTool v%d.%02d - convert keyboard text file to C file or a keyboard layout DLL\n\n",
gVersion, gSubVersion);
/* This is what we do */
printf("Usage: KbdTool [-v] [-n] [-w] [-k] [-n] [-u|a] [-i|x|m|o|s] FILE\n\n");
printf("\t[-?] display this message\n");
printf("\t[-n] no logo or normal build information displayed\n\n");
printf("\t[-a] Uses non-Unicode source files (default)\n");
printf("\t[-u] Uses Unicode source files\n\n");
printf("\t[-v] Verbose diagnostics (and warnings, with -w)\n");
printf("\t[-w] display extended Warnings\n\n");
printf("\t[-x] Builds for x86 (default)\n");
printf("\t[-i] Builds for IA64\n");
printf("\t[-m] Builds for AMD64\n");
printf("\t[-o] Builds for WOW64\n");
printf("\t[-s] Generate Source files (no build)\n\n");
printf("\tFILE The source keyboard file (required)\n\n");
/* Extra hints */
printf("\t-u/-a are mutually exclusive; kbdutool will use the last one if you specify more than one.\n");
printf("\t-i/-x/-m/-o-s will exhibit the same behavior when than one of them is specified.\n\n");
/* Quit */
_exit(1);
printf("should not be here");
}
int
main(int argc,
char** argv)
{
CHAR Option;
/* Loop for parameter */
while (TRUE)
{
/* Get the options */
Option = getopt(argc, argv, "aAeEiIkKmMnNOosSuUvVwWxX?");
if (Option != -1)
{
/* Check supported options */
switch (Option)
{
/* ASCII File */
case 'A':
case 'a':
UnicodeFile = 0;
continue;
/* UNICODE File */
case 'U':
case 'u':
UnicodeFile = 1;
continue;
/* Verbose */
case 'V':
case 'v':
Verbose = 1;
continue;
/* No logo */
case 'N':
case 'n':
NoLogo = 1;
continue;
/* Fallback driver */
case 'K':
case 'k':
FallbackDriver = 1;
continue;
/* Sanity Check */
case 'W':
case 'w':
SanityCheck = 1;
continue;
/* Itanium */
case 'I':
case 'i':
BuildType = 1;
continue;
/* X86 */
case 'X':
case 'x':
BuildType = 0;
continue;
/* AMD64 */
case 'M':
case 'm':
BuildType = 2;
continue;
/* WOW64 */
case 'O':
case 'o':
BuildType = 3;
continue;
/* Source only */
case 'S':
case 's':
SourceOnly = 1;
continue;
default:
break;
}
/* If you got here, the options are invalid or missing */
usage();
}
break;
}
/* Do we have no options? */
if (optind == argc) usage();
/* Should we announce ourselves? */
if (!NoLogo)
{
/* This is who we are */
printf("\nKbdTool v%d.%02d - convert keyboard text file to C file or a keyboard layout DLL\n\n",
gVersion, gSubVersion);
}
/* Otherwise... do something */
printf("Zoom zoom...\n");
}
/* EOF */

View file

@ -0,0 +1,21 @@
/*
* PROJECT: ReactOS Build Tools [Keyboard Layout Compiler]
* LICENSE: BSD - See COPYING.BSD in the top level directory
* FILE: tools/kbdtool/output.c
* PURPOSE: Output Logic (Source Builder)
* PROGRAMMERS: ReactOS Foundation
*/
/* INCLUDES *******************************************************************/
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <host/typedefs.h>
/* GLOBALS ********************************************************************/
/* FUNCTIONS ******************************************************************/
/* EOF */

View file

@ -0,0 +1,21 @@
/*
* PROJECT: ReactOS Build Tools [Keyboard Layout Compiler]
* LICENSE: BSD - See COPYING.BSD in the top level directory
* FILE: tools/kbdtool/parser.c
* PURPOSE: Parsing Logic
* PROGRAMMERS: ReactOS Foundation
*/
/* INCLUDES *******************************************************************/
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <host/typedefs.h>
/* GLOBALS ********************************************************************/
/* FUNCTIONS ******************************************************************/
/* EOF */

View file

@ -7,6 +7,9 @@
<directory name="cdmake">
<xi:include href="cdmake/cdmake.rbuild" />
</directory>
<directory name="kbdtool">
<xi:include href="kbdtool/kbdtool.rbuild" />
</directory>
<directory name="mkhive">
<xi:include href="mkhive/mkhive.rbuild" />
</directory>