Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.31
 
1.32
 
MAIN:ragge:20030531184306
 
pftn.c
_>4545 
 4646 int ddebug = 0;
 4747 
<> 48+/* XXX - temporary while removing symtab array */
  49+#define MAXTAGS 1000
  50+struct symtab *strtags[MAXTAGS];
  51+int curtag;
  52+struct symtab * gettag(char *name);
  53+
  54+struct symtab *
  55+gettag(char *name)
  56+{
  57+        int i;
  58+
  59+        for (i = 0; i < curtag; i++)
  60+                if (strtags[i]->sname == name)
  61+                        return strtags[i];
  62+        if (curtag == MAXTAGS)
  63+                cerror("too many tags (%d)", curtag);
  64+        strtags[curtag++] = calloc(sizeof(struct symtab), 1);
  65+        strtags[i]->sname = name;
  66+        strtags[i]->stype = UNDEF;
  67+        strtags[i]->sclass = SNULL;
  68+        strtags[i]->s_argn = 0;
  69+        return strtags[i];
  70+}
  71+/* end temporary */
  72+
4873 void
 4974 defid(NODE *q, int class)
 5075 {
     
 !
5782         int slev, temp;
 5883         int changed;
 5984 
<>60 -        if( q == NIL ) return/* an error was detected */
  85+        if (q == NIL)
  86+                return/* an error was detected */
6187 
<>62 -        if( q < node || q >= &node[TREESZ] ) cerror( "defid call" );
  88+        if (q < node || q >= &node[TREESZ])
  89+                cerror("defid call");
6390 
 6491         idp = q->n_rval;
 6592 
<>66 -        if( idp < 0 ) cerror( "tyreduce" );
 67 -        p = &stab[idp];
  93+        if (idp < 0)
  94+                cerror("tyreduce");
6895 
<> 96+        if (idp > 20000) {
  97+                p = (struct symtab *)idp;
  98+        } else
  99+                p = &stab[idp];
  100+
69101 # ifndef BUG1
 70102         if (ddebug) {
 71103                 printf("defid(%s (%d), ", p->sname, idp);
     
 !
257289                 int *memp;
 258290                 p->sflags |= SNONUNIQ/* old entry is nonunique */
 259291                 /* determine if name has occurred in this structure/union */
<>260 -                if (paramno > 0) for( memp = &paramstk[paramno-1];
 261 -                        /* while */ *memp>=0 && stab[*memp].sclass != STNAME
 262 -                                && stab[*memp].sclass != UNAME;
 263 -                        /* iterate */ --memp){ char *cname, *oname;
 264 -                        if( stab[*memp].sflags & SNONUNIQ ){
 265 -                                cname=p->sname;
 266 -                                oname=stab[*memp].sname;
 267 -                                if (cname != oname) goto diff;
 268 -                                uerror("redeclaration of: %s",p->sname);
 269 -                                break;
 270 -                                diff: continue;
  292+                if (paramno > 0) {
  293+                        memp = &paramstk[paramno-1];
  294+                        for (; *memp>=0; --memp) {
  295+                                char *cname, *oname;
  296+                                struct symtab *w;
  297+
  298+                                if (*memp > 20000)
  299+                                        w = (struct symtab *)*memp;
  300+                                else
  301+                                        w = &stab[*memp];
  302+                                if (w->sclass != STNAME && w->sclass != UNAME)
  303+                                        break;
  304+
  305+                                if (w->sflags & SNONUNIQ ){
  306+                                        cname=p->sname;
  307+                                        oname=w->sname;
  308+                                        if (cname != oname) goto diff;
  309+                                        uerror("redeclaration of: %s",p->sname);
  310+                                        break;
  311+                                        diff: continue;
271312                                 }
 272313                         }
<> 314+                }
273315                 p = mknonuniq( &idp ); /* update p and idp to new entry */
 274316                 goto enter;
 275317                 }
     
 !
299341                 dstash( 0 );  /* size */
 300342                 dstash( -1 ); /* index to members of str or union */
 301343                 dstash( ALSTRUCT );  /* alignment */
<>302 -                dstash( idp );
  344+                dstash((int)p); /* dstash( idp ); XXX */
303345                 }
 304346         else {
 305347                 switch( BTYPE(type) ){
     
 !
468510 {
 469511         struct symtab *p;
 470512         NODE *q;
<>471 -        p = &stab[idn];
  513+        p = (struct symtab *)idn;
  514+
472515         switch (p->stype) {
 473516 
 474517         case UNDEF:
 475518         def:
 476519                 q = block(FREE, NIL, NIL, 0, 0, 0);
<>477 -                q->n_rval = idn;
  520+                q->n_rval = (int)p;
478521                 q->n_type = (soru&INSTRUCT) ? STRTY :
 479522                     ((soru&INUNION) ? UNIONTY : ENUMTY);
 480523                 defid(q, (soru&INSTRUCT) ? STNAME :
     
 !
545588         psave(idn = q->n_rval);
 546589         /* the "real" definition is where the members are seen */
 547590         if (idn >= 0)
<> 591+#if 0
548592                 stab[idn].suse = lineno;
<> 593+#else
  594+                ((struct symtab *)idn)->suse = lineno;
  595+#endif
549596         return(paramno-4);
 550597 }
 551598 
     
 !
578625                 dstash(ALSTRUCT);  /* alignment */
 579626                 dstash(-lineno);        /* name of structure */
 580627         } else
<> 628+#if 0
581629                 szindex = stab[i].sizoff;
<> 630+#else
  631+                szindex = ((struct symtab *)i)->sizoff;
  632+#endif
582633 
 583634 # ifndef BUG1
 584635         if (ddebug) {
 585636                 printf("dclstruct( %s ), szindex = %d\n",
<>586 -                    (i>=0)? stab[i].sname : "??", szindex);
  637+                    (i>=0)? ((struct symtab *)i)->sname : "??", szindex);
587638         }
 588639 # endif
 589640         temp = (instruct&INSTRUCT)?STRTY:((instruct&INUNION)?UNIONTY:ENUMTY);
     
 !
16821733                 endinit();
 16831734         }
 16841735         if (commflag)
<>1685 -                commdec(p->n_rval);
  1736+                commdec(p->n_rval > 20000 ? (struct symtab *)p->n_rval : &stab[p->n_rval]);
16861737 }
 16871738 
 16881739 /*
     
 !
21562207                 }
 21572208 # endif
 21582209 
<> 2210+        if (s == STAG)
  2211+                return (int)gettag(name);
  2212+
<_21592213         i = 0;
 21602214         i = (int)name;
 21612215         i = i%SYMTSZ;
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-01 23:03 +0200