Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.39
 
1.40
 
MAIN:ragge:20030607202603
 
pftn.c
_>469469         struct symtab *p;
 470470         NODE *q;
 471471 
<>472 -        p = (struct symtab *)lookup(tag, STAG);
  472+        p = (struct symtab *)lookup(tag, STAGNAME);
473473         switch (p->stype) {
 474474 
 475475         case UNDEF:
     
 !
521521         NODE *q;
 522522 
 523523         if (name != NULL)
<>524 -                s = lookup(name, STAG);
  524+                s = lookup(name, STAGNAME);
525525         else
 526526                 s = NULL;
 527527 
     
 !
20512051         return 0; /* XXX */
 20522052 }
 20532053 
<>2054 -#define MAXLABELS       100     /* per function */
 2055 -static int labelno[MAXLABELS];
 2056 -static char *labelname[MAXLABELS];
 2057 -static int nlabels;
 2058 -
 2059 -static int
 2060 -lentry(char *name)
 2061 -{
 2062 -        int l;
 2063 -
 2064 -        for (l = 0; l < nlabels; l++)
 2065 -                if (labelname[l] == name)
 2066 -                        break;
 2067 -
 2068 -        if (l == nlabels) {
 2069 -                if (nlabels == MAXLABELS) {
 2070 -                        uerror("too many labels");
 2071 -                        nlabels = 0;
 2072 -                        return 0;
 2073 -                }
 2074 -                labelno[nlabels] = -getlab();
 2075 -                labelname[nlabels] = name;
 2076 -                l = nlabels++;
 2077 -        }
 2078 -        return l;
 2079 -}
 2080 -
20812054 /*
 20822055  * Generates a goto statement; sets up label number etc.
 20832056  */
 20842057 void
 20852058 gotolabel(char *name)
 20862059 {
<>2087 -        int l = lentry(name);
 2088 -        branch(labelno[l] < 0 ? -labelno[l] : labelno[l]);
  2060+        struct symtab *s = lookup(name, SLBLNAME);
  2061+
  2062+        if (s->soffset == 0)
  2063+                s->soffset = -getlab();
  2064+        branch(s->soffset < 0 ? -s->soffset : s->soffset);
20892065 }
 20902066 
 20912067 /*
     
 !
20942070 void
 20952071 deflabel(char *name)
 20962072 {
<>2097 -        int l = lentry(name);
  2073+        struct symtab *s = lookup(name, SLBLNAME);
20982074 
<>2099 -        if (labelno[l] > 0)
 2100 -                uerror("label '%s' redefined", labelname[l]);
 2101 -        labelno[l] = -labelno[l];
  2075+        if (s->soffset > 0)
  2076+                uerror("label '%s' redefined", name);
  2077+        if (s->soffset == 0)
  2078+                s->soffset = getlab();
  2079+        if (s->soffset < 0)
  2080+                s->soffset = -s->soffset;
21022081         locctr(PROG);
<>2103 -        deflab(labelno[l]);
  2082+        deflab(s->soffset);
21042083 }
 21052084 
 21062085 /*
<>2107 - * look up name: must agree with s w.r.t. STAG and SHIDDEN
  2086+ * look up name: must agree with s w.r.t. STAGNAME and SHIDDEN
21082087  */
 21092088 struct symtab *
 21102089 lookup(char *name, int s)
     
 !
21202099                     name, s, instruct);
 21212100 # endif
 21222101 
<>2123 -        if (s == STAG)
 2124 -                return symbol_add(name);
  2102+        if (s == STAGNAME || s == SLBLNAME)
  2103+                return symbol_add(name, s);
21252104 
<>2126 -        if (s != 0 && s != SNOCREAT)
 2127 -                cerror("lookup s %o", s);
 2128 -
21292105         i = (int)name;
 21302106         i = i%SYMTSZ;
 21312107         sp = &stab[ii=i];
     
 !
21362112                         if (s & SNOCREAT)
 21372113                                 return NULL;
 21382114 //printf("creating %s (%d)\n", name, sp - stab);
<>2139 -                        sp->sflags = s/* set STAG if needed, turn off all others */
  2115+                        sp->sflags = 0;
21402116                         sp->sname = name;
 21412117                         sp->stype = UNDEF;
 21422118                         sp->sclass = SNULL;
 21432119                         sp->s_argn = 0;
 21442120                         return sp;
 21452121                 }
<>2146 -                if ((sp->sflags & (STAG|SHIDDEN)) != (s & ~SNOCREAT))
  2122+                if ((sp->sflags & SHIDDEN) != (s & ~SNOCREAT))
21472123                         goto next;
 21482124                 p = sp->sname;
 21492125                 q = name;
     
 !
21722148         for (i=0, p=stab; i<SYMTSZ; ++i, ++p) {
 21732149                 if (p->stype == TNULL)
 21742150                         continue;
<>2175 -                j = lookup(p->sname, p->sflags&STAG);
  2151+                j = lookup(p->sname, 0);
21762152                 if (j != i) {
 21772153                         q = &stab[j];
 21782154                         if (q->stype == UNDEF || q->slevel <= p->slevel)
     
 !
21922168 {
 21932169         struct symtab *q;
 21942170 
<>2195 -        q = lookup(p->sname, p->sflags&(STAG|SHIDDEN));
  2171+        q = lookup(p->sname, p->sflags&SHIDDEN);
21962172         /* make relook always point to either p or an empty cell */
 21972173         if (q->stype == UNDEF) {
 21982174                 q->stype = TNULL;
     
 !
22112187 clearst(int lev)
 22122188 {
 22132189         struct symtab *p, *q;
<>2214 -        int i, temp;
  2190+        int temp;
22152191         struct symtab *clist = 0;
 22162192 
 22172193         temp = lineno;
     
 !
22722248                         }
 22732249                 p = next;
 22742250                 }
<>2275 -        /* step 3: check for undefined labels and reset label stack */
 2276 -        if (lev == 0) {
 2277 -                for (i = 0; i < nlabels; i++)
 2278 -                        if (labelno[i] < 0)
 2279 -                                uerror("label '%s' not defined", labelname[i]);
 2280 -                nlabels = 0;
 2281 -        }
22822251 
<> 2252+        symclear(lev); /* Clean ut the symbol table */
  2253+
22832254         lineno = temp;
 22842255         aoend();
 22852256 }
     
 !
23032274         }
 23042275         *q = *p;
 23052276         p->sflags |= SHIDDEN;
<>2306 -        q->sflags = (p->sflags&STAG) | SHIDES;
  2277+        q->sflags = SHIDES;
23072278 #if 0
 23082279         if (p->slevel > 0)
 23092280                 werror("%s redefinition hides earlier one", p->sname);
     
 !
23212292         struct symtab *q;
 23222293         int s;
 23232294 
<>2324 -        s = p->sflags & STAG;
  2295+        s = 0;
23252296         q = p;
 23262297 
 23272298         for(;;){
     
 !
23312302 
 23322303                 if( q == p ) break;
 23332304 
<>2334 -                if( (q->sflags&STAG) == s ){
  2305+                if (0 == s) {
23352306                         if (p->sname == q->sname) {
 23362307                                 q->sflags &= ~SHIDDEN;
 23372308 # ifndef BUG1
     
 !
23502321 {
 23512322         struct symtab *s;
 23522323 
<>2353 -        s = permalloc(sizeof(struct symtab));
  2324+        if (flags == SLBLNAME)
  2325+                s = tmpalloc(sizeof(struct symtab));
  2326+        else
  2327+                s = permalloc(sizeof(struct symtab));
<_23542328         s->sname = name;
 23552329         s->snext = NULL;
 23562330         s->stype = UNDEF;
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-15 06:04 +0200