From b6e0457195694b541e975c74597d4b2b24203c6d Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 10 Sep 2012 20:16:05 +0100 Subject: [PATCH] kbproto unentanglement: XkbLC_* Signed-off-by: Daniel Stone --- src/xkbcomp/ast-build.c | 2 +- src/xkbcomp/ast.h | 13 ++++++++++++- src/xkbcomp/include.c | 2 +- src/xkbcomp/parser.y | 20 +++++++++++--------- src/xkbcomp/scanner.l | 4 ++-- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index 5291bfd..f32b120 100644 --- a/src/xkbcomp/ast-build.c +++ b/src/xkbcomp/ast-build.c @@ -445,7 +445,7 @@ EnsureSafeMapName(char *name) XkbFile * XkbFileCreate(struct xkb_context *ctx, enum xkb_file_type type, char *name, - ParseCommon *defs, unsigned flags) + ParseCommon *defs, enum xkb_map_flags flags) { XkbFile *file; diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h index ccef461..9b66a02 100644 --- a/src/xkbcomp/ast.h +++ b/src/xkbcomp/ast.h @@ -249,6 +249,17 @@ typedef struct _IndicatorMapDef { VarDef *body; } IndicatorMapDef; +enum xkb_map_flags { + MAP_IS_DEFAULT = (1 << 0), + MAP_IS_PARTIAL = (1 << 1), + MAP_IS_HIDDEN = (1 << 2), + MAP_HAS_ALPHANUMERIC = (1 << 3), + MAP_HAS_MODIFIER = (1 << 4), + MAP_HAS_KEYPAD = (1 << 5), + MAP_HAS_FN = (1 << 6), + MAP_IS_ALTGR = (1 << 7), +}; + typedef struct _XkbFile { ParseCommon common; enum xkb_file_type file_type; @@ -256,7 +267,7 @@ typedef struct _XkbFile { char *name; ParseCommon *defs; int id; - unsigned flags; + enum xkb_map_flags flags; } XkbFile; #endif diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c index f0c3c03..8bfd650 100644 --- a/src/xkbcomp/include.c +++ b/src/xkbcomp/include.c @@ -280,7 +280,7 @@ ProcessIncludeFile(struct xkb_context *ctx, } else if (rtrn->common.next) { for (; mapToUse; mapToUse = (XkbFile *) mapToUse->common.next) - if (mapToUse->flags & XkbLC_Default) + if (mapToUse->flags & MAP_IS_DEFAULT) break; if (!mapToUse) { diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index b46cbfb..d702890 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -125,6 +125,7 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg) char keyName[XKB_KEY_NAME_LENGTH]; xkb_atom_t sval; enum merge_mode merge; + enum xkb_map_flags mapFlags; ParseCommon *any; ExprDef *expr; VarDef *var; @@ -148,7 +149,8 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg) %type Number Integer Float SignedNumber %type MergeMode OptMergeMode %type XkbCompositeType FileType -%type DoodadType Flag Flags OptFlags KeyCode +%type DoodadType +%type Flag Flags OptFlags KeyCode %type MapName OptMapName KeySym %type FieldSpec Ident Element String %type DeclList Decl @@ -253,14 +255,14 @@ Flags : Flags Flag { $$ = ($1 | $2); } | Flag { $$ = $1; } ; -Flag : PARTIAL { $$ = XkbLC_Partial; } - | DEFAULT { $$ = XkbLC_Default; } - | HIDDEN { $$ = XkbLC_Hidden; } - | ALPHANUMERIC_KEYS { $$ = XkbLC_AlphanumericKeys; } - | MODIFIER_KEYS { $$ = XkbLC_ModifierKeys; } - | KEYPAD_KEYS { $$ = XkbLC_KeypadKeys; } - | FUNCTION_KEYS { $$ = XkbLC_FunctionKeys; } - | ALTERNATE_GROUP { $$ = XkbLC_AlternateGroup; } +Flag : PARTIAL { $$ = MAP_IS_PARTIAL; } + | DEFAULT { $$ = MAP_IS_DEFAULT; } + | HIDDEN { $$ = MAP_IS_HIDDEN; } + | ALPHANUMERIC_KEYS { $$ = MAP_HAS_ALPHANUMERIC; } + | MODIFIER_KEYS { $$ = MAP_HAS_MODIFIER; } + | KEYPAD_KEYS { $$ = MAP_HAS_KEYPAD; } + | FUNCTION_KEYS { $$ = MAP_HAS_FN; } + | ALTERNATE_GROUP { $$ = MAP_IS_ALTGR; } ; DeclList : DeclList Decl diff --git a/src/xkbcomp/scanner.l b/src/xkbcomp/scanner.l index 37e798b..6e1089d 100644 --- a/src/xkbcomp/scanner.l +++ b/src/xkbcomp/scanner.l @@ -234,7 +234,7 @@ CheckDefaultMap(struct xkb_context *ctx, XkbFile *maps, const char *fileName) XkbFile *dflt = NULL, *tmp; for (tmp = maps; tmp; tmp = (XkbFile *) tmp->common.next) { - if (!(tmp->flags & XkbLC_Default)) + if (!(tmp->flags & MAP_IS_DEFAULT)) continue; if (!dflt) { @@ -249,7 +249,7 @@ CheckDefaultMap(struct xkb_context *ctx, XkbFile *maps, const char *fileName) (dflt->name ? dflt->name : "(first)"), (tmp->name ? tmp->name : "(subsequent)")); - tmp->flags &= (~XkbLC_Default); + tmp->flags &= (~MAP_IS_DEFAULT); } }