1 /*-
2 * %sccs.include.proprietary.c%
3 *
4 * @(#)ehash.c 8.1 (Berkeley) 06/06/93
5 */
6
7 struct hnode {
8 char *aakey;
9 struct dict *aadata;
10 };
11 struct dict {
12 char *entry;
13 char val;
14 };
15 char able();
16 struct dict able_d[];
17 char ace();
18 struct dict ace_d[];
19 char age();
20 struct dict age_d[];
21 char ance();
22 struct dict ance_d[];
23 char ant();
24 struct dict ant_d[];
25 char cal();
26 struct dict cal_d[];
27 char cle();
28 struct dict cle_d[];
29 char ee();
30 struct dict ee_d[];
31 char ence();
32 struct dict ence_d[];
33 char ess();
34 struct dict ess_d[];
35 char est();
36 struct dict est_d[];
37 char ful();
38 struct dict ful_d[];
39 char ible();
40 struct dict ible_d[];
41 char ic();
42 struct dict ic_d[];
43 char ice();
44 struct dict ice_d[];
45 char ion();
46 struct dict ion_d[];
47 char ional();
48 struct dict ional_d[];
49 char is();
50 struct dict is_d[];
51 char ish();
52 struct dict ish_d[];
53 char ist();
54 struct dict ist_d[];
55 char ite();
56 struct dict ite_d[];
57 char ive();
58 struct dict ive_d[];
59 char ize();
60 struct dict ize_d[];
61 char lar();
62 struct dict lar_d[];
63 char less();
64 struct dict less_d[];
65 char man();
66 struct dict man_d[];
67 char ment();
68 struct dict ment_d[];
69 char ness();
70 struct dict ness_d[];
71 char ous();
72 struct dict ous_d[];
73 char ship();
74 struct dict ship_d[];
75 char ss();
76 struct dict ss_d[];
77 char ure();
78 struct dict ure_d[];
79 char us();
80 struct dict us_d[];
81 char ing();
82 struct dict ing_d[];
83 char ed();
84 struct dict ed_d[];
85 struct fandd {
86 char (*fun)();
87 struct dict *yd;
88 } arr[] = {
89 able, able_d,
90 ace, ace_d,
91 age, age_d,
92 ance, ance_d,
93 ant, ant_d,
94 cal, cal_d,
95 cle, cle_d,
96 ee, ee_d,
97 ence, ence_d,
98 ess, ess_d,
99 est, est_d,
100 ful, ful_d,
101 ible, ible_d,
102 ic, ic_d,
103 ice, ice_d,
104 ion, ion_d,
105 ional, ional_d,
106 is, is_d,
107 ish, ish_d,
108 ist, ist_d,
109 ite, ite_d,
110 ive, ive_d,
111 ize, ize_d,
112 lar, lar_d,
113 less, less_d,
114 man, man_d,
115 ment, ment_d,
116 ness, ness_d,
117 ous, ous_d,
118 ship, ship_d,
119 ss, ss_d,
120 ure, ure_d,
121 us, us_d,
122 ing, ing_d,
123 ed, ed_d,
124 0, 0
125 };
egetd()126 egetd(){
127 struct dict *pp;
128 struct fandd *ptr;
129 ptr = arr;
130 while(ptr->fun != 0){
131 pp = ptr->yd;
132 while(pp->entry != 0){
133 (*ptr->fun)(pp->entry,0,pp);
134 pp++;
135 }
136 ptr++;
137 }
138 }
139 char
aahash(s,ex,aatsize,aapr1,aapr2,tbl,data)140 aahash(s,ex,aatsize,aapr1,aapr2,tbl,data)
141 char *s;
142 struct hnode tbl[];
143 struct dict *data;
144 {
145 char *cp;
146 int i, key, c, p1, p2;
147 cp = s;
148 key =0;
149 while (c = *cp++)
150 key = key + (key<<5) + c;
151 key &= 077777;
152 p1 = key%aapr1;
153 p2 = key%aapr2;
154 if (p2==0) p2=17;
155 for(i=0; i<aatsize; i++)
156 {
157 if (tbl[p1].aakey==0)
158 { /* new item */
159 if (ex ==0)
160 {
161 tbl[p1].aakey = s;
162 tbl[p1].aadata= data;
163 return(tbl[p1].aadata->val);
164 }
165 else
166 return(0);
167 }
168 else
169 if(strcmp(tbl[p1].aakey, s)== 0)
170 {
171 return(tbl[p1].aadata->val);
172 }
173 p1 = (p1+p2)%aatsize;
174 }
175 fprintf(stderr, "hash table full\n");
176 exit(1);
177 }
178 struct hnode aa1root[43];
179 #define aa1tsize 43
180 #define aa1p1 37
181 #define aa1p2 41
182 char
able(a0,a1,ptr)183 able(a0,a1,ptr)
184 char *a0;
185 struct dict *ptr;
186 {
187 return(aahash(a0,a1,aa1tsize,aa1p1,aa1p2,aa1root,ptr));
188 }
189 struct hnode aa2root[11];
190 #define aa2tsize 11
191 #define aa2p1 5
192 #define aa2p2 7
193 char
ace(a0,a1,ptr)194 ace(a0,a1,ptr)
195 char *a0;
196 struct dict *ptr;
197 {
198 return(aahash(a0,a1,aa2tsize,aa2p1,aa2p2,aa2root,ptr));
199 }
200 struct hnode aa3root[61];
201 #define aa3tsize 61
202 #define aa3p1 53
203 #define aa3p2 59
204 char
age(a0,a1,ptr)205 age(a0,a1,ptr)
206 char *a0;
207 struct dict *ptr;
208 {
209 return(aahash(a0,a1,aa3tsize,aa3p1,aa3p2,aa3root,ptr));
210 }
211 struct hnode aa4root[37];
212 #define aa4tsize 37
213 #define aa4p1 29
214 #define aa4p2 31
215 char
ance(a0,a1,ptr)216 ance(a0,a1,ptr)
217 char *a0;
218 struct dict *ptr;
219 {
220 return(aahash(a0,a1,aa4tsize,aa4p1,aa4p2,aa4root,ptr));
221 }
222 struct hnode aa5root[31];
223 #define aa5tsize 31
224 #define aa5p1 23
225 #define aa5p2 29
226 char
ant(a0,a1,ptr)227 ant(a0,a1,ptr)
228 char *a0;
229 struct dict *ptr;
230 {
231 return(aahash(a0,a1,aa5tsize,aa5p1,aa5p2,aa5root,ptr));
232 }
233 struct hnode aa7root[19];
234 #define aa7tsize 19
235 #define aa7p1 13
236 #define aa7p2 17
237 char
cal(a0,a1,ptr)238 cal(a0,a1,ptr)
239 char *a0;
240 struct dict *ptr;
241 {
242 return(aahash(a0,a1,aa7tsize,aa7p1,aa7p2,aa7root,ptr));
243 }
244 struct hnode aa8root[13];
245 #define aa8tsize 13
246 #define aa8p1 7
247 #define aa8p2 11
248 char
cle(a0,a1,ptr)249 cle(a0,a1,ptr)
250 char *a0;
251 struct dict *ptr;
252 {
253 return(aahash(a0,a1,aa8tsize,aa8p1,aa8p2,aa8root,ptr));
254 }
255 struct hnode aa10root[31];
256 #define aa10tsize 31
257 #define aa10p1 23
258 #define aa10p2 29
259 char
ee(a0,a1,ptr)260 ee(a0,a1,ptr)
261 char *a0;
262 struct dict *ptr;
263 {
264 return(aahash(a0,a1,aa10tsize,aa10p1,aa10p2,aa10root,ptr));
265 }
266 struct hnode aa11root[31];
267 #define aa11tsize 31
268 #define aa11p1 23
269 #define aa11p2 29
270 char
ence(a0,a1,ptr)271 ence(a0,a1,ptr)
272 char *a0;
273 struct dict *ptr;
274 {
275 return(aahash(a0,a1,aa11tsize,aa11p1,aa11p2,aa11root,ptr));
276 }
277 struct hnode aa13root[47];
278 #define aa13tsize 47
279 #define aa13p1 41
280 #define aa13p2 43
281 char
ess(a0,a1,ptr)282 ess(a0,a1,ptr)
283 char *a0;
284 struct dict *ptr;
285 {
286 return(aahash(a0,a1,aa13tsize,aa13p1,aa13p2,aa13root,ptr));
287 }
288 struct hnode aa14root[67];
289 #define aa14tsize 67
290 #define aa14p1 59
291 #define aa14p2 61
292 char
est(a0,a1,ptr)293 est(a0,a1,ptr)
294 char *a0;
295 struct dict *ptr;
296 {
297 return(aahash(a0,a1,aa14tsize,aa14p1,aa14p2,aa14root,ptr));
298 }
299 struct hnode aa15root[43];
300 #define aa15tsize 43
301 #define aa15p1 37
302 #define aa15p2 41
303 char
ful(a0,a1,ptr)304 ful(a0,a1,ptr)
305 char *a0;
306 struct dict *ptr;
307 {
308 return(aahash(a0,a1,aa15tsize,aa15p1,aa15p2,aa15root,ptr));
309 }
310 struct hnode aa18root[19];
311 #define aa18tsize 19
312 #define aa18p1 13
313 #define aa18p2 17
314 char
ible(a0,a1,ptr)315 ible(a0,a1,ptr)
316 char *a0;
317 struct dict *ptr;
318 {
319 return(aahash(a0,a1,aa18tsize,aa18p1,aa18p2,aa18root,ptr));
320 }
321 struct hnode aa19root[151];
322 #define aa19tsize 151
323 #define aa19p1 139
324 #define aa19p2 149
325 char
ic(a0,a1,ptr)326 ic(a0,a1,ptr)
327 char *a0;
328 struct dict *ptr;
329 {
330 return(aahash(a0,a1,aa19tsize,aa19p1,aa19p2,aa19root,ptr));
331 }
332 struct hnode aa20root[11];
333 #define aa20tsize 11
334 #define aa20p1 5
335 #define aa20p2 7
336 char
ice(a0,a1,ptr)337 ice(a0,a1,ptr)
338 char *a0;
339 struct dict *ptr;
340 {
341 return(aahash(a0,a1,aa20tsize,aa20p1,aa20p2,aa20root,ptr));
342 }
343 struct hnode aa21root[89];
344 #define aa21tsize 89
345 #define aa21p1 79
346 #define aa21p2 83
347 char
ion(a0,a1,ptr)348 ion(a0,a1,ptr)
349 char *a0;
350 struct dict *ptr;
351 {
352 return(aahash(a0,a1,aa21tsize,aa21p1,aa21p2,aa21root,ptr));
353 }
354 struct hnode aa22root[13];
355 #define aa22tsize 13
356 #define aa22p1 7
357 #define aa22p2 11
358 char
ional(a0,a1,ptr)359 ional(a0,a1,ptr)
360 char *a0;
361 struct dict *ptr;
362 {
363 return(aahash(a0,a1,aa22tsize,aa22p1,aa22p2,aa22root,ptr));
364 }
365 struct hnode aa23root[11];
366 #define aa23tsize 11
367 #define aa23p1 5
368 #define aa23p2 7
369 char
is(a0,a1,ptr)370 is(a0,a1,ptr)
371 char *a0;
372 struct dict *ptr;
373 {
374 return(aahash(a0,a1,aa23tsize,aa23p1,aa23p2,aa23root,ptr));
375 }
376 struct hnode aa24root[71];
377 #define aa24tsize 71
378 #define aa24p1 61
379 #define aa24p2 67
380 char
ish(a0,a1,ptr)381 ish(a0,a1,ptr)
382 char *a0;
383 struct dict *ptr;
384 {
385 return(aahash(a0,a1,aa24tsize,aa24p1,aa24p2,aa24root,ptr));
386 }
387 struct hnode aa25root[151];
388 #define aa25tsize 151
389 #define aa25p1 139
390 #define aa25p2 149
391 char
ist(a0,a1,ptr)392 ist(a0,a1,ptr)
393 char *a0;
394 struct dict *ptr;
395 {
396 return(aahash(a0,a1,aa25tsize,aa25p1,aa25p2,aa25root,ptr));
397 }
398 struct hnode aa26root[79];
399 #define aa26tsize 79
400 #define aa26p1 71
401 #define aa26p2 73
402 char
ite(a0,a1,ptr)403 ite(a0,a1,ptr)
404 char *a0;
405 struct dict *ptr;
406 {
407 return(aahash(a0,a1,aa26tsize,aa26p1,aa26p2,aa26root,ptr));
408 }
409 struct hnode aa28root[151];
410 #define aa28tsize 151
411 #define aa28p1 139
412 #define aa28p2 149
413 char
ive(a0,a1,ptr)414 ive(a0,a1,ptr)
415 char *a0;
416 struct dict *ptr;
417 {
418 return(aahash(a0,a1,aa28tsize,aa28p1,aa28p2,aa28root,ptr));
419 }
420 struct hnode aa29root[11];
421 #define aa29tsize 11
422 #define aa29p1 5
423 #define aa29p2 7
424 char
ize(a0,a1,ptr)425 ize(a0,a1,ptr)
426 char *a0;
427 struct dict *ptr;
428 {
429 return(aahash(a0,a1,aa29tsize,aa29p1,aa29p2,aa29root,ptr));
430 }
431 struct hnode aa30root[37];
432 #define aa30tsize 37
433 #define aa30p1 29
434 #define aa30p2 31
435 char
lar(a0,a1,ptr)436 lar(a0,a1,ptr)
437 char *a0;
438 struct dict *ptr;
439 {
440 return(aahash(a0,a1,aa30tsize,aa30p1,aa30p2,aa30root,ptr));
441 }
442 struct hnode aa31root[11];
443 #define aa31tsize 11
444 #define aa31p1 5
445 #define aa31p2 7
446 char
less(a0,a1,ptr)447 less(a0,a1,ptr)
448 char *a0;
449 struct dict *ptr;
450 {
451 return(aahash(a0,a1,aa31tsize,aa31p1,aa31p2,aa31root,ptr));
452 }
453 struct hnode aa33root[11];
454 #define aa33tsize 11
455 #define aa33p1 5
456 #define aa33p2 7
457 char
man(a0,a1,ptr)458 man(a0,a1,ptr)
459 char *a0;
460 struct dict *ptr;
461 {
462 return(aahash(a0,a1,aa33tsize,aa33p1,aa33p2,aa33root,ptr));
463 }
464 struct hnode aa34root[37];
465 #define aa34tsize 37
466 #define aa34p1 29
467 #define aa34p2 31
468 char
ment(a0,a1,ptr)469 ment(a0,a1,ptr)
470 char *a0;
471 struct dict *ptr;
472 {
473 return(aahash(a0,a1,aa34tsize,aa34p1,aa34p2,aa34root,ptr));
474 }
475 struct hnode aa35root[11];
476 #define aa35tsize 11
477 #define aa35p1 5
478 #define aa35p2 7
479 char
ness(a0,a1,ptr)480 ness(a0,a1,ptr)
481 char *a0;
482 struct dict *ptr;
483 {
484 return(aahash(a0,a1,aa35tsize,aa35p1,aa35p2,aa35root,ptr));
485 }
486 struct hnode aa37root[11];
487 #define aa37tsize 11
488 #define aa37p1 5
489 #define aa37p2 7
490 char
ous(a0,a1,ptr)491 ous(a0,a1,ptr)
492 char *a0;
493 struct dict *ptr;
494 {
495 return(aahash(a0,a1,aa37tsize,aa37p1,aa37p2,aa37root,ptr));
496 }
497 struct hnode aa39root[11];
498 #define aa39tsize 11
499 #define aa39p1 5
500 #define aa39p2 7
501 char
ship(a0,a1,ptr)502 ship(a0,a1,ptr)
503 char *a0;
504 struct dict *ptr;
505 {
506 return(aahash(a0,a1,aa39tsize,aa39p1,aa39p2,aa39root,ptr));
507 }
508 struct hnode aa40root[61];
509 #define aa40tsize 61
510 #define aa40p1 53
511 #define aa40p2 59
512 char
ss(a0,a1,ptr)513 ss(a0,a1,ptr)
514 char *a0;
515 struct dict *ptr;
516 {
517 return(aahash(a0,a1,aa40tsize,aa40p1,aa40p2,aa40root,ptr));
518 }
519 struct hnode aa42root[89];
520 #define aa42tsize 89
521 #define aa42p1 79
522 #define aa42p2 83
523 char
ure(a0,a1,ptr)524 ure(a0,a1,ptr)
525 char *a0;
526 struct dict *ptr;
527 {
528 return(aahash(a0,a1,aa42tsize,aa42p1,aa42p2,aa42root,ptr));
529 }
530 struct hnode aa43root[19];
531 #define aa43tsize 19
532 #define aa43p1 13
533 #define aa43p2 17
534 char
us(a0,a1,ptr)535 us(a0,a1,ptr)
536 char *a0;
537 struct dict *ptr;
538 {
539 return(aahash(a0,a1,aa43tsize,aa43p1,aa43p2,aa43root,ptr));
540 }
541 struct hnode aa44root[23];
542 #define aa44tsize 23
543 #define aa44p1 17
544 #define aa44p2 19
545 char
ing(a0,a1,ptr)546 ing(a0,a1,ptr)
547 char *a0;
548 struct dict *ptr;
549 {
550 return(aahash(a0,a1,aa44tsize,aa44p1,aa44p2,aa44root,ptr));
551 }
552 struct hnode aa45root[47];
553 #define aa45tsize 47
554 #define aa45p1 41
555 #define aa45p2 43
556 char
ed(a0,a1,ptr)557 ed(a0,a1,ptr)
558 char *a0;
559 struct dict *ptr;
560 {
561 return(aahash(a0,a1,aa45tsize,aa45p1,aa45p2,aa45root,ptr));
562 }
563