1
2 /* A Bison parser, made from layout_bison.y with Bison version GNU Bison version 1.24
3 */
4
5 #include "ac_config.h"
6
7 #define YYBISON 1 /* Identify Bison output. */
8
9 #define yyparse layout_parse
10 #define yylex layout_lex
11 #define yyerror layout_error
12 #define yylval layout_lval
13 #define yychar layout_char
14 #define yydebug layout_debug
15 #define yynerrs layout_nerrs
16 #define OC 258
17 #define CC 259
18 #define OA 260
19 #define CA 261
20 #define OP 262
21 #define CP 263
22 #define NAME 264
23 #define NUMBER 265
24 #define INFINITY 266
25 #define VERTICAL 267
26 #define HORIZONTAL 268
27 #define EQUAL 269
28 #define DOLLAR 270
29 #define PLUS 271
30 #define MINUS 272
31 #define TIMES 273
32 #define DIVIDE 274
33 #define PERCENTOF 275
34 #define PERCENT 276
35 #define WIDTH 277
36 #define HEIGHT 278
37 #define UMINUS 279
38 #define UPLUS 280
39
40 #ifndef YYLTYPE
41 typedef
42 struct yyltype
43 {
44 int timestamp;
45 int first_line;
46 int first_column;
47 int last_line;
48 int last_column;
49 char *text;
50 }
51 yyltype;
52
53 #define YYLTYPE yyltype
54 #endif
55
56 #include <stdio.h>
57 #include <stdlib.h>
58 #include "Aaa_intern.h"
59
60 #ifndef __cplusplus
61 #ifndef __STDC__
62 #define const
63 #endif
64 #endif
65
66
67
68 #define YYFINAL 68
69 #define YYFLAG -32768
70 #define YYNTBASE 26
71
72 #define YYTRANSLATE(x) ((unsigned)(x) <= 280 ? yytranslate[x] : 39)
73
74 static const char yytranslate[] = { 0,
75 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
76 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
77 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
89 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
91 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
94 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
96 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
101 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
102 16, 17, 18, 19, 20, 21, 22, 23, 24, 25
103 };
104
105 #if YYDEBUG != 0
106 static const short yyprhs[] = { 0,
107 0, 2, 5, 8, 12, 14, 19, 22, 24, 32,
108 33, 38, 39, 42, 43, 46, 47, 50, 52, 54,
109 57, 60, 62, 65, 68, 72, 75, 77, 80, 84,
110 88, 92, 96, 100, 103, 106, 108, 110
111 };
112
113 static const short yyrhs[] = { 28,
114 0, 9, 30, 0, 35, 31, 0, 9, 14, 35,
115 0, 28, 0, 38, 3, 29, 4, 0, 27, 29,
116 0, 27, 0, 5, 32, 33, 18, 32, 33, 6,
117 0, 0, 5, 32, 33, 6, 0, 0, 16, 34,
118 0, 0, 17, 34, 0, 0, 36, 11, 0, 36,
119 0, 11, 0, 17, 36, 0, 16, 36, 0, 36,
120 0, 22, 9, 0, 23, 9, 0, 7, 37, 8,
121 0, 36, 21, 0, 10, 0, 15, 9, 0, 37,
122 16, 37, 0, 37, 17, 37, 0, 37, 18, 37,
123 0, 37, 19, 37, 0, 37, 20, 37, 0, 17,
124 37, 0, 16, 37, 0, 36, 0, 12, 0, 13,
125 0
126 };
127
128 #endif
129
130 #if YYDEBUG != 0
131 static const short yyrline[] = { 0,
132 29, 32, 43, 54, 68, 73, 105, 110, 113, 124,
133 136, 147, 159, 161, 164, 166, 169, 171, 173, 176,
134 184, 186, 188, 194, 200, 202, 209, 215, 222, 231,
135 233, 235, 237, 239, 247, 249, 251, 253
136 };
137
138 static const char * const yytname[] = { "$","error","$undefined.","OC","CC",
139 "OA","CA","OP","CP","NAME","NUMBER","INFINITY","VERTICAL","HORIZONTAL","EQUAL",
140 "DOLLAR","PLUS","MINUS","TIMES","DIVIDE","PERCENTOF","PERCENT","WIDTH","HEIGHT",
141 "UMINUS","UPLUS","layout","box","compositebox","boxes","bothparams","oneparams",
142 "opStretch","opShrink","glue","signedExpr","simpleExpr","expr","orientation",
143 ""
144 };
145 #endif
146
147 static const short yyr1[] = { 0,
148 26, 27, 27, 27, 27, 28, 29, 29, 30, 30,
149 31, 31, 32, 32, 33, 33, 34, 34, 34, 35,
150 35, 35, 36, 36, 36, 36, 36, 36, 37, 37,
151 37, 37, 37, 37, 37, 37, 38, 38
152 };
153
154 static const short yyr2[] = { 0,
155 1, 2, 2, 3, 1, 4, 2, 1, 7, 0,
156 4, 0, 2, 0, 2, 0, 2, 1, 1, 2,
157 2, 1, 2, 2, 3, 2, 1, 2, 3, 3,
158 3, 3, 3, 2, 2, 1, 1, 1
159 };
160
161 static const short yydefact[] = { 0,
162 37, 38, 1, 0, 0, 0, 10, 27, 0, 0,
163 0, 0, 0, 8, 5, 0, 12, 22, 0, 0,
164 36, 0, 14, 0, 2, 28, 21, 20, 23, 24,
165 7, 6, 14, 3, 26, 35, 34, 25, 0, 0,
166 0, 0, 0, 0, 16, 4, 16, 29, 30, 31,
167 32, 33, 19, 13, 18, 0, 0, 0, 17, 15,
168 14, 11, 16, 0, 9, 0, 0, 0
169 };
170
171 static const short yydefgoto[] = { 66,
172 14, 15, 16, 25, 34, 45, 57, 54, 17, 21,
173 22, 4
174 };
175
176 static const short yypact[] = { -2,
177 -32768,-32768,-32768, 5, 21, 25, 7,-32768, 4, 43,
178 43, 6, 9, 21,-32768, 10, 11, 24, 25, 25,
179 24, 61, 36, 39,-32768,-32768, 24, 24,-32768,-32768,
180 -32768,-32768, 36,-32768,-32768,-32768,-32768,-32768, 25, 25,
181 25, 25, 25, 53, 40,-32768, 40, 52, 52,-32768,
182 -32768,-32768,-32768,-32768, -4, 53, 41, 67,-32768,-32768,
183 36,-32768, 40, 68,-32768, 27, 82,-32768
184 };
185
186 static const short yypgoto[] = {-32768,
187 -32768, 83, 70,-32768,-32768, -32, -43, 29, 62, -5,
188 -17,-32768
189 };
190
191
192 #define YYLAST 86
193
194
195 static const short yytable[] = { 18,
196 47, 36, 37, 58, 27, 28, 59, 5, 18, 1,
197 2, 23, 26, 32, 29, 33, 35, 30, 18, 64,
198 24, 48, 49, 50, 51, 52, 67, 6, 63, 7,
199 8, 6, 1, 2, 8, 9, 10, 11, 55, 9,
200 19, 20, 12, 13, 35, 6, 12, 13, 8, 6,
201 55, 44, 8, 9, 10, 11, 56, 9, 61, 6,
202 12, 13, 8, 53, 12, 13, 0, 9, 38, 41,
203 42, 43, 62, 65, 12, 13, 39, 40, 41, 42,
204 43, 68, 3, 31, 60, 46
205 };
206
207 static const short yycheck[] = { 5,
208 33, 19, 20, 47, 10, 11, 11, 3, 14, 12,
209 13, 5, 9, 4, 9, 5, 21, 9, 24, 63,
210 14, 39, 40, 41, 42, 43, 0, 7, 61, 9,
211 10, 7, 12, 13, 10, 15, 16, 17, 44, 15,
212 16, 17, 22, 23, 21, 7, 22, 23, 10, 7,
213 56, 16, 10, 15, 16, 17, 17, 15, 18, 7,
214 22, 23, 10, 11, 22, 23, -1, 15, 8, 18,
215 19, 20, 6, 6, 22, 23, 16, 17, 18, 19,
216 20, 0, 0, 14, 56, 24
217 };
218 #define YYPURE 1
219
220 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
221
222
223 /* Skeleton output parser for bison,
224 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
225
226 This program is free software; you can redistribute it and/or modify
227 it under the terms of the GNU General Public License as published by
228 the Free Software Foundation; either version 3, or (at your option)
229 any later version.
230
231 This program is distributed in the hope that it will be useful,
232 but WITHOUT ANY WARRANTY; without even the implied warranty of
233 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
234 GNU General Public License for more details.
235
236 You should have received a copy of the GNU General Public License
237 along with this program; if not, write to the Free Software
238 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
239
240 /* As a special exception, when this file is copied by Bison into a
241 Bison output file, you may use that output file without restriction.
242 This special exception was added by the Free Software Foundation
243 in version 1.24 of Bison. */
244
245 #ifndef alloca
246 #ifdef __GNUC__
247 #define alloca __builtin_alloca
248 #else /* not GNU C. */
249 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
250 #include <alloca.h>
251 #else /* not sparc */
252 #if defined (MSDOS) && !defined (__TURBOC__)
253 #include <malloc.h>
254 #else /* not MSDOS, or __TURBOC__ */
255 #if defined(_AIX)
256 #include <malloc.h>
257 #pragma alloca
258 #else /* not MSDOS, __TURBOC__, or _AIX */
259 #ifdef __hpux
260 #ifdef __cplusplus
261 extern "C" {
262 void *alloca (unsigned int);
263 };
264 #else /* not __cplusplus */
265 void *alloca ();
266 #endif /* not __cplusplus */
267 #endif /* __hpux */
268 #endif /* not _AIX */
269 #endif /* not MSDOS, or __TURBOC__ */
270 #endif /* not sparc. */
271 #endif /* not GNU C. */
272 #endif /* alloca not defined. */
273
274 /* This is the parser code that is written into each bison parser
275 when the %semantic_parser declaration is not specified in the grammar.
276 It was written by Richard Stallman by simplifying the hairy parser
277 used when %semantic_parser is specified. */
278
279 /* Note: there must be only one dollar sign in this file.
280 It is replaced by the list of actions, each action
281 as one case of the switch. */
282
283 #define yyerrok (yyerrstatus = 0)
284 #define yyclearin (yychar = YYEMPTY)
285 #define YYEMPTY -2
286 #define YYEOF 0
287 #define YYACCEPT return(0)
288 #define YYABORT return(1)
289 #define YYERROR goto yyerrlab1
290 /* Like YYERROR except do call yyerror.
291 This remains here temporarily to ease the
292 transition to the new meaning of YYERROR, for GCC.
293 Once GCC version 3 has supplanted version 1, this can go. */
294 #define YYFAIL goto yyerrlab
295 #define YYRECOVERING() (!!yyerrstatus)
296 #define YYBACKUP(token, value) \
297 do \
298 if (yychar == YYEMPTY && yylen == 1) \
299 { yychar = (token), yylval = (value); \
300 yychar1 = YYTRANSLATE (yychar); \
301 YYPOPSTACK; \
302 goto yybackup; \
303 } \
304 else \
305 { yyerror ("syntax error: cannot back up"); YYERROR; } \
306 while (0)
307
308 #define YYTERROR 1
309 #define YYERRCODE 256
310
311 #ifndef YYPURE
312 #define YYLEX yylex()
313 #endif
314
315 #ifdef YYPURE
316 #ifdef YYLSP_NEEDED
317 #ifdef YYLEX_PARAM
318 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
319 #else
320 #define YYLEX yylex(&yylval, &yylloc)
321 #endif
322 #else /* not YYLSP_NEEDED */
323 #ifdef YYLEX_PARAM
324 #define YYLEX yylex(&yylval, YYLEX_PARAM)
325 #else
326 #define YYLEX yylex(&yylval)
327 #endif
328 #endif /* not YYLSP_NEEDED */
329 #endif
330
331 /* If nonreentrant, generate the variables here */
332
333 #ifndef YYPURE
334
335 int yychar; /* the lookahead symbol */
336 YYSTYPE yylval; /* the semantic value of the */
337 /* lookahead symbol */
338
339 #ifdef YYLSP_NEEDED
340 YYLTYPE yylloc; /* location data for the lookahead */
341 /* symbol */
342 #endif
343
344 int yynerrs; /* number of parse errors so far */
345 #endif /* not YYPURE */
346
347 #if YYDEBUG != 0
348 int yydebug; /* nonzero means print parse trace */
349 /* Since this is uninitialized, it does not stop multiple parsers
350 from coexisting. */
351 #endif
352
353 /* YYINITDEPTH indicates the initial size of the parser's stacks */
354
355 #ifndef YYINITDEPTH
356 #define YYINITDEPTH 200
357 #endif
358
359 /* YYMAXDEPTH is the maximum size the stacks can grow to
360 (effective only if the built-in stack extension method is used). */
361
362 #if YYMAXDEPTH == 0
363 #undef YYMAXDEPTH
364 #endif
365
366 #ifndef YYMAXDEPTH
367 #define YYMAXDEPTH 10000
368 #endif
369
370 /* Prevent warning if -Wstrict-prototypes. */
371 #ifdef __GNUC__
372 /*###jp###*/
373 int yyparse (void*);
374 #endif
375
376 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
377 #define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
378 #else /* not GNU C or C++ */
379 #ifndef __cplusplus
380
381 /* This is the most reliable way to avoid incompatibilities
382 in available built-in functions on various systems. */
383 static void
__yy_memcpy(from,to,count)384 __yy_memcpy (from, to, count)
385 char *from;
386 char *to;
387 int count;
388 {
389 register char *f = from;
390 register char *t = to;
391 register int i = count;
392
393 while (i-- > 0)
394 *t++ = *f++;
395 }
396
397 #else /* __cplusplus */
398
399 /* This is the most reliable way to avoid incompatibilities
400 in available built-in functions on various systems. */
401 static void
__yy_memcpy(char * from,char * to,int count)402 __yy_memcpy (char *from, char *to, int count)
403 {
404 register char *f = from;
405 register char *t = to;
406 register int i = count;
407
408 while (i-- > 0)
409 *t++ = *f++;
410 }
411
412 #endif
413 #endif
414
415
416
417 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
418 into yyparse. The argument should have type void *.
419 It should actually point to an object.
420 Grammar actions can access the variable by casting it
421 to the proper pointer type. */
422
423 #ifdef YYPARSE_PARAM
424 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
425 #else
426 #define YYPARSE_PARAM
427 #define YYPARSE_PARAM_DECL
428 #endif
429
430 int
yyparse(YYPARSE_PARAM)431 yyparse(YYPARSE_PARAM)
432 YYPARSE_PARAM_DECL
433 {
434 register int yystate;
435 register int yyn;
436 register short *yyssp;
437 register YYSTYPE *yyvsp;
438 int yyerrstatus; /* number of tokens to shift before error messages enabled */
439 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
440
441 short yyssa[YYINITDEPTH]; /* the state stack */
442 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
443
444 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
445 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
446
447 #ifdef YYLSP_NEEDED
448 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
449 YYLTYPE *yyls = yylsa;
450 YYLTYPE *yylsp;
451
452 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
453 #else
454 #define YYPOPSTACK (yyvsp--, yyssp--)
455 #endif
456
457 int yystacksize = YYINITDEPTH;
458
459 #ifdef YYPURE
460 int yychar;
461 YYSTYPE yylval;
462 int yynerrs;
463 #ifdef YYLSP_NEEDED
464 YYLTYPE yylloc;
465 #endif
466 #endif
467
468 YYSTYPE yyval; /* the variable used to return */
469 /* semantic values from the action */
470 /* routines */
471
472 int yylen;
473
474 #if YYDEBUG != 0
475 if (yydebug)
476 fprintf(stderr, "Starting parse\n");
477 #endif
478
479 yystate = 0;
480 yyerrstatus = 0;
481 yynerrs = 0;
482 yychar = YYEMPTY; /* Cause a token to be read. */
483
484 /* Initialize stack pointers.
485 Waste one element of value and location stack
486 so that they stay on the same level as the state stack.
487 The wasted elements are never initialized. */
488
489 yyssp = yyss - 1;
490 yyvsp = yyvs;
491 #ifdef YYLSP_NEEDED
492 yylsp = yyls;
493 #endif
494
495 /* Push a new state, which is found in yystate . */
496 /* In all cases, when you get here, the value and location stacks
497 have just been pushed. so pushing a state here evens the stacks. */
498 yynewstate:
499
500 *++yyssp = yystate;
501 /*
502 printf("---%d\n",(yyssp - yyss + 1));
503 */
504 if (yyssp >= yyss + yystacksize - 1)
505 {
506 /* Give user a chance to reallocate the stack */
507 /* Use copies of these so that the &'s don't force the real ones into memory. */
508 YYSTYPE *yyvs1 = yyvs;
509 short *yyss1 = yyss;
510 #ifdef YYLSP_NEEDED
511 YYLTYPE *yyls1 = yyls;
512 #endif
513
514 /* Get the current used size of the three stacks, in elements. */
515 int size = yyssp - yyss + 1;
516
517 #ifdef yyoverflow
518 /* Each stack pointer address is followed by the size of
519 the data in use in that stack, in bytes. */
520 #ifdef YYLSP_NEEDED
521 /* This used to be a conditional around just the two extra args,
522 but that might be undefined if yyoverflow is a macro. */
523 yyoverflow("parser stack overflow",
524 &yyss1, size * sizeof (*yyssp),
525 &yyvs1, size * sizeof (*yyvsp),
526 &yyls1, size * sizeof (*yylsp),
527 &yystacksize);
528 #else
529 yyoverflow("parser stack overflow",
530 &yyss1, size * sizeof (*yyssp),
531 &yyvs1, size * sizeof (*yyvsp),
532 &yystacksize);
533 #endif
534
535 yyss = yyss1; yyvs = yyvs1;
536 #ifdef YYLSP_NEEDED
537 yyls = yyls1;
538 #endif
539 #else /* no yyoverflow */
540 /* Extend the stack our own way. */
541 if (yystacksize >= YYMAXDEPTH)
542 {
543 yyerror("parser stack overflow");
544 return 2;
545 }
546 yystacksize *= 2;
547 if (yystacksize > YYMAXDEPTH)
548 yystacksize = YYMAXDEPTH;
549 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
550 __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
551 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
552 __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
553 #ifdef YYLSP_NEEDED
554 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
555 __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
556 #endif
557 #endif /* no yyoverflow */
558
559 yyssp = yyss + size - 1;
560 yyvsp = yyvs + size - 1;
561 #ifdef YYLSP_NEEDED
562 yylsp = yyls + size - 1;
563 #endif
564
565 #if YYDEBUG != 0
566 if (yydebug)
567 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
568 #endif
569
570 if (yyssp >= yyss + yystacksize - 1)
571 YYABORT;
572 }
573
574 #if YYDEBUG != 0
575 if (yydebug)
576 fprintf(stderr, "Entering state %d\n", yystate);
577 #endif
578
579 goto yybackup;
580 yybackup:
581
582 /* Do appropriate processing given the current state. */
583 /* Read a lookahead token if we need one and don't already have one. */
584 /* yyresume: */
585
586 /* First try to decide what to do without reference to lookahead token. */
587
588 yyn = yypact[yystate];
589 if (yyn == YYFLAG)
590 goto yydefault;
591
592 /* Not known => get a lookahead token if don't already have one. */
593
594 /* yychar is either YYEMPTY or YYEOF
595 or a valid token in external form. */
596
597 if (yychar == YYEMPTY)
598 {
599 #if YYDEBUG != 0
600 if (yydebug)
601 fprintf(stderr, "Reading a token: ");
602 #endif
603 yychar = YYLEX;
604 }
605
606 /* Convert token to internal form (in yychar1) for indexing tables with */
607
608 if (yychar <= 0) /* This means end of input. */
609 {
610 yychar1 = 0;
611 yychar = YYEOF; /* Don't call YYLEX any more */
612
613 #if YYDEBUG != 0
614 if (yydebug)
615 fprintf(stderr, "Now at end of input.\n");
616 #endif
617 }
618 else
619 {
620 yychar1 = YYTRANSLATE(yychar);
621
622 #if YYDEBUG != 0
623 if (yydebug)
624 {
625 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
626 /* Give the individual parser a way to print the precise meaning
627 of a token, for further debugging info. */
628 #ifdef YYPRINT
629 YYPRINT (stderr, yychar, yylval);
630 #endif
631 fprintf (stderr, ")\n");
632 }
633 #endif
634 }
635
636 yyn += yychar1;
637 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
638 goto yydefault;
639
640 yyn = yytable[yyn];
641
642 /* yyn is what to do for this token type in this state.
643 Negative => reduce, -yyn is rule number.
644 Positive => shift, yyn is new state.
645 New state is final state => don't bother to shift,
646 just return success.
647 0, or most negative number => error. */
648
649 if (yyn < 0)
650 {
651 if (yyn == YYFLAG)
652 goto yyerrlab;
653 yyn = -yyn;
654 goto yyreduce;
655 }
656 else if (yyn == 0)
657 goto yyerrlab;
658
659 if (yyn == YYFINAL)
660 YYACCEPT;
661
662 /* Shift the lookahead token. */
663
664 #if YYDEBUG != 0
665 if (yydebug)
666 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
667 #endif
668
669 /* Discard the token being shifted unless it is eof. */
670 if (yychar != YYEOF)
671 yychar = YYEMPTY;
672
673 *++yyvsp = yylval;
674 #ifdef YYLSP_NEEDED
675 *++yylsp = yylloc;
676 #endif
677
678 /* count tokens shifted since error; after three, turn off error status. */
679 if (yyerrstatus) yyerrstatus--;
680
681 yystate = yyn;
682 goto yynewstate;
683
684 /* Do the default action for the current state. */
685 yydefault:
686
687 yyn = yydefact[yystate];
688 if (yyn == 0)
689 goto yyerrlab;
690
691 /* Do a reduction. yyn is the number of a rule to reduce with. */
692 yyreduce:
693 yylen = yyr2[yyn];
694 if (yylen > 0)
695 yyval = yyvsp[1-yylen]; /* implement default value of the action */
696
697 #if YYDEBUG != 0
698 if (yydebug)
699 {
700 int i;
701
702 fprintf (stderr, "Reducing via rule %d (line %d), ",
703 yyn, yyrline[yyn]);
704
705 /* Print the symbols being reduced, and their result. */
706 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
707 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
708 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
709 }
710 #endif
711
712
713 switch (yyn) {
714
715 case 1:
716 { *(((LayoutConverterArg)layoutConverterArg)->to) = (LayoutPtr) yyvsp[0].bval; ;
717 break;}
718 case 2:
719 {
720 BoxPtr box = New(LBoxRec);
721 MEMMESSAGE(WidgetBox)
722 box->nextSibling = 0;
723 box->type = WidgetBox;
724 box->params = *yyvsp[0].pval;
725 Dispose (yyvsp[0].pval);
726 box->u.widget.quark = yyvsp[-1].qval;
727 yyval.bval = box;
728 ;
729 break;}
730 case 3:
731 {
732 BoxPtr box = New(LBoxRec);
733 MEMMESSAGE(GlueBox)
734 box->nextSibling = 0;
735 box->type = GlueBox;
736 box->params = *yyvsp[0].pval;
737 Dispose (yyvsp[0].pval);
738 box->u.glue.expr = yyvsp[-1].eval;
739 yyval.bval = box;
740 ;
741 break;}
742 case 4:
743 {
744 BoxPtr box = New(LBoxRec);
745 MEMMESSAGE(VariableBox)
746 box->nextSibling = 0;
747 box->type = VariableBox;
748 box->u.variable.quark = yyvsp[-2].qval;
749 box->u.variable.expr = yyvsp[0].eval;
750 ZeroGlue (box->params.stretch[LayoutHorizontal]); /*###jp###*/
751 ZeroGlue (box->params.shrink[LayoutHorizontal]); /*###jp###*/
752 ZeroGlue (box->params.stretch[LayoutVertical]); /*###jp###*/
753 ZeroGlue (box->params.shrink[LayoutVertical]); /*###jp###*/
754 yyval.bval = box;
755 ;
756 break;}
757 case 5:
758 {
759 yyval.bval = yyvsp[0].bval;
760 ;
761 break;}
762 case 6:
763 {
764 BoxPtr box = New(LBoxRec);
765 BoxPtr child;
766
767 MEMMESSAGE(BoxBox)
768 box->nextSibling = 0;
769 box->parent = 0;
770 box->type = BoxBox;
771 box->u.box.dir = yyvsp[-3].lval;
772 box->u.box.firstChild = yyvsp[-1].bval;
773 ZeroGlue (box->params.stretch[LayoutHorizontal]); /*###jp###*/
774 ZeroGlue (box->params.shrink[LayoutHorizontal]); /*###jp###*/
775 ZeroGlue (box->params.stretch[LayoutVertical]); /*###jp###*/
776 ZeroGlue (box->params.shrink[LayoutVertical]); /*###jp###*/
777
778 for (child = yyvsp[-1].bval; child; child = child->nextSibling)
779 {
780 if (child->type == GlueBox)
781 {
782 child->params.stretch[!yyvsp[-3].lval].expr = 0;
783 child->params.shrink[!yyvsp[-3].lval].expr = 0;
784 child->params.stretch[!yyvsp[-3].lval].order = 100000;
785 child->params.shrink[!yyvsp[-3].lval].order = 100000;
786 child->params.stretch[!yyvsp[-3].lval].value = 1;
787 child->params.shrink[!yyvsp[-3].lval].value = 1;
788 }
789 child->parent = box;
790 }
791 yyval.bval = box;
792 ;
793 break;}
794 case 7:
795 {
796 yyvsp[-1].bval->nextSibling = yyvsp[0].bval;
797 yyval.bval = yyvsp[-1].bval;
798 ;
799 break;}
800 case 8:
801 { yyval.bval = yyvsp[0].bval; ;
802 break;}
803 case 9:
804 {
805 BoxParamsPtr p = New(BoxParamsRec);
806
807 MEMMESSAGE(BoxParamsRec)
808 p->stretch[LayoutHorizontal] = yyvsp[-5].gval;
809 p->shrink[LayoutHorizontal] = yyvsp[-4].gval;
810 p->stretch[LayoutVertical] = yyvsp[-2].gval;
811 p->shrink[LayoutVertical] = yyvsp[-1].gval;
812 yyval.pval = p;
813 ;
814 break;}
815 case 10:
816 {
817 BoxParamsPtr p = New(BoxParamsRec);
818
819 MEMMESSAGE(BoxParamsRec)
820 ZeroGlue (p->stretch[LayoutHorizontal]);
821 ZeroGlue (p->shrink[LayoutHorizontal]);
822 ZeroGlue (p->stretch[LayoutVertical]);
823 ZeroGlue (p->shrink[LayoutVertical]);
824 yyval.pval = p;
825 ;
826 break;}
827 case 11:
828 {
829 BoxParamsPtr p = New(BoxParamsRec);
830
831 MEMMESSAGE(BoxParamsRec)
832 p->stretch[LayoutHorizontal] = yyvsp[-2].gval;
833 p->shrink[LayoutHorizontal] = yyvsp[-1].gval;
834 p->stretch[LayoutVertical] = yyvsp[-2].gval;
835 p->shrink[LayoutVertical] = yyvsp[-1].gval;
836 yyval.pval = p;
837 ;
838 break;}
839 case 12:
840 {
841 BoxParamsPtr p = New(BoxParamsRec);
842
843 MEMMESSAGE(BoxParamsRec)
844 ZeroGlue (p->stretch[LayoutHorizontal]);
845 ZeroGlue (p->shrink[LayoutHorizontal]);
846 ZeroGlue (p->stretch[LayoutVertical]);
847 ZeroGlue (p->shrink[LayoutVertical]);
848 yyval.pval = p;
849 ;
850 break;}
851 case 13:
852 { yyval.gval = yyvsp[0].gval; ;
853 break;}
854 case 14:
855 { ZeroGlue (yyval.gval); ;
856 break;}
857 case 15:
858 { yyval.gval = yyvsp[0].gval; ;
859 break;}
860 case 16:
861 { ZeroGlue (yyval.gval); ;
862 break;}
863 case 17:
864 { yyval.gval.order = yyvsp[0].ival; yyval.gval.expr = yyvsp[-1].eval; ;
865 break;}
866 case 18:
867 { yyval.gval.order = 0; yyval.gval.expr = yyvsp[0].eval; ;
868 break;}
869 case 19:
870 { yyval.gval.order = yyvsp[0].ival; yyval.gval.expr = 0; yyval.gval.value = 1; ;
871 break;}
872 case 20:
873 {
874 yyval.eval = New(ExprRec);
875 MEMMESSAGE(ExprRec)
876 yyval.eval->type = Unary;
877 yyval.eval->u.unary.op = yyvsp[-1].oval;
878 yyval.eval->u.unary.down = yyvsp[0].eval;
879 ;
880 break;}
881 case 21:
882 { yyval.eval = yyvsp[0].eval; ;
883 break;}
884 case 23:
885 { yyval.eval = New(ExprRec);
886 MEMMESSAGE(Width)
887 yyval.eval->type = Width;
888 yyval.eval->u.width = yyvsp[0].qval;
889 ;
890 break;}
891 case 24:
892 { yyval.eval = New(ExprRec);
893 MEMMESSAGE(Height)
894 yyval.eval->type = Height;
895 yyval.eval->u.height = yyvsp[0].qval;
896 ;
897 break;}
898 case 25:
899 { yyval.eval = yyvsp[-1].eval; ;
900 break;}
901 case 26:
902 {
903 yyval.eval = New(ExprRec);
904 yyval.eval->type = Unary;
905 yyval.eval->u.unary.op = yyvsp[0].oval;
906 yyval.eval->u.unary.down = yyvsp[-1].eval;
907 ;
908 break;}
909 case 27:
910 { yyval.eval = New(ExprRec);
911 MEMMESSAGE(Constant)
912 yyval.eval->type = Constant;
913 yyval.eval->u.constant = yyvsp[0].ival;
914 ;
915 break;}
916 case 28:
917 { yyval.eval = New(ExprRec);
918 MEMMESSAGE(Variable)
919 yyval.eval->type = Variable;
920 yyval.eval->u.variable = yyvsp[0].qval;
921 ;
922 break;}
923 case 29:
924 { binary: ;
925 yyval.eval = New(ExprRec);
926 MEMMESSAGE(Binary)
927 yyval.eval->type = Binary;
928 yyval.eval->u.binary.op = yyvsp[-1].oval;
929 yyval.eval->u.binary.left = yyvsp[-2].eval;
930 yyval.eval->u.binary.right = yyvsp[0].eval;
931 ;
932 break;}
933 case 30:
934 { goto binary; ;
935 break;}
936 case 31:
937 { goto binary; ;
938 break;}
939 case 32:
940 { goto binary; ;
941 break;}
942 case 33:
943 { goto binary; ;
944 break;}
945 case 34:
946 { /* unary: ; ###jp###*/
947 yyval.eval = New(ExprRec);
948 MEMMESSAGE(Unary)
949 yyval.eval->type = Unary;
950 yyval.eval->u.unary.op = yyvsp[-1].oval;
951 yyval.eval->u.unary.down = yyvsp[0].eval;
952 ;
953 break;}
954 case 35:
955 { yyval.eval = yyvsp[0].eval; ;
956 break;}
957 case 37:
958 { yyval.lval = LayoutVertical; ;
959 break;}
960 case 38:
961 { yyval.lval = LayoutHorizontal; ;
962 break;}
963 }
964 /* the action file gets copied in in place of this dollarsign */
965
966
967 yyvsp -= yylen;
968 yyssp -= yylen;
969 #ifdef YYLSP_NEEDED
970 yylsp -= yylen;
971 #endif
972
973 #if YYDEBUG != 0
974 if (yydebug)
975 {
976 short *ssp1 = yyss - 1;
977 fprintf (stderr, "state stack now");
978 while (ssp1 != yyssp)
979 fprintf (stderr, " %d", *++ssp1);
980 fprintf (stderr, "\n");
981 }
982 #endif
983
984 *++yyvsp = yyval;
985
986 #ifdef YYLSP_NEEDED
987 yylsp++;
988 if (yylen == 0)
989 {
990 yylsp->first_line = yylloc.first_line;
991 yylsp->first_column = yylloc.first_column;
992 yylsp->last_line = (yylsp-1)->last_line;
993 yylsp->last_column = (yylsp-1)->last_column;
994 yylsp->text = 0;
995 }
996 else
997 {
998 yylsp->last_line = (yylsp+yylen-1)->last_line;
999 yylsp->last_column = (yylsp+yylen-1)->last_column;
1000 }
1001 #endif
1002
1003 /* Now "shift" the result of the reduction.
1004 Determine what state that goes to,
1005 based on the state we popped back to
1006 and the rule number reduced by. */
1007
1008 yyn = yyr1[yyn];
1009
1010 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1011 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1012 yystate = yytable[yystate];
1013 else
1014 yystate = yydefgoto[yyn - YYNTBASE];
1015
1016 goto yynewstate;
1017
1018 yyerrlab: /* here on detecting error */
1019
1020 if (! yyerrstatus)
1021 /* If not already recovering from an error, report this error. */
1022 {
1023 ++yynerrs;
1024
1025 #ifdef YYERROR_VERBOSE
1026 yyn = yypact[yystate];
1027
1028 if (yyn > YYFLAG && yyn < YYLAST)
1029 {
1030 int size = 0;
1031 char *msg;
1032 int x, count;
1033
1034 count = 0;
1035 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1036 for (x = (yyn < 0 ? -yyn : 0);
1037 x < (sizeof(yytname) / sizeof(char *)); x++)
1038 if (yycheck[x + yyn] == x)
1039 size += strlen(yytname[x]) + 15, count++;
1040 msg = (char *) malloc(size + 15);
1041 if (msg != 0)
1042 {
1043 strcpy(msg, "parse error");
1044
1045 if (count < 5)
1046 {
1047 count = 0;
1048 for (x = (yyn < 0 ? -yyn : 0);
1049 x < (sizeof(yytname) / sizeof(char *)); x++)
1050 if (yycheck[x + yyn] == x)
1051 {
1052 strcat(msg, count == 0 ? ", expecting `" : " or `");
1053 strcat(msg, yytname[x]);
1054 strcat(msg, "'");
1055 count++;
1056 }
1057 }
1058 yyerror(msg);
1059 free(msg);
1060 }
1061 else
1062 yyerror ("parse error; also virtual memory exceeded");
1063 }
1064 else
1065 #endif /* YYERROR_VERBOSE */
1066 yyerror("parse error");
1067 }
1068
1069 goto yyerrlab1;
1070 yyerrlab1: /* here on error raised explicitly by an action */
1071
1072 if (yyerrstatus == 3)
1073 {
1074 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1075
1076 /* return failure if at end of input */
1077 if (yychar == YYEOF)
1078 YYABORT;
1079
1080 #if YYDEBUG != 0
1081 if (yydebug)
1082 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1083 #endif
1084
1085 yychar = YYEMPTY;
1086 }
1087
1088 /* Else will try to reuse lookahead token
1089 after shifting the error token. */
1090
1091 yyerrstatus = 3; /* Each real token shifted decrements this */
1092
1093 goto yyerrhandle;
1094
1095 yyerrdefault: /* current state does not do anything special for the error token. */
1096
1097 #if 0
1098 /* This is wrong; only states that explicitly want error tokens
1099 should shift them. */
1100 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1101 if (yyn) goto yydefault;
1102 #endif
1103
1104 yyerrpop: /* pop the current state because it cannot handle the error token */
1105
1106 if (yyssp == yyss) YYABORT;
1107 yyvsp--;
1108 yystate = *--yyssp;
1109 #ifdef YYLSP_NEEDED
1110 yylsp--;
1111 #endif
1112
1113 #if YYDEBUG != 0
1114 if (yydebug)
1115 {
1116 short *ssp1 = yyss - 1;
1117 fprintf (stderr, "Error: state stack now");
1118 while (ssp1 != yyssp)
1119 fprintf (stderr, " %d", *++ssp1);
1120 fprintf (stderr, "\n");
1121 }
1122 #endif
1123
1124 yyerrhandle:
1125
1126 yyn = yypact[yystate];
1127 if (yyn == YYFLAG)
1128 goto yyerrdefault;
1129
1130 yyn += YYTERROR;
1131 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1132 goto yyerrdefault;
1133
1134 yyn = yytable[yyn];
1135 if (yyn < 0)
1136 {
1137 if (yyn == YYFLAG)
1138 goto yyerrpop;
1139 yyn = -yyn;
1140 goto yyreduce;
1141 }
1142 else if (yyn == 0)
1143 goto yyerrpop;
1144
1145 if (yyn == YYFINAL)
1146 YYACCEPT;
1147
1148 #if YYDEBUG != 0
1149 if (yydebug)
1150 fprintf(stderr, "Shifting error token, ");
1151 #endif
1152
1153 *++yyvsp = yylval;
1154 #ifdef YYLSP_NEEDED
1155 *++yylsp = yylloc;
1156 #endif
1157
1158 yystate = yyn;
1159 goto yynewstate;
1160 }
1161
1162