+
+/* A Bison parser, made from pic.y */
+
+#define LABEL 258
+#define VARIABLE 259
+#define NUMBER 260
+#define TEXT 261
+#define COMMAND 262
+#define DELIMITED 263
+#define ORDINAL 264
+#define LEFT_ARROW_HEAD 265
+#define RIGHT_ARROW_HEAD 266
+#define DOUBLE_ARROW_HEAD 267
+#define LAST 268
+#define UP 269
+#define DOWN 270
+#define LEFT 271
+#define RIGHT 272
+#define BOX 273
+#define CIRCLE 274
+#define ELLIPSE 275
+#define ARC 276
+#define LINE 277
+#define ARROW 278
+#define MOVE 279
+#define SPLINE 280
+#define HEIGHT 281
+#define RADIUS 282
+#define WIDTH 283
+#define DIAMETER 284
+#define FROM 285
+#define TO 286
+#define AT 287
+#define WITH 288
+#define BY 289
+#define THEN 290
+#define DOTTED 291
+#define DASHED 292
+#define CHOP 293
+#define SAME 294
+#define INVISIBLE 295
+#define LJUST 296
+#define RJUST 297
+#define ABOVE 298
+#define BELOW 299
+#define OF 300
+#define THE 301
+#define WAY 302
+#define BETWEEN 303
+#define AND 304
+#define HERE 305
+#define DOT_N 306
+#define DOT_E 307
+#define DOT_W 308
+#define DOT_S 309
+#define DOT_NE 310
+#define DOT_SE 311
+#define DOT_NW 312
+#define DOT_SW 313
+#define DOT_C 314
+#define DOT_START 315
+#define DOT_END 316
+#define DOT_X 317
+#define DOT_Y 318
+#define DOT_HT 319
+#define DOT_WID 320
+#define DOT_RAD 321
+#define SIN 322
+#define COS 323
+#define ATAN2 324
+#define LOG 325
+#define EXP 326
+#define SQRT 327
+#define MAX 328
+#define MIN 329
+#define INT 330
+#define RAND 331
+#define COPY 332
+#define THRU 333
+#define TOP 334
+#define BOTTOM 335
+#define UPPER 336
+#define LOWER 337
+#define SH 338
+#define PRINT 339
+#define CW 340
+#define CCW 341
+#define FOR 342
+#define DO 343
+#define IF 344
+#define ELSE 345
+#define ANDAND 346
+#define OROR 347
+#define NOTEQUAL 348
+#define EQUALEQUAL 349
+#define LESSEQUAL 350
+#define GREATEREQUAL 351
+#define LEFT_CORNER 352
+#define RIGHT_CORNER 353
+#define CENTER 354
+#define END 355
+#define START 356
+#define RESET 357
+#define UNTIL 358
+#define PLOT 359
+#define THICKNESS 360
+#define FILL 361
+#define ALIGNED 362
+#define SPRINTF 363
+#define DEFINE 364
+#define UNDEF 365
+
+#line 19 "pic.y"
+
+#include "pic.h"
+#include "ptable.h"
+#include "object.h"
+
+extern int delim_flag;
+extern void do_copy(const char *);
+extern void copy_rest_thru(const char *, const char *);
+extern void copy_file_thru(const char *, const char *, const char *);
+extern void push_body(const char *);
+extern void do_for(char *var, double from, double to,
+ int by_is_multiplicative, double by, char *body);
+extern void do_lookahead();
+
+extern "C" {
+ double fmod(double, double);
+ int rand();
+}
+
+#define YYDEBUG 1
+
+int yylex();
+void yyerror(const char *);
+
+void reset(const char *nm);
+void reset_all();
+
+place *lookup_label(const char *);
+void define_label(const char *label, const place *pl);
+
+direction current_direction;
+position current_position;
+
+implement_ptable(place)
+
+PTABLE(place) top_table;
+
+PTABLE(place) *current_table = &top_table;
+saved_state *current_saved_state = 0;
+
+object_list olist;
+
+const char *ordinal_postfix(int n);
+const char *object_type_name(object_type type);
+char *format_number(const char *form, double n);
+char *do_sprintf(const char *form, const double *v, int nv);
+
+
+#line 69 "pic.y"
+typedef union {
+ char *str;
+ int n;
+ double x;
+ struct { double x, y; } pair;
+ struct { double x; char *body; } if_data;
+ struct { char *str; const char *filename; int lineno; } lstr;
+ struct { double *v; int nv; int maxv; } dv;
+ struct { double val; int is_multiplicative; } by;
+ place pl;
+ object *obj;
+ corner crn;
+ path *pth;
+ object_spec *spec;
+ saved_state *pstate;
+ graphics_state state;
+ object_type obtype;
+} YYSTYPE;
+
+#ifndef YYLTYPE
+typedef
+ struct yyltype
+ {
+ int timestamp;
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+ char *text;
+ }
+ yyltype;
+
+#define YYLTYPE yyltype
+#endif
+
+#include <stdio.h>
+
+#ifndef __STDC__
+#define const
+#endif
+
+
+
+#define YYFINAL 373
+#define YYFLAG -32768
+#define YYNTBASE 131
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 365 ? yytranslate[x] : 170)
+
+static const short yytranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 120, 2, 2, 2, 119, 2, 2, 111,
+ 129, 117, 115, 112, 116, 130, 118, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 124, 122, 113,
+ 123, 114, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 127, 2, 128, 121, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 125, 2, 126, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109, 110
+};
+
+#if YYDEBUG != 0
+static const short yyrline[] = { 0,
+ 263, 265, 273, 278, 281, 285, 287, 290, 292, 295,
+ 301, 303, 305, 307, 309, 315, 320, 326, 331, 334,
+ 339, 346, 349, 351, 359, 362, 364, 371, 374, 380,
+ 388, 391, 402, 403, 407, 410, 412, 416, 420, 423,
+ 426, 430, 433, 439, 446, 449, 451, 455, 470, 472,
+ 480, 486, 492, 499, 507, 512, 516, 520, 525, 532,
+ 539, 546, 553, 558, 563, 570, 585, 597, 603, 609,
+ 615, 621, 640, 647, 654, 661, 668, 675, 682, 689,
+ 696, 703, 718, 730, 736, 743, 755, 761, 767, 773,
+ 779, 784, 790, 806, 823, 828, 833, 838, 843, 848,
+ 853, 858, 865, 874, 883, 892, 901, 907, 914, 919,
+ 929, 936, 957, 960, 968, 971, 976, 981, 986, 991,
+ 998, 1000, 1003, 1006, 1010, 1013, 1019, 1025, 1031, 1039,
+ 1050, 1054, 1062, 1065, 1069, 1084, 1100, 1103, 1105, 1107,
+ 1109, 1111, 1113, 1115, 1117, 1121, 1126, 1133, 1141, 1145,
+ 1152, 1158, 1164, 1170, 1176, 1184, 1187, 1189, 1191, 1193,
+ 1195, 1197, 1199, 1201, 1203, 1205, 1207, 1209, 1211, 1213,
+ 1215, 1217, 1219, 1221, 1223, 1225, 1227, 1229, 1231, 1233,
+ 1235, 1237, 1239, 1243, 1252, 1254, 1261, 1268, 1275, 1282,
+ 1289, 1291, 1293, 1295, 1303, 1311, 1324, 1326, 1328, 1337,
+ 1346, 1359, 1368, 1377, 1386, 1388, 1390, 1392, 1394, 1400,
+ 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416
+};
+
+static const char * const yytname[] = { 0,
+"error","$illegal.","LABEL","VARIABLE","NUMBER","TEXT","COMMAND","DELIMITED","ORDINAL","LEFT_ARROW_HEAD",
+"RIGHT_ARROW_HEAD","DOUBLE_ARROW_HEAD","LAST","UP","DOWN","LEFT","RIGHT","BOX","CIRCLE","ELLIPSE",
+"ARC","LINE","ARROW","MOVE","SPLINE","HEIGHT","RADIUS","WIDTH","DIAMETER","FROM",
+"TO","AT","WITH","BY","THEN","DOTTED","DASHED","CHOP","SAME","INVISIBLE",
+"LJUST","RJUST","ABOVE","BELOW","OF","THE","WAY","BETWEEN","AND","HERE",
+"DOT_N","DOT_E","DOT_W","DOT_S","DOT_NE","DOT_SE","DOT_NW","DOT_SW","DOT_C","DOT_START",
+"DOT_END","DOT_X","DOT_Y","DOT_HT","DOT_WID","DOT_RAD","SIN","COS","ATAN2","LOG",
+"EXP","SQRT","MAX","MIN","INT","RAND","COPY","THRU","TOP","BOTTOM",
+"UPPER","LOWER","SH","PRINT","CW","CCW","FOR","DO","IF","ELSE",
+"ANDAND","OROR","NOTEQUAL","EQUALEQUAL","LESSEQUAL","GREATEREQUAL","LEFT_CORNER","RIGHT_CORNER","CENTER","END",
+"START","RESET","UNTIL","PLOT","THICKNESS","FILL","ALIGNED","SPRINTF","DEFINE","UNDEF",
+"'('","','","'<'","'>'","'+'","'-'","'*'","'/'","'%'","'!'",
+"'^'","';'","'='","':'","'{'","'}'","'['","']'","')'","'.'",
+"top"
+};
+#endif
+
+static const short yyr1[] = { 0,
+ 131, 131, 132, 133, 133, 134, 134, 135, 135, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 137, 136,
+ 136, 138, 139, 136, 140, 141, 136, 142, 136, 136,
+ 143, 136, 136, 136, 144, 144, 144, 146, 145, 147,
+ 147, 148, 148, 148, 149, 149, 149, 150, 150, 150,
+ 150, 151, 150, 150, 152, 152, 152, 152, 152, 152,
+ 152, 152, 152, 152, 152, 153, 152, 152, 152, 152,
+ 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
+ 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
+ 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
+ 152, 152, 152, 152, 152, 152, 152, 152, 154, 154,
+ 155, 155, 156, 156, 157, 157, 157, 157, 157, 157,
+ 158, 158, 159, 159, 160, 160, 160, 160, 160, 161,
+ 161, 161, 162, 162, 163, 163, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 165, 165, 166, 166, 166,
+ 167, 167, 167, 167, 167, 168, 168, 168, 168, 168,
+ 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+ 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+ 168, 168, 168, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169
+};
+
+static const short yyr2[] = { 0,
+ 1, 1, 3, 1, 3, 0, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 2, 2, 2, 0, 3,
+ 2, 0, 0, 7, 0, 0, 6, 0, 10, 1,
+ 0, 4, 1, 1, 2, 2, 3, 0, 5, 0,
+ 2, 1, 3, 3, 0, 2, 3, 1, 4, 4,
+ 4, 0, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 3, 0, 4, 3, 3, 3,
+ 3, 2, 2, 3, 2, 3, 2, 3, 2, 3,
+ 3, 3, 3, 3, 3, 2, 2, 3, 2, 3,
+ 2, 3, 2, 3, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 2, 1, 5,
+ 0, 3, 1, 1, 1, 3, 3, 5, 5, 6,
+ 1, 4, 3, 3, 1, 2, 2, 3, 1, 1,
+ 1, 3, 1, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 2, 1, 2, 3, 1, 1, 2,
+ 1, 4, 3, 3, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 1, 1, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 2, 3, 4, 4,
+ 6, 4, 4, 4, 6, 6, 4, 4, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 2
+};
+
+static const short yydefact[] = { 6,
+ 8, 2, 1, 7, 0, 0, 109, 15, 11, 12,
+ 13, 14, 55, 56, 57, 58, 59, 60, 61, 62,
+ 0, 19, 0, 0, 0, 34, 0, 0, 52, 66,
+ 6, 54, 33, 30, 4, 48, 63, 9, 6, 0,
+ 21, 25, 0, 130, 184, 185, 0, 133, 169, 170,
+ 129, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+ 165, 166, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 167, 168, 0, 0, 175, 176, 181, 183,
+ 182, 0, 0, 0, 17, 18, 113, 115, 114, 125,
+ 0, 131, 0, 16, 0, 0, 0, 0, 0, 42,
+ 35, 64, 0, 6, 6, 3, 7, 36, 0, 31,
+ 97, 98, 99, 73, 75, 79, 77, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 86, 87, 89, 93,
+ 95, 96, 103, 104, 105, 106, 100, 101, 0, 91,
+ 108, 102, 72, 0, 10, 22, 0, 20, 145, 134,
+ 137, 138, 139, 140, 141, 142, 143, 0, 135, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 171,
+ 173, 177, 179, 172, 174, 178, 180, 0, 115, 0,
+ 197, 218, 0, 0, 186, 187, 188, 189, 190, 0,
+ 126, 136, 0, 127, 0, 121, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 38, 0, 0, 0, 65, 111,
+ 0, 0, 0, 5, 37, 0, 74, 76, 80, 78,
+ 68, 69, 70, 71, 81, 0, 82, 83, 0, 0,
+ 0, 0, 149, 151, 84, 148, 0, 85, 0, 88,
+ 90, 94, 107, 92, 130, 184, 13, 14, 49, 0,
+ 50, 51, 0, 26, 144, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 209, 0, 0, 124, 198, 116,
+ 117, 132, 128, 0, 216, 217, 215, 214, 211, 213,
+ 123, 0, 210, 212, 191, 192, 193, 194, 195, 196,
+ 0, 0, 0, 44, 43, 210, 0, 53, 67, 32,
+ 155, 0, 0, 0, 146, 0, 150, 0, 0, 23,
+ 40, 199, 200, 0, 202, 203, 204, 0, 0, 207,
+ 208, 0, 0, 0, 0, 0, 39, 0, 110, 0,
+ 154, 153, 147, 40, 0, 27, 0, 0, 0, 118,
+ 122, 0, 119, 45, 112, 152, 24, 41, 201, 205,
+ 206, 120, 0, 0, 0, 46, 28, 47, 0, 29,
+ 0, 0, 0
+};
+
+static const short yydefgoto[] = { 371,
+ 2, 31, 222, 4, 32, 43, 263, 344, 147, 321,
+ 369, 226, 33, 34, 303, 346, 97, 364, 35, 104,
+ 36, 105, 37, 307, 86, 87, 212, 88, 99, 90,
+ 91, 92, 159, 243, 244, 245, 93, 236
+};
+
+static const short yypact[] = { -101,
+-32768,-32768, 535, -99, -96, -89,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+ 23,-32768, 750, 37, 851, 38, 1057, -65,-32768,-32768,
+ -101,-32768, 1, -42,-32768, 641,-32768,-32768, -101, 851,
+ -4,-32768, 68,-32768,-32768,-32768, 62,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768, -32, -21, -9, -7, 25, 41, 42, 46,
+ 48, 52,-32768,-32768, 2, 21,-32768,-32768,-32768,-32768,
+-32768, 1158, 1057, 1057,-32768, -59,-32768,-32768, 232, 1673,
+ 363,-32768, 13, 1646, 7, 1057, 97, 28, 232, 1973,
+-32768, 984, 143, -101, -101,-32768, 509,-32768, 150,-32768,
+-32768,-32768,-32768, 1499, 1499, 1339, 1419, 1057, 1057, 1057,
+ 1057, 1158, 1158, 1158, 153, 1259,-32768, 1499, 1499, 1499,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1057, 1499,
+-32768,-32768, 1973, 394,-32768,-32768, 157,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768, 39,-32768, 1057,
+ 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 276,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768, -61, 44, 1594,
+ 50, 50, 1259, 1259,-32768,-32768,-32768,-32768,-32768, 190,
+-32768,-32768, 111, 64, 126,-32768, 1057, 1057, 1057, 1057,
+ 1057, 1057, 1057, 1158, 1057, 1057, 1057, 1057, 1057, 1057,
+ 1057, 1158, 1057, 1701,-32768, 0, 0, 1057,-32768,-32768,
+ 70, 535, 69,-32768,-32768, 194, 1973, 1973, 1973, 1973,
+ 1973, 1973, 1973, 1973, -59, 1646, -59, -59, 1569, 253,
+ 363, 200, 1621,-32768,-32768,-32768, 1259,-32768, 677, 1973,
+ 1973, 1973, 1973, 1973, -96, -89, 22, 27,-32768, -59,
+ 19, 154, 207,-32768,-32768, 1732, 1741, 1540, 1772, 1781,
+ 1812, 1932, 1942, 1821,-32768, 1852, 1158,-32768,-32768,-32768,
+-32768,-32768, 64, 174, 720, 778, 767, 767, 125, 125,
+ 1973, 11, 110, 125, 169, 169, 50, 50, 50, 50,
+ -38, 486, 215,-32768,-32768, 125, -80,-32768,-32768,-32768,
+-32768, 363, 1569, 1569,-32768, 227,-32768, 44, 1692,-32768,
+ 133,-32768,-32768, 1057,-32768,-32768,-32768, 1057, 1057,-32768,
+-32768, -63, 189, 1158, 1158, 1057,-32768, 1057,-32768, 1569,
+-32768,-32768,-32768, 133, 239,-32768, 1861, 1892, 1901,-32768,
+-32768, -52, -59, 452, 1973,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768, 952, 159, 1057, 1973,-32768, 1973, 240,-32768,
+ 249, 257,-32768
+};
+
+static const short yypgoto[] = {-32768,
+ 43,-32768, 8, 229,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768, -86, 221,-32768, -74,-32768,
+-32768,-32768, -16,-32768, -79, 118,-32768, -55, -13, -81,
+-32768,-32768, -90,-32768, -225,-32768, -75, -23
+};
+
+
+#define YYLAST 2094
+
+
+static const short yytable[] = { 94,
+ 192, 100, 178, 102, 108, 7, 85, 3, 98, 89,
+ 335, 194, 143, 311, 191, 44, 100, 170, 171, 142,
+ 1, 47, 38, 98, -169, 48, 179, 39, 41, -170,
+ -169, 338, 224, 40, -169, -170, 174, 175, 106, -170,
+ 95, 101, 235, 237, 238, 103, 144, 110, 339, 246,
+ 277, 183, 184, 183, 184, 183, 184, 193, 180, 181,
+ 182, 362, 183, 184, 260, 350, -169, 149, 89, 259,
+ 248, -170, 214, 146, 150, 148, 183, 184, 160, 151,
+ 152, 153, 154, 155, 156, 219, 157, 341, 342, 161,
+ 227, 228, 229, 230, 231, 232, 233, 234, 172, 173,
+ 42, 162, 249, 163, 250, 251, 252, 28, 89, 89,
+ 89, 283, 109, 44, 356, 253, 254, 176, 177, 47,
+ 216, 217, 334, 48, 292, 183, 184, 280, 281, 213,
+ 262, 215, 301, -113, -113, 164, 266, 267, 268, 269,
+ 270, 271, 272, 273, 274, 276, 221, 223, 220, 313,
+ 314, 165, 166, 225, 195, 239, 167, 196, 168, 249,
+ 249, 240, 169, 246, 264, 241, 265, 317, 49, 50,
+ 211, 284, 278, 285, 286, 287, 288, 289, 290, 291,
+ 293, 294, 295, 296, 297, 298, 299, 300, 158, 302,
+ 89, 318, 282, 190, 306, 308, 309, 332, 89, 304,
+ 305, 310, 315, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 320, 185, 186, 187, 188, 189,
+ 333, 340, 337, 319, 206, 207, 208, 209, 210, 343,
+ 211, 73, 74, 75, 76, 345, 351, 246, 246, 206,
+ 207, 208, 209, 210, 358, 211, 367, 370, 372, 77,
+ 78, 79, 80, 81, 352, 353, 373, 357, 149, 107,
+ 145, 261, 0, 89, 246, 312, 0, 0, -114, -114,
+ 151, 152, 153, 154, 155, 156, 0, 157, 44, 45,
+ 46, 0, 242, 0, 47, 208, 209, 210, 48, 211,
+ 0, 49, 50, 185, 186, 187, 188, 189, 0, 0,
+ 347, 0, 0, 0, 348, 349, 0, 0, 0, 0,
+ 0, 0, 354, 0, 355, 0, 0, 0, 0, 0,
+ 89, 89, 0, 0, 0, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 0, 0, 366,
+ 0, 368, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 0, 0, 73, 74, 75, 76, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 149, 0,
+ 0, 0, 77, 78, 79, 80, 81, 0, 0, 158,
+ 151, 152, 153, 154, 155, 156, 96, 157, 0, 0,
+ 0, 83, 0, 0, 0, 84, 255, 256, 46, 7,
+ 8, 0, 47, 0, 275, 0, 48, 9, 10, 257,
+ 258, 13, 14, 15, 16, 17, 18, 19, 20, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 0, 0, 0, 0, 0,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 21, 0, 73, 74, 75, 76, 22, 23, 0, 0,
+ 24, 0, 25, 0, 0, 363, 0, 0, 0, 158,
+ 77, 78, 79, 80, 81, 26, 0, 27, 0, 0,
+ 0, 28, 0, 0, 82, 0, 0, 0, 0, 83,
+ 0, 5, 6, 84, 7, 8, 336, 0, 29, 0,
+ 30, 0, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 0, 0, 0, 5, 6, 0,
+ 7, 8, 197, 198, 199, 200, 201, 202, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 0, 0, 0, 197, 198, 199, 200,
+ 201, 202, 0, 0, 0, 21, 0, 0, 0, 0,
+ 0, 22, 23, 0, 0, 24, 0, 25, 218, 205,
+ 206, 207, 208, 209, 210, 0, 211, 0, 0, 0,
+ 26, 21, 27, 0, 0, 0, 28, 22, 23, 0,
+ 0, 24, 0, 25, 0, 0, 0, 0, 0, 0,
+ 38, 0, 0, 29, 0, 30, 26, 0, 27, 0,
+ 0, 0, 28, 44, 45, 46, 7, 0, 0, 47,
+ 111, 112, 113, 48, 114, 115, 116, 117, 0, 29,
+ 0, 30, 0, 0, 0, 0, 118, 119, 120, 121,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 0, 0, 0, 0, 0,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 0, 0, 0, 0, 0, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 0, 0, 73,
+ 74, 75, 76, 0, 0, 137, 138, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 77, 78, 79,
+ 80, 81, 0, 0, 0, 139, 140, 141, 28, 0,
+ 0, 96, 44, 45, 46, 7, 83, 0, 47, 0,
+ 84, 0, 48, 0, 0, 49, 50, 197, 198, 199,
+ 200, 201, 202, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 203, 218,
+ 205, 206, 207, 208, 209, 210, 0, 211, 0, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 0, 199, 200, 201, 202, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 0, 0, 73, 74,
+ 75, 76, 218, 205, 206, 207, 208, 209, 210, 0,
+ 211, 0, 0, 0, 0, 0, 77, 78, 79, 80,
+ 81, 0, 0, 44, 45, 46, 7, 28, 0, 47,
+ 82, 201, 202, 48, 0, 83, 49, 50, 197, 84,
+ 199, 200, 201, 202, 0, 0, 0, 0, 0, 218,
+ 205, 206, 207, 208, 209, 210, 0, 211, 0, 0,
+ 218, 205, 206, 207, 208, 209, 210, 0, 211, 0,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 0, 0, 0, 0, 0, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 0, 0, 73,
+ 74, 75, 76, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 77, 78, 79,
+ 80, 81, 0, 0, 44, 45, 46, 0, 28, 0,
+ 47, 96, 0, 0, 48, 0, 83, 49, 50, 0,
+ 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 0, 0, 0, 0, 0, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 0, 0,
+ 73, 74, 75, 76, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 77, 78,
+ 79, 80, 81, 0, 0, 0, 0, 0, 0, 44,
+ 45, 46, 96, 0, 0, 47, 0, 83, 365, 48,
+ 0, 84, 49, 50, 197, 198, 199, 200, 201, 202,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 28, 0, 0, 0, 0, 218, 205, 206, 207,
+ 208, 209, 210, 0, 211, 0, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 0, 0,
+ 0, 0, 0, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 0, 0, 73, 74, 75, 76, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 77, 78, 79, 80, 81, 0, 0,
+ 44, 45, 46, 0, 0, 0, 47, 96, 0, 0,
+ 48, 0, 83, 49, 50, 0, 84, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 0,
+ 0, 0, 0, 0, 63, 64, 65, 66, 67, 68,
+ 69, 70, 71, 72, 0, 0, 73, 74, 75, 76,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 77, 78, 79, 80, 81, 0,
+ 0, 44, 45, 46, 0, 0, 0, 47, 82, 0,
+ 0, 48, 0, 83, 49, 50, 0, 84, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
+ 76, 44, 45, 46, 0, 0, 0, 47, 0, 0,
+ 0, 48, 0, 0, 0, 77, 78, 79, 80, 81,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
+ 0, 0, 0, 0, 83, 0, 0, 0, 84, 0,
+ 0, 0, 0, -169, 0, 0, 0, 0, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
+ 76, 44, 45, 46, 0, 0, 0, 47, 0, 0,
+ 0, 48, 0, 0, 0, 77, 78, 79, 80, 81,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
+ 0, 0, 0, 0, 83, 0, 0, 0, 84, 0,
+ 0, 0, 0, -170, 0, 0, 0, 0, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
+ 76, 44, 45, 46, 0, 0, 0, 47, 0, 0,
+ 0, 48, 0, 0, 0, 77, 78, 79, 80, 81,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
+ 0, 0, 0, 0, 83, 0, 0, 0, 84, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
+ 76, 0, 0, 0, 49, 50, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 77, 78, 79, 80, 81,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
+ 0, 0, 0, 0, 83, 0, 0, 0, 84, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 197, 198, 199, 200, 201, 202, 49, 50, 195, 0,
+ 0, 196, 0, 0, 0, 0, 0, 73, 74, 75,
+ 76, 324, 218, 205, 206, 207, 208, 209, 210, 0,
+ 211, 0, 0, 0, 0, 77, 78, 79, 80, 81,
+ 0, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 0, 0, 197, 198, 199, 200, 201, 202,
+ 195, 0, 0, 196, 0, 0, 0, 0, 242, 73,
+ 74, 75, 76, 0, 0, 203, 204, 205, 206, 207,
+ 208, 209, 210, 0, 211, 0, 0, 77, 78, 79,
+ 80, 81, 279, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 0, 0, 197, 198, 199, 200,
+ 201, 202, 0, 0, 0, 0, 0, 0, 0, 0,
+ 316, 73, 74, 75, 76, 0, 0, 203, 204, 205,
+ 206, 207, 208, 209, 210, 0, 211, 0, 0, 77,
+ 78, 79, 80, 81, 0, 0, 0, 0, 0, 0,
+ 0, 0, 197, 198, 199, 200, 201, 202, 0, 0,
+ 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 0, 0, 190, 203, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
+ 279, 211, 197, 198, 199, 200, 201, 202, 0, 279,
+ 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
+ 322, 211, 197, 198, 199, 200, 201, 202, 0, 323,
+ 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
+ 325, 211, 197, 198, 199, 200, 201, 202, 0, 326,
+ 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
+ 327, 211, 197, 198, 199, 200, 201, 202, 0, 330,
+ 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
+ 331, 211, 197, 198, 199, 200, 201, 202, 0, 359,
+ 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
+ 360, 211, 197, 198, 199, 200, 201, 202, 0, 361,
+ 0, 0, 197, 198, 199, 200, 201, 202, 0, 0,
+ 0, 0, 0, 328, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 329, 218, 205, 206, 207, 208, 209,
+ 210, 0, 211, 197, 198, 199, 200, 201, 202, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 218, 205, 206, 207, 208,
+ 209, 210, 0, 211
+};
+
+static const short yycheck[] = { 23,
+ 91, 25, 82, 27, 4, 6, 23, 0, 25, 23,
+ 49, 93, 36, 239, 90, 3, 40, 16, 17, 36,
+ 122, 9, 122, 40, 3, 13, 82, 124, 6, 3,
+ 9, 112, 107, 123, 13, 9, 16, 17, 31, 13,
+ 4, 4, 122, 123, 124, 111, 39, 90, 129, 125,
+ 112, 115, 116, 115, 116, 115, 116, 45, 82, 83,
+ 84, 114, 115, 116, 144, 129, 45, 6, 82, 144,
+ 126, 45, 96, 78, 13, 8, 115, 116, 111, 18,
+ 19, 20, 21, 22, 23, 102, 25, 313, 314, 111,
+ 114, 115, 116, 117, 118, 119, 120, 121, 97, 98,
+ 78, 111, 126, 111, 128, 129, 130, 108, 122, 123,
+ 124, 193, 112, 3, 340, 139, 140, 97, 98, 9,
+ 93, 94, 112, 13, 204, 115, 116, 183, 184, 123,
+ 144, 35, 212, 115, 116, 111, 160, 161, 162, 163,
+ 164, 165, 166, 167, 168, 169, 104, 105, 6, 240,
+ 241, 111, 111, 4, 45, 3, 111, 48, 111, 183,
+ 184, 9, 111, 239, 8, 13, 128, 243, 16, 17,
+ 121, 46, 129, 197, 198, 199, 200, 201, 202, 203,
+ 204, 205, 206, 207, 208, 209, 210, 211, 127, 213,
+ 204, 247, 3, 130, 218, 126, 128, 277, 212, 216,
+ 217, 8, 3, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 8, 62, 63, 64, 65, 66,
+ 47, 312, 8, 247, 115, 116, 117, 118, 119, 3,
+ 121, 79, 80, 81, 82, 103, 48, 313, 314, 115,
+ 116, 117, 118, 119, 6, 121, 88, 8, 0, 97,
+ 98, 99, 100, 101, 334, 335, 0, 344, 6, 31,
+ 40, 144, -1, 277, 340, 13, -1, -1, 115, 116,
+ 18, 19, 20, 21, 22, 23, -1, 25, 3, 4,
+ 5, -1, 130, -1, 9, 117, 118, 119, 13, 121,
+ -1, 16, 17, 62, 63, 64, 65, 66, -1, -1,
+ 324, -1, -1, -1, 328, 329, -1, -1, -1, -1,
+ -1, -1, 336, -1, 338, -1, -1, -1, -1, -1,
+ 334, 335, -1, -1, -1, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, -1, -1, 363,
+ -1, 365, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, -1, -1, 79, 80, 81, 82, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 6, -1,
+ -1, -1, 97, 98, 99, 100, 101, -1, -1, 127,
+ 18, 19, 20, 21, 22, 23, 111, 25, -1, -1,
+ -1, 116, -1, -1, -1, 120, 3, 4, 5, 6,
+ 7, -1, 9, -1, 129, -1, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, -1, -1, -1, -1, -1,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, -1, 79, 80, 81, 82, 83, 84, -1, -1,
+ 87, -1, 89, -1, -1, 34, -1, -1, -1, 127,
+ 97, 98, 99, 100, 101, 102, -1, 104, -1, -1,
+ -1, 108, -1, -1, 111, -1, -1, -1, -1, 116,
+ -1, 3, 4, 120, 6, 7, 31, -1, 125, -1,
+ 127, -1, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, -1, -1, -1, 3, 4, -1,
+ 6, 7, 91, 92, 93, 94, 95, 96, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, -1, -1, -1, 91, 92, 93, 94,
+ 95, 96, -1, -1, -1, 77, -1, -1, -1, -1,
+ -1, 83, 84, -1, -1, 87, -1, 89, 113, 114,
+ 115, 116, 117, 118, 119, -1, 121, -1, -1, -1,
+ 102, 77, 104, -1, -1, -1, 108, 83, 84, -1,
+ -1, 87, -1, 89, -1, -1, -1, -1, -1, -1,
+ 122, -1, -1, 125, -1, 127, 102, -1, 104, -1,
+ -1, -1, 108, 3, 4, 5, 6, -1, -1, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, -1, 125,
+ -1, 127, -1, -1, -1, -1, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, -1, -1, -1, -1, -1,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, -1, -1, -1, -1, -1, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, -1, -1, 79,
+ 80, 81, 82, -1, -1, 85, 86, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 97, 98, 99,
+ 100, 101, -1, -1, -1, 105, 106, 107, 108, -1,
+ -1, 111, 3, 4, 5, 6, 116, -1, 9, -1,
+ 120, -1, 13, -1, -1, 16, 17, 91, 92, 93,
+ 94, 95, 96, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 112, 113,
+ 114, 115, 116, 117, 118, 119, -1, 121, -1, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, -1, 93, 94, 95, 96, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, -1, -1, 79, 80,
+ 81, 82, 113, 114, 115, 116, 117, 118, 119, -1,
+ 121, -1, -1, -1, -1, -1, 97, 98, 99, 100,
+ 101, -1, -1, 3, 4, 5, 6, 108, -1, 9,
+ 111, 95, 96, 13, -1, 116, 16, 17, 91, 120,
+ 93, 94, 95, 96, -1, -1, -1, -1, -1, 113,
+ 114, 115, 116, 117, 118, 119, -1, 121, -1, -1,
+ 113, 114, 115, 116, 117, 118, 119, -1, 121, -1,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, -1, -1, -1, -1, -1, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, -1, -1, 79,
+ 80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 97, 98, 99,
+ 100, 101, -1, -1, 3, 4, 5, -1, 108, -1,
+ 9, 111, -1, -1, 13, -1, 116, 16, 17, -1,
+ 120, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 6,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, -1, -1, -1, -1, -1, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, -1, -1,
+ 79, 80, 81, 82, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 97, 98,
+ 99, 100, 101, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 111, -1, -1, 9, -1, 116, 117, 13,
+ -1, 120, 16, 17, 91, 92, 93, 94, 95, 96,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 108, -1, -1, -1, -1, 113, 114, 115, 116,
+ 117, 118, 119, -1, 121, -1, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
+ -1, -1, -1, 67, 68, 69, 70, 71, 72, 73,
+ 74, 75, 76, -1, -1, 79, 80, 81, 82, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 97, 98, 99, 100, 101, -1, -1,
+ 3, 4, 5, -1, -1, -1, 9, 111, -1, -1,
+ 13, -1, 116, 16, 17, -1, 120, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, -1,
+ -1, -1, -1, -1, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, -1, -1, 79, 80, 81, 82,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 97, 98, 99, 100, 101, -1,
+ -1, 3, 4, 5, -1, -1, -1, 9, 111, -1,
+ -1, 13, -1, 116, 16, 17, -1, 120, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
+ 82, 3, 4, 5, -1, -1, -1, 9, -1, -1,
+ -1, 13, -1, -1, -1, 97, 98, 99, 100, 101,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
+ -1, -1, -1, -1, 116, -1, -1, -1, 120, -1,
+ -1, -1, -1, 45, -1, -1, -1, -1, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
+ 82, 3, 4, 5, -1, -1, -1, 9, -1, -1,
+ -1, 13, -1, -1, -1, 97, 98, 99, 100, 101,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
+ -1, -1, -1, -1, 116, -1, -1, -1, 120, -1,
+ -1, -1, -1, 45, -1, -1, -1, -1, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
+ 82, 3, 4, 5, -1, -1, -1, 9, -1, -1,
+ -1, 13, -1, -1, -1, 97, 98, 99, 100, 101,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
+ -1, -1, -1, -1, 116, -1, -1, -1, 120, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
+ 82, -1, -1, -1, 16, 17, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 97, 98, 99, 100, 101,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
+ -1, -1, -1, -1, 116, -1, -1, -1, 120, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 91, 92, 93, 94, 95, 96, 16, 17, 45, -1,
+ -1, 48, -1, -1, -1, -1, -1, 79, 80, 81,
+ 82, 112, 113, 114, 115, 116, 117, 118, 119, -1,
+ 121, -1, -1, -1, -1, 97, 98, 99, 100, 101,
+ -1, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, -1, -1, 91, 92, 93, 94, 95, 96,
+ 45, -1, -1, 48, -1, -1, -1, -1, 130, 79,
+ 80, 81, 82, -1, -1, 112, 113, 114, 115, 116,
+ 117, 118, 119, -1, 121, -1, -1, 97, 98, 99,
+ 100, 101, 129, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, -1, -1, 91, 92, 93, 94,
+ 95, 96, -1, -1, -1, -1, -1, -1, -1, -1,
+ 130, 79, 80, 81, 82, -1, -1, 112, 113, 114,
+ 115, 116, 117, 118, 119, -1, 121, -1, -1, 97,
+ 98, 99, 100, 101, -1, -1, -1, -1, -1, -1,
+ -1, -1, 91, 92, 93, 94, 95, 96, -1, -1,
+ -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
+ -1, -1, 130, 112, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
+ 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
+ -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
+ -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
+ 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
+ -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
+ -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
+ 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
+ -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
+ -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
+ 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
+ -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
+ -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
+ 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
+ -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
+ -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
+ 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
+ -1, -1, 91, 92, 93, 94, 95, 96, -1, -1,
+ -1, -1, -1, 112, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 112, 113, 114, 115, 116, 117, 118,
+ 119, -1, 121, 91, 92, 93, 94, 95, 96, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 113, 114, 115, 116, 117,
+ 118, 119, -1, 121
+};
+#define YYPURE 1
+
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "/usr/local/lib/bison.simple"
+
+/* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+#ifdef __GNUC__
+#ifndef alloca
+#define alloca __builtin_alloca
+#endif /* Not alloca. */
+#else /* Not GNU C. */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
+#include <alloca.h>
+#endif /* Sparc. */
+#endif /* Not GNU C. */
+
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+/* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+ as one case of the switch. */
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYACCEPT return(0)
+#define YYABORT return(1)
+#define YYERROR goto yyerrlab1
+/* Like YYERROR except do call yyerror.
+ This remains here temporarily to ease the
+ transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define YYFAIL goto yyerrlab
+#define YYRECOVERING() (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { yychar = (token), yylval = (value); \
+ yychar1 = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { yyerror ("syntax error: cannot back up"); YYERROR; } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+#ifndef YYIMPURE
+#define YYLEX yylex()
+#endif
+
+#ifndef YYPURE
+#define YYLEX yylex(&yylval, &yylloc)
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYIMPURE
+
+int yychar; /* the lookahead symbol */
+YYSTYPE yylval; /* the semantic value of the */
+ /* lookahead symbol */
+
+#ifdef YYLSP_NEEDED
+YYLTYPE yylloc; /* location data for the lookahead */
+ /* symbol */
+#endif
+
+int yynerrs; /* number of parse errors so far */
+#endif /* YYIMPURE */
+
+#if YYDEBUG != 0
+int yydebug; /* nonzero means print parse trace */
+/* Since this is uninitialized, it does not stop multiple parsers
+ from coexisting. */
+#endif
+
+/* YYINITDEPTH indicates the initial size of the parser's stacks */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH is the maximum size the stacks can grow to
+ (effective only if the built-in stack extension method is used). */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+#ifdef __cplusplus
+__yy_bcopy (char *from, char *to, int count)
+#else
+__yy_bcopy (from, to, count)
+ char *from;
+ char *to;
+ int count;
+#endif
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#line 137 "/usr/local/lib/bison.simple"
+int
+yyparse()
+{
+ register int yystate;
+ register int yyn;
+ register short *yyssp;
+ register YYSTYPE *yyvsp;
+ int yyerrstatus; /* number of tokens to shift before error messages enabled */
+ int yychar1; /* lookahead token as an internal (translated) token number */
+
+ short yyssa[YYINITDEPTH]; /* the state stack */
+ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
+
+ short *yyss = yyssa; /* refer to the stacks thru separate pointers */
+ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+ YYLTYPE *yyls = yylsa;
+ YYLTYPE *yylsp;
+ YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
+
+#define YYPOPSTACK (yyvsp--, yysp--, yylsp--)
+#else
+#define YYPOPSTACK (yyvsp--, yysp--)
+#endif
+
+ int yystacksize = YYINITDEPTH;
+
+#ifndef YYPURE
+ int yychar;
+ YYSTYPE yylval;
+ int yynerrs;
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylloc;
+#endif
+#endif
+
+ YYSTYPE yyval; /* the variable used to return */
+ /* semantic values from the action */
+ /* routines */
+
+ int yylen;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Starting parse\n");
+#endif
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack. */
+
+ yyssp = yyss - 1;
+ yyvsp = yyvs;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in yystate . */
+/* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks. */
+yynewstate:
+
+ *++yyssp = yystate;
+
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ /* Give user a chance to reallocate the stack */
+ /* Use copies of these so that the &'s don't force the real ones into memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+#ifdef YYLSP_NEEDED
+ YYLTYPE *yyls1 = yyls;
+#endif
+
+ /* Get the current used size of the three stacks, in elements. */
+ int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ /* Each stack pointer address is followed by the size of
+ the data in use in that stack, in bytes. */
+ yyoverflow("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+#ifdef YYLSP_NEEDED
+ &yyls1, size * sizeof (*yylsp),
+#endif
+ &yystacksize);
+
+ yyss = yyss1; yyvs = yyvs1;
+#ifdef YYLSP_NEEDED
+ yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+ /* Extend the stack our own way. */
+ if (yystacksize >= YYMAXDEPTH)
+ {
+ yyerror("parser stack overflow");
+ return 2;
+ }
+ yystacksize *= 2;
+ if (yystacksize > YYMAXDEPTH)
+ yystacksize = YYMAXDEPTH;
+ yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+ __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
+ yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+ __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
+#ifdef YYLSP_NEEDED
+ yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+ __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+#endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + size - 1;
+ yyvsp = yyvs + size - 1;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+ if (yyssp >= yyss + yystacksize - 1)
+ YYABORT;
+ }
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+ yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
+ if (yychar == YYEMPTY)
+ {
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Reading a token: ");
+#endif
+ yychar = YYLEX;
+ }
+
+ /* Convert token to internal form (in yychar1) for indexing tables with */
+
+ if (yychar <= 0) /* This means end of input. */
+ {
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Now at end of input.\n");
+#endif
+ }
+ else
+ {
+ yychar1 = YYTRANSLATE(yychar);
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
+#endif
+ }
+
+ yyn += yychar1;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+ goto yydefault;
+
+ yyn = yytable[yyn];
+
+ /* yyn is what to do for this token type in this state.
+ Negative => reduce, -yyn is rule number.
+ Positive => shift, yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrlab;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
+#endif
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ /* count tokens shifted since error; after three, turn off error status. */
+ if (yyerrstatus) yyerrstatus--;
+
+ yystate = yyn;
+ goto yynewstate;
+
+/* Do the default action for the current state. */
+yydefault:
+
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+
+/* Do a reduction. yyn is the number of a rule to reduce with. */
+yyreduce:
+ yylen = yyr2[yyn];
+ yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ if (yylen == 1)
+ fprintf (stderr, "Reducing 1 value via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
+ else
+ fprintf (stderr, "Reducing %d values via rule %d (line %d), ",
+ yylen, yyn, yyrline[yyn]);
+ }
+#endif
+
+
+ switch (yyn) {
+
+case 2:
+#line 266 "pic.y"
+{
+ if (olist.head)
+ print_picture(olist.head);
+ ;
+ break;}
+case 3:
+#line 275 "pic.y"
+{ yyval.pl = yyvsp[-1].pl; ;
+ break;}
+case 4:
+#line 280 "pic.y"
+{ yyval.pl = yyvsp[0].pl; ;
+ break;}
+case 5:
+#line 282 "pic.y"
+{ yyval.pl = yyvsp[-2].pl; ;
+ break;}
+case 10:
+#line 297 "pic.y"
+{
+ define_variable(yyvsp[-2].str, yyvsp[0].x);
+ delete yyvsp[-2].str;
+ ;
+ break;}
+case 11:
+#line 302 "pic.y"
+{ current_direction = UP_DIRECTION; ;
+ break;}
+case 12:
+#line 304 "pic.y"
+{ current_direction = DOWN_DIRECTION; ;
+ break;}
+case 13:
+#line 306 "pic.y"
+{ current_direction = LEFT_DIRECTION; ;
+ break;}
+case 14:
+#line 308 "pic.y"
+{ current_direction = RIGHT_DIRECTION; ;
+ break;}
+case 15:
+#line 310 "pic.y"
+{
+ olist.append(make_command_object(yyvsp[0].lstr.str,
+ yyvsp[0].lstr.filename,
+ yyvsp[0].lstr.lineno));
+ ;
+ break;}
+case 16:
+#line 316 "pic.y"
+{
+ fprintf(stderr, "%g\n", yyvsp[0].x);
+ fflush(stderr);
+ ;
+ break;}
+case 17:
+#line 321 "pic.y"
+{
+ fprintf(stderr, "%s\n", yyvsp[0].lstr.str);
+ delete yyvsp[0].lstr.str;
+ fflush(stderr);
+ ;
+ break;}
+case 18:
+#line 327 "pic.y"
+{
+ fprintf(stderr, "%g, %g\n", yyvsp[0].pair.x, yyvsp[0].pair.y);
+ fflush(stderr);
+ ;
+ break;}
+case 19:
+#line 332 "pic.y"
+{ delim_flag = 1; ;
+ break;}
+case 20:
+#line 334 "pic.y"
+{
+ delim_flag = 0;
+ system(yyvsp[0].str);
+ delete yyvsp[0].str;
+ ;
+ break;}
+case 21:
+#line 340 "pic.y"
+{
+ if (yychar < 0)
+ do_lookahead();
+ do_copy(yyvsp[0].lstr.str);
+ // do not delete the filename
+ ;
+ break;}
+case 22:
+#line 347 "pic.y"
+{ delim_flag = 2; ;
+ break;}
+case 23:
+#line 349 "pic.y"
+{ delim_flag = 0; ;
+ break;}
+case 24:
+#line 351 "pic.y"
+{
+ if (yychar < 0)
+ do_lookahead();
+ copy_file_thru(yyvsp[-5].lstr.str, yyvsp[-2].str, yyvsp[0].str);
+ // do not delete the filename
+ delete yyvsp[-2].str;
+ delete yyvsp[0].str;
+ ;
+ break;}
+case 25:
+#line 360 "pic.y"
+{ delim_flag = 2; ;
+ break;}
+case 26:
+#line 362 "pic.y"
+{ delim_flag = 0; ;
+ break;}
+case 27:
+#line 364 "pic.y"
+{
+ if (yychar < 0)
+ do_lookahead();
+ copy_rest_thru(yyvsp[-2].str, yyvsp[0].str);
+ delete yyvsp[-2].str;
+ delete yyvsp[0].str;
+ ;
+ break;}
+case 28:
+#line 372 "pic.y"
+{ delim_flag = 1; ;
+ break;}
+case 29:
+#line 374 "pic.y"
+{
+ delim_flag = 0;
+ if (yychar < 0)
+ do_lookahead();
+ do_for(yyvsp[-8].str, yyvsp[-6].x, yyvsp[-4].x, yyvsp[-3].by.is_multiplicative, yyvsp[-3].by.val, yyvsp[0].str);
+ ;
+ break;}
+case 30:
+#line 381 "pic.y"
+{
+ if (yychar < 0)
+ do_lookahead();
+ if (yyvsp[0].if_data.x != 0.0)
+ push_body(yyvsp[0].if_data.body);
+ delete yyvsp[0].if_data.body;
+ ;
+ break;}
+case 31:
+#line 389 "pic.y"
+{ delim_flag = 1; ;
+ break;}
+case 32:
+#line 391 "pic.y"
+{
+ delim_flag = 0;
+ if (yychar < 0)
+ do_lookahead();
+ if (yyvsp[-3].if_data.x != 0.0)
+ push_body(yyvsp[-3].if_data.body);
+ else
+ push_body(yyvsp[0].str);
+ delete yyvsp[-3].if_data.body;
+ delete yyvsp[0].str;
+ ;
+ break;}
+case 34:
+#line 404 "pic.y"
+{ define_variable("scale", 1.0); ;
+ break;}
+case 35:
+#line 409 "pic.y"
+{ reset(yyvsp[0].str); delete yyvsp[0].str; ;
+ break;}
+case 36:
+#line 411 "pic.y"
+{ reset(yyvsp[0].str); delete yyvsp[0].str; ;
+ break;}
+case 37:
+#line 413 "pic.y"
+{ reset(yyvsp[0].str); delete yyvsp[0].str; ;
+ break;}
+case 38:
+#line 418 "pic.y"
+{ delim_flag = 1; ;
+ break;}
+case 39:
+#line 420 "pic.y"
+{ delim_flag = 0; yyval.if_data.x = yyvsp[-3].x; yyval.if_data.body = yyvsp[0].str; ;
+ break;}
+case 40:
+#line 425 "pic.y"
+{ yyval.str = 0; ;
+ break;}
+case 41:
+#line 427 "pic.y"
+{ yyval.str = yyvsp[0].lstr.str; ;
+ break;}
+case 42:
+#line 432 "pic.y"
+{ yyval.x = yyvsp[0].x; ;
+ break;}
+case 43:
+#line 434 "pic.y"
+{
+ yyval.x = strcmp(yyvsp[-2].lstr.str, yyvsp[0].lstr.str) == 0;
+ delete yyvsp[-2].lstr.str;
+ delete yyvsp[0].lstr.str;
+ ;
+ break;}
+case 44:
+#line 440 "pic.y"
+{
+ yyval.x = strcmp(yyvsp[-2].lstr.str, yyvsp[0].lstr.str) != 0;
+ delete yyvsp[-2].lstr.str;
+ delete yyvsp[0].lstr.str;
+ ;
+ break;}
+case 45:
+#line 448 "pic.y"
+{ yyval.by.val = 1.0; yyval.by.is_multiplicative = 0; ;
+ break;}
+case 46:
+#line 450 "pic.y"
+{ yyval.by.val = yyvsp[0].x; yyval.by.is_multiplicative = 0; ;
+ break;}
+case 47:
+#line 452 "pic.y"
+{ yyval.by.val = yyvsp[0].x; yyval.by.is_multiplicative = 1; ;
+ break;}
+case 48:
+#line 457 "pic.y"
+{
+ yyval.pl.obj = yyvsp[0].spec->make_object(¤t_position,
+ ¤t_direction);
+ if (yyval.pl.obj == 0)
+ YYABORT;
+ delete yyvsp[0].spec;
+ if (yyval.pl.obj)
+ olist.append(yyval.pl.obj);
+ else {
+ yyval.pl.x = current_position.x;
+ yyval.pl.y = current_position.y;
+ }
+ ;
+ break;}
+case 49:
+#line 471 "pic.y"
+{ yyval.pl = yyvsp[0].pl; define_label(yyvsp[-3].str, & yyval.pl); delete yyvsp[-3].str; ;
+ break;}
+case 50:
+#line 473 "pic.y"
+{
+ yyval.pl.obj = 0;
+ yyval.pl.x = yyvsp[0].pair.x;
+ yyval.pl.y = yyvsp[0].pair.y;
+ define_label(yyvsp[-3].str, & yyval.pl);
+ delete yyvsp[-3].str;
+ ;
+ break;}
+case 51:
+#line 481 "pic.y"
+{
+ yyval.pl = yyvsp[0].pl;
+ define_label(yyvsp[-3].str, & yyval.pl);
+ delete yyvsp[-3].str;
+ ;
+ break;}
+case 52:
+#line 487 "pic.y"
+{
+ yyval.state.x = current_position.x;
+ yyval.state.y = current_position.y;
+ yyval.state.dir = current_direction;
+ ;
+ break;}
+case 53:
+#line 493 "pic.y"
+{
+ current_position.x = yyvsp[-2].state.x;
+ current_position.y = yyvsp[-2].state.y;
+ current_direction = yyvsp[-2].state.dir;
+ yyval.pl = yyvsp[-1].pl;
+ ;
+ break;}
+case 54:
+#line 500 "pic.y"
+{
+ yyval.pl.obj = 0;
+ yyval.pl.x = current_position.x;
+ yyval.pl.y = current_position.y;
+ ;
+ break;}
+case 55:
+#line 509 "pic.y"
+{
+ yyval.spec = new object_spec(BOX_OBJECT);
+ ;
+ break;}
+case 56:
+#line 513 "pic.y"
+{
+ yyval.spec = new object_spec(CIRCLE_OBJECT);
+ ;
+ break;}
+case 57:
+#line 517 "pic.y"
+{
+ yyval.spec = new object_spec(ELLIPSE_OBJECT);
+ ;
+ break;}
+case 58:
+#line 521 "pic.y"
+{
+ yyval.spec = new object_spec(ARC_OBJECT);
+ yyval.spec->dir = current_direction;
+ ;
+ break;}
+case 59:
+#line 526 "pic.y"
+{
+ yyval.spec = new object_spec(LINE_OBJECT);
+ lookup_variable("lineht", & yyval.spec->segment_height);
+ lookup_variable("linewid", & yyval.spec->segment_width);
+ yyval.spec->dir = current_direction;
+ ;
+ break;}
+case 60:
+#line 533 "pic.y"
+{
+ yyval.spec = new object_spec(ARROW_OBJECT);
+ lookup_variable("lineht", & yyval.spec->segment_height);
+ lookup_variable("linewid", & yyval.spec->segment_width);
+ yyval.spec->dir = current_direction;
+ ;
+ break;}
+case 61:
+#line 540 "pic.y"
+{
+ yyval.spec = new object_spec(MOVE_OBJECT);
+ lookup_variable("moveht", & yyval.spec->segment_height);
+ lookup_variable("movewid", & yyval.spec->segment_width);
+ yyval.spec->dir = current_direction;
+ ;
+ break;}
+case 62:
+#line 547 "pic.y"
+{
+ yyval.spec = new object_spec(SPLINE_OBJECT);
+ lookup_variable("lineht", & yyval.spec->segment_height);
+ lookup_variable("linewid", & yyval.spec->segment_width);
+ yyval.spec->dir = current_direction;
+ ;
+ break;}
+case 63:
+#line 554 "pic.y"
+{
+ yyval.spec = new object_spec(TEXT_OBJECT);
+ yyval.spec->text = new text_item(yyvsp[0].lstr.str, yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
+ ;
+ break;}
+case 64:
+#line 559 "pic.y"
+{
+ yyval.spec = new object_spec(TEXT_OBJECT);
+ yyval.spec->text = new text_item(format_number(0, yyvsp[0].x), 0, -1);
+ ;
+ break;}
+case 65:
+#line 564 "pic.y"
+{
+ yyval.spec = new object_spec(TEXT_OBJECT);
+ yyval.spec->text = new text_item(format_number(yyvsp[0].lstr.str, yyvsp[-1].x),
+ yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
+ delete yyvsp[0].lstr.str;
+ ;
+ break;}
+case 66:
+#line 571 "pic.y"
+{
+ saved_state *p = new saved_state;
+ yyval.pstate = p;
+ p->x = current_position.x;
+ p->y = current_position.y;
+ p->dir = current_direction;
+ p->tbl = current_table;
+ p->prev = current_saved_state;
+ current_position.x = 0.0;
+ current_position.y = 0.0;
+ current_table = new PTABLE(place);
+ current_saved_state = p;
+ olist.append(make_mark_object());
+ ;
+ break;}
+case 67:
+#line 586 "pic.y"
+{
+ current_position.x = yyvsp[-2].pstate->x;
+ current_position.y = yyvsp[-2].pstate->y;
+ current_direction = yyvsp[-2].pstate->dir;
+ yyval.spec = new object_spec(BLOCK_OBJECT);
+ olist.wrap_up_block(& yyval.spec->oblist);
+ yyval.spec->tbl = current_table;
+ current_table = yyvsp[-2].pstate->tbl;
+ current_saved_state = yyvsp[-2].pstate->prev;
+ delete yyvsp[-2].pstate;
+ ;
+ break;}
+case 68:
+#line 598 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->height = yyvsp[0].x;
+ yyval.spec->flags |= HAS_HEIGHT;
+ ;
+ break;}
+case 69:
+#line 604 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->radius = yyvsp[0].x;
+ yyval.spec->flags |= HAS_RADIUS;
+ ;
+ break;}
+case 70:
+#line 610 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->width = yyvsp[0].x;
+ yyval.spec->flags |= HAS_WIDTH;
+ ;
+ break;}
+case 71:
+#line 616 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->radius = yyvsp[0].x/2.0;
+ yyval.spec->flags |= HAS_RADIUS;
+ ;
+ break;}
+case 72:
+#line 622 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= HAS_SEGMENT;
+ switch (yyval.spec->dir) {
+ case UP_DIRECTION:
+ yyval.spec->segment_pos.y += yyvsp[0].x;
+ break;
+ case DOWN_DIRECTION:
+ yyval.spec->segment_pos.y -= yyvsp[0].x;
+ break;
+ case RIGHT_DIRECTION:
+ yyval.spec->segment_pos.x += yyvsp[0].x;
+ break;
+ case LEFT_DIRECTION:
+ yyval.spec->segment_pos.x -= yyvsp[0].x;
+ break;
+ }
+ ;
+ break;}
+case 73:
+#line 641 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->dir = UP_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.y += yyval.spec->segment_height;
+ ;
+ break;}
+case 74:
+#line 648 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->dir = UP_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.y += yyvsp[0].x;
+ ;
+ break;}
+case 75:
+#line 655 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->dir = DOWN_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.y -= yyval.spec->segment_height;
+ ;
+ break;}
+case 76:
+#line 662 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->dir = DOWN_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.y -= yyvsp[0].x;
+ ;
+ break;}
+case 77:
+#line 669 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->dir = RIGHT_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.x += yyval.spec->segment_width;
+ ;
+ break;}
+case 78:
+#line 676 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->dir = RIGHT_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.x += yyvsp[0].x;
+ ;
+ break;}
+case 79:
+#line 683 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->dir = LEFT_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.x -= yyval.spec->segment_width;
+ ;
+ break;}
+case 80:
+#line 690 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->dir = LEFT_DIRECTION;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.x -= yyvsp[0].x;
+ ;
+ break;}
+case 81:
+#line 697 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= HAS_FROM;
+ yyval.spec->from.x = yyvsp[0].pair.x;
+ yyval.spec->from.y = yyvsp[0].pair.y;
+ ;
+ break;}
+case 82:
+#line 704 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ if (yyval.spec->flags & HAS_SEGMENT)
+ yyval.spec->segment_list = new segment(yyval.spec->segment_pos,
+ yyval.spec->segment_is_absolute,
+ yyval.spec->segment_list);
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.x = yyvsp[0].pair.x;
+ yyval.spec->segment_pos.y = yyvsp[0].pair.y;
+ yyval.spec->segment_is_absolute = 1;
+ yyval.spec->flags |= HAS_TO;
+ yyval.spec->to.x = yyvsp[0].pair.x;
+ yyval.spec->to.y = yyvsp[0].pair.y;
+ ;
+ break;}
+case 83:
+#line 719 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= HAS_AT;
+ yyval.spec->at.x = yyvsp[0].pair.x;
+ yyval.spec->at.y = yyvsp[0].pair.y;
+ if (yyval.spec->type != ARC_OBJECT) {
+ yyval.spec->flags |= HAS_FROM;
+ yyval.spec->from.x = yyvsp[0].pair.x;
+ yyval.spec->from.y = yyvsp[0].pair.y;
+ }
+ ;
+ break;}
+case 84:
+#line 731 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= HAS_WITH;
+ yyval.spec->with = yyvsp[0].pth;
+ ;
+ break;}
+case 85:
+#line 737 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= HAS_SEGMENT;
+ yyval.spec->segment_pos.x += yyvsp[0].pair.x;
+ yyval.spec->segment_pos.y += yyvsp[0].pair.y;
+ ;
+ break;}
+case 86:
+#line 744 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ if (yyval.spec->flags & HAS_SEGMENT) {
+ yyval.spec->segment_list = new segment(yyval.spec->segment_pos,
+ yyval.spec->segment_is_absolute,
+ yyval.spec->segment_list);
+ yyval.spec->flags &= ~HAS_SEGMENT;
+ yyval.spec->segment_pos.x = yyval.spec->segment_pos.y = 0.0;
+ yyval.spec->segment_is_absolute = 0;
+ }
+ ;
+ break;}
+case 87:
+#line 756 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_DOTTED;
+ lookup_variable("dashwid", & yyval.spec->dash_width);
+ ;
+ break;}
+case 88:
+#line 762 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= IS_DOTTED;
+ yyval.spec->dash_width = yyvsp[0].x;
+ ;
+ break;}
+case 89:
+#line 768 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_DASHED;
+ lookup_variable("dashwid", & yyval.spec->dash_width);
+ ;
+ break;}
+case 90:
+#line 774 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= IS_DASHED;
+ yyval.spec->dash_width = yyvsp[0].x;
+ ;
+ break;}
+case 91:
+#line 780 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_DEFAULT_FILLED;
+ ;
+ break;}
+case 92:
+#line 785 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= IS_FILLED;
+ yyval.spec->fill = yyvsp[0].x;
+ ;
+ break;}
+case 93:
+#line 791 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ // line chop chop means line chop 0 chop 0
+ if (yyval.spec->flags & IS_DEFAULT_CHOPPED) {
+ yyval.spec->flags |= IS_CHOPPED;
+ yyval.spec->flags &= ~IS_DEFAULT_CHOPPED;
+ yyval.spec->start_chop = yyval.spec->end_chop = 0.0;
+ }
+ else if (yyval.spec->flags & IS_CHOPPED) {
+ yyval.spec->end_chop = 0.0;
+ }
+ else {
+ yyval.spec->flags |= IS_DEFAULT_CHOPPED;
+ }
+ ;
+ break;}
+case 94:
+#line 807 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ if (yyval.spec->flags & IS_DEFAULT_CHOPPED) {
+ yyval.spec->flags |= IS_CHOPPED;
+ yyval.spec->flags &= ~IS_DEFAULT_CHOPPED;
+ yyval.spec->start_chop = 0.0;
+ yyval.spec->end_chop = yyvsp[0].x;
+ }
+ else if (yyval.spec->flags & IS_CHOPPED) {
+ yyval.spec->end_chop = yyvsp[0].x;
+ }
+ else {
+ yyval.spec->start_chop = yyval.spec->end_chop = yyvsp[0].x;
+ yyval.spec->flags |= IS_CHOPPED;
+ }
+ ;
+ break;}
+case 95:
+#line 824 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_SAME;
+ ;
+ break;}
+case 96:
+#line 829 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_INVISIBLE;
+ ;
+ break;}
+case 97:
+#line 834 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= HAS_LEFT_ARROW_HEAD;
+ ;
+ break;}
+case 98:
+#line 839 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= HAS_RIGHT_ARROW_HEAD;
+ ;
+ break;}
+case 99:
+#line 844 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= (HAS_LEFT_ARROW_HEAD|HAS_RIGHT_ARROW_HEAD);
+ ;
+ break;}
+case 100:
+#line 849 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_CLOCKWISE;
+ ;
+ break;}
+case 101:
+#line 854 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags &= ~IS_CLOCKWISE;
+ ;
+ break;}
+case 102:
+#line 859 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ for (text_item **p = & yyval.spec->text; *p; p = &(*p)->next)
+ ;
+ *p = new text_item(yyvsp[0].lstr.str, yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
+ ;
+ break;}
+case 103:
+#line 866 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ if (yyval.spec->text) {
+ for (text_item *p = yyval.spec->text; p->next; p = p->next)
+ ;
+ p->adj.h = LEFT_ADJUST;
+ }
+ ;
+ break;}
+case 104:
+#line 875 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ if (yyval.spec->text) {
+ for (text_item *p = yyval.spec->text; p->next; p = p->next)
+ ;
+ p->adj.h = RIGHT_ADJUST;
+ }
+ ;
+ break;}
+case 105:
+#line 884 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ if (yyval.spec->text) {
+ for (text_item *p = yyval.spec->text; p->next; p = p->next)
+ ;
+ p->adj.v = ABOVE_ADJUST;
+ }
+ ;
+ break;}
+case 106:
+#line 893 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ if (yyval.spec->text) {
+ for (text_item *p = yyval.spec->text; p->next; p = p->next)
+ ;
+ p->adj.v = BELOW_ADJUST;
+ }
+ ;
+ break;}
+case 107:
+#line 902 "pic.y"
+{
+ yyval.spec = yyvsp[-2].spec;
+ yyval.spec->flags |= HAS_THICKNESS;
+ yyval.spec->thickness = yyvsp[0].x;
+ ;
+ break;}
+case 108:
+#line 908 "pic.y"
+{
+ yyval.spec = yyvsp[-1].spec;
+ yyval.spec->flags |= IS_ALIGNED;
+ ;
+ break;}
+case 109:
+#line 916 "pic.y"
+{
+ yyval.lstr = yyvsp[0].lstr;
+ ;
+ break;}
+case 110:
+#line 920 "pic.y"
+{
+ yyval.lstr.filename = yyvsp[-2].lstr.filename;
+ yyval.lstr.lineno = yyvsp[-2].lstr.lineno;
+ yyval.lstr.str = do_sprintf(yyvsp[-2].lstr.str, yyvsp[-1].dv.v, yyvsp[-1].dv.nv);
+ delete yyvsp[-1].dv.v;
+ delete yyvsp[-2].lstr.str;
+ ;
+ break;}
+case 111:
+#line 931 "pic.y"
+{
+ yyval.dv.v = 0;
+ yyval.dv.nv = 0;
+ yyval.dv.maxv = 0;
+ ;
+ break;}
+case 112:
+#line 937 "pic.y"
+{
+ yyval.dv = yyvsp[-2].dv;
+ if (yyval.dv.nv >= yyval.dv.maxv) {
+ if (yyval.dv.nv == 0) {
+ yyval.dv.v = new double[4];
+ yyval.dv.maxv = 4;
+ }
+ else {
+ double *oldv = yyval.dv.v;
+ yyval.dv.maxv *= 2;
+ yyval.dv.v = new double[yyval.dv.maxv];
+ memcpy(yyval.dv.v, oldv, yyval.dv.nv*sizeof(double));
+ delete oldv;
+ }
+ }
+ yyval.dv.v[yyval.dv.nv] = yyvsp[0].x;
+ yyval.dv.nv += 1;
+ ;
+ break;}
+case 113:
+#line 959 "pic.y"
+{ yyval.pair = yyvsp[0].pair; ;
+ break;}
+case 114:
+#line 961 "pic.y"
+{
+ position pos = yyvsp[0].pl;
+ yyval.pair.x = pos.x;
+ yyval.pair.y = pos.y;
+ ;
+ break;}
+case 115:
+#line 970 "pic.y"
+{ yyval.pair = yyvsp[0].pair; ;
+ break;}
+case 116:
+#line 972 "pic.y"
+{
+ yyval.pair.x = yyvsp[-2].pair.x + yyvsp[0].pair.x;
+ yyval.pair.y = yyvsp[-2].pair.y + yyvsp[0].pair.y;
+ ;
+ break;}
+case 117:
+#line 977 "pic.y"
+{
+ yyval.pair.x = yyvsp[-2].pair.x - yyvsp[0].pair.x;
+ yyval.pair.y = yyvsp[-2].pair.y - yyvsp[0].pair.y;
+ ;
+ break;}
+case 118:
+#line 982 "pic.y"
+{
+ yyval.pair.x = yyvsp[-3].pair.x;
+ yyval.pair.y = yyvsp[-1].pair.y;
+ ;
+ break;}
+case 119:
+#line 987 "pic.y"
+{
+ yyval.pair.x = (1.0 - yyvsp[-4].x)*yyvsp[-2].pair.x + yyvsp[-4].x*yyvsp[0].pair.x;
+ yyval.pair.y = (1.0 - yyvsp[-4].x)*yyvsp[-2].pair.y + yyvsp[-4].x*yyvsp[0].pair.y;
+ ;
+ break;}
+case 120:
+#line 992 "pic.y"
+{
+ yyval.pair.x = (1.0 - yyvsp[-5].x)*yyvsp[-3].pair.x + yyvsp[-5].x*yyvsp[-1].pair.x;
+ yyval.pair.y = (1.0 - yyvsp[-5].x)*yyvsp[-3].pair.y + yyvsp[-5].x*yyvsp[-1].pair.y;
+ ;
+ break;}
+case 123:
+#line 1005 "pic.y"
+{ yyval.pair.x = yyvsp[-2].x; yyval.pair.y = yyvsp[0].x; ;
+ break;}
+case 124:
+#line 1007 "pic.y"
+{ yyval.pair = yyvsp[-1].pair; ;
+ break;}
+case 125:
+#line 1012 "pic.y"
+{ yyval.pl = yyvsp[0].pl; ;
+ break;}
+case 126:
+#line 1014 "pic.y"
+{
+ path pth(yyvsp[0].crn);
+ if (!pth.follow(yyvsp[-1].pl, & yyval.pl))
+ YYABORT;
+ ;
+ break;}
+case 127:
+#line 1020 "pic.y"
+{
+ path pth(yyvsp[-1].crn);
+ if (!pth.follow(yyvsp[0].pl, & yyval.pl))
+ YYABORT;
+ ;
+ break;}
+case 128:
+#line 1026 "pic.y"
+{
+ path pth(yyvsp[-2].crn);
+ if (!pth.follow(yyvsp[0].pl, & yyval.pl))
+ YYABORT;
+ ;
+ break;}
+case 129:
+#line 1032 "pic.y"
+{
+ yyval.pl.x = current_position.x;
+ yyval.pl.y = current_position.y;
+ yyval.pl.obj = 0;
+ ;
+ break;}
+case 130:
+#line 1041 "pic.y"
+{
+ place *p = lookup_label(yyvsp[0].str);
+ if (!p) {
+ lex_error("there is no place `%1'", yyvsp[0].str);
+ YYABORT;
+ }
+ yyval.pl = *p;
+ delete yyvsp[0].str;
+ ;
+ break;}
+case 131:
+#line 1051 "pic.y"
+{
+ yyval.pl.obj = yyvsp[0].obj;
+ ;
+ break;}
+case 132:
+#line 1055 "pic.y"
+{
+ path pth(yyvsp[0].str);
+ if (!pth.follow(yyvsp[-2].pl, & yyval.pl))
+ YYABORT;
+ ;
+ break;}
+case 133:
+#line 1064 "pic.y"
+{ yyval.n = 1; ;
+ break;}
+case 134:
+#line 1066 "pic.y"
+{ yyval.n = yyvsp[-1].n; ;
+ break;}
+case 135:
+#line 1071 "pic.y"
+{
+ int count = 0;
+ for (object *p = olist.head; p != 0; p = p->next)
+ if (p->type() == yyvsp[0].obtype && ++count == yyvsp[-1].n) {
+ yyval.obj = p;
+ break;
+ }
+ if (p == 0) {
+ lex_error("there is no %1%2 %3", yyvsp[-1].n, ordinal_postfix(yyvsp[-1].n),
+ object_type_name(yyvsp[0].obtype));
+ YYABORT;
+ }
+ ;
+ break;}
+case 136:
+#line 1085 "pic.y"
+{
+ int count = 0;
+ for (object *p = olist.tail; p != 0; p = p->prev)
+ if (p->type() == yyvsp[0].obtype && ++count == yyvsp[-1].n) {
+ yyval.obj = p;
+ break;
+ }
+ if (p == 0) {
+ lex_error("there is no %1%2 last %3", yyvsp[-1].n,
+ ordinal_postfix(yyvsp[-1].n), object_type_name(yyvsp[0].obtype));
+ YYABORT;
+ }
+ ;
+ break;}
+case 137:
+#line 1102 "pic.y"
+{ yyval.obtype = BOX_OBJECT; ;
+ break;}
+case 138:
+#line 1104 "pic.y"
+{ yyval.obtype = CIRCLE_OBJECT; ;
+ break;}
+case 139:
+#line 1106 "pic.y"
+{ yyval.obtype = ELLIPSE_OBJECT; ;
+ break;}
+case 140:
+#line 1108 "pic.y"
+{ yyval.obtype = ARC_OBJECT; ;
+ break;}
+case 141:
+#line 1110 "pic.y"
+{ yyval.obtype = LINE_OBJECT; ;
+ break;}
+case 142:
+#line 1112 "pic.y"
+{ yyval.obtype = ARROW_OBJECT; ;
+ break;}
+case 143:
+#line 1114 "pic.y"
+{ yyval.obtype = SPLINE_OBJECT; ;
+ break;}
+case 144:
+#line 1116 "pic.y"
+{ yyval.obtype = BLOCK_OBJECT; ;
+ break;}
+case 145:
+#line 1118 "pic.y"
+{ yyval.obtype = TEXT_OBJECT; ;
+ break;}
+case 146:
+#line 1123 "pic.y"
+{
+ yyval.pth = new path(yyvsp[0].str);
+ ;
+ break;}
+case 147:
+#line 1127 "pic.y"
+{
+ yyval.pth = yyvsp[-2].pth;
+ yyval.pth->append(yyvsp[0].str);
+ ;
+ break;}
+case 148:
+#line 1135 "pic.y"
+{
+ yyval.pth = new path(yyvsp[0].crn);
+ ;
+ break;}
+case 149:
+#line 1142 "pic.y"
+{
+ yyval.pth = yyvsp[0].pth;
+ ;
+ break;}
+case 150:
+#line 1146 "pic.y"
+{
+ yyval.pth = yyvsp[-1].pth;
+ yyval.pth->append(yyvsp[0].crn);
+ ;
+ break;}
+case 151:
+#line 1154 "pic.y"
+{
+ yyval.pth = yyvsp[0].pth;
+ ;
+ break;}
+case 152:
+#line 1159 "pic.y"
+{
+ lex_warning("`%1%2 last %3' in `with' argument ignored",
+ yyvsp[-3].n, ordinal_postfix(yyvsp[-3].n), object_type_name(yyvsp[-1].obtype));
+ yyval.pth = yyvsp[0].pth;
+ ;
+ break;}
+case 153:
+#line 1165 "pic.y"
+{
+ lex_warning("`last %1' in `with' argument ignored",
+ object_type_name(yyvsp[-1].obtype));
+ yyval.pth = yyvsp[0].pth;
+ ;
+ break;}
+case 154:
+#line 1171 "pic.y"
+{
+ lex_warning("`%1%2 %3' in `with' argument ignored",
+ yyvsp[-2].n, ordinal_postfix(yyvsp[-2].n), object_type_name(yyvsp[-1].obtype));
+ yyval.pth = yyvsp[0].pth;
+ ;
+ break;}
+case 155:
+#line 1177 "pic.y"
+{
+ lex_warning("initial `%1' in `with' argument ignored", yyvsp[-1].str);
+ delete yyvsp[-1].str;
+ yyval.pth = yyvsp[0].pth;
+ ;
+ break;}
+case 156:
+#line 1186 "pic.y"
+{ yyval.crn = &object::north; ;
+ break;}
+case 157:
+#line 1188 "pic.y"
+{ yyval.crn = &object::east; ;
+ break;}
+case 158:
+#line 1190 "pic.y"
+{ yyval.crn = &object::west; ;
+ break;}
+case 159:
+#line 1192 "pic.y"
+{ yyval.crn = &object::south; ;
+ break;}
+case 160:
+#line 1194 "pic.y"
+{ yyval.crn = &object::north_east; ;
+ break;}
+case 161:
+#line 1196 "pic.y"
+{ yyval.crn = &object:: south_east; ;
+ break;}
+case 162:
+#line 1198 "pic.y"
+{ yyval.crn = &object::north_west; ;
+ break;}
+case 163:
+#line 1200 "pic.y"
+{ yyval.crn = &object::south_west; ;
+ break;}
+case 164:
+#line 1202 "pic.y"
+{ yyval.crn = &object::center; ;
+ break;}
+case 165:
+#line 1204 "pic.y"
+{ yyval.crn = &object::start; ;
+ break;}
+case 166:
+#line 1206 "pic.y"
+{ yyval.crn = &object::end; ;
+ break;}
+case 167:
+#line 1208 "pic.y"
+{ yyval.crn = &object::north; ;
+ break;}
+case 168:
+#line 1210 "pic.y"
+{ yyval.crn = &object::south; ;
+ break;}
+case 169:
+#line 1212 "pic.y"
+{ yyval.crn = &object::west; ;
+ break;}
+case 170:
+#line 1214 "pic.y"
+{ yyval.crn = &object::east; ;
+ break;}
+case 171:
+#line 1216 "pic.y"
+{ yyval.crn = &object::north_west; ;
+ break;}
+case 172:
+#line 1218 "pic.y"
+{ yyval.crn = &object::south_west; ;
+ break;}
+case 173:
+#line 1220 "pic.y"
+{ yyval.crn = &object::north_east; ;
+ break;}
+case 174:
+#line 1222 "pic.y"
+{ yyval.crn = &object::south_east; ;
+ break;}
+case 175:
+#line 1224 "pic.y"
+{ yyval.crn = &object::west; ;
+ break;}
+case 176:
+#line 1226 "pic.y"
+{ yyval.crn = &object::east; ;
+ break;}
+case 177:
+#line 1228 "pic.y"
+{ yyval.crn = &object::north_west; ;
+ break;}
+case 178:
+#line 1230 "pic.y"
+{ yyval.crn = &object::south_west; ;
+ break;}
+case 179:
+#line 1232 "pic.y"
+{ yyval.crn = &object::north_east; ;
+ break;}
+case 180:
+#line 1234 "pic.y"
+{ yyval.crn = &object::south_east; ;
+ break;}
+case 181:
+#line 1236 "pic.y"
+{ yyval.crn = &object::center; ;
+ break;}
+case 182:
+#line 1238 "pic.y"
+{ yyval.crn = &object::start; ;
+ break;}
+case 183:
+#line 1240 "pic.y"
+{ yyval.crn = &object::end; ;
+ break;}
+case 184:
+#line 1245 "pic.y"
+{
+ if (!lookup_variable(yyvsp[0].str, & yyval.x)) {
+ lex_error("there is no variable `%1'", yyvsp[0].str);
+ YYABORT;
+ }
+ delete yyvsp[0].str;
+ ;
+ break;}
+case 185:
+#line 1253 "pic.y"
+{ yyval.x = yyvsp[0].x; ;
+ break;}
+case 186:
+#line 1255 "pic.y"
+{
+ if (yyvsp[-1].pl.obj != 0)
+ yyval.x = yyvsp[-1].pl.obj->origin().x;
+ else
+ yyval.x = yyvsp[-1].pl.x;
+ ;
+ break;}
+case 187:
+#line 1262 "pic.y"
+{
+ if (yyvsp[-1].pl.obj != 0)
+ yyval.x = yyvsp[-1].pl.obj->origin().y;
+ else
+ yyval.x = yyvsp[-1].pl.y;
+ ;
+ break;}
+case 188:
+#line 1269 "pic.y"
+{
+ if (yyvsp[-1].pl.obj != 0)
+ yyval.x = yyvsp[-1].pl.obj->height();
+ else
+ yyval.x = 0.0;
+ ;
+ break;}
+case 189:
+#line 1276 "pic.y"
+{
+ if (yyvsp[-1].pl.obj != 0)
+ yyval.x = yyvsp[-1].pl.obj->width();
+ else
+ yyval.x = 0.0;
+ ;
+ break;}
+case 190:
+#line 1283 "pic.y"
+{
+ if (yyvsp[-1].pl.obj != 0)
+ yyval.x = yyvsp[-1].pl.obj->radius();
+ else
+ yyval.x = 0.0;
+ ;
+ break;}
+case 191:
+#line 1290 "pic.y"
+{ yyval.x = yyvsp[-2].x + yyvsp[0].x; ;
+ break;}
+case 192:
+#line 1292 "pic.y"
+{ yyval.x = yyvsp[-2].x - yyvsp[0].x; ;
+ break;}
+case 193:
+#line 1294 "pic.y"
+{ yyval.x = yyvsp[-2].x * yyvsp[0].x; ;
+ break;}
+case 194:
+#line 1296 "pic.y"
+{
+ if (yyvsp[0].x == 0.0) {
+ lex_error("division by zero");
+ YYABORT;
+ }
+ yyval.x = yyvsp[-2].x/yyvsp[0].x;
+ ;
+ break;}
+case 195:
+#line 1304 "pic.y"
+{
+ if (yyvsp[0].x == 0.0) {
+ lex_error("modulus by zero");
+ YYABORT;
+ }
+ yyval.x = fmod(yyvsp[-2].x, yyvsp[0].x);
+ ;
+ break;}
+case 196:
+#line 1312 "pic.y"
+{
+ errno = 0;
+ yyval.x = pow(yyvsp[-2].x, yyvsp[0].x);
+ if (errno == EDOM) {
+ lex_error("arguments to `^' operator out of domain");
+ YYABORT;
+ }
+ if (errno == ERANGE) {
+ lex_error("result of `^' operator out of range");
+ YYABORT;
+ }
+ ;
+ break;}
+case 197:
+#line 1325 "pic.y"
+{ yyval.x = -yyvsp[0].x; ;
+ break;}
+case 198:
+#line 1327 "pic.y"
+{ yyval.x = yyvsp[-1].x; ;
+ break;}
+case 199:
+#line 1329 "pic.y"
+{
+ errno = 0;
+ yyval.x = sin(yyvsp[-1].x);
+ if (errno == ERANGE) {
+ lex_error("sin result out of range");
+ YYABORT;
+ }
+ ;
+ break;}
+case 200:
+#line 1338 "pic.y"
+{
+ errno = 0;
+ yyval.x = cos(yyvsp[-1].x);
+ if (errno == ERANGE) {
+ lex_error("cos result out of range");
+ YYABORT;
+ }
+ ;
+ break;}
+case 201:
+#line 1347 "pic.y"
+{
+ errno = 0;
+ yyval.x = atan2(yyvsp[-3].x, yyvsp[-1].x);
+ if (errno == EDOM) {
+ lex_error("atan2 argument out of domain");
+ YYABORT;
+ }
+ if (errno == ERANGE) {
+ lex_error("atan2 result out of range");
+ YYABORT;
+ }
+ ;
+ break;}
+case 202:
+#line 1360 "pic.y"
+{
+ errno = 0;
+ yyval.x = log10(yyvsp[-1].x);
+ if (errno == ERANGE) {
+ lex_error("log result out of range");
+ YYABORT;
+ }
+ ;
+ break;}
+case 203:
+#line 1369 "pic.y"
+{
+ errno = 0;
+ yyval.x = pow(10.0, yyvsp[-1].x);
+ if (errno == ERANGE) {
+ lex_error("exp result out of range");
+ YYABORT;
+ }
+ ;
+ break;}
+case 204:
+#line 1378 "pic.y"
+{
+ errno = 0;
+ yyval.x = sqrt(yyvsp[-1].x);
+ if (errno == EDOM) {
+ lex_error("sqrt argument out of domain");
+ YYABORT;
+ }
+ ;
+ break;}
+case 205:
+#line 1387 "pic.y"
+{ yyval.x = yyvsp[-3].x > yyvsp[-1].x ? yyvsp[-3].x : yyvsp[-1].x; ;
+ break;}
+case 206:
+#line 1389 "pic.y"
+{ yyval.x = yyvsp[-3].x > yyvsp[-1].x ? yyvsp[-3].x : yyvsp[-1].x; ;
+ break;}
+case 207:
+#line 1391 "pic.y"
+{ yyval.x = floor(yyvsp[-1].x); ;
+ break;}
+case 208:
+#line 1393 "pic.y"
+{ yyval.x = 1.0 + floor(((rand()&0x7fff)/double(0x7fff))*yyvsp[-1].x); ;
+ break;}
+case 209:
+#line 1395 "pic.y"
+{
+ /* return a random number in the range [0,1) */
+ /* portable, but not very random */
+ yyval.x = (rand() & 0x7fff) / double(0x8000);
+ ;
+ break;}
+case 210:
+#line 1401 "pic.y"
+{ yyval.x = (yyvsp[-2].x < yyvsp[0].x); ;
+ break;}
+case 211:
+#line 1403 "pic.y"
+{ yyval.x = (yyvsp[-2].x <= yyvsp[0].x); ;
+ break;}
+case 212:
+#line 1405 "pic.y"
+{ yyval.x = (yyvsp[-2].x > yyvsp[0].x); ;
+ break;}
+case 213:
+#line 1407 "pic.y"
+{ yyval.x = (yyvsp[-2].x >= yyvsp[0].x); ;
+ break;}
+case 214:
+#line 1409 "pic.y"
+{ yyval.x = (yyvsp[-2].x == yyvsp[0].x); ;
+ break;}
+case 215:
+#line 1411 "pic.y"
+{ yyval.x = (yyvsp[-2].x != yyvsp[0].x); ;
+ break;}
+case 216:
+#line 1413 "pic.y"
+{ yyval.x = (yyvsp[-2].x != 0.0 && yyvsp[0].x != 0.0); ;
+ break;}
+case 217:
+#line 1415 "pic.y"
+{ yyval.x = (yyvsp[-2].x != 0.0 || yyvsp[0].x != 0.0); ;
+ break;}
+case 218:
+#line 1417 "pic.y"
+{ yyval.x = (yyvsp[0].x == 0.0); ;
+ break;}
+}
+ /* the action file gets copied in in place of this dollarsign */
+#line 362 "/usr/local/lib/bison.simple"
+\f
+ yyvsp -= yylen;
+ yyssp -= yylen;
+#ifdef YYLSP_NEEDED
+ yylsp -= yylen;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ *++yyvsp = yyval;
+
+#ifdef YYLSP_NEEDED
+ yylsp++;
+ if (yylen == 0)
+ {
+ yylsp->first_line = yylloc.first_line;
+ yylsp->first_column = yylloc.first_column;
+ yylsp->last_line = (yylsp-1)->last_line;
+ yylsp->last_column = (yylsp-1)->last_column;
+ yylsp->text = 0;
+ }
+ else
+ {
+ yylsp->last_line = (yylsp+yylen-1)->last_line;
+ yylsp->last_column = (yylsp+yylen-1)->last_column;
+ }
+#endif
+
+ /* Now "shift" the result of the reduction.
+ Determine what state that goes to,
+ based on the state we popped back to
+ and the rule number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTBASE];
+
+ goto yynewstate;
+
+yyerrlab: /* here on detecting error */
+
+ if (! yyerrstatus)
+ /* If not already recovering from an error, report this error. */
+ {
+ ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (yyn > YYFLAG && yyn < YYLAST)
+ {
+ int size = 0;
+ char *msg;
+ int x, count;
+
+ count = 0;
+ for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ size += strlen(yytname[x]) + 15, count++;
+ msg = (char *) xmalloc(size + 15);
+ strcpy(msg, "parse error");
+
+ if (count < 5)
+ {
+ count = 0;
+ for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ {
+ strcat(msg, count == 0 ? ", expecting `" : " or `");
+ strcat(msg, yytname[x]);
+ strcat(msg, "'");
+ count++;
+ }
+ }
+ yyerror(msg);
+ free(msg);
+ }
+ else
+#endif /* YYERROR_VERBOSE */
+ yyerror("parse error");
+ }
+
+yyerrlab1: /* here on error raised explicitly by an action */
+
+ if (yyerrstatus == 3)
+ {
+ /* if just tried and failed to reuse lookahead token after an error, discard it. */
+
+ /* return failure if at end of input */
+ if (yychar == YYEOF)
+ YYABORT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
+#endif
+
+ yychar = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token
+ after shifting the error token. */
+
+ yyerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto yyerrhandle;
+
+yyerrdefault: /* current state does not do anything special for the error token. */
+
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
+ if (yyn) goto yydefault;
+#endif
+
+yyerrpop: /* pop the current state because it cannot handle the error token */
+
+ if (yyssp == yyss) YYABORT;
+ yyvsp--;
+ yystate = *--yyssp;
+#ifdef YYLSP_NEEDED
+ yylsp--;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "Error: state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+yyerrhandle:
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yyerrdefault;
+
+ yyn += YYTERROR;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+ goto yyerrdefault;
+
+ yyn = yytable[yyn];
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrpop;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrpop;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting error token, ");
+#endif
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ yystate = yyn;
+ goto yynewstate;
+}
+#line 1421 "pic.y"
+
+
+/* bison defines const to be empty unless __STDC__ is defined, which it
+isn't under cfront */
+
+#ifdef const
+#undef const
+#endif
+
+static struct {
+ const char *name;
+ double val;
+ int scaled; // non-zero if val should be multiplied by scale
+} defaults_table[] = {
+ "arcrad", .25, 1,
+ "arrowht", .1, 1,
+ "arrowwid", .05, 1,
+ "circlerad", .25, 1,
+ "boxht", .5, 1,
+ "boxwid", .75, 1,
+ "boxrad", 0.0, 1,
+ "dashwid", .05, 1,
+ "ellipseht", .5, 1,
+ "ellipsewid", .75, 1,
+ "moveht", .5, 1,
+ "movewid", .5, 1,
+ "lineht", .5, 1,
+ "linewid", .5, 1,
+ "textht", 0.0, 1,
+ "textwid", 0.0, 1,
+ "scale", 1.0, 0,
+ "linethick", -1.0, 0, // in points
+ "fillval", .5, 0,
+ "arrowhead", 1.0, 0,
+ "maxpswid", 8.5, 0,
+ "maxpsht", 11.0, 0,
+};
+
+place *lookup_label(const char *label)
+{
+ saved_state *state = current_saved_state;
+ PTABLE(place) *tbl = current_table;
+ for (;;) {
+ place *pl = tbl->lookup(label);
+ if (pl)
+ return pl;
+ if (!state)
+ return 0;
+ tbl = state->tbl;
+ state = state->prev;
+ }
+}
+
+void define_label(const char *label, const place *pl)
+{
+ place *p = new place;
+ *p = *pl;
+ current_table->define(label, p);
+}
+
+int lookup_variable(const char *name, double *val)
+{
+ place *pl = lookup_label(name);
+ if (pl) {
+ *val = pl->x;
+ return 1;
+ }
+ return 0;
+}
+
+void define_variable(const char *name, double val)
+{
+ place *p = new place;
+ p->obj = 0;
+ p->x = val;
+ p->y = 0.0;
+ current_table->define(name, p);
+ if (strcmp(name, "scale") == 0) {
+ // When the scale changes, reset all scaled pre-defined variables to
+ // their default values.
+ for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
+ if (defaults_table[i].scaled)
+ define_variable(defaults_table[i].name, val*defaults_table[i].val);
+ }
+}
+
+// called once only (not once per parse)
+
+void parse_init()
+{
+ current_direction = RIGHT_DIRECTION;
+ current_position.x = 0.0;
+ current_position.y = 0.0;
+ // This resets everything to its default value.
+ reset_all();
+}
+
+void reset(const char *nm)
+{
+ for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
+ if (strcmp(nm, defaults_table[i].name) == 0) {
+ double val = defaults_table[i].val;
+ if (defaults_table[i].scaled) {
+ double scale;
+ lookup_variable("scale", &scale);
+ val *= scale;
+ }
+ define_variable(defaults_table[i].name, val);
+ return;
+ }
+ lex_error("`%1' is not a predefined variable", nm);
+}
+
+void reset_all()
+{
+ // We only have to explicitly reset the pre-defined variables that
+ // aren't scaled because `scale' is not scaled, and changing the
+ // value of `scale' will reset all the pre-defined variables that
+ // are scaled.
+ for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
+ if (!defaults_table[i].scaled)
+ define_variable(defaults_table[i].name, defaults_table[i].val);
+}
+
+// called after each parse
+
+void parse_cleanup()
+{
+ while (current_saved_state != 0) {
+ delete current_table;
+ current_table = current_saved_state->tbl;
+ saved_state *tem = current_saved_state;
+ current_saved_state = current_saved_state->prev;
+ delete tem;
+ }
+ assert(current_table == &top_table);
+ PTABLE_ITERATOR(place) iter(current_table);
+ const char *key;
+ place *pl;
+ while (iter.next(&key, &pl))
+ if (pl->obj != 0) {
+ position pos = pl->obj->origin();
+ pl->obj = 0;
+ pl->x = pos.x;
+ pl->y = pos.y;
+ }
+ while (olist.head != 0) {
+ object *tem = olist.head;
+ olist.head = olist.head->next;
+ delete tem;
+ }
+ olist.tail = 0;
+ current_direction = RIGHT_DIRECTION;
+ current_position.x = 0.0;
+ current_position.y = 0.0;
+}
+
+const char *ordinal_postfix(int n)
+{
+ if (n < 10 || n > 20)
+ switch (n % 10) {
+ case 1:
+ return "st";
+ case 2:
+ return "nd";
+ case 3:
+ return "rd";
+ }
+ return "th";
+}
+
+const char *object_type_name(object_type type)
+{
+ switch (type) {
+ case BOX_OBJECT:
+ return "box";
+ case CIRCLE_OBJECT:
+ return "circle";
+ case ELLIPSE_OBJECT:
+ return "ellipse";
+ case ARC_OBJECT:
+ return "arc";
+ case SPLINE_OBJECT:
+ return "spline";
+ case LINE_OBJECT:
+ return "line";
+ case ARROW_OBJECT:
+ return "arrow";
+ case MOVE_OBJECT:
+ return "move";
+ case TEXT_OBJECT:
+ return "\"\"";
+ case BLOCK_OBJECT:
+ return "[]";
+ case OTHER_OBJECT:
+ case MARK_OBJECT:
+ default:
+ break;
+ }
+ return "object";
+}
+
+static char sprintf_buf[1024];
+
+char *format_number(const char *form, double n)
+{
+ if (form == 0)
+ form = "%g";
+ else {
+ // this is a fairly feeble attempt at validation of the format
+ int nspecs = 0;
+ for (const char *p = form; *p != '\0'; p++)
+ if (*p == '%') {
+ if (p[1] == '%')
+ p++;
+ else
+ nspecs++;
+ }
+ if (nspecs > 1) {
+ lex_error("bad format `%1'", form);
+ return strsave(form);
+ }
+ }
+ sprintf(sprintf_buf, form, n);
+ return strsave(sprintf_buf);
+}
+
+char *do_sprintf(const char *form, const double *v, int nv)
+{
+ string result;
+ int i = 0;
+ string one_format;
+ while (*form) {
+ if (*form == '%') {
+ one_format += *form++;
+ for (; *form != '\0' && strchr("#-+ 0123456789.", *form) != 0; form++)
+ one_format += *form;
+ if (*form == '\0' || strchr("eEfgG%", *form) == 0) {
+ lex_error("bad sprintf format");
+ result += one_format;
+ result += form;
+ break;
+ }
+ if (*form == '%') {
+ one_format += *form++;
+ one_format += '\0';
+ sprintf(sprintf_buf, one_format.contents());
+ }
+ else {
+ if (i >= nv) {
+ lex_error("too few arguments to sprintf");
+ result += one_format;
+ result += form;
+ break;
+ }
+ one_format += *form++;
+ one_format += '\0';
+ sprintf(sprintf_buf, one_format.contents(), v[i++]);
+ }
+ one_format.clear();
+ result += sprintf_buf;
+ }
+ else
+ result += *form++;
+ }
+ result += '\0';
+ return strsave(result.contents());
+}