# 2.11BSD#431 - /usr/src/usr.bin/diction/nhash.c

##### Functions

    aahash            X
    abbrev            X
    ary               X
    cy                X
    ery               X
    fy                X
    getab             X
    getd              X
    gy                X
    ity               X
    lookup            X
    ly                X
    ory               X
    ry                X
    ty                X
    ygetd             X

##### Variables

    aa12root          X
    aa16root          X
    aa17root          X
    aa1root           X
    aa27root          X
    aa32root          X
    aa36root          X
    aa38root          X
    aa41root          X
    aa42root          X
    aa6root           X
    aa9root           X
    arr               X

##### Macros

    aa12p1            X
    aa12p2            X
    aa12tsize         X
    aa16p1            X
    aa16p2            X
    aa16tsize         X
    aa17p1            X
    aa17p2            X
    aa17tsize         X
    aa1p1             X
    aa1p2             X
    aa1tsize          X
    aa27p1            X
    aa27p2            X
    aa27tsize         X
    aa32p1            X
    aa32p2            X
    aa32tsize         X
    aa36p1            X
    aa36p2            X
    aa36tsize         X
    aa38p1            X
    aa38p2            X
    aa38tsize         X
    aa41p1            X
    aa41p2            X
    aa41tsize         X
    aa42p1            X
    aa42p2            X
    aa42tsize         X
    aa6p1             X
    aa6p2             X
    aa6tsize          X
    aa9p1             X
    aa9p2             X
    aa9tsize          X

##### struct's

    dict              X
    fandd             X
    hnode             X

       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

- in line 13, 96, 107, 118, 129, 140, 151, 162, 173, 184, 195, 206, 247

abbrev defined in line 242; used 2 times

- in line 15, 82

ary defined in line 102; used 2 times

- in line 16, 212

cy defined in line 113; used 2 times

- in line 17, 213

ery defined in line 124; used 2 times

- in line 18, 214

fy defined in line 135; used 2 times

- in line 19, 215

getab defined in line 78; never used
getd defined in line 70; never used
gy defined in line 146; used 2 times

- in line 20, 216

ity defined in line 157; used 2 times

- in line 21, 217

lookup defined in line 91; used 2 times

- in line 14, 74

ly defined in line 168; used 2 times

- in line 22, 218

ory defined in line 179; used 2 times

- in line 23, 219

ry defined in line 190; used 2 times

- in line 24, 220

ty defined in line 201; used 2 times

- in line 25, 221

ygetd defined in line 225; never used

#### Defined variables

aa12root defined in line 120; used 1 times

- in line 129

aa16root defined in line 131; used 1 times

- in line 140

aa17root defined in line 142; used 1 times

- in line 151

aa1root defined in line 87; used 1 times

- in line 96

aa27root defined in line 153; used 1 times

- in line 162

aa32root defined in line 164; used 1 times

- in line 173

aa36root defined in line 175; used 1 times

- in line 184

aa38root defined in line 186; used 1 times

- in line 195

aa41root defined in line 197; used 1 times

- in line 206

aa42root defined in line 238; used 1 times

- in line 247

aa6root defined in line 98; used 1 times

- in line 107

aa9root defined in line 109; used 1 times

- in line 118

arr defined in line 211; used 1 times

- in line 228

nhash_sccsid defined in line 2; never used

#### Defined struct's

dict defined in line 5; used 44 times

- in line 9-12(8), 29(2), 35(2), 71(2), 79(2), 94(2), 105(2), 116(2), 127(2), 138(2), 149(2), 160(2), 171(2), 182(2), 193(2), 204(2), 210(2), 227(2), 245(2)

fandd defined in line 208; used 2 times

- in line 226(2)

hnode defined in line 27; used 26 times

- in line 34(2), 87(2), 98(2), 109(2), 120(2), 131(2), 142(2), 153(2), 164(2), 175(2), 186(2), 197(2), 238(2)

#### Defined macros

aa12p1 defined in line 122; used 1 times

- in line 129

aa12p2 defined in line 123; used 1 times

- in line 129

aa12tsize defined in line 121; used 1 times

- in line 129

aa16p1 defined in line 133; used 1 times

- in line 140

aa16p2 defined in line 134; used 1 times

- in line 140

aa16tsize defined in line 132; used 1 times

- in line 140

aa17p1 defined in line 144; used 1 times

- in line 151

aa17p2 defined in line 145; used 1 times

- in line 151

aa17tsize defined in line 143; used 1 times

- in line 151

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

- in line 162

aa27p2 defined in line 156; used 1 times

- in line 162

aa27tsize defined in line 154; used 1 times

- in line 162

aa32p1 defined in line 166; used 1 times

- in line 173

aa32p2 defined in line 167; used 1 times

- in line 173

aa32tsize defined in line 165; used 1 times

- in line 173

aa36p1 defined in line 177; used 1 times

- in line 184

aa36p2 defined in line 178; used 1 times

- in line 184

aa36tsize defined in line 176; used 1 times

- in line 184

aa38p1 defined in line 188; used 1 times

- in line 195

aa38p2 defined in line 189; used 1 times

- in line 195

aa38tsize defined in line 187; used 1 times

- in line 195

aa41p1 defined in line 199; used 1 times

- in line 206

aa41p2 defined in line 200; used 1 times

- in line 206

aa41tsize defined in line 198; used 1 times

- in line 206

aa42p1 defined in line 240; used 1 times

- in line 247

aa42p2 defined in line 241; used 1 times

- in line 247

aa42tsize defined in line 239; used 1 times

- in line 247

aa6p1 defined in line 100; used 1 times

- in line 107

aa6p2 defined in line 101; used 1 times

- in line 107

aa6tsize defined in line 99; used 1 times

- in line 107

aa9p1 defined in line 111; used 1 times

- in line 118

aa9p2 defined in line 112; used 1 times

- in line 118

aa9tsize defined in line 110; used 1 times

- in line 118

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1739 |