Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 6 | #ifdef __GNUC__ |
| 7 | __inline |
| 8 | #else |
| 9 | #ifdef __cplusplus |
| 10 | inline |
| 11 | #endif |
| 12 | #endif |
| 13 | static unsigned int |
| 14 | is_reserved_hash (register const char *str, register unsigned int len) |
| 15 | { |
| 16 | static const unsigned char asso_values[] = |
| 17 | { |
| 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, 113, |
| 24 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 5, |
| 25 | 113, 113, 113, 113, 113, 113, 0, 113, 113, 113, |
| 26 | 0, 113, 113, 113, 113, 113, 113, 113, 113, 113, |
| 27 | 113, 113, 113, 113, 113, 0, 113, 0, 113, 20, |
| 28 | 25, 0, 35, 30, 113, 20, 113, 113, 40, 30, |
| 29 | 30, 0, 0, 113, 0, 51, 0, 15, 5, 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, 113, 113, 113, 113, |
| 43 | 113, 113, 113, 113, 113, 113 |
| 44 | }; |
| 45 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; |
| 46 | } |
| 47 | |
| 48 | #ifdef __GNUC__ |
| 49 | __inline |
| 50 | #endif |
| 51 | const struct resword * |
| 52 | is_reserved_word (register const char *str, register unsigned int len) |
| 53 | { |
| 54 | enum |
| 55 | { |
| 56 | TOTAL_KEYWORDS = 41, |
| 57 | MIN_WORD_LENGTH = 3, |
| 58 | MAX_WORD_LENGTH = 17, |
| 59 | MIN_HASH_VALUE = 4, |
| 60 | MAX_HASH_VALUE = 112 |
| 61 | }; |
| 62 | |
| 63 | static const struct resword wordlist[] = |
| 64 | { |
| 65 | {""}, {""}, {""}, {""}, |
| 66 | {"auto", AUTO_KEYW}, |
| 67 | {""}, {""}, |
| 68 | {"__asm__", ASM_KEYW}, |
| 69 | {""}, |
| 70 | {"_restrict", RESTRICT_KEYW}, |
| 71 | {"__typeof__", TYPEOF_KEYW}, |
| 72 | {"__attribute", ATTRIBUTE_KEYW}, |
| 73 | {"__restrict__", RESTRICT_KEYW}, |
| 74 | {"__attribute__", ATTRIBUTE_KEYW}, |
| 75 | {""}, |
| 76 | {"__volatile", VOLATILE_KEYW}, |
| 77 | {""}, |
| 78 | {"__volatile__", VOLATILE_KEYW}, |
| 79 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, |
| 80 | {""}, {""}, {""}, |
| 81 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
| 82 | {"int", INT_KEYW}, |
| 83 | {"char", CHAR_KEYW}, |
| 84 | {""}, {""}, |
| 85 | {"__const", CONST_KEYW}, |
| 86 | {"__inline", INLINE_KEYW}, |
| 87 | {"__const__", CONST_KEYW}, |
| 88 | {"__inline__", INLINE_KEYW}, |
| 89 | {""}, {""}, {""}, {""}, |
| 90 | {"__asm", ASM_KEYW}, |
| 91 | {"extern", EXTERN_KEYW}, |
| 92 | {""}, |
| 93 | {"register", REGISTER_KEYW}, |
| 94 | {""}, |
| 95 | {"float", FLOAT_KEYW}, |
| 96 | {"typeof", TYPEOF_KEYW}, |
| 97 | {"typedef", TYPEDEF_KEYW}, |
| 98 | {""}, {""}, |
| 99 | {"_Bool", BOOL_KEYW}, |
| 100 | {"double", DOUBLE_KEYW}, |
| 101 | {""}, {""}, |
| 102 | {"enum", ENUM_KEYW}, |
| 103 | {""}, {""}, {""}, |
| 104 | {"volatile", VOLATILE_KEYW}, |
| 105 | {"void", VOID_KEYW}, |
| 106 | {"const", CONST_KEYW}, |
| 107 | {"short", SHORT_KEYW}, |
| 108 | {"struct", STRUCT_KEYW}, |
| 109 | {""}, |
| 110 | {"restrict", RESTRICT_KEYW}, |
| 111 | {""}, |
| 112 | {"__signed__", SIGNED_KEYW}, |
| 113 | {""}, |
| 114 | {"asm", ASM_KEYW}, |
| 115 | {""}, {""}, |
| 116 | {"inline", INLINE_KEYW}, |
| 117 | {""}, {""}, {""}, |
| 118 | {"union", UNION_KEYW}, |
| 119 | {""}, {""}, {""}, {""}, {""}, {""}, |
| 120 | {"static", STATIC_KEYW}, |
| 121 | {""}, {""}, {""}, {""}, {""}, {""}, |
| 122 | {"__signed", SIGNED_KEYW}, |
| 123 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, |
| 124 | {""}, {""}, {""}, {""}, {""}, |
| 125 | {"unsigned", UNSIGNED_KEYW}, |
| 126 | {""}, {""}, {""}, {""}, |
| 127 | {"long", LONG_KEYW}, |
| 128 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, |
| 129 | {"signed", SIGNED_KEYW} |
| 130 | }; |
| 131 | |
| 132 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
| 133 | { |
| 134 | register int key = is_reserved_hash (str, len); |
| 135 | |
| 136 | if (key <= MAX_HASH_VALUE && key >= 0) |
| 137 | { |
| 138 | register const char *s = wordlist[key].name; |
| 139 | |
| 140 | if (*str == *s && !strcmp (str + 1, s + 1)) |
| 141 | return &wordlist[key]; |
| 142 | } |
| 143 | } |
| 144 | return 0; |
| 145 | } |