typedef struct {
enum si_field defined;
- unsigned file_id;
enum merge_mode merge;
struct xkb_sym_interpret interp;
typedef struct {
enum led_field defined;
- unsigned file_id;
enum merge_mode merge;
struct xkb_led led;
typedef struct {
char *name;
- unsigned file_id;
int errorCount;
SymInterpInfo default_interp;
darray(SymInterpInfo) interps;
}
static void
-InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id,
+InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap,
ActionsInfo *actions)
{
memset(info, 0, sizeof(*info));
info->keymap = keymap;
- info->file_id = file_id;
info->actions = actions;
- info->default_interp.file_id = file_id;
info->default_interp.merge = MERGE_OVERRIDE;
info->default_interp.interp.virtual_mod = XKB_MOD_INVALID;
- info->default_led.file_id = file_id;
info->default_led.merge = MERGE_OVERRIDE;
}
}
static bool
-AddInterp(CompatInfo *info, SymInterpInfo *new)
+AddInterp(CompatInfo *info, SymInterpInfo *new, bool same_file)
{
- enum si_field collide = 0;
- SymInterpInfo *old;
-
- old = FindMatchingInterp(info, new);
+ SymInterpInfo *old = FindMatchingInterp(info, new);
if (old) {
- int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
- bool report = ((old->file_id == new->file_id && verbosity > 0) ||
- verbosity > 9);
+ const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
+ const bool report = (same_file && verbosity > 0) || verbosity > 9;
+ enum si_field collide = 0;
if (new->merge == MERGE_REPLACE) {
if (report)
return true;
}
-
/***====================================================================***/
static bool
}
static bool
-AddLedMap(CompatInfo *info, LedInfo *new)
+AddLedMap(CompatInfo *info, LedInfo *new, bool same_file)
{
LedInfo *old;
enum led_field collide;
struct xkb_context *ctx = info->keymap->ctx;
- int verbosity = xkb_context_get_log_verbosity(ctx);
+ const int verbosity = xkb_context_get_log_verbosity(ctx);
+ const bool report = (same_file && verbosity > 0) || verbosity > 9;
darray_foreach(old, info->leds) {
- bool report;
-
if (old->led.name != new->led.name)
continue;
return true;
}
- report = ((old->file_id == new->file_id && verbosity > 0) ||
- verbosity > 9);
-
if (new->merge == MERGE_REPLACE) {
if (report)
log_warn(info->keymap->ctx,
darray_foreach(si, from->interps) {
si->merge = (merge == MERGE_DEFAULT ? si->merge : merge);
- if (!AddInterp(into, si))
+ if (!AddInterp(into, si, false))
into->errorCount++;
}
darray_foreach(ledi, from->leds) {
ledi->merge = (merge == MERGE_DEFAULT ? ledi->merge : merge);
- if (!AddLedMap(into, ledi))
+ if (!AddLedMap(into, ledi, false))
into->errorCount++;
}
}
{
CompatInfo included;
- InitCompatInfo(&included, info->keymap, info->file_id, info->actions);
+ InitCompatInfo(&included, info->keymap, info->actions);
included.name = include->stmt;
include->stmt = NULL;
return false;
}
- InitCompatInfo(&next_incl, info->keymap, file->id, info->actions);
+ InitCompatInfo(&next_incl, info->keymap, info->actions);
next_incl.default_interp = info->default_interp;
- next_incl.default_interp.file_id = file->id;
next_incl.default_interp.merge = stmt->merge;
next_incl.default_led = info->default_led;
- next_incl.default_led.file_id = file->id;
next_incl.default_led.merge = stmt->merge;
HandleCompatMapFile(&next_incl, file, MERGE_OVERRIDE);
return false;
}
- if (!AddInterp(info, &si)) {
+ if (!AddInterp(info, &si, true)) {
info->errorCount++;
return false;
}
}
if (ok)
- return AddLedMap(info, &ledi);
+ return AddLedMap(info, &ledi, true);
return false;
}
if (!actions)
return false;
- InitCompatInfo(&info, keymap, file->id, actions);
+ InitCompatInfo(&info, keymap, actions);
info.default_interp.merge = merge;
info.default_led.merge = merge;