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