Annotation of coherent/d/usr/lib/scn/obj386/y.tab.c, revision 1.1.1.1

1.1       root        1: 
                      2: #line 1 "../scn.y"
                      3: 
                      4: #include <scnbld.h>
                      5: 
                      6: clump *clumps, *lastc, *thisc;
                      7: loc *locs, *last, *this;
                      8: 
                      9: /*
                     10:  * Generate a unique name.
                     11:  */
                     12: static char *
                     13: genname()
                     14: {
                     15:        char buf[20];
                     16:        static int i = 0;
                     17: 
                     18:        sprintf(buf, "L%04d", ++i);
                     19:        return(newcpy(buf));
                     20: }
                     21: 
                     22: 
                     23: #include "y.tab.h"
                     24: #define YYCLEARIN yychar = -1000
                     25: #define YYERROK yyerrflag = 0
                     26: extern int yychar;
                     27: extern short yyerrflag;
                     28: #ifndef YYMAXDEPTH
                     29: #define YYMAXDEPTH 150
                     30: #endif
                     31: YYSTYPE yyval, yylval;
                     32: #ifdef YYTNAMES
                     33: readonly struct yytname yytnames[18] =
                     34: {
                     35:        "$end", -1, 
                     36:        "error", -2, 
                     37:        "NAME", 256, 
                     38:        "STRING", 257, 
                     39:        "NUMBER", 258, 
                     40:        "EXT", 259, 
                     41:        "RONLY", 260, 
                     42:        "LONG", 261, 
                     43:        "DEFAULT", 262, 
                     44:        "SKIP", 263, 
                     45:        "GROUP", 264, 
                     46:        "HELP", 265, 
                     47:        "VERIFY", 266, 
                     48:        "NL", 267, 
                     49:        "DO", 268, 
                     50:        "DONE", 269, 
                     51:        "DESIG", 270, 
                     52:        NULL
                     53: } ;
                     54: #endif
                     55: #include <action.h>
                     56: readonly unsigned char yypdnt[25] = {
                     57: 0, 1, 1, 1, 2, 2, 2, 4,
                     58: 3, 3, 3, 3, 5, 5, 5, 6,
                     59: 6, 6, 6, 6, 6, 6, 6, 6,
                     60: 6 
                     61: };
                     62: readonly unsigned char yypn[25] = {
                     63: 2, 1, 2, 0, 2, 1, 2, 0,
                     64: 4, 2, 3, 1, 1, 2, 0, 1,
                     65: 1, 1, 2, 2, 2, 2, 2, 2,
                     66: 2 
                     67: };
                     68: readonly unsigned char yypgo[7] = {
                     69: 0, 0, 2, 6, 8, 10, 12 
                     70: };
                     71: readonly unsigned int yygo[16] = {
                     72: YYOTHERS, 0x7, 0x7, 0xF, YYOTHERS, 0x8, YYOTHERS, 0x9,
                     73: YYOTHERS, 0x11, YYOTHERS, 0x1A, 0x1A, 0x23, YYOTHERS, 0x1B
                     74: };
                     75: readonly unsigned char yypa[36] = {
                     76: 0, 14, 18, 22, 24, 28, 30, 34,
                     77: 48, 50, 54, 56, 58, 62, 64, 68,
                     78: 70, 72, 88, 90, 92, 94, 96, 102,
                     79: 108, 114, 118, 134, 136, 138, 140, 142,
                     80: 144, 146, 148, 150 
                     81: };
                     82: readonly unsigned int yyact[152] = {
                     83: 0x2, 0x100, 0x3, 0x10B, 0x4, 0x10C, 0x5, 0x10D,
                     84: 0x6, 0x10E, 0x2003, YYEOFVAL, 0x1, YYOTHERS, 0xA, 0x10B,
                     85: 0x6000, YYOTHERS, 0xB, 0x102, 0x6000, YYOTHERS, 0x2005, YYOTHERS,
                     86: 0xC, 0x102, 0x6000, YYOTHERS, 0x200B, YYOTHERS, 0xD, 0x101,
                     87: 0x6000, YYOTHERS, 0xE, YYEOFVAL, 0x2, 0x100, 0x3, 0x10B,
                     88: 0x4, 0x10C, 0x5, 0x10D, 0x6, 0x10E, 0x1, YYOTHERS,
                     89: 0x2001, YYOTHERS, 0x10, 0x10B, 0x6000, YYOTHERS, 0x2006, YYOTHERS,
                     90: 0x2007, YYOTHERS, 0x12, 0x100, 0x6000, YYOTHERS, 0x2009, YYOTHERS,
                     91: 0x4000, YYEOFVAL, 0x6000, YYOTHERS, 0x2002, YYOTHERS, 0x2004, YYOTHERS,
                     92: 0x13, 0x103, 0x14, 0x104, 0x15, 0x105, 0x16, 0x106,
                     93: 0x17, 0x107, 0x18, 0x109, 0x19, 0x10A, 0x200E, YYOTHERS,
                     94: 0x200A, YYOTHERS, 0x2011, YYOTHERS, 0x2010, YYOTHERS, 0x200F, YYOTHERS,
                     95: 0x1C, 0x100, 0x1D, 0x101, 0x6000, YYOTHERS, 0x1E, 0x102,
                     96: 0x1F, 0x108, 0x6000, YYOTHERS, 0x20, 0x100, 0x21, 0x101,
                     97: 0x6000, YYOTHERS, 0x22, 0x100, 0x6000, YYOTHERS, 0x13, 0x103,
                     98: 0x14, 0x104, 0x15, 0x105, 0x16, 0x106, 0x17, 0x107,
                     99: 0x18, 0x109, 0x19, 0x10A, 0x2008, YYOTHERS, 0x200C, YYOTHERS,
                    100: 0x2013, YYOTHERS, 0x2012, YYOTHERS, 0x2016, YYOTHERS, 0x2018, YYOTHERS,
                    101: 0x2015, YYOTHERS, 0x2014, YYOTHERS, 0x2017, YYOTHERS, 0x200D, YYOTHERS
                    102: };
                    103: #define YYNOCHAR (-1000)
                    104: #define        yyerrok yyerrflag=0
                    105: #define        yyclearin       yylval=YYNOCHAR
                    106: int yystack[YYMAXDEPTH];
                    107: YYSTYPE yyvstack[YYMAXDEPTH], *yyv;
                    108: int yychar;
                    109: 
                    110: #ifdef YYDEBUG
                    111: int yydebug = 1;       /* No sir, not in the BSS */
                    112: #include <stdio.h>
                    113: #endif
                    114: 
                    115: short yyerrflag;
                    116: int *yys;
                    117: 
                    118: yyparse()
                    119: {
                    120:        register YYSTYPE *yypvt;
                    121:        int act;
                    122:        register unsigned *ip, yystate;
                    123:        int pno;
                    124:        yystate = 0;
                    125:        yychar = YYNOCHAR;
                    126:        yyv = &yyvstack[-1];
                    127:        yys = &yystack[-1];
                    128: 
                    129: stack:
                    130:        if( ++yys >= &yystack[YYMAXDEPTH] ) {
                    131:                write(2, "Stack overflow\n", 15);
                    132:                exit(1);
                    133:        }
                    134:        *yys = yystate;
                    135:        *++yyv = yyval;
                    136: #ifdef YYDEBUG
                    137:        if( yydebug )
                    138:                fprintf(stdout, "Stack state %d, char %d\n", yystate, yychar);
                    139: #endif
                    140: 
                    141: read:
                    142:        ip = &yyact[yypa[yystate]];
                    143:        if( ip[1] != YYNOCHAR ) {
                    144:                if( yychar == YYNOCHAR ) {
                    145:                        yychar = yylex();
                    146: #ifdef YYDEBUG
                    147:                        if( yydebug )
                    148:                                fprintf(stdout, "lex read char %d, val %d\n", yychar, yylval);
                    149: #endif
                    150:                }
                    151:                while (ip[1]!=YYNOCHAR) {
                    152:                        if (ip[1]==yychar)
                    153:                                break;
                    154:                        ip += 2;
                    155:                }
                    156:        }
                    157:        act = ip[0];
                    158:        switch( act>>YYACTSH ) {
                    159:        case YYSHIFTACT:
                    160:                if( ip[1]==YYNOCHAR )
                    161:                        goto YYerract;
                    162:                if( yychar != -1 )
                    163:                        yychar = YYNOCHAR; /* dont throw away EOF */
                    164:                yystate = act&YYAMASK;
                    165:                yyval = yylval;
                    166: #ifdef YYDEBUG
                    167:                if( yydebug )
                    168:                        fprintf(stdout, "shift %d\n", yystate);
                    169: #endif
                    170:                if( yyerrflag )
                    171:                        --yyerrflag;
                    172:                goto stack;
                    173: 
                    174:        case YYACCEPTACT:
                    175: #ifdef YYDEBUG
                    176:                if( yydebug )
                    177:                        fprintf(stdout, "accept\n");
                    178: #endif
                    179:                return(0);
                    180: 
                    181:        case YYERRACT:
                    182:        YYerract:
                    183:                switch (yyerrflag) {
                    184:                case 0:
                    185:                        yyerror("Syntax error");
                    186: 
                    187:                case 1:
                    188:                case 2:
                    189: 
                    190:                        yyerrflag = 3;
                    191:                        while( yys >= & yystack[0] ) {
                    192:                                ip = &yyact[yypa[*yys]];
                    193:                                while( ip[1]!=YYNOCHAR )
                    194:                                        ip += 2;
                    195:                                if( (*ip&~YYAMASK) == (YYSHIFTACT<<YYACTSH) ) {
                    196:                                        yystate = *ip&YYAMASK;
                    197:                                        goto stack;
                    198:                                }
                    199: #ifdef YYDEBUG
                    200:                                if( yydebug )
                    201:                                        fprintf(stderr, "error recovery leaves state %d, uncovers %d\n", *yys, yys[-1]);
                    202: #endif
                    203:                                yys--;
                    204:                                yyv--;
                    205:                        }
                    206: #ifdef YYDEBUG
                    207:                        if( yydebug )
                    208:                                fprintf(stderr, "no shift on error; abort\n");
                    209: #endif
                    210:                        return(1);
                    211: 
                    212:                case 3:
                    213: #ifdef YYDEBUG
                    214:                        if( yydebug )
                    215:                                fprintf(stderr, "Error recovery clobbers char %o\n", yychar);
                    216: #endif
                    217:                        if( yychar==YYEOFVAL )
                    218:                                return(1);
                    219:                        yychar = YYNOCHAR;
                    220:                        goto read;
                    221:                }
                    222: 
                    223:        case YYREDACT:
                    224:                pno = act&YYAMASK;
                    225: #ifdef YYDEBUG
                    226:                if( yydebug )
                    227:                        fprintf(stdout, "reduce %d\n", pno);
                    228: #endif
                    229:                yypvt = yyv;
                    230:                yyv -= yypn[pno];
                    231:                yys -= yypn[pno];
                    232:                yyval = yyv[1];
                    233:                switch(pno) {
                    234: 
                    235: case 6: {
                    236: 
                    237: #line 50 "../scn.y"
                    238: 
                    239:                yyerrok; 
                    240:        }break;
                    241: 
                    242: case 7: {
                    243: 
                    244: #line 54 "../scn.y"
                    245: 
                    246:                if (0 >= yypvt[0].val)
                    247:                        yyerror("Invalid field size");
                    248:                this = alloc(sizeof(*this));
                    249:                if (NULL == locs)
                    250:                        last = locs = this;
                    251:                else
                    252:                        last = last->next = this;
                    253:                        
                    254:                this->field = yypvt[-1].string;
                    255:                this->len = yypvt[0].val; 
                    256: 
                    257:                if ((NULL != thisc) && (!thisc->count++))
                    258:                        thisc->from = this;
                    259:        }break;
                    260: 
                    261: case 9: {
                    262: 
                    263: #line 70 "../scn.y"
                    264: 
                    265:                extern char fieldDesig;
                    266: 
                    267:                fieldDesig = yypvt[0].string[1];
                    268:        }break;
                    269: 
                    270: case 10: {
                    271: 
                    272: #line 76 "../scn.y"
                    273: 
                    274:                if (NULL != thisc)
                    275:                        yyerror("Nested do statements");
                    276:                if (0 >= yypvt[-1].val)
                    277:                        yyerror("Invalid repeat count");
                    278: 
                    279:                thisc = alloc(sizeof(*thisc));
                    280:                if (NULL == clumps)
                    281:                        lastc = clumps = thisc;
                    282:                else
                    283:                        lastc = lastc->next = thisc;
                    284: 
                    285:                thisc->times = yypvt[-1].val;
                    286: 
                    287:                fprintf(ohp, "#define %s %d\n", yypvt[0].string, yypvt[-1].val);
                    288:        }break;
                    289: 
                    290: case 11: {
                    291: 
                    292: #line 93 "../scn.y"
                    293: 
                    294:                if (NULL == thisc)
                    295:                        yyerror("Unmatched done statement");
                    296:                thisc = NULL;
                    297:        }break;
                    298: 
                    299: case 15: {
                    300: 
                    301: #line 101 "../scn.y"
                    302:  this->flags |= LONGFIELD; }break;
                    303: 
                    304: case 16: {
                    305: 
                    306: #line 102 "../scn.y"
                    307:  this->flags |= READONLY; }break;
                    308: 
                    309: case 17: {
                    310: 
                    311: #line 103 "../scn.y"
                    312:  this->flags |= EXTERNAL; }break;
                    313: 
                    314: case 18: {
                    315: 
                    316: #line 104 "../scn.y"
                    317: 
                    318:                if (NULL != this->Default)
                    319:                        yyerror("Default already set");
                    320:                this->Default = genname();
                    321:                fprintf(ofp, "static char %s[] = %s;\n", this->Default, yypvt[0].string);
                    322:                }break;
                    323: 
                    324: case 19: {
                    325: 
                    326: #line 110 "../scn.y"
                    327: 
                    328:                if (NULL != this->Default)
                    329:                        yyerror("Default already set");
                    330:                this->Default = yypvt[0].string;
                    331:                }break;
                    332: 
                    333: case 20: {
                    334: 
                    335: #line 115 "../scn.y"
                    336: 
                    337:                if (NULL != this->help)
                    338:                        yyerror("Help already set");
                    339:                this->help = genname();
                    340:                fprintf(ofp, "static char %s[] = %s;\n", this->help, yypvt[0].string);
                    341:                }break;
                    342: 
                    343: case 21: {
                    344: 
                    345: #line 121 "../scn.y"
                    346: 
                    347:                if (NULL != this->help)
                    348:                        yyerror("Help already set");
                    349:                this->help = yypvt[0].string;
                    350:                }break;
                    351: 
                    352: case 22: {
                    353: 
                    354: #line 126 "../scn.y"
                    355: 
                    356:                if (0 >= yypvt[0].val || 254 < yypvt[0].val)
                    357:                        yyerror("Invalid skip number");
                    358:                if (this->skipf)
                    359:                        yyerror("Skip factor already set");
                    360:                this->skipf = yypvt[0].val;
                    361:                }break;
                    362: 
                    363: case 23: {
                    364: 
                    365: #line 133 "../scn.y"
                    366: 
                    367:                if (NULL != this->verify)
                    368:                        yyerror("Verify already set");
                    369:                this->verify = yypvt[0].string;
                    370:        }break;
                    371: 
                    372: case 24: {
                    373: 
                    374: #line 138 "../scn.y"
                    375: 
                    376:                if (this->skipf)
                    377:                        yyerror("Skip factor already set");
                    378:                if (NULL == thisc)
                    379:                        yyerror("group must be in do");
                    380:                else
                    381:                        this->skipf = 255;
                    382:                }break;
                    383: 
                    384:                }
                    385:                ip = &yygo[ yypgo[yypdnt[pno]] ];
                    386:                while( *ip!=*yys && *ip!=YYNOCHAR )
                    387:                        ip += 2;
                    388:                yystate = ip[1];
                    389:                goto stack;
                    390:        }
                    391: }
                    392: 
                    393: 
                    394: 
                    395: 

unix.superglobalmegacorp.com

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