Use enum for merge mode
The merge mode shows up in a lot of functions, so it's useful to give it a distinct type. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
48b4d30aa3
commit
213dcf686f
|
@ -43,7 +43,7 @@ HandleCollision(AliasInfo * old, AliasInfo * new)
|
|||
else
|
||||
{
|
||||
char *use, *ignore;
|
||||
if (new->def.merge == MergeAugment)
|
||||
if (new->def.merge == MERGE_AUGMENT)
|
||||
{
|
||||
use = old->real;
|
||||
ignore = new->real;
|
||||
|
@ -70,7 +70,7 @@ HandleCollision(AliasInfo * old, AliasInfo * new)
|
|||
|
||||
static void
|
||||
InitAliasInfo(AliasInfo * info,
|
||||
unsigned merge, unsigned file_id, char *alias, char *real)
|
||||
enum merge_mode merge, unsigned file_id, char *alias, char *real)
|
||||
{
|
||||
memset(info, 0, sizeof(AliasInfo));
|
||||
info->def.merge = merge;
|
||||
|
@ -81,7 +81,7 @@ InitAliasInfo(AliasInfo * info,
|
|||
|
||||
int
|
||||
HandleAliasDef(KeyAliasDef * def,
|
||||
unsigned merge, unsigned file_id, AliasInfo ** info_in)
|
||||
enum merge_mode merge, unsigned file_id, AliasInfo ** info_in)
|
||||
{
|
||||
AliasInfo *info;
|
||||
|
||||
|
@ -134,7 +134,7 @@ MergeAliases(AliasInfo ** into, AliasInfo ** merge, unsigned how_merge)
|
|||
memset(&def, 0, sizeof(KeyAliasDef));
|
||||
for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next)
|
||||
{
|
||||
if (how_merge == MergeDefault)
|
||||
if (how_merge == MERGE_DEFAULT)
|
||||
def.merge = tmp->def.merge;
|
||||
else
|
||||
def.merge = how_merge;
|
||||
|
@ -198,7 +198,7 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
|||
if (strncmp(a->alias, info->alias, XkbKeyNameLength) == 0)
|
||||
{
|
||||
AliasInfo old_info;
|
||||
InitAliasInfo(&old_info, MergeAugment, 0, a->alias, a->real);
|
||||
InitAliasInfo(&old_info, MERGE_AUGMENT, 0, a->alias, a->real);
|
||||
HandleCollision(&old_info, info);
|
||||
memcpy(old_info.real, a->real, XkbKeyNameLength);
|
||||
info->alias[0] = '\0';
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct _AliasInfo
|
|||
} AliasInfo;
|
||||
|
||||
extern int
|
||||
HandleAliasDef(KeyAliasDef *def, unsigned merge, unsigned file_id,
|
||||
HandleAliasDef(KeyAliasDef *def, enum merge_mode merge, unsigned file_id,
|
||||
AliasInfo **info);
|
||||
|
||||
extern void
|
||||
|
|
|
@ -109,7 +109,7 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
|
|||
info->act = NULL;
|
||||
info->dflt.defs.fileID = info->fileID;
|
||||
info->dflt.defs.defined = 0;
|
||||
info->dflt.defs.merge = MergeOverride;
|
||||
info->dflt.defs.merge = MERGE_OVERRIDE;
|
||||
info->dflt.interp.flags = 0;
|
||||
info->dflt.interp.virtual_mod = XkbNoModifier;
|
||||
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||
|
@ -118,7 +118,7 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
|
|||
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
||||
info->ledDflt.defs.fileID = info->fileID;
|
||||
info->ledDflt.defs.defined = 0;
|
||||
info->ledDflt.defs.merge = MergeOverride;
|
||||
info->ledDflt.defs.merge = MERGE_OVERRIDE;
|
||||
memset(&info->groupCompat[0], 0,
|
||||
XkbNumKbdGroups * sizeof(GroupCompatInfo));
|
||||
info->leds = NULL;
|
||||
|
@ -134,7 +134,7 @@ ClearCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
|
|||
free(info->name);
|
||||
info->name = NULL;
|
||||
info->dflt.defs.defined = 0;
|
||||
info->dflt.defs.merge = MergeAugment;
|
||||
info->dflt.defs.merge = MERGE_AUGMENT;
|
||||
info->dflt.interp.flags = 0;
|
||||
info->dflt.interp.virtual_mod = XkbNoModifier;
|
||||
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||
|
@ -197,7 +197,7 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
|
|||
old = FindMatchingInterp(info, new);
|
||||
if (old != NULL)
|
||||
{
|
||||
if (new->defs.merge == MergeReplace)
|
||||
if (new->defs.merge == MERGE_REPLACE)
|
||||
{
|
||||
SymInterpInfo *next = (SymInterpInfo *) old->defs.next;
|
||||
if (((old->defs.fileID == new->defs.fileID)
|
||||
|
@ -242,7 +242,7 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
|
|||
{
|
||||
WARN("Multiple interpretations of \"%s\"\n", siText(new, info));
|
||||
ACTION("Using %s definition for duplicate fields\n",
|
||||
(new->defs.merge != MergeAugment ? "last" : "first"));
|
||||
(new->defs.merge != MERGE_AUGMENT ? "last" : "first"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ static bool
|
|||
AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
|
||||
{
|
||||
GroupCompatInfo *gc;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
|
||||
merge = newGC->merge;
|
||||
gc = &info->groupCompat[group];
|
||||
|
@ -271,9 +271,9 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
|
|||
{
|
||||
WARN("Compat map for group %d redefined\n", group + 1);
|
||||
ACTION("Using %s definition\n",
|
||||
(merge == MergeAugment ? "old" : "new"));
|
||||
(merge == MERGE_AUGMENT ? "old" : "new"));
|
||||
}
|
||||
if (newGC->defined && (merge != MergeAugment || !gc->defined))
|
||||
if (newGC->defined && (merge != MERGE_AUGMENT || !gc->defined))
|
||||
*gc = *newGC;
|
||||
return true;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
/***====================================================================***/
|
||||
|
||||
static void
|
||||
MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge)
|
||||
MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, enum merge_mode merge)
|
||||
{
|
||||
SymInterpInfo *si;
|
||||
LEDInfo *led, *rtrn, *next;
|
||||
|
@ -359,14 +359,14 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge)
|
|||
}
|
||||
for (si = from->interps; si; si = (SymInterpInfo *) si->defs.next)
|
||||
{
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
si->defs.merge = merge;
|
||||
if (!AddInterp(into, si))
|
||||
into->errorCount++;
|
||||
}
|
||||
for (i = 0, gcm = &from->groupCompat[0]; i < XkbNumKbdGroups; i++, gcm++)
|
||||
{
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
gcm->merge = merge;
|
||||
if (!AddGroupCompat(into, i, gcm))
|
||||
into->errorCount++;
|
||||
|
@ -374,7 +374,7 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge)
|
|||
for (led = from->leds; led != NULL; led = next)
|
||||
{
|
||||
next = (LEDInfo *) led->defs.next;
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
led->defs.merge = merge;
|
||||
rtrn = AddIndicatorMap(from->keymap, into->leds, led);
|
||||
if (rtrn != NULL)
|
||||
|
@ -385,7 +385,7 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge)
|
|||
}
|
||||
|
||||
static void
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, unsigned merge,
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
CompatInfo *info);
|
||||
|
||||
static bool
|
||||
|
@ -415,7 +415,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
included.ledDflt.defs.fileID = rtrn->id;
|
||||
included.ledDflt.defs.merge = newMerge;
|
||||
included.act = info->act;
|
||||
HandleCompatMapFile(rtrn, keymap, MergeOverride, &included);
|
||||
HandleCompatMapFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||
if (stmt->stmt != NULL)
|
||||
{
|
||||
free(included.name);
|
||||
|
@ -456,7 +456,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
next_incl.ledDflt.defs.fileID = rtrn->id;
|
||||
next_incl.ledDflt.defs.merge = op;
|
||||
next_incl.act = info->act;
|
||||
HandleCompatMapFile(rtrn, keymap, MergeOverride, &next_incl);
|
||||
HandleCompatMapFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
||||
MergeIncludedCompatMaps(&included, &next_incl, op);
|
||||
if (info->act != NULL)
|
||||
next_incl.act = NULL;
|
||||
|
@ -622,7 +622,7 @@ HandleInterpBody(VarDef *def, struct xkb_keymap *keymap, SymInterpInfo *si,
|
|||
}
|
||||
|
||||
static int
|
||||
HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, unsigned merge,
|
||||
HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
CompatInfo *info)
|
||||
{
|
||||
unsigned pred, mods;
|
||||
|
@ -634,7 +634,7 @@ HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, unsigned merge,
|
|||
ACTION("Symbol interpretation ignored\n");
|
||||
return false;
|
||||
}
|
||||
if (def->merge != MergeDefault)
|
||||
if (def->merge != MERGE_DEFAULT)
|
||||
merge = def->merge;
|
||||
|
||||
si = info->dflt;
|
||||
|
@ -663,12 +663,12 @@ HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, unsigned merge,
|
|||
|
||||
static int
|
||||
HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
||||
unsigned merge, CompatInfo *info)
|
||||
enum merge_mode merge, CompatInfo *info)
|
||||
{
|
||||
ExprResult val;
|
||||
GroupCompatInfo tmp;
|
||||
|
||||
if (def->merge != MergeDefault)
|
||||
if (def->merge != MERGE_DEFAULT)
|
||||
merge = def->merge;
|
||||
if (!XkbIsLegalGroup(def->group - 1))
|
||||
{
|
||||
|
@ -694,13 +694,13 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
|||
}
|
||||
|
||||
static void
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, unsigned merge,
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
CompatInfo *info)
|
||||
{
|
||||
ParseCommon *stmt;
|
||||
|
||||
if (merge == MergeDefault)
|
||||
merge = MergeAugment;
|
||||
if (merge == MERGE_DEFAULT)
|
||||
merge = MERGE_AUGMENT;
|
||||
free(info->name);
|
||||
info->name = uDupString(file->name);
|
||||
stmt = file->defs;
|
||||
|
@ -779,7 +779,7 @@ CopyInterps(CompatInfo * info,
|
|||
}
|
||||
|
||||
bool
|
||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, unsigned merge,
|
||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
LEDInfoPtr *unboundLEDs)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -71,7 +71,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
old->defs.defined |= new->defs.defined;
|
||||
return oldLEDs;
|
||||
}
|
||||
if (new->defs.merge == MergeReplace)
|
||||
if (new->defs.merge == MERGE_REPLACE)
|
||||
{
|
||||
CommonInfo *next = old->defs.next;
|
||||
if (((old->defs.fileID == new->defs.fileID)
|
||||
|
@ -132,7 +132,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
WARN("Map for indicator %s redefined\n",
|
||||
xkb_atom_text(keymap->ctx, old->name));
|
||||
ACTION("Using %s definition for duplicate fields\n",
|
||||
(new->defs.merge == MergeAugment ? "first" : "last"));
|
||||
(new->defs.merge == MERGE_AUGMENT ? "first" : "last"));
|
||||
}
|
||||
return oldLEDs;
|
||||
}
|
||||
|
@ -313,13 +313,13 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
|
||||
LEDInfo *
|
||||
HandleIndicatorMapDef(IndicatorMapDef *def, struct xkb_keymap *keymap,
|
||||
LEDInfo *dflt, LEDInfo *oldLEDs, unsigned merge)
|
||||
LEDInfo *dflt, LEDInfo *oldLEDs, enum merge_mode merge)
|
||||
{
|
||||
LEDInfo led, *rtrn;
|
||||
VarDef *var;
|
||||
bool ok;
|
||||
|
||||
if (def->merge != MergeDefault)
|
||||
if (def->merge != MERGE_DEFAULT)
|
||||
merge = def->merge;
|
||||
|
||||
led = *dflt;
|
||||
|
|
|
@ -66,7 +66,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap, char *field,
|
|||
|
||||
extern LEDInfo *
|
||||
HandleIndicatorMapDef(IndicatorMapDef *stmt, struct xkb_keymap *keymap,
|
||||
LEDInfo *dflt, LEDInfo *oldLEDs, unsigned mergeMode);
|
||||
LEDInfo *dflt, LEDInfo *oldLEDs, enum merge_mode mergeMode);
|
||||
|
||||
extern bool
|
||||
CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds,
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef struct _KeyNamesInfo
|
|||
char *name; /* e.g. evdev+aliases(qwerty) */
|
||||
int errorCount;
|
||||
unsigned fileID;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
xkb_keycode_t computedMin; /* lowest keycode stored */
|
||||
xkb_keycode_t computedMax; /* highest keycode stored */
|
||||
xkb_keycode_t explicitMin;
|
||||
|
@ -77,7 +77,7 @@ typedef struct _KeyNamesInfo
|
|||
} KeyNamesInfo;
|
||||
|
||||
static void HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
unsigned merge, KeyNamesInfo *info);
|
||||
enum merge_mode merge, KeyNamesInfo *info);
|
||||
|
||||
static void
|
||||
ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
|
||||
|
@ -155,13 +155,13 @@ FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
|
|||
}
|
||||
|
||||
static bool
|
||||
AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, unsigned merge,
|
||||
AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
IndicatorNameInfo *new)
|
||||
{
|
||||
IndicatorNameInfo *old;
|
||||
bool replace;
|
||||
|
||||
replace = (merge == MergeReplace) || (merge == MergeOverride);
|
||||
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
|
||||
old = FindIndicatorByName(info, new->name);
|
||||
if (old)
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ FindKeyByLong(KeyNamesInfo * info, unsigned long name)
|
|||
static bool
|
||||
AddKeyName(KeyNamesInfo * info,
|
||||
xkb_keycode_t kc,
|
||||
char *name, unsigned merge, unsigned fileID, bool reportCollisions)
|
||||
char *name, enum merge_mode merge, unsigned fileID, bool reportCollisions)
|
||||
{
|
||||
xkb_keycode_t old;
|
||||
unsigned long lval;
|
||||
|
@ -349,7 +349,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
buf[4] = '\0';
|
||||
if (darray_item(info->names, kc) == lval)
|
||||
{
|
||||
if (darray_item(info->has_alt_forms, kc) || (merge == MergeAltForm)) {
|
||||
if (darray_item(info->has_alt_forms, kc) || (merge == MERGE_ALT_FORM)) {
|
||||
darray_item(info->has_alt_forms, kc) = true;
|
||||
}
|
||||
else if (reportCollisions) {
|
||||
|
@ -359,7 +359,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
if (merge == MergeAugment)
|
||||
if (merge == MERGE_AUGMENT)
|
||||
{
|
||||
if (reportCollisions)
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
old = FindKeyByLong(info, lval);
|
||||
if ((old != 0) && (old != kc))
|
||||
{
|
||||
if (merge == MergeOverride)
|
||||
if (merge == MERGE_OVERRIDE)
|
||||
{
|
||||
darray_item(info->names, old) = 0;
|
||||
darray_item(info->files, old) = 0;
|
||||
|
@ -393,7 +393,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
ACTION("Using %d, ignoring %d\n", kc, old);
|
||||
}
|
||||
}
|
||||
else if (merge != MergeAltForm)
|
||||
else if (merge != MERGE_ALT_FORM)
|
||||
{
|
||||
if ((reportCollisions) && (warningLevel > 3))
|
||||
{
|
||||
|
@ -411,7 +411,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
}
|
||||
darray_item(info->names, kc) = lval;
|
||||
darray_item(info->files, kc) = fileID;
|
||||
darray_item(info->has_alt_forms, kc) = (merge == MergeAltForm);
|
||||
darray_item(info->has_alt_forms, kc) = (merge == MERGE_ALT_FORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
|
||||
static void
|
||||
MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
||||
KeyNamesInfo *from, unsigned merge)
|
||||
KeyNamesInfo *from, enum merge_mode merge)
|
||||
{
|
||||
uint64_t i;
|
||||
char buf[5];
|
||||
|
@ -445,7 +445,7 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
|||
LongToKeyName(darray_item(from->names, i), buf);
|
||||
buf[4] = '\0';
|
||||
if (darray_item(from->has_alt_forms, i))
|
||||
thisMerge = MergeAltForm;
|
||||
thisMerge = MERGE_ALT_FORM;
|
||||
else
|
||||
thisMerge = merge;
|
||||
if (!AddKeyName(into, i, buf, thisMerge, from->fileID, false))
|
||||
|
@ -456,7 +456,7 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
|||
IndicatorNameInfo *led, *next;
|
||||
for (led = from->leds; led != NULL; led = next)
|
||||
{
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
led->defs.merge = merge;
|
||||
if (!AddIndicatorName(into, keymap, led->defs.merge, led))
|
||||
into->errorCount++;
|
||||
|
@ -515,7 +515,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
&newMerge))
|
||||
{
|
||||
InitKeyNamesInfo(&included);
|
||||
HandleKeycodesFile(rtrn, keymap, MergeOverride, &included);
|
||||
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||
if (stmt->stmt != NULL)
|
||||
{
|
||||
free(included.name);
|
||||
|
@ -548,7 +548,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
&rtrn, &op))
|
||||
{
|
||||
InitKeyNamesInfo(&next_incl);
|
||||
HandleKeycodesFile(rtrn, keymap, MergeOverride, &next_incl);
|
||||
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
||||
MergeIncludedKeycodes(&included, keymap, &next_incl, op);
|
||||
ClearKeyNamesInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
|
@ -576,7 +576,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
* e.g. <ESC> = 9
|
||||
*/
|
||||
static int
|
||||
HandleKeycodeDef(KeycodeDef *stmt, unsigned merge, KeyNamesInfo *info)
|
||||
HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
|
||||
{
|
||||
if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
|
||||
(info->explicitMax != 0 && stmt->value > info->explicitMax))
|
||||
|
@ -587,10 +587,10 @@ HandleKeycodeDef(KeycodeDef *stmt, unsigned merge, KeyNamesInfo *info)
|
|||
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
|
||||
return 0;
|
||||
}
|
||||
if (stmt->merge != MergeDefault)
|
||||
if (stmt->merge != MERGE_DEFAULT)
|
||||
{
|
||||
if (stmt->merge == MergeReplace)
|
||||
merge = MergeOverride;
|
||||
if (stmt->merge == MERGE_REPLACE)
|
||||
merge = MERGE_OVERRIDE;
|
||||
else
|
||||
merge = stmt->merge;
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ err_out:
|
|||
|
||||
static int
|
||||
HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
||||
unsigned merge, KeyNamesInfo *info)
|
||||
enum merge_mode merge, KeyNamesInfo *info)
|
||||
{
|
||||
IndicatorNameInfo ii;
|
||||
ExprResult tmp;
|
||||
|
@ -742,12 +742,12 @@ HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
|||
*
|
||||
* @param file The input file (parsed xkb_keycodes section)
|
||||
* @param xkb Necessary to pass down, may have flags changed.
|
||||
* @param merge Merge strategy (MergeOverride, etc.)
|
||||
* @param merge Merge strategy (MERGE_OVERRIDE, etc.)
|
||||
* @param info Struct to contain the fully parsed key information.
|
||||
*/
|
||||
static void
|
||||
HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
unsigned merge, KeyNamesInfo *info)
|
||||
enum merge_mode merge, KeyNamesInfo *info)
|
||||
{
|
||||
ParseCommon *stmt;
|
||||
|
||||
|
@ -817,7 +817,7 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
|||
* @return true on success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge)
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||
{
|
||||
KeyNamesInfo info; /* contains all the info after parsing */
|
||||
|
||||
|
|
|
@ -132,25 +132,25 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file)
|
|||
|
||||
/* compile the sections we have in the file one-by-one, or fail. */
|
||||
if (sections.keycodes == NULL ||
|
||||
!CompileKeycodes(sections.keycodes, keymap, MergeOverride))
|
||||
!CompileKeycodes(sections.keycodes, keymap, MERGE_OVERRIDE))
|
||||
{
|
||||
ERROR("Failed to compile keycodes\n");
|
||||
goto err;
|
||||
}
|
||||
if (sections.types == NULL ||
|
||||
!CompileKeyTypes(sections.types, keymap, MergeOverride))
|
||||
!CompileKeyTypes(sections.types, keymap, MERGE_OVERRIDE))
|
||||
{
|
||||
ERROR("Failed to compile key types\n");
|
||||
goto err;
|
||||
}
|
||||
if (sections.compat == NULL ||
|
||||
!CompileCompatMap(sections.compat, keymap, MergeOverride, &unbound))
|
||||
!CompileCompatMap(sections.compat, keymap, MERGE_OVERRIDE, &unbound))
|
||||
{
|
||||
ERROR("Failed to compile compat map\n");
|
||||
goto err;
|
||||
}
|
||||
if (sections.symbols == NULL ||
|
||||
!CompileSymbols(sections.symbols, keymap, MergeOverride))
|
||||
!CompileSymbols(sections.symbols, keymap, MERGE_OVERRIDE))
|
||||
{
|
||||
ERROR("Failed to compile symbols\n");
|
||||
goto err;
|
||||
|
|
|
@ -112,7 +112,7 @@ InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap,
|
|||
info->types = NULL;
|
||||
info->dflt.defs.defined = 0;
|
||||
info->dflt.defs.fileID = 0;
|
||||
info->dflt.defs.merge = MergeOverride;
|
||||
info->dflt.defs.merge = MERGE_OVERRIDE;
|
||||
info->dflt.defs.next = NULL;
|
||||
info->dflt.name = XKB_ATOM_NONE;
|
||||
info->dflt.mask = 0;
|
||||
|
@ -258,8 +258,8 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
if (old != NULL)
|
||||
{
|
||||
bool report;
|
||||
if ((new->defs.merge == MergeReplace)
|
||||
|| (new->defs.merge == MergeOverride))
|
||||
if ((new->defs.merge == MERGE_REPLACE)
|
||||
|| (new->defs.merge == MERGE_OVERRIDE))
|
||||
{
|
||||
KeyTypeInfo *next = (KeyTypeInfo *) old->defs.next;
|
||||
if (((old->defs.fileID == new->defs.fileID)
|
||||
|
@ -302,7 +302,7 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
|
||||
static void
|
||||
MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
||||
unsigned merge, struct xkb_keymap *keymap)
|
||||
enum merge_mode merge, struct xkb_keymap *keymap)
|
||||
{
|
||||
KeyTypeInfo *type;
|
||||
|
||||
|
@ -318,7 +318,7 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
|||
}
|
||||
for (type = from->types; type; type = (KeyTypeInfo *) type->defs.next)
|
||||
{
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
type->defs.merge = merge;
|
||||
if (!AddKeyType(keymap, into, type))
|
||||
into->errorCount++;
|
||||
|
@ -328,7 +328,7 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
|||
|
||||
static void
|
||||
HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
unsigned merge, KeyTypesInfo *info);
|
||||
enum merge_mode merge, KeyTypesInfo *info);
|
||||
|
||||
static bool
|
||||
HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||
|
@ -851,13 +851,13 @@ HandleKeyTypeBody(VarDef *def, struct xkb_keymap *keymap,
|
|||
*/
|
||||
static int
|
||||
HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
||||
unsigned merge, KeyTypesInfo *info)
|
||||
enum merge_mode merge, KeyTypesInfo *info)
|
||||
{
|
||||
unsigned int i;
|
||||
KeyTypeInfo type;
|
||||
struct xkb_kt_map_entry *entry;
|
||||
|
||||
if (def->merge != MergeDefault)
|
||||
if (def->merge != MERGE_DEFAULT)
|
||||
merge = def->merge;
|
||||
|
||||
type.defs.defined = 0;
|
||||
|
@ -923,12 +923,12 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
|||
* Process an xkb_types section.
|
||||
*
|
||||
* @param file The parsed xkb_types section.
|
||||
* @param merge Merge Strategy (e.g. MergeOverride)
|
||||
* @param merge Merge Strategy (e.g. MERGE_OVERRIDE)
|
||||
* @param info Pointer to memory where the outcome will be stored.
|
||||
*/
|
||||
static void
|
||||
HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
unsigned merge, KeyTypesInfo *info)
|
||||
enum merge_mode merge, KeyTypesInfo *info)
|
||||
{
|
||||
ParseCommon *stmt;
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
}
|
||||
|
||||
bool
|
||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge)
|
||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||
{
|
||||
unsigned int i;
|
||||
struct xkb_key_type *type, *next;
|
||||
|
|
|
@ -169,7 +169,7 @@ UseNewField(unsigned field,
|
|||
{
|
||||
*pCollide |= field;
|
||||
}
|
||||
if (newDefs->merge != MergeAugment)
|
||||
if (newDefs->merge != MERGE_AUGMENT)
|
||||
useNew = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -328,10 +328,10 @@ Decl : OptMergeMode VarDecl
|
|||
}
|
||||
| MergeMode STRING
|
||||
{
|
||||
if ($1==MergeAltForm) {
|
||||
if ($1==MERGE_ALT_FORM) {
|
||||
yyerror(&@1, scanner,
|
||||
"cannot use 'alternate' to include other maps");
|
||||
$$= &IncludeCreate($2,MergeDefault)->common;
|
||||
$$= &IncludeCreate($2,MERGE_DEFAULT)->common;
|
||||
}
|
||||
else {
|
||||
$$= &IncludeCreate($2,$1)->common;
|
||||
|
@ -589,14 +589,14 @@ Element : ACTION_TOK
|
|||
;
|
||||
|
||||
OptMergeMode : MergeMode { $$= $1; }
|
||||
| { $$= MergeDefault; }
|
||||
| { $$= MERGE_DEFAULT; }
|
||||
;
|
||||
|
||||
MergeMode : INCLUDE { $$= MergeDefault; }
|
||||
| AUGMENT { $$= MergeAugment; }
|
||||
| OVERRIDE { $$= MergeOverride; }
|
||||
| REPLACE { $$= MergeReplace; }
|
||||
| ALTERNATE { $$= MergeAltForm; }
|
||||
MergeMode : INCLUDE { $$= MERGE_DEFAULT; }
|
||||
| AUGMENT { $$= MERGE_AUGMENT; }
|
||||
| OVERRIDE { $$= MERGE_OVERRIDE; }
|
||||
| REPLACE { $$= MERGE_REPLACE; }
|
||||
| ALTERNATE { $$= MERGE_ALT_FORM; }
|
||||
;
|
||||
|
||||
OptExprList : ExprList { $$= $1; }
|
||||
|
|
|
@ -242,7 +242,7 @@ KeyTypeCreate(xkb_atom_t name, VarDef * body)
|
|||
{
|
||||
def->common.stmtType = StmtKeyTypeDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MergeDefault;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->name = name;
|
||||
def->body = body;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ SymbolsCreate(const char *keyName, ExprDef *symbols)
|
|||
{
|
||||
def->common.stmtType = StmtSymbolsDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MergeDefault;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
memset(def->keyName, 0, 5);
|
||||
strncpy(def->keyName, keyName, 4);
|
||||
def->symbols = symbols;
|
||||
|
@ -287,7 +287,7 @@ GroupCompatCreate(int group, ExprDef * val)
|
|||
{
|
||||
def->common.stmtType = StmtGroupCompatDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MergeDefault;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->group = group;
|
||||
def->def = val;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ ModMapCreate(uint32_t modifier, ExprDef * keys)
|
|||
{
|
||||
def->common.stmtType = StmtModMapDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MergeDefault;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->modifier = modifier;
|
||||
def->keys = keys;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ IndicatorMapCreate(xkb_atom_t name, VarDef * body)
|
|||
{
|
||||
def->common.stmtType = StmtIndicatorMapDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MergeDefault;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->name = name;
|
||||
def->body = body;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
|
|||
{
|
||||
def->common.stmtType = StmtIndicatorNameDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MergeDefault;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->ndx = ndx;
|
||||
def->name = name;
|
||||
def->virtual = virtual;
|
||||
|
@ -481,7 +481,7 @@ static void
|
|||
FreeInclude(IncludeStmt *incl);
|
||||
|
||||
IncludeStmt *
|
||||
IncludeCreate(char *str, unsigned merge)
|
||||
IncludeCreate(char *str, enum merge_mode merge)
|
||||
{
|
||||
IncludeStmt *incl, *first;
|
||||
char *file, *map, *stmt, *tmp, *extra_data;
|
||||
|
@ -529,9 +529,9 @@ IncludeCreate(char *str, unsigned merge)
|
|||
break;
|
||||
}
|
||||
if (nextop == '|')
|
||||
merge = MergeAugment;
|
||||
merge = MERGE_AUGMENT;
|
||||
else
|
||||
merge = MergeOverride;
|
||||
merge = MERGE_OVERRIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -627,12 +627,12 @@ CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
|||
}
|
||||
|
||||
unsigned
|
||||
StmtSetMerge(ParseCommon * stmt, unsigned merge, struct YYLTYPE *loc, void *scanner)
|
||||
StmtSetMerge(ParseCommon * stmt, enum merge_mode merge, struct YYLTYPE *loc, void *scanner)
|
||||
{
|
||||
if ((merge == MergeAltForm) && (stmt->stmtType != StmtKeycodeDef))
|
||||
if ((merge == MERGE_ALT_FORM) && (stmt->stmtType != StmtKeycodeDef))
|
||||
{
|
||||
yyerror(loc, scanner, "illegal use of 'alternate' merge mode");
|
||||
merge = MergeDefault;
|
||||
merge = MERGE_DEFAULT;
|
||||
}
|
||||
return merge;
|
||||
}
|
||||
|
|
|
@ -111,10 +111,10 @@ extern int
|
|||
LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn);
|
||||
|
||||
extern IncludeStmt *
|
||||
IncludeCreate(char *str, unsigned merge);
|
||||
IncludeCreate(char *str, enum merge_mode merge);
|
||||
|
||||
extern unsigned
|
||||
StmtSetMerge(ParseCommon *stmt, unsigned merge, struct YYLTYPE *loc, void *scanner);
|
||||
StmtSetMerge(ParseCommon *stmt, enum merge_mode merge, struct YYLTYPE *loc, void *scanner);
|
||||
|
||||
extern void
|
||||
CheckDefaultMap(XkbFile *maps, const char *fileName);
|
||||
|
|
|
@ -95,7 +95,7 @@ InitKeyInfo(KeyInfo * info)
|
|||
|
||||
info->defs.defined = 0;
|
||||
info->defs.fileID = 0;
|
||||
info->defs.merge = MergeOverride;
|
||||
info->defs.merge = MERGE_OVERRIDE;
|
||||
info->defs.next = NULL;
|
||||
info->name = KeyNameToLong(dflt);
|
||||
info->groupInfo = 0;
|
||||
|
@ -126,7 +126,7 @@ FreeKeyInfo(KeyInfo * info)
|
|||
|
||||
info->defs.defined = 0;
|
||||
info->defs.fileID = 0;
|
||||
info->defs.merge = MergeOverride;
|
||||
info->defs.merge = MERGE_OVERRIDE;
|
||||
info->defs.next = NULL;
|
||||
info->groupInfo = 0;
|
||||
info->typesDefined = info->symsDefined = info->actsDefined = 0;
|
||||
|
@ -199,7 +199,7 @@ typedef struct _SymbolsInfo
|
|||
char *name; /* e.g. pc+us+inet(evdev) */
|
||||
int errorCount;
|
||||
unsigned fileID;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
unsigned explicit_group;
|
||||
darray(KeyInfo) keys;
|
||||
KeyInfo dflt;
|
||||
|
@ -220,7 +220,7 @@ InitSymbolsInfo(SymbolsInfo * info, struct xkb_keymap *keymap)
|
|||
info->explicit_group = 0;
|
||||
info->errorCount = 0;
|
||||
info->fileID = 0;
|
||||
info->merge = MergeOverride;
|
||||
info->merge = MERGE_OVERRIDE;
|
||||
darray_init(info->keys);
|
||||
darray_growalloc(info->keys, 110);
|
||||
info->modMap = NULL;
|
||||
|
@ -298,7 +298,7 @@ MergeKeyGroups(SymbolsInfo * info,
|
|||
int i;
|
||||
bool report, clobber;
|
||||
|
||||
clobber = (from->defs.merge != MergeAugment);
|
||||
clobber = (from->defs.merge != MERGE_AUGMENT);
|
||||
|
||||
report = (warningLevel > 9) ||
|
||||
((into->defs.fileID == from->defs.fileID) && (warningLevel > 0));
|
||||
|
@ -510,7 +510,7 @@ MergeKeys(SymbolsInfo *info, struct xkb_keymap *keymap,
|
|||
unsigned collide = 0;
|
||||
bool report;
|
||||
|
||||
if (from->defs.merge == MergeReplace)
|
||||
if (from->defs.merge == MERGE_REPLACE)
|
||||
{
|
||||
for (i = 0; i < XkbNumKbdGroups; i++)
|
||||
{
|
||||
|
@ -569,7 +569,7 @@ MergeKeys(SymbolsInfo *info, struct xkb_keymap *keymap,
|
|||
{
|
||||
xkb_atom_t use, ignore;
|
||||
collide |= _Key_Types;
|
||||
if (from->defs.merge != MergeAugment)
|
||||
if (from->defs.merge != MERGE_AUGMENT)
|
||||
{
|
||||
use = from->types[i];
|
||||
ignore = into->types[i];
|
||||
|
@ -586,7 +586,7 @@ MergeKeys(SymbolsInfo *info, struct xkb_keymap *keymap,
|
|||
xkb_atom_text(keymap->ctx, use),
|
||||
xkb_atom_text(keymap->ctx, ignore));
|
||||
}
|
||||
if ((from->defs.merge != MergeAugment)
|
||||
if ((from->defs.merge != MERGE_AUGMENT)
|
||||
|| (into->types[i] == XKB_ATOM_NONE))
|
||||
{
|
||||
into->types[i] = from->types[i];
|
||||
|
@ -623,7 +623,7 @@ MergeKeys(SymbolsInfo *info, struct xkb_keymap *keymap,
|
|||
WARN("Symbol map for key %s redefined\n",
|
||||
longText(into->name));
|
||||
ACTION("Using %s definition for conflicting fields\n",
|
||||
(from->defs.merge == MergeAugment ? "first" : "last"));
|
||||
(from->defs.merge == MERGE_AUGMENT ? "first" : "last"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
|
|||
ModMapEntry *mm;
|
||||
bool clobber;
|
||||
|
||||
clobber = (new->defs.merge != MergeAugment);
|
||||
clobber = (new->defs.merge != MERGE_AUGMENT);
|
||||
for (mm = info->modMap; mm != NULL; mm = (ModMapEntry *) mm->defs.next)
|
||||
{
|
||||
if (new->haveSymbol && mm->haveSymbol
|
||||
|
@ -727,7 +727,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
|
|||
|
||||
static void
|
||||
MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from,
|
||||
unsigned merge, struct xkb_keymap *keymap)
|
||||
enum merge_mode merge, struct xkb_keymap *keymap)
|
||||
{
|
||||
unsigned int i;
|
||||
KeyInfo *key;
|
||||
|
@ -746,14 +746,14 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from,
|
|||
{
|
||||
if (from->groupNames[i] != XKB_ATOM_NONE)
|
||||
{
|
||||
if ((merge != MergeAugment) ||
|
||||
if ((merge != MERGE_AUGMENT) ||
|
||||
(into->groupNames[i] == XKB_ATOM_NONE))
|
||||
into->groupNames[i] = from->groupNames[i];
|
||||
}
|
||||
}
|
||||
|
||||
darray_foreach(key, from->keys) {
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
key->defs.merge = merge;
|
||||
|
||||
if (!AddKeySymbols(into, key, keymap))
|
||||
|
@ -765,7 +765,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from,
|
|||
ModMapEntry *mm, *next;
|
||||
for (mm = from->modMap; mm != NULL; mm = next)
|
||||
{
|
||||
if (merge != MergeDefault)
|
||||
if (merge != MERGE_DEFAULT)
|
||||
mm->defs.merge = merge;
|
||||
if (!AddModMapEntry(into, mm))
|
||||
into->errorCount++;
|
||||
|
@ -780,7 +780,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from,
|
|||
|
||||
static void
|
||||
HandleSymbolsFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
unsigned merge, SymbolsInfo *info);
|
||||
enum merge_mode merge, SymbolsInfo *info);
|
||||
|
||||
static bool
|
||||
HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||
|
@ -803,7 +803,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
{
|
||||
InitSymbolsInfo(&included, keymap);
|
||||
included.fileID = included.dflt.defs.fileID = rtrn->id;
|
||||
included.merge = included.dflt.defs.merge = MergeOverride;
|
||||
included.merge = included.dflt.defs.merge = MERGE_OVERRIDE;
|
||||
if (stmt->modifier)
|
||||
{
|
||||
included.explicit_group = atoi(stmt->modifier) - 1;
|
||||
|
@ -812,7 +812,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
{
|
||||
included.explicit_group = info->explicit_group;
|
||||
}
|
||||
HandleSymbolsFile(rtrn, keymap, MergeOverride, &included);
|
||||
HandleSymbolsFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||
if (stmt->stmt != NULL)
|
||||
{
|
||||
free(included.name);
|
||||
|
@ -845,7 +845,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
{
|
||||
InitSymbolsInfo(&next_incl, keymap);
|
||||
next_incl.fileID = next_incl.dflt.defs.fileID = rtrn->id;
|
||||
next_incl.merge = next_incl.dflt.defs.merge = MergeOverride;
|
||||
next_incl.merge = next_incl.dflt.defs.merge = MERGE_OVERRIDE;
|
||||
if (next->modifier)
|
||||
{
|
||||
next_incl.explicit_group = atoi(next->modifier) - 1;
|
||||
|
@ -854,7 +854,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
{
|
||||
next_incl.explicit_group = info->explicit_group;
|
||||
}
|
||||
HandleSymbolsFile(rtrn, keymap, MergeOverride, &next_incl);
|
||||
HandleSymbolsFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
||||
MergeIncludedSymbols(&included, &next_incl, op, keymap);
|
||||
FreeSymbolsInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
|
@ -1493,7 +1493,7 @@ HandleModMapDef(ModMapDef *def, struct xkb_keymap *keymap, SymbolsInfo *info)
|
|||
|
||||
static void
|
||||
HandleSymbolsFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
unsigned merge, SymbolsInfo *info)
|
||||
enum merge_mode merge, SymbolsInfo *info)
|
||||
{
|
||||
ParseCommon *stmt;
|
||||
|
||||
|
@ -2036,10 +2036,10 @@ CopyModMapDef(struct xkb_keymap *keymap, ModMapEntry *entry)
|
|||
*
|
||||
* @param file The parsed xkb_symbols section of the xkb file.
|
||||
* @param keymap Handle to the keyboard description to store the symbols in.
|
||||
* @param merge Merge strategy (e.g. MergeOverride).
|
||||
* @param merge Merge strategy (e.g. MERGE_OVERRIDE).
|
||||
*/
|
||||
bool
|
||||
CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, unsigned merge)
|
||||
CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||
{
|
||||
unsigned int i;
|
||||
SymbolsInfo info;
|
||||
|
|
|
@ -66,10 +66,10 @@ ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap)
|
|||
* XkbServerMap's vmod is set to the given modifier. Otherwise, the vmod is 0.
|
||||
*
|
||||
* @param stmt The statement specifying the name and (if any the value).
|
||||
* @param mergeMode Merge strategy (e.g. MergeOverride)
|
||||
* @param mergeMode Merge strategy (e.g. MERGE_OVERRIDE)
|
||||
*/
|
||||
bool
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, unsigned mergeMode,
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMode,
|
||||
VModInfo *info)
|
||||
{
|
||||
int i, bit, nextFree;
|
||||
|
@ -104,13 +104,13 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, unsigned mergeMode,
|
|||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||
WARN("Virtual modifier %s multiply defined\n", str1);
|
||||
str1 = XkbcModMaskText(srv->vmods[i], true);
|
||||
if (mergeMode == MergeOverride)
|
||||
if (mergeMode == MERGE_OVERRIDE)
|
||||
{
|
||||
str2 = str1;
|
||||
str1 = XkbcModMaskText(mod.uval, true);
|
||||
}
|
||||
ACTION("Using %s, ignoring %s\n", str1, str2);
|
||||
if (mergeMode == MergeOverride)
|
||||
if (mergeMode == MERGE_OVERRIDE)
|
||||
srv->vmods[i] = mod.uval;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ extern void
|
|||
ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap);
|
||||
|
||||
extern bool
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, unsigned mergeMode,
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMode,
|
||||
VModInfo *info);
|
||||
|
||||
extern bool
|
||||
|
|
|
@ -40,21 +40,21 @@ XkbKeymapFileFromComponents(struct xkb_context *ctx,
|
|||
XkbFile *keycodes, *types, *compat, *symbols;
|
||||
IncludeStmt *inc;
|
||||
|
||||
inc = IncludeCreate(ktcsg->keycodes, MergeDefault);
|
||||
inc = IncludeCreate(ktcsg->keycodes, MERGE_DEFAULT);
|
||||
keycodes = CreateXKBFile(ctx, FILE_TYPE_KEYCODES, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
|
||||
inc = IncludeCreate(ktcsg->types, MergeDefault);
|
||||
inc = IncludeCreate(ktcsg->types, MERGE_DEFAULT);
|
||||
types = CreateXKBFile(ctx, FILE_TYPE_TYPES, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
AppendStmt(&keycodes->common, &types->common);
|
||||
|
||||
inc = IncludeCreate(ktcsg->compat, MergeDefault);
|
||||
inc = IncludeCreate(ktcsg->compat, MERGE_DEFAULT);
|
||||
compat = CreateXKBFile(ctx, FILE_TYPE_COMPAT, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
AppendStmt(&keycodes->common, &compat->common);
|
||||
|
||||
inc = IncludeCreate(ktcsg->symbols, MergeDefault);
|
||||
inc = IncludeCreate(ktcsg->symbols, MERGE_DEFAULT);
|
||||
symbols = CreateXKBFile(ctx, FILE_TYPE_SYMBOLS, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
AppendStmt(&keycodes->common, &symbols->common);
|
||||
|
|
|
@ -78,11 +78,13 @@ typedef struct _ParseCommon
|
|||
#define OpInvert 27
|
||||
#define OpUnaryPlus 28
|
||||
|
||||
#define MergeDefault 0
|
||||
#define MergeAugment 1
|
||||
#define MergeOverride 2
|
||||
#define MergeReplace 3
|
||||
#define MergeAltForm 4
|
||||
enum merge_mode {
|
||||
MERGE_DEFAULT,
|
||||
MERGE_AUGMENT,
|
||||
MERGE_OVERRIDE,
|
||||
MERGE_REPLACE,
|
||||
MERGE_ALT_FORM,
|
||||
};
|
||||
|
||||
#define AutoKeyNames (1L << 0)
|
||||
#define CreateKeyNames(x) ((x)->flags&AutoKeyNames)
|
||||
|
@ -92,7 +94,7 @@ extern unsigned warningLevel;
|
|||
typedef struct _IncludeStmt
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
char *stmt;
|
||||
char *file;
|
||||
char *map;
|
||||
|
@ -146,7 +148,7 @@ typedef struct _Expr
|
|||
typedef struct _VarDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
ExprDef *name;
|
||||
ExprDef *value;
|
||||
} VarDef;
|
||||
|
@ -154,7 +156,7 @@ typedef struct _VarDef
|
|||
typedef struct _VModDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
xkb_atom_t name;
|
||||
ExprDef *value;
|
||||
} VModDef;
|
||||
|
@ -162,7 +164,7 @@ typedef struct _VModDef
|
|||
typedef struct _KeycodeDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
char name[5];
|
||||
unsigned long value;
|
||||
} KeycodeDef;
|
||||
|
@ -170,7 +172,7 @@ typedef struct _KeycodeDef
|
|||
typedef struct _KeyAliasDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
char alias[5];
|
||||
char real[5];
|
||||
} KeyAliasDef;
|
||||
|
@ -178,7 +180,7 @@ typedef struct _KeyAliasDef
|
|||
typedef struct _KeyTypeDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
xkb_atom_t name;
|
||||
VarDef *body;
|
||||
} KeyTypeDef;
|
||||
|
@ -186,7 +188,7 @@ typedef struct _KeyTypeDef
|
|||
typedef struct _SymbolsDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
char keyName[5];
|
||||
ExprDef *symbols;
|
||||
} SymbolsDef;
|
||||
|
@ -194,7 +196,7 @@ typedef struct _SymbolsDef
|
|||
typedef struct _ModMapDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
xkb_atom_t modifier;
|
||||
ExprDef *keys;
|
||||
} ModMapDef;
|
||||
|
@ -202,7 +204,7 @@ typedef struct _ModMapDef
|
|||
typedef struct _GroupCompatDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
int group;
|
||||
ExprDef *def;
|
||||
} GroupCompatDef;
|
||||
|
@ -210,7 +212,7 @@ typedef struct _GroupCompatDef
|
|||
typedef struct _InterpDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
char *sym;
|
||||
ExprDef *match;
|
||||
VarDef *def;
|
||||
|
@ -219,7 +221,7 @@ typedef struct _InterpDef
|
|||
typedef struct _IndicatorNameDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
int ndx;
|
||||
ExprDef *name;
|
||||
bool virtual;
|
||||
|
@ -228,7 +230,7 @@ typedef struct _IndicatorNameDef
|
|||
typedef struct _IndicatorMapDef
|
||||
{
|
||||
ParseCommon common;
|
||||
unsigned merge;
|
||||
enum merge_mode merge;
|
||||
unsigned type;
|
||||
xkb_atom_t name;
|
||||
VarDef *body;
|
||||
|
@ -249,18 +251,21 @@ extern struct xkb_keymap *
|
|||
CompileKeymap(struct xkb_context *ctx, XkbFile *file);
|
||||
|
||||
extern bool
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge);
|
||||
|
||||
extern bool
|
||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
|
||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge);
|
||||
|
||||
typedef struct _LEDInfo *LEDInfoPtr;
|
||||
|
||||
extern bool
|
||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, unsigned merge,
|
||||
LEDInfoPtr *unboundLEDs);
|
||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge, LEDInfoPtr *unboundLEDs);
|
||||
|
||||
extern bool
|
||||
CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
|
||||
CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge);
|
||||
|
||||
#endif /* XKBCOMP_H */
|
||||
|
|
Loading…
Reference in New Issue