Debian Codegraph @

src/xkbcomp/keywords.c

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