Fix xkbparse.y compilation
authorDaniel Stone <daniel@fooishbar.org>
Wed, 15 Feb 2012 19:39:33 +0000 (19:39 +0000)
committerDaniel Stone <daniel@fooishbar.org>
Wed, 15 Feb 2012 19:39:33 +0000 (19:39 +0000)
Thanks to autotools happily building stale generated sources, I hadn't
actually ever built my xkbparse.y changes.  Fix that so it not only
compiles, but works.  This seems to parse long keycodes correctly,
although I very much would not recommend testing this by declaring
0x1fffffff as your highest keycode.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/xkbcomp/keycodes.c
src/xkbcomp/parseutils.c
src/xkbcomp/parseutils.h
src/xkbcomp/xkbcomp.h
src/xkbcomp/xkbparse.y

index be1e3b6..c8bbadc 100644 (file)
@@ -636,19 +636,10 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_desc * xkb, KeyNamesInfo *
 static int
 HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
 {
-    int code;
-    ExprResult result;
-
-    if (!ExprResolveKeyCode(stmt->value, &result))
-    {
-        ACTION("No value keycode assigned to name <%s>\n", stmt->name);
-        return 0;
-    }
-    code = result.uval;
-    if ((info->explicitMin != 0 && code < info->explicitMin) ||
-        (info->explicitMax != 0 && code > info->explicitMax))
+    if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
+        (info->explicitMax != 0 && stmt->value > info->explicitMax))
     {
-        ERROR("Illegal keycode %d for name <%s>\n", code, stmt->name);
+        ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
         ACTION("Must be in the range %d-%d inclusive\n",
                 info->explicitMin,
                 info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
@@ -661,7 +652,8 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
         else
             merge = stmt->merge;
     }
-    return AddKeyName(info, code, stmt->name, merge, info->fileID, True);
+    return AddKeyName(info, stmt->value, stmt->name, merge, info->fileID,
+                      True);
 }
 
 #define        MIN_KEYCODE_DEF         0
index c8491e7..69b8a5c 100644 (file)
@@ -120,7 +120,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
 }
 
 KeycodeDef *
-KeycodeCreate(char *name, ExprDef * value)
+KeycodeCreate(char *name, unsigned long value)
 {
     KeycodeDef *def;
 
index c0a78df..dbaf683 100644 (file)
@@ -31,6 +31,7 @@
 
 extern char scanBuf[1024];
 extern int scanInt;
+extern unsigned long scanULong;
 extern int lineNum;
 
 extern XkbFile *rtrnValue;
@@ -65,7 +66,7 @@ extern ExprDef *ExprCreateBinary(unsigned /* op */ ,
     );
 
 extern KeycodeDef *KeycodeCreate(char * /* name */ ,
-                                 ExprDef *      /* value */
+                                 unsigned long /* value */
     );
 
 extern KeyAliasDef *KeyAliasCreate(char * /* alias */ ,
index 3772a88..502b0ba 100644 (file)
@@ -192,7 +192,7 @@ typedef struct _KeycodeDef
     ParseCommon common;
     unsigned merge;
     char name[5];
-    ExprDef *value;
+    unsigned long value;
 } KeycodeDef;
 
 typedef struct _KeyAliasDef
index 4214e9c..5634fb7 100644 (file)
@@ -707,13 +707,6 @@ Terminal   :       String
                            free($1);
                            $$= expr;
                        }
-                |       KeyCode
-                        {
-                            ExprDef *expr;
-                            expr= ExprCreate(ExprValue,TypeKeyCode);
-                            expr->value.uval= $1;
-                            $$= expr;
-                        }
                ;
 
 OptKeySymList  :       KeySymList                      { $$= $1; }