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
HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
{
int code;
ExprResult result;
if (!ExprResolveKeyCode(stmt->value, &result))
if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
(info->explicitMax != 0 && stmt->value > info->explicitMax))
{
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))
{
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

View 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;

View 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 */ ,

View File

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

View 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; }