build: fix out-of-tree build
[platform/upstream/libxkbcommon.git] / src / xkbcomp / keywords.gperf
1 %{
2 #include "xkbcomp-priv.h"
3 #include "parser-priv.h"
4
5 static unsigned int
6 keyword_gperf_hash(const char *str, unsigned int len);
7
8 static const struct keyword_tok *
9 keyword_gperf_lookup(const char *str, unsigned int len);
10 %}
11
12 struct keyword_tok { int name; int tok; };
13 %language=ANSI-C
14 %define hash-function-name keyword_gperf_hash
15 %define lookup-function-name keyword_gperf_lookup
16 %readonly-tables
17 %enum
18 %includes
19 %struct-type
20 %pic
21 %ignore-case
22
23 %%
24 action,                 ACTION_TOK
25 alias,                  ALIAS
26 alphanumeric_keys,      ALPHANUMERIC_KEYS
27 alternate_group,        ALTERNATE_GROUP
28 alternate,              ALTERNATE
29 augment,                AUGMENT
30 default,                DEFAULT
31 function_keys,          FUNCTION_KEYS
32 group,                  GROUP
33 hidden,                 HIDDEN
34 include,                INCLUDE
35 indicator,              INDICATOR
36 interpret,              INTERPRET
37 keypad_keys,            KEYPAD_KEYS
38 key,                    KEY
39 keys,                   KEYS
40 logo,                   LOGO
41 modifier_keys,          MODIFIER_KEYS
42 modifier_map,           MODIFIER_MAP
43 mod_map,                MODIFIER_MAP
44 modmap,                 MODIFIER_MAP
45 outline,                OUTLINE
46 overlay,                OVERLAY
47 override,               OVERRIDE
48 partial,                PARTIAL
49 replace,                REPLACE
50 row,                    ROW
51 section,                SECTION
52 shape,                  SHAPE
53 solid,                  SOLID
54 text,                   TEXT
55 type,                   TYPE
56 virtual_modifiers,      VIRTUAL_MODS
57 virtual,                VIRTUAL
58 xkb_compatibility_map,  XKB_COMPATMAP
59 xkb_compatibility,      XKB_COMPATMAP
60 xkb_compat_map,         XKB_COMPATMAP
61 xkb_compat,             XKB_COMPATMAP
62 xkb_geometry,           XKB_GEOMETRY
63 xkb_keycodes,           XKB_KEYCODES
64 xkb_keymap,             XKB_KEYMAP
65 xkb_layout,             XKB_LAYOUT
66 xkb_semantics,          XKB_SEMANTICS
67 xkb_symbols,            XKB_SYMBOLS
68 xkb_types,              XKB_TYPES
69 %%
70
71 int
72 keyword_to_token(const char *string, unsigned int len)
73 {
74     const struct keyword_tok *kt = keyword_gperf_lookup(string, len);
75     if (!kt)
76         return -1;
77     return kt->tok;
78 }