types: remove file_id
See previous commit. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
2ddb9e4f98
commit
2b6e576f26
|
@ -144,7 +144,6 @@ enum type_field {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
enum type_field defined;
|
enum type_field defined;
|
||||||
unsigned file_id;
|
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
|
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
|
@ -157,7 +156,6 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int errorCount;
|
int errorCount;
|
||||||
unsigned file_id;
|
|
||||||
|
|
||||||
darray(KeyTypeInfo) types;
|
darray(KeyTypeInfo) types;
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
@ -212,12 +210,10 @@ ReportTypeBadWidth(KeyTypesInfo *info, const char *type, int has, int needs)
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap,
|
InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap)
|
||||||
unsigned file_id)
|
|
||||||
{
|
{
|
||||||
memset(info, 0, sizeof(*info));
|
memset(info, 0, sizeof(*info));
|
||||||
info->keymap = keymap;
|
info->keymap = keymap;
|
||||||
info->file_id = file_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -247,16 +243,15 @@ FindMatchingKeyType(KeyTypesInfo *info, xkb_atom_t name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new)
|
AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new, bool same_file)
|
||||||
{
|
{
|
||||||
KeyTypeInfo *old;
|
KeyTypeInfo *old;
|
||||||
int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
|
const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
|
||||||
|
|
||||||
old = FindMatchingKeyType(info, new->name);
|
old = FindMatchingKeyType(info, new->name);
|
||||||
if (old) {
|
if (old) {
|
||||||
if (new->merge == MERGE_REPLACE || new->merge == MERGE_OVERRIDE) {
|
if (new->merge == MERGE_REPLACE || new->merge == MERGE_OVERRIDE) {
|
||||||
if ((old->file_id == new->file_id && verbosity > 0) ||
|
if ((same_file && verbosity > 0) || verbosity > 9) {
|
||||||
verbosity > 9) {
|
|
||||||
log_warn(info->keymap->ctx,
|
log_warn(info->keymap->ctx,
|
||||||
"Multiple definitions of the %s key type; "
|
"Multiple definitions of the %s key type; "
|
||||||
"Earlier definition ignored\n",
|
"Earlier definition ignored\n",
|
||||||
|
@ -270,7 +265,7 @@ AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old->file_id == new->file_id)
|
if (same_file)
|
||||||
log_vrb(info->keymap->ctx, 4,
|
log_vrb(info->keymap->ctx, 4,
|
||||||
"Multiple definitions of the %s key type; "
|
"Multiple definitions of the %s key type; "
|
||||||
"Later definition ignored\n",
|
"Later definition ignored\n",
|
||||||
|
@ -280,7 +275,6 @@ AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
new->file_id = info->file_id;
|
|
||||||
darray_append(info->types, *new);
|
darray_append(info->types, *new);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +299,7 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
||||||
|
|
||||||
darray_foreach(type, from->types) {
|
darray_foreach(type, from->types) {
|
||||||
type->merge = (merge == MERGE_DEFAULT ? type->merge : merge);
|
type->merge = (merge == MERGE_DEFAULT ? type->merge : merge);
|
||||||
if (!AddKeyType(into, type))
|
if (!AddKeyType(into, type, false))
|
||||||
into->errorCount++;
|
into->errorCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,7 +312,7 @@ HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *include)
|
||||||
{
|
{
|
||||||
KeyTypesInfo included;
|
KeyTypesInfo included;
|
||||||
|
|
||||||
InitKeyTypesInfo(&included, info->keymap, info->file_id);
|
InitKeyTypesInfo(&included, info->keymap);
|
||||||
included.name = include->stmt;
|
included.name = include->stmt;
|
||||||
include->stmt = NULL;
|
include->stmt = NULL;
|
||||||
|
|
||||||
|
@ -333,7 +327,7 @@ HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *include)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitKeyTypesInfo(&next_incl, info->keymap, file->id);
|
InitKeyTypesInfo(&next_incl, info->keymap);
|
||||||
|
|
||||||
HandleKeyTypesFile(&next_incl, file, stmt->merge);
|
HandleKeyTypesFile(&next_incl, file, stmt->merge);
|
||||||
|
|
||||||
|
@ -710,7 +704,6 @@ HandleKeyTypeDef(KeyTypesInfo *info, KeyTypeDef *def, enum merge_mode merge)
|
||||||
{
|
{
|
||||||
KeyTypeInfo type = {
|
KeyTypeInfo type = {
|
||||||
.defined = 0,
|
.defined = 0,
|
||||||
.file_id = info->file_id,
|
|
||||||
.merge = (def->merge == MERGE_DEFAULT ? merge : def->merge),
|
.merge = (def->merge == MERGE_DEFAULT ? merge : def->merge),
|
||||||
.name = def->name,
|
.name = def->name,
|
||||||
.mods = 0,
|
.mods = 0,
|
||||||
|
@ -724,7 +717,7 @@ HandleKeyTypeDef(KeyTypesInfo *info, KeyTypeDef *def, enum merge_mode merge)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AddKeyType(info, &type)) {
|
if (!AddKeyType(info, &type, true)) {
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -831,7 +824,7 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
{
|
{
|
||||||
KeyTypesInfo info;
|
KeyTypesInfo info;
|
||||||
|
|
||||||
InitKeyTypesInfo(&info, keymap, file->id);
|
InitKeyTypesInfo(&info, keymap);
|
||||||
|
|
||||||
HandleKeyTypesFile(&info, file, merge);
|
HandleKeyTypesFile(&info, file, merge);
|
||||||
if (info.errorCount != 0)
|
if (info.errorCount != 0)
|
||||||
|
|
Loading…
Reference in New Issue