• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ANSI-C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf  */
3 /* Computed positions: -k'1-2,5' */
4 
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7       && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8       && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9       && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10       && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11       && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12       && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13       && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14       && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15       && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16       && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17       && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18       && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19       && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20       && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21       && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22       && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23       && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24       && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25       && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646.  */
29 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
30 #endif
31 
32 
33 #include "xkbcomp-priv.h"
34 #include "parser-priv.h"
35 
36 static unsigned int
37 keyword_gperf_hash(const char *str, unsigned int len);
38 
39 static const struct keyword_tok *
40 keyword_gperf_lookup(const char *str, unsigned int len);
41 struct keyword_tok { int name; int tok; };
42 #include <string.h>
43 /* maximum key range = 70, duplicates = 0 */
44 
45 #ifndef GPERF_DOWNCASE
46 #define GPERF_DOWNCASE 1
47 static unsigned char gperf_downcase[256] =
48   {
49       0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
50      15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
51      30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
52      45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
53      60,  61,  62,  63,  64,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106,
54     107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
55     122,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104,
56     105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
57     120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
58     135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
59     150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
60     165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
61     180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
62     195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
63     210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
64     225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
65     240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
66     255
67   };
68 #endif
69 
70 #ifndef GPERF_CASE_STRCMP
71 #define GPERF_CASE_STRCMP 1
72 static int
gperf_case_strcmp(register const char * s1,register const char * s2)73 gperf_case_strcmp (register const char *s1, register const char *s2)
74 {
75   for (;;)
76     {
77       unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
78       unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
79       if (c1 != 0 && c1 == c2)
80         continue;
81       return (int)c1 - (int)c2;
82     }
83 }
84 #endif
85 
86 #ifdef __GNUC__
87 __inline
88 #else
89 #ifdef __cplusplus
90 inline
91 #endif
92 #endif
93 static unsigned int
keyword_gperf_hash(register const char * str,register unsigned int len)94 keyword_gperf_hash (register const char *str, register unsigned int len)
95 {
96   static const unsigned char asso_values[] =
97     {
98       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
99       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
100       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
101       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
102       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
103       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
104       73, 73, 73, 73, 73,  0, 73,  5, 36,  0,
105       10,  1, 15, 15, 73,  0, 10, 20, 35, 20,
106       50, 73, 10, 10,  5,  0, 15, 73,  0, 15,
107       73, 73, 73, 73, 73, 73, 73,  0, 73,  5,
108       36,  0, 10,  1, 15, 15, 73,  0, 10, 20,
109       35, 20, 50, 73, 10, 10,  5,  0, 15, 73,
110        0, 15, 73, 73, 73, 73, 73, 73, 73, 73,
111       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
112       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
113       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
114       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
115       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
116       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
117       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
118       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
119       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
120       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
121       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
122       73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
123       73, 73, 73, 73, 73, 73
124     };
125   register int hval = len;
126 
127   switch (hval)
128     {
129       default:
130         hval += asso_values[(unsigned char)str[4]];
131       /*FALLTHROUGH*/
132       case 4:
133       case 3:
134       case 2:
135         hval += asso_values[(unsigned char)str[1]];
136       /*FALLTHROUGH*/
137       case 1:
138         hval += asso_values[(unsigned char)str[0]];
139         break;
140     }
141   return hval;
142 }
143 
144 struct stringpool_t
145   {
146     char stringpool_str3[sizeof("key")];
147     char stringpool_str4[sizeof("keys")];
148     char stringpool_str7[sizeof("augment")];
149     char stringpool_str9[sizeof("text")];
150     char stringpool_str10[sizeof("xkb_keymap")];
151     char stringpool_str11[sizeof("keypad_keys")];
152     char stringpool_str12[sizeof("xkb_keycodes")];
153     char stringpool_str13[sizeof("xkb_geometry")];
154     char stringpool_str14[sizeof("xkb_types")];
155     char stringpool_str15[sizeof("xkb_compat")];
156     char stringpool_str17[sizeof("replace")];
157     char stringpool_str19[sizeof("xkb_compat_map")];
158     char stringpool_str20[sizeof("xkb_layout")];
159     char stringpool_str21[sizeof("xkb_symbols")];
160     char stringpool_str22[sizeof("xkb_compatibility")];
161     char stringpool_str23[sizeof("xkb_semantics")];
162     char stringpool_str24[sizeof("type")];
163     char stringpool_str25[sizeof("alias")];
164     char stringpool_str26[sizeof("xkb_compatibility_map")];
165     char stringpool_str27[sizeof("alphanumeric_keys")];
166     char stringpool_str28[sizeof("function_keys")];
167     char stringpool_str29[sizeof("alternate")];
168     char stringpool_str30[sizeof("shape")];
169     char stringpool_str31[sizeof("action")];
170     char stringpool_str32[sizeof("section")];
171     char stringpool_str33[sizeof("row")];
172     char stringpool_str34[sizeof("logo")];
173     char stringpool_str35[sizeof("alternate_group")];
174     char stringpool_str36[sizeof("hidden")];
175     char stringpool_str37[sizeof("virtual")];
176     char stringpool_str42[sizeof("outline")];
177     char stringpool_str43[sizeof("default")];
178     char stringpool_str46[sizeof("modmap")];
179     char stringpool_str47[sizeof("virtual_modifiers")];
180     char stringpool_str52[sizeof("overlay")];
181     char stringpool_str53[sizeof("override")];
182     char stringpool_str57[sizeof("include")];
183     char stringpool_str62[sizeof("modifier_map")];
184     char stringpool_str63[sizeof("modifier_keys")];
185     char stringpool_str64[sizeof("indicator")];
186     char stringpool_str66[sizeof("group")];
187     char stringpool_str67[sizeof("mod_map")];
188     char stringpool_str69[sizeof("interpret")];
189     char stringpool_str71[sizeof("solid")];
190     char stringpool_str72[sizeof("partial")];
191   };
192 static const struct stringpool_t stringpool_contents =
193   {
194     "key",
195     "keys",
196     "augment",
197     "text",
198     "xkb_keymap",
199     "keypad_keys",
200     "xkb_keycodes",
201     "xkb_geometry",
202     "xkb_types",
203     "xkb_compat",
204     "replace",
205     "xkb_compat_map",
206     "xkb_layout",
207     "xkb_symbols",
208     "xkb_compatibility",
209     "xkb_semantics",
210     "type",
211     "alias",
212     "xkb_compatibility_map",
213     "alphanumeric_keys",
214     "function_keys",
215     "alternate",
216     "shape",
217     "action",
218     "section",
219     "row",
220     "logo",
221     "alternate_group",
222     "hidden",
223     "virtual",
224     "outline",
225     "default",
226     "modmap",
227     "virtual_modifiers",
228     "overlay",
229     "override",
230     "include",
231     "modifier_map",
232     "modifier_keys",
233     "indicator",
234     "group",
235     "mod_map",
236     "interpret",
237     "solid",
238     "partial"
239   };
240 #define stringpool ((const char *) &stringpool_contents)
241 #ifdef __GNUC__
242 __inline
243 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
244 __attribute__ ((__gnu_inline__))
245 #endif
246 #endif
247 const struct keyword_tok *
keyword_gperf_lookup(register const char * str,register unsigned int len)248 keyword_gperf_lookup (register const char *str, register unsigned int len)
249 {
250   enum
251     {
252       TOTAL_KEYWORDS = 45,
253       MIN_WORD_LENGTH = 3,
254       MAX_WORD_LENGTH = 21,
255       MIN_HASH_VALUE = 3,
256       MAX_HASH_VALUE = 72
257     };
258 
259   static const struct keyword_tok wordlist[] =
260     {
261       {-1}, {-1}, {-1},
262       {(int)(long)&((struct stringpool_t *)0)->stringpool_str3,                    KEY},
263       {(int)(long)&((struct stringpool_t *)0)->stringpool_str4,                   KEYS},
264       {-1}, {-1},
265       {(int)(long)&((struct stringpool_t *)0)->stringpool_str7,                AUGMENT},
266       {-1},
267       {(int)(long)&((struct stringpool_t *)0)->stringpool_str9,                   TEXT},
268       {(int)(long)&((struct stringpool_t *)0)->stringpool_str10,             XKB_KEYMAP},
269       {(int)(long)&((struct stringpool_t *)0)->stringpool_str11,            KEYPAD_KEYS},
270       {(int)(long)&((struct stringpool_t *)0)->stringpool_str12,           XKB_KEYCODES},
271       {(int)(long)&((struct stringpool_t *)0)->stringpool_str13,           XKB_GEOMETRY},
272       {(int)(long)&((struct stringpool_t *)0)->stringpool_str14,              XKB_TYPES},
273       {(int)(long)&((struct stringpool_t *)0)->stringpool_str15,             XKB_COMPATMAP},
274       {-1},
275       {(int)(long)&((struct stringpool_t *)0)->stringpool_str17,                REPLACE},
276       {-1},
277       {(int)(long)&((struct stringpool_t *)0)->stringpool_str19,         XKB_COMPATMAP},
278       {(int)(long)&((struct stringpool_t *)0)->stringpool_str20,             XKB_LAYOUT},
279       {(int)(long)&((struct stringpool_t *)0)->stringpool_str21,            XKB_SYMBOLS},
280       {(int)(long)&((struct stringpool_t *)0)->stringpool_str22,      XKB_COMPATMAP},
281       {(int)(long)&((struct stringpool_t *)0)->stringpool_str23,          XKB_SEMANTICS},
282       {(int)(long)&((struct stringpool_t *)0)->stringpool_str24,                   TYPE},
283       {(int)(long)&((struct stringpool_t *)0)->stringpool_str25,                  ALIAS},
284       {(int)(long)&((struct stringpool_t *)0)->stringpool_str26,  XKB_COMPATMAP},
285       {(int)(long)&((struct stringpool_t *)0)->stringpool_str27,      ALPHANUMERIC_KEYS},
286       {(int)(long)&((struct stringpool_t *)0)->stringpool_str28,          FUNCTION_KEYS},
287       {(int)(long)&((struct stringpool_t *)0)->stringpool_str29,              ALTERNATE},
288       {(int)(long)&((struct stringpool_t *)0)->stringpool_str30,                  SHAPE},
289       {(int)(long)&((struct stringpool_t *)0)->stringpool_str31,                 ACTION_TOK},
290       {(int)(long)&((struct stringpool_t *)0)->stringpool_str32,                SECTION},
291       {(int)(long)&((struct stringpool_t *)0)->stringpool_str33,                    ROW},
292       {(int)(long)&((struct stringpool_t *)0)->stringpool_str34,                   LOGO},
293       {(int)(long)&((struct stringpool_t *)0)->stringpool_str35,        ALTERNATE_GROUP},
294       {(int)(long)&((struct stringpool_t *)0)->stringpool_str36,                 HIDDEN},
295       {(int)(long)&((struct stringpool_t *)0)->stringpool_str37,                VIRTUAL},
296       {-1}, {-1}, {-1}, {-1},
297       {(int)(long)&((struct stringpool_t *)0)->stringpool_str42,                OUTLINE},
298       {(int)(long)&((struct stringpool_t *)0)->stringpool_str43,                DEFAULT},
299       {-1}, {-1},
300       {(int)(long)&((struct stringpool_t *)0)->stringpool_str46,                 MODIFIER_MAP},
301       {(int)(long)&((struct stringpool_t *)0)->stringpool_str47,      VIRTUAL_MODS},
302       {-1}, {-1}, {-1}, {-1},
303       {(int)(long)&((struct stringpool_t *)0)->stringpool_str52,                OVERLAY},
304       {(int)(long)&((struct stringpool_t *)0)->stringpool_str53,               OVERRIDE},
305       {-1}, {-1}, {-1},
306       {(int)(long)&((struct stringpool_t *)0)->stringpool_str57,                INCLUDE},
307       {-1}, {-1}, {-1}, {-1},
308       {(int)(long)&((struct stringpool_t *)0)->stringpool_str62,           MODIFIER_MAP},
309       {(int)(long)&((struct stringpool_t *)0)->stringpool_str63,          MODIFIER_KEYS},
310       {(int)(long)&((struct stringpool_t *)0)->stringpool_str64,              INDICATOR},
311       {-1},
312       {(int)(long)&((struct stringpool_t *)0)->stringpool_str66,                  GROUP},
313       {(int)(long)&((struct stringpool_t *)0)->stringpool_str67,                MODIFIER_MAP},
314       {-1},
315       {(int)(long)&((struct stringpool_t *)0)->stringpool_str69,              INTERPRET},
316       {-1},
317       {(int)(long)&((struct stringpool_t *)0)->stringpool_str71,                  SOLID},
318       {(int)(long)&((struct stringpool_t *)0)->stringpool_str72,                PARTIAL}
319     };
320 
321   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
322     {
323       register int key = keyword_gperf_hash (str, len);
324 
325       if (key <= MAX_HASH_VALUE && key >= 0)
326         {
327           register int o = wordlist[key].name;
328           if (o >= 0)
329             {
330               register const char *s = o + stringpool;
331 
332               if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s))
333                 return &wordlist[key];
334             }
335         }
336     }
337   return 0;
338 }
339 
340 
341 int
keyword_to_token(const char * string,unsigned int len)342 keyword_to_token(const char *string, unsigned int len)
343 {
344     const struct keyword_tok *kt = keyword_gperf_lookup(string, len);
345     if (!kt)
346         return -1;
347     return kt->tok;
348 }
349