Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.17
 
1.18
 
MAIN:ragge:20021205200307
 
pftn.c
_>88 
 99 struct symtab *schain[MAXSCOPES];       /* sym chains for clearst */
 1010 int chaintop;                           /* highest active entry */
<> 11+static int strunem;                     /* currently parsed member */
1112 
 1213 struct instk {
 1314         int in_sz;   /* size of array element */
     
 !
413414         checkst(0);
 414415         retstat = 0;
 415416         tcheck();
<>416 -        curclass = SNULL;
417417         brklab = contlab = retlab = NOLAB;
 418418         flostat = 0;
 419419         if( nerrors == 0 ){
     
 !
521521 {
 522522         NODE *q;
 523523 
<>524 -        psave( instruct );
 525 -        psave( curclass );
 526 -        psave( strucoff );
  524+        psave(instruct);
  525+        psave(strunem);
  526+        psave(strucoff);
527527         strucoff = 0;
 528528         instruct = soru;
 529529         q = block( FREE, NIL, NIL, 0, 0, 0 );
 530530         q->tn.rval = idn;
 531531         if( instruct==INSTRUCT ){
<>532 -                curclass = MOS;
  532+                strunem = MOS;
533533                 q->in.type = STRTY;
 534534                 if( idn >= 0 ) defid( q, STNAME );
 535535                 }
 536536         else if( instruct == INUNION ) {
<>537 -                curclass = MOU;
  537+                strunem = MOU;
538538                 q->in.type = UNIONTY;
 539539                 if( idn >= 0 ) defid( q, UNAME );
 540540                 }
 541541         else { /* enum */
<>542 -                curclass = MOE;
  542+                strunem = MOE;
543543                 q->in.type = ENUMTY;
 544544                 if( idn >= 0 ) defid( q, ENAME );
 545545                 }
     
 !
549549         return( paramno-4 );
 550550 }
 551551 
<> 552+/*
  553+ * Called after a struct is declared to restore the environment.
  554+ */
552555 NODE *
 553556 dclstruct(int oparam)
 554557 {
     
 !
557560         TWORD temp;
 558561         int high, low;
 559562 
<>560 -        /* paramstk contains:
 561 -                paramstk[ oparam ] = previous instruct
 562 -                paramstk[ oparam+1 ] = previous class
 563 -                paramstk[ oparam+2 ] = previous strucoff
 564 -                paramstk[ oparam+3 ] = structure name
  563+        /*
  564+         * paramstk contains:
  565+         *      paramstk[oparam] = previous instruct
  566+         *      paramstk[oparam+1] = previous class
  567+         *      paramstk[oparam+2] = previous strucoff
  568+         *      paramstk[oparam+3] = structure name
  569+         *
  570+         *      paramstk[oparam+4, ...]  = member stab indices
  571+         */
565572 
<>566 -                paramstk[ oparam+4, ... ]  = member stab indices
567573 
<>568 -                */
 569 -
 570 -
 571 -        if( (i=paramstk[oparam+3]) < 0 ){
  574+        if ((i = paramstk[oparam+3]) < 0) {
572575                 szindex = curdim;
<>573 -                dstash( 0 );  /* size */
 574 -                dstash( -1 );  /* index to member names */
 575 -                dstash( ALSTRUCT );  /* alignment */
 576 -                dstash( -lineno );      /* name of structure */
 577 -                }
 578 -        else {
  576+                dstash(0);  /* size */
  577+                dstash(-1);  /* index to member names */
  578+                dstash(ALSTRUCT);  /* alignment */
  579+                dstash(-lineno);        /* name of structure */
  580+        } else
579581                 szindex = stab[i].sizoff;
<>580 -                }
581582 
 582583 # ifndef BUG1
<>583 -        if( ddebug ){
 584 -                printf( "dclstruct( %s ), szindex = %d\n", (i>=0)? stab[i].sname : "??", szindex );
 585 -                }
  584+        if (ddebug) {
  585+                printf("dclstruct( %s ), szindex = %d\n",
  586+                    (i>=0)? stab[i].sname : "??", szindex);
  587+        }
586588 # endif
 587589         temp = (instruct&INSTRUCT)?STRTY:((instruct&INUNION)?UNIONTY:ENUMTY);
<>588 -        stwart = instruct = paramstk[ oparam ];
 589 -        curclass = paramstk[ oparam+1 ];
 590 -        dimtab[ szindex+1 ] = curdim;
  590+        stwart = instruct = paramstk[oparam];
  591+        strunem = paramstk[oparam+1];
  592+        dimtab[szindex+1] = curdim;
591593         al = ALSTRUCT;
 592594 
 593595         high = low = 0;
     
 !
866868  * beginning of initilization; set location ctr and set type
 867869  */
 868870 void
<>869 -beginit(int curid)
  871+beginit(int curid, int class)
870872 {
 871873         struct symtab *p;
 872874 
     
 !
877879         p = &stab[curid];
 878880 
 879881         iclass = p->sclass;
<>880 -        if( curclass == EXTERN || curclass == FORTRAN ) iclass = EXTERN;
  882+        if( class == EXTERN || class == FORTRAN )
  883+                iclass = EXTERN;
881884         switch( iclass ){
 882885 
 883886         case UNAME:
     
 !
15141517 #endif
 15151518         {
 15161519                 /* simulate initialization by 0 */
<>1517 -                beginit(p->tn.rval);
  1520+                beginit(p->tn.rval, class);
15181521                 endinit();
 15191522         }
 15201523         if (commflag)
     
 !
16181621                 noun += (UNSIGNED-INT);
 16191622 
 16201623         p = block(TYPE, NIL, NIL, noun, 0, 0);
<> 1624+        if (strunem != 0)
  1625+                class = strunem;
16211626         p->in.su = class;
 16221627         return p;
 16231628 
     
 !
20242029                 }
 20252030         }
 20262031 
<>2027 -#ifndef checkst
 2028 -/* if not debugging, make checkst a macro */
 2029 -checkst(lev){
 2030 -        int s, i, j;
  2032+#ifdef PCC_DEBUG
  2033+/* if not debugging, checkst is a macro */
  2034+void
  2035+checkst(int lev)
  2036+{
  2037+#if 0
  2038+        int i, j;
20312039         struct symtab *p, *q;
 20322040 
<>2033 -        for( i=0, p=stab; i<SYMTSZ; ++i, ++p ){
 2034 -                if( p->stype == TNULL ) continue;
 2035 -                j = lookup( p->sname, p->sflags&(SMOS|STAG) );
 2036 -                if( j != i ){
  2041+        for (i=0, p=stab; i<SYMTSZ; ++i, ++p) {
  2042+                if (p->stype == TNULL)
  2043+                        continue;
  2044+                j = lookup(p->sname, p->sflags&(SMOS|STAG));
  2045+                if (j != i) {
20372046                         q = &stab[j];
<>2038 -                        if( q->stype == UNDEF ||
 2039 -                            q->slevel <= p->slevel ){
 2040 -                                cerror( "check error: %s", q->sname );
 2041 -                                }
 2042 -                        }
 2043 -                else if( p->slevel > lev ) cerror( "%s check at level %d", p->sname, lev );
 2044 -                }
  2047+                        if (q->stype == UNDEF || q->slevel <= p->slevel)
  2048+                                cerror("check error: %s", q->sname);
  2049+                } else if (p->slevel > lev)
  2050+                        cerror("%s check at level %d", p->sname, lev);
20452051         }
 20462052 #endif
<> 2053+}
  2054+#endif
<_20472055 
 20482056 /*
 20492057  * look up p again, and see where it lies
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-08-21 12:13 +0200