Commit 83f18b1c3abce7bd47f9b72c56cf0a01102f8569

Daniel Stone 2012-02-15T19:39:33

Fix xkbparse.y compilation 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>

diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index be1e3b6..c8bbadc 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -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
diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c
index c8491e7..69b8a5c 100644
--- a/src/xkbcomp/parseutils.c
+++ b/src/xkbcomp/parseutils.c
@@ -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;
 
diff --git a/src/xkbcomp/parseutils.h b/src/xkbcomp/parseutils.h
index c0a78df..dbaf683 100644
--- a/src/xkbcomp/parseutils.h
+++ b/src/xkbcomp/parseutils.h
@@ -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 */ ,
diff --git a/src/xkbcomp/xkbcomp.h b/src/xkbcomp/xkbcomp.h
index 3772a88..502b0ba 100644
--- a/src/xkbcomp/xkbcomp.h
+++ b/src/xkbcomp/xkbcomp.h
@@ -192,7 +192,7 @@ typedef struct _KeycodeDef
     ParseCommon common;
     unsigned merge;
     char name[5];
-    ExprDef *value;
+    unsigned long value;
 } KeycodeDef;
 
 typedef struct _KeyAliasDef
diff --git a/src/xkbcomp/xkbparse.y b/src/xkbcomp/xkbparse.y
index 4214e9c..5634fb7 100644
--- a/src/xkbcomp/xkbparse.y
+++ b/src/xkbcomp/xkbparse.y
@@ -707,13 +707,6 @@ Terminal	:	String
 			    free($1);
 			    $$= expr;
 			}
-                |       KeyCode
-                        {
-                            ExprDef *expr;
-                            expr= ExprCreate(ExprValue,TypeKeyCode);
-                            expr->value.uval= $1;
-                            $$= expr;
-                        }
 		;
 
 OptKeySymList	:	KeySymList			{ $$= $1; }