1: # 2: #include "e.h" 3: # 4: int fromflg; /* removed by stan */ 5: # define CONTIG 257 6: # define QTEXT 258 7: # define SPACE 259 8: # define THIN 260 9: # define TAB 261 10: # define MATRIX 262 11: # define LCOL 263 12: # define CCOL 264 13: # define RCOL 265 14: # define COL 266 15: # define MARK 267 16: # define LINEUP 268 17: # define LPILE 269 18: # define PILE 270 19: # define CPILE 271 20: # define RPILE 272 21: # define ABOVE 273 22: # define DEFINE 274 23: # define TDEFINE 275 24: # define NDEFINE 276 25: # define DELIM 277 26: # define GSIZE 278 27: # define GFONT 279 28: # define INCLUDE 280 29: # define FROM 281 30: # define TO 282 31: # define OVER 283 32: # define SQRT 284 33: # define SUP 285 34: # define SUB 286 35: # define SIZE 287 36: # define FONT 288 37: # define ROMAN 289 38: # define ITALIC 290 39: # define BOLD 291 40: # define FAT 292 41: # define UP 293 42: # define DOWN 294 43: # define BACK 295 44: # define FWD 296 45: # define LEFT 297 46: # define RIGHT 298 47: # define DOT 299 48: # define DOTDOT 300 49: # define HAT 301 50: # define TILDE 302 51: # define BAR 303 52: # define UNDER 304 53: # define VEC 305 54: # define DYAD 306 55: #define yyclearin yychar = -1 56: #define yyerrok yyerrflag = 0 57: extern int yychar, yyerrflag; 58: #ifndef YYMAXDEPTH 59: #define YYMAXDEPTH 150 60: #endif 61: #ifndef YYSTYPE 62: #define YYSTYPE int 63: #endif 64: #ifndef YYVCOPY 65: #define YYVCOPY(x,y) x=y 66: #endif 67: YYSTYPE yylval, yyval; 68: # define YYERRCODE 256 69: 70: int yyexca[] { 71: -1, 1, 72: 0, -1, 73: -2, 0, 74: }; 75: # define YYNPROD 86 76: # 77: extern int yychar; 78: 79: int yylast 534; 80: yyact[]{ 81: 82: 32, 54, 55, 46, 141, 53, 52, 140, 139, 138, 83: 122, 121, 120, 53, 52, 118, 80, 81, 124, 61, 84: 63, 56, 62, 59, 60, 57, 58, 61, 63, 56, 85: 62, 59, 60, 57, 58, 109, 110, 111, 112, 130, 86: 129, 128, 32, 127, 113, 61, 63, 56, 62, 59, 87: 60, 57, 58, 78, 126, 72, 71, 70, 69, 79, 88: 48, 20, 84, 97, 2, 19, 18, 17, 51, 49, 89: 96, 16, 101, 15, 47, 14, 13, 12, 11, 73, 90: 104, 8, 7, 116, 32, 114, 82, 108, 107, 106, 91: 50, 83, 105, 103, 21, 44, 85, 1, 86, 87, 92: 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, 93: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94: 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 95: 0, 0, 0, 0, 34, 33, 35, 36, 37, 42, 96: 0, 98, 99, 100, 6, 45, 27, 30, 28, 29, 97: 80, 81, 119, 115, 0, 119, 119, 119, 119, 119, 98: 119, 10, 123, 119, 22, 26, 23, 24, 25, 9, 99: 39, 41, 40, 38, 31, 102, 34, 33, 35, 36, 100: 37, 42, 32, 133, 125, 117, 6, 45, 27, 30, 101: 28, 29, 109, 110, 111, 112, 80, 81, 134, 135, 102: 136, 137, 0, 10, 0, 0, 22, 26, 23, 24, 103: 25, 9, 39, 41, 40, 38, 31, 3, 34, 33, 104: 35, 36, 37, 42, 32, 0, 0, 0, 6, 5, 105: 27, 30, 28, 29, 0, 0, 0, 0, 0, 0, 106: 0, 0, 0, 0, 0, 10, 0, 0, 22, 26, 107: 23, 24, 25, 9, 39, 41, 40, 38, 31, 34, 108: 33, 35, 36, 37, 42, 0, 0, 0, 0, 6, 109: 45, 27, 30, 28, 29, 0, 0, 0, 0, 0, 110: 0, 0, 0, 0, 0, 0, 10, 0, 0, 22, 111: 26, 23, 24, 25, 9, 39, 41, 40, 38, 31, 112: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 113: 0, 0, 0, 0, 0, 0, 34, 33, 35, 36, 114: 37, 42, 0, 0, 0, 0, 6, 5, 27, 30, 115: 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 116: 0, 0, 0, 10, 0, 0, 22, 26, 23, 24, 117: 25, 9, 39, 41, 40, 38, 31, 0, 34, 33, 118: 35, 36, 37, 42, 0, 0, 0, 0, 6, 0, 119: 27, 30, 28, 29, 0, 0, 0, 0, 0, 0, 120: 0, 0, 0, 0, 0, 10, 0, 0, 22, 26, 121: 23, 24, 25, 9, 39, 41, 40, 38, 31, 4, 122: 0, 0, 43, 0, 0, 0, 64, 65, 66, 67, 123: 68, 0, 0, 0, 0, 0, 0, 74, 75, 76, 124: 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126: 0, 0, 0, 0, 0, 90, 91, 92, 93, 94, 127: 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129: 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 130: 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 131: 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 132: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133: 0, 0, 0, 0, 0, 131, 0, 132, 0, 0, 134: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 135: 0, 0, 0, 43 }; 136: yypact[]{ 137: 138: -39,-1000, 2,-1000,-280,-1000, 101, 101, 101, 101, 139: 101, -65, -66, -67, -68, 59,-1000, 101, 101, 101, 140: 101, -70,-241,-1000,-1000,-1000,-241,-1000,-1000,-1000, 141: -1000, -61, 59,-1000,-1000,-1000,-1000,-1000,-241,-241, 142: -241,-241,-1000,-280,-1000, 101, 101, 101, 101, 101, 143: 101,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, 144: -1000,-1000,-1000,-1000,-280,-254,-254,-254,-272, 59, 145: 59, 59, 59,-123,-254,-254,-254,-254,-228,-1000, 146: -1000,-1000,-1000,-1000,-1000, -81,-1000,-1000,-1000,-1000, 147: -280,-272,-272,-272,-280,-280,-110, 2,-113,-114, 148: -115,-1000,-107, -71,-1000, -80, -82, -83, -84,-1000, 149: -1000,-1000,-1000,-1000,-1000, 101,-1000, 101,-1000, 59, 150: -1000,-1000,-1000,-1000,-1000,-1000,-1000, 59, 59, 59, 151: 59,-272,-280, 2,-116,-117,-118,-121,-1000,-1000, 152: -1000,-1000 }; 153: yypgo[]{ 154: 155: 0, 97, 63, 399, 95, 94, 93, 80, 92, 70, 156: 89, 88, 87, 85, 60, 83, 90, 82, 81, 78, 157: 77, 76, 75, 74, 73, 72, 71, 69, 68, 67, 158: 66, 65, 61, 59 }; 159: yyr1[]{ 160: 161: 0, 1, 1, 1, 2, 2, 2, 2, 4, 5, 162: 6, 6, 7, 7, 7, 7, 8, 10, 11, 12, 163: 13, 15, 15, 3, 3, 3, 3, 3, 3, 3, 164: 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 165: 3, 3, 3, 3, 3, 3, 29, 30, 31, 32, 166: 28, 28, 28, 28, 28, 28, 28, 28, 27, 16, 167: 24, 24, 25, 25, 25, 9, 9, 19, 20, 22, 168: 21, 17, 18, 18, 18, 18, 23, 14, 26, 26, 169: 26, 26, 26, 26, 33, 33 }; 170: yyr2[]{ 171: 172: 0, 1, 1, 0, 1, 2, 2, 1, 2, 1, 173: 1, 2, 4, 4, 4, 4, 1, 1, 1, 1, 174: 2, 2, 0, 3, 2, 2, 2, 2, 2, 4, 175: 4, 4, 4, 4, 3, 3, 3, 1, 4, 3, 176: 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 177: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 178: 2, 2, 2, 2, 0, 1, 3, 1, 1, 1, 179: 1, 2, 1, 1, 1, 2, 1, 1, 3, 1, 180: 1, 1, 1, 1, 1, 1 }; 181: yychk[]{ 182: 183: -1000, -1, -2, 256, -3, 268, 267, -17, -18, 292, 184: 284, -19, -20, -21, -22, -24, -26, -29, -30, -31, 185: -32, -5, 287, 289, 290, 291, 288, 269, 271, 272, 186: 270, 297, 123, 258, 257, 259, 260, 261, 296, 293, 187: 295, 294, 262, -3, -4, 268, 283, -23, -14, -27, 188: -16, -28, 286, 285, 281, 282, 301, 305, 306, 303, 189: 304, 299, 302, 300, -3, -3, -3, -3, -3, 123, 190: 123, 123, 123, -2, -3, -3, -3, -3, 123, -33, 191: 257, 258, -33, -33, 123, -2, -33, -33, -33, -33, 192: -3, -3, -3, -3, -3, -3, -9, -2, -9, -9, 193: -9, -25, 298, -6, -7, -8, -10, -11, -12, 263, 194: 264, 265, 266, 125, -13, -14, -15, -16, 125, 273, 195: 125, 125, 125, -33, 125, -7, 125, 123, 123, 123, 196: 123, -3, -3, -2, -9, -9, -9, -9, 125, 125, 197: 125, 125 }; 198: yydef[]{ 199: 200: 3, -2, 1, 2, 4, 7, 0, 0, 0, 0, 201: 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 202: 0, 0, 0, 72, 73, 74, 0, 67, 68, 70, 203: 69, 0, 0, 79, 80, 81, 82, 83, 0, 0, 204: 0, 0, 9, 5, 6, 0, 0, 0, 0, 0, 205: 0, 40, 76, 77, 58, 59, 50, 51, 52, 53, 206: 54, 55, 56, 57, 24, 25, 26, 27, 28, 0, 207: 0, 0, 0, 64, 41, 42, 43, 44, 0, 71, 208: 84, 85, 75, 60, 61, 0, 46, 47, 48, 49, 209: 8, 23, 34, 35, 22, 39, 0, 65, 0, 0, 210: 0, 36, 0, 0, 10, 0, 0, 0, 0, 16, 211: 17, 18, 19, 78, 33, 0, 38, 0, 29, 0, 212: 30, 31, 32, 62, 63, 11, 45, 0, 0, 0, 213: 0, 20, 21, 66, 0, 0, 0, 0, 12, 13, 214: 14, 15 }; 215: # 216: # define YYFLAG -1000 217: # define YYERROR goto yyerrlab 218: # define YYACCEPT return(0) 219: # define YYABORT return(1) 220: 221: /* parser for yacc output */ 222: 223: int yydebug 0; /* 1 for debugging */ 224: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */ 225: int yychar -1; /* current input token number */ 226: int yynerrs 0; /* number of errors */ 227: int yyerrflag 0; /* error recovery flag */ 228: 229: yyparse() { 230: 231: int yys[YYMAXDEPTH]; 232: int yyj, yym; 233: register YYSTYPE *yypvt; 234: register yystate, *yyps, yyn; 235: register YYSTYPE *yypv; 236: register *yyxi; 237: 238: yystate = 0; 239: yychar = -1; 240: yynerrs = 0; 241: yyerrflag = 0; 242: yyps= &yys[-1]; 243: yypv= &yyv[-1]; 244: 245: yystack: /* put a state and value onto the stack */ 246: 247: if( yydebug ) printf( "state %d, value %d, char %d\n",yystate,yyval,yychar ); 248: if( ++yyps> &yys[YYMAXDEPTH] ) yyerror( "yacc stack overflow" ); 249: *yyps = yystate; 250: ++yypv; 251: YYVCOPY(*yypv,yyval); 252: 253: yynewstate: 254: 255: yyn = yypact[yystate]; 256: 257: if( yyn<= YYFLAG ) goto yydefault; /* simple state */ 258: 259: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0; 260: if( (yyn =+ yychar)<0 || yyn >= yylast ) goto yydefault; 261: 262: if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */ 263: yychar = -1; 264: YYVCOPY(yyval,yylval); 265: yystate = yyn; 266: if( yyerrflag > 0 ) --yyerrflag; 267: goto yystack; 268: } 269: 270: yydefault: 271: /* default state action */ 272: 273: if( (yyn=yydef[yystate]) == -2 ) { 274: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0; 275: /* look through exception table */ 276: 277: for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi =+ 2 ) ; /* VOID */ 278: 279: while( *(yyxi=+2) >= 0 ){ 280: if( *yyxi == yychar ) break; 281: } 282: if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */ 283: } 284: 285: if( yyn == 0 ){ /* error */ 286: /* error ... attempt to resume parsing */ 287: 288: switch( yyerrflag ){ 289: 290: case 0: /* brand new error */ 291: 292: yyerror( "syntax error" ); 293: yyerrlab: 294: ++yynerrs; 295: 296: case 1: 297: case 2: /* incompletely recovered error ... try again */ 298: 299: yyerrflag = 3; 300: 301: /* find a state where "error" is a legal shift action */ 302: 303: while ( yyps >= yys ) { 304: yyn = yypact[*yyps] + YYERRCODE; 305: if( yyn>= 0 && yyn < yylast && yychk[yyact[yyn]] == YYERRCODE ){ 306: yystate = yyact[yyn]; /* simulate a shift of "error" */ 307: goto yystack; 308: } 309: yyn = yypact[*yyps]; 310: 311: /* the current yyps has no shift onn "error", pop stack */ 312: 313: if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] ); 314: --yyps; 315: --yypv; 316: } 317: 318: /* there is no state on the stack with an error shift ... abort */ 319: 320: yyabort: 321: return(1); 322: 323: 324: case 3: /* no shift yet; clobber input char */ 325: 326: if( yydebug ) printf( "error recovery discards char %d\n", yychar ); 327: 328: if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */ 329: yychar = -1; 330: goto yynewstate; /* try again in the same state */ 331: 332: } 333: 334: } 335: 336: /* reduction by production yyn */ 337: 338: if( yydebug ) printf("reduce %d\n",yyn); 339: yyps =- yyr2[yyn]; 340: yypvt = yypv; 341: yypv =- yyr2[yyn]; 342: YYVCOPY(yyval,yypv[1]); 343: yym=yyn; 344: /* consult goto table to find next state */ 345: yyn = yyr1[yyn]; 346: yyj = yypgo[yyn] + *yyps + 1; 347: if( yyj>=yylast || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]]; 348: switch(yym){ 349: 350: case 1:{ putout(yypvt[-0]); } break; 351: case 2:{ error(!FATAL, "syntax error"); } break; 352: case 3:{ eqnreg = 0; } break; 353: case 5:{ eqnbox(yypvt[-1], yypvt[-0], 0); } break; 354: case 6:{ eqnbox(yypvt[-1], yypvt[-0], 1); } break; 355: case 7:{ lineup(0); } break; 356: case 8:{ yyval = yypvt[-0]; lineup(1); } break; 357: case 9:{ yyval = ct; } break; 358: case 12:{ column('L', yypvt[-3]); } break; 359: case 13:{ column('C', yypvt[-3]); } break; 360: case 14:{ column('R', yypvt[-3]); } break; 361: case 15:{ column('-', yypvt[-3]); } break; 362: case 16:{ yyval = ct++; } break; 363: case 17:{ yyval = ct++; } break; 364: case 18:{ yyval = ct++; } break; 365: case 19:{ yyval = ct++; } break; 366: case 20:{ yyval = yypvt[-0]; } break; 367: case 21:{ yyval = yypvt[-0]; } break; 368: case 22:{ yyval = 0; } break; 369: case 23:{ boverb(yypvt[-2], yypvt[-0]); } break; 370: case 24:{ mark(yypvt[-0]); } break; 371: case 25:{ size(yypvt[-1], yypvt[-0]); } break; 372: case 26:{ font(yypvt[-1], yypvt[-0]); } break; 373: case 27:{ fatbox(yypvt[-0]); } break; 374: case 28:{ sqrt(yypvt[-0]); } break; 375: case 29:{ lpile('L', yypvt[-3], ct); ct = yypvt[-3]; } break; 376: case 30:{ lpile('C', yypvt[-3], ct); ct = yypvt[-3]; } break; 377: case 31:{ lpile('R', yypvt[-3], ct); ct = yypvt[-3]; } break; 378: case 32:{ lpile('-', yypvt[-3], ct); ct = yypvt[-3]; } break; 379: case 33:{ shift2(yypvt[-3], yypvt[-1], yypvt[-0]); } break; 380: case 34:{ bshiftb(yypvt[-2], yypvt[-1], yypvt[-0]); } break; 381: case 35:{ bshiftb(yypvt[-2], yypvt[-1], yypvt[-0]); } break; 382: case 36:{ paren(yypvt[-2], yypvt[-1], yypvt[-0]); } break; 383: case 38:{ fromto(yypvt[-3], yypvt[-1], yypvt[-0]); fromflg=0; } break; 384: case 39:{ fromto(yypvt[-2], 0, yypvt[-0]); } break; 385: case 40:{ diacrit(yypvt[-1], yypvt[-0]); } break; 386: case 41:{ move(FWD, yypvt[-1], yypvt[-0]); } break; 387: case 42:{ move(UP, yypvt[-1], yypvt[-0]); } break; 388: case 43:{ move(BACK, yypvt[-1], yypvt[-0]); } break; 389: case 44:{ move(DOWN, yypvt[-1], yypvt[-0]); } break; 390: case 45:{ matrix(yypvt[-3]); } break; 391: case 46:{ yyval = atoi((char *) yypvt[-1]); } break; 392: case 47:{ yyval = atoi((char *) yypvt[-1]); } break; 393: case 48:{ yyval = atoi((char *) yypvt[-1]); } break; 394: case 49:{ yyval = atoi((char *) yypvt[-1]); } break; 395: case 50:{ yyval = HAT; } break; 396: case 51:{ yyval = VEC; } break; 397: case 52:{ yyval = DYAD; } break; 398: case 53:{ yyval = BAR; } break; 399: case 54:{ yyval = UNDER; } break; 400: case 55:{ yyval = DOT; } break; 401: case 56:{ yyval = TILDE; } break; 402: case 57:{ yyval = DOTDOT; } break; 403: case 58:{ yyval=ps; ps -= 3; fromflg = 1; 404: if(dbg)printf(".\tfrom: old ps %d, new ps %d, fflg %d\n", yyval, ps, fromflg); 405: } break; 406: case 59:{ yyval=ps; if(fromflg==0)ps -= 3; 407: if(dbg)printf(".\tto: old ps %d, new ps %d\n", yyval, ps); 408: } break; 409: case 60:{ yyval = ((char *)yypvt[-0])[0]; } break; 410: case 61:{ yyval = '{'; } break; 411: case 62:{ yyval = ((char *)yypvt[-0])[0]; } break; 412: case 63:{ yyval = '}'; } break; 413: case 64:{ yyval = 0; } break; 414: case 65:{ lp[ct++] = yypvt[-0]; } break; 415: case 66:{ lp[ct++] = yypvt[-0]; } break; 416: case 67:{ yyval = ct; } break; 417: case 68:{ yyval = ct; } break; 418: case 69:{ yyval = ct; } break; 419: case 70:{ yyval = ct; } break; 420: case 71:{ yyval = ps; setsize((char *) yypvt[-0]); } break; 421: case 72:{ setfont(ROM); } break; 422: case 73:{ setfont(ITAL); } break; 423: case 74:{ setfont(BLD); } break; 424: case 75:{ setfont(((char *)yypvt[-0])[0]); } break; 425: case 76:{ shift(SUB); } break; 426: case 77:{ shift(SUP); } break; 427: case 78:{ yyval = yypvt[-1]; } break; 428: case 79:{ text(QTEXT, (char *) yypvt[-0]); } break; 429: case 80:{ text(CONTIG, (char *) yypvt[-0]); } break; 430: case 81:{ text('~', (char *) yypvt[-0]); } break; 431: case 82:{ text(THIN, 0); } break; 432: case 83:{ text(TAB, 0); } break; 433: } 434: goto yystack; /* stack new state and value */ 435: 436: }