Rewritten pptok.pl, now works
[nasm/perl-rewrite.git] / perl / old / pptok / pptok.c
blob537ffbc111aa522758cbb7f670a4507a89bb1e70
1 /* Automatically generated from pptok.dat by ../pptok.pl */
2 /* Do not edit */
4 #include "compiler.h"
5 #include <inttypes.h>
6 #include <ctype.h>
7 #include "nasmlib.h"
8 #include "hashtbl.h"
9 #include "preproc.h"
11 const char * const pp_directives[103] = {
12 "%elif",
13 "%elifn",
14 "%elifctx",
15 "%elifnctx",
16 "%elifdef",
17 "%elifndef",
18 "%elifempty",
19 "%elifnempty",
20 "%elifid",
21 "%elifnid",
22 "%elifidn",
23 "%elifnidn",
24 "%elifidni",
25 "%elifnidni",
26 "%elifmacro",
27 "%elifnmacro",
28 "%elifnum",
29 "%elifnnum",
30 "%elifstr",
31 "%elifnstr",
32 "%eliftoken",
33 "%elifntoken",
34 NULL,
35 NULL,
36 NULL,
37 NULL,
38 NULL,
39 NULL,
40 NULL,
41 NULL,
42 NULL,
43 NULL,
44 "%if",
45 "%ifn",
46 "%ifctx",
47 "%ifnctx",
48 "%ifdef",
49 "%ifndef",
50 "%ifempty",
51 "%ifnempty",
52 "%ifid",
53 "%ifnid",
54 "%ifidn",
55 "%ifnidn",
56 "%ifidni",
57 "%ifnidni",
58 "%ifmacro",
59 "%ifnmacro",
60 "%ifnum",
61 "%ifnnum",
62 "%ifstr",
63 "%ifnstr",
64 "%iftoken",
65 "%ifntoken",
66 NULL,
67 NULL,
68 NULL,
69 NULL,
70 NULL,
71 NULL,
72 NULL,
73 NULL,
74 NULL,
75 NULL,
76 "%arg",
77 "%assign",
78 "%clear",
79 "%define",
80 "%defstr",
81 "%depend",
82 "%else",
83 "%endif",
84 "%endm",
85 "%endmacro",
86 "%endrep",
87 "%error",
88 "%exitrep",
89 "%fatal",
90 "%iassign",
91 "%idefine",
92 "%idefstr",
93 "%imacro",
94 "%include",
95 "%ixdefine",
96 "%line",
97 "%local",
98 "%macro",
99 "%pathsearch",
100 "%pop",
101 "%push",
102 "%rep",
103 "%repl",
104 "%rotate",
105 "%stacksize",
106 "%strcat",
107 "%strlen",
108 "%substr",
109 "%undef",
110 "%unimacro",
111 "%unmacro",
112 "%use",
113 "%warning",
114 "%xdefine",
116 const uint8_t pp_directives_len[103] = {
221 enum preproc_token pp_token_hash(const char *token)
223 #define UNUSED 16383
224 static const int16_t hash1[128] = {
225 UNUSED,
226 UNUSED,
231 UNUSED,
232 UNUSED,
233 UNUSED,
234 UNUSED,
235 UNUSED,
236 UNUSED,
237 UNUSED,
238 UNUSED,
240 UNUSED,
241 UNUSED,
244 UNUSED,
246 UNUSED,
247 UNUSED,
248 UNUSED,
250 -47,
251 UNUSED,
253 UNUSED,
254 -60,
256 UNUSED,
257 UNUSED,
258 -44,
259 UNUSED,
260 UNUSED,
261 -45,
262 UNUSED,
263 UNUSED,
265 UNUSED,
266 UNUSED,
267 UNUSED,
268 UNUSED,
269 UNUSED,
270 UNUSED,
272 UNUSED,
273 UNUSED,
276 UNUSED,
277 -49,
279 UNUSED,
280 UNUSED,
282 UNUSED,
283 UNUSED,
285 UNUSED,
288 UNUSED,
291 UNUSED,
292 UNUSED,
293 UNUSED,
295 UNUSED,
296 125,
297 UNUSED,
299 UNUSED,
303 120,
304 -81,
305 UNUSED,
306 UNUSED,
309 UNUSED,
312 -60,
313 -102,
315 -12,
316 -73,
317 UNUSED,
318 UNUSED,
319 UNUSED,
321 UNUSED,
324 UNUSED,
325 -141,
326 UNUSED,
327 100,
328 UNUSED,
330 UNUSED,
333 UNUSED,
336 UNUSED,
337 UNUSED,
338 UNUSED,
339 UNUSED,
340 UNUSED,
341 UNUSED,
342 UNUSED,
346 UNUSED,
347 UNUSED,
348 UNUSED,
349 UNUSED,
350 101,
352 UNUSED,
354 static const int16_t hash2[128] = {
355 UNUSED,
357 UNUSED,
359 UNUSED,
360 UNUSED,
362 UNUSED,
363 UNUSED,
365 UNUSED,
366 UNUSED,
367 UNUSED,
368 UNUSED,
369 UNUSED,
370 UNUSED,
371 UNUSED,
374 UNUSED,
376 UNUSED,
378 UNUSED,
381 UNUSED,
382 UNUSED,
383 UNUSED,
385 UNUSED,
386 UNUSED,
387 UNUSED,
388 UNUSED,
389 UNUSED,
391 121,
393 UNUSED,
397 UNUSED,
398 114,
399 UNUSED,
400 178,
401 UNUSED,
402 UNUSED,
403 UNUSED,
405 UNUSED,
406 -34,
407 UNUSED,
409 UNUSED,
410 UNUSED,
411 UNUSED,
412 UNUSED,
414 UNUSED,
416 UNUSED,
417 UNUSED,
418 139,
419 UNUSED,
420 UNUSED,
421 UNUSED,
423 UNUSED,
425 100,
426 145,
427 UNUSED,
431 UNUSED,
432 UNUSED,
433 UNUSED,
435 UNUSED,
436 UNUSED,
437 UNUSED,
442 UNUSED,
445 UNUSED,
449 UNUSED,
450 UNUSED,
451 109,
453 UNUSED,
454 UNUSED,
455 UNUSED,
456 UNUSED,
457 UNUSED,
458 UNUSED,
462 UNUSED,
466 UNUSED,
467 UNUSED,
468 UNUSED,
472 UNUSED,
473 UNUSED,
475 UNUSED,
478 UNUSED,
479 UNUSED,
482 UNUSED,
484 uint32_t k1, k2;
485 uint64_t crc;
486 uint16_t ix;
488 crc = crc64i(UINT64_C(0xaee7ac5ccabdec91), token);
489 k1 = (uint32_t)crc;
490 k2 = (uint32_t)(crc >> 32);
492 ix = hash1[k1 & 0x7f] + hash2[k2 & 0x7f];
493 if (ix >= 103)
494 return PP_INVALID;
496 if (!pp_directives[ix] || nasm_stricmp(pp_directives[ix], token))
497 return PP_INVALID;
499 return ix;