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