version 1.18, 1999/11/17 15:34:13 |
version 1.19, 1999/11/20 17:48:59 |
|
|
char *name = tp; |
char *name = tp; |
char *etp = tp+MAXTOK; |
char *etp = tp+MAXTOK; |
ndptr p; |
ndptr p; |
unsigned long h = 0; |
unsigned h = 0; |
|
|
while ((isalnum(c = gpbc()) || c == '_') && tp < etp) |
while ((isalnum(c = gpbc()) || c == '_') && tp < etp) |
h = (h << 5) + h + (*tp++ = c); |
h = (h << 5) + h + (*tp++ = c); |
|
|
|
|
*tp = EOS; |
*tp = EOS; |
|
|
for (p = hashtab[h%HASHSIZE]; p != nil; p = p->nxtptr) |
for (p = hashtab[h % HASHSIZE]; p != nil; p = p->nxtptr) |
if (STREQ(name, p->name)) |
if (h == p->hv && STREQ(name, p->name)) |
break; |
break; |
return p; |
return p; |
} |
} |
|
|
initkwds() |
initkwds() |
{ |
{ |
size_t i; |
size_t i; |
int h; |
unsigned h; |
ndptr p; |
ndptr p; |
|
|
for (i = 0; i < MAXKEYS; i++) { |
for (i = 0; i < MAXKEYS; i++) { |
h = hash(keywrds[i].knam); |
h = hash(keywrds[i].knam); |
p = (ndptr) xalloc(sizeof(struct ndblock)); |
p = (ndptr) xalloc(sizeof(struct ndblock)); |
p->nxtptr = hashtab[h]; |
p->nxtptr = hashtab[h % HASHSIZE]; |
hashtab[h] = p; |
hashtab[h % HASHSIZE] = p; |
p->name = keywrds[i].knam; |
p->name = keywrds[i].knam; |
p->defn = null; |
p->defn = null; |
|
p->hv = h; |
p->type = keywrds[i].ktyp | STATIC; |
p->type = keywrds[i].ktyp | STATIC; |
} |
} |
} |
} |