1: #ifndef lint
   2: static char nhash_sccsid[] = "@(#)nhash.c	4.2	(Berkeley)	82/11/06";
   3: #endif not lint
   4: 
   5: struct dict {
   6:     char *entry;
   7:     char val;
   8: };
   9: extern struct dict ary_d[], cy_d[], ery_d[], fy_d[],gy_d[];
  10: extern struct dict ity_d[],ly_d[],ory_d[],ry_d[],ty_d[];
  11: extern struct dict dict[];
  12: extern struct dict abbrev_d[];
  13: char aahash();
  14: char lookup();
  15: char abbrev();
  16: char ary();
  17: char cy();
  18: char ery();
  19: char fy();
  20: char gy();
  21: char ity();
  22: char ly();
  23: char ory();
  24: char ry();
  25: char ty();
  26: 
  27: struct hnode {
  28:     char *aakey;
  29:     struct dict *aadata;
  30: };
  31: char
  32: aahash(s,ex,aatsize,aapr1,aapr2,tbl,data)
  33: char *s;
  34: struct hnode tbl[];
  35: struct dict *data;
  36: {
  37:     char *cp;
  38:     int ii, key, c, p1, p2;
  39:     cp = s;
  40:     key =0;
  41:     while (c = *cp++)
  42:         key = key + (key<<5) + c;
  43:     key &= 077777;
  44:     p1 = key%aapr1;
  45:     p2 = key%aapr2;
  46:     if (p2==0) p2=17;
  47:     for(ii=0; ii<aatsize; ii++)
  48:     {
  49:         if (tbl[p1].aakey==0)
  50:         { /* new item */
  51:             if (ex ==0)
  52:             {
  53:                 tbl[p1].aakey = s;
  54:                 tbl[p1].aadata= data;
  55:                 return(tbl[p1].aadata->val);
  56:             }
  57:             else
  58:                 return(0);
  59:         }
  60:         else
  61:             if(strcmp(tbl[p1].aakey, s)== 0)
  62:             {
  63:                 return(tbl[p1].aadata->val);
  64:             }
  65:         p1 = (p1+p2)%aatsize;
  66:     }
  67:     fprintf(stderr, "hash table full:size %d\n",aatsize);
  68:     exit();
  69: }
  70: getd(){
  71:     struct dict *ptr;
  72:     ptr = dict;
  73:     while(ptr->entry != 0){
  74:         lookup(ptr->entry,0,ptr);
  75:         ptr++;
  76:     }
  77: }
  78: getab(){
  79:     struct dict *ptr;
  80:     ptr = abbrev_d;
  81:     while(ptr->entry != 0){
  82:         abbrev(ptr->entry,0,ptr);
  83:         ptr++;
  84:     }
  85: }
  86: 
  87: struct hnode aa1root[499];
  88: #define aa1tsize 499
  89: #define aa1p1 487
  90: #define aa1p2 491
  91: char
  92: lookup(a0,a1,ptr)
  93: char *a0;
  94: struct dict *ptr;
  95: {
  96:     return(aahash(a0,a1,aa1tsize,aa1p1,aa1p2,aa1root,ptr));
  97: }
  98: struct hnode aa6root[113];
  99: #define aa6tsize 113
 100: #define aa6p1 107
 101: #define aa6p2 109
 102: char
 103: ary(a0,a1,ptr)
 104:     char *a0;
 105:     struct dict *ptr;
 106: {
 107:     return(aahash(a0,a1,aa6tsize,aa6p1,aa6p2,aa6root,ptr));
 108: }
 109: struct hnode aa9root[13];
 110: #define aa9tsize 13
 111: #define aa9p1 7
 112: #define aa9p2 1
 113: char
 114: cy(a0,a1,ptr)
 115:     char *a0;
 116:     struct dict *ptr;
 117: {
 118:     return(aahash(a0,a1,aa9tsize,aa9p1,aa9p2,aa9root,ptr));
 119: }
 120: struct hnode aa12root[59];
 121: #define aa12tsize 59
 122: #define aa12p1 47
 123: #define aa12p2 43
 124: char
 125: ery(a0,a1,ptr)
 126:     char *a0;
 127:     struct dict *ptr;
 128: {
 129:     return(aahash(a0,a1,aa12tsize,aa12p1,aa12p2,aa12root,ptr));
 130: }
 131: struct hnode aa16root[23];
 132: #define aa16tsize 23
 133: #define aa16p1 17
 134: #define aa16p2 19
 135: char
 136: fy(a0,a1,ptr)
 137:     char *a0;
 138:     struct dict *ptr;
 139: {
 140:     return(aahash(a0,a1,aa16tsize,aa16p1,aa16p2,aa16root,ptr));
 141: }
 142: struct hnode aa17root[29];
 143: #define aa17tsize 29
 144: #define aa17p1 19
 145: #define aa17p2 23
 146: char
 147: gy(a0,a1,ptr)
 148:     char *a0;
 149:     struct dict *ptr;
 150: {
 151:     return(aahash(a0,a1,aa17tsize,aa17p1,aa17p2,aa17root,ptr));
 152: }
 153: struct hnode aa27root[11];
 154: #define aa27tsize 11
 155: #define aa27p1 5
 156: #define aa27p2 7
 157: char
 158: ity(a0,a1,ptr)
 159:     char *a0;
 160:     struct dict *ptr;
 161: {
 162:     return(aahash(a0,a1,aa27tsize,aa27p1,aa27p2,aa27root,ptr));
 163: }
 164: struct hnode aa32root[281];
 165: #define aa32tsize 281
 166: #define aa32p1 271
 167: #define aa32p2 277
 168: char
 169: ly(a0,a1,ptr)
 170:     char *a0;
 171:     struct dict *ptr;
 172: {
 173:     return(aahash(a0,a1,aa32tsize,aa32p1,aa32p2,aa32root,ptr));
 174: }
 175: struct hnode aa36root[59];
 176: #define aa36tsize 59
 177: #define aa36p1 47
 178: #define aa36p2 43
 179: char
 180: ory(a0,a1,ptr)
 181:     char *a0;
 182:     struct dict *ptr;
 183: {
 184:     return(aahash(a0,a1,aa36tsize,aa36p1,aa36p2,aa36root,ptr));
 185: }
 186: struct hnode aa38root[59];
 187: #define aa38tsize 59
 188: #define aa38p1 47
 189: #define aa38p2 53
 190: char
 191: ry(a0,a1,ptr)
 192:     char *a0;
 193:     struct dict *ptr;
 194: {
 195:     return(aahash(a0,a1,aa38tsize,aa38p1,aa38p2,aa38root,ptr));
 196: }
 197: struct hnode aa41root[127];
 198: #define aa41tsize 127
 199: #define aa41p1 109
 200: #define aa41p2 113
 201: char
 202: ty(a0,a1,ptr)
 203:     char *a0;
 204:     struct dict *ptr;
 205: {
 206:     return(aahash(a0,a1,aa41tsize,aa41p1,aa41p2,aa41root,ptr));
 207: }
 208: struct fandd {
 209:     char (*fun)();
 210:     struct dict *yd;
 211: } arr[] = {
 212:     ary,    ary_d,
 213:     cy, cy_d,
 214:     ery,    ery_d,
 215:     fy, fy_d,
 216:     gy, gy_d,
 217:     ity,    ity_d,
 218:     ly, ly_d,
 219:     ory,    ory_d,
 220:     ry, ry_d,
 221:     ty, ty_d,
 222:     0,  0
 223: };
 224: 
 225: ygetd(){
 226:     struct fandd *ptr;
 227:     struct dict *pp;
 228:     ptr=arr;
 229:     while(ptr->fun != 0){
 230:         pp = ptr->yd;
 231:         while(pp->entry != 0){
 232:             (*ptr->fun)(pp->entry,0,pp);
 233:             pp++;
 234:         }
 235:         ptr++;
 236:     }
 237: }
 238: struct hnode aa42root[71];
 239: #define aa42tsize 71
 240: #define aa42p1 61
 241: #define aa42p2 67
 242: char
 243: abbrev(a0,a1,ptr)
 244:     char *a0;
 245:     struct dict *ptr;
 246: {
 247:     return(aahash(a0,a1,aa42tsize,aa42p1,aa42p2,aa42root,ptr));
 248: }

Defined functions

aahash defined in line 31; used 13 times
abbrev defined in line 242; used 2 times
ary defined in line 102; used 2 times
cy defined in line 113; used 2 times
ery defined in line 124; used 2 times
fy defined in line 135; used 2 times
getab defined in line 78; never used
getd defined in line 70; never used
gy defined in line 146; used 2 times
ity defined in line 157; used 2 times
lookup defined in line 91; used 2 times
ly defined in line 168; used 2 times
ory defined in line 179; used 2 times
ry defined in line 190; used 2 times
ty defined in line 201; used 2 times
ygetd defined in line 225; never used

Defined variables

aa12root defined in line 120; used 1 times
aa16root defined in line 131; used 1 times
aa17root defined in line 142; used 1 times
aa1root defined in line 87; used 1 times
  • in line 96
aa27root defined in line 153; used 1 times
aa32root defined in line 164; used 1 times
aa36root defined in line 175; used 1 times
aa38root defined in line 186; used 1 times
aa41root defined in line 197; used 1 times
aa42root defined in line 238; used 1 times
aa6root defined in line 98; used 1 times
aa9root defined in line 109; used 1 times
arr defined in line 211; used 1 times
nhash_sccsid defined in line 2; never used

Defined struct's

dict defined in line 5; used 44 times
fandd defined in line 208; used 2 times
  • in line 226(2)
hnode defined in line 27; used 26 times

Defined macros

aa12p1 defined in line 122; used 1 times
aa12p2 defined in line 123; used 1 times
aa12tsize defined in line 121; used 1 times
aa16p1 defined in line 133; used 1 times
aa16p2 defined in line 134; used 1 times
aa16tsize defined in line 132; used 1 times
aa17p1 defined in line 144; used 1 times
aa17p2 defined in line 145; used 1 times
aa17tsize defined in line 143; used 1 times
aa1p1 defined in line 89; used 1 times
  • in line 96
aa1p2 defined in line 90; used 1 times
  • in line 96
aa1tsize defined in line 88; used 1 times
  • in line 96
aa27p1 defined in line 155; used 1 times
aa27p2 defined in line 156; used 1 times
aa27tsize defined in line 154; used 1 times
aa32p1 defined in line 166; used 1 times
aa32p2 defined in line 167; used 1 times
aa32tsize defined in line 165; used 1 times
aa36p1 defined in line 177; used 1 times
aa36p2 defined in line 178; used 1 times
aa36tsize defined in line 176; used 1 times
aa38p1 defined in line 188; used 1 times
aa38p2 defined in line 189; used 1 times
aa38tsize defined in line 187; used 1 times
aa41p1 defined in line 199; used 1 times
aa41p2 defined in line 200; used 1 times
aa41tsize defined in line 198; used 1 times
aa42p1 defined in line 240; used 1 times
aa42p2 defined in line 241; used 1 times
aa42tsize defined in line 239; used 1 times
aa6p1 defined in line 100; used 1 times
aa6p2 defined in line 101; used 1 times
aa6tsize defined in line 99; used 1 times
aa9p1 defined in line 111; used 1 times
aa9p2 defined in line 112; used 1 times
aa9tsize defined in line 110; used 1 times
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1701
Valid CSS Valid XHTML 1.0 Strict