Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.42
 
1.43
 
MAIN:ragge:20030609155556
 
pftn.c
_>1212 struct symtab *cftnsp;
 1313 static int strunem;                     /* currently parsed member */
 1414 
<> 15+/*
  16+ * Linked list stack while reading in structs.
  17+ */
  18+struct rstack {
  19+        struct  rstack *rnext;
  20+        int     rinstruct;
  21+        int     rclass;
  22+        int     rstrucoff;
  23+        int     rparamno;
  24+        struct  symtab *rsym;
  25+};
  26+
1527 struct instk {
 1628         int in_sz;   /* size of array element */
<>17 -        int in_x;    /* current index for structure member in structure initializations */
  29+        struct symtab **in_xp/* member in structure initializations */
1830         int in_n;    /* number of initializations seen */
<>19 -        int in_s;    /* sizoff */
  31+        struct suedef *in_sue;
2032         int in_d;    /* dimoff */
 2133         TWORD in_t;    /* type */
 2234         struct symtab *in_sym;   /* stab index */
     
 !
3749 static void dynalloc(struct symtab *p, int *poff);
 3850 void inforce(OFFSZ n);
 3951 void vfdalign(int n);
<>40 -static void instk(struct symtab *p, TWORD t, int d, int s, OFFSZ off);
  52+static void instk(struct symtab *p, TWORD t, int d, struct suedef *, OFFSZ off);
4153 void gotscal(void);
 4254 
 4355 int ddebug = 0;
     
 !
6577         if (ddebug) {
 6678                 printf("defid(%s (%p), ", p->sname, p);
 6779                 tprint(q->n_type);
<>68 -                printf(", %s, (%d,%d)), level %d\n", scnames(class),
 69 -                    q->n_cdim, q->n_csiz, blevel);
  80+                printf(", %s, (%d,%p)), level %d\n", scnames(class),
  81+                    q->n_cdim, q->n_sue, blevel);
7082         }
 7183 # endif
 7284 
     
 !
8597                 printf(", %s\n", scnames(class));
 8698                 printf("        previous def'n: ");
 8799                 tprint(stp);
<>88 -                printf(", %s, (%d,%d)), level %d\n",
 89 -                    scnames(p->sclass), p->dimoff, p->sizoff, slev);
  100+                printf(", %s, (%d,%p)), level %d\n",
  101+                    scnames(p->sclass), p->dimoff, p->ssue, slev);
90102         }
 91103 # endif
 92104 
     
 !
142154 
 143155         /* check that redeclarations are to the same structure */
 144156         if ((temp == STRTY || temp == UNIONTY || temp == ENUMTY) &&
<>145 -            p->sizoff != q->n_csiz &&
  157+            p->ssue != q->n_sue &&
146158             class != STNAME && class != UNAME && class != ENAME) {
 147159                 goto mismatch;
 148160         }
     
 !
246258         case ENAME:
 247259                 if (scl != class)
 248260                         break;
<>249 -                if (dimtab[p->sizoff] == 0)
  261+                if (p->ssue->suesize == 0)
250262                         return/* previous entry just a mention */
 251263                 break;
 252264 
     
 !
282294         p->slevel = blevel;
 283295         p->soffset = NOOFFSET;
 284296         p->suse = lineno;
<>285 -        if( class == STNAME || class == UNAME || class == ENAME ) {
 286 -                p->sizoff = curdim;
 287 -                dstash( 0 );  /* size */
 288 -                dstash( -1 ); /* index to members of str or union */
 289 -                dstash( ALSTRUCT )/* alignment */
 290 -                dstash((int)p); /* dstash( idp ); XXX cast */
 291 -                }
 292 -        else {
 293 -                switch( BTYPE(type) ){
  297+        if (class == STNAME || class == UNAME || class == ENAME) {
  298+                p->ssue = permalloc(sizeof(struct suedef));
  299+                p->ssue->suesize = 0;
  300+                p->ssue->suelem = NULL;
  301+                p->ssue->suealign = ALSTRUCT;
  302+                p->ssue->suesym = p;
  303+        } else {
  304+                switch (BTYPE(type)) {
294305                 case STRTY:
 295306                 case UNIONTY:
 296307                 case ENUMTY:
<>297 -                        p->sizoff = q->n_csiz;
  308+                        p->ssue = q->n_sue;
298309                         break;
 299310                 default:
<>300 -                        p->sizoff = BTYPE(type);
 301 -                        }
  311+                        p->ssue = (struct suedef *)&dimtab[BTYPE(type)];
302312                 }
<> 313+        }
303314 
 304315         /* copy dimensions */
 305316 
     
 !
360371 
 361372 # ifndef BUG1
 362373         if (ddebug)
<>363 -                printf( "       dimoff, sizoff, offset: %d, %d, %d\n",
 364 -                    p->dimoff, p->sizoff, p->soffset );
  374+                printf( "       dimoff, ssue, offset: %d, %p, %d\n",
  375+                    p->dimoff, p->ssue, p->soffset);
365376 # endif
 366377 
 367378 }
     
 !
429440                 }
 430441 # endif
 431442                 if (p->stype == FARG) {
<>432 -                        q = block(FREE,NIL,NIL,INT,0,INT);
  443+                        q = block(FREE, NIL, NIL, INT, 0,
  444+                            (struct suedef *)&dimtab[INT]);
433445                         q->n_rval = j;
 434446                         defid(q, PARAM);
 435447                 }
     
 !
483495                 goto def;
 484496 
 485497         }
<>486 -        return(mkty(p->stype, 0, p->sizoff));
  498+        q = mkty(p->stype, 0, p->ssue);
  499+        q->n_sue = p->ssue;
  500+        return q;
487501 }
 488502 
 489503 void
     
 !
499513 /*
 500514  * begining of structure or union declaration
 501515  */
<>502 -int
  516+struct rstack *
503517 bstruct(char *name, int soru)
 504518 {
<> 519+        struct rstack *r;
505520         struct symtab *s;
 506521         NODE *q;
 507522 
     
 !
510525         else
 511526                 s = NULL;
 512527 
<>513 -        psave(instruct);
 514 -        psave(strunem);
 515 -        psave(strucoff);
  528+        r = tmpalloc(sizeof(struct rstack));
  529+        r->rinstruct = instruct;
  530+        r->rclass = strunem;
  531+        r->rstrucoff = strucoff;
  532+
516533         strucoff = 0;
 517534         instruct = soru;
 518535         q = block(FREE, NIL, NIL, 0, 0, 0);
     
 !
533550                 if (s != NULL)
 534551                         defid(q, ENAME);
 535552         }
<>536 -        psave((int)q->n_sp); /* XXX cast */
  553+        r->rsym = q->n_sp;
  554+        r->rparamno = paramno;
537555 
 538556         /* the "real" definition is where the members are seen */
 539557         if (s != NULL)
 540558                 s->suse = lineno;
<>541 -        return(paramno-4);
  559+        return r;
542560 }
 543561 
 544562 /*
 545563  * Called after a struct is declared to restore the environment.
 546564  */
 547565 NODE *
<>548 -dclstruct(int oparam)
  566+dclstruct(struct rstack *r)
549567 {
<> 568+        NODE *n;
  569+        struct suedef *sue;
550570         struct symtab *p;
<>551 -        int i, al, sa, j, sz, szindex;
  571+        int i, al, sa, j, sz;
552572         TWORD temp;
 553573         int high, low;
 554574 
     
 !
563583          */
 564584 
 565585 
<>566 -        if ((i = paramstk[oparam+3]) <= 0) {
 567 -                szindex = curdim;
 568 -                dstash(0);  /* size */
 569 -                dstash(-1)/* index to member names */
 570 -                dstash(ALSTRUCT)/* alignment */
 571 -                dstash(-lineno);        /* name of structure */
  586+        if (r->rsym == NULL) {
  587+                sue = permalloc(sizeof(struct suedef));
  588+                sue->suesize = 0;
  589+                sue->suelem = NULL;
  590+                sue->suealign = ALSTRUCT;
  591+                sue->suesym = NULL; /* XXX -lineno */
572592         } else
<>573 -                szindex = ((struct symtab *)i)->sizoff;
  593+                sue = r->rsym->ssue;
574594 
<>575 -# ifndef BUG1
 576 -        if (ddebug) {
 577 -                printf("dclstruct( %s ), szindex = %d\n",
 578 -                    (i>0)? ((struct symtab *)i)->sname : "??", szindex);
 579 -        }
 580 -# endif
  595+#ifdef PCC_DEBUG
  596+        if (ddebug)
  597+                printf("dclstruct( %s )\n", r->rsym ? r->rsym->sname : "??");
  598+#endif
581599         temp = (instruct&INSTRUCT)?STRTY:((instruct&INUNION)?UNIONTY:ENUMTY);
<>582 -        instruct = paramstk[oparam];
 583 -        strunem = paramstk[oparam+1];
 584 -        dimtab[szindex+1] = curdim;
  600+        instruct = r->rinstruct;
  601+        strunem = r->rclass;
  602+        sue->suelem = (struct symtab **)&dimtab[curdim]; /* XXX cast */
585603         al = ALSTRUCT;
 586604 
 587605         high = low = 0;
 588606 
<>589 -        for( i = oparam+4i< paramno; ++i ){
 590 -                dstash( j=paramstk[i] );
 591 -                if( j<0 /* || j>= SYMTSZ */ ) cerror( "gummy structure member" ); /* XXX cast bad test */
  607+        for (i = r->rparamno; i < paramno; ++i) {
  608+                dstash(j = paramstk[i]);
  609+                if (j == 0)
  610+                        cerror("gummy structure member");
592611                 p = (struct symtab *)j; /* XXX - cast */
 593612                 if( temp == ENUMTY ){
 594613                         if( p->soffset < low ) low = p->soffset;
 595614                         if( p->soffset > high ) high = p->soffset;
<>596 -                        p->sizoff = szindex;
  615+                        p->ssue = sue;
597616                         continue;
 598617                         }
<>599 -                sa = talign( p->stype, p->sizoff );
  618+                sa = talign(p->stype, p->ssue);
600619                 if (p->sclass & FIELD) {
 601620                         sz = p->sclass&FLDSIZ;
 602621                 } else {
<>603 -                        sz = tsize(p->stype, p->dimoff, p->sizoff);
  622+                        sz = tsize(p->stype, p->dimoff, p->ssue);
604623                 }
<>605 -#if 0
 606 -                if (sz == 0) {
 607 -                        werror("illegal zero sized structure member: %s", p->sname );
 608 -                }
 609 -#endif
610624                 if (sz > strucoff)
 611625                         strucoff = sz/* for use with unions */
 612626                 /*
     
 !
615629                  */
 616630                 SETOFF(al, sa);
 617631         }
<>618 -        dstash(-1);  /* endmarker */
  632+        dstash(0);  /* endmarker XXX cast */
619633         SETOFF( strucoff, al );
 620634 
<>621 -        if( temp == ENUMTY ){
  635+        if (temp == ENUMTY) {
622636                 TWORD ty;
 623637 
<>624 -# ifdef ENUMSIZE
  638+#ifdef ENUMSIZE
625639                 ty = ENUMSIZE(high,low);
<>626 -# else
 627 -                if( (char)high == high && (char)low == low ) ty = ctype( CHAR );
 628 -                else if( (short)high == high && (short)low == low ) ty = ctype( SHORT );
 629 -                else ty = ctype(INT);
  640+#else
  641+                if ((char)high == high && (char)low == low)
  642+                        ty = ctype(CHAR);
  643+                else if ((short)high == high && (short)low == low)
  644+                        ty = ctype(SHORT);
  645+                else
  646+                        ty = ctype(INT);
630647 #endif
<>631 -                strucoff = tsize( ty, 0, (int)ty );
 632 -                dimtab[ szindex+2 ] = al = talign( ty, (int)ty );
  648+                strucoff = tsize(ty, 0, MKSUE(ty));
  649+                sue->suealign = al = talign(ty, MKSUE(ty));
633650         }
 634651 
<>635 -#if 0
 636 -        if (strucoff == 0)
 637 -                uerror( "zero sized structure" );
 638 -#endif
 639 -        dimtab[szindex] = strucoff;
 640 -        dimtab[szindex+2] = al;
 641 -        dimtab[szindex+3] = paramstk[ oparam+3 ]/* name index */
  652+        sue->suesize = strucoff;
  653+        sue->suealign = al;
  654+        sue->suesym = r->rsym;
642655 
<>643 -        FIXSTRUCT(szindex, oparam); /* local hook, eg. for sym debugger */
 644 -# ifndef BUG1
  656+//      FIXSTRUCT(szindex, oparam); /* local hook, eg. for sym debugger */
  657+#if 0
645658         if (ddebug>1) {
 646659                 printf("\tdimtab[%d,%d,%d] = %d,%d,%d\n",
 647660                     szindex,szindex+1,szindex+2,
     
 !
651664                             ((struct symtab *)dimtab[i])->sname, dimtab[i]);
 652665                 }
 653666         }
<>654 -# endif
  667+#endif
655668 
<>656 -        strucoff = paramstk[ oparam+2 ];
 657 -        paramno = oparam;
 658 -
 659 -        return( mkty( temp, 0, szindex ) );
  669+        strucoff = r->rstrucoff;
  670+        paramno = r->rparamno;
  671+        n = mkty(temp, 0, 0);
  672+        n->n_sue = sue;
  673+        return n;
660674 }
 661675 
 662676 /*
     
 !
709723  * compute the alignment of an object with type ty, sizeoff index s
 710724  */
 711725 int
<>712 -talign(unsigned int ty, int s)
  726+talign(unsigned int ty, struct suedef *sue)
713727 {
 714728         int i;
 715729 
<>716 -        if( s<0 && ty!=INT && ty!=CHAR && ty!=SHORT && ty!=UNSIGNED && ty!=UCHAR && ty!=USHORT
 717 -                                        ){
 718 -                return( fldal( ty ) );
 719 -                }
  730+        if(sue == NULL && ty!=INT && ty!=CHAR && ty!=SHORT &&
  731+            ty!=UNSIGNED && ty!=UCHAR && ty!=USHORT) {
  732+                return(fldal(ty));
  733+        }
720734 
 721735         for( i=0; i<=(SZINT-BTSHIFT-1); i+=TSHIFT ){
 722736                 switch( (ty>>i)&TMASK ){
     
 !
738752         case UNIONTY:
 739753         case ENUMTY:
 740754         case STRTY:
<>741 -                return( (unsigned int) dimtab[ s+2 ] );
  755+                return((unsigned int)sue->suealign);
742756         case CHAR:
 743757         case UCHAR:
 744758                 return (ALCHAR);
     
 !
757771                 return (ALSHORT);
 758772         default:
 759773                 return (ALINT);
<>760 -                }
761774         }
<> 775+}
762776 
<> 777+/* compute the size associated with type ty,
  778+ *  dimoff d, and sizoff s */
  779+/* BETTER NOT BE CALLED WHEN t, d, and s REFER TO A BIT FIELD... */
763780 OFFSZ
<>764 -tsize( ty, d, s )  TWORD ty; {
 765 -        /* compute the size associated with type ty,
 766 -            dimoff d, and sizoff s */
 767 -        /* BETTER NOT BE CALLED WHEN t, d, and s REFER TO A BIT FIELD... */
  781+tsize(TWORD ty, int d, struct suedef *sue)
  782+{
768783 
 769784         int i;
 770785         OFFSZ mult;
     
 !
789804                         }
 790805                 }
 791806 
<> 807+        if (sue == NULL)
  808+                cerror("bad tsize sue");
792809         if (ty != STRTY && ty != UNIONTY) {
<>793 -                if (dimtab[s] == 0) {
  810+                if (sue->suesize == 0) {
794811                         uerror("unknown size");
 795812                         return(SZINT);
 796813                 }
 797814         } else {
<>798 -                if (dimtab[s+1] == -1)
  815+                if (sue->suelem == NULL)
799816                         uerror("unknown structure/union");
 800817         }
 801818 
<>802 -        return( (unsigned int) dimtab[ s ] * mult );
  819+        return((unsigned int)sue->suesize * mult);
803820 }
 804821 
 805822 /*
     
 !
898915                 ilocctr = ISARY(p->stype)?ADATA:DATA;
 899916                 if (nerrors == 0) {
 900917                         (void) locctr(ilocctr);
<>901 -                        defalign(talign(p->stype, p->sizoff));
  918+                        defalign(talign(p->stype, p->ssue));
902919                         defnam(p);
 903920                 }
 904921         }
     
 !
909926 
 910927         pstk = 0;
 911928 
<>912 -        instk(p, p->stype, p->dimoff, p->sizoff, inoff);
  929+        instk(p, p->stype, p->dimoff, p->ssue, inoff);
913930 
 914931 }
 915932 
 916933 /*
<>917 - * make a new entry on the parameter stack to initialize id
  934+ * make a new entry on the parameter stack to initialize p
918935  */
 919936 void
<>920 -instk(struct symtab *p, TWORD t, int d, int s, OFFSZ off)
  937+instk(struct symtab *p, TWORD t, int d, struct suedef *sue, OFFSZ off)
921938 {
 922939 
 923940         for (;;) {
 924941 # ifndef BUG1
 925942                 if (idebug)
<>926 -                        printf("instk((%p, %o,%d,%d, %lld)\n",
 927 -                            p, t, d, s, (long long)off);
  943+                        printf("instk((%p, %o,%d,%p, %lld)\n",
  944+                            p, t, d, sue, (long long)off);
928945 # endif
 929946 
 930947                 /* save information on the stack */
     
 !
938955                 pstk->in_sym = p;
 939956                 pstk->in_t = t;
 940957                 pstk->in_d = d;
<>941 -                pstk->in_s = s;
  958+                pstk->in_sue = sue;
942959                 pstk->in_n = 0/* number seen */
<>943 -                pstk->in_x = (t == STRTY || t == UNIONTY) ? dimtab[s+1] : 0 ;
  960+                pstk->in_xp = (t == STRTY || t == UNIONTY) ? sue->suelem : NULL;
944961                 pstk->in_off = off;/* offset at the beginning of this element */
 945962 
 946963                 /* if t is an array, DECREF(t) can't be a field */
 947964                 /* in_sz has size of array elements, and -size for fields */
 948965                 if (ISARY(t)) {
<>949 -                        pstk->in_sz = tsize(DECREF(t), d+1, s);
  966+                        pstk->in_sz = tsize(DECREF(t), d+1, sue);
950967                 } else if (p->sclass & FIELD){
 951968                         pstk->in_sz = - (p->sclass & FLDSIZ);
 952969                 } else {
     
 !
964981                         ++d;
 965982                         continue;
 966983                 } else if (t == STRTY || t == UNIONTY) {
<>967 -                        if (dimtab[pstk->in_s] == 0) {
  984+                        if (pstk->in_sue == 0) {
968985                                 uerror("can't initialize undefined %s",
 969986                                     t == STRTY ? "structure" : "union");
 970987                                 iclass = -1;
 971988                                 return;
 972989                         }
<>973 -                        p = (struct symtab *)dimtab[pstk->in_x];
  990+                        p = *pstk->in_xp;
974991                         if (((p->sclass != MOS && t == STRTY) ||
 975992                             (p->sclass != MOU && t == UNIONTY)) &&
 976993                             !(p->sclass&FIELD))
 977994                                 cerror("insane %s member list",
 978995                                     t == STRTY ? "structure" : "union");
 979996                         t = p->stype;
 980997                         d = p->dimoff;
<>981 -                        s = p->sizoff;
  998+                        sue = p->ssue;
982999                         off += p->soffset;
 9831000                         continue;
 9841001                 } else
     
 !
11031120 void
 11041121 endinit(void)
 11051122 {
<> 1123+        struct suedef *sue;
11061124         TWORD t;
<>1107 -        int d, s, n, d1;
  1125+        int d, n, d1;
11081126 
 11091127 # ifndef BUG1
 11101128         if (idebug)
     
 !
11241142 
 11251143         t = pstk->in_t;
 11261144         d = pstk->in_d;
<>1127 -        s = pstk->in_s;
  1145+        sue = pstk->in_sue;
11281146         n = pstk->in_n;
 11291147 
 11301148         if( ISARY(t) ){
     
 !
11341152                 n = inoff/pstk->in_sz/* real number of initializers */
 11351153                 if( d1 >= n ){
 11361154                         /* once again, t is an array, so no fields */
<>1137 -                        inforce( tsize( t, d, s ) );
  1155+                        inforce(tsize(t, d, sue));
11381156                         n = d1;
 11391157                         }
 11401158                 if( d1!=0 && d1!=n ) uerror( "too many initializers");
     
 !
11471165 
 11481166         else if( t == STRTY || t == UNIONTY ){
 11491167                 /* clearly not fields either */
<>1150 -                inforce( tsize( t, d, s ) );
  1168+                inforce( tsize( t, d, sue ) );
11511169                 }
 11521170         else if( n > 1 ) uerror( "bad scalar initialization");
 11531171         /* this will never be called with a field element... */
<>1154 -        else inforce( tsize(t,d,s) );
  1172+        else inforce( tsize(t,d,sue) );
11551173 
 11561174         paramno = 0;
 11571175         vfdalign( AL_INIT );
     
 !
11821200 void
 11831201 doinit(NODE *p)
 11841202 {
<>1185 -        int sz, d, s;
  1203+        NODE *u;
  1204+        struct suedef *sue;
  1205+        int sz, d;
11861206         TWORD t;
 11871207         int o;
 11881208 
     
 !
12241244 
 12251245         t = pstk->in_t/* type required */
 12261246         d = pstk->in_d;
<>1227 -        s = pstk->in_s;
  1247+        sue = pstk->in_sue;
12281248         if (pstk->in_sz < 0) {  /* bit field */
 12291249                 sz = -pstk->in_sz;
 12301250         } else {
<>1231 -                sz = tsize( t, d, s );
  1251+                sz = tsize( t, d, sue );
12321252         }
 12331253 
 12341254         inforce( pstk->in_off );
 12351255 
<>1236 -        p = buildtree( ASSIGN, block( NAME, NIL,NIL, t, d, s ), p );
  1256+        u = block(NAME, NIL,NIL, t, d, 0);
  1257+        u->n_sue = sue;
  1258+        p = buildtree( ASSIGN, u, p );
12371259         p->n_left->n_op = FREE;
 12381260         p->n_left = p->n_right;
 12391261         p->n_right = NIL;
     
 !
12711293 void
 12721294 gotscal(void)
 12731295 {
<>1274 -        int t, ix;
 1275 -        int n, id;
  1296+        int t, n;
12761297         struct symtab *p;
 12771298         OFFSZ temp;
 12781299 
     
 !
12851306                 t = pstk->in_t;
 12861307 
 12871308                 if( t == STRTY || t == UNIONTY){
<>1288 -                        ix = ++pstk->in_x;
 1289 -                        if( (id=dimtab[ix]) < 0 ) continue;
  1309+                        ++pstk->in_xp;
  1310+                        if ((p = *pstk->in_xp) == NULL)
  1311+                                continue;
12901312 
 12911313                         /* otherwise, put next element on the stack */
<>1292 -
 1293 -                        p = (struct symtab *)id;
 1294 -                        instk(p, p->stype, p->dimoff, p->sizoff, p->soffset+pstk->in_off );
  1314+                        instk(p, p->stype, p->dimoff, p->ssue, p->soffset+pstk->in_off );
12951315                         return;
 12961316                         }
 12971317                 else if( ISARY(t) ){
     
 !
13011321                         /* put the new element onto the stack */
 13021322 
 13031323                         temp = pstk->in_sz;
<>1304 -                        instk(pstk->in_sym, (TWORD)DECREF(pstk->in_t), pstk->in_d+1, pstk->in_s,
  1324+                        instk(pstk->in_sym, (TWORD)DECREF(pstk->in_t), pstk->in_d+1, pstk->in_sue,
13051325                                 pstk->in_off+n*temp );
 13061326                         return;
 13071327                         }
     
 !
14051425         int al, off, tsz;
 14061426         int noff;
 14071427 
<>1408 -        al = talign(p->stype, p->sizoff);
  1428+        al = talign(p->stype, p->ssue);
14091429         noff = off = *poff;
<>1410 -        tsz = tsize(p->stype, p->dimoff, p->sizoff);
  1430+        tsz = tsize(p->stype, p->dimoff, p->ssue);
14111431 #ifdef BACKAUTO
 14121432         if (p->sclass == AUTO) {
 14131433                 if ((offsz-off) < tsz)
     
 !
14631483 static void
 14641484 dynalloc(struct symtab *p, int *poff)
 14651485 {
<> 1486+        struct suedef sue;
14661487 //      struct symtab *q;
 14671488         NODE *n, *nn;
 14681489         OFFSZ ptroff, argoff;
     
 !
14751496          * Setup space on the stack, one pointer to the array space
 14761497          * and n-1 integers for the array sizes.
 14771498          */
<>1478 -        ptroff = upoff(tsize(PTR, 0, 0), talign(PTR, 0), poff);
  1499+        ptroff = upoff(tsize(PTR, 0, &sue), talign(PTR, &sue), poff);
14791500         if (arrstkp > 1) {
 14801501                 dimtab[curdim] = arrstkp-1;
 14811502                 dimtab[curdim+1] = INT;
<>1482 -                argoff = upoff(tsize(ARY+INT, dimtab[curdim], dimtab[curdim+1]),                    talign(ARY+INT, 0), poff);
  1503+                argoff = upoff(tsize(ARY+INT, dimtab[curdim], NULL),
  1504+                    talign(ARY+INT, 0), poff);
14831505         }
 14841506 
 14851507         /*
     
 !
15221544                 t = DECREF(t);
 15231545 
 15241546         /* Write it onto the stack */
<>1525 -        spalloc(nn, n, tsize(t, 0, p->sizoff));
  1547+        spalloc(nn, n, tsize(t, 0, p->ssue));
15261548         p->sflags |= SDYNARRAY;
 15271549         arrstkp = 0;
 15281550 }
     
 !
15411563         /* this must be fixed to use the current type in alignments */
 15421564         switch( new<0?pty->n_type:p->stype ){
 15431565 
<>1544 -        case ENUMTY:
 1545 -                {
 1546 -                        int s;
 1547 -                        s = new<0 ? pty->n_csiz : p->sizoff;
 1548 -                        al = dimtab[s+2];
 1549 -                        sz = dimtab[s];
 1550 -                        break;
 1551 -                        }
  1566+        case ENUMTY: {
  1567+                struct suedef *sue;
  1568+                sue = new < 0 ? pty->n_sue : p->ssue;
  1569+                al = sue->suealign;
  1570+                sz = sue->suesize;
  1571+                break;
  1572+        }
15521573 
 15531574         case CHAR:
 15541575         case UCHAR:
     
 !
17891810         return mkty(INT, 0, 0);
 17901811 }
 17911812 
<> 1813+/* merge type typ with identifier idp  */
17921814 NODE *
<>1793 -tymerge( typ, idp ) NODE *typ, *idp; {
 1794 -        /* merge type typ with identifier idp  */
 1795 -
  1815+tymerge(NODE *typ, NODE *idp)
  1816+{
17961817         unsigned int t;
 17971818         int i;
 17981819 
<>1799 -        if( typ->n_op != TYPE ) cerror( "tymerge: arg 1" );
 1800 -        if(idp == NIL ) return( NIL );
  1820+        if (typ->n_op != TYPE)
  1821+                cerror( "tymerge: arg 1" );
  1822+        if (idp == NIL)
  1823+                return( NIL );
18011824 
 18021825 # ifndef BUG1
 18031826         if( ddebug > 2 ) fwalk( idp, eprint, 0 );
 18041827 # endif
 18051828 
 18061829         idp->n_type = typ->n_type;
 18071830         idp->n_cdim = curdim;
<>1808 -        tyreduce( idp );
 1809 -        idp->n_csiz = typ->n_csiz;
  1831+        tyreduce(idp);
  1832+        idp->n_sue = typ->n_sue;
18101833 
<>1811 -        for( t=typ->n_type, i=typ->n_cdim; t&TMASK; t = DECREF(t) ){
 1812 -                if( ISARY(t) ) dstash( dimtab[i++] );
 1813 -                }
  1834+        for (t=typ->n_type, i=typ->n_cdim; t&TMASK; t = DECREF(t))
  1835+                if (ISARY(t))
  1836+                        dstash(dimtab[i++]);
18141837 
 18151838         /* now idp is a single node: fix up type */
 18161839 
<>1817 -        idp->n_type = ctype( idp->n_type );
  1840+        idp->n_type = ctype(idp->n_type);
18181841 
<>1819 -        if( (t = BTYPE(idp->n_type)) != STRTY && t != UNIONTY && t != ENUMTY ){
 1820 -                idp->n_csiz = t/* in case ctype has rewritten things */
 1821 -                }
  1842+        /* in case ctype has rewritten things */
  1843+        if ((t = BTYPE(idp->n_type)) != STRTY && t != UNIONTY && t != ENUMTY)
  1844+                idp->n_sue = (struct suedef *)&dimtab[t];
18221845 
<>1823 -        return( idp );
 1824 -        }
  1846+        return(idp);
  1847+}
<_18251848 
 18261849 /*
 18271850  * build a type, and stash away dimensions,
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-20 16:02 +0200