From 7909bd0733771f26ea6d81809a175e0bc3575aee Mon Sep 17 00:00:00 2001 From: Arch Blackmann Date: Wed, 4 Nov 2009 22:07:29 +0000 Subject: [PATCH] Refactoring and cleanup. Start fleshing out the output phase. Start handling exit correctly. Fix a bug in DoLAYOUT. Nothing new to see here... svn path=/trunk/; revision=43959 --- reactos/tools/kbdtool/data.c | 174 +++++++++++++++++++ reactos/tools/kbdtool/kbdtool.h | 75 +++++++++ reactos/tools/kbdtool/kbdtool.rbuild | 3 +- reactos/tools/kbdtool/main.c | 44 +++-- reactos/tools/kbdtool/output.c | 94 ++++++++++- reactos/tools/kbdtool/parser.c | 242 +++------------------------ 6 files changed, 391 insertions(+), 241 deletions(-) create mode 100644 reactos/tools/kbdtool/data.c create mode 100644 reactos/tools/kbdtool/kbdtool.h diff --git a/reactos/tools/kbdtool/data.c b/reactos/tools/kbdtool/data.c new file mode 100644 index 00000000000..12c5974f635 --- /dev/null +++ b/reactos/tools/kbdtool/data.c @@ -0,0 +1,174 @@ +/* + * PROJECT: ReactOS Build Tools [Keyboard Layout Compiler] + * LICENSE: BSD - See COPYING.BSD in the top level directory + * FILE: tools/kbdtool/data.c + * PURPOSE: Internal Keyboard (Scancode/Virtual Key) Tables + * PROGRAMMERS: ReactOS Foundation + */ + +/* INCLUDES *******************************************************************/ + +#include "kbdtool.h" + +/* GLOBALS ********************************************************************/ + +/* Table of Virtual Key Names */ +VKNAME VKName[] = +{ + {0x08, "BACK"}, + {0x03, "CANCEL"}, + {0x1b, "ESCAPE"}, + {0x0d, "RETURN"}, + {0x20, "SPACE"}, + {0x6e, "DECIMAL"}, + {0xba, "OEM_1"}, + {0xbb, "OEM_PLUS"}, + {0xbc, "OEM_COMMA"}, + {0xbd, "OEM_MINUS"}, + {0xbe, "OEM_PERIOD"}, + {0xbf, "OEM_2"}, + {0xc0, "OEM_3"}, + {0xdb, "OEM_4"}, + {0xdc, "OEM_5"}, + {0xdd, "OEM_6"}, + {0xde, "OEM_7"}, + {0xdf, "OEM_8"}, + {0xe2, "OEM_102"}, + {0xc1, "ABNT_C1"}, + {0xc2, "ABNT_C2"}, + {0x10, "SHIFT"}, + {0xa0, "LSHIFT"}, + {0xa1, "RSHIFT"}, + {0x12, "MENU"}, + {0xa4, "LMENU"}, + {0xa5, "RMENU"}, + {0x11, "CONTROL"}, + {0xa2, "LCONTROL"}, + {0xa3, "RCONTROL"}, + {0x6c, "SEPARATOR"}, + {0xe4, "ICO_00"}, + {0x2e, "DELETE"}, + {0x2d, "INSERT"}, + {0xe5, "GROUPSHIFT"}, + {0xe6, "RGROUPSHIFT"} +}; + +/* ISO 110-key Keyboard Scancode to Virtual Key Conversion Table */ +SCVK ScVk[] = +{ + {0x02, '1', NULL, FALSE}, + {0x03, '2', NULL, FALSE}, + {0x04, '3', NULL, FALSE}, + {0x05, '4', NULL, FALSE}, + {0x06, '5', NULL, FALSE}, + {0x07, '6', NULL, FALSE}, + {0x08, '7', NULL, FALSE}, + {0x09, '8', NULL, FALSE}, + {0x0a, '9', NULL, FALSE}, + {0x0b, '0', NULL, FALSE}, + {0x0c, 0xbd, NULL, FALSE}, + {0x0d, 0xbb, NULL, FALSE}, + {0x10, 'Q', NULL, FALSE}, + {0x11, 'W', NULL, FALSE}, + {0x12, 'E', NULL, FALSE}, + {0x13, 'R', NULL, FALSE}, + {0x14, 'T', NULL, FALSE}, + {0x15, 'Y', NULL, FALSE}, + {0x16, 'U', NULL, FALSE}, + {0x17, 'I', NULL, FALSE}, + {0x18, 'O', NULL, FALSE}, + {0x19, 'P', NULL, FALSE}, + {0x1a, 0xdb, NULL, FALSE}, + {0x1b, 0xdd, NULL, FALSE}, + {0x1e, 'A', NULL, FALSE}, + {0x1f, 'S', NULL, FALSE}, + {0x20, 'D', NULL, FALSE}, + {0x21, 'F', NULL, FALSE}, + {0x22, 'G', NULL, FALSE}, + {0x23, 'H', NULL, FALSE}, + {0x24, 'J', NULL, FALSE}, + {0x25, 'K', NULL, FALSE}, + {0x26, 'L', NULL, FALSE}, + {0x27, 0xba, NULL, FALSE}, + {0x28, 0xde, NULL, FALSE}, + {0x29, 0xc0, NULL, FALSE}, + {0x2b, 0xdc, NULL, FALSE}, + {0x2c, 'Z', NULL, FALSE}, + {0x2d, 'X', NULL, FALSE}, + {0x2e, 'C', NULL, FALSE}, + {0x2f, 'V', NULL, FALSE}, + {0x30, 'B', NULL, FALSE}, + {0x31, 'N', NULL, FALSE}, + {0x32, 'M', NULL, FALSE}, + {0x33, 0xbc, NULL, FALSE}, + {0x34, 0xbe, NULL, FALSE}, + {0x35, 0xbf, NULL, FALSE}, + {0x53, 0x6e, NULL, FALSE}, + {0x56, 0xe2, NULL, FALSE}, + {0x73, 0xc1, NULL, FALSE}, + {0x7e, 0xc2, NULL, FALSE}, + {0xe010, 0xb1, "Speedracer: Previous Track", FALSE}, + {0xe019, 0xb0, "Speedracer: Next Track", FALSE}, + {0xe01d, 0xa3, "RControl", FALSE}, + {0xe020, 0xad, "Speedracer: Volume Mute", FALSE}, + {0xe021, 0xb7, "Speedracer: Launch App 2", FALSE}, + {0xe022, 0xb3, "Speedracer: Media Play/Pause", FALSE}, + {0xe024, 0xb2, "Speedracer: Media Stop", FALSE}, + {0xe02e, 0xae, "Speedracer: Volume Up", FALSE}, + {0xe030, 0xaf, "Speedracer: Volume Down", FALSE}, + {0xe032, 0xac, "Speedracer: Browser Home", FALSE}, + {0xe035, 0x6f, "Numpad Divide", FALSE}, + {0xe037, 0x2c, "Snapshot", FALSE}, + {0xe038, 0xa5, "RMenu", FALSE}, + {0xe047, 0x24, "Home", FALSE}, + {0xe048, 0x26, "Up", FALSE}, + {0xe049, 0x21, "Prior", FALSE}, + {0xe04b, 0x25, "Left", FALSE}, + {0xe04d, 0x27, "Right", FALSE}, + {0xe04f, 0x23, "End", FALSE}, + {0xe050, 0x28, "Down", FALSE}, + {0xe051, 0x22, "Next", FALSE}, + {0xe052, 0x2d, "Insert", FALSE}, + {0xe053, 0x2e, "Delete", FALSE}, + {0xe05b, 0x5b, "Left Win", FALSE}, + {0xe05c, 0x5c, "Right Win", FALSE}, + {0xe05d, 0x5d, "Application", FALSE}, + {0xe05e, 0xff, "Power", FALSE}, + {0xe05f, 0x5f, "Speedracer: Sleep", FALSE}, + {0xe060, 0xff, "BAD SCANCODE", FALSE}, + {0xe061, 0xff, "BAD SCANCODE", FALSE}, + {0xe065, 0xaa, "Speedracer: Browser Search", FALSE}, + {0xe066, 0xab, "Speedracer: Browser Favorites", FALSE}, + {0xe067, 0xa8, "Speedracer: Browser Refresh", FALSE}, + {0xe068, 0xa9, "Speedracer: Browser Stop", FALSE}, + {0xe069, 0xa7, "Speedracer: Browser Foward", FALSE}, + {0xe06a, 0xa6, "Speedracer: Browser Back", FALSE}, + {0xe06b, 0xb6, "Speedracer: Launch App 1", FALSE}, + {0xe06c, 0xb4, "Speedracer: Launch Mail", FALSE}, + {0xe06d, 0xb5, "Speedracer: Launch Media Selector", FALSE}, + {0x53, 0x6e, NULL, FALSE}, + {0x0e, 0x08, NULL, FALSE}, + {0x01, 0x1b, NULL, FALSE}, + {0xe01c, 0x0d, "Numpad Enter", FALSE}, + {0x1c, 0x0d, NULL, FALSE}, + {0x39, 0x20, NULL, FALSE}, + {0xe046, 0x03, "Break (Ctrl + Pause)", FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE}, + {0xFFFF, 0x00, NULL, FALSE} +}; + +/* FUNCTIONS ******************************************************************/ + +/* EOF */ diff --git a/reactos/tools/kbdtool/kbdtool.h b/reactos/tools/kbdtool/kbdtool.h new file mode 100644 index 00000000000..de6a6127f47 --- /dev/null +++ b/reactos/tools/kbdtool/kbdtool.h @@ -0,0 +1,75 @@ +/* + * PROJECT: ReactOS Build Tools [Keyboard Layout Compiler] + * LICENSE: BSD - See COPYING.BSD in the top level directory + * FILE: tools/kbdtool/kbdtool.h + * PURPOSE: Main Header File + * PROGRAMMERS: ReactOS Foundation + */ + +/* INCLUDES *******************************************************************/ + +#include +#include +#include +#include +#include +#include + +#define KEYWORD_COUNT 17 + +#define CHAR_NORMAL_KEY 0 +#define CHAR_DEAD_KEY 1 +#define CHAR_OTHER_KEY 2 +#define CHAR_INVALID_KEY 3 +#define CHAR_LIGATURE_KEY 4 + +typedef struct tagKEYNAME +{ + ULONG Code; + PCHAR Name; + struct tagKEYNAME* Next; +} KEYNAME, *PKEYNAME; + +typedef struct tagSCVK +{ + USHORT ScanCode; + USHORT VirtualKey; + PCHAR Name; + BOOLEAN Processed; +} SCVK, *PSCVK; + +typedef struct tagVKNAME +{ + ULONG VirtualKey; + PCHAR Name; +} VKNAME, *PVKNAME; + +typedef struct tagLAYOUTENTRY +{ + USHORT ScanCode; + UCHAR VirtualKey; + UCHAR OriginalVirtualKey; + ULONG Cap; + ULONG StateCount; + ULONG CharData[8]; + ULONG DeadCharData[8]; + ULONG OtherCharData[8]; + struct LAYOUTENTRY* CapData; + PCHAR Name; + ULONG Processed; + ULONG LineCount; +} LAYOUTENTRY, *PLAYOUTENTRY; + +typedef struct tagLAYOUT +{ + LAYOUTENTRY Entry[110]; +} LAYOUT, *PLAYOUT; + +extern BOOLEAN Verbose, UnicodeFile, SanityCheck, FallbackDriver; +extern PCHAR gpszFileName; +extern FILE* gfpInput; +extern VKNAME VKName[]; +extern SCVK ScVk[]; +extern LAYOUT g_Layout; + +/* EOF */ diff --git a/reactos/tools/kbdtool/kbdtool.rbuild b/reactos/tools/kbdtool/kbdtool.rbuild index ca23163941c..ac715ddac17 100644 --- a/reactos/tools/kbdtool/kbdtool.rbuild +++ b/reactos/tools/kbdtool/kbdtool.rbuild @@ -1,7 +1,8 @@ - main.c + data.c + main.c output.c parser.c \ No newline at end of file diff --git a/reactos/tools/kbdtool/main.c b/reactos/tools/kbdtool/main.c index 76f4b61cfa6..5dd3fb3bc83 100644 --- a/reactos/tools/kbdtool/main.c +++ b/reactos/tools/kbdtool/main.c @@ -8,22 +8,22 @@ /* INCLUDES *******************************************************************/ -#include -#include -#include -#include -#include "getopt.h" -#include +#include "kbdtool.h" /* GLOBALS ********************************************************************/ +/* Internal tool data */ ULONG gVersion = 3; ULONG gSubVersion = 40; -BOOLEAN UnicodeFile, Verbose, NoLogo, FallbackDriver, SanityCheck, SourceOnly; -ULONG BuildType; + +/* Input file */ PCHAR gpszFileName; FILE* gfpInput; +/* Command-line parameters */ +BOOLEAN UnicodeFile, Verbose, NoLogo, FallbackDriver, SanityCheck, SourceOnly; +ULONG BuildType; + /* FUNCTIONS ******************************************************************/ VOID @@ -53,7 +53,7 @@ PrintUsage(VOID) printf("\t-i/-x/-m/-o-s will exhibit the same behavior when than one of them is specified.\n\n"); /* Quit */ - _exit(1); + exit(1); printf("should not be here"); } @@ -61,6 +61,7 @@ INT main(INT argc, PCHAR* argv) { + ULONG ErrorCode, FailureCode; CHAR Option; PCHAR OpenFlags; CHAR BuildOptions[16] = {0}; @@ -213,16 +214,27 @@ main(INT argc, /* Now inform the user */ printf("Compiling layout information from '%s' for %s.\n", gpszFileName, BuildOptions); } - + /* Now parse the keywords */ - DoParsing(); + FailureCode = DoParsing(); - /* We are done */ - fclose(gfpInput); + /* Should we build? */ + if (!(SourceOnly) && !(FallbackDriver)) ErrorCode = 0;//DoBuild(); - /* Now do something... */ - printf("Like a rock...\n"); - exit(0); + /* Did everything work? */ + if (FailureCode == 0) + { + /* Tell the user, if he cares */ + if (!NoLogo) printf("All tasks completed successfully.\n"); + } + else + { + /* Print the failure code */ + printf("\n %13d\n", FailureCode); + } + + /* Return the error code */ + return ErrorCode; } /* EOF */ diff --git a/reactos/tools/kbdtool/output.c b/reactos/tools/kbdtool/output.c index c3c1fd0d621..845ce59a66e 100644 --- a/reactos/tools/kbdtool/output.c +++ b/reactos/tools/kbdtool/output.c @@ -8,14 +8,98 @@ /* INCLUDES *******************************************************************/ -#include -#include -#include -#include -#include +#include "kbdtool.h" /* GLOBALS ********************************************************************/ /* FUNCTIONS ******************************************************************/ +BOOLEAN +kbd_h(IN PLAYOUT Layout) +{ + /* FIXME: Stub */ + return FALSE; +} + +BOOLEAN +kbd_rc(IN PKEYNAME DescriptionData, + IN PKEYNAME LanguageData) +{ + /* FIXME: Stub */ + return FALSE; +} + +BOOLEAN +kbd_def(VOID) +{ + /* FIXME: Stub */ + return FALSE; +} + +BOOLEAN +kbd_c(IN ULONG StateCount, + IN PULONG ShiftStates, + IN PVOID AttributeData, + IN PLAYOUT Layout, + IN PVOID DeadKeyData, + IN PVOID LigatureData, + IN PKEYNAME KeyNameData, + IN PKEYNAME KeyNameExtData, + IN PKEYNAME KeyNameDeadData) +{ + /* FIXME: Stub */ + return FALSE; +} + +ULONG +DoOutput(IN ULONG StateCount, + IN PULONG ShiftStates, + IN PKEYNAME DescriptionData, + IN PKEYNAME LanguageData, + IN PVOID AttributeData, + IN PVOID DeadKeyData, + IN PVOID LigatureData, + IN PKEYNAME KeyNameData, + IN PKEYNAME KeyNameExtData, + IN PKEYNAME KeyNameDeadData) +{ + ULONG FailureCode = 0; + + /* Check if this just a fallback driver*/ + if (!FallbackDriver) + { + /* It's not, create header file */ + if (!kbd_h(&g_Layout)) FailureCode = 1; + + /* Create the resource file */ + if (!kbd_rc(DescriptionData, LanguageData)) FailureCode = 2; + } + + /* Create the C file */ + if (!kbd_c(StateCount, + ShiftStates, + AttributeData, + &g_Layout, + DeadKeyData, + LigatureData, + KeyNameData, + KeyNameExtData, + KeyNameDeadData)) + { + /* Failed in C file generation */ + FailureCode = 3; + } + + /* Check if this just a fallback driver*/ + if (!FallbackDriver) + { + /* Generate the definition file */ + if (!kbd_def()) FailureCode = 4; + } + + /* Done */ + return FailureCode; +} + + /* EOF */ diff --git a/reactos/tools/kbdtool/parser.c b/reactos/tools/kbdtool/parser.c index 4617f5f2b48..ead5f63f9a0 100644 --- a/reactos/tools/kbdtool/parser.c +++ b/reactos/tools/kbdtool/parser.c @@ -8,61 +8,11 @@ /* INCLUDES *******************************************************************/ -#include -#include -#include -#include -#include - -typedef struct tagKEYNAME -{ - ULONG Code; - PCHAR Name; - struct tagKEYNAME* Next; -} KEYNAME, *PKEYNAME; - -typedef struct tagSCVK -{ - USHORT ScanCode; - USHORT VirtualKey; - PCHAR Name; - BOOLEAN Processed; -} SCVK, *PSCVK; - -typedef struct tagVKNAME -{ - ULONG VirtualKey; - PCHAR Name; -} VKNAME, *PVKNAME; - -typedef struct tagLAYOUTENTRY -{ - USHORT ScanCode; - UCHAR VirtualKey; - UCHAR OriginalVirtualKey; - ULONG Cap; - ULONG StateCount; - ULONG CharData[8]; - ULONG DeadCharData[8]; - ULONG OtherCharData[8]; - struct LAYOUTENTRY* CapData; - PCHAR Name; - ULONG Processed; - ULONG LineCount; -} LAYOUTENTRY, *PLAYOUTENTRY; - -typedef struct tagLAYOUT -{ - LAYOUTENTRY Entry[110]; -} LAYOUT, *PLAYOUT; +#include "kbdtool.h" /* GLOBALS ********************************************************************/ -#define KEYWORD_COUNT 17 - -extern BOOLEAN Verbose, UnicodeFile, SanityCheck; -extern PCHAR gpszFileName; -extern FILE* gfpInput; +/* Internal parser data about everything that was parsed */ CHAR gBuf[256]; CHAR gKBDName[10]; CHAR gCopyright[256]; @@ -73,6 +23,8 @@ ULONG gID = 0; ULONG gKbdLayoutVersion; LAYOUT g_Layout; ULONG gLineCount; + +/* Table of keywords the parser recognizes */ PCHAR KeyWordList[KEYWORD_COUNT] = { "KBD", @@ -94,168 +46,6 @@ PCHAR KeyWordList[KEYWORD_COUNT] = "ENDKBD", }; -/* ISO 110-key Keyboard Scancode to Virtual Key Conversion Table */ -SCVK ScVk[] = -{ - {0x02, '1', NULL, FALSE}, - {0x03, '2', NULL, FALSE}, - {0x04, '3', NULL, FALSE}, - {0x05, '4', NULL, FALSE}, - {0x06, '5', NULL, FALSE}, - {0x07, '6', NULL, FALSE}, - {0x08, '7', NULL, FALSE}, - {0x09, '8', NULL, FALSE}, - {0x0a, '9', NULL, FALSE}, - {0x0b, '0', NULL, FALSE}, - {0x0c, 0xbd, NULL, FALSE}, - {0x0d, 0xbb, NULL, FALSE}, - {0x10, 'Q', NULL, FALSE}, - {0x11, 'W', NULL, FALSE}, - {0x12, 'E', NULL, FALSE}, - {0x13, 'R', NULL, FALSE}, - {0x14, 'T', NULL, FALSE}, - {0x15, 'Y', NULL, FALSE}, - {0x16, 'U', NULL, FALSE}, - {0x17, 'I', NULL, FALSE}, - {0x18, 'O', NULL, FALSE}, - {0x19, 'P', NULL, FALSE}, - {0x1a, 0xdb, NULL, FALSE}, - {0x1b, 0xdd, NULL, FALSE}, - {0x1e, 'A', NULL, FALSE}, - {0x1f, 'S', NULL, FALSE}, - {0x20, 'D', NULL, FALSE}, - {0x21, 'F', NULL, FALSE}, - {0x22, 'G', NULL, FALSE}, - {0x23, 'H', NULL, FALSE}, - {0x24, 'J', NULL, FALSE}, - {0x25, 'K', NULL, FALSE}, - {0x26, 'L', NULL, FALSE}, - {0x27, 0xba, NULL, FALSE}, - {0x28, 0xde, NULL, FALSE}, - {0x29, 0xc0, NULL, FALSE}, - {0x2b, 0xdc, NULL, FALSE}, - {0x2c, 'Z', NULL, FALSE}, - {0x2d, 'X', NULL, FALSE}, - {0x2e, 'C', NULL, FALSE}, - {0x2f, 'V', NULL, FALSE}, - {0x30, 'B', NULL, FALSE}, - {0x31, 'N', NULL, FALSE}, - {0x32, 'M', NULL, FALSE}, - {0x33, 0xbc, NULL, FALSE}, - {0x34, 0xbe, NULL, FALSE}, - {0x35, 0xbf, NULL, FALSE}, - {0x53, 0x6e, NULL, FALSE}, - {0x56, 0xe2, NULL, FALSE}, - {0x73, 0xc1, NULL, FALSE}, - {0x7e, 0xc2, NULL, FALSE}, - {0xe010, 0xb1, "Speedracer: Previous Track", FALSE}, - {0xe019, 0xb0, "Speedracer: Next Track", FALSE}, - {0xe01d, 0xa3, "RControl", FALSE}, - {0xe020, 0xad, "Speedracer: Volume Mute", FALSE}, - {0xe021, 0xb7, "Speedracer: Launch App 2", FALSE}, - {0xe022, 0xb3, "Speedracer: Media Play/Pause", FALSE}, - {0xe024, 0xb2, "Speedracer: Media Stop", FALSE}, - {0xe02e, 0xae, "Speedracer: Volume Up", FALSE}, - {0xe030, 0xaf, "Speedracer: Volume Down", FALSE}, - {0xe032, 0xac, "Speedracer: Browser Home", FALSE}, - {0xe035, 0x6f, "Numpad Divide", FALSE}, - {0xe037, 0x2c, "Snapshot", FALSE}, - {0xe038, 0xa5, "RMenu", FALSE}, - {0xe047, 0x24, "Home", FALSE}, - {0xe048, 0x26, "Up", FALSE}, - {0xe049, 0x21, "Prior", FALSE}, - {0xe04b, 0x25, "Left", FALSE}, - {0xe04d, 0x27, "Right", FALSE}, - {0xe04f, 0x23, "End", FALSE}, - {0xe050, 0x28, "Down", FALSE}, - {0xe051, 0x22, "Next", FALSE}, - {0xe052, 0x2d, "Insert", FALSE}, - {0xe053, 0x2e, "Delete", FALSE}, - {0xe05b, 0x5b, "Left Win", FALSE}, - {0xe05c, 0x5c, "Right Win", FALSE}, - {0xe05d, 0x5d, "Application", FALSE}, - {0xe05e, 0xff, "Power", FALSE}, - {0xe05f, 0x5f, "Speedracer: Sleep", FALSE}, - {0xe060, 0xff, "BAD SCANCODE", FALSE}, - {0xe061, 0xff, "BAD SCANCODE", FALSE}, - {0xe065, 0xaa, "Speedracer: Browser Search", FALSE}, - {0xe066, 0xab, "Speedracer: Browser Favorites", FALSE}, - {0xe067, 0xa8, "Speedracer: Browser Refresh", FALSE}, - {0xe068, 0xa9, "Speedracer: Browser Stop", FALSE}, - {0xe069, 0xa7, "Speedracer: Browser Foward", FALSE}, - {0xe06a, 0xa6, "Speedracer: Browser Back", FALSE}, - {0xe06b, 0xb6, "Speedracer: Launch App 1", FALSE}, - {0xe06c, 0xb4, "Speedracer: Launch Mail", FALSE}, - {0xe06d, 0xb5, "Speedracer: Launch Media Selector", FALSE}, - {0x53, 0x6e, NULL, FALSE}, - {0x0e, 0x08, NULL, FALSE}, - {0x01, 0x1b, NULL, FALSE}, - {0xe01c, 0x0d, "Numpad Enter", FALSE}, - {0x1c, 0x0d, NULL, FALSE}, - {0x39, 0x20, NULL, FALSE}, - {0xe046, 0x03, "Break (Ctrl + Pause)", FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE}, - {0xFFFF, 0x00, NULL, FALSE} -}; - -VKNAME VKName[] = -{ - {0x08, "BACK"}, - {0x03, "CANCEL"}, - {0x1b, "ESCAPE"}, - {0x0d, "RETURN"}, - {0x20, "SPACE"}, - {0x6e, "DECIMAL"}, - {0xba, "OEM_1"}, - {0xbb, "OEM_PLUS"}, - {0xbc, "OEM_COMMA"}, - {0xbd, "OEM_MINUS"}, - {0xbe, "OEM_PERIOD"}, - {0xbf, "OEM_2"}, - {0xc0, "OEM_3"}, - {0xdb, "OEM_4"}, - {0xdc, "OEM_5"}, - {0xdd, "OEM_6"}, - {0xde, "OEM_7"}, - {0xdf, "OEM_8"}, - {0xe2, "OEM_102"}, - {0xc1, "ABNT_C1"}, - {0xc2, "ABNT_C2"}, - {0x10, "SHIFT"}, - {0xa0, "LSHIFT"}, - {0xa1, "RSHIFT"}, - {0x12, "MENU"}, - {0xa4, "LMENU"}, - {0xa5, "RMENU"}, - {0x11, "CONTROL"}, - {0xa2, "LCONTROL"}, - {0xa3, "RCONTROL"}, - {0x6c, "SEPARATOR"}, - {0xe4, "ICO_00"}, - {0x2e, "DELETE"}, - {0x2d, "INSERT"}, - {0xe5, "GROUPSHIFT"}, - {0xe6, "RGROUPSHIFT"} -}; - -#define CHAR_NORMAL_KEY 0 -#define CHAR_DEAD_KEY 1 -#define CHAR_OTHER_KEY 2 -#define CHAR_INVALID_KEY 3 -#define CHAR_LIGATURE_KEY 4 - /* FUNCTIONS ******************************************************************/ ULONG @@ -1081,10 +871,10 @@ DoLAYOUT(IN PLAYOUT LayoutData, } /* Skip what's left */ - return SkipLines(); + return KeyWord; } -VOID +ULONG DoParsing(VOID) { ULONG KeyWords[KEYWORD_COUNT]; @@ -1119,8 +909,7 @@ DoParsing(VOID) printf("The '%s' keyword appeared multiple times.\n", KeyWordList[KeyWord]); } - - + /* Now parse this keyword */ switch (KeyWord) { @@ -1257,6 +1046,21 @@ DoParsing(VOID) default: break; } - } + } + + /* We are done */ + fclose(gfpInput); + + /* Now enter the output phase */ + return DoOutput(StateCount, + ShiftStates, + DescriptionData, + LanguageData, + AttributeData, + DeadKeyData, + LigatureData, + KeyNameData, + KeyNameExtData, + KeyNameDeadData); } /* EOF */