Annotation of researchv9/cmd/sun/pcc/y.tab.c, revision 1.1

1.1     ! root        1: 
        !             2: # line 2 "../mip/cgram.y"
        !             3: #ifndef lint
        !             4: static char sccsid[] = "@(#)cgram.y 1.1 86/02/03 SMI"; /* from UCB X.X XX/XX/XX */
        !             5: #endif
        !             6: # define NAME 2
        !             7: # define STRING 3
        !             8: # define ICON 4
        !             9: # define FCON 5
        !            10: # define PLUS 6
        !            11: # define MINUS 8
        !            12: # define MUL 11
        !            13: # define AND 14
        !            14: # define OR 17
        !            15: # define ER 19
        !            16: # define QUEST 21
        !            17: # define COLON 22
        !            18: # define ANDAND 23
        !            19: # define OROR 24
        !            20: # define ASOP 25
        !            21: # define RELOP 26
        !            22: # define EQUOP 27
        !            23: # define DIVOP 28
        !            24: # define SHIFTOP 29
        !            25: # define INCOP 30
        !            26: # define UNOP 31
        !            27: # define STROP 32
        !            28: # define TYPE 33
        !            29: # define CLASS 34
        !            30: # define STRUCT 35
        !            31: # define RETURN 36
        !            32: # define GOTO 37
        !            33: # define IF 38
        !            34: # define ELSE 39
        !            35: # define SWITCH 40
        !            36: # define BREAK 41
        !            37: # define CONTINUE 42
        !            38: # define WHILE 43
        !            39: # define DO 44
        !            40: # define FOR 45
        !            41: # define DEFAULT 46
        !            42: # define CASE 47
        !            43: # define SIZEOF 48
        !            44: # define ENUM 49
        !            45: # define LP 50
        !            46: # define RP 51
        !            47: # define LC 52
        !            48: # define RC 53
        !            49: # define LB 54
        !            50: # define RB 55
        !            51: # define CM 56
        !            52: # define SM 57
        !            53: # define ASSIGN 58
        !            54: # define ASM 112
        !            55: 
        !            56: # line 116 "../mip/cgram.y"
        !            57: # include "cpass1.h"
        !            58: # define yyerror( x ) ccerror( x, yychar )
        !            59: #define yyclearin yychar = -1
        !            60: #define yyerrok yyerrflag = 0
        !            61: extern int yychar;
        !            62: extern short yyerrflag;
        !            63: #ifndef YYMAXDEPTH
        !            64: #define YYMAXDEPTH 150
        !            65: #endif
        !            66: YYSTYPE yylval, yyval;
        !            67: 
        !            68: # line 136 "../mip/cgram.y"
        !            69:        static int fake = 0;
        !            70: #ifndef FLEXNAMES
        !            71:        static char fakename[NCHNAM+1];
        !            72: #else
        !            73:        static char fakename[24];
        !            74: #endif
        !            75:        static int noassign = 0;
        !            76:        extern int errline, lineno;
        !            77: # define YYERRCODE 256
        !            78: 
        !            79: # line 982 "../mip/cgram.y"
        !            80: 
        !            81: 
        !            82: NODE *
        !            83: mkty( t, d, s ) unsigned t; {
        !            84:        return( block( TYPE, NIL, NIL, t, d, s ) );
        !            85:        }
        !            86: 
        !            87: NODE *
        !            88: bdty( op, p, v ) NODE *p; {
        !            89:        register NODE *q;
        !            90: 
        !            91:        q = block( op, p, NIL, INT, 0, INT );
        !            92: 
        !            93:        switch( op ){
        !            94: 
        !            95:        case UNARY MUL:
        !            96:        case UNARY CALL:
        !            97:                break;
        !            98: 
        !            99:        case LB:
        !           100:                q->in.right = bcon(v);
        !           101:                break;
        !           102: 
        !           103:        case NAME:
        !           104:                q->tn.rval = v;
        !           105:                break;
        !           106: 
        !           107:        default:
        !           108:                cerror( "bad bdty" );
        !           109:                }
        !           110: 
        !           111:        return( q );
        !           112:        }
        !           113: 
        !           114: dstash( n )
        !           115: {
        !           116:     /* put n into the dimension table */
        !           117:     extern char *realloc();
        !           118: 
        !           119:     if( (unsigned)curdim % DIMTABSZ == 0 ) {
        !           120:        dimtab = (int*)realloc(dimtab, (curdim+DIMTABSZ)*sizeof(dimtab[0]));
        !           121:        if (dimtab == NULL) {
        !           122:            cerror("dimension table overflow");
        !           123:        }
        !           124:     }
        !           125:     dimtab[ curdim++ ] = n;
        !           126: }
        !           127: 
        !           128: savebc() {
        !           129:        if( psavbc > & asavbc[BCSZ-4 ] ){
        !           130:                cerror( "whiles, fors, etc. too deeply nested");
        !           131:                }
        !           132:        *psavbc++ = brklab;
        !           133:        *psavbc++ = contlab;
        !           134:        *psavbc++ = flostat;
        !           135:        *psavbc++ = swx;
        !           136:        flostat = 0;
        !           137:        }
        !           138: 
        !           139: resetbc(mask){
        !           140: 
        !           141:        swx = *--psavbc;
        !           142:        flostat = *--psavbc | (flostat&mask);
        !           143:        contlab = *--psavbc;
        !           144:        brklab = *--psavbc;
        !           145: 
        !           146:        }
        !           147: 
        !           148: #ifndef LINT
        !           149: savelineno(){
        !           150:        if( psavbc > & asavbc[BCSZ-1 ] ){
        !           151:                cerror( "whiles, fors, etc. too deeply nested");
        !           152:                }
        !           153:        *psavbc++ = lineno;
        !           154:        }
        !           155: 
        !           156: resetlineno(){
        !           157:        return  *--psavbc;
        !           158:        }
        !           159: #endif
        !           160: 
        !           161: addcase(p) NODE *p; { /* add case to switch */
        !           162: 
        !           163:        p = optim( p );  /* change enum to ints */
        !           164:        if( p->in.op != ICON ){
        !           165:                uerror( "non-constant case expression");
        !           166:                return;
        !           167:                }
        !           168:        if( swp == swtab ){
        !           169:                uerror( "case not in switch");
        !           170:                return;
        !           171:                }
        !           172:        if( swp >= &swtab[SWITSZ] ){
        !           173:                cerror( "switch table overflow");
        !           174:                }
        !           175:        swp->sval = p->tn.lval;
        !           176:        deflab( swp->slab = getlab() );
        !           177:        ++swp;
        !           178:        tfree(p);
        !           179:        }
        !           180: 
        !           181: adddef(){ /* add default case to switch */
        !           182:        if( swtab[swx].slab >= 0 ){
        !           183:                uerror( "duplicate default in switch");
        !           184:                return;
        !           185:                }
        !           186:        if( swp == swtab ){
        !           187:                uerror( "default not inside switch");
        !           188:                return;
        !           189:                }
        !           190:        deflab( swtab[swx].slab = getlab() );
        !           191:        }
        !           192: 
        !           193: swstart(){
        !           194:        /* begin a switch block */
        !           195:        if( swp >= &swtab[SWITSZ] ){
        !           196:                cerror( "switch table overflow");
        !           197:                }
        !           198:        swx = swp - swtab;
        !           199:        swp->slab = -1;
        !           200:        ++swp;
        !           201:        }
        !           202: 
        !           203: swend(){ /* end a switch block */
        !           204: 
        !           205:        register struct sw *swbeg, *p, *q, *r, *r1;
        !           206:        CONSZ temp;
        !           207:        int tempi;
        !           208: 
        !           209:        swbeg = &swtab[swx+1];
        !           210: 
        !           211:        /* sort */
        !           212: 
        !           213:        r1 = swbeg;
        !           214:        r = swp-1;
        !           215: 
        !           216:        while( swbeg < r ){
        !           217:                /* bubble largest to end */
        !           218:                for( q=swbeg; q<r; ++q ){
        !           219:                        if( q->sval > (q+1)->sval ){
        !           220:                                /* swap */
        !           221:                                r1 = q+1;
        !           222:                                temp = q->sval;
        !           223:                                q->sval = r1->sval;
        !           224:                                r1->sval = temp;
        !           225:                                tempi = q->slab;
        !           226:                                q->slab = r1->slab;
        !           227:                                r1->slab = tempi;
        !           228:                                }
        !           229:                        }
        !           230:                r = r1;
        !           231:                r1 = swbeg;
        !           232:                }
        !           233: 
        !           234:        /* it is now sorted */
        !           235: 
        !           236:        for( p = swbeg+1; p<swp; ++p ){
        !           237:                if( p->sval == (p-1)->sval ){
        !           238:                        uerror( "duplicate case in switch, %d", tempi=p->sval );
        !           239:                        return;
        !           240:                        }
        !           241:                }
        !           242: 
        !           243:        genswitch( swbeg-1, swp-swbeg );
        !           244:        swp = swbeg-1;
        !           245:        }
        !           246: short yyexca[] ={
        !           247: -1, 1,
        !           248:        0, -1,
        !           249:        2, 24,
        !           250:        11, 24,
        !           251:        50, 24,
        !           252:        57, 24,
        !           253:        -2, 0,
        !           254: -1, 21,
        !           255:        56, 84,
        !           256:        57, 84,
        !           257:        -2, 8,
        !           258: -1, 26,
        !           259:        56, 83,
        !           260:        57, 83,
        !           261:        -2, 81,
        !           262: -1, 28,
        !           263:        56, 87,
        !           264:        57, 87,
        !           265:        -2, 82,
        !           266: -1, 34,
        !           267:        52, 47,
        !           268:        -2, 45,
        !           269: -1, 36,
        !           270:        52, 39,
        !           271:        -2, 37,
        !           272: -1, 61,
        !           273:        53, 52,
        !           274:        57, 52,
        !           275:        -2, 0,
        !           276: -1, 115,
        !           277:        33, 19,
        !           278:        34, 19,
        !           279:        35, 19,
        !           280:        49, 19,
        !           281:        -2, 14,
        !           282: -1, 284,
        !           283:        57, 138,
        !           284:        -2, 0,
        !           285: -1, 289,
        !           286:        33, 17,
        !           287:        34, 17,
        !           288:        35, 17,
        !           289:        49, 17,
        !           290:        -2, 15,
        !           291: -1, 310,
        !           292:        33, 18,
        !           293:        34, 18,
        !           294:        35, 18,
        !           295:        49, 18,
        !           296:        -2, 16,
        !           297:        };
        !           298: # define YYNPROD 194

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.