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