symbols: remove file_id See previous commits. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 2ae184c..eb8af20 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -86,7 +86,6 @@ typedef struct {
typedef struct {
enum key_field defined;
- unsigned file_id;
enum merge_mode merge;
xkb_atom_t name;
@@ -140,10 +139,9 @@ CopyGroupInfo(GroupInfo *to, const GroupInfo *from)
}
static void
-InitKeyInfo(struct xkb_context *ctx, KeyInfo *keyi, unsigned file_id)
+InitKeyInfo(struct xkb_context *ctx, KeyInfo *keyi)
{
memset(keyi, 0, sizeof(*keyi));
- keyi->file_id = file_id;
keyi->merge = MERGE_OVERRIDE;
keyi->name = xkb_atom_intern(ctx, "*");
keyi->out_of_range_group_action = RANGE_WRAP;
@@ -173,7 +171,6 @@ typedef struct {
typedef struct {
char *name; /* e.g. pc+us+inet(evdev) */
int errorCount;
- unsigned file_id;
enum merge_mode merge;
xkb_layout_index_t explicit_group;
darray(KeyInfo) keys;
@@ -187,13 +184,12 @@ typedef struct {
static void
InitSymbolsInfo(SymbolsInfo *info, struct xkb_keymap *keymap,
- unsigned file_id, ActionsInfo *actions)
+ ActionsInfo *actions)
{
memset(info, 0, sizeof(*info));
info->keymap = keymap;
- info->file_id = file_id;
info->merge = MERGE_OVERRIDE;
- InitKeyInfo(keymap->ctx, &info->default_key, file_id);
+ InitKeyInfo(keymap->ctx, &info->default_key);
info->actions = actions;
info->explicit_group = XKB_LAYOUT_INVALID;
}
@@ -348,27 +344,23 @@ UseNewKeyField(enum key_field field, enum key_field old, enum key_field new,
}
static bool
-MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
+MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from, bool same_file)
{
xkb_layout_index_t i;
xkb_layout_index_t groups_in_both;
enum key_field collide = 0;
- bool clobber, report;
- int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
+ const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
+ const bool clobber = (from->merge != MERGE_AUGMENT);
+ const bool report = (same_file && verbosity > 0) || verbosity > 9;
if (from->merge == MERGE_REPLACE) {
ClearKeyInfo(into);
*into = *from;
- InitKeyInfo(info->keymap->ctx, from, info->file_id);
+ InitKeyInfo(info->keymap->ctx, from);
return true;
}
- clobber = (from->merge != MERGE_AUGMENT);
- report = (verbosity > 9 ||
- (into->file_id == from->file_id && verbosity > 0));
-
- groups_in_both = MIN(darray_size(into->groups),
- darray_size(from->groups));
+ groups_in_both = MIN(darray_size(into->groups), darray_size(from->groups));
for (i = 0; i < groups_in_both; i++)
MergeGroups(info,
&darray_item(into->groups, i),
@@ -410,12 +402,12 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
(clobber ? "first" : "last"));
ClearKeyInfo(from);
- InitKeyInfo(info->keymap->ctx, from, info->file_id);
+ InitKeyInfo(info->keymap->ctx, from);
return true;
}
static bool
-AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi)
+AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi, bool same_file)
{
xkb_atom_t real_name;
KeyInfo *iter;
@@ -432,10 +424,10 @@ AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi)
darray_foreach(iter, info->keys)
if (iter->name == keyi->name)
- return MergeKeys(info, iter, keyi);
+ return MergeKeys(info, iter, keyi, same_file);
darray_append(info->keys, *keyi);
- InitKeyInfo(info->keymap->ctx, keyi, info->file_id);
+ InitKeyInfo(info->keymap->ctx, keyi);
return true;
}
@@ -521,7 +513,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from,
darray_foreach(keyi, from->keys) {
keyi->merge = (merge == MERGE_DEFAULT ? keyi->merge : merge);
- if (!AddKeySymbols(into, keyi))
+ if (!AddKeySymbols(into, keyi, false))
into->errorCount++;
}
@@ -540,7 +532,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include)
{
SymbolsInfo included;
- InitSymbolsInfo(&included, info->keymap, info->file_id, info->actions);
+ InitSymbolsInfo(&included, info->keymap, info->actions);
included.name = include->stmt;
include->stmt = NULL;
@@ -555,7 +547,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include)
return false;
}
- InitSymbolsInfo(&next_incl, info->keymap, file->id, info->actions);
+ InitSymbolsInfo(&next_incl, info->keymap, info->actions);
if (stmt->modifier) {
next_incl.explicit_group = atoi(stmt->modifier) - 1;
if (next_incl.explicit_group >= XKB_MAX_GROUPS) {
@@ -1176,7 +1168,7 @@ HandleSymbolsDef(SymbolsInfo *info, SymbolsDef *stmt)
return false;
}
- if (!AddKeySymbols(info, &keyi)) {
+ if (!AddKeySymbols(info, &keyi, true)) {
info->errorCount++;
return false;
}
@@ -1621,7 +1613,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
if (!actions)
return false;
- InitSymbolsInfo(&info, keymap, file->id, actions);
+ InitSymbolsInfo(&info, keymap, actions);
info.default_key.merge = merge;
HandleSymbolsFile(&info, file, merge);