Sync usage with man page.
[netbsd-mini2440.git] / gnu / usr.bin / groff / pic / key.cc
bloba73e71c0e3ebe84de1cf893643216d3b4417e889
1 /* C code produced by gperf version 2.3 (GNU C++ version) */
2 /* Command-line: gperf -p -a -t -k 1,3,4 -c -C -N lookup_keyword -T pic.gperf */
3 /* Copyright (C) 1989, 1990 Free Software Foundation, Inc.
4 Written by James Clark (jjc@jclark.uucp)
6 This file is part of groff.
8 groff is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 1, or (at your option) any later
11 version.
13 groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License along
19 with groff; see the file LICENSE. If not, write to the Free Software
20 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include "key.h"
22 #include "pic.h"
23 #include "ptable.h"
24 #include "object.h"
25 #include "pic.tab.h"
27 #define TOTAL_KEYWORDS 81
28 #define MIN_WORD_LENGTH 2
29 #define MAX_WORD_LENGTH 9
30 #define MIN_HASH_VALUE 2
31 #define MAX_HASH_VALUE 276
32 /* maximum key range = 275, duplicates = 0 */
34 static unsigned int
35 hash (register const char *str, register int len)
37 static const unsigned short asso_values[] =
39 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
40 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
41 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
42 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
43 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
44 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
45 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
46 277, 277, 5, 277, 277, 277, 277, 277, 277, 277,
47 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
48 277, 277, 277, 277, 277, 277, 277, 25, 20, 40,
49 55, 35, 105, 35, 15, 110, 277, 277, 40, 95,
50 25, 70, 7, 277, 30, 100, 0, 85, 20, 17,
51 5, 5, 277, 277, 277, 277, 277, 277,
53 register int hval = len;
55 switch (hval)
57 default:
58 case 4:
59 hval += asso_values[str[3]];
60 case 3:
61 hval += asso_values[str[2]];
62 case 2:
63 case 1:
64 hval += asso_values[str[0]];
66 return hval;
69 const struct keyword *
70 lookup_keyword (register const char *str, register int len)
73 static const struct keyword wordlist[] =
75 {"to", TO},
76 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
77 {"top", TOP},
78 {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
79 {"ht", HEIGHT},
80 {"",}, {"",}, {"",}, {"",},
81 {"by", BY},
82 {"",}, {"",},
83 {"way", WAY},
84 {"bottom", BOTTOM},
85 {"at", AT},
86 {"box", BOX},
87 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
88 {"with", WITH},
89 {"",},
90 {"the", THE},
91 {"",}, {"",}, {"",},
92 {"cw", CW},
93 {"",},
94 {"between", BETWEEN},
95 {"exp", EXP},
96 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
97 {"",},
98 {"copy", COPY},
99 {"do", DO},
100 {"",}, {"",},
101 {"ccw", CCW},
102 {"dotted", DOTTED},
103 {"",}, {"",},
104 {"then", THEN},
105 {"",}, {"",}, {"",},
106 {"arc", ARC},
107 {"",}, {"",},
108 {"center", CENTER},
109 {"of", OF},
110 {"",},
111 {"Here", HERE},
112 {"wid", WIDTH},
113 {"",},
114 {"width", WIDTH},
115 {"log", LOG},
116 {"",},
117 {"atan2", ATAN2},
118 {"plot", PLOT},
119 {"",},
120 {"and", AND},
121 {"",},
122 {"right", RIGHT},
123 {"",},
124 {"up", UP},
125 {"rad", RADIUS},
126 {"",}, {"",}, {"",}, {"",},
127 {"end", END},
128 {"",}, {"",}, {"",},
129 {"lower", LOWER},
130 {"",}, {"",}, {"",},
131 {"down", DOWN},
132 {"sh", SH},
133 {"max", MAX},
134 {"line", LINE},
135 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
136 {"if", IF},
137 {"int", INT},
138 {"rand", RAND},
139 {"",},
140 {"circle", CIRCLE},
141 {"",}, {"",},
142 {"thru", THRU},
143 {"above", ABOVE},
144 {"chop", CHOP},
145 {"",},
146 {"min", MIN},
147 {"",}, {"",}, {"",}, {"",},
148 {"sin", SIN},
149 {"",},
150 {"arrow", ARROW},
151 {"",},
152 {"upper", UPPER},
153 {"",},
154 {"sqrt", SQRT},
155 {"below", BELOW},
156 {"",}, {"",},
157 {"for", FOR},
158 {"",}, {"",}, {"",}, {"",},
159 {"cos", COS},
160 {"last", LAST},
161 {"",}, {"",},
162 {"print", PRINT},
163 {"",},
164 {"left", LEFT},
165 {"",}, {"",}, {"",}, {"",},
166 {"move", MOVE},
167 {"thick", THICKNESS},
168 {"",}, {"",}, {"",},
169 {"thickness", THICKNESS},
170 {"start", START},
171 {"",}, {"",}, {"",}, {"",}, {"",},
172 {"height", HEIGHT},
173 {"",}, {"",}, {"",},
174 {"reset", RESET},
175 {"",}, {"",}, {"",},
176 {"else", ELSE},
177 {"",},
178 {"dashed", DASHED},
179 {"aligned", ALIGNED},
180 {"",},
181 {"diam", DIAMETER},
182 {"undef", UNDEF},
183 {"",}, {"",},
184 {"diameter", DIAMETER},
185 {"",}, {"",}, {"",}, {"",}, {"",},
186 {"fill", FILL},
187 {"",},
188 {"filled", FILL},
189 {"ellipse", ELLIPSE},
190 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
191 {"until", UNTIL},
192 {"radius", RADIUS},
193 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
194 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
196 {"rjust", RJUST},
197 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
198 {"ljust", LJUST},
199 {"",}, {"",}, {"",},
200 {"same", SAME},
201 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
202 {"",},
203 {"invis", INVISIBLE},
204 {"",},
205 {"sprintf", SPRINTF},
206 {"",},
207 {"invisible", INVISIBLE},
208 {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
209 {"spline", SPLINE},
210 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
211 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
212 {"from", FROM},
213 {"",},
214 {"define", DEFINE},
217 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
219 register int key = hash (str, len) - MIN_HASH_VALUE;
221 if (key <= (MAX_HASH_VALUE - MIN_HASH_VALUE) && key >= 0)
223 register const char *s = wordlist[key].name;
225 if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
226 return &wordlist[key];
229 return 0;