X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=test%2Fref%2Fyacc2.c;h=3b4819c55318ac59180110ac95f1acc1249b229d;hb=74455508314bc2b007e812ec5f9429496b9fbd5f;hp=c62fca34aaa188667c81557af2f7d655b4feae3b;hpb=0b186407f1117529f0f6902569f9d24bc8b1b979;p=cc65 diff --git a/test/ref/yacc2.c b/test/ref/yacc2.c index c62fca34a..3b4819c55 100644 --- a/test/ref/yacc2.c +++ b/test/ref/yacc2.c @@ -5,108 +5,110 @@ !!AUTHOR!! Groepaz/Hitmen */ +#include + # define YYTYPE char struct yywork { - YYTYPE verify, advance; + YYTYPE verify, advance; } yycrank[] = { - {0,0}, {0,0}, {1,3}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {1,4}, {1,3}, - {0,0}, {0,0}, {0,0}, {0,0}, - - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {1,3}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {1,4}, {1,3}, + {0,0}, {0,0}, {0,0}, {0,0}, + + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {1,5}, {5,7}, {5,7}, - {5,7}, {5,7}, {5,7}, {5,7}, - {5,7}, {5,7}, {5,7}, {5,7}, - {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {1,5}, {5,7}, {5,7}, + {5,7}, {5,7}, {5,7}, {5,7}, + {5,7}, {5,7}, {5,7}, {5,7}, + {0,0}, {0,0}, {0,0}, {0,0}, /* 0x40 */ - {0,0}, {0,0}, {1,6}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {1,6}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, + {0,0}, {0,0}, {0,0}, {0,0}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {0,0}, {0,0}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {0,0}, {0,0}, - {0,0}, {0,0}, {6,8}, {0,0}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, + {0,0}, {0,0}, {6,8}, {0,0}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, /* 0x80 */ - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {0,0}, {0,0}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {0,0}, {0,0}, #ifdef CHARSETHACK - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {0,0}, {0,0}, /* 0xc0 */ - {0,0}, {0,0}, {1,6}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {6,8}, {6,8}, {6,8}, - {6,8}, {0,0}, {0,0}, {0,0}, + {0,0}, {0,0}, {1,6}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {6,8}, {6,8}, {6,8}, + {6,8}, {0,0}, {0,0}, {0,0}, #endif - {0,0} + {0,0} }; struct yywork *yytop = yycrank+255; int yyvstop[] = { - 0,4,0,3,4,0,2,4,0,1,4,0,2,0,1,0,0 + 0,4,0,3,4,0,2,4,0,1,4,0,2,0,1,0,0 }; struct yysvf { - struct yywork *yystoff; - struct yysvf *yyother; - int *yystops; + struct yywork *yystoff; + struct yysvf *yyother; + int *yystops; }; struct yysvf yysvec[] = { - {0, 0, 0}, - {yycrank+-1, 0, 0}, - {yycrank+0, yysvec+1, 0}, - {yycrank+0, 0, yyvstop+1}, - {yycrank+0, 0, yyvstop+3}, - {yycrank+2, 0, yyvstop+6}, - {yycrank+19, 0, yyvstop+9}, - {yycrank+0, yysvec+5, yyvstop+12}, - {yycrank+0, yysvec+6, yyvstop+14}, - {0, 0, 0} + {0, 0, 0}, + {yycrank+-1, 0, 0}, + {yycrank+0, yysvec+1, 0}, + {yycrank+0, 0, yyvstop+1}, + {yycrank+0, 0, yyvstop+3}, + {yycrank+2, 0, yyvstop+6}, + {yycrank+19, 0, yyvstop+9}, + {yycrank+0, yysvec+5, yyvstop+12}, + {yycrank+0, yysvec+6, yyvstop+14}, + {0, 0, 0} }; #if 0 @@ -114,7 +116,7 @@ struct yysvf yysvec[] = // *yylastch++ = yych = input(); void subtest1(void) { - *yylastch++ = yych = input(); + *yylastch++ = yych = input(); } #endif @@ -123,26 +125,26 @@ static int bog=1234; #if 0 void bogus(void) { - bog*=0x1234; + bog*=0x1234; } #else -#define bogus() bog+=0x1234 +#define bogus() bog+=0x1234 #endif #if 1 // yyt = yyt + yych; void subtest2(void) { - register struct yywork *yyt; - int yych; + register struct yywork *yyt; + int yych; - yyt=yycrank; - yych=10; + yyt=yycrank; + yych=10; - bogus(); - yyt = yyt + yych; + bogus(); + yyt = yyt + yych; - printf("yyt: %d %d\n",yyt->verify,yyt->advance); + printf("yyt: %d %d\n",yyt->verify,yyt->advance); } #endif @@ -150,21 +152,21 @@ void subtest2(void) // if(yyt <= yytop && yyt->verify+yysvec == yystate) void subtest3(void) { - register struct yywork *yyt; - register struct yysvf *yystate; - - yyt=yycrank; - yystate=yysvec; - - bogus(); - if(yyt <= yytop && yyt->verify+yysvec == yystate) - { - printf("if ok %d %d\n",yyt->verify,yyt->advance); - } - else - { - printf("if not ok %d %d\n",yyt->verify,yyt->advance); - } + register struct yywork *yyt; + register struct yysvf *yystate; + + yyt=yycrank; + yystate=yysvec; + + bogus(); + if(yyt <= yytop && yyt->verify+yysvec == yystate) + { + printf("if ok %d %d\n",yyt->verify,yyt->advance); + } + else + { + printf("if not ok %d %d\n",yyt->verify,yyt->advance); + } } #endif @@ -177,19 +179,19 @@ short yyr2[]= // yyps -= yyr2[yyn]; void subtest4(void) { - register short *yyps, yyn; + register short *yyps, yyn; - yyps=0x8004; - yyn=0; + yyps=0x8004; + yyn=0; - while(yyn<14) - { - bogus(); - yyps -= yyr2[yyn]; + while(yyn<14) + { + bogus(); + yyps -= yyr2[yyn]; - yyn++; - } - printf("yyps: %04x\n",yyps); + yyn++; + } + printf("yyps: %04x\n",yyps); } #if 1 @@ -197,21 +199,21 @@ void subtest4(void) int yylookret=10; yylook() { - yylookret--; - return yylookret; + yylookret--; + return yylookret; } // while((nstr = yylook()) >= 0) void subtest5(void) { - int nstr; - - bogus(); - while((nstr = yylook()) >= 0) - { - printf("nstr: %04x\n",nstr); - bogus(); - } + int nstr; + + bogus(); + while((nstr = yylook()) >= 0) + { + printf("nstr: %04x\n",nstr); + bogus(); + } } #endif