BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.bin / groff / pic / grot / pic.tab.c
CommitLineData
ba3faa5e
C
1
2/* A Bison parser, made from pic.y */
3
4#define LABEL 258
5#define VARIABLE 259
6#define NUMBER 260
7#define TEXT 261
8#define COMMAND 262
9#define DELIMITED 263
10#define ORDINAL 264
11#define LEFT_ARROW_HEAD 265
12#define RIGHT_ARROW_HEAD 266
13#define DOUBLE_ARROW_HEAD 267
14#define LAST 268
15#define UP 269
16#define DOWN 270
17#define LEFT 271
18#define RIGHT 272
19#define BOX 273
20#define CIRCLE 274
21#define ELLIPSE 275
22#define ARC 276
23#define LINE 277
24#define ARROW 278
25#define MOVE 279
26#define SPLINE 280
27#define HEIGHT 281
28#define RADIUS 282
29#define WIDTH 283
30#define DIAMETER 284
31#define FROM 285
32#define TO 286
33#define AT 287
34#define WITH 288
35#define BY 289
36#define THEN 290
37#define DOTTED 291
38#define DASHED 292
39#define CHOP 293
40#define SAME 294
41#define INVISIBLE 295
42#define LJUST 296
43#define RJUST 297
44#define ABOVE 298
45#define BELOW 299
46#define OF 300
47#define THE 301
48#define WAY 302
49#define BETWEEN 303
50#define AND 304
51#define HERE 305
52#define DOT_N 306
53#define DOT_E 307
54#define DOT_W 308
55#define DOT_S 309
56#define DOT_NE 310
57#define DOT_SE 311
58#define DOT_NW 312
59#define DOT_SW 313
60#define DOT_C 314
61#define DOT_START 315
62#define DOT_END 316
63#define DOT_X 317
64#define DOT_Y 318
65#define DOT_HT 319
66#define DOT_WID 320
67#define DOT_RAD 321
68#define SIN 322
69#define COS 323
70#define ATAN2 324
71#define LOG 325
72#define EXP 326
73#define SQRT 327
74#define MAX 328
75#define MIN 329
76#define INT 330
77#define RAND 331
78#define COPY 332
79#define THRU 333
80#define TOP 334
81#define BOTTOM 335
82#define UPPER 336
83#define LOWER 337
84#define SH 338
85#define PRINT 339
86#define CW 340
87#define CCW 341
88#define FOR 342
89#define DO 343
90#define IF 344
91#define ELSE 345
92#define ANDAND 346
93#define OROR 347
94#define NOTEQUAL 348
95#define EQUALEQUAL 349
96#define LESSEQUAL 350
97#define GREATEREQUAL 351
98#define LEFT_CORNER 352
99#define RIGHT_CORNER 353
100#define CENTER 354
101#define END 355
102#define START 356
103#define RESET 357
104#define UNTIL 358
105#define PLOT 359
106#define THICKNESS 360
107#define FILL 361
108#define ALIGNED 362
109#define SPRINTF 363
110#define DEFINE 364
111#define UNDEF 365
112
113#line 19 "pic.y"
114
115#include "pic.h"
116#include "ptable.h"
117#include "object.h"
118
119extern int delim_flag;
120extern void do_copy(const char *);
121extern void copy_rest_thru(const char *, const char *);
122extern void copy_file_thru(const char *, const char *, const char *);
123extern void push_body(const char *);
124extern void do_for(char *var, double from, double to,
125 int by_is_multiplicative, double by, char *body);
126extern void do_lookahead();
127
128extern "C" {
129 double fmod(double, double);
130 int rand();
131}
132
133#define YYDEBUG 1
134
135int yylex();
136void yyerror(const char *);
137
138void reset(const char *nm);
139void reset_all();
140
141place *lookup_label(const char *);
142void define_label(const char *label, const place *pl);
143
144direction current_direction;
145position current_position;
146
147implement_ptable(place)
148
149PTABLE(place) top_table;
150
151PTABLE(place) *current_table = &top_table;
152saved_state *current_saved_state = 0;
153
154object_list olist;
155
156const char *ordinal_postfix(int n);
157const char *object_type_name(object_type type);
158char *format_number(const char *form, double n);
159char *do_sprintf(const char *form, const double *v, int nv);
160
161
162#line 69 "pic.y"
163typedef union {
164 char *str;
165 int n;
166 double x;
167 struct { double x, y; } pair;
168 struct { double x; char *body; } if_data;
169 struct { char *str; const char *filename; int lineno; } lstr;
170 struct { double *v; int nv; int maxv; } dv;
171 struct { double val; int is_multiplicative; } by;
172 place pl;
173 object *obj;
174 corner crn;
175 path *pth;
176 object_spec *spec;
177 saved_state *pstate;
178 graphics_state state;
179 object_type obtype;
180} YYSTYPE;
181
182#ifndef YYLTYPE
183typedef
184 struct yyltype
185 {
186 int timestamp;
187 int first_line;
188 int first_column;
189 int last_line;
190 int last_column;
191 char *text;
192 }
193 yyltype;
194
195#define YYLTYPE yyltype
196#endif
197
198#include <stdio.h>
199
200#ifndef __STDC__
201#define const
202#endif
203
204
205
206#define YYFINAL 373
207#define YYFLAG -32768
208#define YYNTBASE 131
209
210#define YYTRANSLATE(x) ((unsigned)(x) <= 365 ? yytranslate[x] : 170)
211
212static const short yytranslate[] = { 0,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 2, 2, 120, 2, 2, 2, 119, 2, 2, 111,
217 129, 117, 115, 112, 116, 130, 118, 2, 2, 2,
218 2, 2, 2, 2, 2, 2, 2, 124, 122, 113,
219 123, 114, 2, 2, 2, 2, 2, 2, 2, 2,
220 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
221 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
222 127, 2, 128, 121, 2, 2, 2, 2, 2, 2,
223 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
224 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
225 2, 2, 125, 2, 126, 2, 2, 2, 2, 2,
226 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
227 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
228 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
229 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
230 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
231 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
232 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
233 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
234 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
235 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
236 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
237 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
238 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
239 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
240 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
241 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
242 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
243 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
244 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
245 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
246 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
247 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
248 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
249 106, 107, 108, 109, 110
250};
251
252#if YYDEBUG != 0
253static const short yyrline[] = { 0,
254 263, 265, 273, 278, 281, 285, 287, 290, 292, 295,
255 301, 303, 305, 307, 309, 315, 320, 326, 331, 334,
256 339, 346, 349, 351, 359, 362, 364, 371, 374, 380,
257 388, 391, 402, 403, 407, 410, 412, 416, 420, 423,
258 426, 430, 433, 439, 446, 449, 451, 455, 470, 472,
259 480, 486, 492, 499, 507, 512, 516, 520, 525, 532,
260 539, 546, 553, 558, 563, 570, 585, 597, 603, 609,
261 615, 621, 640, 647, 654, 661, 668, 675, 682, 689,
262 696, 703, 718, 730, 736, 743, 755, 761, 767, 773,
263 779, 784, 790, 806, 823, 828, 833, 838, 843, 848,
264 853, 858, 865, 874, 883, 892, 901, 907, 914, 919,
265 929, 936, 957, 960, 968, 971, 976, 981, 986, 991,
266 998, 1000, 1003, 1006, 1010, 1013, 1019, 1025, 1031, 1039,
267 1050, 1054, 1062, 1065, 1069, 1084, 1100, 1103, 1105, 1107,
268 1109, 1111, 1113, 1115, 1117, 1121, 1126, 1133, 1141, 1145,
269 1152, 1158, 1164, 1170, 1176, 1184, 1187, 1189, 1191, 1193,
270 1195, 1197, 1199, 1201, 1203, 1205, 1207, 1209, 1211, 1213,
271 1215, 1217, 1219, 1221, 1223, 1225, 1227, 1229, 1231, 1233,
272 1235, 1237, 1239, 1243, 1252, 1254, 1261, 1268, 1275, 1282,
273 1289, 1291, 1293, 1295, 1303, 1311, 1324, 1326, 1328, 1337,
274 1346, 1359, 1368, 1377, 1386, 1388, 1390, 1392, 1394, 1400,
275 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416
276};
277
278static const char * const yytname[] = { 0,
279"error","$illegal.","LABEL","VARIABLE","NUMBER","TEXT","COMMAND","DELIMITED","ORDINAL","LEFT_ARROW_HEAD",
280"RIGHT_ARROW_HEAD","DOUBLE_ARROW_HEAD","LAST","UP","DOWN","LEFT","RIGHT","BOX","CIRCLE","ELLIPSE",
281"ARC","LINE","ARROW","MOVE","SPLINE","HEIGHT","RADIUS","WIDTH","DIAMETER","FROM",
282"TO","AT","WITH","BY","THEN","DOTTED","DASHED","CHOP","SAME","INVISIBLE",
283"LJUST","RJUST","ABOVE","BELOW","OF","THE","WAY","BETWEEN","AND","HERE",
284"DOT_N","DOT_E","DOT_W","DOT_S","DOT_NE","DOT_SE","DOT_NW","DOT_SW","DOT_C","DOT_START",
285"DOT_END","DOT_X","DOT_Y","DOT_HT","DOT_WID","DOT_RAD","SIN","COS","ATAN2","LOG",
286"EXP","SQRT","MAX","MIN","INT","RAND","COPY","THRU","TOP","BOTTOM",
287"UPPER","LOWER","SH","PRINT","CW","CCW","FOR","DO","IF","ELSE",
288"ANDAND","OROR","NOTEQUAL","EQUALEQUAL","LESSEQUAL","GREATEREQUAL","LEFT_CORNER","RIGHT_CORNER","CENTER","END",
289"START","RESET","UNTIL","PLOT","THICKNESS","FILL","ALIGNED","SPRINTF","DEFINE","UNDEF",
290"'('","','","'<'","'>'","'+'","'-'","'*'","'/'","'%'","'!'",
291"'^'","';'","'='","':'","'{'","'}'","'['","']'","')'","'.'",
292"top"
293};
294#endif
295
296static const short yyr1[] = { 0,
297 131, 131, 132, 133, 133, 134, 134, 135, 135, 136,
298 136, 136, 136, 136, 136, 136, 136, 136, 137, 136,
299 136, 138, 139, 136, 140, 141, 136, 142, 136, 136,
300 143, 136, 136, 136, 144, 144, 144, 146, 145, 147,
301 147, 148, 148, 148, 149, 149, 149, 150, 150, 150,
302 150, 151, 150, 150, 152, 152, 152, 152, 152, 152,
303 152, 152, 152, 152, 152, 153, 152, 152, 152, 152,
304 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
305 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
306 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
307 152, 152, 152, 152, 152, 152, 152, 152, 154, 154,
308 155, 155, 156, 156, 157, 157, 157, 157, 157, 157,
309 158, 158, 159, 159, 160, 160, 160, 160, 160, 161,
310 161, 161, 162, 162, 163, 163, 164, 164, 164, 164,
311 164, 164, 164, 164, 164, 165, 165, 166, 166, 166,
312 167, 167, 167, 167, 167, 168, 168, 168, 168, 168,
313 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
314 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
315 168, 168, 168, 169, 169, 169, 169, 169, 169, 169,
316 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
317 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
318 169, 169, 169, 169, 169, 169, 169, 169
319};
320
321static const short yyr2[] = { 0,
322 1, 1, 3, 1, 3, 0, 1, 1, 2, 3,
323 1, 1, 1, 1, 1, 2, 2, 2, 0, 3,
324 2, 0, 0, 7, 0, 0, 6, 0, 10, 1,
325 0, 4, 1, 1, 2, 2, 3, 0, 5, 0,
326 2, 1, 3, 3, 0, 2, 3, 1, 4, 4,
327 4, 0, 4, 1, 1, 1, 1, 1, 1, 1,
328 1, 1, 1, 2, 3, 0, 4, 3, 3, 3,
329 3, 2, 2, 3, 2, 3, 2, 3, 2, 3,
330 3, 3, 3, 3, 3, 2, 2, 3, 2, 3,
331 2, 3, 2, 3, 2, 2, 2, 2, 2, 2,
332 2, 2, 2, 2, 2, 2, 3, 2, 1, 5,
333 0, 3, 1, 1, 1, 3, 3, 5, 5, 6,
334 1, 4, 3, 3, 1, 2, 2, 3, 1, 1,
335 1, 3, 1, 2, 2, 2, 1, 1, 1, 1,
336 1, 1, 1, 2, 1, 2, 3, 1, 1, 2,
337 1, 4, 3, 3, 2, 1, 1, 1, 1, 1,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 2, 2, 2, 2, 1, 1, 2, 2, 2, 2,
340 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
341 3, 3, 3, 3, 3, 3, 2, 3, 4, 4,
342 6, 4, 4, 4, 6, 6, 4, 4, 3, 3,
343 3, 3, 3, 3, 3, 3, 3, 2
344};
345
346static const short yydefact[] = { 6,
347 8, 2, 1, 7, 0, 0, 109, 15, 11, 12,
348 13, 14, 55, 56, 57, 58, 59, 60, 61, 62,
349 0, 19, 0, 0, 0, 34, 0, 0, 52, 66,
350 6, 54, 33, 30, 4, 48, 63, 9, 6, 0,
351 21, 25, 0, 130, 184, 185, 0, 133, 169, 170,
352 129, 156, 157, 158, 159, 160, 161, 162, 163, 164,
353 165, 166, 0, 0, 0, 0, 0, 0, 0, 0,
354 0, 0, 167, 168, 0, 0, 175, 176, 181, 183,
355 182, 0, 0, 0, 17, 18, 113, 115, 114, 125,
356 0, 131, 0, 16, 0, 0, 0, 0, 0, 42,
357 35, 64, 0, 6, 6, 3, 7, 36, 0, 31,
358 97, 98, 99, 73, 75, 79, 77, 0, 0, 0,
359 0, 0, 0, 0, 0, 0, 86, 87, 89, 93,
360 95, 96, 103, 104, 105, 106, 100, 101, 0, 91,
361 108, 102, 72, 0, 10, 22, 0, 20, 145, 134,
362 137, 138, 139, 140, 141, 142, 143, 0, 135, 0,
363 0, 0, 0, 0, 0, 0, 0, 0, 0, 171,
364 173, 177, 179, 172, 174, 178, 180, 0, 115, 0,
365 197, 218, 0, 0, 186, 187, 188, 189, 190, 0,
366 126, 136, 0, 127, 0, 121, 0, 0, 0, 0,
367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
368 0, 0, 0, 0, 38, 0, 0, 0, 65, 111,
369 0, 0, 0, 5, 37, 0, 74, 76, 80, 78,
370 68, 69, 70, 71, 81, 0, 82, 83, 0, 0,
371 0, 0, 149, 151, 84, 148, 0, 85, 0, 88,
372 90, 94, 107, 92, 130, 184, 13, 14, 49, 0,
373 50, 51, 0, 26, 144, 0, 0, 0, 0, 0,
374 0, 0, 0, 0, 209, 0, 0, 124, 198, 116,
375 117, 132, 128, 0, 216, 217, 215, 214, 211, 213,
376 123, 0, 210, 212, 191, 192, 193, 194, 195, 196,
377 0, 0, 0, 44, 43, 210, 0, 53, 67, 32,
378 155, 0, 0, 0, 146, 0, 150, 0, 0, 23,
379 40, 199, 200, 0, 202, 203, 204, 0, 0, 207,
380 208, 0, 0, 0, 0, 0, 39, 0, 110, 0,
381 154, 153, 147, 40, 0, 27, 0, 0, 0, 118,
382 122, 0, 119, 45, 112, 152, 24, 41, 201, 205,
383 206, 120, 0, 0, 0, 46, 28, 47, 0, 29,
384 0, 0, 0
385};
386
387static const short yydefgoto[] = { 371,
388 2, 31, 222, 4, 32, 43, 263, 344, 147, 321,
389 369, 226, 33, 34, 303, 346, 97, 364, 35, 104,
390 36, 105, 37, 307, 86, 87, 212, 88, 99, 90,
391 91, 92, 159, 243, 244, 245, 93, 236
392};
393
394static const short yypact[] = { -101,
395-32768,-32768, 535, -99, -96, -89,-32768,-32768,-32768,-32768,
396-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
397 23,-32768, 750, 37, 851, 38, 1057, -65,-32768,-32768,
398 -101,-32768, 1, -42,-32768, 641,-32768,-32768, -101, 851,
399 -4,-32768, 68,-32768,-32768,-32768, 62,-32768,-32768,-32768,
400-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
401-32768,-32768, -32, -21, -9, -7, 25, 41, 42, 46,
402 48, 52,-32768,-32768, 2, 21,-32768,-32768,-32768,-32768,
403-32768, 1158, 1057, 1057,-32768, -59,-32768,-32768, 232, 1673,
404 363,-32768, 13, 1646, 7, 1057, 97, 28, 232, 1973,
405-32768, 984, 143, -101, -101,-32768, 509,-32768, 150,-32768,
406-32768,-32768,-32768, 1499, 1499, 1339, 1419, 1057, 1057, 1057,
407 1057, 1158, 1158, 1158, 153, 1259,-32768, 1499, 1499, 1499,
408-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1057, 1499,
409-32768,-32768, 1973, 394,-32768,-32768, 157,-32768,-32768,-32768,
410-32768,-32768,-32768,-32768,-32768,-32768,-32768, 39,-32768, 1057,
411 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 276,-32768,
412-32768,-32768,-32768,-32768,-32768,-32768,-32768, -61, 44, 1594,
413 50, 50, 1259, 1259,-32768,-32768,-32768,-32768,-32768, 190,
414-32768,-32768, 111, 64, 126,-32768, 1057, 1057, 1057, 1057,
415 1057, 1057, 1057, 1158, 1057, 1057, 1057, 1057, 1057, 1057,
416 1057, 1158, 1057, 1701,-32768, 0, 0, 1057,-32768,-32768,
417 70, 535, 69,-32768,-32768, 194, 1973, 1973, 1973, 1973,
418 1973, 1973, 1973, 1973, -59, 1646, -59, -59, 1569, 253,
419 363, 200, 1621,-32768,-32768,-32768, 1259,-32768, 677, 1973,
420 1973, 1973, 1973, 1973, -96, -89, 22, 27,-32768, -59,
421 19, 154, 207,-32768,-32768, 1732, 1741, 1540, 1772, 1781,
422 1812, 1932, 1942, 1821,-32768, 1852, 1158,-32768,-32768,-32768,
423-32768,-32768, 64, 174, 720, 778, 767, 767, 125, 125,
424 1973, 11, 110, 125, 169, 169, 50, 50, 50, 50,
425 -38, 486, 215,-32768,-32768, 125, -80,-32768,-32768,-32768,
426-32768, 363, 1569, 1569,-32768, 227,-32768, 44, 1692,-32768,
427 133,-32768,-32768, 1057,-32768,-32768,-32768, 1057, 1057,-32768,
428-32768, -63, 189, 1158, 1158, 1057,-32768, 1057,-32768, 1569,
429-32768,-32768,-32768, 133, 239,-32768, 1861, 1892, 1901,-32768,
430-32768, -52, -59, 452, 1973,-32768,-32768,-32768,-32768,-32768,
431-32768,-32768, 952, 159, 1057, 1973,-32768, 1973, 240,-32768,
432 249, 257,-32768
433};
434
435static const short yypgoto[] = {-32768,
436 43,-32768, 8, 229,-32768,-32768,-32768,-32768,-32768,-32768,
437-32768,-32768,-32768,-32768,-32768, -86, 221,-32768, -74,-32768,
438-32768,-32768, -16,-32768, -79, 118,-32768, -55, -13, -81,
439-32768,-32768, -90,-32768, -225,-32768, -75, -23
440};
441
442
443#define YYLAST 2094
444
445
446static const short yytable[] = { 94,
447 192, 100, 178, 102, 108, 7, 85, 3, 98, 89,
448 335, 194, 143, 311, 191, 44, 100, 170, 171, 142,
449 1, 47, 38, 98, -169, 48, 179, 39, 41, -170,
450 -169, 338, 224, 40, -169, -170, 174, 175, 106, -170,
451 95, 101, 235, 237, 238, 103, 144, 110, 339, 246,
452 277, 183, 184, 183, 184, 183, 184, 193, 180, 181,
453 182, 362, 183, 184, 260, 350, -169, 149, 89, 259,
454 248, -170, 214, 146, 150, 148, 183, 184, 160, 151,
455 152, 153, 154, 155, 156, 219, 157, 341, 342, 161,
456 227, 228, 229, 230, 231, 232, 233, 234, 172, 173,
457 42, 162, 249, 163, 250, 251, 252, 28, 89, 89,
458 89, 283, 109, 44, 356, 253, 254, 176, 177, 47,
459 216, 217, 334, 48, 292, 183, 184, 280, 281, 213,
460 262, 215, 301, -113, -113, 164, 266, 267, 268, 269,
461 270, 271, 272, 273, 274, 276, 221, 223, 220, 313,
462 314, 165, 166, 225, 195, 239, 167, 196, 168, 249,
463 249, 240, 169, 246, 264, 241, 265, 317, 49, 50,
464 211, 284, 278, 285, 286, 287, 288, 289, 290, 291,
465 293, 294, 295, 296, 297, 298, 299, 300, 158, 302,
466 89, 318, 282, 190, 306, 308, 309, 332, 89, 304,
467 305, 310, 315, 52, 53, 54, 55, 56, 57, 58,
468 59, 60, 61, 62, 320, 185, 186, 187, 188, 189,
469 333, 340, 337, 319, 206, 207, 208, 209, 210, 343,
470 211, 73, 74, 75, 76, 345, 351, 246, 246, 206,
471 207, 208, 209, 210, 358, 211, 367, 370, 372, 77,
472 78, 79, 80, 81, 352, 353, 373, 357, 149, 107,
473 145, 261, 0, 89, 246, 312, 0, 0, -114, -114,
474 151, 152, 153, 154, 155, 156, 0, 157, 44, 45,
475 46, 0, 242, 0, 47, 208, 209, 210, 48, 211,
476 0, 49, 50, 185, 186, 187, 188, 189, 0, 0,
477 347, 0, 0, 0, 348, 349, 0, 0, 0, 0,
478 0, 0, 354, 0, 355, 0, 0, 0, 0, 0,
479 89, 89, 0, 0, 0, 51, 52, 53, 54, 55,
480 56, 57, 58, 59, 60, 61, 62, 0, 0, 366,
481 0, 368, 63, 64, 65, 66, 67, 68, 69, 70,
482 71, 72, 0, 0, 73, 74, 75, 76, 0, 0,
483 0, 0, 0, 0, 0, 0, 0, 0, 149, 0,
484 0, 0, 77, 78, 79, 80, 81, 0, 0, 158,
485 151, 152, 153, 154, 155, 156, 96, 157, 0, 0,
486 0, 83, 0, 0, 0, 84, 255, 256, 46, 7,
487 8, 0, 47, 0, 275, 0, 48, 9, 10, 257,
488 258, 13, 14, 15, 16, 17, 18, 19, 20, 0,
489 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
490 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
491 0, 0, 0, 51, 52, 53, 54, 55, 56, 57,
492 58, 59, 60, 61, 62, 0, 0, 0, 0, 0,
493 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
494 21, 0, 73, 74, 75, 76, 22, 23, 0, 0,
495 24, 0, 25, 0, 0, 363, 0, 0, 0, 158,
496 77, 78, 79, 80, 81, 26, 0, 27, 0, 0,
497 0, 28, 0, 0, 82, 0, 0, 0, 0, 83,
498 0, 5, 6, 84, 7, 8, 336, 0, 29, 0,
499 30, 0, 9, 10, 11, 12, 13, 14, 15, 16,
500 17, 18, 19, 20, 0, 0, 0, 5, 6, 0,
501 7, 8, 197, 198, 199, 200, 201, 202, 9, 10,
502 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
503 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
504 210, 0, 211, 0, 0, 0, 197, 198, 199, 200,
505 201, 202, 0, 0, 0, 21, 0, 0, 0, 0,
506 0, 22, 23, 0, 0, 24, 0, 25, 218, 205,
507 206, 207, 208, 209, 210, 0, 211, 0, 0, 0,
508 26, 21, 27, 0, 0, 0, 28, 22, 23, 0,
509 0, 24, 0, 25, 0, 0, 0, 0, 0, 0,
510 38, 0, 0, 29, 0, 30, 26, 0, 27, 0,
511 0, 0, 28, 44, 45, 46, 7, 0, 0, 47,
512 111, 112, 113, 48, 114, 115, 116, 117, 0, 29,
513 0, 30, 0, 0, 0, 0, 118, 119, 120, 121,
514 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
515 132, 133, 134, 135, 136, 0, 0, 0, 0, 0,
516 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
517 61, 62, 0, 0, 0, 0, 0, 63, 64, 65,
518 66, 67, 68, 69, 70, 71, 72, 0, 0, 73,
519 74, 75, 76, 0, 0, 137, 138, 0, 0, 0,
520 0, 0, 0, 0, 0, 0, 0, 77, 78, 79,
521 80, 81, 0, 0, 0, 139, 140, 141, 28, 0,
522 0, 96, 44, 45, 46, 7, 83, 0, 47, 0,
523 84, 0, 48, 0, 0, 49, 50, 197, 198, 199,
524 200, 201, 202, 0, 0, 0, 0, 0, 0, 0,
525 0, 0, 0, 0, 0, 0, 0, 0, 203, 218,
526 205, 206, 207, 208, 209, 210, 0, 211, 0, 51,
527 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
528 62, 0, 199, 200, 201, 202, 63, 64, 65, 66,
529 67, 68, 69, 70, 71, 72, 0, 0, 73, 74,
530 75, 76, 218, 205, 206, 207, 208, 209, 210, 0,
531 211, 0, 0, 0, 0, 0, 77, 78, 79, 80,
532 81, 0, 0, 44, 45, 46, 7, 28, 0, 47,
533 82, 201, 202, 48, 0, 83, 49, 50, 197, 84,
534 199, 200, 201, 202, 0, 0, 0, 0, 0, 218,
535 205, 206, 207, 208, 209, 210, 0, 211, 0, 0,
536 218, 205, 206, 207, 208, 209, 210, 0, 211, 0,
537 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
538 61, 62, 0, 0, 0, 0, 0, 63, 64, 65,
539 66, 67, 68, 69, 70, 71, 72, 0, 0, 73,
540 74, 75, 76, 0, 0, 0, 0, 0, 0, 0,
541 0, 0, 0, 0, 0, 0, 0, 77, 78, 79,
542 80, 81, 0, 0, 44, 45, 46, 0, 28, 0,
543 47, 96, 0, 0, 48, 0, 83, 49, 50, 0,
544 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
545 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,
546 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
547 0, 51, 52, 53, 54, 55, 56, 57, 58, 59,
548 60, 61, 62, 0, 0, 0, 0, 0, 63, 64,
549 65, 66, 67, 68, 69, 70, 71, 72, 0, 0,
550 73, 74, 75, 76, 0, 0, 0, 0, 0, 0,
551 0, 0, 0, 0, 0, 0, 0, 0, 77, 78,
552 79, 80, 81, 0, 0, 0, 0, 0, 0, 44,
553 45, 46, 96, 0, 0, 47, 0, 83, 365, 48,
554 0, 84, 49, 50, 197, 198, 199, 200, 201, 202,
555 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
556 0, 28, 0, 0, 0, 0, 218, 205, 206, 207,
557 208, 209, 210, 0, 211, 0, 51, 52, 53, 54,
558 55, 56, 57, 58, 59, 60, 61, 62, 0, 0,
559 0, 0, 0, 63, 64, 65, 66, 67, 68, 69,
560 70, 71, 72, 0, 0, 73, 74, 75, 76, 0,
561 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
562 0, 0, 0, 77, 78, 79, 80, 81, 0, 0,
563 44, 45, 46, 0, 0, 0, 47, 96, 0, 0,
564 48, 0, 83, 49, 50, 0, 84, 0, 0, 0,
565 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
566 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
567 0, 0, 0, 0, 0, 0, 0, 51, 52, 53,
568 54, 55, 56, 57, 58, 59, 60, 61, 62, 0,
569 0, 0, 0, 0, 63, 64, 65, 66, 67, 68,
570 69, 70, 71, 72, 0, 0, 73, 74, 75, 76,
571 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
572 0, 0, 0, 0, 77, 78, 79, 80, 81, 0,
573 0, 44, 45, 46, 0, 0, 0, 47, 82, 0,
574 0, 48, 0, 83, 49, 50, 0, 84, 0, 0,
575 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
576 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
577 0, 0, 0, 0, 0, 0, 0, 0, 51, 52,
578 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
579 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
580 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
581 76, 44, 45, 46, 0, 0, 0, 47, 0, 0,
582 0, 48, 0, 0, 0, 77, 78, 79, 80, 81,
583 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
584 0, 0, 0, 0, 83, 0, 0, 0, 84, 0,
585 0, 0, 0, -169, 0, 0, 0, 0, 51, 52,
586 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
587 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
588 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
589 76, 44, 45, 46, 0, 0, 0, 47, 0, 0,
590 0, 48, 0, 0, 0, 77, 78, 79, 80, 81,
591 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
592 0, 0, 0, 0, 83, 0, 0, 0, 84, 0,
593 0, 0, 0, -170, 0, 0, 0, 0, 51, 52,
594 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
595 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
596 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
597 76, 44, 45, 46, 0, 0, 0, 47, 0, 0,
598 0, 48, 0, 0, 0, 77, 78, 79, 80, 81,
599 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
600 0, 0, 0, 0, 83, 0, 0, 0, 84, 0,
601 0, 0, 0, 0, 0, 0, 0, 0, 51, 52,
602 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
603 0, 0, 0, 0, 0, 63, 64, 65, 66, 67,
604 68, 69, 70, 71, 72, 0, 0, 73, 74, 75,
605 76, 0, 0, 0, 49, 50, 0, 0, 0, 0,
606 0, 0, 0, 0, 0, 77, 78, 79, 80, 81,
607 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
608 0, 0, 0, 0, 83, 0, 0, 0, 84, 52,
609 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
610 197, 198, 199, 200, 201, 202, 49, 50, 195, 0,
611 0, 196, 0, 0, 0, 0, 0, 73, 74, 75,
612 76, 324, 218, 205, 206, 207, 208, 209, 210, 0,
613 211, 0, 0, 0, 0, 77, 78, 79, 80, 81,
614 0, 52, 53, 54, 55, 56, 57, 58, 59, 60,
615 61, 62, 0, 0, 197, 198, 199, 200, 201, 202,
616 195, 0, 0, 196, 0, 0, 0, 0, 242, 73,
617 74, 75, 76, 0, 0, 203, 204, 205, 206, 207,
618 208, 209, 210, 0, 211, 0, 0, 77, 78, 79,
619 80, 81, 279, 52, 53, 54, 55, 56, 57, 58,
620 59, 60, 61, 62, 0, 0, 197, 198, 199, 200,
621 201, 202, 0, 0, 0, 0, 0, 0, 0, 0,
622 316, 73, 74, 75, 76, 0, 0, 203, 204, 205,
623 206, 207, 208, 209, 210, 0, 211, 0, 0, 77,
624 78, 79, 80, 81, 0, 0, 0, 0, 0, 0,
625 0, 0, 197, 198, 199, 200, 201, 202, 0, 0,
626 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
627 0, 0, 190, 203, 218, 205, 206, 207, 208, 209,
628 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
629 279, 211, 197, 198, 199, 200, 201, 202, 0, 279,
630 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
631 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
632 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
633 322, 211, 197, 198, 199, 200, 201, 202, 0, 323,
634 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
635 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
636 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
637 325, 211, 197, 198, 199, 200, 201, 202, 0, 326,
638 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
639 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
640 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
641 327, 211, 197, 198, 199, 200, 201, 202, 0, 330,
642 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
643 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
644 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
645 331, 211, 197, 198, 199, 200, 201, 202, 0, 359,
646 0, 197, 198, 199, 200, 201, 202, 0, 0, 0,
647 0, 0, 0, 0, 218, 205, 206, 207, 208, 209,
648 210, 0, 211, 218, 205, 206, 207, 208, 209, 210,
649 360, 211, 197, 198, 199, 200, 201, 202, 0, 361,
650 0, 0, 197, 198, 199, 200, 201, 202, 0, 0,
651 0, 0, 0, 328, 218, 205, 206, 207, 208, 209,
652 210, 0, 211, 329, 218, 205, 206, 207, 208, 209,
653 210, 0, 211, 197, 198, 199, 200, 201, 202, 0,
654 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
655 0, 0, 0, 0, 0, 218, 205, 206, 207, 208,
656 209, 210, 0, 211
657};
658
659static const short yycheck[] = { 23,
660 91, 25, 82, 27, 4, 6, 23, 0, 25, 23,
661 49, 93, 36, 239, 90, 3, 40, 16, 17, 36,
662 122, 9, 122, 40, 3, 13, 82, 124, 6, 3,
663 9, 112, 107, 123, 13, 9, 16, 17, 31, 13,
664 4, 4, 122, 123, 124, 111, 39, 90, 129, 125,
665 112, 115, 116, 115, 116, 115, 116, 45, 82, 83,
666 84, 114, 115, 116, 144, 129, 45, 6, 82, 144,
667 126, 45, 96, 78, 13, 8, 115, 116, 111, 18,
668 19, 20, 21, 22, 23, 102, 25, 313, 314, 111,
669 114, 115, 116, 117, 118, 119, 120, 121, 97, 98,
670 78, 111, 126, 111, 128, 129, 130, 108, 122, 123,
671 124, 193, 112, 3, 340, 139, 140, 97, 98, 9,
672 93, 94, 112, 13, 204, 115, 116, 183, 184, 123,
673 144, 35, 212, 115, 116, 111, 160, 161, 162, 163,
674 164, 165, 166, 167, 168, 169, 104, 105, 6, 240,
675 241, 111, 111, 4, 45, 3, 111, 48, 111, 183,
676 184, 9, 111, 239, 8, 13, 128, 243, 16, 17,
677 121, 46, 129, 197, 198, 199, 200, 201, 202, 203,
678 204, 205, 206, 207, 208, 209, 210, 211, 127, 213,
679 204, 247, 3, 130, 218, 126, 128, 277, 212, 216,
680 217, 8, 3, 51, 52, 53, 54, 55, 56, 57,
681 58, 59, 60, 61, 8, 62, 63, 64, 65, 66,
682 47, 312, 8, 247, 115, 116, 117, 118, 119, 3,
683 121, 79, 80, 81, 82, 103, 48, 313, 314, 115,
684 116, 117, 118, 119, 6, 121, 88, 8, 0, 97,
685 98, 99, 100, 101, 334, 335, 0, 344, 6, 31,
686 40, 144, -1, 277, 340, 13, -1, -1, 115, 116,
687 18, 19, 20, 21, 22, 23, -1, 25, 3, 4,
688 5, -1, 130, -1, 9, 117, 118, 119, 13, 121,
689 -1, 16, 17, 62, 63, 64, 65, 66, -1, -1,
690 324, -1, -1, -1, 328, 329, -1, -1, -1, -1,
691 -1, -1, 336, -1, 338, -1, -1, -1, -1, -1,
692 334, 335, -1, -1, -1, 50, 51, 52, 53, 54,
693 55, 56, 57, 58, 59, 60, 61, -1, -1, 363,
694 -1, 365, 67, 68, 69, 70, 71, 72, 73, 74,
695 75, 76, -1, -1, 79, 80, 81, 82, -1, -1,
696 -1, -1, -1, -1, -1, -1, -1, -1, 6, -1,
697 -1, -1, 97, 98, 99, 100, 101, -1, -1, 127,
698 18, 19, 20, 21, 22, 23, 111, 25, -1, -1,
699 -1, 116, -1, -1, -1, 120, 3, 4, 5, 6,
700 7, -1, 9, -1, 129, -1, 13, 14, 15, 16,
701 17, 18, 19, 20, 21, 22, 23, 24, 25, -1,
702 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
703 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
704 -1, -1, -1, 50, 51, 52, 53, 54, 55, 56,
705 57, 58, 59, 60, 61, -1, -1, -1, -1, -1,
706 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
707 77, -1, 79, 80, 81, 82, 83, 84, -1, -1,
708 87, -1, 89, -1, -1, 34, -1, -1, -1, 127,
709 97, 98, 99, 100, 101, 102, -1, 104, -1, -1,
710 -1, 108, -1, -1, 111, -1, -1, -1, -1, 116,
711 -1, 3, 4, 120, 6, 7, 31, -1, 125, -1,
712 127, -1, 14, 15, 16, 17, 18, 19, 20, 21,
713 22, 23, 24, 25, -1, -1, -1, 3, 4, -1,
714 6, 7, 91, 92, 93, 94, 95, 96, 14, 15,
715 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
716 -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
717 119, -1, 121, -1, -1, -1, 91, 92, 93, 94,
718 95, 96, -1, -1, -1, 77, -1, -1, -1, -1,
719 -1, 83, 84, -1, -1, 87, -1, 89, 113, 114,
720 115, 116, 117, 118, 119, -1, 121, -1, -1, -1,
721 102, 77, 104, -1, -1, -1, 108, 83, 84, -1,
722 -1, 87, -1, 89, -1, -1, -1, -1, -1, -1,
723 122, -1, -1, 125, -1, 127, 102, -1, 104, -1,
724 -1, -1, 108, 3, 4, 5, 6, -1, -1, 9,
725 10, 11, 12, 13, 14, 15, 16, 17, -1, 125,
726 -1, 127, -1, -1, -1, -1, 26, 27, 28, 29,
727 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
728 40, 41, 42, 43, 44, -1, -1, -1, -1, -1,
729 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
730 60, 61, -1, -1, -1, -1, -1, 67, 68, 69,
731 70, 71, 72, 73, 74, 75, 76, -1, -1, 79,
732 80, 81, 82, -1, -1, 85, 86, -1, -1, -1,
733 -1, -1, -1, -1, -1, -1, -1, 97, 98, 99,
734 100, 101, -1, -1, -1, 105, 106, 107, 108, -1,
735 -1, 111, 3, 4, 5, 6, 116, -1, 9, -1,
736 120, -1, 13, -1, -1, 16, 17, 91, 92, 93,
737 94, 95, 96, -1, -1, -1, -1, -1, -1, -1,
738 -1, -1, -1, -1, -1, -1, -1, -1, 112, 113,
739 114, 115, 116, 117, 118, 119, -1, 121, -1, 50,
740 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
741 61, -1, 93, 94, 95, 96, 67, 68, 69, 70,
742 71, 72, 73, 74, 75, 76, -1, -1, 79, 80,
743 81, 82, 113, 114, 115, 116, 117, 118, 119, -1,
744 121, -1, -1, -1, -1, -1, 97, 98, 99, 100,
745 101, -1, -1, 3, 4, 5, 6, 108, -1, 9,
746 111, 95, 96, 13, -1, 116, 16, 17, 91, 120,
747 93, 94, 95, 96, -1, -1, -1, -1, -1, 113,
748 114, 115, 116, 117, 118, 119, -1, 121, -1, -1,
749 113, 114, 115, 116, 117, 118, 119, -1, 121, -1,
750 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
751 60, 61, -1, -1, -1, -1, -1, 67, 68, 69,
752 70, 71, 72, 73, 74, 75, 76, -1, -1, 79,
753 80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
754 -1, -1, -1, -1, -1, -1, -1, 97, 98, 99,
755 100, 101, -1, -1, 3, 4, 5, -1, 108, -1,
756 9, 111, -1, -1, 13, -1, 116, 16, 17, -1,
757 120, -1, -1, -1, -1, -1, -1, -1, -1, -1,
758 -1, -1, -1, -1, -1, -1, -1, -1, -1, 6,
759 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
760 -1, 50, 51, 52, 53, 54, 55, 56, 57, 58,
761 59, 60, 61, -1, -1, -1, -1, -1, 67, 68,
762 69, 70, 71, 72, 73, 74, 75, 76, -1, -1,
763 79, 80, 81, 82, -1, -1, -1, -1, -1, -1,
764 -1, -1, -1, -1, -1, -1, -1, -1, 97, 98,
765 99, 100, 101, -1, -1, -1, -1, -1, -1, 3,
766 4, 5, 111, -1, -1, 9, -1, 116, 117, 13,
767 -1, 120, 16, 17, 91, 92, 93, 94, 95, 96,
768 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
769 -1, 108, -1, -1, -1, -1, 113, 114, 115, 116,
770 117, 118, 119, -1, 121, -1, 50, 51, 52, 53,
771 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
772 -1, -1, -1, 67, 68, 69, 70, 71, 72, 73,
773 74, 75, 76, -1, -1, 79, 80, 81, 82, -1,
774 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
775 -1, -1, -1, 97, 98, 99, 100, 101, -1, -1,
776 3, 4, 5, -1, -1, -1, 9, 111, -1, -1,
777 13, -1, 116, 16, 17, -1, 120, -1, -1, -1,
778 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
779 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
780 -1, -1, -1, -1, -1, -1, -1, 50, 51, 52,
781 53, 54, 55, 56, 57, 58, 59, 60, 61, -1,
782 -1, -1, -1, -1, 67, 68, 69, 70, 71, 72,
783 73, 74, 75, 76, -1, -1, 79, 80, 81, 82,
784 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
785 -1, -1, -1, -1, 97, 98, 99, 100, 101, -1,
786 -1, 3, 4, 5, -1, -1, -1, 9, 111, -1,
787 -1, 13, -1, 116, 16, 17, -1, 120, -1, -1,
788 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
789 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
790 -1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
791 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
792 -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
793 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
794 82, 3, 4, 5, -1, -1, -1, 9, -1, -1,
795 -1, 13, -1, -1, -1, 97, 98, 99, 100, 101,
796 -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
797 -1, -1, -1, -1, 116, -1, -1, -1, 120, -1,
798 -1, -1, -1, 45, -1, -1, -1, -1, 50, 51,
799 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
800 -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
801 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
802 82, 3, 4, 5, -1, -1, -1, 9, -1, -1,
803 -1, 13, -1, -1, -1, 97, 98, 99, 100, 101,
804 -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
805 -1, -1, -1, -1, 116, -1, -1, -1, 120, -1,
806 -1, -1, -1, 45, -1, -1, -1, -1, 50, 51,
807 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
808 -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
809 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
810 82, 3, 4, 5, -1, -1, -1, 9, -1, -1,
811 -1, 13, -1, -1, -1, 97, 98, 99, 100, 101,
812 -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
813 -1, -1, -1, -1, 116, -1, -1, -1, 120, -1,
814 -1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
815 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
816 -1, -1, -1, -1, -1, 67, 68, 69, 70, 71,
817 72, 73, 74, 75, 76, -1, -1, 79, 80, 81,
818 82, -1, -1, -1, 16, 17, -1, -1, -1, -1,
819 -1, -1, -1, -1, -1, 97, 98, 99, 100, 101,
820 -1, -1, -1, -1, -1, -1, -1, -1, -1, 111,
821 -1, -1, -1, -1, 116, -1, -1, -1, 120, 51,
822 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
823 91, 92, 93, 94, 95, 96, 16, 17, 45, -1,
824 -1, 48, -1, -1, -1, -1, -1, 79, 80, 81,
825 82, 112, 113, 114, 115, 116, 117, 118, 119, -1,
826 121, -1, -1, -1, -1, 97, 98, 99, 100, 101,
827 -1, 51, 52, 53, 54, 55, 56, 57, 58, 59,
828 60, 61, -1, -1, 91, 92, 93, 94, 95, 96,
829 45, -1, -1, 48, -1, -1, -1, -1, 130, 79,
830 80, 81, 82, -1, -1, 112, 113, 114, 115, 116,
831 117, 118, 119, -1, 121, -1, -1, 97, 98, 99,
832 100, 101, 129, 51, 52, 53, 54, 55, 56, 57,
833 58, 59, 60, 61, -1, -1, 91, 92, 93, 94,
834 95, 96, -1, -1, -1, -1, -1, -1, -1, -1,
835 130, 79, 80, 81, 82, -1, -1, 112, 113, 114,
836 115, 116, 117, 118, 119, -1, 121, -1, -1, 97,
837 98, 99, 100, 101, -1, -1, -1, -1, -1, -1,
838 -1, -1, 91, 92, 93, 94, 95, 96, -1, -1,
839 -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
840 -1, -1, 130, 112, 113, 114, 115, 116, 117, 118,
841 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
842 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
843 -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
844 -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
845 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
846 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
847 -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
848 -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
849 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
850 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
851 -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
852 -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
853 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
854 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
855 -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
856 -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
857 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
858 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
859 -1, 91, 92, 93, 94, 95, 96, -1, -1, -1,
860 -1, -1, -1, -1, 113, 114, 115, 116, 117, 118,
861 119, -1, 121, 113, 114, 115, 116, 117, 118, 119,
862 129, 121, 91, 92, 93, 94, 95, 96, -1, 129,
863 -1, -1, 91, 92, 93, 94, 95, 96, -1, -1,
864 -1, -1, -1, 112, 113, 114, 115, 116, 117, 118,
865 119, -1, 121, 112, 113, 114, 115, 116, 117, 118,
866 119, -1, 121, 91, 92, 93, 94, 95, 96, -1,
867 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
868 -1, -1, -1, -1, -1, 113, 114, 115, 116, 117,
869 118, 119, -1, 121
870};
871#define YYPURE 1
872
873/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
874#line 3 "/usr/local/lib/bison.simple"
875
876/* Skeleton output parser for bison,
877 Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
878
879 This program is free software; you can redistribute it and/or modify
880 it under the terms of the GNU General Public License as published by
881 the Free Software Foundation; either version 1, or (at your option)
882 any later version.
883
884 This program is distributed in the hope that it will be useful,
885 but WITHOUT ANY WARRANTY; without even the implied warranty of
886 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
887 GNU General Public License for more details.
888
889 You should have received a copy of the GNU General Public License
890 along with this program; if not, write to the Free Software
891 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
892
893
894#ifdef __GNUC__
895#ifndef alloca
896#define alloca __builtin_alloca
897#endif /* Not alloca. */
898#else /* Not GNU C. */
899#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
900#include <alloca.h>
901#endif /* Sparc. */
902#endif /* Not GNU C. */
903
904/* This is the parser code that is written into each bison parser
905 when the %semantic_parser declaration is not specified in the grammar.
906 It was written by Richard Stallman by simplifying the hairy parser
907 used when %semantic_parser is specified. */
908
909/* Note: there must be only one dollar sign in this file.
910 It is replaced by the list of actions, each action
911 as one case of the switch. */
912
913#define yyerrok (yyerrstatus = 0)
914#define yyclearin (yychar = YYEMPTY)
915#define YYEMPTY -2
916#define YYEOF 0
917#define YYACCEPT return(0)
918#define YYABORT return(1)
919#define YYERROR goto yyerrlab1
920/* Like YYERROR except do call yyerror.
921 This remains here temporarily to ease the
922 transition to the new meaning of YYERROR, for GCC.
923 Once GCC version 2 has supplanted version 1, this can go. */
924#define YYFAIL goto yyerrlab
925#define YYRECOVERING() (!!yyerrstatus)
926#define YYBACKUP(token, value) \
927do \
928 if (yychar == YYEMPTY && yylen == 1) \
929 { yychar = (token), yylval = (value); \
930 yychar1 = YYTRANSLATE (yychar); \
931 YYPOPSTACK; \
932 goto yybackup; \
933 } \
934 else \
935 { yyerror ("syntax error: cannot back up"); YYERROR; } \
936while (0)
937
938#define YYTERROR 1
939#define YYERRCODE 256
940
941#ifndef YYIMPURE
942#define YYLEX yylex()
943#endif
944
945#ifndef YYPURE
946#define YYLEX yylex(&yylval, &yylloc)
947#endif
948
949/* If nonreentrant, generate the variables here */
950
951#ifndef YYIMPURE
952
953int yychar; /* the lookahead symbol */
954YYSTYPE yylval; /* the semantic value of the */
955 /* lookahead symbol */
956
957#ifdef YYLSP_NEEDED
958YYLTYPE yylloc; /* location data for the lookahead */
959 /* symbol */
960#endif
961
962int yynerrs; /* number of parse errors so far */
963#endif /* YYIMPURE */
964
965#if YYDEBUG != 0
966int yydebug; /* nonzero means print parse trace */
967/* Since this is uninitialized, it does not stop multiple parsers
968 from coexisting. */
969#endif
970
971/* YYINITDEPTH indicates the initial size of the parser's stacks */
972
973#ifndef YYINITDEPTH
974#define YYINITDEPTH 200
975#endif
976
977/* YYMAXDEPTH is the maximum size the stacks can grow to
978 (effective only if the built-in stack extension method is used). */
979
980#if YYMAXDEPTH == 0
981#undef YYMAXDEPTH
982#endif
983
984#ifndef YYMAXDEPTH
985#define YYMAXDEPTH 10000
986#endif
987
988/* This is the most reliable way to avoid incompatibilities
989 in available built-in functions on various systems. */
990static void
991#ifdef __cplusplus
992__yy_bcopy (char *from, char *to, int count)
993#else
994__yy_bcopy (from, to, count)
995 char *from;
996 char *to;
997 int count;
998#endif
999{
1000 register char *f = from;
1001 register char *t = to;
1002 register int i = count;
1003
1004 while (i-- > 0)
1005 *t++ = *f++;
1006}
1007
1008#line 137 "/usr/local/lib/bison.simple"
1009int
1010yyparse()
1011{
1012 register int yystate;
1013 register int yyn;
1014 register short *yyssp;
1015 register YYSTYPE *yyvsp;
1016 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1017 int yychar1; /* lookahead token as an internal (translated) token number */
1018
1019 short yyssa[YYINITDEPTH]; /* the state stack */
1020 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1021
1022 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1023 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1024
1025#ifdef YYLSP_NEEDED
1026 YYLTYPE *yyls = yylsa;
1027 YYLTYPE *yylsp;
1028 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1029
1030#define YYPOPSTACK (yyvsp--, yysp--, yylsp--)
1031#else
1032#define YYPOPSTACK (yyvsp--, yysp--)
1033#endif
1034
1035 int yystacksize = YYINITDEPTH;
1036
1037#ifndef YYPURE
1038 int yychar;
1039 YYSTYPE yylval;
1040 int yynerrs;
1041#ifdef YYLSP_NEEDED
1042 YYLTYPE yylloc;
1043#endif
1044#endif
1045
1046 YYSTYPE yyval; /* the variable used to return */
1047 /* semantic values from the action */
1048 /* routines */
1049
1050 int yylen;
1051
1052#if YYDEBUG != 0
1053 if (yydebug)
1054 fprintf(stderr, "Starting parse\n");
1055#endif
1056
1057 yystate = 0;
1058 yyerrstatus = 0;
1059 yynerrs = 0;
1060 yychar = YYEMPTY; /* Cause a token to be read. */
1061
1062 /* Initialize stack pointers.
1063 Waste one element of value and location stack
1064 so that they stay on the same level as the state stack. */
1065
1066 yyssp = yyss - 1;
1067 yyvsp = yyvs;
1068#ifdef YYLSP_NEEDED
1069 yylsp = yyls;
1070#endif
1071
1072/* Push a new state, which is found in yystate . */
1073/* In all cases, when you get here, the value and location stacks
1074 have just been pushed. so pushing a state here evens the stacks. */
1075yynewstate:
1076
1077 *++yyssp = yystate;
1078
1079 if (yyssp >= yyss + yystacksize - 1)
1080 {
1081 /* Give user a chance to reallocate the stack */
1082 /* Use copies of these so that the &'s don't force the real ones into memory. */
1083 YYSTYPE *yyvs1 = yyvs;
1084 short *yyss1 = yyss;
1085#ifdef YYLSP_NEEDED
1086 YYLTYPE *yyls1 = yyls;
1087#endif
1088
1089 /* Get the current used size of the three stacks, in elements. */
1090 int size = yyssp - yyss + 1;
1091
1092#ifdef yyoverflow
1093 /* Each stack pointer address is followed by the size of
1094 the data in use in that stack, in bytes. */
1095 yyoverflow("parser stack overflow",
1096 &yyss1, size * sizeof (*yyssp),
1097 &yyvs1, size * sizeof (*yyvsp),
1098#ifdef YYLSP_NEEDED
1099 &yyls1, size * sizeof (*yylsp),
1100#endif
1101 &yystacksize);
1102
1103 yyss = yyss1; yyvs = yyvs1;
1104#ifdef YYLSP_NEEDED
1105 yyls = yyls1;
1106#endif
1107#else /* no yyoverflow */
1108 /* Extend the stack our own way. */
1109 if (yystacksize >= YYMAXDEPTH)
1110 {
1111 yyerror("parser stack overflow");
1112 return 2;
1113 }
1114 yystacksize *= 2;
1115 if (yystacksize > YYMAXDEPTH)
1116 yystacksize = YYMAXDEPTH;
1117 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
1118 __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
1119 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
1120 __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
1121#ifdef YYLSP_NEEDED
1122 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
1123 __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
1124#endif
1125#endif /* no yyoverflow */
1126
1127 yyssp = yyss + size - 1;
1128 yyvsp = yyvs + size - 1;
1129#ifdef YYLSP_NEEDED
1130 yylsp = yyls + size - 1;
1131#endif
1132
1133#if YYDEBUG != 0
1134 if (yydebug)
1135 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1136#endif
1137
1138 if (yyssp >= yyss + yystacksize - 1)
1139 YYABORT;
1140 }
1141
1142#if YYDEBUG != 0
1143 if (yydebug)
1144 fprintf(stderr, "Entering state %d\n", yystate);
1145#endif
1146
1147 yybackup:
1148
1149/* Do appropriate processing given the current state. */
1150/* Read a lookahead token if we need one and don't already have one. */
1151/* yyresume: */
1152
1153 /* First try to decide what to do without reference to lookahead token. */
1154
1155 yyn = yypact[yystate];
1156 if (yyn == YYFLAG)
1157 goto yydefault;
1158
1159 /* Not known => get a lookahead token if don't already have one. */
1160
1161 /* yychar is either YYEMPTY or YYEOF
1162 or a valid token in external form. */
1163
1164 if (yychar == YYEMPTY)
1165 {
1166#if YYDEBUG != 0
1167 if (yydebug)
1168 fprintf(stderr, "Reading a token: ");
1169#endif
1170 yychar = YYLEX;
1171 }
1172
1173 /* Convert token to internal form (in yychar1) for indexing tables with */
1174
1175 if (yychar <= 0) /* This means end of input. */
1176 {
1177 yychar1 = 0;
1178 yychar = YYEOF; /* Don't call YYLEX any more */
1179
1180#if YYDEBUG != 0
1181 if (yydebug)
1182 fprintf(stderr, "Now at end of input.\n");
1183#endif
1184 }
1185 else
1186 {
1187 yychar1 = YYTRANSLATE(yychar);
1188
1189#if YYDEBUG != 0
1190 if (yydebug)
1191 fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
1192#endif
1193 }
1194
1195 yyn += yychar1;
1196 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1197 goto yydefault;
1198
1199 yyn = yytable[yyn];
1200
1201 /* yyn is what to do for this token type in this state.
1202 Negative => reduce, -yyn is rule number.
1203 Positive => shift, yyn is new state.
1204 New state is final state => don't bother to shift,
1205 just return success.
1206 0, or most negative number => error. */
1207
1208 if (yyn < 0)
1209 {
1210 if (yyn == YYFLAG)
1211 goto yyerrlab;
1212 yyn = -yyn;
1213 goto yyreduce;
1214 }
1215 else if (yyn == 0)
1216 goto yyerrlab;
1217
1218 if (yyn == YYFINAL)
1219 YYACCEPT;
1220
1221 /* Shift the lookahead token. */
1222
1223#if YYDEBUG != 0
1224 if (yydebug)
1225 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1226#endif
1227
1228 /* Discard the token being shifted unless it is eof. */
1229 if (yychar != YYEOF)
1230 yychar = YYEMPTY;
1231
1232 *++yyvsp = yylval;
1233#ifdef YYLSP_NEEDED
1234 *++yylsp = yylloc;
1235#endif
1236
1237 /* count tokens shifted since error; after three, turn off error status. */
1238 if (yyerrstatus) yyerrstatus--;
1239
1240 yystate = yyn;
1241 goto yynewstate;
1242
1243/* Do the default action for the current state. */
1244yydefault:
1245
1246 yyn = yydefact[yystate];
1247 if (yyn == 0)
1248 goto yyerrlab;
1249
1250/* Do a reduction. yyn is the number of a rule to reduce with. */
1251yyreduce:
1252 yylen = yyr2[yyn];
1253 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1254
1255#if YYDEBUG != 0
1256 if (yydebug)
1257 {
1258 if (yylen == 1)
1259 fprintf (stderr, "Reducing 1 value via rule %d (line %d), ",
1260 yyn, yyrline[yyn]);
1261 else
1262 fprintf (stderr, "Reducing %d values via rule %d (line %d), ",
1263 yylen, yyn, yyrline[yyn]);
1264 }
1265#endif
1266
1267
1268 switch (yyn) {
1269
1270case 2:
1271#line 266 "pic.y"
1272{
1273 if (olist.head)
1274 print_picture(olist.head);
1275 ;
1276 break;}
1277case 3:
1278#line 275 "pic.y"
1279{ yyval.pl = yyvsp[-1].pl; ;
1280 break;}
1281case 4:
1282#line 280 "pic.y"
1283{ yyval.pl = yyvsp[0].pl; ;
1284 break;}
1285case 5:
1286#line 282 "pic.y"
1287{ yyval.pl = yyvsp[-2].pl; ;
1288 break;}
1289case 10:
1290#line 297 "pic.y"
1291{
1292 define_variable(yyvsp[-2].str, yyvsp[0].x);
1293 delete yyvsp[-2].str;
1294 ;
1295 break;}
1296case 11:
1297#line 302 "pic.y"
1298{ current_direction = UP_DIRECTION; ;
1299 break;}
1300case 12:
1301#line 304 "pic.y"
1302{ current_direction = DOWN_DIRECTION; ;
1303 break;}
1304case 13:
1305#line 306 "pic.y"
1306{ current_direction = LEFT_DIRECTION; ;
1307 break;}
1308case 14:
1309#line 308 "pic.y"
1310{ current_direction = RIGHT_DIRECTION; ;
1311 break;}
1312case 15:
1313#line 310 "pic.y"
1314{
1315 olist.append(make_command_object(yyvsp[0].lstr.str,
1316 yyvsp[0].lstr.filename,
1317 yyvsp[0].lstr.lineno));
1318 ;
1319 break;}
1320case 16:
1321#line 316 "pic.y"
1322{
1323 fprintf(stderr, "%g\n", yyvsp[0].x);
1324 fflush(stderr);
1325 ;
1326 break;}
1327case 17:
1328#line 321 "pic.y"
1329{
1330 fprintf(stderr, "%s\n", yyvsp[0].lstr.str);
1331 delete yyvsp[0].lstr.str;
1332 fflush(stderr);
1333 ;
1334 break;}
1335case 18:
1336#line 327 "pic.y"
1337{
1338 fprintf(stderr, "%g, %g\n", yyvsp[0].pair.x, yyvsp[0].pair.y);
1339 fflush(stderr);
1340 ;
1341 break;}
1342case 19:
1343#line 332 "pic.y"
1344{ delim_flag = 1; ;
1345 break;}
1346case 20:
1347#line 334 "pic.y"
1348{
1349 delim_flag = 0;
1350 system(yyvsp[0].str);
1351 delete yyvsp[0].str;
1352 ;
1353 break;}
1354case 21:
1355#line 340 "pic.y"
1356{
1357 if (yychar < 0)
1358 do_lookahead();
1359 do_copy(yyvsp[0].lstr.str);
1360 // do not delete the filename
1361 ;
1362 break;}
1363case 22:
1364#line 347 "pic.y"
1365{ delim_flag = 2; ;
1366 break;}
1367case 23:
1368#line 349 "pic.y"
1369{ delim_flag = 0; ;
1370 break;}
1371case 24:
1372#line 351 "pic.y"
1373{
1374 if (yychar < 0)
1375 do_lookahead();
1376 copy_file_thru(yyvsp[-5].lstr.str, yyvsp[-2].str, yyvsp[0].str);
1377 // do not delete the filename
1378 delete yyvsp[-2].str;
1379 delete yyvsp[0].str;
1380 ;
1381 break;}
1382case 25:
1383#line 360 "pic.y"
1384{ delim_flag = 2; ;
1385 break;}
1386case 26:
1387#line 362 "pic.y"
1388{ delim_flag = 0; ;
1389 break;}
1390case 27:
1391#line 364 "pic.y"
1392{
1393 if (yychar < 0)
1394 do_lookahead();
1395 copy_rest_thru(yyvsp[-2].str, yyvsp[0].str);
1396 delete yyvsp[-2].str;
1397 delete yyvsp[0].str;
1398 ;
1399 break;}
1400case 28:
1401#line 372 "pic.y"
1402{ delim_flag = 1; ;
1403 break;}
1404case 29:
1405#line 374 "pic.y"
1406{
1407 delim_flag = 0;
1408 if (yychar < 0)
1409 do_lookahead();
1410 do_for(yyvsp[-8].str, yyvsp[-6].x, yyvsp[-4].x, yyvsp[-3].by.is_multiplicative, yyvsp[-3].by.val, yyvsp[0].str);
1411 ;
1412 break;}
1413case 30:
1414#line 381 "pic.y"
1415{
1416 if (yychar < 0)
1417 do_lookahead();
1418 if (yyvsp[0].if_data.x != 0.0)
1419 push_body(yyvsp[0].if_data.body);
1420 delete yyvsp[0].if_data.body;
1421 ;
1422 break;}
1423case 31:
1424#line 389 "pic.y"
1425{ delim_flag = 1; ;
1426 break;}
1427case 32:
1428#line 391 "pic.y"
1429{
1430 delim_flag = 0;
1431 if (yychar < 0)
1432 do_lookahead();
1433 if (yyvsp[-3].if_data.x != 0.0)
1434 push_body(yyvsp[-3].if_data.body);
1435 else
1436 push_body(yyvsp[0].str);
1437 delete yyvsp[-3].if_data.body;
1438 delete yyvsp[0].str;
1439 ;
1440 break;}
1441case 34:
1442#line 404 "pic.y"
1443{ define_variable("scale", 1.0); ;
1444 break;}
1445case 35:
1446#line 409 "pic.y"
1447{ reset(yyvsp[0].str); delete yyvsp[0].str; ;
1448 break;}
1449case 36:
1450#line 411 "pic.y"
1451{ reset(yyvsp[0].str); delete yyvsp[0].str; ;
1452 break;}
1453case 37:
1454#line 413 "pic.y"
1455{ reset(yyvsp[0].str); delete yyvsp[0].str; ;
1456 break;}
1457case 38:
1458#line 418 "pic.y"
1459{ delim_flag = 1; ;
1460 break;}
1461case 39:
1462#line 420 "pic.y"
1463{ delim_flag = 0; yyval.if_data.x = yyvsp[-3].x; yyval.if_data.body = yyvsp[0].str; ;
1464 break;}
1465case 40:
1466#line 425 "pic.y"
1467{ yyval.str = 0; ;
1468 break;}
1469case 41:
1470#line 427 "pic.y"
1471{ yyval.str = yyvsp[0].lstr.str; ;
1472 break;}
1473case 42:
1474#line 432 "pic.y"
1475{ yyval.x = yyvsp[0].x; ;
1476 break;}
1477case 43:
1478#line 434 "pic.y"
1479{
1480 yyval.x = strcmp(yyvsp[-2].lstr.str, yyvsp[0].lstr.str) == 0;
1481 delete yyvsp[-2].lstr.str;
1482 delete yyvsp[0].lstr.str;
1483 ;
1484 break;}
1485case 44:
1486#line 440 "pic.y"
1487{
1488 yyval.x = strcmp(yyvsp[-2].lstr.str, yyvsp[0].lstr.str) != 0;
1489 delete yyvsp[-2].lstr.str;
1490 delete yyvsp[0].lstr.str;
1491 ;
1492 break;}
1493case 45:
1494#line 448 "pic.y"
1495{ yyval.by.val = 1.0; yyval.by.is_multiplicative = 0; ;
1496 break;}
1497case 46:
1498#line 450 "pic.y"
1499{ yyval.by.val = yyvsp[0].x; yyval.by.is_multiplicative = 0; ;
1500 break;}
1501case 47:
1502#line 452 "pic.y"
1503{ yyval.by.val = yyvsp[0].x; yyval.by.is_multiplicative = 1; ;
1504 break;}
1505case 48:
1506#line 457 "pic.y"
1507{
1508 yyval.pl.obj = yyvsp[0].spec->make_object(&current_position,
1509 &current_direction);
1510 if (yyval.pl.obj == 0)
1511 YYABORT;
1512 delete yyvsp[0].spec;
1513 if (yyval.pl.obj)
1514 olist.append(yyval.pl.obj);
1515 else {
1516 yyval.pl.x = current_position.x;
1517 yyval.pl.y = current_position.y;
1518 }
1519 ;
1520 break;}
1521case 49:
1522#line 471 "pic.y"
1523{ yyval.pl = yyvsp[0].pl; define_label(yyvsp[-3].str, & yyval.pl); delete yyvsp[-3].str; ;
1524 break;}
1525case 50:
1526#line 473 "pic.y"
1527{
1528 yyval.pl.obj = 0;
1529 yyval.pl.x = yyvsp[0].pair.x;
1530 yyval.pl.y = yyvsp[0].pair.y;
1531 define_label(yyvsp[-3].str, & yyval.pl);
1532 delete yyvsp[-3].str;
1533 ;
1534 break;}
1535case 51:
1536#line 481 "pic.y"
1537{
1538 yyval.pl = yyvsp[0].pl;
1539 define_label(yyvsp[-3].str, & yyval.pl);
1540 delete yyvsp[-3].str;
1541 ;
1542 break;}
1543case 52:
1544#line 487 "pic.y"
1545{
1546 yyval.state.x = current_position.x;
1547 yyval.state.y = current_position.y;
1548 yyval.state.dir = current_direction;
1549 ;
1550 break;}
1551case 53:
1552#line 493 "pic.y"
1553{
1554 current_position.x = yyvsp[-2].state.x;
1555 current_position.y = yyvsp[-2].state.y;
1556 current_direction = yyvsp[-2].state.dir;
1557 yyval.pl = yyvsp[-1].pl;
1558 ;
1559 break;}
1560case 54:
1561#line 500 "pic.y"
1562{
1563 yyval.pl.obj = 0;
1564 yyval.pl.x = current_position.x;
1565 yyval.pl.y = current_position.y;
1566 ;
1567 break;}
1568case 55:
1569#line 509 "pic.y"
1570{
1571 yyval.spec = new object_spec(BOX_OBJECT);
1572 ;
1573 break;}
1574case 56:
1575#line 513 "pic.y"
1576{
1577 yyval.spec = new object_spec(CIRCLE_OBJECT);
1578 ;
1579 break;}
1580case 57:
1581#line 517 "pic.y"
1582{
1583 yyval.spec = new object_spec(ELLIPSE_OBJECT);
1584 ;
1585 break;}
1586case 58:
1587#line 521 "pic.y"
1588{
1589 yyval.spec = new object_spec(ARC_OBJECT);
1590 yyval.spec->dir = current_direction;
1591 ;
1592 break;}
1593case 59:
1594#line 526 "pic.y"
1595{
1596 yyval.spec = new object_spec(LINE_OBJECT);
1597 lookup_variable("lineht", & yyval.spec->segment_height);
1598 lookup_variable("linewid", & yyval.spec->segment_width);
1599 yyval.spec->dir = current_direction;
1600 ;
1601 break;}
1602case 60:
1603#line 533 "pic.y"
1604{
1605 yyval.spec = new object_spec(ARROW_OBJECT);
1606 lookup_variable("lineht", & yyval.spec->segment_height);
1607 lookup_variable("linewid", & yyval.spec->segment_width);
1608 yyval.spec->dir = current_direction;
1609 ;
1610 break;}
1611case 61:
1612#line 540 "pic.y"
1613{
1614 yyval.spec = new object_spec(MOVE_OBJECT);
1615 lookup_variable("moveht", & yyval.spec->segment_height);
1616 lookup_variable("movewid", & yyval.spec->segment_width);
1617 yyval.spec->dir = current_direction;
1618 ;
1619 break;}
1620case 62:
1621#line 547 "pic.y"
1622{
1623 yyval.spec = new object_spec(SPLINE_OBJECT);
1624 lookup_variable("lineht", & yyval.spec->segment_height);
1625 lookup_variable("linewid", & yyval.spec->segment_width);
1626 yyval.spec->dir = current_direction;
1627 ;
1628 break;}
1629case 63:
1630#line 554 "pic.y"
1631{
1632 yyval.spec = new object_spec(TEXT_OBJECT);
1633 yyval.spec->text = new text_item(yyvsp[0].lstr.str, yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
1634 ;
1635 break;}
1636case 64:
1637#line 559 "pic.y"
1638{
1639 yyval.spec = new object_spec(TEXT_OBJECT);
1640 yyval.spec->text = new text_item(format_number(0, yyvsp[0].x), 0, -1);
1641 ;
1642 break;}
1643case 65:
1644#line 564 "pic.y"
1645{
1646 yyval.spec = new object_spec(TEXT_OBJECT);
1647 yyval.spec->text = new text_item(format_number(yyvsp[0].lstr.str, yyvsp[-1].x),
1648 yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
1649 delete yyvsp[0].lstr.str;
1650 ;
1651 break;}
1652case 66:
1653#line 571 "pic.y"
1654{
1655 saved_state *p = new saved_state;
1656 yyval.pstate = p;
1657 p->x = current_position.x;
1658 p->y = current_position.y;
1659 p->dir = current_direction;
1660 p->tbl = current_table;
1661 p->prev = current_saved_state;
1662 current_position.x = 0.0;
1663 current_position.y = 0.0;
1664 current_table = new PTABLE(place);
1665 current_saved_state = p;
1666 olist.append(make_mark_object());
1667 ;
1668 break;}
1669case 67:
1670#line 586 "pic.y"
1671{
1672 current_position.x = yyvsp[-2].pstate->x;
1673 current_position.y = yyvsp[-2].pstate->y;
1674 current_direction = yyvsp[-2].pstate->dir;
1675 yyval.spec = new object_spec(BLOCK_OBJECT);
1676 olist.wrap_up_block(& yyval.spec->oblist);
1677 yyval.spec->tbl = current_table;
1678 current_table = yyvsp[-2].pstate->tbl;
1679 current_saved_state = yyvsp[-2].pstate->prev;
1680 delete yyvsp[-2].pstate;
1681 ;
1682 break;}
1683case 68:
1684#line 598 "pic.y"
1685{
1686 yyval.spec = yyvsp[-2].spec;
1687 yyval.spec->height = yyvsp[0].x;
1688 yyval.spec->flags |= HAS_HEIGHT;
1689 ;
1690 break;}
1691case 69:
1692#line 604 "pic.y"
1693{
1694 yyval.spec = yyvsp[-2].spec;
1695 yyval.spec->radius = yyvsp[0].x;
1696 yyval.spec->flags |= HAS_RADIUS;
1697 ;
1698 break;}
1699case 70:
1700#line 610 "pic.y"
1701{
1702 yyval.spec = yyvsp[-2].spec;
1703 yyval.spec->width = yyvsp[0].x;
1704 yyval.spec->flags |= HAS_WIDTH;
1705 ;
1706 break;}
1707case 71:
1708#line 616 "pic.y"
1709{
1710 yyval.spec = yyvsp[-2].spec;
1711 yyval.spec->radius = yyvsp[0].x/2.0;
1712 yyval.spec->flags |= HAS_RADIUS;
1713 ;
1714 break;}
1715case 72:
1716#line 622 "pic.y"
1717{
1718 yyval.spec = yyvsp[-1].spec;
1719 yyval.spec->flags |= HAS_SEGMENT;
1720 switch (yyval.spec->dir) {
1721 case UP_DIRECTION:
1722 yyval.spec->segment_pos.y += yyvsp[0].x;
1723 break;
1724 case DOWN_DIRECTION:
1725 yyval.spec->segment_pos.y -= yyvsp[0].x;
1726 break;
1727 case RIGHT_DIRECTION:
1728 yyval.spec->segment_pos.x += yyvsp[0].x;
1729 break;
1730 case LEFT_DIRECTION:
1731 yyval.spec->segment_pos.x -= yyvsp[0].x;
1732 break;
1733 }
1734 ;
1735 break;}
1736case 73:
1737#line 641 "pic.y"
1738{
1739 yyval.spec = yyvsp[-1].spec;
1740 yyval.spec->dir = UP_DIRECTION;
1741 yyval.spec->flags |= HAS_SEGMENT;
1742 yyval.spec->segment_pos.y += yyval.spec->segment_height;
1743 ;
1744 break;}
1745case 74:
1746#line 648 "pic.y"
1747{
1748 yyval.spec = yyvsp[-2].spec;
1749 yyval.spec->dir = UP_DIRECTION;
1750 yyval.spec->flags |= HAS_SEGMENT;
1751 yyval.spec->segment_pos.y += yyvsp[0].x;
1752 ;
1753 break;}
1754case 75:
1755#line 655 "pic.y"
1756{
1757 yyval.spec = yyvsp[-1].spec;
1758 yyval.spec->dir = DOWN_DIRECTION;
1759 yyval.spec->flags |= HAS_SEGMENT;
1760 yyval.spec->segment_pos.y -= yyval.spec->segment_height;
1761 ;
1762 break;}
1763case 76:
1764#line 662 "pic.y"
1765{
1766 yyval.spec = yyvsp[-2].spec;
1767 yyval.spec->dir = DOWN_DIRECTION;
1768 yyval.spec->flags |= HAS_SEGMENT;
1769 yyval.spec->segment_pos.y -= yyvsp[0].x;
1770 ;
1771 break;}
1772case 77:
1773#line 669 "pic.y"
1774{
1775 yyval.spec = yyvsp[-1].spec;
1776 yyval.spec->dir = RIGHT_DIRECTION;
1777 yyval.spec->flags |= HAS_SEGMENT;
1778 yyval.spec->segment_pos.x += yyval.spec->segment_width;
1779 ;
1780 break;}
1781case 78:
1782#line 676 "pic.y"
1783{
1784 yyval.spec = yyvsp[-2].spec;
1785 yyval.spec->dir = RIGHT_DIRECTION;
1786 yyval.spec->flags |= HAS_SEGMENT;
1787 yyval.spec->segment_pos.x += yyvsp[0].x;
1788 ;
1789 break;}
1790case 79:
1791#line 683 "pic.y"
1792{
1793 yyval.spec = yyvsp[-1].spec;
1794 yyval.spec->dir = LEFT_DIRECTION;
1795 yyval.spec->flags |= HAS_SEGMENT;
1796 yyval.spec->segment_pos.x -= yyval.spec->segment_width;
1797 ;
1798 break;}
1799case 80:
1800#line 690 "pic.y"
1801{
1802 yyval.spec = yyvsp[-2].spec;
1803 yyval.spec->dir = LEFT_DIRECTION;
1804 yyval.spec->flags |= HAS_SEGMENT;
1805 yyval.spec->segment_pos.x -= yyvsp[0].x;
1806 ;
1807 break;}
1808case 81:
1809#line 697 "pic.y"
1810{
1811 yyval.spec = yyvsp[-2].spec;
1812 yyval.spec->flags |= HAS_FROM;
1813 yyval.spec->from.x = yyvsp[0].pair.x;
1814 yyval.spec->from.y = yyvsp[0].pair.y;
1815 ;
1816 break;}
1817case 82:
1818#line 704 "pic.y"
1819{
1820 yyval.spec = yyvsp[-2].spec;
1821 if (yyval.spec->flags & HAS_SEGMENT)
1822 yyval.spec->segment_list = new segment(yyval.spec->segment_pos,
1823 yyval.spec->segment_is_absolute,
1824 yyval.spec->segment_list);
1825 yyval.spec->flags |= HAS_SEGMENT;
1826 yyval.spec->segment_pos.x = yyvsp[0].pair.x;
1827 yyval.spec->segment_pos.y = yyvsp[0].pair.y;
1828 yyval.spec->segment_is_absolute = 1;
1829 yyval.spec->flags |= HAS_TO;
1830 yyval.spec->to.x = yyvsp[0].pair.x;
1831 yyval.spec->to.y = yyvsp[0].pair.y;
1832 ;
1833 break;}
1834case 83:
1835#line 719 "pic.y"
1836{
1837 yyval.spec = yyvsp[-2].spec;
1838 yyval.spec->flags |= HAS_AT;
1839 yyval.spec->at.x = yyvsp[0].pair.x;
1840 yyval.spec->at.y = yyvsp[0].pair.y;
1841 if (yyval.spec->type != ARC_OBJECT) {
1842 yyval.spec->flags |= HAS_FROM;
1843 yyval.spec->from.x = yyvsp[0].pair.x;
1844 yyval.spec->from.y = yyvsp[0].pair.y;
1845 }
1846 ;
1847 break;}
1848case 84:
1849#line 731 "pic.y"
1850{
1851 yyval.spec = yyvsp[-2].spec;
1852 yyval.spec->flags |= HAS_WITH;
1853 yyval.spec->with = yyvsp[0].pth;
1854 ;
1855 break;}
1856case 85:
1857#line 737 "pic.y"
1858{
1859 yyval.spec = yyvsp[-2].spec;
1860 yyval.spec->flags |= HAS_SEGMENT;
1861 yyval.spec->segment_pos.x += yyvsp[0].pair.x;
1862 yyval.spec->segment_pos.y += yyvsp[0].pair.y;
1863 ;
1864 break;}
1865case 86:
1866#line 744 "pic.y"
1867{
1868 yyval.spec = yyvsp[-1].spec;
1869 if (yyval.spec->flags & HAS_SEGMENT) {
1870 yyval.spec->segment_list = new segment(yyval.spec->segment_pos,
1871 yyval.spec->segment_is_absolute,
1872 yyval.spec->segment_list);
1873 yyval.spec->flags &= ~HAS_SEGMENT;
1874 yyval.spec->segment_pos.x = yyval.spec->segment_pos.y = 0.0;
1875 yyval.spec->segment_is_absolute = 0;
1876 }
1877 ;
1878 break;}
1879case 87:
1880#line 756 "pic.y"
1881{
1882 yyval.spec = yyvsp[-1].spec;
1883 yyval.spec->flags |= IS_DOTTED;
1884 lookup_variable("dashwid", & yyval.spec->dash_width);
1885 ;
1886 break;}
1887case 88:
1888#line 762 "pic.y"
1889{
1890 yyval.spec = yyvsp[-2].spec;
1891 yyval.spec->flags |= IS_DOTTED;
1892 yyval.spec->dash_width = yyvsp[0].x;
1893 ;
1894 break;}
1895case 89:
1896#line 768 "pic.y"
1897{
1898 yyval.spec = yyvsp[-1].spec;
1899 yyval.spec->flags |= IS_DASHED;
1900 lookup_variable("dashwid", & yyval.spec->dash_width);
1901 ;
1902 break;}
1903case 90:
1904#line 774 "pic.y"
1905{
1906 yyval.spec = yyvsp[-2].spec;
1907 yyval.spec->flags |= IS_DASHED;
1908 yyval.spec->dash_width = yyvsp[0].x;
1909 ;
1910 break;}
1911case 91:
1912#line 780 "pic.y"
1913{
1914 yyval.spec = yyvsp[-1].spec;
1915 yyval.spec->flags |= IS_DEFAULT_FILLED;
1916 ;
1917 break;}
1918case 92:
1919#line 785 "pic.y"
1920{
1921 yyval.spec = yyvsp[-2].spec;
1922 yyval.spec->flags |= IS_FILLED;
1923 yyval.spec->fill = yyvsp[0].x;
1924 ;
1925 break;}
1926case 93:
1927#line 791 "pic.y"
1928{
1929 yyval.spec = yyvsp[-1].spec;
1930 // line chop chop means line chop 0 chop 0
1931 if (yyval.spec->flags & IS_DEFAULT_CHOPPED) {
1932 yyval.spec->flags |= IS_CHOPPED;
1933 yyval.spec->flags &= ~IS_DEFAULT_CHOPPED;
1934 yyval.spec->start_chop = yyval.spec->end_chop = 0.0;
1935 }
1936 else if (yyval.spec->flags & IS_CHOPPED) {
1937 yyval.spec->end_chop = 0.0;
1938 }
1939 else {
1940 yyval.spec->flags |= IS_DEFAULT_CHOPPED;
1941 }
1942 ;
1943 break;}
1944case 94:
1945#line 807 "pic.y"
1946{
1947 yyval.spec = yyvsp[-2].spec;
1948 if (yyval.spec->flags & IS_DEFAULT_CHOPPED) {
1949 yyval.spec->flags |= IS_CHOPPED;
1950 yyval.spec->flags &= ~IS_DEFAULT_CHOPPED;
1951 yyval.spec->start_chop = 0.0;
1952 yyval.spec->end_chop = yyvsp[0].x;
1953 }
1954 else if (yyval.spec->flags & IS_CHOPPED) {
1955 yyval.spec->end_chop = yyvsp[0].x;
1956 }
1957 else {
1958 yyval.spec->start_chop = yyval.spec->end_chop = yyvsp[0].x;
1959 yyval.spec->flags |= IS_CHOPPED;
1960 }
1961 ;
1962 break;}
1963case 95:
1964#line 824 "pic.y"
1965{
1966 yyval.spec = yyvsp[-1].spec;
1967 yyval.spec->flags |= IS_SAME;
1968 ;
1969 break;}
1970case 96:
1971#line 829 "pic.y"
1972{
1973 yyval.spec = yyvsp[-1].spec;
1974 yyval.spec->flags |= IS_INVISIBLE;
1975 ;
1976 break;}
1977case 97:
1978#line 834 "pic.y"
1979{
1980 yyval.spec = yyvsp[-1].spec;
1981 yyval.spec->flags |= HAS_LEFT_ARROW_HEAD;
1982 ;
1983 break;}
1984case 98:
1985#line 839 "pic.y"
1986{
1987 yyval.spec = yyvsp[-1].spec;
1988 yyval.spec->flags |= HAS_RIGHT_ARROW_HEAD;
1989 ;
1990 break;}
1991case 99:
1992#line 844 "pic.y"
1993{
1994 yyval.spec = yyvsp[-1].spec;
1995 yyval.spec->flags |= (HAS_LEFT_ARROW_HEAD|HAS_RIGHT_ARROW_HEAD);
1996 ;
1997 break;}
1998case 100:
1999#line 849 "pic.y"
2000{
2001 yyval.spec = yyvsp[-1].spec;
2002 yyval.spec->flags |= IS_CLOCKWISE;
2003 ;
2004 break;}
2005case 101:
2006#line 854 "pic.y"
2007{
2008 yyval.spec = yyvsp[-1].spec;
2009 yyval.spec->flags &= ~IS_CLOCKWISE;
2010 ;
2011 break;}
2012case 102:
2013#line 859 "pic.y"
2014{
2015 yyval.spec = yyvsp[-1].spec;
2016 for (text_item **p = & yyval.spec->text; *p; p = &(*p)->next)
2017 ;
2018 *p = new text_item(yyvsp[0].lstr.str, yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
2019 ;
2020 break;}
2021case 103:
2022#line 866 "pic.y"
2023{
2024 yyval.spec = yyvsp[-1].spec;
2025 if (yyval.spec->text) {
2026 for (text_item *p = yyval.spec->text; p->next; p = p->next)
2027 ;
2028 p->adj.h = LEFT_ADJUST;
2029 }
2030 ;
2031 break;}
2032case 104:
2033#line 875 "pic.y"
2034{
2035 yyval.spec = yyvsp[-1].spec;
2036 if (yyval.spec->text) {
2037 for (text_item *p = yyval.spec->text; p->next; p = p->next)
2038 ;
2039 p->adj.h = RIGHT_ADJUST;
2040 }
2041 ;
2042 break;}
2043case 105:
2044#line 884 "pic.y"
2045{
2046 yyval.spec = yyvsp[-1].spec;
2047 if (yyval.spec->text) {
2048 for (text_item *p = yyval.spec->text; p->next; p = p->next)
2049 ;
2050 p->adj.v = ABOVE_ADJUST;
2051 }
2052 ;
2053 break;}
2054case 106:
2055#line 893 "pic.y"
2056{
2057 yyval.spec = yyvsp[-1].spec;
2058 if (yyval.spec->text) {
2059 for (text_item *p = yyval.spec->text; p->next; p = p->next)
2060 ;
2061 p->adj.v = BELOW_ADJUST;
2062 }
2063 ;
2064 break;}
2065case 107:
2066#line 902 "pic.y"
2067{
2068 yyval.spec = yyvsp[-2].spec;
2069 yyval.spec->flags |= HAS_THICKNESS;
2070 yyval.spec->thickness = yyvsp[0].x;
2071 ;
2072 break;}
2073case 108:
2074#line 908 "pic.y"
2075{
2076 yyval.spec = yyvsp[-1].spec;
2077 yyval.spec->flags |= IS_ALIGNED;
2078 ;
2079 break;}
2080case 109:
2081#line 916 "pic.y"
2082{
2083 yyval.lstr = yyvsp[0].lstr;
2084 ;
2085 break;}
2086case 110:
2087#line 920 "pic.y"
2088{
2089 yyval.lstr.filename = yyvsp[-2].lstr.filename;
2090 yyval.lstr.lineno = yyvsp[-2].lstr.lineno;
2091 yyval.lstr.str = do_sprintf(yyvsp[-2].lstr.str, yyvsp[-1].dv.v, yyvsp[-1].dv.nv);
2092 delete yyvsp[-1].dv.v;
2093 delete yyvsp[-2].lstr.str;
2094 ;
2095 break;}
2096case 111:
2097#line 931 "pic.y"
2098{
2099 yyval.dv.v = 0;
2100 yyval.dv.nv = 0;
2101 yyval.dv.maxv = 0;
2102 ;
2103 break;}
2104case 112:
2105#line 937 "pic.y"
2106{
2107 yyval.dv = yyvsp[-2].dv;
2108 if (yyval.dv.nv >= yyval.dv.maxv) {
2109 if (yyval.dv.nv == 0) {
2110 yyval.dv.v = new double[4];
2111 yyval.dv.maxv = 4;
2112 }
2113 else {
2114 double *oldv = yyval.dv.v;
2115 yyval.dv.maxv *= 2;
2116 yyval.dv.v = new double[yyval.dv.maxv];
2117 memcpy(yyval.dv.v, oldv, yyval.dv.nv*sizeof(double));
2118 delete oldv;
2119 }
2120 }
2121 yyval.dv.v[yyval.dv.nv] = yyvsp[0].x;
2122 yyval.dv.nv += 1;
2123 ;
2124 break;}
2125case 113:
2126#line 959 "pic.y"
2127{ yyval.pair = yyvsp[0].pair; ;
2128 break;}
2129case 114:
2130#line 961 "pic.y"
2131{
2132 position pos = yyvsp[0].pl;
2133 yyval.pair.x = pos.x;
2134 yyval.pair.y = pos.y;
2135 ;
2136 break;}
2137case 115:
2138#line 970 "pic.y"
2139{ yyval.pair = yyvsp[0].pair; ;
2140 break;}
2141case 116:
2142#line 972 "pic.y"
2143{
2144 yyval.pair.x = yyvsp[-2].pair.x + yyvsp[0].pair.x;
2145 yyval.pair.y = yyvsp[-2].pair.y + yyvsp[0].pair.y;
2146 ;
2147 break;}
2148case 117:
2149#line 977 "pic.y"
2150{
2151 yyval.pair.x = yyvsp[-2].pair.x - yyvsp[0].pair.x;
2152 yyval.pair.y = yyvsp[-2].pair.y - yyvsp[0].pair.y;
2153 ;
2154 break;}
2155case 118:
2156#line 982 "pic.y"
2157{
2158 yyval.pair.x = yyvsp[-3].pair.x;
2159 yyval.pair.y = yyvsp[-1].pair.y;
2160 ;
2161 break;}
2162case 119:
2163#line 987 "pic.y"
2164{
2165 yyval.pair.x = (1.0 - yyvsp[-4].x)*yyvsp[-2].pair.x + yyvsp[-4].x*yyvsp[0].pair.x;
2166 yyval.pair.y = (1.0 - yyvsp[-4].x)*yyvsp[-2].pair.y + yyvsp[-4].x*yyvsp[0].pair.y;
2167 ;
2168 break;}
2169case 120:
2170#line 992 "pic.y"
2171{
2172 yyval.pair.x = (1.0 - yyvsp[-5].x)*yyvsp[-3].pair.x + yyvsp[-5].x*yyvsp[-1].pair.x;
2173 yyval.pair.y = (1.0 - yyvsp[-5].x)*yyvsp[-3].pair.y + yyvsp[-5].x*yyvsp[-1].pair.y;
2174 ;
2175 break;}
2176case 123:
2177#line 1005 "pic.y"
2178{ yyval.pair.x = yyvsp[-2].x; yyval.pair.y = yyvsp[0].x; ;
2179 break;}
2180case 124:
2181#line 1007 "pic.y"
2182{ yyval.pair = yyvsp[-1].pair; ;
2183 break;}
2184case 125:
2185#line 1012 "pic.y"
2186{ yyval.pl = yyvsp[0].pl; ;
2187 break;}
2188case 126:
2189#line 1014 "pic.y"
2190{
2191 path pth(yyvsp[0].crn);
2192 if (!pth.follow(yyvsp[-1].pl, & yyval.pl))
2193 YYABORT;
2194 ;
2195 break;}
2196case 127:
2197#line 1020 "pic.y"
2198{
2199 path pth(yyvsp[-1].crn);
2200 if (!pth.follow(yyvsp[0].pl, & yyval.pl))
2201 YYABORT;
2202 ;
2203 break;}
2204case 128:
2205#line 1026 "pic.y"
2206{
2207 path pth(yyvsp[-2].crn);
2208 if (!pth.follow(yyvsp[0].pl, & yyval.pl))
2209 YYABORT;
2210 ;
2211 break;}
2212case 129:
2213#line 1032 "pic.y"
2214{
2215 yyval.pl.x = current_position.x;
2216 yyval.pl.y = current_position.y;
2217 yyval.pl.obj = 0;
2218 ;
2219 break;}
2220case 130:
2221#line 1041 "pic.y"
2222{
2223 place *p = lookup_label(yyvsp[0].str);
2224 if (!p) {
2225 lex_error("there is no place `%1'", yyvsp[0].str);
2226 YYABORT;
2227 }
2228 yyval.pl = *p;
2229 delete yyvsp[0].str;
2230 ;
2231 break;}
2232case 131:
2233#line 1051 "pic.y"
2234{
2235 yyval.pl.obj = yyvsp[0].obj;
2236 ;
2237 break;}
2238case 132:
2239#line 1055 "pic.y"
2240{
2241 path pth(yyvsp[0].str);
2242 if (!pth.follow(yyvsp[-2].pl, & yyval.pl))
2243 YYABORT;
2244 ;
2245 break;}
2246case 133:
2247#line 1064 "pic.y"
2248{ yyval.n = 1; ;
2249 break;}
2250case 134:
2251#line 1066 "pic.y"
2252{ yyval.n = yyvsp[-1].n; ;
2253 break;}
2254case 135:
2255#line 1071 "pic.y"
2256{
2257 int count = 0;
2258 for (object *p = olist.head; p != 0; p = p->next)
2259 if (p->type() == yyvsp[0].obtype && ++count == yyvsp[-1].n) {
2260 yyval.obj = p;
2261 break;
2262 }
2263 if (p == 0) {
2264 lex_error("there is no %1%2 %3", yyvsp[-1].n, ordinal_postfix(yyvsp[-1].n),
2265 object_type_name(yyvsp[0].obtype));
2266 YYABORT;
2267 }
2268 ;
2269 break;}
2270case 136:
2271#line 1085 "pic.y"
2272{
2273 int count = 0;
2274 for (object *p = olist.tail; p != 0; p = p->prev)
2275 if (p->type() == yyvsp[0].obtype && ++count == yyvsp[-1].n) {
2276 yyval.obj = p;
2277 break;
2278 }
2279 if (p == 0) {
2280 lex_error("there is no %1%2 last %3", yyvsp[-1].n,
2281 ordinal_postfix(yyvsp[-1].n), object_type_name(yyvsp[0].obtype));
2282 YYABORT;
2283 }
2284 ;
2285 break;}
2286case 137:
2287#line 1102 "pic.y"
2288{ yyval.obtype = BOX_OBJECT; ;
2289 break;}
2290case 138:
2291#line 1104 "pic.y"
2292{ yyval.obtype = CIRCLE_OBJECT; ;
2293 break;}
2294case 139:
2295#line 1106 "pic.y"
2296{ yyval.obtype = ELLIPSE_OBJECT; ;
2297 break;}
2298case 140:
2299#line 1108 "pic.y"
2300{ yyval.obtype = ARC_OBJECT; ;
2301 break;}
2302case 141:
2303#line 1110 "pic.y"
2304{ yyval.obtype = LINE_OBJECT; ;
2305 break;}
2306case 142:
2307#line 1112 "pic.y"
2308{ yyval.obtype = ARROW_OBJECT; ;
2309 break;}
2310case 143:
2311#line 1114 "pic.y"
2312{ yyval.obtype = SPLINE_OBJECT; ;
2313 break;}
2314case 144:
2315#line 1116 "pic.y"
2316{ yyval.obtype = BLOCK_OBJECT; ;
2317 break;}
2318case 145:
2319#line 1118 "pic.y"
2320{ yyval.obtype = TEXT_OBJECT; ;
2321 break;}
2322case 146:
2323#line 1123 "pic.y"
2324{
2325 yyval.pth = new path(yyvsp[0].str);
2326 ;
2327 break;}
2328case 147:
2329#line 1127 "pic.y"
2330{
2331 yyval.pth = yyvsp[-2].pth;
2332 yyval.pth->append(yyvsp[0].str);
2333 ;
2334 break;}
2335case 148:
2336#line 1135 "pic.y"
2337{
2338 yyval.pth = new path(yyvsp[0].crn);
2339 ;
2340 break;}
2341case 149:
2342#line 1142 "pic.y"
2343{
2344 yyval.pth = yyvsp[0].pth;
2345 ;
2346 break;}
2347case 150:
2348#line 1146 "pic.y"
2349{
2350 yyval.pth = yyvsp[-1].pth;
2351 yyval.pth->append(yyvsp[0].crn);
2352 ;
2353 break;}
2354case 151:
2355#line 1154 "pic.y"
2356{
2357 yyval.pth = yyvsp[0].pth;
2358 ;
2359 break;}
2360case 152:
2361#line 1159 "pic.y"
2362{
2363 lex_warning("`%1%2 last %3' in `with' argument ignored",
2364 yyvsp[-3].n, ordinal_postfix(yyvsp[-3].n), object_type_name(yyvsp[-1].obtype));
2365 yyval.pth = yyvsp[0].pth;
2366 ;
2367 break;}
2368case 153:
2369#line 1165 "pic.y"
2370{
2371 lex_warning("`last %1' in `with' argument ignored",
2372 object_type_name(yyvsp[-1].obtype));
2373 yyval.pth = yyvsp[0].pth;
2374 ;
2375 break;}
2376case 154:
2377#line 1171 "pic.y"
2378{
2379 lex_warning("`%1%2 %3' in `with' argument ignored",
2380 yyvsp[-2].n, ordinal_postfix(yyvsp[-2].n), object_type_name(yyvsp[-1].obtype));
2381 yyval.pth = yyvsp[0].pth;
2382 ;
2383 break;}
2384case 155:
2385#line 1177 "pic.y"
2386{
2387 lex_warning("initial `%1' in `with' argument ignored", yyvsp[-1].str);
2388 delete yyvsp[-1].str;
2389 yyval.pth = yyvsp[0].pth;
2390 ;
2391 break;}
2392case 156:
2393#line 1186 "pic.y"
2394{ yyval.crn = &object::north; ;
2395 break;}
2396case 157:
2397#line 1188 "pic.y"
2398{ yyval.crn = &object::east; ;
2399 break;}
2400case 158:
2401#line 1190 "pic.y"
2402{ yyval.crn = &object::west; ;
2403 break;}
2404case 159:
2405#line 1192 "pic.y"
2406{ yyval.crn = &object::south; ;
2407 break;}
2408case 160:
2409#line 1194 "pic.y"
2410{ yyval.crn = &object::north_east; ;
2411 break;}
2412case 161:
2413#line 1196 "pic.y"
2414{ yyval.crn = &object:: south_east; ;
2415 break;}
2416case 162:
2417#line 1198 "pic.y"
2418{ yyval.crn = &object::north_west; ;
2419 break;}
2420case 163:
2421#line 1200 "pic.y"
2422{ yyval.crn = &object::south_west; ;
2423 break;}
2424case 164:
2425#line 1202 "pic.y"
2426{ yyval.crn = &object::center; ;
2427 break;}
2428case 165:
2429#line 1204 "pic.y"
2430{ yyval.crn = &object::start; ;
2431 break;}
2432case 166:
2433#line 1206 "pic.y"
2434{ yyval.crn = &object::end; ;
2435 break;}
2436case 167:
2437#line 1208 "pic.y"
2438{ yyval.crn = &object::north; ;
2439 break;}
2440case 168:
2441#line 1210 "pic.y"
2442{ yyval.crn = &object::south; ;
2443 break;}
2444case 169:
2445#line 1212 "pic.y"
2446{ yyval.crn = &object::west; ;
2447 break;}
2448case 170:
2449#line 1214 "pic.y"
2450{ yyval.crn = &object::east; ;
2451 break;}
2452case 171:
2453#line 1216 "pic.y"
2454{ yyval.crn = &object::north_west; ;
2455 break;}
2456case 172:
2457#line 1218 "pic.y"
2458{ yyval.crn = &object::south_west; ;
2459 break;}
2460case 173:
2461#line 1220 "pic.y"
2462{ yyval.crn = &object::north_east; ;
2463 break;}
2464case 174:
2465#line 1222 "pic.y"
2466{ yyval.crn = &object::south_east; ;
2467 break;}
2468case 175:
2469#line 1224 "pic.y"
2470{ yyval.crn = &object::west; ;
2471 break;}
2472case 176:
2473#line 1226 "pic.y"
2474{ yyval.crn = &object::east; ;
2475 break;}
2476case 177:
2477#line 1228 "pic.y"
2478{ yyval.crn = &object::north_west; ;
2479 break;}
2480case 178:
2481#line 1230 "pic.y"
2482{ yyval.crn = &object::south_west; ;
2483 break;}
2484case 179:
2485#line 1232 "pic.y"
2486{ yyval.crn = &object::north_east; ;
2487 break;}
2488case 180:
2489#line 1234 "pic.y"
2490{ yyval.crn = &object::south_east; ;
2491 break;}
2492case 181:
2493#line 1236 "pic.y"
2494{ yyval.crn = &object::center; ;
2495 break;}
2496case 182:
2497#line 1238 "pic.y"
2498{ yyval.crn = &object::start; ;
2499 break;}
2500case 183:
2501#line 1240 "pic.y"
2502{ yyval.crn = &object::end; ;
2503 break;}
2504case 184:
2505#line 1245 "pic.y"
2506{
2507 if (!lookup_variable(yyvsp[0].str, & yyval.x)) {
2508 lex_error("there is no variable `%1'", yyvsp[0].str);
2509 YYABORT;
2510 }
2511 delete yyvsp[0].str;
2512 ;
2513 break;}
2514case 185:
2515#line 1253 "pic.y"
2516{ yyval.x = yyvsp[0].x; ;
2517 break;}
2518case 186:
2519#line 1255 "pic.y"
2520{
2521 if (yyvsp[-1].pl.obj != 0)
2522 yyval.x = yyvsp[-1].pl.obj->origin().x;
2523 else
2524 yyval.x = yyvsp[-1].pl.x;
2525 ;
2526 break;}
2527case 187:
2528#line 1262 "pic.y"
2529{
2530 if (yyvsp[-1].pl.obj != 0)
2531 yyval.x = yyvsp[-1].pl.obj->origin().y;
2532 else
2533 yyval.x = yyvsp[-1].pl.y;
2534 ;
2535 break;}
2536case 188:
2537#line 1269 "pic.y"
2538{
2539 if (yyvsp[-1].pl.obj != 0)
2540 yyval.x = yyvsp[-1].pl.obj->height();
2541 else
2542 yyval.x = 0.0;
2543 ;
2544 break;}
2545case 189:
2546#line 1276 "pic.y"
2547{
2548 if (yyvsp[-1].pl.obj != 0)
2549 yyval.x = yyvsp[-1].pl.obj->width();
2550 else
2551 yyval.x = 0.0;
2552 ;
2553 break;}
2554case 190:
2555#line 1283 "pic.y"
2556{
2557 if (yyvsp[-1].pl.obj != 0)
2558 yyval.x = yyvsp[-1].pl.obj->radius();
2559 else
2560 yyval.x = 0.0;
2561 ;
2562 break;}
2563case 191:
2564#line 1290 "pic.y"
2565{ yyval.x = yyvsp[-2].x + yyvsp[0].x; ;
2566 break;}
2567case 192:
2568#line 1292 "pic.y"
2569{ yyval.x = yyvsp[-2].x - yyvsp[0].x; ;
2570 break;}
2571case 193:
2572#line 1294 "pic.y"
2573{ yyval.x = yyvsp[-2].x * yyvsp[0].x; ;
2574 break;}
2575case 194:
2576#line 1296 "pic.y"
2577{
2578 if (yyvsp[0].x == 0.0) {
2579 lex_error("division by zero");
2580 YYABORT;
2581 }
2582 yyval.x = yyvsp[-2].x/yyvsp[0].x;
2583 ;
2584 break;}
2585case 195:
2586#line 1304 "pic.y"
2587{
2588 if (yyvsp[0].x == 0.0) {
2589 lex_error("modulus by zero");
2590 YYABORT;
2591 }
2592 yyval.x = fmod(yyvsp[-2].x, yyvsp[0].x);
2593 ;
2594 break;}
2595case 196:
2596#line 1312 "pic.y"
2597{
2598 errno = 0;
2599 yyval.x = pow(yyvsp[-2].x, yyvsp[0].x);
2600 if (errno == EDOM) {
2601 lex_error("arguments to `^' operator out of domain");
2602 YYABORT;
2603 }
2604 if (errno == ERANGE) {
2605 lex_error("result of `^' operator out of range");
2606 YYABORT;
2607 }
2608 ;
2609 break;}
2610case 197:
2611#line 1325 "pic.y"
2612{ yyval.x = -yyvsp[0].x; ;
2613 break;}
2614case 198:
2615#line 1327 "pic.y"
2616{ yyval.x = yyvsp[-1].x; ;
2617 break;}
2618case 199:
2619#line 1329 "pic.y"
2620{
2621 errno = 0;
2622 yyval.x = sin(yyvsp[-1].x);
2623 if (errno == ERANGE) {
2624 lex_error("sin result out of range");
2625 YYABORT;
2626 }
2627 ;
2628 break;}
2629case 200:
2630#line 1338 "pic.y"
2631{
2632 errno = 0;
2633 yyval.x = cos(yyvsp[-1].x);
2634 if (errno == ERANGE) {
2635 lex_error("cos result out of range");
2636 YYABORT;
2637 }
2638 ;
2639 break;}
2640case 201:
2641#line 1347 "pic.y"
2642{
2643 errno = 0;
2644 yyval.x = atan2(yyvsp[-3].x, yyvsp[-1].x);
2645 if (errno == EDOM) {
2646 lex_error("atan2 argument out of domain");
2647 YYABORT;
2648 }
2649 if (errno == ERANGE) {
2650 lex_error("atan2 result out of range");
2651 YYABORT;
2652 }
2653 ;
2654 break;}
2655case 202:
2656#line 1360 "pic.y"
2657{
2658 errno = 0;
2659 yyval.x = log10(yyvsp[-1].x);
2660 if (errno == ERANGE) {
2661 lex_error("log result out of range");
2662 YYABORT;
2663 }
2664 ;
2665 break;}
2666case 203:
2667#line 1369 "pic.y"
2668{
2669 errno = 0;
2670 yyval.x = pow(10.0, yyvsp[-1].x);
2671 if (errno == ERANGE) {
2672 lex_error("exp result out of range");
2673 YYABORT;
2674 }
2675 ;
2676 break;}
2677case 204:
2678#line 1378 "pic.y"
2679{
2680 errno = 0;
2681 yyval.x = sqrt(yyvsp[-1].x);
2682 if (errno == EDOM) {
2683 lex_error("sqrt argument out of domain");
2684 YYABORT;
2685 }
2686 ;
2687 break;}
2688case 205:
2689#line 1387 "pic.y"
2690{ yyval.x = yyvsp[-3].x > yyvsp[-1].x ? yyvsp[-3].x : yyvsp[-1].x; ;
2691 break;}
2692case 206:
2693#line 1389 "pic.y"
2694{ yyval.x = yyvsp[-3].x > yyvsp[-1].x ? yyvsp[-3].x : yyvsp[-1].x; ;
2695 break;}
2696case 207:
2697#line 1391 "pic.y"
2698{ yyval.x = floor(yyvsp[-1].x); ;
2699 break;}
2700case 208:
2701#line 1393 "pic.y"
2702{ yyval.x = 1.0 + floor(((rand()&0x7fff)/double(0x7fff))*yyvsp[-1].x); ;
2703 break;}
2704case 209:
2705#line 1395 "pic.y"
2706{
2707 /* return a random number in the range [0,1) */
2708 /* portable, but not very random */
2709 yyval.x = (rand() & 0x7fff) / double(0x8000);
2710 ;
2711 break;}
2712case 210:
2713#line 1401 "pic.y"
2714{ yyval.x = (yyvsp[-2].x < yyvsp[0].x); ;
2715 break;}
2716case 211:
2717#line 1403 "pic.y"
2718{ yyval.x = (yyvsp[-2].x <= yyvsp[0].x); ;
2719 break;}
2720case 212:
2721#line 1405 "pic.y"
2722{ yyval.x = (yyvsp[-2].x > yyvsp[0].x); ;
2723 break;}
2724case 213:
2725#line 1407 "pic.y"
2726{ yyval.x = (yyvsp[-2].x >= yyvsp[0].x); ;
2727 break;}
2728case 214:
2729#line 1409 "pic.y"
2730{ yyval.x = (yyvsp[-2].x == yyvsp[0].x); ;
2731 break;}
2732case 215:
2733#line 1411 "pic.y"
2734{ yyval.x = (yyvsp[-2].x != yyvsp[0].x); ;
2735 break;}
2736case 216:
2737#line 1413 "pic.y"
2738{ yyval.x = (yyvsp[-2].x != 0.0 && yyvsp[0].x != 0.0); ;
2739 break;}
2740case 217:
2741#line 1415 "pic.y"
2742{ yyval.x = (yyvsp[-2].x != 0.0 || yyvsp[0].x != 0.0); ;
2743 break;}
2744case 218:
2745#line 1417 "pic.y"
2746{ yyval.x = (yyvsp[0].x == 0.0); ;
2747 break;}
2748}
2749 /* the action file gets copied in in place of this dollarsign */
2750#line 362 "/usr/local/lib/bison.simple"
2751\f
2752 yyvsp -= yylen;
2753 yyssp -= yylen;
2754#ifdef YYLSP_NEEDED
2755 yylsp -= yylen;
2756#endif
2757
2758#if YYDEBUG != 0
2759 if (yydebug)
2760 {
2761 short *ssp1 = yyss - 1;
2762 fprintf (stderr, "state stack now");
2763 while (ssp1 != yyssp)
2764 fprintf (stderr, " %d", *++ssp1);
2765 fprintf (stderr, "\n");
2766 }
2767#endif
2768
2769 *++yyvsp = yyval;
2770
2771#ifdef YYLSP_NEEDED
2772 yylsp++;
2773 if (yylen == 0)
2774 {
2775 yylsp->first_line = yylloc.first_line;
2776 yylsp->first_column = yylloc.first_column;
2777 yylsp->last_line = (yylsp-1)->last_line;
2778 yylsp->last_column = (yylsp-1)->last_column;
2779 yylsp->text = 0;
2780 }
2781 else
2782 {
2783 yylsp->last_line = (yylsp+yylen-1)->last_line;
2784 yylsp->last_column = (yylsp+yylen-1)->last_column;
2785 }
2786#endif
2787
2788 /* Now "shift" the result of the reduction.
2789 Determine what state that goes to,
2790 based on the state we popped back to
2791 and the rule number reduced by. */
2792
2793 yyn = yyr1[yyn];
2794
2795 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2796 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2797 yystate = yytable[yystate];
2798 else
2799 yystate = yydefgoto[yyn - YYNTBASE];
2800
2801 goto yynewstate;
2802
2803yyerrlab: /* here on detecting error */
2804
2805 if (! yyerrstatus)
2806 /* If not already recovering from an error, report this error. */
2807 {
2808 ++yynerrs;
2809
2810#ifdef YYERROR_VERBOSE
2811 yyn = yypact[yystate];
2812
2813 if (yyn > YYFLAG && yyn < YYLAST)
2814 {
2815 int size = 0;
2816 char *msg;
2817 int x, count;
2818
2819 count = 0;
2820 for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
2821 if (yycheck[x + yyn] == x)
2822 size += strlen(yytname[x]) + 15, count++;
2823 msg = (char *) xmalloc(size + 15);
2824 strcpy(msg, "parse error");
2825
2826 if (count < 5)
2827 {
2828 count = 0;
2829 for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
2830 if (yycheck[x + yyn] == x)
2831 {
2832 strcat(msg, count == 0 ? ", expecting `" : " or `");
2833 strcat(msg, yytname[x]);
2834 strcat(msg, "'");
2835 count++;
2836 }
2837 }
2838 yyerror(msg);
2839 free(msg);
2840 }
2841 else
2842#endif /* YYERROR_VERBOSE */
2843 yyerror("parse error");
2844 }
2845
2846yyerrlab1: /* here on error raised explicitly by an action */
2847
2848 if (yyerrstatus == 3)
2849 {
2850 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2851
2852 /* return failure if at end of input */
2853 if (yychar == YYEOF)
2854 YYABORT;
2855
2856#if YYDEBUG != 0
2857 if (yydebug)
2858 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2859#endif
2860
2861 yychar = YYEMPTY;
2862 }
2863
2864 /* Else will try to reuse lookahead token
2865 after shifting the error token. */
2866
2867 yyerrstatus = 3; /* Each real token shifted decrements this */
2868
2869 goto yyerrhandle;
2870
2871yyerrdefault: /* current state does not do anything special for the error token. */
2872
2873#if 0
2874 /* This is wrong; only states that explicitly want error tokens
2875 should shift them. */
2876 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2877 if (yyn) goto yydefault;
2878#endif
2879
2880yyerrpop: /* pop the current state because it cannot handle the error token */
2881
2882 if (yyssp == yyss) YYABORT;
2883 yyvsp--;
2884 yystate = *--yyssp;
2885#ifdef YYLSP_NEEDED
2886 yylsp--;
2887#endif
2888
2889#if YYDEBUG != 0
2890 if (yydebug)
2891 {
2892 short *ssp1 = yyss - 1;
2893 fprintf (stderr, "Error: state stack now");
2894 while (ssp1 != yyssp)
2895 fprintf (stderr, " %d", *++ssp1);
2896 fprintf (stderr, "\n");
2897 }
2898#endif
2899
2900yyerrhandle:
2901
2902 yyn = yypact[yystate];
2903 if (yyn == YYFLAG)
2904 goto yyerrdefault;
2905
2906 yyn += YYTERROR;
2907 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2908 goto yyerrdefault;
2909
2910 yyn = yytable[yyn];
2911 if (yyn < 0)
2912 {
2913 if (yyn == YYFLAG)
2914 goto yyerrpop;
2915 yyn = -yyn;
2916 goto yyreduce;
2917 }
2918 else if (yyn == 0)
2919 goto yyerrpop;
2920
2921 if (yyn == YYFINAL)
2922 YYACCEPT;
2923
2924#if YYDEBUG != 0
2925 if (yydebug)
2926 fprintf(stderr, "Shifting error token, ");
2927#endif
2928
2929 *++yyvsp = yylval;
2930#ifdef YYLSP_NEEDED
2931 *++yylsp = yylloc;
2932#endif
2933
2934 yystate = yyn;
2935 goto yynewstate;
2936}
2937#line 1421 "pic.y"
2938
2939
2940/* bison defines const to be empty unless __STDC__ is defined, which it
2941isn't under cfront */
2942
2943#ifdef const
2944#undef const
2945#endif
2946
2947static struct {
2948 const char *name;
2949 double val;
2950 int scaled; // non-zero if val should be multiplied by scale
2951} defaults_table[] = {
2952 "arcrad", .25, 1,
2953 "arrowht", .1, 1,
2954 "arrowwid", .05, 1,
2955 "circlerad", .25, 1,
2956 "boxht", .5, 1,
2957 "boxwid", .75, 1,
2958 "boxrad", 0.0, 1,
2959 "dashwid", .05, 1,
2960 "ellipseht", .5, 1,
2961 "ellipsewid", .75, 1,
2962 "moveht", .5, 1,
2963 "movewid", .5, 1,
2964 "lineht", .5, 1,
2965 "linewid", .5, 1,
2966 "textht", 0.0, 1,
2967 "textwid", 0.0, 1,
2968 "scale", 1.0, 0,
2969 "linethick", -1.0, 0, // in points
2970 "fillval", .5, 0,
2971 "arrowhead", 1.0, 0,
2972 "maxpswid", 8.5, 0,
2973 "maxpsht", 11.0, 0,
2974};
2975
2976place *lookup_label(const char *label)
2977{
2978 saved_state *state = current_saved_state;
2979 PTABLE(place) *tbl = current_table;
2980 for (;;) {
2981 place *pl = tbl->lookup(label);
2982 if (pl)
2983 return pl;
2984 if (!state)
2985 return 0;
2986 tbl = state->tbl;
2987 state = state->prev;
2988 }
2989}
2990
2991void define_label(const char *label, const place *pl)
2992{
2993 place *p = new place;
2994 *p = *pl;
2995 current_table->define(label, p);
2996}
2997
2998int lookup_variable(const char *name, double *val)
2999{
3000 place *pl = lookup_label(name);
3001 if (pl) {
3002 *val = pl->x;
3003 return 1;
3004 }
3005 return 0;
3006}
3007
3008void define_variable(const char *name, double val)
3009{
3010 place *p = new place;
3011 p->obj = 0;
3012 p->x = val;
3013 p->y = 0.0;
3014 current_table->define(name, p);
3015 if (strcmp(name, "scale") == 0) {
3016 // When the scale changes, reset all scaled pre-defined variables to
3017 // their default values.
3018 for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
3019 if (defaults_table[i].scaled)
3020 define_variable(defaults_table[i].name, val*defaults_table[i].val);
3021 }
3022}
3023
3024// called once only (not once per parse)
3025
3026void parse_init()
3027{
3028 current_direction = RIGHT_DIRECTION;
3029 current_position.x = 0.0;
3030 current_position.y = 0.0;
3031 // This resets everything to its default value.
3032 reset_all();
3033}
3034
3035void reset(const char *nm)
3036{
3037 for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
3038 if (strcmp(nm, defaults_table[i].name) == 0) {
3039 double val = defaults_table[i].val;
3040 if (defaults_table[i].scaled) {
3041 double scale;
3042 lookup_variable("scale", &scale);
3043 val *= scale;
3044 }
3045 define_variable(defaults_table[i].name, val);
3046 return;
3047 }
3048 lex_error("`%1' is not a predefined variable", nm);
3049}
3050
3051void reset_all()
3052{
3053 // We only have to explicitly reset the pre-defined variables that
3054 // aren't scaled because `scale' is not scaled, and changing the
3055 // value of `scale' will reset all the pre-defined variables that
3056 // are scaled.
3057 for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
3058 if (!defaults_table[i].scaled)
3059 define_variable(defaults_table[i].name, defaults_table[i].val);
3060}
3061
3062// called after each parse
3063
3064void parse_cleanup()
3065{
3066 while (current_saved_state != 0) {
3067 delete current_table;
3068 current_table = current_saved_state->tbl;
3069 saved_state *tem = current_saved_state;
3070 current_saved_state = current_saved_state->prev;
3071 delete tem;
3072 }
3073 assert(current_table == &top_table);
3074 PTABLE_ITERATOR(place) iter(current_table);
3075 const char *key;
3076 place *pl;
3077 while (iter.next(&key, &pl))
3078 if (pl->obj != 0) {
3079 position pos = pl->obj->origin();
3080 pl->obj = 0;
3081 pl->x = pos.x;
3082 pl->y = pos.y;
3083 }
3084 while (olist.head != 0) {
3085 object *tem = olist.head;
3086 olist.head = olist.head->next;
3087 delete tem;
3088 }
3089 olist.tail = 0;
3090 current_direction = RIGHT_DIRECTION;
3091 current_position.x = 0.0;
3092 current_position.y = 0.0;
3093}
3094
3095const char *ordinal_postfix(int n)
3096{
3097 if (n < 10 || n > 20)
3098 switch (n % 10) {
3099 case 1:
3100 return "st";
3101 case 2:
3102 return "nd";
3103 case 3:
3104 return "rd";
3105 }
3106 return "th";
3107}
3108
3109const char *object_type_name(object_type type)
3110{
3111 switch (type) {
3112 case BOX_OBJECT:
3113 return "box";
3114 case CIRCLE_OBJECT:
3115 return "circle";
3116 case ELLIPSE_OBJECT:
3117 return "ellipse";
3118 case ARC_OBJECT:
3119 return "arc";
3120 case SPLINE_OBJECT:
3121 return "spline";
3122 case LINE_OBJECT:
3123 return "line";
3124 case ARROW_OBJECT:
3125 return "arrow";
3126 case MOVE_OBJECT:
3127 return "move";
3128 case TEXT_OBJECT:
3129 return "\"\"";
3130 case BLOCK_OBJECT:
3131 return "[]";
3132 case OTHER_OBJECT:
3133 case MARK_OBJECT:
3134 default:
3135 break;
3136 }
3137 return "object";
3138}
3139
3140static char sprintf_buf[1024];
3141
3142char *format_number(const char *form, double n)
3143{
3144 if (form == 0)
3145 form = "%g";
3146 else {
3147 // this is a fairly feeble attempt at validation of the format
3148 int nspecs = 0;
3149 for (const char *p = form; *p != '\0'; p++)
3150 if (*p == '%') {
3151 if (p[1] == '%')
3152 p++;
3153 else
3154 nspecs++;
3155 }
3156 if (nspecs > 1) {
3157 lex_error("bad format `%1'", form);
3158 return strsave(form);
3159 }
3160 }
3161 sprintf(sprintf_buf, form, n);
3162 return strsave(sprintf_buf);
3163}
3164
3165char *do_sprintf(const char *form, const double *v, int nv)
3166{
3167 string result;
3168 int i = 0;
3169 string one_format;
3170 while (*form) {
3171 if (*form == '%') {
3172 one_format += *form++;
3173 for (; *form != '\0' && strchr("#-+ 0123456789.", *form) != 0; form++)
3174 one_format += *form;
3175 if (*form == '\0' || strchr("eEfgG%", *form) == 0) {
3176 lex_error("bad sprintf format");
3177 result += one_format;
3178 result += form;
3179 break;
3180 }
3181 if (*form == '%') {
3182 one_format += *form++;
3183 one_format += '\0';
3184 sprintf(sprintf_buf, one_format.contents());
3185 }
3186 else {
3187 if (i >= nv) {
3188 lex_error("too few arguments to sprintf");
3189 result += one_format;
3190 result += form;
3191 break;
3192 }
3193 one_format += *form++;
3194 one_format += '\0';
3195 sprintf(sprintf_buf, one_format.contents(), v[i++]);
3196 }
3197 one_format.clear();
3198 result += sprintf_buf;
3199 }
3200 else
3201 result += *form++;
3202 }
3203 result += '\0';
3204 return strsave(result.contents());
3205}