This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / gnu / usr.bin / cc / cc1plus / cp-hash.h
CommitLineData
9bf86ebb
PR
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 gplus.gperf */
3/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
4struct resword { char *name; short token; enum rid rid;};
5
6#define TOTAL_KEYWORDS 82
7#define MIN_WORD_LENGTH 2
8#define MAX_WORD_LENGTH 13
9#define MIN_HASH_VALUE 4
10#define MAX_HASH_VALUE 140
11/* maximum key range = 137, duplicates = 0 */
12
13#ifdef __GNUC__
14inline
15#endif
16static unsigned int
17hash (str, len)
18 register char *str;
19 register int unsigned len;
20{
21 static unsigned char asso_values[] =
22 {
23 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
24 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
25 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
26 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
27 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
28 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
29 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
30 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
31 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
32 141, 141, 141, 141, 141, 0, 141, 49, 3, 28,
33 28, 0, 5, 11, 32, 37, 141, 2, 24, 35,
34 51, 0, 19, 141, 23, 0, 8, 48, 0, 36,
35 0, 11, 141, 141, 141, 141, 141, 141,
36 };
37 register int hval = len;
38
39 switch (hval)
40 {
41 default:
42 case 7:
43 hval += asso_values[str[6]];
44 case 6:
45 case 5:
46 case 4:
47 hval += asso_values[str[3]];
48 case 3:
49 case 2:
50 case 1:
51 hval += asso_values[str[0]];
52 }
53 return hval + asso_values[str[len - 1]];
54}
55
56#ifdef __GNUC__
57inline
58#endif
59struct resword *
60is_reserved_word (str, len)
61 register char *str;
62 register unsigned int len;
63{
64 static struct resword wordlist[] =
65 {
66 {"",}, {"",}, {"",}, {"",},
67 {"else", ELSE, NORID,},
68 {"",}, {"",},
69 {"__asm__", GCC_ASM_KEYWORD, NORID},
70 {"",}, {"",},
71 {"__headof__", HEADOF, NORID},
72 {"sizeof", SIZEOF, NORID,},
73 {"this", THIS, NORID,},
74 {"__headof", HEADOF, NORID},
75 {"except", EXCEPT, NORID /* Extension */,},
76 {"goto", GOTO, NORID,},
77 {"",},
78 {"__const__", TYPE_QUAL, RID_CONST},
79 {"__volatile", TYPE_QUAL, RID_VOLATILE},
80 {"typeof", TYPEOF, NORID,},
81 {"__volatile__", TYPE_QUAL, RID_VOLATILE},
82 {"__typeof__", TYPEOF, NORID},
83 {"try", TRY, NORID /* Extension */,},
84 {"__const", TYPE_QUAL, RID_CONST},
85 {"__typeof", TYPEOF, NORID},
86 {"typedef", SCSPEC, RID_TYPEDEF,},
87 {"private", VISSPEC, RID_PRIVATE,},
88 {"",},
89 {"raise", RAISE, NORID /* Extension */,},
90 {"raises", RAISES, NORID /* Extension */,},
91 {"do", DO, NORID,},
92 {"for", FOR, NORID,},
93 {"case", CASE, NORID,},
94 {"class", AGGR, RID_CLASS,},
95 {"delete", DELETE, NORID,},
96 {"__classof__", CLASSOF, NORID},
97 {"short", TYPESPEC, RID_SHORT,},
98 {"double", TYPESPEC, RID_DOUBLE,},
99 {"__classof", CLASSOF, NORID},
100 {"friend", SCSPEC, RID_FRIEND,},
101 {"__asm", GCC_ASM_KEYWORD, NORID},
102 {"const", TYPE_QUAL, RID_CONST,},
103 {"static", SCSPEC, RID_STATIC,},
104 {"template", TEMPLATE, NORID,},
105 {"if", IF, NORID,},
106 {"classof", CLASSOF, NORID,},
107 {"switch", SWITCH, NORID,},
108 {"__signed__", TYPESPEC, RID_SIGNED},
109 {"int", TYPESPEC, RID_INT,},
110 {"throw", THROW, NORID /* Extension */,},
111 {"long", TYPESPEC, RID_LONG,},
112 {"",}, {"",},
113 {"auto", SCSPEC, RID_AUTO,},
114 {"operator", OPERATOR, NORID,},
115 {"",},
116 {"__attribute", ATTRIBUTE, NORID},
117 {"extern", SCSPEC, RID_EXTERN,},
118 {"__attribute__", ATTRIBUTE, NORID},
119 {"break", BREAK, NORID,},
120 {"void", TYPESPEC, RID_VOID,},
121 {"",},
122 {"struct", AGGR, RID_RECORD,},
123 {"virtual", SCSPEC, RID_VIRTUAL,},
124 {"__extension__", EXTENSION, NORID},
125 {"while", WHILE, NORID,},
126 {"",},
127 {"float", TYPESPEC, RID_FLOAT,},
128 {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
129 {"",}, {"",},
130 {"headof", HEADOF, NORID,},
131 {"protected", VISSPEC, RID_PROTECTED,},
132 {"__signed", TYPESPEC, RID_SIGNED},
133 {"enum", ENUM, NORID,},
134 {"",},
135 {"all", ALL, NORID /* Extension */,},
136 {"public", VISSPEC, RID_PUBLIC,},
137 {"char", TYPESPEC, RID_CHAR,},
138 {"reraise", RERAISE, NORID /* Extension */,},
139 {"inline", SCSPEC, RID_INLINE,},
140 {"volatile", TYPE_QUAL, RID_VOLATILE,},
141 {"__label__", LABEL, NORID},
142 {"",}, {"",},
143 {"signed", TYPESPEC, RID_SIGNED,},
144 {"__alignof__", ALIGNOF, NORID},
145 {"asm", ASM_KEYWORD, NORID,},
146 {"",},
147 {"__alignof", ALIGNOF, NORID},
148 {"new", NEW, NORID,},
149 {"register", SCSPEC, RID_REGISTER,},
150 {"continue", CONTINUE, NORID,},
151 {"catch", CATCH, NORID,},
152 {"",}, {"",}, {"",},
153 {"exception", AGGR, RID_EXCEPTION /* Extension */,},
154 {"",}, {"",},
155 {"default", DEFAULT, NORID,},
156 {"",}, {"",}, {"",},
157 {"union", AGGR, RID_UNION,},
158 {"",}, {"",}, {"",},
159 {"overload", OVERLOAD, NORID,},
160 {"",},
161 {"__inline", SCSPEC, RID_INLINE},
162 {"",},
163 {"__inline__", SCSPEC, RID_INLINE},
164 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
165 {"unsigned", TYPESPEC, RID_UNSIGNED,},
166 {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
167 {"return", RETURN, NORID,},
168 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
169 {"",}, {"",},
170 {"dynamic", DYNAMIC, NORID,},
171 };
172
173 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
174 {
175 register int key = hash (str, len);
176
177 if (key <= MAX_HASH_VALUE && key >= 0)
178 {
179 register char *s = wordlist[key].name;
180
181 if (*s == *str && !strcmp (str + 1, s + 1))
182 return &wordlist[key];
183 }
184 }
185 return 0;
186}