symbols: separate ctx

Same as was done for compat and types.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2013-02-08 00:28:49 +02:00
parent 659eacc9fc
commit 120c5c317e
1 changed files with 73 additions and 73 deletions

View File

@ -178,6 +178,7 @@ typedef struct {
darray(xkb_atom_t) group_names; darray(xkb_atom_t) group_names;
darray(ModMapEntry) modmaps; darray(ModMapEntry) modmaps;
struct xkb_context *ctx;
struct xkb_keymap *keymap; struct xkb_keymap *keymap;
} SymbolsInfo; } SymbolsInfo;
@ -186,6 +187,7 @@ InitSymbolsInfo(SymbolsInfo *info, struct xkb_keymap *keymap,
ActionsInfo *actions) ActionsInfo *actions)
{ {
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->ctx = keymap->ctx;
info->keymap = keymap; info->keymap = keymap;
info->merge = MERGE_OVERRIDE; info->merge = MERGE_OVERRIDE;
InitKeyInfo(keymap->ctx, &info->default_key); InitKeyInfo(keymap->ctx, &info->default_key);
@ -209,7 +211,7 @@ ClearSymbolsInfo(SymbolsInfo *info)
static const char * static const char *
KeyInfoText(SymbolsInfo *info, KeyInfo *keyi) KeyInfoText(SymbolsInfo *info, KeyInfo *keyi)
{ {
return KeyNameText(info->keymap->ctx, keyi->name); return KeyNameText(info->ctx, keyi->name);
} }
static bool static bool
@ -217,7 +219,6 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
bool report, xkb_layout_index_t group, xkb_atom_t key_name) bool report, xkb_layout_index_t group, xkb_atom_t key_name)
{ {
xkb_level_index_t i, levels_in_both; xkb_level_index_t i, levels_in_both;
struct xkb_context *ctx = info->keymap->ctx;
/* First find the type of the merged group. */ /* First find the type of the merged group. */
if (into->type != from->type) { if (into->type != from->type) {
@ -231,11 +232,12 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
xkb_atom_t ignore = (clobber ? into->type : from->type); xkb_atom_t ignore = (clobber ? into->type : from->type);
if (report) if (report)
log_warn(info->keymap->ctx, log_warn(info->ctx,
"Multiple definitions for group %d type of key %s; " "Multiple definitions for group %d type of key %s; "
"Using %s, ignoring %s\n", "Using %s, ignoring %s\n",
group + 1, KeyNameText(ctx, key_name), group + 1, KeyNameText(info->ctx, key_name),
xkb_atom_text(ctx, use), xkb_atom_text(ctx, ignore)); xkb_atom_text(info->ctx, use),
xkb_atom_text(info->ctx, ignore));
into->type = use; into->type = use;
} }
@ -273,10 +275,10 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
ignore = (clobber ? &intoLevel->action : &fromLevel->action); ignore = (clobber ? &intoLevel->action : &fromLevel->action);
if (report) if (report)
log_warn(ctx, log_warn(info->ctx,
"Multiple actions for level %d/group %u on key %s; " "Multiple actions for level %d/group %u on key %s; "
"Using %s, ignoring %s\n", "Using %s, ignoring %s\n",
i + 1, group + 1, KeyNameText(ctx, key_name), i + 1, group + 1, KeyNameText(info->ctx, key_name),
ActionTypeText(use->type), ActionTypeText(use->type),
ActionTypeText(ignore->type)); ActionTypeText(ignore->type));
@ -295,10 +297,10 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
} }
else { else {
if (report) if (report)
log_warn(ctx, log_warn(info->ctx,
"Multiple symbols for level %d/group %u on key %s; " "Multiple symbols for level %d/group %u on key %s; "
"Using %s, ignoring %s\n", "Using %s, ignoring %s\n",
i + 1, group + 1, KeyNameText(ctx, key_name), i + 1, group + 1, KeyNameText(info->ctx, key_name),
(clobber ? "from" : "to"), (clobber ? "from" : "to"),
(clobber ? "to" : "from")); (clobber ? "to" : "from"));
@ -348,14 +350,14 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from, bool same_file)
xkb_layout_index_t i; xkb_layout_index_t i;
xkb_layout_index_t groups_in_both; xkb_layout_index_t groups_in_both;
enum key_field collide = 0; enum key_field collide = 0;
const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); const int verbosity = xkb_context_get_log_verbosity(info->ctx);
const bool clobber = (from->merge != MERGE_AUGMENT); const bool clobber = (from->merge != MERGE_AUGMENT);
const bool report = (same_file && verbosity > 0) || verbosity > 9; const bool report = (same_file && verbosity > 0) || verbosity > 9;
if (from->merge == MERGE_REPLACE) { if (from->merge == MERGE_REPLACE) {
ClearKeyInfo(into); ClearKeyInfo(into);
*into = *from; *into = *from;
InitKeyInfo(info->keymap->ctx, from); InitKeyInfo(info->ctx, from);
return true; return true;
} }
@ -394,14 +396,14 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from, bool same_file)
} }
if (collide) if (collide)
log_warn(info->keymap->ctx, log_warn(info->ctx,
"Symbol map for key %s redefined; " "Symbol map for key %s redefined; "
"Using %s definition for conflicting fields\n", "Using %s definition for conflicting fields\n",
KeyNameText(info->keymap->ctx, into->name), KeyNameText(info->ctx, into->name),
(clobber ? "first" : "last")); (clobber ? "first" : "last"));
ClearKeyInfo(from); ClearKeyInfo(from);
InitKeyInfo(info->keymap->ctx, from); InitKeyInfo(info->ctx, from);
return true; return true;
} }
@ -426,7 +428,7 @@ AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi, bool same_file)
return MergeKeys(info, iter, keyi, same_file); return MergeKeys(info, iter, keyi, same_file);
darray_append(info->keys, *keyi); darray_append(info->keys, *keyi);
InitKeyInfo(info->keymap->ctx, keyi); InitKeyInfo(info->ctx, keyi);
return true; return true;
} }
@ -451,17 +453,17 @@ AddModMapEntry(SymbolsInfo *info, ModMapEntry *new)
ignore = (clobber ? old->modifier : new->modifier); ignore = (clobber ? old->modifier : new->modifier);
if (new->haveSymbol) if (new->haveSymbol)
log_err(info->keymap->ctx, log_err(info->ctx,
"Symbol \"%s\" added to modifier map for multiple modifiers; " "Symbol \"%s\" added to modifier map for multiple modifiers; "
"Using %s, ignoring %s\n", "Using %s, ignoring %s\n",
KeysymText(info->keymap->ctx, new->u.keySym), KeysymText(info->ctx, new->u.keySym),
ModIndexText(info->keymap, use), ModIndexText(info->keymap, use),
ModIndexText(info->keymap, ignore)); ModIndexText(info->keymap, ignore));
else else
log_err(info->keymap->ctx, log_err(info->ctx,
"Key \"%s\" added to modifier map for multiple modifiers; " "Key \"%s\" added to modifier map for multiple modifiers; "
"Using %s, ignoring %s\n", "Using %s, ignoring %s\n",
KeyNameText(info->keymap->ctx, new->u.keyName), KeyNameText(info->ctx, new->u.keyName),
ModIndexText(info->keymap, use), ModIndexText(info->keymap, use),
ModIndexText(info->keymap, ignore)); ModIndexText(info->keymap, ignore));
@ -550,7 +552,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include)
SymbolsInfo next_incl; SymbolsInfo next_incl;
XkbFile *file; XkbFile *file;
file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS); file = ProcessIncludeFile(info->ctx, stmt, FILE_TYPE_SYMBOLS);
if (!file) { if (!file) {
info->errorCount += 10; info->errorCount += 10;
ClearSymbolsInfo(&included); ClearSymbolsInfo(&included);
@ -561,7 +563,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include)
if (stmt->modifier) { if (stmt->modifier) {
next_incl.explicit_group = atoi(stmt->modifier) - 1; next_incl.explicit_group = atoi(stmt->modifier) - 1;
if (next_incl.explicit_group >= XKB_MAX_GROUPS) { if (next_incl.explicit_group >= XKB_MAX_GROUPS) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Cannot set explicit group to %d - must be between 1..%d; " "Cannot set explicit group to %d - must be between 1..%d; "
"Ignoring group number\n", "Ignoring group number\n",
next_incl.explicit_group + 1, XKB_MAX_GROUPS); next_incl.explicit_group + 1, XKB_MAX_GROUPS);
@ -609,7 +611,7 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
} }
if (i >= XKB_MAX_GROUPS) { if (i >= XKB_MAX_GROUPS) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Too many groups of %s for key %s (max %u); " "Too many groups of %s for key %s (max %u); "
"Ignoring %s defined for extra groups\n", "Ignoring %s defined for extra groups\n",
name, KeyInfoText(info, keyi), XKB_MAX_GROUPS, name); name, KeyInfoText(info, keyi), XKB_MAX_GROUPS, name);
@ -621,8 +623,8 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
return true; return true;
} }
if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, ndx_rtrn)) { if (!ExprResolveGroup(info->ctx, arrayNdx, ndx_rtrn)) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Illegal group index for %s of key %s\n" "Illegal group index for %s of key %s\n"
"Definition with non-integer array index ignored\n", "Definition with non-integer array index ignored\n",
name, KeyInfoText(info, keyi)); name, KeyInfoText(info, keyi));
@ -655,7 +657,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
} }
if (value->expr.op != EXPR_KEYSYM_LIST) { if (value->expr.op != EXPR_KEYSYM_LIST) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Expected a list of symbols, found %s; " "Expected a list of symbols, found %s; "
"Ignoring symbols for group %u of %s\n", "Ignoring symbols for group %u of %s\n",
expr_op_type_to_string(value->expr.op), ndx + 1, expr_op_type_to_string(value->expr.op), ndx + 1,
@ -664,7 +666,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
} }
if (groupi->defined & GROUP_FIELD_SYMS) { if (groupi->defined & GROUP_FIELD_SYMS) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Symbols for key %s, group %u already defined; " "Symbols for key %s, group %u already defined; "
"Ignoring duplicate definition\n", "Ignoring duplicate definition\n",
KeyInfoText(info, keyi), ndx + 1); KeyInfoText(info, keyi), ndx + 1);
@ -725,7 +727,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
} }
if (value->expr.op != EXPR_ACTION_LIST) { if (value->expr.op != EXPR_ACTION_LIST) {
log_wsgo(info->keymap->ctx, log_wsgo(info->ctx,
"Bad expression type (%d) for action list value; " "Bad expression type (%d) for action list value; "
"Ignoring actions for group %u of %s\n", "Ignoring actions for group %u of %s\n",
value->expr.op, ndx, KeyInfoText(info, keyi)); value->expr.op, ndx, KeyInfoText(info, keyi));
@ -733,7 +735,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
} }
if (groupi->defined & GROUP_FIELD_ACTS) { if (groupi->defined & GROUP_FIELD_ACTS) {
log_wsgo(info->keymap->ctx, log_wsgo(info->ctx,
"Actions for key %s, group %u already defined\n", "Actions for key %s, group %u already defined\n",
KeyInfoText(info, keyi), ndx); KeyInfoText(info, keyi), ndx);
return false; return false;
@ -753,7 +755,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
union xkb_action *toAct = &darray_item(groupi->levels, i).action; union xkb_action *toAct = &darray_item(groupi->levels, i).action;
if (!HandleActionDef(act, info->keymap, toAct, info->actions)) if (!HandleActionDef(act, info->keymap, toAct, info->actions))
log_err(info->keymap->ctx, log_err(info->ctx,
"Illegal action definition for %s; " "Illegal action definition for %s; "
"Action for group %u/level %u ignored\n", "Action for group %u/level %u ignored\n",
KeyInfoText(info, keyi), ndx + 1, i + 1); KeyInfoText(info, keyi), ndx + 1, i + 1);
@ -779,14 +781,12 @@ static bool
SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
ExprDef *arrayNdx, ExprDef *value) ExprDef *arrayNdx, ExprDef *value)
{ {
struct xkb_context *ctx = info->keymap->ctx;
if (istreq(field, "type")) { if (istreq(field, "type")) {
xkb_layout_index_t ndx; xkb_layout_index_t ndx;
xkb_atom_t val; xkb_atom_t val;
if (!ExprResolveString(ctx, value, &val)) { if (!ExprResolveString(info->ctx, value, &val)) {
log_err(ctx, log_err(info->ctx,
"The type field of a key symbol map must be a string; " "The type field of a key symbol map must be a string; "
"Ignoring illegal type definition\n"); "Ignoring illegal type definition\n");
return false; return false;
@ -796,8 +796,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
keyi->default_type = val; keyi->default_type = val;
keyi->defined |= KEY_FIELD_DEFAULT_TYPE; keyi->defined |= KEY_FIELD_DEFAULT_TYPE;
} }
else if (!ExprResolveGroup(ctx, arrayNdx, &ndx)) { else if (!ExprResolveGroup(info->ctx, arrayNdx, &ndx)) {
log_err(ctx, log_err(info->ctx,
"Illegal group index for type of key %s; " "Illegal group index for type of key %s; "
"Definition with non-integer array index ignored\n", "Definition with non-integer array index ignored\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -823,7 +823,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
xkb_mod_mask_t mask; xkb_mod_mask_t mask;
if (!ExprResolveModMask(info->keymap, value, MOD_VIRT, &mask)) { if (!ExprResolveModMask(info->keymap, value, MOD_VIRT, &mask)) {
log_err(ctx, log_err(info->ctx,
"Expected a virtual modifier mask, found %s; " "Expected a virtual modifier mask, found %s; "
"Ignoring virtual modifiers definition for key %s\n", "Ignoring virtual modifiers definition for key %s\n",
expr_op_type_to_string(value->expr.op), expr_op_type_to_string(value->expr.op),
@ -837,7 +837,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
else if (istreq(field, "locking") || else if (istreq(field, "locking") ||
istreq(field, "lock") || istreq(field, "lock") ||
istreq(field, "locks")) { istreq(field, "locks")) {
log_vrb(ctx, 1, log_vrb(info->ctx, 1,
"Key behaviors not supported; " "Key behaviors not supported; "
"Ignoring locking specification for key %s\n", "Ignoring locking specification for key %s\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -845,14 +845,14 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
else if (istreq(field, "radiogroup") || else if (istreq(field, "radiogroup") ||
istreq(field, "permanentradiogroup") || istreq(field, "permanentradiogroup") ||
istreq(field, "allownone")) { istreq(field, "allownone")) {
log_vrb(ctx, 1, log_vrb(info->ctx, 1,
"Radio groups not supported; " "Radio groups not supported; "
"Ignoring radio group specification for key %s\n", "Ignoring radio group specification for key %s\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
} }
else if (istreq_prefix("overlay", field) || else if (istreq_prefix("overlay", field) ||
istreq_prefix("permanentoverlay", field)) { istreq_prefix("permanentoverlay", field)) {
log_vrb(ctx, 1, log_vrb(info->ctx, 1,
"Overlays not supported; " "Overlays not supported; "
"Ignoring overlay specification for key %s\n", "Ignoring overlay specification for key %s\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -862,8 +862,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
istreq(field, "repeat")) { istreq(field, "repeat")) {
unsigned int val; unsigned int val;
if (!ExprResolveEnum(ctx, value, &val, repeatEntries)) { if (!ExprResolveEnum(info->ctx, value, &val, repeatEntries)) {
log_err(ctx, log_err(info->ctx,
"Illegal repeat setting for %s; " "Illegal repeat setting for %s; "
"Non-boolean repeat setting ignored\n", "Non-boolean repeat setting ignored\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -877,8 +877,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
istreq(field, "wrapgroups")) { istreq(field, "wrapgroups")) {
bool set; bool set;
if (!ExprResolveBoolean(ctx, value, &set)) { if (!ExprResolveBoolean(info->ctx, value, &set)) {
log_err(ctx, log_err(info->ctx,
"Illegal groupsWrap setting for %s; " "Illegal groupsWrap setting for %s; "
"Non-boolean value ignored\n", "Non-boolean value ignored\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -892,8 +892,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
istreq(field, "clampgroups")) { istreq(field, "clampgroups")) {
bool set; bool set;
if (!ExprResolveBoolean(ctx, value, &set)) { if (!ExprResolveBoolean(info->ctx, value, &set)) {
log_err(ctx, log_err(info->ctx,
"Illegal groupsClamp setting for %s; " "Illegal groupsClamp setting for %s; "
"Non-boolean value ignored\n", "Non-boolean value ignored\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -907,8 +907,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
istreq(field, "redirectgroups")) { istreq(field, "redirectgroups")) {
xkb_layout_index_t grp; xkb_layout_index_t grp;
if (!ExprResolveGroup(ctx, value, &grp)) { if (!ExprResolveGroup(info->ctx, value, &grp)) {
log_err(ctx, log_err(info->ctx,
"Illegal group index for redirect of key %s; " "Illegal group index for redirect of key %s; "
"Definition with non-integer group ignored\n", "Definition with non-integer group ignored\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
@ -920,7 +920,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
keyi->defined |= KEY_FIELD_GROUPINFO; keyi->defined |= KEY_FIELD_GROUPINFO;
} }
else { else {
log_err(ctx, log_err(info->ctx,
"Unknown field %s in a symbol interpretation; " "Unknown field %s in a symbol interpretation; "
"Definition ignored\n", "Definition ignored\n",
field); field);
@ -937,21 +937,21 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value)
xkb_atom_t name; xkb_atom_t name;
if (!arrayNdx) { if (!arrayNdx) {
log_vrb(info->keymap->ctx, 1, log_vrb(info->ctx, 1,
"You must specify an index when specifying a group name; " "You must specify an index when specifying a group name; "
"Group name definition without array subscript ignored\n"); "Group name definition without array subscript ignored\n");
return false; return false;
} }
if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, &group)) { if (!ExprResolveGroup(info->ctx, arrayNdx, &group)) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Illegal index in group name definition; " "Illegal index in group name definition; "
"Definition with non-integer array index ignored\n"); "Definition with non-integer array index ignored\n");
return false; return false;
} }
if (!ExprResolveString(info->keymap->ctx, value, &name)) { if (!ExprResolveString(info->ctx, value, &name)) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Group name must be a string; " "Group name must be a string; "
"Illegal name for group %d ignored\n", group); "Illegal name for group %d ignored\n", group);
return false; return false;
@ -964,12 +964,12 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value)
group_to_use = info->explicit_group; group_to_use = info->explicit_group;
} }
else { else {
log_warn(info->keymap->ctx, log_warn(info->ctx,
"An explicit group was specified for the '%s' map, " "An explicit group was specified for the '%s' map, "
"but it provides a name for a group other than Group1 (%d); " "but it provides a name for a group other than Group1 (%d); "
"Ignoring group name '%s'\n", "Ignoring group name '%s'\n",
info->name, group, info->name, group,
xkb_atom_text(info->keymap->ctx, name)); xkb_atom_text(info->ctx, name));
return false; return false;
} }
@ -987,7 +987,7 @@ HandleGlobalVar(SymbolsInfo *info, VarDef *stmt)
ExprDef *arrayNdx; ExprDef *arrayNdx;
bool ret; bool ret;
if (!ExprResolveLhs(info->keymap->ctx, stmt->name, &elem, &field, &arrayNdx)) if (!ExprResolveLhs(info->ctx, stmt->name, &elem, &field, &arrayNdx))
return false; return false;
if (elem && istreq(elem, "key")) { if (elem && istreq(elem, "key")) {
@ -1000,24 +1000,24 @@ HandleGlobalVar(SymbolsInfo *info, VarDef *stmt)
} }
else if (!elem && (istreq(field, "groupswrap") || else if (!elem && (istreq(field, "groupswrap") ||
istreq(field, "wrapgroups"))) { istreq(field, "wrapgroups"))) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Global \"groupswrap\" not supported; Ignored\n"); "Global \"groupswrap\" not supported; Ignored\n");
ret = true; ret = true;
} }
else if (!elem && (istreq(field, "groupsclamp") || else if (!elem && (istreq(field, "groupsclamp") ||
istreq(field, "clampgroups"))) { istreq(field, "clampgroups"))) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Global \"groupsclamp\" not supported; Ignored\n"); "Global \"groupsclamp\" not supported; Ignored\n");
ret = true; ret = true;
} }
else if (!elem && (istreq(field, "groupsredirect") || else if (!elem && (istreq(field, "groupsredirect") ||
istreq(field, "redirectgroups"))) { istreq(field, "redirectgroups"))) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Global \"groupsredirect\" not supported; Ignored\n"); "Global \"groupsredirect\" not supported; Ignored\n");
ret = true; ret = true;
} }
else if (!elem && istreq(field, "allownone")) { else if (!elem && istreq(field, "allownone")) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Radio groups not supported; " "Radio groups not supported; "
"Ignoring \"allownone\" specification\n"); "Ignoring \"allownone\" specification\n");
ret = true; ret = true;
@ -1039,7 +1039,7 @@ HandleSymbolsBody(SymbolsInfo *info, VarDef *def, KeyInfo *keyi)
for (; def; def = (VarDef *) def->common.next) { for (; def; def = (VarDef *) def->common.next) {
if (def->name && def->name->expr.op == EXPR_FIELD_REF) { if (def->name && def->name->expr.op == EXPR_FIELD_REF) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Cannot set a global default value from within a key statement; " "Cannot set a global default value from within a key statement; "
"Move statements to the global file scope\n"); "Move statements to the global file scope\n");
continue; continue;
@ -1053,7 +1053,7 @@ HandleSymbolsBody(SymbolsInfo *info, VarDef *def, KeyInfo *keyi)
arrayNdx = NULL; arrayNdx = NULL;
} }
else { else {
ok = ExprResolveLhs(info->keymap->ctx, def->name, &elem, &field, ok = ExprResolveLhs(info->ctx, def->name, &elem, &field,
&arrayNdx); &arrayNdx);
} }
@ -1083,7 +1083,7 @@ SetExplicitGroup(SymbolsInfo *info, KeyInfo *keyi)
} }
if (warn) if (warn)
log_warn(info->keymap->ctx, log_warn(info->ctx,
"For the map %s an explicit group specified, " "For the map %s an explicit group specified, "
"but key %s has more than one group defined; " "but key %s has more than one group defined; "
"All groups except first one will be ignored\n", "All groups except first one will be ignored\n",
@ -1137,11 +1137,11 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
ModMapEntry tmp; ModMapEntry tmp;
xkb_mod_index_t ndx; xkb_mod_index_t ndx;
bool ok; bool ok;
struct xkb_context *ctx = info->keymap->ctx; struct xkb_context *ctx = info->ctx;
ndx = ModNameToIndex(info->keymap, def->modifier, MOD_REAL); ndx = ModNameToIndex(info->keymap, def->modifier, MOD_REAL);
if (ndx == XKB_MOD_INVALID) { if (ndx == XKB_MOD_INVALID) {
log_err(info->keymap->ctx, log_err(info->ctx,
"Illegal modifier map definition; " "Illegal modifier map definition; "
"Ignoring map for non-modifier \"%s\"\n", "Ignoring map for non-modifier \"%s\"\n",
xkb_atom_text(ctx, def->modifier)); xkb_atom_text(ctx, def->modifier));
@ -1165,7 +1165,7 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
tmp.u.keySym = sym; tmp.u.keySym = sym;
} }
else { else {
log_err(info->keymap->ctx, log_err(info->ctx,
"Modmap entries may contain only key names or keysyms; " "Modmap entries may contain only key names or keysyms; "
"Illegal definition for %s modifier ignored\n", "Illegal definition for %s modifier ignored\n",
ModIndexText(info->keymap, tmp.modifier)); ModIndexText(info->keymap, tmp.modifier));
@ -1203,7 +1203,7 @@ HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge)
ok = HandleModMapDef(info, (ModMapDef *) stmt); ok = HandleModMapDef(info, (ModMapDef *) stmt);
break; break;
default: default:
log_err(info->keymap->ctx, log_err(info->ctx,
"Symbols files may not include other types; " "Symbols files may not include other types; "
"Ignoring %s\n", stmt_type_to_string(stmt->type)); "Ignoring %s\n", stmt_type_to_string(stmt->type));
ok = false; ok = false;
@ -1214,7 +1214,7 @@ HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge)
info->errorCount++; info->errorCount++;
if (info->errorCount > 10) { if (info->errorCount > 10) {
log_err(info->keymap->ctx, "Abandoning symbols file \"%s\"\n", log_err(info->ctx, "Abandoning symbols file \"%s\"\n",
file->topName); file->topName);
break; break;
} }
@ -1400,7 +1400,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
*/ */
key = XkbKeyByName(keymap, keyi->name, false); key = XkbKeyByName(keymap, keyi->name, false);
if (!key) { if (!key) {
log_vrb(info->keymap->ctx, 5, log_vrb(info->ctx, 5,
"Key %s not found in keycodes; Symbols ignored\n", "Key %s not found in keycodes; Symbols ignored\n",
KeyInfoText(info, keyi)); KeyInfoText(info, keyi));
return false; return false;
@ -1443,7 +1443,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
if (type->num_levels < darray_size(groupi->levels)) { if (type->num_levels < darray_size(groupi->levels)) {
struct xkb_level *leveli; struct xkb_level *leveli;
log_vrb(info->keymap->ctx, 1, log_vrb(info->ctx, 1,
"Type \"%s\" has %d levels, but %s has %d levels; " "Type \"%s\" has %d levels, but %s has %d levels; "
"Ignoring extra symbols\n", "Ignoring extra symbols\n",
xkb_atom_text(keymap->ctx, type->name), type->num_levels, xkb_atom_text(keymap->ctx, type->name), type->num_levels,
@ -1497,7 +1497,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
if (!entry->haveSymbol) { if (!entry->haveSymbol) {
key = XkbKeyByName(keymap, entry->u.keyName, true); key = XkbKeyByName(keymap, entry->u.keyName, true);
if (!key) { if (!key) {
log_vrb(info->keymap->ctx, 5, log_vrb(info->ctx, 5,
"Key %s not found in keycodes; " "Key %s not found in keycodes; "
"Modifier map entry for %s not updated\n", "Modifier map entry for %s not updated\n",
KeyNameText(keymap->ctx, entry->u.keyName), KeyNameText(keymap->ctx, entry->u.keyName),
@ -1508,10 +1508,10 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
else { else {
key = FindKeyForSymbol(keymap, entry->u.keySym); key = FindKeyForSymbol(keymap, entry->u.keySym);
if (!key) { if (!key) {
log_vrb(info->keymap->ctx, 5, log_vrb(info->ctx, 5,
"Key \"%s\" not found in symbol map; " "Key \"%s\" not found in symbol map; "
"Modifier map entry for %s not updated\n", "Modifier map entry for %s not updated\n",
KeysymText(info->keymap->ctx, entry->u.keySym), KeysymText(info->ctx, entry->u.keySym),
ModIndexText(info->keymap, entry->modifier)); ModIndexText(info->keymap, entry->modifier));
return false; return false;
} }