Interp: More lazy keysym resolution

Resolve the keysyms when we create an InterpDef, rather than directly
in the parser.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2010-06-21 14:27:58 +01:00
parent 2c4a045aca
commit b38525421f
4 changed files with 12 additions and 6 deletions

View File

@ -35,6 +35,7 @@
#include "indicators.h"
#include "action.h"
#include "compat.h"
#include "parseutils.h"
typedef struct _SymInterpInfo
{
@ -667,7 +668,12 @@ HandleInterpDef(InterpDef * def, XkbcDescPtr xkb, unsigned merge,
si = info->dflt;
si.defs.merge = merge;
si.interp.sym = def->sym;
if (!LookupKeysym(def->sym, &si.interp.sym))
{
WARN("Could not resolve keysym %s\n", def->sym);
info->errorCount++;
return False;
}
si.interp.match = pred & XkbSI_OpMask;
si.interp.mods = mods;
if (!HandleInterpBody(def->def, xkb, &si, info))

View File

@ -219,7 +219,7 @@ BoolVarCreate(Atom nameToken, unsigned set)
}
InterpDef *
InterpCreate(CARD32 sym, ExprDef * match)
InterpCreate(char *sym, ExprDef * match)
{
InterpDef *def;
@ -228,7 +228,7 @@ InterpCreate(CARD32 sym, ExprDef * match)
{
def->common.stmtType = StmtInterpDef;
def->common.next = NULL;
def->sym = sym;
def->sym = strdup(sym);
def->match = match;
}
else

View File

@ -88,7 +88,7 @@ extern VarDef *BoolVarCreate(Atom /* nameToken */ ,
unsigned /* set */
);
extern InterpDef *InterpCreate(CARD32 /* sym */ ,
extern InterpDef *InterpCreate(char * /* sym */ ,
ExprDef * /* match */
);

View File

@ -376,9 +376,9 @@ InterpretDecl : INTERPRET InterpretMatch OBRACE
;
InterpretMatch : KeySym PLUS Expr
{ $$= InterpCreate(XStringToKeysym($1), $3); }
{ $$= InterpCreate($1, $3); }
| KeySym
{ $$= InterpCreate(XStringToKeysym($1), NULL); }
{ $$= InterpCreate($1, NULL); }
;
VarDeclList : VarDeclList VarDecl