keywords.c_shipped 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* ANSI-C code produced by gperf version 2.7.2 */
  2. /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */
  3. struct resword { const char *name; int token; };
  4. /* maximum key range = 109, duplicates = 0 */
  5. #ifdef __GNUC__
  6. __inline
  7. #else
  8. #ifdef __cplusplus
  9. inline
  10. #endif
  11. #endif
  12. static unsigned int
  13. is_reserved_hash (register const char *str, register unsigned int len)
  14. {
  15. static const unsigned char asso_values[] =
  16. {
  17. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  18. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  19. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  20. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  21. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  22. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  23. 113, 113, 113, 113, 113, 113, 113, 113, 113, 5,
  24. 113, 113, 113, 113, 113, 113, 0, 113, 113, 113,
  25. 0, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  26. 113, 113, 113, 113, 113, 0, 113, 0, 113, 20,
  27. 25, 0, 35, 30, 113, 20, 113, 113, 40, 30,
  28. 30, 0, 0, 113, 0, 51, 0, 15, 5, 113,
  29. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  30. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  31. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  32. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  33. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  34. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  35. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  36. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  37. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  38. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  39. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  40. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  41. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  42. 113, 113, 113, 113, 113, 113
  43. };
  44. return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
  45. }
  46. #ifdef __GNUC__
  47. __inline
  48. #endif
  49. const struct resword *
  50. is_reserved_word (register const char *str, register unsigned int len)
  51. {
  52. enum
  53. {
  54. TOTAL_KEYWORDS = 41,
  55. MIN_WORD_LENGTH = 3,
  56. MAX_WORD_LENGTH = 17,
  57. MIN_HASH_VALUE = 4,
  58. MAX_HASH_VALUE = 112
  59. };
  60. static const struct resword wordlist[] =
  61. {
  62. {""}, {""}, {""}, {""},
  63. {"auto", AUTO_KEYW},
  64. {""}, {""},
  65. {"__asm__", ASM_KEYW},
  66. {""},
  67. {"_restrict", RESTRICT_KEYW},
  68. {"__typeof__", TYPEOF_KEYW},
  69. {"__attribute", ATTRIBUTE_KEYW},
  70. {"__restrict__", RESTRICT_KEYW},
  71. {"__attribute__", ATTRIBUTE_KEYW},
  72. {""},
  73. {"__volatile", VOLATILE_KEYW},
  74. {""},
  75. {"__volatile__", VOLATILE_KEYW},
  76. {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
  77. {""}, {""}, {""},
  78. {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
  79. {"int", INT_KEYW},
  80. {"char", CHAR_KEYW},
  81. {""}, {""},
  82. {"__const", CONST_KEYW},
  83. {"__inline", INLINE_KEYW},
  84. {"__const__", CONST_KEYW},
  85. {"__inline__", INLINE_KEYW},
  86. {""}, {""}, {""}, {""},
  87. {"__asm", ASM_KEYW},
  88. {"extern", EXTERN_KEYW},
  89. {""},
  90. {"register", REGISTER_KEYW},
  91. {""},
  92. {"float", FLOAT_KEYW},
  93. {"typeof", TYPEOF_KEYW},
  94. {"typedef", TYPEDEF_KEYW},
  95. {""}, {""},
  96. {"_Bool", BOOL_KEYW},
  97. {"double", DOUBLE_KEYW},
  98. {""}, {""},
  99. {"enum", ENUM_KEYW},
  100. {""}, {""}, {""},
  101. {"volatile", VOLATILE_KEYW},
  102. {"void", VOID_KEYW},
  103. {"const", CONST_KEYW},
  104. {"short", SHORT_KEYW},
  105. {"struct", STRUCT_KEYW},
  106. {""},
  107. {"restrict", RESTRICT_KEYW},
  108. {""},
  109. {"__signed__", SIGNED_KEYW},
  110. {""},
  111. {"asm", ASM_KEYW},
  112. {""}, {""},
  113. {"inline", INLINE_KEYW},
  114. {""}, {""}, {""},
  115. {"union", UNION_KEYW},
  116. {""}, {""}, {""}, {""}, {""}, {""},
  117. {"static", STATIC_KEYW},
  118. {""}, {""}, {""}, {""}, {""}, {""},
  119. {"__signed", SIGNED_KEYW},
  120. {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
  121. {""}, {""}, {""}, {""}, {""},
  122. {"unsigned", UNSIGNED_KEYW},
  123. {""}, {""}, {""}, {""},
  124. {"long", LONG_KEYW},
  125. {""}, {""}, {""}, {""}, {""}, {""}, {""},
  126. {"signed", SIGNED_KEYW}
  127. };
  128. if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
  129. {
  130. register int key = is_reserved_hash (str, len);
  131. if (key <= MAX_HASH_VALUE && key >= 0)
  132. {
  133. register const char *s = wordlist[key].name;
  134. if (*str == *s && !strcmp (str + 1, s + 1))
  135. return &wordlist[key];
  136. }
  137. }
  138. return 0;
  139. }