Introduce ExprResolveVModMask
Which is just a slightly more typesafe wrapper around the chained ExprResolveModMask everyone was using earlier. Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
fbb82199ee
commit
67605d2c90
|
@ -383,7 +383,7 @@ CheckModifierField(struct xkb_desc * xkb,
|
|||
return True;
|
||||
}
|
||||
}
|
||||
if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(value, &rtrn, xkb))
|
||||
return ReportMismatch(action, F_Modifiers, "modifier mask");
|
||||
*mods_rtrn = rtrn.uval;
|
||||
*flags_inout &= ~XkbSA_UseModMapMods;
|
||||
|
|
|
@ -711,7 +711,7 @@ HandleGroupCompatDef(GroupCompatDef * def,
|
|||
}
|
||||
tmp.fileID = info->fileID;
|
||||
tmp.merge = merge;
|
||||
if (!ExprResolveModMask(def->def, &val, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(def->def, &val, xkb))
|
||||
{
|
||||
ERROR("Expected a modifier mask in group compatibility definition\n");
|
||||
ACTION("Ignoring illegal compatibility map for group %d\n",
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "xkbmisc.h"
|
||||
#include "tokens.h"
|
||||
#include "expr.h"
|
||||
#include "vmod.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -276,6 +277,19 @@ ExprResolveModMask(ExprDef * expr,
|
|||
return ExprResolveMask(expr, val_rtrn, LookupModMask, (char *) & priv);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveVModMask(ExprDef * expr,
|
||||
ExprResult * val_rtrn,
|
||||
struct xkb_desc *xkb)
|
||||
{
|
||||
LookupPriv priv;
|
||||
|
||||
priv.priv = NULL;
|
||||
priv.chain = LookupVModMask;
|
||||
priv.chainPriv = (char *) xkb;
|
||||
return ExprResolveMask(expr, val_rtrn, LookupModMask, (char *) & priv);
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveBoolean(ExprDef * expr,
|
||||
ExprResult * val_rtrn,
|
||||
|
|
|
@ -99,6 +99,11 @@ extern int ExprResolveModMask(ExprDef * /* expr */ ,
|
|||
char * /* priv */
|
||||
);
|
||||
|
||||
extern int ExprResolveVModMask(ExprDef * /* expr */ ,
|
||||
ExprResult * /* val_rtrn */ ,
|
||||
struct xkb_desc * /* xkb */
|
||||
);
|
||||
|
||||
extern int ExprResolveBoolean(ExprDef * /* expr */ ,
|
||||
ExprResult * /* val_rtrn */ ,
|
||||
IdentLookupFunc /* lookup */ ,
|
||||
|
|
|
@ -211,7 +211,7 @@ SetIndicatorMapField(LEDInfo * led,
|
|||
{
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(led, field);
|
||||
if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(value, &rtrn, xkb))
|
||||
return ReportIndicatorBadType(led, field, "modifier mask");
|
||||
led->real_mods = rtrn.uval & 0xff;
|
||||
led->vmods = (rtrn.uval >> 8) & 0xff;
|
||||
|
|
|
@ -666,7 +666,7 @@ SetMapEntry(KeyTypeInfo * type,
|
|||
|
||||
if (arrayNdx == NULL)
|
||||
return ReportTypeShouldBeArray(type, "map entry");
|
||||
if (!ExprResolveModMask(arrayNdx, &rtrn, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(arrayNdx, &rtrn, xkb))
|
||||
return ReportTypeBadType(type, "map entry", "modifier mask");
|
||||
entry.mods.real_mods = rtrn.uval & 0xff; /* modifiers < 512 */
|
||||
entry.mods.vmods = (rtrn.uval >> 8) & 0xffff; /* modifiers > 512 */
|
||||
|
@ -712,7 +712,7 @@ SetPreserve(KeyTypeInfo * type,
|
|||
|
||||
if (arrayNdx == NULL)
|
||||
return ReportTypeShouldBeArray(type, "preserve entry");
|
||||
if (!ExprResolveModMask(arrayNdx, &rtrn, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(arrayNdx, &rtrn, xkb))
|
||||
return ReportTypeBadType(type, "preserve entry", "modifier mask");
|
||||
new.defs = type->defs;
|
||||
new.defs.next = NULL;
|
||||
|
@ -731,7 +731,7 @@ SetPreserve(KeyTypeInfo * type,
|
|||
if (warningLevel > 0)
|
||||
INFO("%s\n", PreserveIndexTxt(xkb, &new));
|
||||
}
|
||||
if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(value, &rtrn, xkb))
|
||||
{
|
||||
ERROR("Preserve value in a key type is not a modifier mask\n");
|
||||
ACTION("Ignoring preserve[%s] in type %s\n",
|
||||
|
@ -869,7 +869,7 @@ SetKeyTypeField(KeyTypeInfo * type,
|
|||
ACTION("Illegal array subscript ignored\n");
|
||||
}
|
||||
/* get modifier mask for current type */
|
||||
if (!ExprResolveModMask(value, &tmp, LookupVModMask, (char *) xkb))
|
||||
if (!ExprResolveVModMask(value, &tmp, xkb))
|
||||
{
|
||||
ERROR("Key type mask field must be a modifier mask\n");
|
||||
ACTION("Key type definition ignored\n");
|
||||
|
|
|
@ -1175,7 +1175,7 @@ SetSymbolsField(KeyInfo * key,
|
|||
(uStrCaseCmp(field, "virtualmods") == 0) ||
|
||||
(uStrCaseCmp(field, "virtualmodifiers") == 0))
|
||||
{
|
||||
ok = ExprResolveModMask(value, &tmp, LookupVModMask, (char *) xkb);
|
||||
ok = ExprResolveVModMask(value, &tmp, xkb);
|
||||
if (ok)
|
||||
{
|
||||
key->vmodmap = (tmp.uval >> 8);
|
||||
|
|
Loading…
Reference in New Issue