Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.45
 
1.46
 
MAIN:ragge:20030610102037
 
pftn.c
_>1212 struct symtab *cftnsp;
 1313 static int strunem;                     /* currently parsed member */
 1414 
<> 15+struct params;
  16+
1517 /*
 1618  * Linked list stack while reading in structs.
 1719  */
     
 !
2022         int     rinstruct;
 2123         int     rclass;
 2224         int     rstrucoff;
<>23 -        int     rparamno;
  25+        struct  params *rlparam;
2426         struct  symtab *rsym;
 2527 };
 2628 
 2729 /*
 2830  * Linked list for parameter declaration.
 2931  */
 3032 static struct params {
<>31 -        struct params *next;
  33+        struct params *next, *prev;
3234         struct symtab *sym;
<>33 -} *parampole;
  35+} *parampole, *lpole, *lparam;
3436 static int nparams;
 3537 
 3638 /*
     
 !
5759 void fixtype(NODE *p, int class);
 5860 int fixclass(int class, TWORD type);
 5961 int falloc(struct symtab *p, int w, int new, NODE *pty);
<>60 -void psave(int);
6162 int oalloc(struct symtab *p, int *poff);
 6263 static void dynalloc(struct symtab *p, int *poff);
 6364 void inforce(OFFSZ n);
 6465 void vfdalign(int n);
 6566 static void instk(struct symtab *p, TWORD t, int d, struct suedef *, OFFSZ off);
 6667 void gotscal(void);
<> 68+static void ssave(struct symtab *);
6769 
 6870 int ddebug = 0;
 6971 
     
 !
183185                 /* redefinition */
 184186                 if (!falloc(p, class&FLDSIZ, 1, NIL)) {
 185187                         /* successful allocation */
<>186 -                        psave((int)p); /* XXX cast */
  188+                        ssave(p);
187189                         return;
 188190                 }
 189191                 /* blew it: resume at end of switch... */
     
 !
243245                                 break;
 244246                         if (class == MOU)
 245247                                 strucoff = 0;
<>246 -                        psave((int)p); /* XXX cast */
  248+                        ssave(p);
247249                         return;
 248250                 }
 249251                 break;
     
 !
331333         /* allocate offsets */
 332334         if (class&FIELD) {
 333335                 (void) falloc(p, class&FLDSIZ, 0, NIL);  /* new entry */
<>334 -                psave((int)p); /* XXX cast */
  336+                ssave(p);
335337         } else switch (class) {
 336338 
 337339         case AUTO:
     
 !
359361         case MOS:
 360362                 (void) oalloc( p, &strucoff );
 361363                 if( class == MOU ) strucoff = 0;
<>362 -                psave((int)p); /* XXX cast */
  364+                ssave(p);
363365                 break;
 364366 
 365367         case MOE:
 366368                 p->soffset = strucoff++;
<>367 -                psave((int)p); /* XXX cast */
  369+                ssave(p);
368370                 break;
 369371         case REGISTER:
 370372                 p->soffset = regvar--;
     
 !
390392 }
 391393 
 392394 void
<>393 -psave(int i)
  395+ssave(struct symtab *sym)
394396 {
<>395 -        if( paramno >= PARAMSZ ){
 396 -                cerror( "parameter stack overflow");
  397+        struct params *p;
  398+
  399+        p = tmpalloc(sizeof(struct params));
  400+        p->next = NULL;
  401+        p->sym = sym;
  402+
  403+        if (lparam == NULL) {
  404+                p->prev = (struct params *)&lpole;
  405+                lpole = p;
  406+        } else {
  407+                lparam->next = p;
  408+                p->prev = lparam;
397409         }
<>398 -        paramstk[ paramno++ ] = i;
  410+        lparam = p;
399411 }
 400412 
 401413 /*
     
 !
414426         flostat = 0;
 415427         if( nerrors == 0 ){
 416428                 if( psavbc != & asavbc[0] ) cerror("bcsave error");
<>417 -                if( paramno != 0 ) cerror("parameter reset error");
  429+                if (lparam != NULL)
  430+                        cerror("parameter reset error");
418431                 if( swx != 0 ) cerror( "switch error");
<>419 -                }
  432+        }
420433         psavbc = &asavbc[0];
<>421 -        paramno = 0;
  434+        lparam = NULL;
422435         autooff = AUTOINIT;
 423436         minrvar = regvar = MAXRVAR;
 424437         reached = 1;
     
 !
566579                         defid(q, ENAME);
 567580         }
 568581         r->rsym = q->n_sp;
<>569 -        r->rparamno = paramno;
  582+        r->rlparam = lparam;
570583 
 571584         /* the "real" definition is where the members are seen */
 572585         if (s != NULL)
     
 !
581594 dclstruct(struct rstack *r)
 582595 {
 583596         NODE *n;
<> 597+        struct params *l;
584598         struct suedef *sue;
 585599         struct symtab *p;
<>586 -        int i, al, sa, j, sz;
  600+        int al, sa, sz;
587601         TWORD temp;
 588602         int high, low;
 589603 
 590604         if (r->rsym == NULL) {
 591605                 sue = permalloc(sizeof(struct suedef));
 592606                 sue->suesize = 0;
<>593 -                sue->suelem = NULL;
594607                 sue->suealign = ALSTRUCT;
 595608         } else
 596609                 sue = r->rsym->ssue;
 597610 
 598611 #ifdef PCC_DEBUG
 599612         if (ddebug)
<>600 -                printf("dclstruct( %s )\n", r->rsym ? r->rsym->sname : "??");
  613+                printf("dclstruct(%s)\n", r->rsym ? r->rsym->sname : "??");
601614 #endif
 602615         temp = (instruct&INSTRUCT)?STRTY:((instruct&INUNION)?UNIONTY:ENUMTY);
 603616         instruct = r->rinstruct;
     
 !
607620 
 608621         high = low = 0;
 609622 
<>610 -        for (i = r->rparamno; i < paramno; ++i) {
 611 -                dstash(j = paramstk[i]);
 612 -                if (j == 0)
  623+        if ((l = r->rlparam) == NULL)
  624+                l = lpole;
  625+        else
  626+                l = l->next;
  627+
  628+        for (; l != NULL; l = l->next) {
  629+                dstash((int)(p = l->sym)); /* XXX cast */
  630+                if (p == NULL)
613631                         cerror("gummy structure member");
<>614 -                p = (struct symtab *)j; /* XXX - cast */
 615 -                if( temp == ENUMTY ){
 616 -                        if( p->soffset < low ) low = p->soffset;
 617 -                        if( p->soffset > high ) high = p->soffset;
  632+                if (temp == ENUMTY) {
  633+                        if (p->soffset < low)
  634+                                low = p->soffset;
  635+                        if (p->soffset > high)
  636+                                high = p->soffset;
618637                         p->ssue = sue;
 619638                         continue;
<>620 -                        }
  639+                }
621640                 sa = talign(p->stype, p->ssue);
 622641                 if (p->sclass & FIELD) {
 623642                         sz = p->sclass&FLDSIZ;
     
 !
633652                 SETOFF(al, sa);
 634653         }
 635654         dstash(0);  /* endmarker XXX cast */
<>636 -        SETOFF( strucoff, al );
  655+        SETOFF(strucoff, al);
637656 
 638657         if (temp == ENUMTY) {
 639658                 TWORD ty;
     
 !
656675         sue->suealign = al;
 657676 
 658677 //      FIXSTRUCT(szindex, oparam); /* local hook, eg. for sym debugger */
<>659 -#if 0
  678+#ifdef PCC_DEBUG
660679         if (ddebug>1) {
<>661 -                printf("\tdimtab[%d,%d,%d] = %d,%d,%d\n",
 662 -                    szindex,szindex+1,szindex+2,
 663 -                    dimtab[szindex],dimtab[szindex+1],dimtab[szindex+2] );
 664 -                for (i = dimtab[szindex+1]; dimtab[i] >= 0; ++i) {
 665 -                        printf("\tmember %s(%d)\n",
  680+                int i = ((int *)sue->suelem) - dimtab;
  681+                printf("\tsize %d align %d elem %p\n",
  682+                    sue->suesize, sue->suealign, sue->suelem);
  683+                for (; dimtab[i] != 0; ++i) {
  684+                        printf("\tmember %s(0x%x)\n",
666685                             ((struct symtab *)dimtab[i])->sname, dimtab[i]);
 667686                 }
 668687         }
 669688 #endif
 670689 
 671690         strucoff = r->rstrucoff;
<>672 -        paramno = r->rparamno;
 673 -        n = mkty(temp, 0, 0);
 674 -        n->n_sue = sue;
  691+        if ((lparam = r->rlparam) != NULL)
  692+                lparam->next = NULL;
  693+        n = mkty(temp, 0, sue);
675694         return n;
 676695 }
 677696 
     
 !
11801199         /* this will never be called with a field element... */
 11811200         else inforce( tsize(t,d,sue) );
 11821201 
<>1183 -        paramno = 0;
  1202+        lparam = NULL;
11841203         vfdalign( AL_INIT );
 11851204         inoff = 0;
 11861205         iclass = SNULL;
     
 !
11961215 {
 11971216         while (pstk->in_prev)
 11981217                 pstk = pstk->in_prev;
<>1199 -        paramno = 0;
  1218+        lparam = NULL;
12001219         vfdalign( AL_INIT );
 12011220         inoff = 0;
 12021221         iclass = SNULL;
     
 !
13821401 {
 13831402 # ifndef BUG1
 13841403         if (idebug)
<>1385 -                printf( "irbrace(): paramno = %d on entry\n", paramno );
  1404+                printf( "irbrace(): lparam = %p on entry\n", lparam);
<_13861405 # endif
 13871406 
 13881407         if (ibseen) {
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 15:51 +0200