pptok.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. /* Automatically generated from ./asm/pptok.dat by ./asm/pptok.pl */
  2. /* Do not edit */
  3. #include "compiler.h"
  4. #include <ctype.h>
  5. #include "nasmlib.h"
  6. #include "hashtbl.h"
  7. #include "preproc.h"
  8. const char * const pp_directives[109] = {
  9. "%elif",
  10. "%elifn",
  11. "%elifctx",
  12. "%elifnctx",
  13. "%elifdef",
  14. "%elifndef",
  15. "%elifempty",
  16. "%elifnempty",
  17. "%elifenv",
  18. "%elifnenv",
  19. "%elifid",
  20. "%elifnid",
  21. "%elifidn",
  22. "%elifnidn",
  23. "%elifidni",
  24. "%elifnidni",
  25. "%elifmacro",
  26. "%elifnmacro",
  27. "%elifnum",
  28. "%elifnnum",
  29. "%elifstr",
  30. "%elifnstr",
  31. "%eliftoken",
  32. "%elifntoken",
  33. NULL,
  34. NULL,
  35. NULL,
  36. NULL,
  37. NULL,
  38. NULL,
  39. NULL,
  40. NULL,
  41. "%if",
  42. "%ifn",
  43. "%ifctx",
  44. "%ifnctx",
  45. "%ifdef",
  46. "%ifndef",
  47. "%ifempty",
  48. "%ifnempty",
  49. "%ifenv",
  50. "%ifnenv",
  51. "%ifid",
  52. "%ifnid",
  53. "%ifidn",
  54. "%ifnidn",
  55. "%ifidni",
  56. "%ifnidni",
  57. "%ifmacro",
  58. "%ifnmacro",
  59. "%ifnum",
  60. "%ifnnum",
  61. "%ifstr",
  62. "%ifnstr",
  63. "%iftoken",
  64. "%ifntoken",
  65. NULL,
  66. NULL,
  67. NULL,
  68. NULL,
  69. NULL,
  70. NULL,
  71. NULL,
  72. NULL,
  73. "%arg",
  74. "%assign",
  75. "%clear",
  76. "%define",
  77. "%defstr",
  78. "%deftok",
  79. "%depend",
  80. "%else",
  81. "%endif",
  82. "%endm",
  83. "%endmacro",
  84. "%endrep",
  85. "%error",
  86. "%exitmacro",
  87. "%exitrep",
  88. "%fatal",
  89. "%iassign",
  90. "%idefine",
  91. "%idefstr",
  92. "%ideftok",
  93. "%imacro",
  94. "%include",
  95. "%irmacro",
  96. "%ixdefine",
  97. "%line",
  98. "%local",
  99. "%macro",
  100. "%pathsearch",
  101. "%pop",
  102. "%pragma",
  103. "%push",
  104. "%rep",
  105. "%repl",
  106. "%rmacro",
  107. "%rotate",
  108. "%stacksize",
  109. "%strcat",
  110. "%strlen",
  111. "%substr",
  112. "%undef",
  113. "%unimacro",
  114. "%unmacro",
  115. "%use",
  116. "%warning",
  117. "%xdefine",
  118. };
  119. const uint8_t pp_directives_len[109] = {
  120. 5,
  121. 6,
  122. 8,
  123. 9,
  124. 8,
  125. 9,
  126. 10,
  127. 11,
  128. 8,
  129. 9,
  130. 7,
  131. 8,
  132. 8,
  133. 9,
  134. 9,
  135. 10,
  136. 10,
  137. 11,
  138. 8,
  139. 9,
  140. 8,
  141. 9,
  142. 10,
  143. 11,
  144. 0,
  145. 0,
  146. 0,
  147. 0,
  148. 0,
  149. 0,
  150. 0,
  151. 0,
  152. 3,
  153. 4,
  154. 6,
  155. 7,
  156. 6,
  157. 7,
  158. 8,
  159. 9,
  160. 6,
  161. 7,
  162. 5,
  163. 6,
  164. 6,
  165. 7,
  166. 7,
  167. 8,
  168. 8,
  169. 9,
  170. 6,
  171. 7,
  172. 6,
  173. 7,
  174. 8,
  175. 9,
  176. 0,
  177. 0,
  178. 0,
  179. 0,
  180. 0,
  181. 0,
  182. 0,
  183. 0,
  184. 4,
  185. 7,
  186. 6,
  187. 7,
  188. 7,
  189. 7,
  190. 7,
  191. 5,
  192. 6,
  193. 5,
  194. 9,
  195. 7,
  196. 6,
  197. 10,
  198. 8,
  199. 6,
  200. 8,
  201. 8,
  202. 8,
  203. 8,
  204. 7,
  205. 8,
  206. 8,
  207. 9,
  208. 5,
  209. 6,
  210. 6,
  211. 11,
  212. 4,
  213. 7,
  214. 5,
  215. 4,
  216. 5,
  217. 7,
  218. 7,
  219. 10,
  220. 7,
  221. 7,
  222. 7,
  223. 6,
  224. 9,
  225. 8,
  226. 4,
  227. 8,
  228. 8,
  229. };
  230. enum preproc_token pp_token_hash(const char *token)
  231. {
  232. #define UNUSED (65535/3)
  233. static const int16_t hash1[128] = {
  234. UNUSED,
  235. UNUSED,
  236. 0,
  237. 0,
  238. 0,
  239. 0,
  240. UNUSED,
  241. UNUSED,
  242. UNUSED,
  243. UNUSED,
  244. UNUSED,
  245. UNUSED,
  246. UNUSED,
  247. UNUSED,
  248. 0,
  249. UNUSED,
  250. UNUSED,
  251. 0,
  252. 0,
  253. UNUSED,
  254. 0,
  255. UNUSED,
  256. UNUSED,
  257. UNUSED,
  258. 0,
  259. -45,
  260. UNUSED,
  261. 0,
  262. UNUSED,
  263. -60,
  264. 0,
  265. UNUSED,
  266. UNUSED,
  267. -42,
  268. UNUSED,
  269. UNUSED,
  270. -49,
  271. UNUSED,
  272. UNUSED,
  273. 0,
  274. UNUSED,
  275. UNUSED,
  276. 0,
  277. UNUSED,
  278. UNUSED,
  279. UNUSED,
  280. 48,
  281. UNUSED,
  282. UNUSED,
  283. 49,
  284. 5,
  285. UNUSED,
  286. -53,
  287. 65,
  288. UNUSED,
  289. UNUSED,
  290. 0,
  291. 0,
  292. UNUSED,
  293. 38,
  294. UNUSED,
  295. 31,
  296. 0,
  297. UNUSED,
  298. 6,
  299. 35,
  300. UNUSED,
  301. UNUSED,
  302. 60,
  303. 33,
  304. UNUSED,
  305. 136,
  306. UNUSED,
  307. -87,
  308. -12,
  309. 42,
  310. 17,
  311. 0,
  312. 130,
  313. -85,
  314. UNUSED,
  315. UNUSED,
  316. 82,
  317. 0,
  318. UNUSED,
  319. 16,
  320. 98,
  321. -66,
  322. -100,
  323. 0,
  324. -10,
  325. -76,
  326. UNUSED,
  327. 84,
  328. UNUSED,
  329. 1,
  330. UNUSED,
  331. 0,
  332. 12,
  333. UNUSED,
  334. -145,
  335. 41,
  336. 106,
  337. UNUSED,
  338. 85,
  339. UNUSED,
  340. 43,
  341. 85,
  342. UNUSED,
  343. 23,
  344. 0,
  345. -14,
  346. UNUSED,
  347. UNUSED,
  348. 77,
  349. -2,
  350. UNUSED,
  351. UNUSED,
  352. 11,
  353. 91,
  354. -7,
  355. UNUSED,
  356. UNUSED,
  357. UNUSED,
  358. UNUSED,
  359. 107,
  360. 44,
  361. UNUSED,
  362. };
  363. static const int16_t hash2[128] = {
  364. UNUSED,
  365. 0,
  366. UNUSED,
  367. 0,
  368. UNUSED,
  369. UNUSED,
  370. 0,
  371. UNUSED,
  372. UNUSED,
  373. 0,
  374. UNUSED,
  375. UNUSED,
  376. UNUSED,
  377. UNUSED,
  378. UNUSED,
  379. UNUSED,
  380. UNUSED,
  381. 0,
  382. 80,
  383. 0,
  384. 64,
  385. UNUSED,
  386. 0,
  387. 0,
  388. 0,
  389. 0,
  390. UNUSED,
  391. UNUSED,
  392. UNUSED,
  393. 64,
  394. UNUSED,
  395. UNUSED,
  396. UNUSED,
  397. UNUSED,
  398. UNUSED,
  399. 0,
  400. 121,
  401. 0,
  402. UNUSED,
  403. 22,
  404. 100,
  405. 63,
  406. UNUSED,
  407. 114,
  408. UNUSED,
  409. 178,
  410. UNUSED,
  411. UNUSED,
  412. UNUSED,
  413. 0,
  414. UNUSED,
  415. -40,
  416. UNUSED,
  417. 88,
  418. UNUSED,
  419. UNUSED,
  420. UNUSED,
  421. UNUSED,
  422. 87,
  423. UNUSED,
  424. 42,
  425. UNUSED,
  426. UNUSED,
  427. 141,
  428. UNUSED,
  429. UNUSED,
  430. UNUSED,
  431. 103,
  432. UNUSED,
  433. 46,
  434. 106,
  435. 149,
  436. UNUSED,
  437. 23,
  438. 53,
  439. 0,
  440. UNUSED,
  441. UNUSED,
  442. UNUSED,
  443. 0,
  444. UNUSED,
  445. UNUSED,
  446. UNUSED,
  447. 33,
  448. 0,
  449. 0,
  450. 92,
  451. UNUSED,
  452. 50,
  453. 72,
  454. UNUSED,
  455. 7,
  456. 43,
  457. 66,
  458. UNUSED,
  459. UNUSED,
  460. 113,
  461. 52,
  462. UNUSED,
  463. UNUSED,
  464. UNUSED,
  465. UNUSED,
  466. UNUSED,
  467. UNUSED,
  468. 99,
  469. 101,
  470. 71,
  471. UNUSED,
  472. 20,
  473. 63,
  474. 32,
  475. UNUSED,
  476. UNUSED,
  477. UNUSED,
  478. 97,
  479. 18,
  480. 84,
  481. 132,
  482. UNUSED,
  483. 37,
  484. UNUSED,
  485. 9,
  486. 20,
  487. UNUSED,
  488. UNUSED,
  489. 75,
  490. 98,
  491. UNUSED,
  492. };
  493. uint32_t k1, k2;
  494. uint64_t crc;
  495. uint16_t ix;
  496. crc = crc64i(UINT64_C(0xaee7ac5ccabdec91), token);
  497. k1 = (uint32_t)crc;
  498. k2 = (uint32_t)(crc >> 32);
  499. ix = hash1[k1 & 0x7f] + hash2[k2 & 0x7f];
  500. if (ix >= 109)
  501. return PP_INVALID;
  502. if (!pp_directives[ix] || nasm_stricmp(pp_directives[ix], token))
  503. return PP_INVALID;
  504. return ix;
  505. }