7 static char *
rcsid=
"@(#)$Id$";
15 {
register int i,
l,hash;
20 for (i=0; i<
l; i++) hash+=(hash<<2)+
id[i];
21 return(hash & 0x1fffffff);}
28 register int i,size,hash=
l,flag=0;
29 for (i=0; i<
l; i++) hash+=(hash<<2)+
id[i];
32 if (size==0)
return(
NULL);
35 sym = symvec->
c.
vec.
v[hash];
38 if (strlength(pnam)==l &&
39 !memcmp((
char *)pnam->
c.
str.
chars, (
char *)
id, l)) {
40 *hashval=hash;
return(sym);}}
42 if (flag==0) *hashval=hash;
44 if (sym==
makeint(1) && flag==0) { flag=1; *hashval=hash;}
45 if (++hash>=size) hash=0;}
50 {
register pointer newsymvec,sym;
52 register int i,newsize,size,hash;
54 bp=bpointerof(symvec);
61 for (i=0; i<newsize; i++) newsymvec->
c.
vec.
v[i]=
makeint(0);
62 for (i=0; i<size; i++) {
63 sym=symvec->
c.
vec.
v[i];
67 if (++hash>=newsize) hash=0;}
68 pointer_update(newsymvec->
c.
vec.
v[hash],sym);}}
77 register int size, newsymcount;
85 while (usedby && iscons(usedbylist)) {
86 usedby=ccar(usedbylist);
87 usedbylist=ccdr(usedbylist);
94 if (symvec->
c.
vec.
v[hash]==sym)
return(sym);
95 if (isint(symvec->
c.
vec.
v[hash])) {
96 pointer_update(symvec->
c.
vec.
v[hash],sym);
97 newsymcount=
intval(pkg->c.pkg.symcount)+1;
98 pkg->c.pkg.symcount=
makeint(newsymcount);
99 if (newsymcount > (size / 2))
100 pointer_update(pkg->c.pkg.symvector,
extendsymvec(symvec));
102 else if (++hash>=size) hash=0;}
110 {
register pointer sym,symvec,newsym,uselist,use;
116 while (islist(uselist)) {
118 uselist=ccdr(uselist);
122 size=vecsize(symvec);
125 while (issymbol(symvec->
c.
vec.
v[hash]))
if (++hash>=size) hash=0;
126 pointer_update(symvec->
c.
vec.
v[hash],newsym);
pointer makesymbol(context *, char *, int, pointer)
pointer findsymbol(byte *id, int l, pointer symvec, int *hashval)
pointer intern(context *ctx, char *id, int l, pointer pkg)
pointer makevector(pointer, int)
static pointer extendsymvec(pointer symvec)
long buddysize[MAXBUDDY+1]
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
pointer export(pointer sym, pointer pkg)