import of gcc-2.8
[official-gcc.git] / gcc / cp / hash.h
blob720890fd4c883168b79a527213dbabb44de8118d
1 /* C code produced by gperf version 2.5 (GNU C++ version) */
2 /* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gxx.gperf */
3 struct resword { char *name; short token; enum rid rid;};
5 #define TOTAL_KEYWORDS 103
6 #define MIN_WORD_LENGTH 2
7 #define MAX_WORD_LENGTH 16
8 #define MIN_HASH_VALUE 4
9 #define MAX_HASH_VALUE 195
10 /* maximum key range = 192, duplicates = 0 */
12 #ifdef __GNUC__
13 inline
14 #endif
15 static unsigned int
16 hash (str, len)
17 register char *str;
18 register int unsigned len;
20 static unsigned char asso_values[] =
22 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
23 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
24 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
25 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
26 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
27 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
28 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
29 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
30 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
31 196, 196, 196, 196, 196, 0, 196, 80, 26, 28,
32 44, 0, 49, 38, 6, 81, 196, 2, 0, 41,
33 16, 47, 4, 31, 32, 5, 6, 62, 20, 96,
34 17, 25, 196, 196, 196, 196, 196, 196,
36 register int hval = len;
38 switch (hval)
40 default:
41 case 7:
42 hval += asso_values[str[6]];
43 case 6:
44 case 5:
45 case 4:
46 hval += asso_values[str[3]];
47 case 3:
48 case 2:
49 case 1:
50 hval += asso_values[str[0]];
51 break;
53 return hval + asso_values[str[len - 1]];
56 #ifdef __GNUC__
57 inline
58 #endif
59 struct resword *
60 is_reserved_word (str, len)
61 register char *str;
62 register unsigned int len;
64 static struct resword wordlist[] =
66 {"",}, {"",}, {"",}, {"",},
67 {"else", ELSE, NORID,},
68 {"",},
69 {"__real", REALPART, NORID},
70 {"",},
71 {"__real__", REALPART, NORID},
72 {"",},
73 {"true", CXX_TRUE, NORID,},
74 {"",},
75 {"__asm__", GCC_ASM_KEYWORD, NORID},
76 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
77 {"this", THIS, NORID,},
78 {"",},
79 {"extern", SCSPEC, RID_EXTERN,},
80 {"switch", SWITCH, NORID,},
81 {"template", TEMPLATE, RID_TEMPLATE,},
82 {"not", '!', NORID,},
83 {"",},
84 {"__alignof__", ALIGNOF, NORID},
85 {"static_cast", STATIC_CAST, NORID,},
86 {"",},
87 {"bool", TYPESPEC, RID_BOOL,},
88 {"private", VISSPEC, RID_PRIVATE,},
89 {"case", CASE, NORID,},
90 {"virtual", SCSPEC, RID_VIRTUAL,},
91 {"try", TRY, NORID,},
92 {"",}, {"",},
93 {"compl", '~', NORID,},
94 {"public", VISSPEC, RID_PUBLIC,},
95 {"",},
96 {"__inline", SCSPEC, RID_INLINE},
97 {"",},
98 {"__inline__", SCSPEC, RID_INLINE},
99 {"class", AGGR, RID_CLASS,},
100 {"const", CV_QUALIFIER, RID_CONST,},
101 {"static", SCSPEC, RID_STATIC,},
102 {"__extension__", EXTENSION, NORID},
103 {"",},
104 {"short", TYPESPEC, RID_SHORT,},
105 {"__imag__", IMAGPART, NORID},
106 {"delete", DELETE, NORID,},
107 {"__asm", GCC_ASM_KEYWORD, NORID},
108 {"xor", '^', NORID,},
109 {"not_eq", EQCOMPARE, NORID,},
110 {"xor_eq", ASSIGN, NORID,},
111 {"typename", TYPENAME_KEYWORD, NORID,},
112 {"typeid", TYPEID, NORID,},
113 {"",},
114 {"__complex__", TYPESPEC, RID_COMPLEX},
115 {"false", CXX_FALSE, NORID,},
116 {"sizeof", SIZEOF, NORID,},
117 {"typeof", TYPEOF, NORID,},
118 {"__const__", CV_QUALIFIER, RID_CONST},
119 {"__volatile", CV_QUALIFIER, RID_VOLATILE},
120 {"",},
121 {"__volatile__", CV_QUALIFIER, RID_VOLATILE},
122 {"__const", CV_QUALIFIER, RID_CONST},
123 {"catch", CATCH, NORID,},
124 {"__null", CONSTANT, RID_NULL},
125 {"protected", VISSPEC, RID_PROTECTED,},
126 {"",},
127 {"signed", TYPESPEC, RID_SIGNED,},
128 {"",},
129 {"__complex", TYPESPEC, RID_COMPLEX},
130 {"__alignof", ALIGNOF, NORID},
131 {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
132 {"double", TYPESPEC, RID_DOUBLE,},
133 {"const_cast", CONST_CAST, NORID,},
134 {"",},
135 {"struct", AGGR, RID_RECORD,},
136 {"long", TYPESPEC, RID_LONG,},
137 {"or", OROR, NORID,},
138 {"__typeof__", TYPEOF, NORID},
139 {"or_eq", ASSIGN, NORID,},
140 {"for", FOR, NORID,},
141 {"__imag", IMAGPART, NORID},
142 {"enum", ENUM, NORID,},
143 {"",}, {"",},
144 {"__label__", LABEL, NORID},
145 {"int", TYPESPEC, RID_INT,},
146 {"__signed__", TYPESPEC, RID_SIGNED},
147 {"signature", AGGR, RID_SIGNATURE /* Extension */,},
148 {"do", DO, NORID,},
149 {"",},
150 {"explicit", SCSPEC, RID_EXPLICIT,},
151 {"char", TYPESPEC, RID_CHAR,},
152 {"",},
153 {"__attribute", ATTRIBUTE, NORID},
154 {"friend", SCSPEC, RID_FRIEND,},
155 {"__attribute__", ATTRIBUTE, NORID},
156 {"while", WHILE, NORID,},
157 {"reinterpret_cast", REINTERPRET_CAST, NORID,},
158 {"",},
159 {"continue", CONTINUE, NORID,},
160 {"namespace", NAMESPACE, NORID,},
161 {"sigof", SIGOF, NORID /* Extension */,},
162 {"",},
163 {"volatile", CV_QUALIFIER, RID_VOLATILE,},
164 {"",},
165 {"bitor", '|', NORID,},
166 {"typedef", SCSPEC, RID_TYPEDEF,},
167 {"void", TYPESPEC, RID_VOID,},
168 {"break", BREAK, NORID,},
169 {"",},
170 {"new", NEW, NORID,},
171 {"return", RETURN, NORID,},
172 {"and_eq", ASSIGN, NORID,},
173 {"",}, {"",}, {"",},
174 {"using", USING, NORID,},
175 {"",}, {"",},
176 {"asm", ASM_KEYWORD, NORID,},
177 {"",}, {"",},
178 {"and", ANDAND, NORID,},
179 {"mutable", SCSPEC, RID_MUTABLE,},
180 {"__typeof", TYPEOF, NORID},
181 {"union", AGGR, RID_UNION,},
182 {"",},
183 {"if", IF, NORID,},
184 {"__signed", TYPESPEC, RID_SIGNED},
185 {"",}, {"",},
186 {"goto", GOTO, NORID,},
187 {"",}, {"",},
188 {"__sigof__", SIGOF, NORID /* Extension */,},
189 {"float", TYPESPEC, RID_FLOAT,},
190 {"",}, {"",},
191 {"default", DEFAULT, NORID,},
192 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
193 {"register", SCSPEC, RID_REGISTER,},
194 {"throw", THROW, NORID,},
195 {"",},
196 {"bitand", '&', NORID,},
197 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
198 {"operator", OPERATOR, NORID,},
199 {"",},
200 {"inline", SCSPEC, RID_INLINE,},
201 {"",},
202 {"dynamic_cast", DYNAMIC_CAST, NORID,},
203 {"",}, {"",}, {"",},
204 {"__signature__", AGGR, RID_SIGNATURE /* Extension */,},
205 {"",}, {"",}, {"",},
206 {"auto", SCSPEC, RID_AUTO,},
207 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
208 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
209 {"unsigned", TYPESPEC, RID_UNSIGNED,},
212 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
214 register int key = hash (str, len);
216 if (key <= MAX_HASH_VALUE && key >= 0)
218 register char *s = wordlist[key].name;
220 if (*s == *str && !strcmp (str + 1, s + 1))
221 return &wordlist[key];
224 return 0;