/* * table look-up for linker v 1.2 */#include "clinkg"resolve()$(int i,j,k,m;char *addr,used;for(i=0;i<sptr;++i)$(if(type[i]==external)$(j=stab+i*symsiz;if((k=lookup(j))>=0)vtab[slink[i]]=vtab[slink[k]];else$(error("never defined:");pl(j);$)$)$)$)/* look for global n */lookup(n)char *n;$(int i,j;for(i=0;i<sptr;)$(j=tlookup(n,stab+i*symsiz,symsiz,sptr-i);if(j<0)return -1; /* not found */i+=j;if(type[i]==global)return i;else ++i; /* if not, skip it */$)return -1;$)streq(a,b)char *a,*b;$(return tlookup(a,b,255,1)==0;$)/* table look-up * look for the first occurence of * string a in table of strings b, * where each entry is of length w, * and there are 0..max-1 entries. * Returns 0..max-1 (index of match) * or -1 if not found. */tlookup(a,b,wid,max)char *a,*b,wid;int max;asm 0x600;