Begin implementing Keyboard Layout Compiler Tool, as requested by KJK::Hyperion....
authorArch Blackmann <ablackmann@svn.reactos.org>
Sat, 31 Oct 2009 18:13:26 +0000 (18:13 +0000)
committerArch Blackmann <ablackmann@svn.reactos.org>
Sat, 31 Oct 2009 18:13:26 +0000 (18:13 +0000)
svn path=/trunk/; revision=43880

reactos/tools/kbdtool/kbdtool.rbuild [new file with mode: 0644]
reactos/tools/kbdtool/main.c [new file with mode: 0644]
reactos/tools/kbdtool/output.c [new file with mode: 0644]
reactos/tools/kbdtool/parser.c [new file with mode: 0644]
reactos/tools/tools.rbuild

diff --git a/reactos/tools/kbdtool/kbdtool.rbuild b/reactos/tools/kbdtool/kbdtool.rbuild
new file mode 100644 (file)
index 0000000..ca23163
--- /dev/null
@@ -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>
\ No newline at end of file
diff --git a/reactos/tools/kbdtool/main.c b/reactos/tools/kbdtool/main.c
new file mode 100644 (file)
index 0000000..d89a674
--- /dev/null
@@ -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 */
diff --git a/reactos/tools/kbdtool/output.c b/reactos/tools/kbdtool/output.c
new file mode 100644 (file)
index 0000000..c3c1fd0
--- /dev/null
@@ -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 */
diff --git a/reactos/tools/kbdtool/parser.c b/reactos/tools/kbdtool/parser.c
new file mode 100644 (file)
index 0000000..39ea3fb
--- /dev/null
@@ -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 */
index 164f65d..51025be 100644 (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>