From 48b4d30aa39a0d41490b8099576909fda73d3a75 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 29 Jun 2012 17:05:33 +0300 Subject: Use enum for file types enums are nice for some type safety and readability. This one also removes the distinction between file type mask / file type index and some naming consistency. Signed-off-by: Ran Benita --- src/text.c | 16 ++++++------ src/text.h | 2 +- src/xkb-priv.h | 37 ++++++++++++++------------- src/xkbcomp/compat.c | 4 +-- src/xkbcomp/keycodes.c | 4 +-- src/xkbcomp/keymap.c | 62 ++++++++++++++++++++++------------------------ src/xkbcomp/keytypes.c | 4 +-- src/xkbcomp/misc.c | 8 +++--- src/xkbcomp/parser.y | 24 ++++++++++-------- src/xkbcomp/parseutils.c | 16 ++++++------ src/xkbcomp/parseutils.h | 2 +- src/xkbcomp/path.c | 24 +++++++++--------- src/xkbcomp/rules.c | 2 +- src/xkbcomp/symbols.c | 4 +-- src/xkbcomp/xkbcomp-priv.h | 4 +-- src/xkbcomp/xkbcomp.c | 12 ++++----- src/xkbcomp/xkbcomp.h | 2 +- 17 files changed, 115 insertions(+), 112 deletions(-) diff --git a/src/text.c b/src/text.c index 2ca411b..d30c4b7 100644 --- a/src/text.c +++ b/src/text.c @@ -186,19 +186,21 @@ XkbcModMaskText(unsigned mask, bool cFormat) } const char * -XkbcConfigText(unsigned config) +XkbcFileTypeText(enum xkb_file_type type) { - switch (config) { - case XkmKeymapFile: + switch (type) { + case FILE_TYPE_KEYMAP: return "Keymap"; - case XkmTypesIndex: + case FILE_TYPE_TYPES: return "Types"; - case XkmCompatMapIndex: + case FILE_TYPE_COMPAT: return "CompatMap"; - case XkmSymbolsIndex: + case FILE_TYPE_SYMBOLS: return "Symbols"; - case XkmKeyNamesIndex: + case FILE_TYPE_KEYCODES: return "KeyNames"; + case FILE_TYPE_RULES: + return "Rules"; default: return "unknown"; } diff --git a/src/text.h b/src/text.h index ddf9b6f..c21a8b6 100644 --- a/src/text.h +++ b/src/text.h @@ -39,7 +39,7 @@ extern const char * XkbcModMaskText(unsigned mask, bool cFormat); extern const char * -XkbcConfigText(unsigned config); +XkbcFileTypeText(enum xkb_file_type type); extern const char * XkbcActionTypeText(unsigned type); diff --git a/src/xkb-priv.h b/src/xkb-priv.h index 48e4355..75f0004 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -89,25 +89,24 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "utils.h" #include "darray.h" -/* From XKM.h */ -#define XkmKeymapFile 22 -#define XkmRulesFile 24 - -#define XkmTypesIndex 0 -#define XkmCompatMapIndex 1 -#define XkmSymbolsIndex 2 -#define XkmKeyNamesIndex 4 -#define XkmGeometryIndex 5 - -#define XkmTypesMask (1<<0) -#define XkmCompatMapMask (1<<1) -#define XkmSymbolsMask (1<<2) -#define XkmKeyNamesMask (1<<4) -#define XkmGeometryMask (1<<5) - -#define XkmKeymapRequired (XkmCompatMapMask|XkmKeyNamesMask|XkmSymbolsMask|XkmTypesMask) -#define XkmKeymapOptional ((XkmTypesMask|XkmGeometryMask)&(~XkmKeymapRequired)) -#define XkmKeymapLegal (XkmKeymapRequired|XkmKeymapOptional) +enum xkb_file_type { + /* The top level file which includes the other component files. */ + FILE_TYPE_KEYMAP = (1 << 0), + + /* Component files. */ + FILE_TYPE_TYPES = (1 << 1), + FILE_TYPE_COMPAT = (1 << 2), + FILE_TYPE_SYMBOLS = (1 << 3), + FILE_TYPE_KEYCODES = (1 << 4), + FILE_TYPE_GEOMETRY = (1 << 5), + + /* This one doesn't mix with the others, but useful here as well. */ + FILE_TYPE_RULES = (1 << 6), +}; + +/* Files needed for a complete keymap. */ +#define REQUIRED_FILE_TYPES (FILE_TYPE_TYPES | FILE_TYPE_COMPAT | FILE_TYPE_SYMBOLS | FILE_TYPE_KEYCODES) +#define LEGAL_FILE_TYPES (FILE_TYPE_GEOMETRY | REQUIRED_FILE_TYPES) /** * Legacy names for the components of an XKB keymap, also known as KcCGST. diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 7ea226a..7c6db8a 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -404,7 +404,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap, included = *info; memset(info, 0, sizeof(CompatInfo)); } - else if (ProcessIncludeFile(keymap->ctx, stmt, XkmCompatMapIndex, &rtrn, + else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_COMPAT, &rtrn, &newMerge)) { InitCompatInfo(&included, keymap); @@ -445,7 +445,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap, MergeIncludedCompatMaps(&included, info, next->merge); ClearCompatInfo(info, keymap); } - else if (ProcessIncludeFile(keymap->ctx, next, XkmCompatMapIndex, + else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_COMPAT, &rtrn, &op)) { InitCompatInfo(&next_incl, keymap); diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index 04c027c..f695f04 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -511,7 +511,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap, info->explicitMax = XKB_KEYCODE_MAX; return (info->errorCount == 0); } /* parse file, store returned info in the xkb struct */ - else if (ProcessIncludeFile(keymap->ctx, stmt, XkmKeyNamesIndex, &rtrn, + else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_KEYCODES, &rtrn, &newMerge)) { InitKeyNamesInfo(&included); @@ -544,7 +544,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap, MergeIncludedKeycodes(&included, keymap, info, next->merge); ClearKeyNamesInfo(info); } - else if (ProcessIncludeFile(keymap->ctx, next, XkmKeyNamesIndex, + else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_KEYCODES, &rtrn, &op)) { InitKeyNamesInfo(&next_incl); diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index 4ce008b..50eec0f 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -30,14 +30,14 @@ /** * Compile the given file and store the output in xkb. * @param file A list of XkbFiles, each denoting one type (e.g. - * XkmKeyNamesIdx, etc.) + * FILE_TYPE_KEYCODES, etc.) */ struct xkb_keymap * CompileKeymap(struct xkb_context *ctx, XkbFile *file) { unsigned have = 0; bool ok; - unsigned mainType; + enum xkb_file_type mainType; const char *mainName; LEDInfo *unbound = NULL, *next; struct xkb_keymap *keymap = XkbcAllocKeyboard(ctx); @@ -55,55 +55,52 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file) mainName = file->name ? file->name : "(unnamed)"; /* - * Other aggregate file types are converted to XkmKeymapFile + * Other aggregate file types are converted to FILE_TYPE_KEYMAP * in the parser. */ - if (mainType != XkmKeymapFile) { + if (mainType != FILE_TYPE_KEYMAP) { ERROR("Cannot compile a %s file alone into a keymap\n", - XkbcConfigText(mainType)); - return false; + XkbcFileTypeText(mainType)); + goto err; } /* Check for duplicate entries in the input file */ for (file = (XkbFile *) file->defs; file; file = (XkbFile *) file->common.next) { - if ((have & (1 << file->type)) != 0) - { + if (have & file->type) { ERROR("More than one %s section in a %s file\n", - XkbcConfigText(file->type), XkbcConfigText(mainType)); + XkbcFileTypeText(file->type), XkbcFileTypeText(mainType)); ACTION("All sections after the first ignored\n"); continue; } - else if ((1 << file->type) & (~XkmKeymapLegal)) - { + else if (!(file->type & LEGAL_FILE_TYPES)) { ERROR("Cannot define %s in a %s file\n", - XkbcConfigText(file->type), XkbcConfigText(mainType)); + XkbcFileTypeText(file->type), XkbcFileTypeText(mainType)); continue; } - switch (file->type) - { - case XkmKeyNamesIndex: + switch (file->type) { + case FILE_TYPE_KEYCODES: sections.keycodes = file; break; - case XkmTypesIndex: + case FILE_TYPE_TYPES: sections.types = file; break; - case XkmSymbolsIndex: + case FILE_TYPE_SYMBOLS: sections.symbols = file; break; - case XkmCompatMapIndex: + case FILE_TYPE_COMPAT: sections.compat = file; break; - case XkmGeometryIndex: + case FILE_TYPE_GEOMETRY: continue; default: WSGO("Unknown file type %d\n", file->type); ACTION("Ignored\n"); continue; - case XkmKeymapFile: + case FILE_TYPE_KEYMAP: WSGO("Illegal %s configuration in a %s file\n", - XkbcConfigText(file->type), XkbcConfigText(mainType)); + XkbcFileTypeText(file->type), XkbcFileTypeText(mainType)); ACTION("Ignored\n"); continue; } @@ -113,22 +110,23 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file) file->topName = strdup(mainName); } - have |= (1 << file->type); + have |= file->type; } - if (XkmKeymapRequired & (~have)) - { - int i, bit; - unsigned missing; - missing = XkmKeymapRequired & (~have); - for (i = 0, bit = 1; missing != 0; i++, bit <<= 1) - { - if (missing & bit) - { - ERROR("Required section %s missing from keymap\n", XkbcConfigText(i)); + if (REQUIRED_FILE_TYPES & (~have)) { + enum xkb_file_type bit; + enum xkb_file_type missing; + + missing = REQUIRED_FILE_TYPES & (~have); + + for (bit = 1; missing != 0; bit <<= 1) { + if (missing & bit) { + ERROR("Required section %s missing from keymap\n", + XkbcFileTypeText(bit)); missing &= ~bit; } } + goto err; } diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c index 599a0f2..c8e0fcb 100644 --- a/src/xkbcomp/keytypes.c +++ b/src/xkbcomp/keytypes.c @@ -346,7 +346,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap, included = *info; memset(info, 0, sizeof(KeyTypesInfo)); } - else if (ProcessIncludeFile(keymap->ctx, stmt, XkmTypesIndex, &rtrn, + else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_TYPES, &rtrn, &newMerge)) { InitKeyTypesInfo(&included, keymap, info); @@ -381,7 +381,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap, MergeIncludedKeyTypes(&included, info, next->merge, keymap); FreeKeyTypesInfo(info); } - else if (ProcessIncludeFile(keymap->ctx, next, XkmTypesIndex, + else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_TYPES, &rtrn, &op)) { InitKeyTypesInfo(&next_incl, keymap, &included); diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c index e9b42ba..7d11376 100644 --- a/src/xkbcomp/misc.c +++ b/src/xkbcomp/misc.c @@ -38,7 +38,7 @@ * * @param ctx The ctx containing include paths * @param stmt The include statement, specifying the file name to look for. - * @param file_type Type of file (XkmKeyNamesIdx, etc.) + * @param file_type Type of file (FILE_TYPE_KEYCODES, etc.) * @param file_rtrn Returns the key map to be used. * @param merge_rtrn Always returns stmt->merge. * @@ -47,7 +47,7 @@ bool ProcessIncludeFile(struct xkb_context *ctx, IncludeStmt * stmt, - unsigned file_type, + enum xkb_file_type file_type, XkbFile ** file_rtrn, unsigned *merge_rtrn) { FILE *file; @@ -92,7 +92,7 @@ ProcessIncludeFile(struct xkb_context *ctx, if (!mapToUse) { ERROR("No %s named \"%s\" in the include file \"%s\"\n", - XkbcConfigText(file_type), stmt->map, stmt->file); + XkbcFileTypeText(file_type), stmt->map, stmt->file); return false; } } @@ -105,7 +105,7 @@ ProcessIncludeFile(struct xkb_context *ctx, if (mapToUse->type != file_type) { ERROR("Include file wrong type (expected %s, got %s)\n", - XkbcConfigText(file_type), XkbcConfigText(mapToUse->type)); + XkbcFileTypeText(file_type), XkbcFileTypeText(mapToUse->type)); ACTION("Include file \"%s\" ignored\n", stmt->file); return false; } diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index 9eb51fc..7b28552 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -113,6 +113,7 @@ extern int yylex(union YYSTYPE *val, struct YYLTYPE *loc, void *scanner); int ival; unsigned uval; int64_t num; + enum xkb_file_type file_type; char *str; xkb_atom_t sval; ParseCommon *any; @@ -134,7 +135,8 @@ extern int yylex(union YYSTYPE *val, struct YYLTYPE *loc, void *scanner); %type INTEGER FLOAT %type IDENT KEYNAME STRING %type Number Integer Float SignedNumber -%type XkbCompositeType FileType MergeMode OptMergeMode +%type MergeMode OptMergeMode +%type XkbCompositeType FileType %type DoodadType Flag Flags OptFlags KeyCode %type KeyName MapName OptMapName KeySym %type FieldSpec Ident Element String @@ -181,9 +183,9 @@ XkbCompositeMap : OptFlags XkbCompositeType OptMapName OBRACE } ; -XkbCompositeType: XKB_KEYMAP { $$= XkmKeymapFile; } - | XKB_SEMANTICS { $$= XkmKeymapFile; } - | XKB_LAYOUT { $$= XkmKeymapFile; } +XkbCompositeType: XKB_KEYMAP { $$= FILE_TYPE_KEYMAP; } + | XKB_SEMANTICS { $$= FILE_TYPE_KEYMAP; } + | XKB_LAYOUT { $$= FILE_TYPE_KEYMAP; } ; XkbMapConfigList : XkbMapConfigList XkbMapConfig @@ -201,7 +203,7 @@ XkbMapConfig : OptFlags FileType OptMapName OBRACE DeclList CBRACE SEMI { - if ($2 == XkmGeometryIndex) + if ($2 == FILE_TYPE_GEOMETRY) { free($3); FreeStmt($5); @@ -216,7 +218,7 @@ XkbMapConfig : OptFlags FileType OptMapName OBRACE XkbConfig : OptFlags FileType OptMapName DeclList { - if ($2 == XkmGeometryIndex) + if ($2 == FILE_TYPE_GEOMETRY) { free($3); FreeStmt($4); @@ -230,11 +232,11 @@ XkbConfig : OptFlags FileType OptMapName DeclList ; -FileType : XKB_KEYCODES { $$= XkmKeyNamesIndex; } - | XKB_TYPES { $$= XkmTypesIndex; } - | XKB_COMPATMAP { $$= XkmCompatMapIndex; } - | XKB_SYMBOLS { $$= XkmSymbolsIndex; } - | XKB_GEOMETRY { $$= XkmGeometryIndex; } +FileType : XKB_KEYCODES { $$= FILE_TYPE_KEYCODES; } + | XKB_TYPES { $$= FILE_TYPE_TYPES; } + | XKB_COMPATMAP { $$= FILE_TYPE_COMPAT; } + | XKB_SYMBOLS { $$= FILE_TYPE_SYMBOLS; } + | XKB_GEOMETRY { $$= FILE_TYPE_GEOMETRY; } ; OptFlags : Flags { $$= $1; } diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c index d5a2528..d026ffa 100644 --- a/src/xkbcomp/parseutils.c +++ b/src/xkbcomp/parseutils.c @@ -606,7 +606,7 @@ EnsureSafeMapName(char *name) } XkbFile * -CreateXKBFile(struct xkb_context *ctx, int type, char *name, +CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name, ParseCommon *defs, unsigned flags) { XkbFile *file; @@ -771,16 +771,18 @@ FreeXKBFile(XkbFile *file) switch (file->type) { - case XkmKeymapFile: + case FILE_TYPE_KEYMAP: FreeXKBFile((XkbFile *)file->defs); break; - case XkmTypesIndex: - case XkmCompatMapIndex: - case XkmSymbolsIndex: - case XkmKeyNamesIndex: - case XkmGeometryIndex: + case FILE_TYPE_TYPES: + case FILE_TYPE_COMPAT: + case FILE_TYPE_SYMBOLS: + case FILE_TYPE_KEYCODES: + case FILE_TYPE_GEOMETRY: FreeStmt(file->defs); break; + default: + break; } free(file->name); diff --git a/src/xkbcomp/parseutils.h b/src/xkbcomp/parseutils.h index 53f24d2..32e4104 100644 --- a/src/xkbcomp/parseutils.h +++ b/src/xkbcomp/parseutils.h @@ -120,7 +120,7 @@ extern void CheckDefaultMap(XkbFile *maps, const char *fileName); extern XkbFile * -CreateXKBFile(struct xkb_context *ctx, int type, char *name, +CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name, ParseCommon *defs, unsigned flags); extern bool diff --git a/src/xkbcomp/path.c b/src/xkbcomp/path.c index 56463e6..2b0a7a0 100644 --- a/src/xkbcomp/path.c +++ b/src/xkbcomp/path.c @@ -142,23 +142,23 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn, * Return the xkb directory based on the type. */ const char * -XkbDirectoryForInclude(unsigned type) +XkbDirectoryForInclude(enum xkb_file_type type) { switch (type) { - case XkmKeymapFile: + case FILE_TYPE_KEYMAP: return "keymap"; - case XkmKeyNamesIndex: + case FILE_TYPE_KEYCODES: return "keycodes"; - case XkmTypesIndex: + case FILE_TYPE_TYPES: return "types"; - case XkmSymbolsIndex: + case FILE_TYPE_SYMBOLS: return "symbols"; - case XkmCompatMapIndex: + case FILE_TYPE_COMPAT: return "compat"; - case XkmGeometryIndex: + case FILE_TYPE_GEOMETRY: return "geometry"; - case XkmRulesFile: + case FILE_TYPE_RULES: return "rules"; default: return ""; @@ -171,16 +171,16 @@ XkbDirectoryForInclude(unsigned type) * Search for the given file name in the include directories. * * @param ctx the XKB ctx containing the include paths - * @param type one of XkbTypesIndex, XkbCompatMapIndex, ..., or - * XkmKeymapFile - * @param pathReturn is set to the full path of the file if found. + * @param type one of FILE_TYPE_TYPES, FILE_TYPE_COMPAT, ..., or + * FILE_TYPE_KEYMAP or FILE_TYPE_RULES + * @param pathRtrn is set to the full path of the file if found. * * @return an FD to the file or NULL. If NULL is returned, the value of * pathRtrn is undefined. */ FILE * XkbFindFileInPath(struct xkb_context *ctx, - const char *name, unsigned type, char **pathRtrn) + const char *name, enum xkb_file_type type, char **pathRtrn) { size_t i; int ret; diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c index 52e93ba..dc02cb3 100644 --- a/src/xkbcomp/rules.c +++ b/src/xkbcomp/rules.c @@ -1059,7 +1059,7 @@ xkb_components_from_rules(struct xkb_context *ctx, struct rules *rules; struct xkb_component_names *kccgst = NULL; - file = XkbFindFileInPath(ctx, rmlvo->rules, XkmRulesFile, &path); + file = XkbFindFileInPath(ctx, rmlvo->rules, FILE_TYPE_RULES, &path); if (!file) { ERROR("could not find \"%s\" rules in XKB path\n", rmlvo->rules); ERROR("%d include paths searched:\n", diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index f464416..a01fb33 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -798,7 +798,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap, included = *info; memset(info, 0, sizeof(SymbolsInfo)); } - else if (ProcessIncludeFile(keymap->ctx, stmt, XkmSymbolsIndex, &rtrn, + else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_SYMBOLS, &rtrn, &newMerge)) { InitSymbolsInfo(&included, keymap); @@ -840,7 +840,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap, MergeIncludedSymbols(&included, info, next->merge, keymap); FreeSymbolsInfo(info); } - else if (ProcessIncludeFile(keymap->ctx, next, XkmSymbolsIndex, + else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_SYMBOLS, &rtrn, &op)) { InitSymbolsInfo(&next_incl, keymap); diff --git a/src/xkbcomp/xkbcomp-priv.h b/src/xkbcomp/xkbcomp-priv.h index 85a9c02..9d10597 100644 --- a/src/xkbcomp/xkbcomp-priv.h +++ b/src/xkbcomp/xkbcomp-priv.h @@ -65,8 +65,8 @@ ReportBadField(const char *type, const char *field, const char *name); extern bool ProcessIncludeFile(struct xkb_context *ctx, - IncludeStmt *stmt, unsigned file_type, XkbFile **file_rtrn, - unsigned *merge_rtrn); + IncludeStmt *stmt, enum xkb_file_type file_type, + XkbFile **file_rtrn, unsigned *merge_rtrn); extern bool FindNamedKey(struct xkb_keymap *keymap, unsigned long name, diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c index 5242c13..52a5fbf 100644 --- a/src/xkbcomp/xkbcomp.c +++ b/src/xkbcomp/xkbcomp.c @@ -41,25 +41,25 @@ XkbKeymapFileFromComponents(struct xkb_context *ctx, IncludeStmt *inc; inc = IncludeCreate(ktcsg->keycodes, MergeDefault); - keycodes = CreateXKBFile(ctx, XkmKeyNamesIndex, NULL, + keycodes = CreateXKBFile(ctx, FILE_TYPE_KEYCODES, NULL, (ParseCommon *)inc, 0); inc = IncludeCreate(ktcsg->types, MergeDefault); - types = CreateXKBFile(ctx, XkmTypesIndex, NULL, + types = CreateXKBFile(ctx, FILE_TYPE_TYPES, NULL, (ParseCommon *)inc, 0); AppendStmt(&keycodes->common, &types->common); inc = IncludeCreate(ktcsg->compat, MergeDefault); - compat = CreateXKBFile(ctx, XkmCompatMapIndex, NULL, + compat = CreateXKBFile(ctx, FILE_TYPE_COMPAT, NULL, (ParseCommon *)inc, 0); AppendStmt(&keycodes->common, &compat->common); inc = IncludeCreate(ktcsg->symbols, MergeDefault); - symbols = CreateXKBFile(ctx, XkmSymbolsIndex, NULL, + symbols = CreateXKBFile(ctx, FILE_TYPE_SYMBOLS, NULL, (ParseCommon *)inc, 0); AppendStmt(&keycodes->common, &symbols->common); - return CreateXKBFile(ctx, XkmKeymapFile, + return CreateXKBFile(ctx, FILE_TYPE_KEYMAP, ktcsg->keymap ? ktcsg->keymap : strdup(""), &keycodes->common, 0); } @@ -141,7 +141,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file) if (!mapToUse) goto err; - if (mapToUse->type != XkmKeymapFile) { + if (mapToUse->type != FILE_TYPE_KEYMAP) { ERROR("file type %d not handled\n", mapToUse->type); goto err; } diff --git a/src/xkbcomp/xkbcomp.h b/src/xkbcomp/xkbcomp.h index ec0db0f..07d4523 100644 --- a/src/xkbcomp/xkbcomp.h +++ b/src/xkbcomp/xkbcomp.h @@ -237,7 +237,7 @@ typedef struct _IndicatorMapDef typedef struct _XkbFile { ParseCommon common; - unsigned type; + enum xkb_file_type type; char *topName; char *name; ParseCommon *defs; -- cgit v1.2.1