mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 00:41:36 +00:00
[KBDTOOL]: Whitespace fixes.
svn path=/trunk/; revision=65995
This commit is contained in:
parent
3f427653d8
commit
c67fcc673a
|
@ -26,13 +26,13 @@ ULONG BuildType;
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
VOID
|
||||
PrintUsage(VOID)
|
||||
{
|
||||
/* 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");
|
||||
|
@ -47,11 +47,11 @@ PrintUsage(VOID)
|
|||
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");
|
||||
|
@ -65,18 +65,18 @@ main(INT argc,
|
|||
CHAR Option;
|
||||
PCHAR OpenFlags;
|
||||
CHAR BuildOptions[16] = {0};
|
||||
|
||||
|
||||
/* Loop for parameter */
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
if (argv[i][0] != '/' && argv[i][0] != '-')
|
||||
break;
|
||||
|
||||
|
||||
if (argv[i][1] && !argv[i][2])
|
||||
Option = argv[i][1];
|
||||
else
|
||||
Option = 0;
|
||||
|
||||
|
||||
/* Check supported options */
|
||||
switch (Option)
|
||||
{
|
||||
|
@ -85,74 +85,74 @@ main(INT argc,
|
|||
case 'a':
|
||||
UnicodeFile = 0;
|
||||
break;
|
||||
|
||||
|
||||
/* UNICODE File */
|
||||
case 'U':
|
||||
case 'u':
|
||||
UnicodeFile = 1;
|
||||
break;
|
||||
|
||||
|
||||
/* Verbose */
|
||||
case 'V':
|
||||
case 'v':
|
||||
Verbose = 1;
|
||||
break;
|
||||
|
||||
|
||||
/* No logo */
|
||||
case 'N':
|
||||
case 'n':
|
||||
NoLogo = 1;
|
||||
break;
|
||||
|
||||
|
||||
/* Fallback driver */
|
||||
case 'K':
|
||||
case 'k':
|
||||
FallbackDriver = 1;
|
||||
break;
|
||||
|
||||
|
||||
/* Sanity Check */
|
||||
case 'W':
|
||||
case 'w':
|
||||
SanityCheck = 1;
|
||||
break;
|
||||
|
||||
|
||||
/* Itanium */
|
||||
case 'I':
|
||||
case 'i':
|
||||
BuildType = 1;
|
||||
break;
|
||||
|
||||
|
||||
/* X86 */
|
||||
case 'X':
|
||||
case 'x':
|
||||
BuildType = 0;
|
||||
break;
|
||||
|
||||
|
||||
/* AMD64 */
|
||||
case 'M':
|
||||
case 'm':
|
||||
BuildType = 2;
|
||||
break;
|
||||
|
||||
|
||||
/* WOW64 */
|
||||
case 'O':
|
||||
case 'o':
|
||||
BuildType = 3;
|
||||
break;
|
||||
|
||||
|
||||
/* Source only */
|
||||
case 'S':
|
||||
case 's':
|
||||
SourceOnly = 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* If you got here, the options are invalid or missing */
|
||||
PrintUsage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Do we have no options? */
|
||||
if (i == argc) PrintUsage();
|
||||
|
||||
|
@ -163,14 +163,14 @@ main(INT argc,
|
|||
printf("\nKbdTool v%d.%02d - convert keyboard text file to C file or a keyboard layout DLL\n\n",
|
||||
gVersion, gSubVersion);
|
||||
}
|
||||
|
||||
|
||||
/* Save the file name */
|
||||
gpszFileName = argv[i];
|
||||
|
||||
|
||||
/* Open either as binary or text */
|
||||
OpenFlags = "rb";
|
||||
if (!UnicodeFile) OpenFlags = "rt";
|
||||
|
||||
|
||||
/* Open a handle to the file */
|
||||
gfpInput = fopen(gpszFileName, OpenFlags);
|
||||
if (!gfpInput)
|
||||
|
@ -179,7 +179,7 @@ main(INT argc,
|
|||
printf("Unable to open '%s' for read.\n", gpszFileName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Should we print out what we're doing? */
|
||||
if (!NoLogo)
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ main(INT argc,
|
|||
/* Print the appropriate message depending on what was chosen */
|
||||
case 0:
|
||||
strcpy(BuildOptions, "i386/x86");
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
strcpy(BuildOptions, "ia64");
|
||||
break;
|
||||
|
@ -212,17 +212,17 @@ main(INT argc,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Now inform the user */
|
||||
printf("Compiling layout information from '%s' for %s.\n", gpszFileName, BuildOptions);
|
||||
}
|
||||
|
||||
|
||||
/* Now parse the keywords */
|
||||
FailureCode = DoParsing();
|
||||
|
||||
|
||||
/* Should we build? */
|
||||
if (!(SourceOnly) && !(FallbackDriver)) ErrorCode = 0;//DoBuild();
|
||||
|
||||
|
||||
/* Did everything work? */
|
||||
if (FailureCode == 0)
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ main(INT argc,
|
|||
/* Print the failure code */
|
||||
printf("\n %13d\n", FailureCode);
|
||||
}
|
||||
|
||||
|
||||
/* Return the error code */
|
||||
return ErrorCode;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ WChName(IN ULONG Char,
|
|||
IN BOOLEAN AddZero)
|
||||
{
|
||||
PCHAR p;
|
||||
|
||||
|
||||
/* Check for invalid character */
|
||||
if (Char == -1)
|
||||
{
|
||||
|
@ -37,19 +37,19 @@ WChName(IN ULONG Char,
|
|||
{
|
||||
/* Use our global buffer */
|
||||
p = gCharName;
|
||||
|
||||
|
||||
/* Add the first quote unless this was a zero-string */
|
||||
if (!AddZero) *p++ = '\'';
|
||||
|
||||
|
||||
/* Now replace any other quote or comment character with a slash */
|
||||
if ((Char == '\"') || (Char == '\'') || (Char == '\\')) *p++ = '\\';
|
||||
|
||||
|
||||
/* Now plug in the character */
|
||||
*p++ = Char;
|
||||
|
||||
|
||||
/* And add the terminating quote, unless this was a zero-string */
|
||||
if (!AddZero) *p++ = '\'';
|
||||
|
||||
|
||||
/* Terminate the buffer */
|
||||
*p = '\0';
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ WChName(IN ULONG Char,
|
|||
sprintf(gCharName, "\\x%04x", Char);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Return the name */
|
||||
return gCharName;
|
||||
}
|
||||
|
@ -93,26 +93,26 @@ PrintNameTable(FILE* FileHandle,
|
|||
BOOL DeadKey)
|
||||
{
|
||||
CHAR CharBuffer[255];
|
||||
PKEYNAME NextName;
|
||||
PKEYNAME NextName;
|
||||
PCHAR Name, Buffer;
|
||||
ULONG i;
|
||||
|
||||
|
||||
/* Loop all key names */
|
||||
while (KeyName)
|
||||
{
|
||||
/* Go to the next key name */
|
||||
NextName = KeyName->Next;
|
||||
|
||||
|
||||
/* Remember the name and our buffer address */
|
||||
Name = KeyName->Name;
|
||||
Buffer = CharBuffer;
|
||||
|
||||
|
||||
/* Check if it's an IDS name */
|
||||
if (strncmp(Name, "IDS_", 4))
|
||||
{
|
||||
/* No, so start parsing it. First, handle initial quote */
|
||||
if (*Name != '\"') *Buffer++ = '\"';
|
||||
|
||||
|
||||
/* Next, parse the name */
|
||||
while (*Name)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ PrintNameTable(FILE* FileHandle,
|
|||
/* Copy 6 characters */
|
||||
for (i = 0; (*Name) && (i < 6); i++) *Buffer++ = *Name++;
|
||||
}
|
||||
|
||||
|
||||
/* Check if we still have something at the end */
|
||||
if (*Name)
|
||||
{
|
||||
|
@ -142,10 +142,10 @@ PrintNameTable(FILE* FileHandle,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check for terminating quote */
|
||||
if (*(Buffer - 1) != '\"') *Buffer++ = '\"';
|
||||
|
||||
|
||||
/* Terminate the buffer */
|
||||
*Buffer++ = '\0';
|
||||
}
|
||||
|
@ -168,15 +168,15 @@ PrintNameTable(FILE* FileHandle,
|
|||
/* Print the entry */
|
||||
fprintf(FileHandle, " 0x%02x, L%s,\n", KeyName->Code, CharBuffer);
|
||||
}
|
||||
|
||||
|
||||
/* Cleanup allocation */
|
||||
free(KeyName->Name);
|
||||
free(KeyName);
|
||||
|
||||
|
||||
/* Move on */
|
||||
KeyName = NextName;
|
||||
}
|
||||
|
||||
|
||||
/* Is this a dead key? */
|
||||
if (DeadKey)
|
||||
{
|
||||
|
@ -199,11 +199,11 @@ kbd_h(IN PLAYOUT Layout)
|
|||
ULONG i;
|
||||
CHAR UndefChar;
|
||||
USHORT SubCode;
|
||||
|
||||
|
||||
/* Build the keyboard name */
|
||||
strcpy(OutputFile, gKBDName);
|
||||
strcat(OutputFile, ".H");
|
||||
|
||||
|
||||
/* Open it */
|
||||
FileHandle = fopen(OutputFile, "wt");
|
||||
if (!FileHandle)
|
||||
|
@ -212,7 +212,7 @@ kbd_h(IN PLAYOUT Layout)
|
|||
printf(" %12s : can't open for write.\n", OutputFile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Print the module header */
|
||||
fprintf(FileHandle,
|
||||
"/****************************** Module Header ******************************\\\n"
|
||||
|
@ -228,7 +228,7 @@ kbd_h(IN PLAYOUT Layout)
|
|||
gVersion,
|
||||
gSubVersion,
|
||||
asctime(Now));
|
||||
|
||||
|
||||
/* Print out the includes and defines */
|
||||
fprintf(FileHandle,
|
||||
"/*\n"
|
||||
|
@ -239,7 +239,7 @@ kbd_h(IN PLAYOUT Layout)
|
|||
"* Include the basis of all keyboard table values\n"
|
||||
"*/\n"
|
||||
"#include \"kbd.h\"\n");
|
||||
|
||||
|
||||
/* Now print out the virtual key conversion table */
|
||||
fprintf(FileHandle,
|
||||
"/***************************************************************************\\\n"
|
||||
|
@ -253,7 +253,7 @@ kbd_h(IN PLAYOUT Layout)
|
|||
"* | Scan | | kbd | kbd | kbd | kbd | kbd | kbd |\n"
|
||||
"* | code | | type 1 | type 2 | type 3 | type 4 | type 5 | type 6 |\n"
|
||||
"\\****+-------+_+----------+----------+----------+----------+----------+----------+*/\n\n");
|
||||
|
||||
|
||||
/* Loop all keys */
|
||||
for (i = 0; i < 110; i++)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ kbd_h(IN PLAYOUT Layout)
|
|||
printf("Weird scancode value %04x: expected xx, E0xx, or E1xx\n", SubCode);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Extended 1 */
|
||||
UndefChar = 'Y';
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ kbd_h(IN PLAYOUT Layout)
|
|||
/* Normal key */
|
||||
UndefChar = 'T';
|
||||
}
|
||||
|
||||
|
||||
/* Print out the virtual key redefinition */
|
||||
fprintf(FileHandle,
|
||||
"#undef %c%02X\n#define %c%02X _EQ(%43s%23s\n",
|
||||
|
@ -302,14 +302,14 @@ kbd_h(IN PLAYOUT Layout)
|
|||
Layout->Entry[i].ScanCode,
|
||||
getVKName(Layout->Entry[i].VirtualKey, 0),
|
||||
")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Cleanup and close */
|
||||
fprintf(FileHandle,"\n");
|
||||
fclose(FileHandle);
|
||||
|
||||
|
||||
/* We made it */
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -325,13 +325,13 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
ULONG Length;
|
||||
PCHAR p;
|
||||
PKEYNAME NextDescription, NextLanguage;
|
||||
|
||||
|
||||
/* Build the keyboard name and internal name */
|
||||
strcpy(OutputFile, gKBDName);
|
||||
strcat(OutputFile, ".RC");
|
||||
strcpy(InternalName, gKBDName);
|
||||
for (p = InternalName; *p; p++) *p = tolower(*p);
|
||||
|
||||
|
||||
/* Open it */
|
||||
FileHandle = fopen(OutputFile, "wb");
|
||||
if (!FileHandle)
|
||||
|
@ -340,24 +340,24 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
printf(" %12s : can't open for write.\n", OutputFile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Check if we have copyright */
|
||||
Length = strlen(gCopyright);
|
||||
if (!Length)
|
||||
{
|
||||
/* Set time string */
|
||||
strftime(TimeBuffer, 5, "%Y", Now);
|
||||
|
||||
|
||||
/* Add copyright character */
|
||||
strcpy(gCopyright, "(C)");
|
||||
|
||||
|
||||
/* Add the year */
|
||||
strcat(gCopyright, TimeBuffer);
|
||||
|
||||
|
||||
/* Add blank company */
|
||||
strcat(gCopyright, " ");
|
||||
}
|
||||
|
||||
|
||||
/* Write the resource file header */
|
||||
fprintf(FileHandle,
|
||||
"#include \"winver.h\"\r\n"
|
||||
|
@ -385,7 +385,7 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
gDescription,
|
||||
gVersion,
|
||||
gSubVersion);
|
||||
|
||||
|
||||
/* Continue writing it */
|
||||
fprintf(FileHandle,
|
||||
" VALUE \"InternalName\", \"%s (%d.%d)\\0\"\r\n"
|
||||
|
@ -410,7 +410,7 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
InternalName,
|
||||
gVersion,
|
||||
gSubVersion);
|
||||
|
||||
|
||||
/* Now check if we have a locale name */
|
||||
Length = strlen(gLocaleName);
|
||||
if (Length)
|
||||
|
@ -421,7 +421,7 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
9,
|
||||
1);
|
||||
fprintf(FileHandle, "BEGIN\r\n");
|
||||
|
||||
|
||||
/* Language or locale? */
|
||||
if (strchr(gLocaleName, '\"'))
|
||||
{
|
||||
|
@ -433,24 +433,24 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
/* Write the locale name */
|
||||
fprintf(FileHandle, " %d \"%s\"\r\n", gStringIdForLocaleName, gLocaleName);
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the entry */
|
||||
fprintf(FileHandle, "END\r\n\r\n");
|
||||
}
|
||||
|
||||
|
||||
/* Check for description information */
|
||||
while (DescriptionData)
|
||||
{
|
||||
/* Remember the next pointer */
|
||||
NextDescription = DescriptionData->Next;
|
||||
|
||||
|
||||
/* Write the header */
|
||||
fprintf(FileHandle,
|
||||
"\r\nSTRINGTABLE DISCARDABLE\r\nLANGUAGE %d, %d\r\n",
|
||||
DescriptionData->Code & 0x3FF,
|
||||
DescriptionData->Code >> 10);
|
||||
fprintf(FileHandle, "BEGIN\r\n");
|
||||
|
||||
|
||||
/* Quoted string or not? */
|
||||
if (strchr(DescriptionData->Name, '\"'))
|
||||
{
|
||||
|
@ -462,31 +462,31 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
/* Write the description name */
|
||||
fprintf(FileHandle, " %d \"%s\"\r\n", gStringIdForDescriptions, DescriptionData->Name);
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the entry */
|
||||
fprintf(FileHandle, "END\r\n\r\n");
|
||||
|
||||
|
||||
/* Free the allocation */
|
||||
free(DescriptionData->Name);
|
||||
free(DescriptionData);
|
||||
|
||||
|
||||
/* Move to the next entry */
|
||||
DescriptionData = NextDescription;
|
||||
}
|
||||
|
||||
|
||||
/* Check for language information */
|
||||
while (LanguageData)
|
||||
{
|
||||
/* Remember the next pointer */
|
||||
NextLanguage = LanguageData->Next;
|
||||
|
||||
|
||||
/* Write the header */
|
||||
fprintf(FileHandle,
|
||||
"\r\nSTRINGTABLE DISCARDABLE\r\nLANGUAGE %d, %d\r\n",
|
||||
LanguageData->Code & 0x3FF,
|
||||
LanguageData->Code >> 10);
|
||||
fprintf(FileHandle, "BEGIN\r\n");
|
||||
|
||||
|
||||
/* Quoted string or not? */
|
||||
if (strchr(LanguageData->Name, '\"'))
|
||||
{
|
||||
|
@ -498,18 +498,18 @@ kbd_rc(IN PKEYNAME DescriptionData,
|
|||
/* Write the language name */
|
||||
fprintf(FileHandle, " %d \"%s\"\r\n", gStringIdForLanguageNames, LanguageData->Name);
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the entry */
|
||||
fprintf(FileHandle, "END\r\n\r\n");
|
||||
|
||||
|
||||
/* Free the allocation */
|
||||
free(LanguageData->Name);
|
||||
free(LanguageData);
|
||||
|
||||
|
||||
/* Move to the next entry */
|
||||
LanguageData = NextLanguage;
|
||||
}
|
||||
|
||||
|
||||
/* We're done! */
|
||||
fclose(FileHandle);
|
||||
return TRUE;
|
||||
|
@ -520,11 +520,11 @@ kbd_def(VOID)
|
|||
{
|
||||
CHAR OutputFile[13];
|
||||
FILE *FileHandle;
|
||||
|
||||
|
||||
/* Build the keyboard name and internal name */
|
||||
strcpy(OutputFile, gKBDName);
|
||||
strcat(OutputFile, ".DEF");
|
||||
|
||||
|
||||
/* Open it */
|
||||
FileHandle = fopen(OutputFile, "wt");
|
||||
if (!FileHandle)
|
||||
|
@ -533,14 +533,14 @@ kbd_def(VOID)
|
|||
printf(" %12s : can't open for write.\n", OutputFile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Write the file exports */
|
||||
fprintf(FileHandle,
|
||||
"LIBRARY %s\n\n"
|
||||
"EXPORTS\n"
|
||||
" KbdLayerDescriptor @1\n",
|
||||
gKBDName);
|
||||
|
||||
|
||||
/* Clean up */
|
||||
fclose(FileHandle);
|
||||
return TRUE;
|
||||
|
@ -567,11 +567,11 @@ kbd_c(IN ULONG StateCount,
|
|||
ULONG HighestState;
|
||||
PVKNAME Entry;
|
||||
PCHAR p;
|
||||
|
||||
|
||||
/* Build the keyboard name and internal name */
|
||||
strcpy(OutputFile, gKBDName);
|
||||
strcat(OutputFile, ".C");
|
||||
|
||||
|
||||
/* Open it */
|
||||
FileHandle = fopen(OutputFile, "wt");
|
||||
if (!FileHandle)
|
||||
|
@ -580,7 +580,7 @@ kbd_c(IN ULONG StateCount,
|
|||
printf(" %12s : can't open for write.\n", OutputFile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Print the header */
|
||||
fprintf(FileHandle,
|
||||
"/***************************************************************************\\\n"
|
||||
|
@ -595,7 +595,7 @@ kbd_c(IN ULONG StateCount,
|
|||
gVersion,
|
||||
gSubVersion,
|
||||
asctime(Now));
|
||||
|
||||
|
||||
/* What kind of driver is this? */
|
||||
if (FallbackDriver)
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ kbd_c(IN ULONG StateCount,
|
|||
"#include <windows.h>\n"
|
||||
"#include \"kbd.h\"\n"
|
||||
"#include \"%s.h\"\n\n",
|
||||
gKBDName);
|
||||
gKBDName);
|
||||
}
|
||||
|
||||
/* What kind of driver is this? */
|
||||
|
@ -641,7 +641,7 @@ kbd_c(IN ULONG StateCount,
|
|||
"/***************************************************************************\\\n"
|
||||
"* ausVK[] - Virtual Scan Code to Virtual Key conversion table\n"
|
||||
"\\***************************************************************************/\n\n");
|
||||
|
||||
|
||||
/* Table begin */
|
||||
fprintf(FileHandle,
|
||||
"static ALLOC_SECTION_LDATA USHORT ausVK[] = {\n"
|
||||
|
@ -652,7 +652,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" T20, T21, T22, T23, T24, T25, T26, T27,\n"
|
||||
" T28, T29, T2A, T2B, T2C, T2D, T2E, T2F,\n"
|
||||
" T30, T31, T32, T33, T34, T35,\n\n");
|
||||
|
||||
|
||||
/* Table continue */
|
||||
fprintf(FileHandle,
|
||||
" /*\n"
|
||||
|
@ -662,7 +662,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" T37 | KBDMULTIVK, // numpad_* + Shift/Alt -> SnapShot\n\n"
|
||||
" T38, T39, T3A, T3B, T3C, T3D, T3E,\n"
|
||||
" T3F, T40, T41, T42, T43, T44,\n\n");
|
||||
|
||||
|
||||
/* Table continue */
|
||||
fprintf(FileHandle,
|
||||
" /*\n"
|
||||
|
@ -672,7 +672,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" */\n"
|
||||
" T45 | KBDEXT | KBDMULTIVK,\n\n"
|
||||
" T46 | KBDMULTIVK,\n\n");
|
||||
|
||||
|
||||
/* Numpad table */
|
||||
fprintf(FileHandle,
|
||||
" /*\n"
|
||||
|
@ -693,7 +693,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" T51 | KBDNUMPAD | KBDSPECIAL, // Numpad 3 (PgDn),\n"
|
||||
" T52 | KBDNUMPAD | KBDSPECIAL, // Numpad 0 (Ins),\n"
|
||||
" T53 | KBDNUMPAD | KBDSPECIAL, // Numpad . (Del),\n\n");
|
||||
|
||||
|
||||
/* Table finish */
|
||||
fprintf(FileHandle,
|
||||
" T54, T55, T56, T57, T58, T59, T5A, T5B,\n"
|
||||
|
@ -703,10 +703,10 @@ kbd_c(IN ULONG StateCount,
|
|||
" T74, T75, T76, T77, T78, T79, T7A, T7B,\n"
|
||||
" T7C, T7D, T7E\n\n"
|
||||
"};\n\n");
|
||||
|
||||
|
||||
/* Key name table header */
|
||||
fprintf(FileHandle, "static ALLOC_SECTION_LDATA VSC_VK aE0VscToVk[] = {\n");
|
||||
|
||||
|
||||
/* Loop 110-key table */
|
||||
for (i = 0; i < 110; i++)
|
||||
{
|
||||
|
@ -729,13 +729,13 @@ kbd_c(IN ULONG StateCount,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Key name table finish */
|
||||
fprintf(FileHandle, " { 0, 0 }\n};\n\n");
|
||||
|
||||
|
||||
/* Extended key name table header */
|
||||
fprintf(FileHandle, "static ALLOC_SECTION_LDATA VSC_VK aE1VscToVk[] = {\n");
|
||||
|
||||
|
||||
/* Loop 110-key table */
|
||||
for (i = 0; i < 110; i++)
|
||||
{
|
||||
|
@ -758,12 +758,12 @@ kbd_c(IN ULONG StateCount,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Extended key name table finish */
|
||||
fprintf(FileHandle,
|
||||
" { 0x1D, Y1D }, // Pause\n"
|
||||
" { 0 , 0 }\n};\n\n");
|
||||
|
||||
|
||||
/* Modifier table description */
|
||||
fprintf(FileHandle,
|
||||
"/***************************************************************************\\\n"
|
||||
|
@ -776,10 +776,10 @@ kbd_c(IN ULONG StateCount,
|
|||
"* CTRL (L & R) is used to generate control characters\n"
|
||||
"* ALT (L & R) used for generating characters by number with numpad\n"
|
||||
"\\***************************************************************************/\n");
|
||||
|
||||
|
||||
/* Modifier table header */
|
||||
fprintf(FileHandle, "static ALLOC_SECTION_LDATA VK_TO_BIT aVkToBits[] = {\n");
|
||||
|
||||
|
||||
/* Loop modifier table */
|
||||
i = 0;
|
||||
Entry = &Modifiers[0];
|
||||
|
@ -790,14 +790,14 @@ kbd_c(IN ULONG StateCount,
|
|||
" { %-12s, %-12s },\n",
|
||||
getVKName(Entry->VirtualKey, 1),
|
||||
Entry->Name);
|
||||
|
||||
|
||||
/* Move to the next one */
|
||||
Entry = &Modifiers[++i];
|
||||
}
|
||||
|
||||
|
||||
/* Modifier table finish */
|
||||
fprintf(FileHandle, " { 0, 0 }\n};\n\n");
|
||||
|
||||
|
||||
/* Modifier conversion table description */
|
||||
fprintf(FileHandle,
|
||||
"/***************************************************************************\\\n"
|
||||
|
@ -806,10 +806,10 @@ kbd_c(IN ULONG StateCount,
|
|||
"* See kbd.h for a full description.\n"
|
||||
"*\n"
|
||||
"\\***************************************************************************/\n\n");
|
||||
|
||||
|
||||
/* Zero out local state data */
|
||||
for (i = 0; i < 8; i++) States[i] = -1;
|
||||
|
||||
|
||||
/* Find the highest set state */
|
||||
for (HighestState = 1, i = 0; (i < 8) && (ShiftStates[i] != -1); i++)
|
||||
{
|
||||
|
@ -817,7 +817,7 @@ kbd_c(IN ULONG StateCount,
|
|||
States[ShiftStates[i]] = i;
|
||||
if (ShiftStates[i] > HighestState) HighestState = ShiftStates[i];
|
||||
}
|
||||
|
||||
|
||||
/* Modifier conversion table header */
|
||||
fprintf(FileHandle,
|
||||
"static ALLOC_SECTION_LDATA MODIFIERS CharModifiers = {\n"
|
||||
|
@ -827,7 +827,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" // Modification# // Keys Pressed\n"
|
||||
" // ============= // =============\n",
|
||||
HighestState);
|
||||
|
||||
|
||||
/* Loop states */
|
||||
for (i = 0; i <= HighestState; i++)
|
||||
{
|
||||
|
@ -843,14 +843,14 @@ kbd_c(IN ULONG StateCount,
|
|||
if (i == HighestState)
|
||||
{
|
||||
/* Last state header */
|
||||
fprintf(FileHandle, " %d // ", States[i]);
|
||||
fprintf(FileHandle, " %d // ", States[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Normal state header */
|
||||
fprintf(FileHandle, " %d, // ", States[i]);
|
||||
fprintf(FileHandle, " %d, // ", States[i]);
|
||||
}
|
||||
|
||||
|
||||
/* State 1 or higher? */
|
||||
if (i >= 1)
|
||||
{
|
||||
|
@ -864,34 +864,34 @@ kbd_c(IN ULONG StateCount,
|
|||
fprintf(FileHandle, "+");
|
||||
NeedPlus = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Check if it's time to add a modifier */
|
||||
if (i & k)
|
||||
{
|
||||
/* Get the key state name and copy it into our buffer */
|
||||
strcpy(KeyNameBuffer, getVKName(Modifiers[j].VirtualKey, 1));
|
||||
|
||||
|
||||
/* Go go the 4th char (past the "KBD") and lower name */
|
||||
for (p = &KeyNameBuffer[4]; *p; p++) *p = tolower(*p);
|
||||
|
||||
|
||||
/* Print it */
|
||||
fprintf(FileHandle, "%s", &KeyNameBuffer[3]);
|
||||
|
||||
|
||||
/* We'll need a plus sign next */
|
||||
NeedPlus = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the entry */
|
||||
fprintf(FileHandle, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Modifier conversion table end */
|
||||
fprintf(FileHandle," }\n" "};\n\n");
|
||||
|
||||
|
||||
/* Shift state translation table description */
|
||||
fprintf(FileHandle,
|
||||
"/***************************************************************************\\\n"
|
||||
|
@ -899,7 +899,7 @@ kbd_c(IN ULONG StateCount,
|
|||
"* aVkToWch2[] - Virtual Key to WCHAR translation for 2 shift states\n"
|
||||
"* aVkToWch3[] - Virtual Key to WCHAR translation for 3 shift states\n"
|
||||
"* aVkToWch4[] - Virtual Key to WCHAR translation for 4 shift states\n");
|
||||
|
||||
|
||||
/* Check if there's exta shift states */
|
||||
for (i = 5; i < HighestState; i++)
|
||||
{
|
||||
|
@ -909,7 +909,7 @@ kbd_c(IN ULONG StateCount,
|
|||
i,
|
||||
i);
|
||||
}
|
||||
|
||||
|
||||
/* Shift state translation table description continue */
|
||||
fprintf(FileHandle,
|
||||
"*\n"
|
||||
|
@ -931,7 +931,7 @@ kbd_c(IN ULONG StateCount,
|
|||
"* WCH_LGTR - Ligature (generates multiple characters)\n"
|
||||
"*\n"
|
||||
"\\***************************************************************************/\n\n");
|
||||
|
||||
|
||||
/* Loop all the states */
|
||||
for (i = 2; i <= StateCount; i++)
|
||||
{
|
||||
|
@ -945,42 +945,42 @@ kbd_c(IN ULONG StateCount,
|
|||
if (i == Layout->Entry[j].StateCount) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Print the table header */
|
||||
fprintf(FileHandle,
|
||||
"static ALLOC_SECTION_LDATA VK_TO_WCHARS%d aVkToWch%d[] = {\n"
|
||||
"// | | Shift |",
|
||||
i,
|
||||
i);
|
||||
|
||||
|
||||
/* Print the correct state label */
|
||||
for (k = 2; k < i; k++) fprintf(FileHandle, "%-9.9s|",
|
||||
StateLabel[ShiftStates[k]]);
|
||||
|
||||
|
||||
/* Print the next separator */
|
||||
fprintf(FileHandle, "\n// |=========|=========|");
|
||||
|
||||
|
||||
/* Check for extra states and print their separators too */
|
||||
for (k = 2; k < i; k++) fprintf(FileHandle, "=========|");
|
||||
|
||||
|
||||
/* Finalize the separator header */
|
||||
fprintf(FileHandle, "\n");
|
||||
|
||||
|
||||
/* Loop all the scan codes */
|
||||
for (j = 0; j < 110; j++)
|
||||
{
|
||||
/* Check if this is the state for the entry */
|
||||
if (i != Layout->Entry[j].StateCount) continue;
|
||||
|
||||
|
||||
/* Print out the entry for this key */
|
||||
fprintf(FileHandle,
|
||||
" {%-13s,%-7s",
|
||||
getVKName(Layout->Entry[j].VirtualKey, 1),
|
||||
CapState[Layout->Entry[j].Cap]);
|
||||
|
||||
|
||||
/* Initialize the buffer for this line */
|
||||
*LineBuffer = '\0';
|
||||
|
||||
|
||||
/* Loop states */
|
||||
for (k = 0; k < i; k++)
|
||||
{
|
||||
|
@ -991,7 +991,7 @@ kbd_c(IN ULONG StateCount,
|
|||
printf("Dead key data not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Check if it's a ligature key */
|
||||
if (Layout->Entry[j].LigatureCharData[k])
|
||||
{
|
||||
|
@ -999,19 +999,19 @@ kbd_c(IN ULONG StateCount,
|
|||
printf("Ligature key data not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Print out the WCH_ name */
|
||||
fprintf(FileHandle,
|
||||
",%-9s",
|
||||
WChName(Layout->Entry[j].CharData[k], 0));
|
||||
|
||||
|
||||
/* If we have something on the line buffer by now, add WCH_NONE */
|
||||
if (*LineBuffer != '\0') strcpy(LineBuffer, "WCH_NONE ");
|
||||
}
|
||||
|
||||
|
||||
/* Finish the line */
|
||||
fprintf(FileHandle, "},\n");
|
||||
|
||||
|
||||
/* Do we have any data at all? */
|
||||
if (*LineBuffer != '\0')
|
||||
{
|
||||
|
@ -1019,15 +1019,15 @@ kbd_c(IN ULONG StateCount,
|
|||
fprintf(FileHandle, "%s},\n", LineBuffer);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise, we're done, unless this requires SGCAP data */
|
||||
if (Layout->Entry[j].Cap != 2) continue;
|
||||
|
||||
|
||||
/* Not yet supported */
|
||||
printf("SGCAP not yet supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Did we only have two states? */
|
||||
if (i == 2)
|
||||
{
|
||||
|
@ -1039,7 +1039,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" {VK_MULTIPLY ,0 ,'*' ,'*' },\n"
|
||||
" {VK_SUBTRACT ,0 ,'-' ,'-' },\n");
|
||||
}
|
||||
|
||||
|
||||
/* Terminate the table */
|
||||
fprintf(FileHandle, " {0 ,0 ");
|
||||
for (k = 0; k < i; k++) fprintf(FileHandle, ",0 ");
|
||||
|
@ -1047,7 +1047,7 @@ kbd_c(IN ULONG StateCount,
|
|||
/* Terminate the structure */
|
||||
fprintf(FileHandle, "}\n" "};\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* Numpad translation table */
|
||||
fprintf(FileHandle,
|
||||
"// Put this last so that VkKeyScan interprets number characters\n"
|
||||
|
@ -1066,10 +1066,10 @@ kbd_c(IN ULONG StateCount,
|
|||
" { VK_NUMPAD9 , 0 , '9' },\n"
|
||||
" { 0 , 0 , '\\0' }\n"
|
||||
"};\n\n");
|
||||
|
||||
|
||||
/* Translation tables header */
|
||||
fprintf(FileHandle,"static ALLOC_SECTION_LDATA VK_TO_WCHAR_TABLE aVkToWcharTable[] = {\n");
|
||||
|
||||
|
||||
/* Loop states higher than 3 */
|
||||
for (i = 3; i <= StateCount; i++)
|
||||
{
|
||||
|
@ -1080,14 +1080,14 @@ kbd_c(IN ULONG StateCount,
|
|||
i,
|
||||
i);
|
||||
}
|
||||
|
||||
|
||||
/* Array of translation tables */
|
||||
fprintf(FileHandle,
|
||||
" { (PVK_TO_WCHARS1)aVkToWch2, 2, sizeof(aVkToWch2[0]) },\n"
|
||||
" { (PVK_TO_WCHARS1)aVkToWch1, 1, sizeof(aVkToWch1[0]) },\n"
|
||||
" { NULL, 0, 0 },\n"
|
||||
"};\n\n");
|
||||
|
||||
|
||||
/* Scan code to key name conversion table description */
|
||||
fprintf(FileHandle,
|
||||
"/***************************************************************************\\\n"
|
||||
|
@ -1098,33 +1098,33 @@ kbd_c(IN ULONG StateCount,
|
|||
"* Only the names of Extended, NumPad, Dead and Non-Printable keys are here.\n"
|
||||
"* (Keys producing printable characters are named by that character)\n"
|
||||
"\\***************************************************************************/\n\n");
|
||||
|
||||
|
||||
/* Check for key name data */
|
||||
if (KeyNameData)
|
||||
{
|
||||
/* Table header */
|
||||
fprintf(FileHandle, "static ALLOC_SECTION_LDATA VSC_LPWSTR aKeyNames[] = {\n");
|
||||
|
||||
|
||||
/* Print table */
|
||||
PrintNameTable(FileHandle, KeyNameData, FALSE);
|
||||
|
||||
|
||||
/* Table end */
|
||||
fprintf(FileHandle, "};\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* Check for extended key name data */
|
||||
if (KeyNameExtData)
|
||||
{
|
||||
/* Table header */
|
||||
fprintf(FileHandle, "static ALLOC_SECTION_LDATA VSC_LPWSTR aKeyNamesExt[] = {\n");
|
||||
|
||||
|
||||
/* Print table */
|
||||
PrintNameTable(FileHandle, KeyNameExtData, FALSE);
|
||||
|
||||
|
||||
/* Table end */
|
||||
fprintf(FileHandle, "};\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* Check for dead key name data */
|
||||
if (KeyNameDeadData)
|
||||
{
|
||||
|
@ -1132,7 +1132,7 @@ kbd_c(IN ULONG StateCount,
|
|||
printf("Dead key name data not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Check for dead key data */
|
||||
if (DeadKeyData)
|
||||
{
|
||||
|
@ -1140,7 +1140,7 @@ kbd_c(IN ULONG StateCount,
|
|||
printf("Dead key data not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Check for ligature data */
|
||||
if (LigatureData)
|
||||
{
|
||||
|
@ -1148,10 +1148,10 @@ kbd_c(IN ULONG StateCount,
|
|||
printf("Ligature key data not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Main keyboard table descriptor type */
|
||||
fprintf(FileHandle, "static ");
|
||||
|
||||
|
||||
/* FIXME? */
|
||||
|
||||
/* Main keyboard table descriptor header */
|
||||
|
@ -1169,7 +1169,7 @@ kbd_c(IN ULONG StateCount,
|
|||
" * Diacritics\n"
|
||||
" */\n",
|
||||
FallbackDriver ? "Fallback" : "" );
|
||||
|
||||
|
||||
/* Descriptor dead key data section */
|
||||
if (DeadKeyData)
|
||||
{
|
||||
|
@ -1179,13 +1179,13 @@ kbd_c(IN ULONG StateCount,
|
|||
{
|
||||
fprintf(FileHandle, " NULL,\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* Descriptor key name comment */
|
||||
fprintf(FileHandle,
|
||||
" /*\n"
|
||||
" * Names of Keys\n"
|
||||
" */\n");
|
||||
|
||||
|
||||
/* Descriptor key name section */
|
||||
if (KeyNameData)
|
||||
{
|
||||
|
@ -1195,7 +1195,7 @@ kbd_c(IN ULONG StateCount,
|
|||
{
|
||||
fprintf(FileHandle, " NULL,\n");
|
||||
}
|
||||
|
||||
|
||||
/* Descriptor extended key name section */
|
||||
if (KeyNameExtData)
|
||||
{
|
||||
|
@ -1205,7 +1205,7 @@ kbd_c(IN ULONG StateCount,
|
|||
{
|
||||
fprintf(FileHandle, " NULL,\n");
|
||||
}
|
||||
|
||||
|
||||
/* Descriptor dead key name section */
|
||||
if ((DeadKeyData) && (KeyNameDeadData))
|
||||
{
|
||||
|
@ -1215,7 +1215,7 @@ kbd_c(IN ULONG StateCount,
|
|||
{
|
||||
fprintf(FileHandle, " NULL,\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* Descriptor conversion table section */
|
||||
fprintf(FileHandle,
|
||||
" /*\n"
|
||||
|
@ -1228,15 +1228,15 @@ kbd_c(IN ULONG StateCount,
|
|||
" /*\n"
|
||||
" * Locale-specific special processing\n"
|
||||
" */\n");
|
||||
|
||||
|
||||
/* FIXME: AttributeData and KLLF_ALTGR stuff */
|
||||
|
||||
|
||||
/* Descriptor locale-specific section */
|
||||
fprintf(FileHandle, " MAKELONG(%s, KBD_VERSION),\n\n", "0"); /* FIXME */
|
||||
|
||||
|
||||
/* Descriptor ligature data comment */
|
||||
fprintf(FileHandle, " /*\n * Ligatures\n */\n %d,\n", 0); /* FIXME */
|
||||
|
||||
|
||||
/* Descriptor ligature data section */
|
||||
if (!LigatureData)
|
||||
{
|
||||
|
@ -1251,7 +1251,7 @@ kbd_c(IN ULONG StateCount,
|
|||
|
||||
/* Descriptor finish */
|
||||
fprintf(FileHandle, "};\n\n");
|
||||
|
||||
|
||||
/* Keyboard layout callback function */
|
||||
if (!FallbackDriver) fprintf(FileHandle,
|
||||
"PKBDTABLES KbdLayerDescriptor(VOID)\n"
|
||||
|
@ -1287,11 +1287,11 @@ DoOutput(IN ULONG StateCount,
|
|||
{
|
||||
/* 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,
|
||||
|
@ -1306,14 +1306,14 @@ DoOutput(IN ULONG StateCount,
|
|||
/* 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;
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ ULONG
|
|||
isKeyWord(PCHAR p)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
||||
/* Check if we know this keyword */
|
||||
for (i = 0; i < KEYWORD_COUNT; i++) if (strcmp(KeyWordList[i], p) == 0) break;
|
||||
|
||||
|
||||
/* If we didn't find anything, i will be KEYWORD_COUNT, which is invalid */
|
||||
return i;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ getVKName(IN ULONG VirtualKey,
|
|||
IN BOOLEAN Prefix)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
||||
/* Loop for standard virtual key */
|
||||
if (((VirtualKey >= 'A') && (VirtualKey <= 'Z')) ||
|
||||
((VirtualKey >= '0') && (VirtualKey <= '9')))
|
||||
|
@ -78,7 +78,7 @@ getVKName(IN ULONG VirtualKey,
|
|||
gVKeyName[3] = '\0';
|
||||
return gVKeyName;
|
||||
}
|
||||
|
||||
|
||||
/* Check if a prefix is required */
|
||||
if (Prefix)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ getVKName(IN ULONG VirtualKey,
|
|||
/* Otherwise, don't add anything */
|
||||
strcpy(gVKeyName, "");
|
||||
}
|
||||
|
||||
|
||||
/* Loop all virtual keys */
|
||||
for (i = 0; i < 36; i++)
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ getVKName(IN ULONG VirtualKey,
|
|||
return gVKeyName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* If we got here, then we failed, so print out an error name */
|
||||
strcpy(gVKeyName, "#ERROR#");
|
||||
return gVKeyName;
|
||||
|
@ -114,11 +114,11 @@ getVKNum(IN PCHAR p)
|
|||
ULONG Length;
|
||||
ULONG i;
|
||||
ULONG KeyNumber;
|
||||
|
||||
|
||||
/* Compute the length of the string */
|
||||
Length = strlen(p);
|
||||
if (!Length) return -1;
|
||||
|
||||
|
||||
/* Check if this is is a simple key */
|
||||
if (Length == 1)
|
||||
{
|
||||
|
@ -127,10 +127,10 @@ getVKNum(IN PCHAR p)
|
|||
|
||||
/* Otherwise, convert the letter to upper case */
|
||||
*p = toupper(*p);
|
||||
|
||||
|
||||
/* And make sure it's a valid letter */
|
||||
if ((*p >= 'A') && (*p <='Z')) return *p;
|
||||
|
||||
|
||||
/* Otherwise, fail */
|
||||
return -1;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ getVKNum(IN PCHAR p)
|
|||
/* Check if we have a match */
|
||||
if (!strcmp(VKName[i].Name, p)) return VKName[i].VirtualKey;
|
||||
}
|
||||
|
||||
|
||||
/* Check if this is a hex string */
|
||||
if ((*p == '0') && ((*(p + 1) == 'x') || (*(p + 1) == 'X')))
|
||||
{
|
||||
|
@ -163,10 +163,10 @@ getCharacterInfo(IN PCHAR State,
|
|||
ULONG CharInfo = CHAR_NORMAL_KEY;
|
||||
UCHAR StateChar;
|
||||
ULONG CharCode;
|
||||
|
||||
|
||||
/* Calculate the length of the state */
|
||||
Length = strlen(State);
|
||||
|
||||
|
||||
/* Check if this is at least a simple key state */
|
||||
if (Length > 1)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ getCharacterInfo(IN PCHAR State,
|
|||
CharInfo = CHAR_OTHER_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check if this is a numerical key state */
|
||||
if ((Length - 1) >= 2)
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ getCharacterInfo(IN PCHAR State,
|
|||
{
|
||||
/* Handle a ligature key */
|
||||
CharInfo = CHAR_LIGATURE_KEY;
|
||||
|
||||
|
||||
/* Not yet handled */
|
||||
printf("Ligatured character entries not yet supported!\n");
|
||||
exit(1);
|
||||
|
@ -225,29 +225,29 @@ getCharacterInfo(IN PCHAR State,
|
|||
/* Return the type of character this is */
|
||||
return CharInfo;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NextLine(PCHAR LineBuffer,
|
||||
ULONG BufferSize,
|
||||
FILE *File)
|
||||
{
|
||||
PCHAR p, pp;
|
||||
|
||||
|
||||
/* Scan each line */
|
||||
while (fgets(LineBuffer, BufferSize, File))
|
||||
{
|
||||
/* Remember it */
|
||||
gLineCount++;
|
||||
|
||||
|
||||
/* Reset the pointer at the beginning of the line */
|
||||
p = LineBuffer;
|
||||
p = LineBuffer;
|
||||
|
||||
/* Now bypass all whitespace (and tabspace) */
|
||||
while ((*p) && ((*p == ' ') || (*p == '\t'))) p++;
|
||||
|
||||
|
||||
/* If this is an old-style comment, skip the line */
|
||||
if (*p == ';') continue;
|
||||
|
||||
|
||||
/* Otherwise, check for new-style comment */
|
||||
pp = strstr(p, "//");
|
||||
if (pp)
|
||||
|
@ -262,11 +262,11 @@ NextLine(PCHAR LineBuffer,
|
|||
p = strchr(p, '\n');
|
||||
if (p) *p = '\0';
|
||||
}
|
||||
|
||||
|
||||
/* We have a line! */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* No line found */
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ SkipLines(VOID)
|
|||
{
|
||||
ULONG KeyWord;
|
||||
CHAR KeyWordChars[32];
|
||||
|
||||
|
||||
/* Scan each line, skipping it if it's not a keyword */
|
||||
while (NextLine(gBuf, sizeof(gBuf), gfpInput))
|
||||
{
|
||||
|
@ -288,21 +288,21 @@ SkipLines(VOID)
|
|||
if (KeyWord < KEYWORD_COUNT) return KeyWord;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* We skipped all the possible lines, not finding anything */
|
||||
return KEYWORD_COUNT;
|
||||
}
|
||||
|
||||
ULONG
|
||||
DoKBD(VOID)
|
||||
{
|
||||
{
|
||||
/* On Unicode files, we need to find the Unicode marker (FEEF) */
|
||||
ASSERT(UnicodeFile == FALSE);
|
||||
|
||||
|
||||
/* Initial values */
|
||||
*gKBDName = '\0';
|
||||
*gDescription = '\0';
|
||||
|
||||
|
||||
/* Scan for the values */
|
||||
if (sscanf(gBuf, "KBD %8s \"%40[^\"]\" %d", gKBDName, gDescription, &gID) < 2)
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ DoKBD(VOID)
|
|||
printf("Unable to read keyboard name or description.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("KBD Name: [%8s] Description: [%40s] ID: [%d]\n", gKBDName, gDescription, gID);
|
||||
return SkipLines();
|
||||
|
@ -318,14 +318,14 @@ DoKBD(VOID)
|
|||
|
||||
ULONG
|
||||
DoVERSION(VOID)
|
||||
{
|
||||
{
|
||||
/* Scan for the value */
|
||||
if (sscanf(gBuf, "VERSION %d", &gKbdLayoutVersion) < 1)
|
||||
{
|
||||
/* Couldn't find them */
|
||||
printf("Unable to read keyboard version information.\n");
|
||||
}
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("VERSION [%d]\n", gKbdLayoutVersion);
|
||||
return SkipLines();
|
||||
|
@ -333,17 +333,17 @@ DoVERSION(VOID)
|
|||
|
||||
ULONG
|
||||
DoCOPYRIGHT(VOID)
|
||||
{
|
||||
{
|
||||
/* Initial values */
|
||||
*gCopyright = '\0';
|
||||
|
||||
|
||||
/* Scan for the value */
|
||||
if (sscanf(gBuf, "COPYRIGHT \"%40[^\"]\"", gCopyright) < 1)
|
||||
{
|
||||
/* Couldn't find them */
|
||||
printf("Unable to read the specified COPYRIGHT string.\n");
|
||||
}
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("COPYRIGHT [%40s]\n", gCopyright);
|
||||
return SkipLines();
|
||||
|
@ -351,17 +351,17 @@ DoCOPYRIGHT(VOID)
|
|||
|
||||
ULONG
|
||||
DoCOMPANY(VOID)
|
||||
{
|
||||
{
|
||||
/* Initial values */
|
||||
*gCompany = '\0';
|
||||
|
||||
|
||||
/* Scan for the value */
|
||||
if (sscanf(gBuf, "COMPANY \"%85[^\"]\"", gCompany) < 1)
|
||||
{
|
||||
/* Couldn't find them */
|
||||
printf("Unable to read the specified COMPANY name.\n");
|
||||
}
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("COMPANY [%85s]\n", gCompany);
|
||||
return SkipLines();
|
||||
|
@ -369,17 +369,17 @@ DoCOMPANY(VOID)
|
|||
|
||||
ULONG
|
||||
DoLOCALENAME(VOID)
|
||||
{
|
||||
{
|
||||
/* Initial values */
|
||||
*gLocaleName = '\0';
|
||||
|
||||
|
||||
/* Scan for the value */
|
||||
if (sscanf(gBuf, "LOCALENAME \"%40[^\"]\"", gLocaleName) < 1)
|
||||
{
|
||||
/* Couldn't find them */
|
||||
printf("Unable to read the specified COPYRIGHT string.\n");
|
||||
}
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("LOCALENAME [%40s]\n", gLocaleName);
|
||||
return SkipLines();
|
||||
|
@ -393,23 +393,23 @@ DoDESCRIPTIONS(IN PKEYNAME* DescriptionData)
|
|||
ULONG LanguageCode;
|
||||
PCHAR p, pp;
|
||||
PKEYNAME Description;
|
||||
|
||||
|
||||
/* Assume nothing */
|
||||
*DescriptionData = 0;
|
||||
|
||||
|
||||
/* Start scanning */
|
||||
while (NextLine(gBuf, 256, gfpInput))
|
||||
{
|
||||
{
|
||||
/* Search for token */
|
||||
if (sscanf(gBuf, "%s", Token) != 1) continue;
|
||||
|
||||
|
||||
/* Make sure it's not just a comment */
|
||||
if (*Token == ';') continue;
|
||||
|
||||
|
||||
/* Make sure it's not a keyword */
|
||||
KeyWord = isKeyWord(Token);
|
||||
if (KeyWord < KEYWORD_COUNT) break;
|
||||
|
||||
|
||||
/* Now scan for the language code */
|
||||
if (sscanf(Token, " %4x", &LanguageCode) != 1)
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ DoDESCRIPTIONS(IN PKEYNAME* DescriptionData)
|
|||
printf("An invalid LANGID was specified.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Now get the actual description */
|
||||
if (sscanf(gBuf, " %*4x %s[^\n]", Token) != 1)
|
||||
{
|
||||
|
@ -425,15 +425,15 @@ DoDESCRIPTIONS(IN PKEYNAME* DescriptionData)
|
|||
printf("A language description is missing.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Get the description string and find the ending */
|
||||
p = strstr(gBuf, Token);
|
||||
pp = strchr(p, '\n');
|
||||
if (!pp) pp = strchr(p, '\r');
|
||||
|
||||
|
||||
/* Terminate the description string here */
|
||||
if (pp) *pp = 0;
|
||||
|
||||
|
||||
/* Now allocate the description */
|
||||
Description = malloc(sizeof(KEYNAME));
|
||||
if (!Description)
|
||||
|
@ -442,15 +442,15 @@ DoDESCRIPTIONS(IN PKEYNAME* DescriptionData)
|
|||
printf("Unable to allocate the KEYNAME struct (out of memory?).\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Fill out the structure */
|
||||
Description->Code = LanguageCode;
|
||||
Description->Name = strdup(p);
|
||||
Description->Next = NULL;
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("LANGID: [%4x] Description: [%s]\n", Description->Code, Description->Name);
|
||||
|
||||
|
||||
/* Point to it and advance the pointer */
|
||||
*DescriptionData = Description;
|
||||
DescriptionData = &Description->Next;
|
||||
|
@ -468,23 +468,23 @@ DoLANGUAGENAMES(IN PKEYNAME* LanguageData)
|
|||
ULONG LanguageCode;
|
||||
PCHAR p, pp;
|
||||
PKEYNAME Language;
|
||||
|
||||
|
||||
/* Assume nothing */
|
||||
*LanguageData = 0;
|
||||
|
||||
|
||||
/* Start scanning */
|
||||
while (NextLine(gBuf, 256, gfpInput))
|
||||
{
|
||||
{
|
||||
/* Search for token */
|
||||
if (sscanf(gBuf, "%s", Token) != 1) continue;
|
||||
|
||||
|
||||
/* Make sure it's not just a comment */
|
||||
if (*Token == ';') continue;
|
||||
|
||||
|
||||
/* Make sure it's not a keyword */
|
||||
KeyWord = isKeyWord(Token);
|
||||
if (KeyWord < KEYWORD_COUNT) break;
|
||||
|
||||
|
||||
/* Now scan for the language code */
|
||||
if (sscanf(Token, " %4x", &LanguageCode) != 1)
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ DoLANGUAGENAMES(IN PKEYNAME* LanguageData)
|
|||
printf("An invalid LANGID was specified.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Now get the actual language */
|
||||
if (sscanf(gBuf, " %*4x %s[^\n]", Token) != 1)
|
||||
{
|
||||
|
@ -500,15 +500,15 @@ DoLANGUAGENAMES(IN PKEYNAME* LanguageData)
|
|||
printf("A language name is missing\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Get the language string and find the ending */
|
||||
p = strstr(gBuf, Token);
|
||||
pp = strchr(p, '\n');
|
||||
if (!pp) pp = strchr(p, '\r');
|
||||
|
||||
|
||||
/* Terminate the language string here */
|
||||
if (pp) *pp = 0;
|
||||
|
||||
|
||||
/* Now allocate the language */
|
||||
Language = malloc(sizeof(KEYNAME));
|
||||
if (!Language)
|
||||
|
@ -517,20 +517,20 @@ DoLANGUAGENAMES(IN PKEYNAME* LanguageData)
|
|||
printf("Unable to allocate the KEYNAME struct (out of memory?).\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Fill out the structure */
|
||||
Language->Code = LanguageCode;
|
||||
Language->Name = strdup(p);
|
||||
Language->Next = NULL;
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("LANGID: [%4x] Name: [%s]\n", Language->Code, Language->Name);
|
||||
|
||||
|
||||
/* Point to it and advance the pointer */
|
||||
*LanguageData = Language;
|
||||
LanguageData = &Language->Next;
|
||||
}
|
||||
|
||||
|
||||
/* We are done */
|
||||
return KeyWord;
|
||||
}
|
||||
|
@ -543,23 +543,23 @@ DoKEYNAME(IN PKEYNAME* KeyNameData)
|
|||
ULONG CharacterCode;
|
||||
PCHAR p, pp;
|
||||
PKEYNAME KeyName;
|
||||
|
||||
|
||||
/* Assume nothing */
|
||||
*KeyNameData = 0;
|
||||
|
||||
|
||||
/* Start scanning */
|
||||
while (NextLine(gBuf, 256, gfpInput))
|
||||
{
|
||||
{
|
||||
/* Search for token */
|
||||
if (sscanf(gBuf, "%s", Token) != 1) continue;
|
||||
|
||||
|
||||
/* Make sure it's not just a comment */
|
||||
if (*Token == ';') continue;
|
||||
|
||||
|
||||
/* Make sure it's not a keyword */
|
||||
KeyWord = isKeyWord(Token);
|
||||
if (KeyWord < KEYWORD_COUNT) break;
|
||||
|
||||
|
||||
/* Now scan for the character code */
|
||||
if (sscanf(Token, " %4x", &CharacterCode) != 1)
|
||||
{
|
||||
|
@ -567,7 +567,7 @@ DoKEYNAME(IN PKEYNAME* KeyNameData)
|
|||
printf("An invalid character code was specified.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Now get the actual key name */
|
||||
if (sscanf(gBuf, " %*4x %s[^\n]", Token) != 1)
|
||||
{
|
||||
|
@ -575,15 +575,15 @@ DoKEYNAME(IN PKEYNAME* KeyNameData)
|
|||
printf("A key name is missing\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Get the key name string and find the ending */
|
||||
p = strstr(gBuf, Token);
|
||||
pp = strchr(p, '\n');
|
||||
if (!pp) pp = strchr(p, '\r');
|
||||
|
||||
|
||||
/* Terminate the key name string here */
|
||||
if (pp) *pp = 0;
|
||||
|
||||
|
||||
/* Now allocate the language */
|
||||
KeyName = malloc(sizeof(KEYNAME));
|
||||
if (!KeyName)
|
||||
|
@ -592,22 +592,22 @@ DoKEYNAME(IN PKEYNAME* KeyNameData)
|
|||
printf("Unable to allocate the KEYNAME struct (out of memory?).\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Fill out the structure */
|
||||
KeyName->Code = CharacterCode;
|
||||
KeyName->Name = strdup(p);
|
||||
KeyName->Next = NULL;
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("CHARCODE: [%4x] Name: [%s]\n", KeyName->Code, KeyName->Name);
|
||||
|
||||
|
||||
/* Point to it and advance the pointer */
|
||||
*KeyNameData = KeyName;
|
||||
KeyNameData = &KeyName->Next;
|
||||
}
|
||||
|
||||
|
||||
/* We are done */
|
||||
return KeyWord;
|
||||
return KeyWord;
|
||||
}
|
||||
|
||||
ULONG
|
||||
|
@ -618,23 +618,23 @@ DoSHIFTSTATE(IN PULONG StateCount,
|
|||
ULONG i;
|
||||
ULONG ShiftState;
|
||||
CHAR Token[32];
|
||||
|
||||
|
||||
/* Reset the shift states */
|
||||
for (i = 0; i < 8; i++) ShiftStates[i] = -1;
|
||||
|
||||
|
||||
/* Start with no states */
|
||||
*StateCount = 0;
|
||||
|
||||
|
||||
/* Scan for shift states */
|
||||
while (NextLine(gBuf, 256, gfpInput))
|
||||
{
|
||||
/* Search for token */
|
||||
if (sscanf(gBuf, "%s", Token) != 1) continue;
|
||||
|
||||
|
||||
/* Make sure it's not a keyword */
|
||||
KeyWord = isKeyWord(Token);
|
||||
if (KeyWord < KEYWORD_COUNT) break;
|
||||
|
||||
|
||||
/* Now scan for the shift state */
|
||||
if (sscanf(gBuf, " %1s[012367]", Token) != 1)
|
||||
{
|
||||
|
@ -642,10 +642,10 @@ DoSHIFTSTATE(IN PULONG StateCount,
|
|||
if (Verbose) printf("An invalid shift state '%s' was found (use 0, 1, 2, 3, 6, or 7.)\n", Token);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Now read the state */
|
||||
ShiftState = atoi(Token);
|
||||
|
||||
|
||||
/* Scan existing states */
|
||||
for (i = 0; i < *StateCount; i++)
|
||||
{
|
||||
|
@ -657,7 +657,7 @@ DoSHIFTSTATE(IN PULONG StateCount,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Make sure we won't overflow */
|
||||
if (*StateCount < 8)
|
||||
{
|
||||
|
@ -670,12 +670,12 @@ DoSHIFTSTATE(IN PULONG StateCount,
|
|||
if (Verbose) printf("There were too many states (you defined %d).\n", *StateCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Debug only */
|
||||
DPRINT1("Found %d Shift States: [", *StateCount);
|
||||
for (i = 0; i < *StateCount; i++) DPRINT1("%d ", ShiftStates[i]);
|
||||
DPRINT1("]\n");
|
||||
|
||||
|
||||
/* We are done */
|
||||
return KeyWord;
|
||||
}
|
||||
|
@ -727,24 +727,24 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
ULONG ScanCodeCount = -1;
|
||||
PLAYOUTENTRY Entry;
|
||||
UCHAR CharacterType, LigatureChar;
|
||||
|
||||
|
||||
/* Zero out the layout */
|
||||
memset(LayoutData, 0, sizeof(LAYOUT));
|
||||
|
||||
|
||||
/* Read each line */
|
||||
Entry = &LayoutData->Entry[0];
|
||||
while (NextLine(gBuf, 256, gfpInput))
|
||||
{
|
||||
/* Search for token */
|
||||
if (sscanf(gBuf, "%s", Token) != 1) continue;
|
||||
|
||||
|
||||
/* Make sure it's not just a comment */
|
||||
if (*Token == ';') continue;
|
||||
|
||||
|
||||
/* Make sure it's not a keyword */
|
||||
KeyWord = isKeyWord(Token);
|
||||
if (KeyWord < KEYWORD_COUNT) break;
|
||||
|
||||
|
||||
/* Now read the entry */
|
||||
TokenCount = sscanf(gBuf, " %x %s %s", &ScanCode, Token, Cap);
|
||||
if (TokenCount == 3)
|
||||
|
@ -763,7 +763,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
/* Simplified layout with no cap */
|
||||
FullEntry = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* One more */
|
||||
DPRINT1("RAW ENTRY: [%x %s %s]\n", ScanCode, Token, Cap);
|
||||
Entry++;
|
||||
|
@ -773,11 +773,11 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
printf("ScanCode %02x - too many scancodes here to parse.\n", ScanCode);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Fill out this entry */
|
||||
Entry->ScanCode = ScanCode;
|
||||
Entry->LineCount = gLineCount;
|
||||
|
||||
|
||||
/* Loop scancode table */
|
||||
for (i = 0; i < 110; i++)
|
||||
{
|
||||
|
@ -787,7 +787,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
{
|
||||
/* New code */
|
||||
if (Verbose) printf("A new scancode is being defined: 0x%2X, %s\n", Entry->ScanCode, Token);
|
||||
|
||||
|
||||
/* Fill out the entry */
|
||||
Entry->VirtualKey = getVKNum(Token);
|
||||
break;
|
||||
|
@ -801,7 +801,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
printf("Scancode %X was previously defined.\n", ScanCode);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Check if there is a valid virtual key */
|
||||
if (ScVk[i].VirtualKey == 0xFFFF)
|
||||
{
|
||||
|
@ -809,24 +809,24 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
printf("The Scancode you tried to use (%X) is reserved.\n", ScanCode);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Fill out the entry */
|
||||
Entry->OriginalVirtualKey = ScVk[i].VirtualKey;
|
||||
Entry->Name = ScVk[i].Name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* The entry is now processed */
|
||||
Entry->Processed = TRUE;
|
||||
ScVk[i].Processed = TRUE;
|
||||
|
||||
|
||||
/* Get the virtual key from the entry */
|
||||
VirtualKey = getVKNum(Token);
|
||||
Entry->VirtualKey = VirtualKey;
|
||||
DPRINT1("ENTRY: [%x %x %x %s] with ",
|
||||
Entry->VirtualKey, Entry->OriginalVirtualKey, Entry->ScanCode, Entry->Name);
|
||||
|
||||
|
||||
/* Make sure it's valid */
|
||||
if (VirtualKey == 0xFFFF)
|
||||
{
|
||||
|
@ -834,13 +834,13 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
if (Verbose) printf("An invalid Virtual Key '%s' was defined.\n", Token);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Is this a full entry */
|
||||
if (FullEntry)
|
||||
{
|
||||
/* Do we have SGCAP data? Set cap mode to 2 */
|
||||
if (!strcmp(Cap, "SGCAP")) *Cap = '2';
|
||||
|
||||
|
||||
/* Read the cap mode */
|
||||
if (sscanf(Cap, "%1d[012]", &Entry->Cap) != 1)
|
||||
{
|
||||
|
@ -849,7 +849,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read the states */
|
||||
Count = sscanf(gBuf,
|
||||
" %*s %*s %*s %s %s %s %s %s %s %s %s",
|
||||
|
@ -863,7 +863,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
State[7]);
|
||||
Entry->StateCount = Count;
|
||||
DPRINT1("%d STATES: [", Count);
|
||||
|
||||
|
||||
/* Check if there are less than 2 states */
|
||||
if ((Count < 2) && (FullEntry))
|
||||
{
|
||||
|
@ -871,7 +871,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
printf("You must have at least 2 characters.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Loop all states */
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
|
@ -883,7 +883,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
Entry->CharData[i] = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise, check what kind of character this is */
|
||||
CharacterType = getCharacterInfo(State[i],
|
||||
&Entry->CharData[i],
|
||||
|
@ -899,16 +899,16 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
Entry->OtherCharData[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check for sanity checks */
|
||||
DPRINT1("]\n");
|
||||
if (SanityCheck)
|
||||
{
|
||||
/* Not yet handled... */
|
||||
printf("Sanity checks not yet handled!\n");
|
||||
exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Check if we had SGCAP data */
|
||||
if (Entry->Cap & 2)
|
||||
{
|
||||
|
@ -917,7 +917,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Process the scan code table */
|
||||
Entry = &LayoutData->Entry[ScanCodeCount];
|
||||
for (i = 0; i < 110; i++)
|
||||
|
@ -925,7 +925,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
/* Get the scan code */
|
||||
CurrentCode = ScVk[i].ScanCode;
|
||||
if (CurrentCode == 0xFFFF) break;
|
||||
|
||||
|
||||
/* Check if this entry had been processed */
|
||||
if (ScVk[i].Processed)
|
||||
{
|
||||
|
@ -939,9 +939,9 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
{
|
||||
/* Fail */
|
||||
printf("ScanCode %02x - too many scancodes here to parse.\n", CurrentCode);
|
||||
exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Build an entry for it */
|
||||
Entry++;
|
||||
Entry->ScanCode = CurrentCode;
|
||||
|
@ -954,7 +954,7 @@ DoLAYOUT(IN PLAYOUT LayoutData,
|
|||
Entry->VirtualKey, Entry->ScanCode, Entry->Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Skip what's left */
|
||||
return KeyWord;
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ DoParsing(VOID)
|
|||
PKEYNAME DescriptionData = NULL, LanguageData = NULL;
|
||||
PKEYNAME KeyNameData = NULL, KeyNameExtData = NULL, KeyNameDeadData = NULL;
|
||||
PVOID AttributeData = NULL, LigatureData = NULL, DeadKeyData = NULL;
|
||||
|
||||
|
||||
/* Parse keywords */
|
||||
gLineCount = 0;
|
||||
KeyWord = SkipLines();
|
||||
|
@ -986,7 +986,7 @@ DoParsing(VOID)
|
|||
{
|
||||
/* Save this keyword */
|
||||
KeyWords[KeyWord]++;
|
||||
|
||||
|
||||
/* Check for duplicate entires, other than DEADKEY, which is okay */
|
||||
if ((KeyWord != 9) && (KeyWords[KeyWord] > 1) && (Verbose))
|
||||
{
|
||||
|
@ -1000,49 +1000,49 @@ DoParsing(VOID)
|
|||
{
|
||||
/* KBD */
|
||||
case 0:
|
||||
|
||||
|
||||
DPRINT1("Found KBD section\n");
|
||||
KeyWord = DoKBD();
|
||||
break;
|
||||
|
||||
|
||||
/* VERSION */
|
||||
case 1:
|
||||
|
||||
|
||||
DPRINT1("Found VERSION section\n");
|
||||
KeyWord = DoVERSION();
|
||||
break;
|
||||
|
||||
|
||||
/* COPYRIGHT */
|
||||
case 2:
|
||||
|
||||
|
||||
DPRINT1("Found COPYRIGHT section\n");
|
||||
KeyWord = DoCOPYRIGHT();
|
||||
break;
|
||||
|
||||
|
||||
/* COMPANY */
|
||||
case 3:
|
||||
|
||||
|
||||
DPRINT1("Found COMPANY section\n");
|
||||
KeyWord = DoCOMPANY();
|
||||
break;
|
||||
|
||||
|
||||
/* LOCALENAME */
|
||||
case 4:
|
||||
|
||||
|
||||
DPRINT1("Found LOCALENAME section\n");
|
||||
KeyWord = DoLOCALENAME();
|
||||
break;
|
||||
|
||||
|
||||
/* MODIFIERS */
|
||||
case 5:
|
||||
|
||||
|
||||
DPRINT1("Found MODIFIERS section\n");
|
||||
KeyWord = DoMODIFIERS();
|
||||
break;
|
||||
|
||||
|
||||
/* SHIFTSTATE */
|
||||
case 6:
|
||||
|
||||
|
||||
DPRINT1("Found SHIFTSTATE section\n");
|
||||
KeyWord = DoSHIFTSTATE(&StateCount, ShiftStates);
|
||||
if (StateCount < 2)
|
||||
|
@ -1053,89 +1053,89 @@ DoParsing(VOID)
|
|||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/* ATTRIBUTES */
|
||||
case 7:
|
||||
|
||||
|
||||
DPRINT1("Found ATTRIBUTES section\n");
|
||||
KeyWord = DoATTRIBUTES(&AttributeData);
|
||||
break;
|
||||
|
||||
|
||||
/* LAYOUT */
|
||||
case 8:
|
||||
|
||||
|
||||
DPRINT1("Found LAYOUT section\n");
|
||||
KeyWord = DoLAYOUT(&g_Layout,
|
||||
&LigatureData,
|
||||
ShiftStates,
|
||||
StateCount);
|
||||
break;
|
||||
|
||||
|
||||
/* DEADKEY */
|
||||
case 9:
|
||||
|
||||
|
||||
DPRINT1("Found DEADKEY section\n");
|
||||
KeyWord = DoDEADKEY(&DeadKeyData);
|
||||
break;
|
||||
|
||||
|
||||
/* LIGATURE */
|
||||
case 10:
|
||||
|
||||
|
||||
DPRINT1("Found LIGATURE section\n");
|
||||
KeyWord = DoLIGATURE(&LigatureData);
|
||||
break;
|
||||
|
||||
|
||||
/* KEYNAME */
|
||||
case 11:
|
||||
|
||||
|
||||
DPRINT1("Found KEYNAME section\n");
|
||||
KeyWord = DoKEYNAME(&KeyNameData);
|
||||
break;
|
||||
|
||||
|
||||
/* KEYNAME_EXT */
|
||||
case 12:
|
||||
|
||||
|
||||
DPRINT1("Found KEYNAME_EXT section\n");
|
||||
KeyWord = DoKEYNAME(&KeyNameExtData);
|
||||
break;
|
||||
|
||||
|
||||
/* KEYNAME_DEAD */
|
||||
case 13:
|
||||
|
||||
|
||||
DPRINT1("Found KEYNAME_DEAD section\n");
|
||||
KeyWord = DoKEYNAME(&KeyNameDeadData);
|
||||
break;
|
||||
|
||||
|
||||
/* DESCRIPTIONS */
|
||||
case 14:
|
||||
|
||||
|
||||
DPRINT1("Found DESCRIPTIONS section\n");
|
||||
KeyWord = DoDESCRIPTIONS(&DescriptionData);
|
||||
break;
|
||||
|
||||
|
||||
/* LANGUAGENAMES */
|
||||
case 15:
|
||||
|
||||
|
||||
DPRINT1("Found LANGUAGENAMES section\n");
|
||||
KeyWord = DoLANGUAGENAMES(&LanguageData);
|
||||
break;
|
||||
|
||||
|
||||
/* ENDKBD */
|
||||
case 16:
|
||||
|
||||
|
||||
DPRINT1("Found ENDKBD section\n");
|
||||
KeyWord = SkipLines();
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* We are done */
|
||||
fclose(gfpInput);
|
||||
|
||||
|
||||
/* Now enter the output phase */
|
||||
return DoOutput(StateCount,
|
||||
ShiftStates,
|
||||
|
|
Loading…
Reference in a new issue