else
{
char *use, *ignore;
- if (new->def.merge == MergeAugment)
+ if (new->def.merge == MERGE_AUGMENT)
{
use = old->real;
ignore = new->real;
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;
int
HandleAliasDef(KeyAliasDef * def,
- unsigned merge, unsigned file_id, AliasInfo ** info_in)
+ enum merge_mode merge, unsigned file_id, AliasInfo ** info_in)
{
AliasInfo *info;
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;
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';
} 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
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;
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;
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;
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)
{
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;
}
AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
{
GroupCompatInfo *gc;
- unsigned merge;
+ enum merge_mode merge;
merge = newGC->merge;
gc = &info->groupCompat[group];
{
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;
}
/***====================================================================***/
static void
-MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge)
+MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, enum merge_mode merge)
{
SymInterpInfo *si;
LEDInfo *led, *rtrn, *next;
}
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++;
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)
}
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
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);
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;
}
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;
ACTION("Symbol interpretation ignored\n");
return false;
}
- if (def->merge != MergeDefault)
+ if (def->merge != MERGE_DEFAULT)
merge = def->merge;
si = info->dflt;
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))
{
}
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;
}
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;
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)
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;
}
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;
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,
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;
} 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)
}
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)
{
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;
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) {
}
return true;
}
- if (merge == MergeAugment)
+ if (merge == MERGE_AUGMENT)
{
if (reportCollisions)
{
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;
ACTION("Using %d, ignoring %d\n", kc, old);
}
}
- else if (merge != MergeAltForm)
+ else if (merge != MERGE_ALT_FORM)
{
if ((reportCollisions) && (warningLevel > 3))
{
}
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;
}
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];
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))
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++;
&newMerge))
{
InitKeyNamesInfo(&included);
- HandleKeycodesFile(rtrn, keymap, MergeOverride, &included);
+ HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
if (stmt->stmt != NULL)
{
free(included.name);
&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);
* 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))
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;
}
static int
HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
- unsigned merge, KeyNamesInfo *info)
+ enum merge_mode merge, KeyNamesInfo *info)
{
IndicatorNameInfo ii;
ExprResult tmp;
*
* @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;
* @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 */
/* 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;
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;
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)
static void
MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
- unsigned merge, struct xkb_keymap *keymap)
+ enum merge_mode merge, struct xkb_keymap *keymap)
{
KeyTypeInfo *type;
}
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++;
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,
*/
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;
* 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;
}
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;
{
*pCollide |= field;
}
- if (newDefs->merge != MergeAugment)
+ if (newDefs->merge != MERGE_AUGMENT)
useNew = true;
}
}
}
| 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;
;
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; }
{
def->common.stmtType = StmtKeyTypeDef;
def->common.next = NULL;
- def->merge = MergeDefault;
+ def->merge = MERGE_DEFAULT;
def->name = name;
def->body = body;
}
{
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;
{
def->common.stmtType = StmtGroupCompatDef;
def->common.next = NULL;
- def->merge = MergeDefault;
+ def->merge = MERGE_DEFAULT;
def->group = group;
def->def = val;
}
{
def->common.stmtType = StmtModMapDef;
def->common.next = NULL;
- def->merge = MergeDefault;
+ def->merge = MERGE_DEFAULT;
def->modifier = modifier;
def->keys = keys;
}
{
def->common.stmtType = StmtIndicatorMapDef;
def->common.next = NULL;
- def->merge = MergeDefault;
+ def->merge = MERGE_DEFAULT;
def->name = name;
def->body = body;
}
{
def->common.stmtType = StmtIndicatorNameDef;
def->common.next = NULL;
- def->merge = MergeDefault;
+ def->merge = MERGE_DEFAULT;
def->ndx = ndx;
def->name = name;
def->virtual = virtual;
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;
break;
}
if (nextop == '|')
- merge = MergeAugment;
+ merge = MERGE_AUGMENT;
else
- merge = MergeOverride;
+ merge = MERGE_OVERRIDE;
}
else
{
}
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;
}
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);
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;
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;
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;
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;
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));
unsigned collide = 0;
bool report;
- if (from->defs.merge == MergeReplace)
+ if (from->defs.merge == MERGE_REPLACE)
{
for (i = 0; i < XkbNumKbdGroups; i++)
{
{
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];
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];
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;
}
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
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;
{
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))
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++;
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,
{
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;
{
included.explicit_group = info->explicit_group;
}
- HandleSymbolsFile(rtrn, keymap, MergeOverride, &included);
+ HandleSymbolsFile(rtrn, keymap, MERGE_OVERRIDE, &included);
if (stmt->stmt != NULL)
{
free(included.name);
{
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;
{
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);
static void
HandleSymbolsFile(XkbFile *file, struct xkb_keymap *keymap,
- unsigned merge, SymbolsInfo *info)
+ enum merge_mode merge, SymbolsInfo *info)
{
ParseCommon *stmt;
*
* @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;
* 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;
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;
}
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
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);
#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)
typedef struct _IncludeStmt
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
char *stmt;
char *file;
char *map;
typedef struct _VarDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
ExprDef *name;
ExprDef *value;
} VarDef;
typedef struct _VModDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
xkb_atom_t name;
ExprDef *value;
} VModDef;
typedef struct _KeycodeDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
char name[5];
unsigned long value;
} KeycodeDef;
typedef struct _KeyAliasDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
char alias[5];
char real[5];
} KeyAliasDef;
typedef struct _KeyTypeDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
xkb_atom_t name;
VarDef *body;
} KeyTypeDef;
typedef struct _SymbolsDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
char keyName[5];
ExprDef *symbols;
} SymbolsDef;
typedef struct _ModMapDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
xkb_atom_t modifier;
ExprDef *keys;
} ModMapDef;
typedef struct _GroupCompatDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
int group;
ExprDef *def;
} GroupCompatDef;
typedef struct _InterpDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
char *sym;
ExprDef *match;
VarDef *def;
typedef struct _IndicatorNameDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
int ndx;
ExprDef *name;
bool virtual;
typedef struct _IndicatorMapDef
{
ParseCommon common;
- unsigned merge;
+ enum merge_mode merge;
unsigned type;
xkb_atom_t name;
VarDef *body;
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 */