Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.1
 
1.2
 
MAIN:ragge:20020325225236
 
pftn.c
_>1 -#ifndef lint
  1+#if 0
22 static char *sccsid ="@(#)pftn.c        1.29 (Berkeley) 6/18/90";
<>3 -#endif lint
  3+#endif
44 
 55 # include "pass1.h"
 66 
     
 !
1919         int in_id;   /* stab index */
 2020         int in_fl;   /* flag which says if this level is controlled by {} */
 2121         OFFSZ in_off/* offset of the beginning of this level */
<>22 -        }
 23 -instack[10],
 24 -*pstk;
  22+} instack[10], *pstk;
2523 
<>26 -        /* defines used for getting things off of the initialization stack */
  24+/* defines used for getting things off of the initialization stack */
2725 
 2826 
<>29 -struct symtab *relook();
  27+struct symtab *relook(struct symtab *);
  28+struct symtab * mknonuniq(int *);
  29+void fixtype(NODE *p, int class);
  30+int fixclass(int class, TWORD type);
  31+int falloc(struct symtab *p, int w, int new, NODE *pty);
  32+void psave(int);
  33+int oalloc(struct symtab *p, int *poff);
  34+int hide(struct symtab *p);
  35+void inforce(OFFSZ n);
  36+void vfdalign(int n);
  37+void instk(int id, TWORD t, int d, int s, OFFSZ off);
  38+void gotscal(void);
3039 
<>31 -
3240 int ddebug = 0;
 3341 
<>34 -struct symtab * mknonuniq();
 35 -
 36 -defid( q, class ) register NODE *q; register int class; {
 37 -        register struct symtab *p;
  42+void
  43+defid(NODE *q, int class)
  44+{
  45+        struct symtab *p;
3846         int idp;
<>39 -        register TWORD type;
  47+        TWORD type;
4048         TWORD stp;
<>41 -        register int scl;
  49+        int scl;
4250         int dsym, ddef;
 4351         int slev, temp;
 4452         int changed;
     
 !
247255         /* allow nonunique structure/union member names */
 248256 
 249257         if( class==MOU || class==MOS || class & FIELD ){/* make a new entry */
<>250 -                register int *memp;
  258+                int *memp;
251259                 p->sflags |= SNONUNIQ/* old entry is nonunique */
 252260                 /* determine if name has occurred in this structure/union */
 253261                 if (paramno > 0) for( memp = &paramstk[paramno-1];
     
 !
371379                 }
 372380 
 373381         {
<>374 -                register int l = p->slevel;
  382+                int l = p->slevel;
375383 
 376384                 if( l >= MAXSCOPES )
 377385                         cerror( "scopes nested too deep" );
     
 !
392400 
 393401         }
 394402 
<>395 -psave( i ){
  403+void
  404+psave(int i)
  405+{
396406         if( paramno >= PARAMSZ ){
 397407                 cerror( "parameter stack overflow");
<>398 -                }
 399 -        paramstk[ paramno++ ] = i;
400408         }
<> 409+        paramstk[ paramno++ ] = i;
  410+}
401411 
<>402 -ftnend(){ /* end of function */
  412+/*
  413+ * end of function
  414+ */
  415+void
  416+ftnend()
  417+{
403418         if( retlab != NOLAB && nerrors == 0 ){ /* inside a real function */
 404419                 efcode();
<>405 -                }
  420+        }
406421         checkst(0);
 407422         retstat = 0;
 408423         tcheck();
     
 !
422437         swx = 0;
 423438         swp = swtab;
 424439         (void) locctr(DATA);
<>425 -        }
  440+}
426441 
<>427 -dclargs(){
 428 -        register i, j;
 429 -        register struct symtab *p;
 430 -        register NODE *q;
  442+void
  443+dclargs()
  444+{
  445+        int i, j;
  446+        struct symtab *p;
  447+        NODE *q;
431448         argoff = ARGINIT;
 432449 # ifndef BUG1
 433450         if( ddebug > 2) printf("dclargs()\n");
     
 !
456473         ftnno = getlab();
 457474         bfcode( paramstk, paramno );
 458475         paramno = 0;
<>459 -        }
  476+}
460477 
 461478 NODE *
 462479 rstruct( idn, soru ){ /* reference to a structure or union, with no definition */
<>463 -        register struct symtab *p;
 464 -        register NODE *q;
  480+        struct symtab *p;
  481+        NODE *q;
465482         p = &stab[idn];
 466483         switch( p->stype ){
 467484 
     
 !
490507         return( mkty( p->stype, 0, p->sizoff ) );
 491508         }
 492509 
<>493 -moedef( idn ){
 494 -        register NODE *q;
  510+void
  511+moedef(int idn)
  512+{
  513+        NODE *q;
495514 
 496515         q = block( FREE, NIL, NIL, MOETY, 0, 0 );
 497516         q->tn.rval = idn;
 498517         if( idn>=0 ) defid( q, MOE );
<>499 -        }
  518+}
500519 
<>501 -bstruct( idn, soru ){ /* begining of structure or union declaration */
 502 -        register NODE *q;
  520+/*
  521+ * begining of structure or union declaration
  522+ */
  523+int
  524+bstruct(int idn, int soru)
  525+{
  526+        NODE *q;
503527 
 504528         psave( instruct );
 505529         psave( curclass );
     
 !
527551         /* the "real" definition is where the members are seen */
 528552         if ( idn >= 0 ) stab[idn].suse = lineno;
 529553         return( paramno-4 );
<>530 -        }
  554+}
531555 
 532556 NODE *
<>533 -dclstruct( oparam ){
 534 -        register struct symtab *p;
 535 -        register i, al, sa, j, sz, szindex;
 536 -        register TWORD temp;
 537 -        register high, low;
  557+dclstruct(int oparam)
  558+{
  559+        struct symtab *p;
  560+        int i, al, sa, j, sz, szindex;
  561+        TWORD temp;
  562+        int high, low;
538563 
 539564         /* paramstk contains:
 540565                 paramstk[ oparam ] = previous instruct
     
 !
607632         SETOFF( strucoff, al );
 608633 
 609634         if( temp == ENUMTY ){
<>610 -                register TWORD ty;
  635+                TWORD ty;
611636 
 612637 # ifdef ENUMSIZE
 613638                 ty = ENUMSIZE(high,low);
     
 !
646671         return( mkty( temp, 0, szindex ) );
 647672         }
 648673 
<>649 -        /* VARARGS */
 650 -yyerror( s ) char *s; { /* error printing routine in parser */
  674+/*
  675+ * error printing routine in parser
  676+ */
  677+void yyerror(char *s);
  678+void
  679+yyerror(char *s)
  680+{
  681+        uerror(s);
  682+}
651683 
<>652 -        uerror( s );
 653 -
 654 -        }
 655 -
 656 -yyaccpt(){
  684+void yyaccpt(void);
  685+void
  686+yyaccpt(void)
  687+{
657688         ftnend();
<>658 -        }
  689+}
659690 
<>660 -ftnarg( idn ) {
  691+void
  692+ftnarg(int idn)
  693+{
661694         switch( stab[idn].stype ){
 662695 
 663696         case UNDEF:
     
 !
684717         stab[idn].stype = FARG;
 685718         stab[idn].sclass = PARAM;
 686719         psave( idn );
<>687 -        }
  720+}
688721 
<>689 -talign( ty, s) register unsigned ty; register s; {
 690 -        /* compute the alignment of an object with type ty, sizeoff index s */
  722+/*
  723+ * compute the alignment of an object with type ty, sizeoff index s
  724+ */
  725+int
  726+talign(unsigned int ty, int s)
  727+{
  728+        int i;
691729 
<>692 -        register i;
693730         if( s<0 && ty!=INT && ty!=CHAR && ty!=SHORT && ty!=UNSIGNED && ty!=UCHAR && ty!=USHORT
 694731 #ifdef LONGFIELDS
 695732                 && ty!=LONG && ty!=ULONG
     
 !
776813         return( (unsigned int) dimtab[ s ] * mult );
 777814         }
 778815 
<>779 -inforce( n ) OFFSZ n; {  /* force inoff to have the value n */
  816+/*
  817+ * force inoff to have the value n
  818+ */
  819+void
  820+inforce(OFFSZ n)
  821+{
780822         /* inoff is updated to have the value n */
 781823         OFFSZ wb;
<>782 -        register rest;
  824+        int rest;
783825         /* rest is used to do a lot of conversion to ints... */
 784826 
 785827         if( inoff == n ) return;
     
 !
816858 
 817859         }
 818860 
<>819 -vfdalign( n ){ /* make inoff have the offset the next alignment of n */
  861+/*
  862+ * make inoff have the offset the next alignment of n
  863+ */
  864+void
  865+vfdalign(int n)
  866+{
820867         OFFSZ m;
 821868 
 822869         m = inoff;
 823870         SETOFF( m, n );
 824871         inforce( m );
<>825 -        }
  872+}
826873 
 827874 
 828875 int idebug = 0;
     
 !
835882 
 836883 int ilocctr = 0/* location counter for current initialization */
 837884 
<>838 -beginit(curid){
 839 -        /* beginning of initilization; set location ctr and set type */
 840 -        register struct symtab *p;
  885+/*
  886+ * beginning of initilization; set location ctr and set type
  887+ */
  888+void
  889+beginit(int curid)
  890+{
  891+        struct symtab *p;
841892 
 842893 # ifndef BUG1
 843894         if( idebug >= 3 ) printf( "beginit(), curid = %d\n", curid );
     
 !
862913                         (void) locctr( ilocctr );
 863914                         defalign( talign( p->stype, p->sizoff ) );
 864915                         defnam( p );
<>865 -                        }
 866 -
867916                 }
<> 917+        }
868918 
 869919         inoff = 0;
 870920         ibseen = 0;
     
 !
874924 
 875925         instk( curid, p->stype, p->dimoff, p->sizoff, inoff );
 876926 
<>877 -        }
  927+}
878928 
<>879 -instk( id, t, d, s, off ) OFFSZ off; TWORD t; {
 880 -        /* make a new entry on the parameter stack to initialize id */
  929+/*
  930+ * make a new entry on the parameter stack to initialize id
  931+ */
  932+void
  933+instk(int id, TWORD t, int d, int s, OFFSZ off)
  934+{
  935+        struct symtab *p;
881936 
<>882 -        register struct symtab *p;
 883 -
 884 -        for(;;){
  937+        for (;;) {
885938 # ifndef BUG1
<>886 -                if( idebug ) printf( "instk((%d, %o,%d,%d, %d)\n", id, t, d, s, off );
  939+                if (idebug)
  940+                        printf("instk((%d, %o,%d,%d, %ld)\n", id, t, d, s, off);
887941 # endif
 888942 
 889943                 /* save information on the stack */
     
 !
943997 NODE *
 944998 getstr(){ /* decide if the string is external or an initializer, and get the contents accordingly */
 945999 
<>946 -        register l, temp;
 947 -        register NODE *p;
  1000+        int l, temp;
  1001+        NODE *p;
9481002 
 9491003         if( (iclass==EXTDEF||iclass==STATIC) && (pstk->in_t == CHAR || pstk->in_t == UCHAR) &&
 9501004                         pstk!=instack && ISARY( pstk[-1].in_t ) ){
     
 !
9741028                 }
 9751029         }
 9761030 
<>977 -putbyte( v ){ /* simulate byte v appearing in a list of integer values */
 978 -        register NODE *p;
  1031+/*
  1032+ * simulate byte v appearing in a list of integer values
  1033+ */
  1034+void
  1035+putbyte(int v)
  1036+{
  1037+        NODE *p;
9791038         p = bcon(v);
 9801039         incode( p, SZCHAR );
 9811040         tfree( p );
 9821041         gotscal();
<>983 -        }
  1042+}
9841043 
<>985 -endinit(){
 986 -        register TWORD t;
 987 -        register d, s, n, d1;
  1044+void
  1045+endinit(void)
  1046+{
  1047+        TWORD t;
  1048+        int d, s, n, d1;
9881049 
 9891050 # ifndef BUG1
<>990 -        if( idebug ) printf( "endinit(), inoff = %d\n", inoff );
  1051+        if (idebug)
  1052+                printf("endinit(), inoff = %ld\n", inoff);
9911053 # endif
 9921054 
 9931055         switch( iclass ){
     
 !
10191081                 if( d1!=0 && d1!=n ) uerror( "too many initializers");
 10201082                 if( n==0 ) werror( "empty array declaration");
 10211083                 dimtab[d] = n;
<>1022 -                if( d1==0 ) FIXDEF(&stab[pstk->in_id]);
  1084+                if (d1==0) {
  1085+                        FIXDEF(&stab[pstk->in_id]);
10231086                 }
<> 1087+        }
10241088 
 10251089         else if( t == STRTY || t == UNIONTY ){
 10261090                 /* clearly not fields either */
     
 !
10351099         inoff = 0;
 10361100         iclass = SNULL;
 10371101 
<>1038 -        }
  1102+}
10391103 
<>1040 -fixinit(){
 1041 -        /* called from the grammar if we must punt during initialization */
 1042 -        /* stolen from endinit() */
  1104+/*
  1105+ * called from the grammar if we must punt during initialization
  1106+ * stolen from endinit()
  1107+ */
  1108+void
  1109+fixinit(void)
  1110+{
10431111         pstk = instack;
 10441112         paramno = 0;
 10451113         vfdalign( AL_INIT );
 10461114         inoff = 0;
 10471115         iclass = SNULL;
<>1048 -        }
  1116+}
10491117 
<>1050 -doinit( p ) register NODE *p; {
 1051 -
 1052 -        /* take care of generating a value for the initializer p */
 1053 -        /* inoff has the current offset (last bit written)
 1054 -                in the current word being generated */
 1055 -
 1056 -        register sz, d, s;
 1057 -        register TWORD t;
  1118+/*
  1119+ * take care of generating a value for the initializer p
  1120+ * inoff has the current offset (last bit written)
  1121+ * in the current word being generated
  1122+ */
  1123+void
  1124+doinit(NODE *p)
  1125+{
  1126+        int sz, d, s;
  1127+        TWORD t;
10581128         int o;
 10591129 
 10601130         /* note: size of an individual initializer is assumed to fit into an int */
     
 !
10891159                 }
 10901160 
 10911161 # ifndef BUG1
<>1092 -        if( idebug > 1 ) printf( "doinit(%o)\n", p );
  1162+        if (idebug > 1)
  1163+                printf("doinit(%p)\n", p);
10931164 # endif
 10941165 
 10951166         t = pstk->in_t/* type required */
 10961167         d = pstk->in_d;
 10971168         s = pstk->in_s;
<>1098 -        if( pstk->in_sz < 0 ){  /* bit field */
  1169+        if (pstk->in_sz < 0) {  /* bit field */
10991170                 sz = -pstk->in_sz;
<>1100 -                }
 1101 -        else {
  1171+        } else {
11021172                 sz = tsize( t, d, s );
<>1103 -                }
  1173+        }
11041174 
 11051175         inforce( pstk->in_off );
 11061176 
     
 !
11231193         if( sz < SZINT ){ /* special case: bit fields, etc. */
 11241194                 if( o != ICON || p->in.left->tn.rval != NONAME )
 11251195                         uerror( "illegal initialization" );
<>1126 -                else incode( p->in.left, sz );
 1127 -                }
 1128 -        else if( o == FCON ){
  1196+                else
  1197+                        incode( p->in.left, sz );
  1198+        } else if( o == FCON ){
11291199                 fincode( p->in.left->fpn.fval, sz );
<>1130 -                }
 1131 -        else if( o == DCON ){
  1200+        } else if( o == DCON ){
11321201                 fincode( p->in.left->dpn.dval, sz );
<>1133 -                }
 1134 -        else {
  1202+        } else {
11351203                 p = optim(p);
<>1136 -                if( p->in.left->in.op != ICON ) uerror( "illegal initialization" );
 1137 -                else cinit( p, sz );
 1138 -                }
  1204+                if( p->in.left->in.op != ICON )
  1205+                        uerror( "illegal initialization" );
  1206+                else
  1207+                        cinit( p, sz );
  1208+        }
11391209 
 11401210         gotscal();
 11411211 
 11421212         leave:
 11431213         tfree(p);
<>1144 -        }
  1214+}
11451215 
<>1146 -gotscal(){
 1147 -        register t, ix;
 1148 -        register n, id;
  1216+void
  1217+gotscal(void)
  1218+{
  1219+        int t, ix;
  1220+        int n, id;
11491221         struct symtab *p;
 11501222         OFFSZ temp;
 11511223 
     
 !
11831255         ifull = 1;
 11841256         }
 11851257 
<>1186 -ilbrace(){ /* process an initializer's left brace */
 1187 -        register t;
  1258+/*
  1259+ * process an initializer's left brace
  1260+ */
  1261+void
  1262+ilbrace()
  1263+{
  1264+        int t;
11881265         struct instk *temp;
 11891266 
 11901267         temp = pstk;
     
 !
12071284         /* ignore such right braces */
 12081285 
 12091286         pstk = temp;
<>1210 -        }
  1287+}
12111288 
<>1212 -irbrace(){
 1213 -        /* called when a '}' is seen */
 1214 -
  1289+/*
  1290+ * called when a '}' is seen
  1291+ */
  1292+void
  1293+irbrace()
  1294+{
12151295 # ifndef BUG1
<>1216 -        if( idebug ) printf( "irbrace(): paramno = %d on entry\n", paramno );
  1296+        if (idebug)
  1297+                printf( "irbrace(): paramno = %d on entry\n", paramno );
12171298 # endif
 12181299 
<>1219 -        if( ibseen ) {
  1300+        if (ibseen) {
12201301                 --ibseen;
 12211302                 return;
<>1222 -                }
  1303+        }
12231304 
 12241305         for( ; pstk > instack; --pstk ){
 12251306                 if( !pstk->in_fl ) continue;
     
 !
12331314 
 12341315         /* these right braces match ignored left braces: throw out */
 12351316         ifull = 1;
<> 1317+}
12361318 
<>1237 -        }
  1319+/*
  1320+ * update the offset pointed to by poff; return the
  1321+ * offset of a value of size `size', alignment `alignment',
  1322+ * given that off is increasing
  1323+ */
  1324+int
  1325+upoff(int size, int alignment, int *poff)
  1326+{
  1327+        int off;
12381328 
<>1239 -upoff( size, alignment, poff ) register alignment, *poff; {
 1240 -        /* update the offset pointed to by poff; return the
 1241 -        /* offset of a value of size `size', alignment `alignment',
 1242 -        /* given that off is increasing */
 1243 -
 1244 -        register off;
 1245 -
12461329         off = *poff;
 12471330         SETOFF( off, alignment );
 12481331         if( (offsz-off) <  size ){
     
 !
12511334                 }
 12521335         *poff = off+size;
 12531336         return( off );
<>1254 -        }
  1337+}
12551338 
<>1256 -oalloc( p, poff ) register struct symtab *p; register *poff; {
 1257 -        /* allocate p with offset *poff, and update *poff */
 1258 -        register al, off, tsz;
  1339+/*
  1340+ * allocate p with offset *poff, and update *poff
  1341+ */
  1342+int
  1343+oalloc(struct symtab *p, int *poff )
  1344+{
  1345+        int al, off, tsz;
12591346         int noff;
 12601347 
 12611348         al = talign( p->stype, p->sizoff );
     
 !
12881375 
 12891376         *poff = noff;
 12901377         return(0);
<>1291 -        }
  1378+}
12921379 
<>1293 -falloc( p, w, new, pty )  register struct symtab *p; NODE *pty; {
 1294 -        /* allocate a field of width w */
 1295 -        /* new is 0 if new entry, 1 if redefinition, -1 if alignment */
  1380+/*
  1381+ * allocate a field of width w
  1382+ * new is 0 if new entry, 1 if redefinition, -1 if alignment
  1383+ */
  1384+int
  1385+falloc(struct symtab *p, int w, int new, NODE *pty)
  1386+{
  1387+        int al,sz,type;
12961388 
<>1297 -        register al,sz,type;
 1298 -
12991389         type = (new<0)? pty->in.type : p->stype;
 13001390 
 13011391         /* this must be fixed to use the current type in alignments */
     
 !
13771467         p->stype = type;
 13781468         fldty( p );
 13791469         return(0);
<>1380 -        }
  1470+}
13811471 
<>1382 -nidcl( p ) NODE *p; { /* handle unitialized declarations */
 1383 -        /* assumed to be not functions */
 1384 -        register class;
 1385 -        register commflag/* flag for labelled common declarations */
  1472+/*
  1473+ * handle unitialized declarations
  1474+ * assumed to be not functions
  1475+ */
  1476+void
  1477+nidcl(NODE *p)
  1478+{
  1479+        int class;
  1480+        int commflag/* flag for labelled common declarations */
13861481 
 13871482         commflag = 0;
 13881483 
     
 !
14141509         if( class==EXTDEF || class==STATIC )
 14151510 #else
 14161511         if (class==STATIC) {
<>1417 -                register struct symtab *s = &stab[p->tn.rval];
  1512+                struct symtab *s = &stab[p->tn.rval];
14181513                 extern int stabLCSYM;
 14191514                 int sz = tsize(s->stype, s->dimoff, s->sizoff)/SZCHAR;
 14201515                 
     
 !
14331528                 endinit();
 14341529                 }
 14351530         if( commflag ) commdec( p->tn.rval );
<>1436 -        }
  1531+}
14371532 
 14381533 TWORD
 14391534 types( t1, t2, t3 ) TWORD t1, t2, t3; {
 14401535         /* return a basic type from basic types t1, t2, and t3 */
 14411536 
 14421537         TWORD t[3], noun, adj, unsg;
<>1443 -        register i;
  1538+        int i;
14441539 
 14451540         t[0] = t1;
 14461541         t[1] = t2;
     
 !
14991594 tymerge( typ, idp ) NODE *typ, *idp; {
 15001595         /* merge type typ with identifier idp  */
 15011596 
<>1502 -        register unsigned t;
 1503 -        register i;
 1504 -        extern int eprint();
  1597+        unsigned int t;
  1598+        int i;
15051599 
 15061600         if( typ->in.op != TYPE ) cerror( "tymerge: arg 1" );
 15071601         if(idp == NIL ) return( NIL );
     
 !
15301624         return( idp );
 15311625         }
 15321626 
<>1533 -tyreduce( p ) register NODE *p; {
  1627+/*
  1628+ * build a type, and stash away dimensions, from a parse tree of the declaration
  1629+ * the type is build top down, the dimensions bottom up
  1630+ */
  1631+void
  1632+tyreduce(NODE *p)
  1633+{
  1634+        int o, temp;
  1635+        unsigned int t;
15341636 
<>1535 -        /* build a type, and stash away dimensions, from a parse tree of the declaration */
 1536 -        /* the type is build top down, the dimensions bottom up */
 1537 -        register o, temp;
 1538 -        register unsigned t;
 1539 -
15401637         o = p->in.op;
 15411638         p->in.op = FREE;
 15421639 
     
 !
15621659 
 15631660         }
 15641661 
<>1565 -fixtype( p, class ) register NODE *p; {
 1566 -        register unsigned t, type;
 1567 -        register mod1, mod2;
  1662+void
  1663+fixtype(NODE *p, int class)
  1664+{
  1665+        unsigned int t, type;
  1666+        int mod1, mod2;
15681667         /* fix up the types, and check for legality */
 15691668 
 15701669         if( (type = p->in.type) == UNDEF ) return;
<>1571 -        if( mod2 = (type&TMASK) ){
  1670+        if ((mod2 = (type&TMASK))) {
15721671                 t = DECREF(type);
 15731672                 while( mod1=mod2, mod2 = (t&TMASK) ){
 15741673                         if( mod1 == ARY && mod2 == FTN ){
     
 !
16121711                 type = INCREF(type);
 16131712                 }
 16141713         p->in.type = type;
<>1615 -        }
  1714+}
16161715 
<>1617 -uclass( class ) register class; {
 1618 -        /* give undefined version of class */
 1619 -        if( class == SNULL ) return( EXTERN );
 1620 -        else if( class == STATIC ) return( USTATIC );
 1621 -        else if( class == FORTRAN ) return( UFORTRAN );
 1622 -        else return( class );
 1623 -        }
  1716+/*
  1717+ * give undefined version of class
  1718+ */
  1719+int
  1720+uclass(int class)
  1721+{
  1722+        if (class == SNULL)
  1723+                return(EXTERN);
  1724+        else if (class == STATIC)
  1725+                return(USTATIC);
  1726+        else if (class == FORTRAN)
  1727+                return(UFORTRAN);
  1728+        else
  1729+                return(class);
  1730+}
16241731 
<>1625 -fixclass( class, type ) TWORD type; {
 1626 -
  1732+int
  1733+fixclass(int class, TWORD type)
  1734+{
16271735         /* first, fix null class */
<>1628 -
16291736         if( class == SNULL ){
 16301737                 if( instruct&INSTRUCT ) class = MOS;
 16311738                 else if( instruct&INUNION ) class = MOU;
     
 !
17191826                 cerror( "illegal class: %d", class );
 17201827                 /* NOTREACHED */
 17211828 
<>1722 -                }
17231829         }
<> 1830+        return 0; /* XXX */
  1831+}
17241832 
<> 1833+/*
  1834+ * locate a symbol table entry for
  1835+ * an occurrence of a nonunique structure member name
  1836+ * or field
  1837+ */
17251838 struct symtab *
<>1726 -mknonuniq(idindex) int *idindex; {/* locate a symbol table entry for */
 1727 -        /* an occurrence of a nonunique structure member name */
 1728 -        /* or field */
 1729 -        register i;
 1730 -        register struct symtab * sp;
  1839+mknonuniq(int *idindex)
  1840+{
  1841+        int i;
  1842+        struct symtab * sp;
17311843         char *q;
 17321844 
 17331845         sp = & stab[ i= *idindex ]; /* position search at old entry */
     
 !
17591871                 }
 17601872 #endif
 17611873         return ( sp );
<>1762 -        }
  1874+}
17631875 
<>1764 -lookup( name, s) char *name; {
 1765 -        /* look up name: must agree with s w.r.t. STAG, SMOS and SHIDDEN */
 1766 -
 1767 -        register char *p, *q;
  1876+/*
  1877+ * look up name: must agree with s w.r.t. STAG, SMOS and SHIDDEN
  1878+ */
  1879+int
  1880+lookup(char *name, int s)
  1881+{
  1882+        char *p, *q;
17681883         int i, ii;
 17691884 #ifndef FLEXNAMES
 17701885         int j;
 17711886 #endif
<>1772 -        register struct symtab *sp;
  1887+        struct symtab *sp;
17731888 
 17741889         /* compute initial hash index */
 17751890 # ifndef BUG1
     
 !
18301945 #ifndef checkst
 18311946 /* if not debugging, make checkst a macro */
 18321947 checkst(lev){
<>1833 -        register int s, i, j;
 1834 -        register struct symtab *p, *q;
  1948+        int s, i, j;
  1949+        struct symtab *p, *q;
18351950 
 18361951         for( i=0, p=stab; i<SYMTSZ; ++i, ++p ){
 18371952                 if( p->stype == TNULL ) continue;
     
 !
18561971         }
 18571972 #endif
 18581973 
<> 1974+/*
  1975+ * look up p again, and see where it lies
  1976+ */
18591977 struct symtab *
<>1860 -relook(p) register struct symtab *p;/* look up p again, and see where it lies */
  1978+relook(struct symtab *p)
  1979+{
  1980+        struct symtab *q;
18611981 
<>1862 -        register struct symtab *q;
 1863 -
18641982         /* I'm not sure that this handles towers of several hidden definitions in all cases */
 18651983         q = &stab[lookup( p->sname, p->sflags&(STAG|SMOS|SHIDDEN) )];
 18661984         /* make relook always point to either p or an empty cell */
     
 !
18731991                 if( ++q >= &stab[SYMTSZ] ) q=stab;
 18741992                 }
 18751993         return(q);
<>1876 -        }
  1994+}
18771995 
<>1878 -clearst( lev ) register int lev; {
 1879 -        register struct symtab *p, *q;
 1880 -        register int temp;
  1996+void
  1997+clearst(int lev)
  1998+{
  1999+        struct symtab *p, *q;
  2000+        int temp;
18812001         struct symtab *clist = 0;
 18822002 
 18832003         temp = lineno;
     
 !
19222042         /* step 2: fix any mishashed entries */
 19232043         p = clist;
 19242044         while( p ){
<>1925 -                register struct symtab *next, **t, *r;
  2045+                struct symtab *next, **t, *r;
19262046 
 19272047                 q = p;
 19282048                 next = p->snext;
     
 !
19312051                         if( q == p || q->stype == TNULL )break;
 19322052                         if( (r = relook(q)) != q ) {
 19332053                                 /* move q in schain list */
<>1934 -                                t = &schain[q->slevel];
  2054+                                t = &schain[(int)q->slevel];
19352055                                 while( *t && *t != q )
 19362056                                         t = &(*t)->snext;
 19372057                                 if( *t )
     
 !
19472067 
 19482068         lineno = temp;
 19492069         aoend();
<>1950 -        }
  2070+}
19512071 
<>1952 -hide( p ) register struct symtab *p; {
 1953 -        register struct symtab *q;
  2072+int
  2073+hide(struct symtab *p)
  2074+{
  2075+        struct symtab *q;
19542076         for( q=p+1; ; ++q ){
 19552077                 if( q >= &stab[SYMTSZ] ) q = stab;
 19562078                 if( q == p ) cerror( "symbol table full" );
     
 !
19682090         if( ddebug ) printf( "  %d hidden in %d\n", p-stab, q-stab );
 19692091 # endif
 19702092         return( idname = q-stab );
<>1971 -        }
  2093+}
19722094 
<>1973 -unhide( p ) register struct symtab *p; {
 1974 -        register struct symtab *q;
 1975 -        register s;
  2095+void
  2096+unhide(struct symtab *p)
  2097+{
  2098+        struct symtab *q;
  2099+        int s;
19762100 
 19772101         s = p->sflags & (SMOS|STAG);
 19782102         q = p;
     
 !
19862110 
 19872111                 if( (q->sflags&(SMOS|STAG)) == s ){
 19882112 #ifndef FLEXNAMES
<>1989 -                        register j;
  2113+                        int j;
<_19902114                         for( j =0; j<NCHNAM; ++j ) if( p->sname[j] != q->sname[j] ) break;
 19912115                         if( j == NCHNAM ){ /* found the name */
 19922116 #else
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-10-31 05:54 +0100