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>
master
Daniel Stone 2012-02-15 19:39:33 +00:00
parent eb8c96cbd9
commit 83f18b1c3a
5 changed files with 9 additions and 23 deletions

View File

@ -636,19 +636,10 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_desc * xkb, KeyNamesInfo *
static int static int
HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info) HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
{ {
int code; if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
ExprResult result; (info->explicitMax != 0 && stmt->value > info->explicitMax))
if (!ExprResolveKeyCode(stmt->value, &result))
{ {
ACTION("No value keycode assigned to name <%s>\n", stmt->name); ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
return 0;
}
code = result.uval;
if ((info->explicitMin != 0 && code < info->explicitMin) ||
(info->explicitMax != 0 && code > info->explicitMax))
{
ERROR("Illegal keycode %d for name <%s>\n", code, stmt->name);
ACTION("Must be in the range %d-%d inclusive\n", ACTION("Must be in the range %d-%d inclusive\n",
info->explicitMin, info->explicitMin,
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX); info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
@ -661,7 +652,8 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
else else
merge = stmt->merge; 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 #define MIN_KEYCODE_DEF 0

View File

@ -120,7 +120,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
} }
KeycodeDef * KeycodeDef *
KeycodeCreate(char *name, ExprDef * value) KeycodeCreate(char *name, unsigned long value)
{ {
KeycodeDef *def; KeycodeDef *def;

View File

@ -31,6 +31,7 @@
extern char scanBuf[1024]; extern char scanBuf[1024];
extern int scanInt; extern int scanInt;
extern unsigned long scanULong;
extern int lineNum; extern int lineNum;
extern XkbFile *rtrnValue; extern XkbFile *rtrnValue;
@ -65,7 +66,7 @@ extern ExprDef *ExprCreateBinary(unsigned /* op */ ,
); );
extern KeycodeDef *KeycodeCreate(char * /* name */ , extern KeycodeDef *KeycodeCreate(char * /* name */ ,
ExprDef * /* value */ unsigned long /* value */
); );
extern KeyAliasDef *KeyAliasCreate(char * /* alias */ , extern KeyAliasDef *KeyAliasCreate(char * /* alias */ ,

View File

@ -192,7 +192,7 @@ typedef struct _KeycodeDef
ParseCommon common; ParseCommon common;
unsigned merge; unsigned merge;
char name[5]; char name[5];
ExprDef *value; unsigned long value;
} KeycodeDef; } KeycodeDef;
typedef struct _KeyAliasDef typedef struct _KeyAliasDef

View File

@ -707,13 +707,6 @@ Terminal : String
free($1); free($1);
$$= expr; $$= expr;
} }
| KeyCode
{
ExprDef *expr;
expr= ExprCreate(ExprValue,TypeKeyCode);
expr->value.uval= $1;
$$= expr;
}
; ;
OptKeySymList : KeySymList { $$= $1; } OptKeySymList : KeySymList { $$= $1; }