]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/deprecated/dosyacc.c
Applied patch [ 795491 ] Multimon sample compatibility with various conditions
[wxWidgets.git] / contrib / src / deprecated / dosyacc.c
CommitLineData
4a3bdee6
JS
1/* include platform.h first to get __WIN32__ definition */
2#include "wx/platform.h"
4a3bdee6 3#include "wx/setup.h"
c6dafd93 4#include "wx/deprecated/setup.h"
4a3bdee6
JS
5
6#if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
7
8#ifndef lint
9static char yysccsid[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
10#endif
11#define YYBYACC 1
12#line 2 "parser.y"
13#include "string.h"
14#if defined(_MSC_VER) || defined(__VISAGECPP__)
15#include <io.h>
16#endif
17#include "wx/deprecated/expr.h"
18
19#ifndef __EXTERN_C__
20#define __EXTERN_C__ 1
21#endif
22
23#if defined(__cplusplus) || defined(__STDC__)
24#if defined(__cplusplus) && defined(__EXTERN_C__)
25extern "C" {
26#endif
27#endif
28int yylex(void);
29int yylook(void);
30int yywrap(void);
31int yyback(int *, int);
32
33/* You may need to put /DLEX_SCANNER in your makefile
34 * if you're using LEX!
35 */
36#ifdef LEX_SCANNER
37/* int yyoutput(int); */
38void yyoutput(int);
39#else
40void yyoutput(int);
41#endif
42
43#if defined(__cplusplus) || defined(__STDC__)
44#if defined(__cplusplus) && defined(__EXTERN_C__)
45}
46#endif
47#endif
48#line 36 "parser.y"
49typedef union {
50 char *s;
51/* struct pexpr *expr; */
52} YYSTYPE;
53#line 44 "y_tab.c"
54#define INTEGER 1
55#define WORD 2
56#define STRING 3
57#define PERIOD 13
58#define OPEN 4
59#define CLOSE 5
60#define COMMA 6
61#define NEWLINE 7
62#define ERROR 8
63#define OPEN_SQUARE 9
64#define CLOSE_SQUARE 10
65#define EQUALS 11
66#define EXP 14
67#define YYERRCODE 256
68short yylhs[] = { -1,
69 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
70 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
71};
72short yylen[] = { 2,
73 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
74 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
75};
76short yydefred[] = { 1,
77 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
78 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
79 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
80 0, 19,
81};
82short yydgoto[] = { 1,
83 5, 14, 15, 16, 17,
84};
85short yysindex[] = { 0,
86 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
87 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
88 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
89 44, 0,
90};
91short yyrindex[] = { 0,
92 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
93 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
94 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
95 0, 0,
96};
97short yygindex[] = { 0,
98 0, 45, -8, 0, 26,
99};
100#define YYTABLESIZE 254
101short yytable[] = { 3,
102 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
103 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
104 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
105 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
106 9, 27, 31, 9, 32, 6, 9, 29, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
127 0, 0, 0, 2,
128};
129short yycheck[] = { 2,
130 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
131 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
132 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
133 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
134 10, 1, 14, 4, 1, 1, 5, 22, -1, -1,
135 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
136 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
137 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
138 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
139 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
140 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
141 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
142 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
143 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
145 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
146 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
147 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
148 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
149 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
151 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
153 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
155 -1, -1, -1, 256,
156};
157#define YYFINAL 1
158#ifndef YYDEBUG
159#define YYDEBUG 0
160#endif
161#define YYMAXTOKEN 14
162#if YYDEBUG
163char *yyname[] = {
164"end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
165"ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
166};
167char *yyrule[] = {
168"$accept : commands",
169"commands :",
170"commands : commands command",
171"command : WORD PERIOD",
172"command : expr PERIOD",
173"command : error PERIOD",
174"expr : WORD OPEN arglist CLOSE",
175"expr : OPEN_SQUARE CLOSE_SQUARE",
176"expr : OPEN_SQUARE arglist CLOSE_SQUARE",
177"arglist :",
178"arglist : arg",
179"arglist : arg COMMA arglist",
180"arg : WORD EQUALS arg1",
181"arg : arg1",
182"arg1 : WORD",
183"arg1 : STRING",
184"arg1 : INTEGER",
185"arg1 : INTEGER PERIOD INTEGER",
186"arg1 : INTEGER EXP INTEGER",
187"arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
188"arg1 : expr",
189};
190#endif
191#define yyclearin (yychar=(-1))
192#define yyerrok (yyerrflag=0)
193#ifdef YYSTACKSIZE
194#ifndef YYMAXDEPTH
195#define YYMAXDEPTH YYSTACKSIZE
196#endif
197#else
198#ifdef YYMAXDEPTH
199#define YYSTACKSIZE YYMAXDEPTH
200#else
201#define YYSTACKSIZE 600
202#define YYMAXDEPTH 600
203#endif
204#endif
205int yydebug;
206int yynerrs;
207int yyerrflag;
208int yychar;
209short *yyssp;
210YYSTYPE *yyvsp;
211YYSTYPE yyval;
212YYSTYPE yylval;
213short yyss[YYSTACKSIZE];
214YYSTYPE yyvs[YYSTACKSIZE];
215#define yystacksize YYSTACKSIZE
216#line 118 "parser.y"
217
c6dafd93 218#include "doslex.c"
4a3bdee6
JS
219
220/*
221void yyerror(s)
222char *s;
223{
224 syntax_error(s);
225}
226*/
227
228/* Ansi prototype. If this doesn't work for you... uncomment
229 the above instead.
230 */
231
232void yyerror(char *s)
233{
234 syntax_error(s);
235}
236
237/*
238 * Unfortunately, my DOS version of FLEX
239 * requires yywrap to be #def'ed, whereas
240 * the UNIX flex expects a proper function.
241 */
242
243/* Not sure if __SC__ is the appropriate thing
244 * to test
245 */
246
15e8daec 247#if 0 /* VS: doesn't work... */
4a3bdee6
JS
248#ifndef __SC__
249#ifdef USE_DEFINE
250#ifndef yywrap
251#define yywrap() 1
252#endif
253#else
254# if !(defined(__VISAGECPP__) && __IBMC__ >= 400)
255/* VA 4.0 thinks this is multiply defined (in lex_yy.c) */
256 int yywrap() { return 1; }
257# endif
258#endif
259#endif
15e8daec
VS
260#endif
261
4a3bdee6
JS
262#line 247 "y_tab.c"
263#define YYABORT goto yyabort
264#define YYACCEPT goto yyaccept
265#define YYERROR goto yyerrlab
266int
267PROIO_yyparse()
268{
269 register int yym, yyn, yystate;
270#if YYDEBUG
271 register char *yys;
272 extern char *getenv();
273
274 yys = getenv("YYDEBUG");
275 if (yys)
276 {
277 yyn = *yys;
278 if (yyn >= '0' && yyn <= '9')
279 yydebug = yyn - '0';
280 }
281#endif
282
283 yynerrs = 0;
284 yyerrflag = 0;
285 yychar = (-1);
286
287 yyssp = yyss;
288 yyvsp = yyvs;
289 *yyssp = yystate = 0;
290
291yyloop:
292 yyn = yydefred[yystate];
293 if (yyn != 0) goto yyreduce;
294 if (yychar < 0)
295 {
296 if ((yychar = yylex()) < 0) yychar = 0;
297#if YYDEBUG
298 if (yydebug)
299 {
300 yys = 0;
301 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
302 if (!yys) yys = "illegal-symbol";
303 printf("yydebug: state %d, reading %d (%s)\n", yystate,
304 yychar, yys);
305 }
306#endif
307 }
308 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
309 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
310 {
311#if YYDEBUG
312 if (yydebug)
313 printf("yydebug: state %d, shifting to state %d\n",
314 yystate, yytable[yyn]);
315#endif
316 if (yyssp >= yyss + yystacksize - 1)
317 {
318 goto yyoverflow;
319 }
320 *++yyssp = yystate = yytable[yyn];
321 *++yyvsp = yylval;
322 yychar = (-1);
323 if (yyerrflag > 0) --yyerrflag;
324 goto yyloop;
325 }
326 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
327 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
328 {
329 yyn = yytable[yyn];
330 goto yyreduce;
331 }
332 if (yyerrflag) goto yyinrecovery;
333#ifdef lint
334 goto yynewerror;
335#endif
336yynewerror:
337 yyerror("syntax error");
338#ifdef lint
339 goto yyerrlab;
340#endif
341yyerrlab:
342 ++yynerrs;
343yyinrecovery:
344 if (yyerrflag < 3)
345 {
346 yyerrflag = 3;
347 for (;;)
348 {
349 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
350 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
351 {
352#if YYDEBUG
353 if (yydebug)
354 printf("yydebug: state %d, error recovery shifting\
355 to state %d\n", *yyssp, yytable[yyn]);
356#endif
357 if (yyssp >= yyss + yystacksize - 1)
358 {
359 goto yyoverflow;
360 }
361 *++yyssp = yystate = yytable[yyn];
362 *++yyvsp = yylval;
363 goto yyloop;
364 }
365 else
366 {
367#if YYDEBUG
368 if (yydebug)
369 printf("yydebug: error recovery discarding state %d\n",
370 *yyssp);
371#endif
372 if (yyssp <= yyss) goto yyabort;
373 --yyssp;
374 --yyvsp;
375 }
376 }
377 }
378 else
379 {
380 if (yychar == 0) goto yyabort;
381#if YYDEBUG
382 if (yydebug)
383 {
384 yys = 0;
385 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
386 if (!yys) yys = "illegal-symbol";
387 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
388 yystate, yychar, yys);
389 }
390#endif
391 yychar = (-1);
392 goto yyloop;
393 }
394yyreduce:
395#if YYDEBUG
396 if (yydebug)
397 printf("yydebug: state %d, reducing by rule %d (%s)\n",
398 yystate, yyn, yyrule[yyn]);
399#endif
400 yym = yylen[yyn];
401 yyval = yyvsp[1-yym];
402 switch (yyn)
403 {
404case 3:
405#line 68 "parser.y"
406{process_command(proio_cons(wxmake_word(yyvsp[-1].s), NULL)); free(yyvsp[-1].s);}
407break;
408case 4:
409#line 70 "parser.y"
410{process_command(yyvsp[-1].s);}
411break;
412case 5:
413#line 72 "parser.y"
414{syntax_error("Unrecognized command.");}
415break;
416case 6:
417#line 76 "parser.y"
418{yyval.s = proio_cons(wxmake_word(yyvsp[-3].s), yyvsp[-1].s); free(yyvsp[-3].s);}
419break;
420case 7:
421#line 78 "parser.y"
422{yyval.s = proio_cons(NULL, NULL);}
423break;
424case 8:
425#line 80 "parser.y"
426{yyval.s = yyvsp[-1].s; }
427break;
428case 9:
429#line 84 "parser.y"
430{yyval.s = NULL;}
431break;
432case 10:
433#line 86 "parser.y"
434{yyval.s = proio_cons(yyvsp[0].s, NULL);}
435break;
436case 11:
437#line 89 "parser.y"
438{yyval.s = proio_cons(yyvsp[-2].s, yyvsp[0].s);}
439break;
440case 12:
441#line 93 "parser.y"
442{yyval.s = proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp[-2].s), proio_cons(yyvsp[0].s, NULL)));
443 free(yyvsp[-2].s); }
444break;
445case 13:
446#line 96 "parser.y"
447{yyval.s = yyvsp[0].s; }
448break;
449case 14:
450#line 99 "parser.y"
451{yyval.s = wxmake_word(yyvsp[0].s); free(yyvsp[0].s);}
452break;
453case 15:
454#line 101 "parser.y"
455{yyval.s = wxmake_string(yyvsp[0].s); free(yyvsp[0].s);}
456break;
457case 16:
458#line 103 "parser.y"
459{yyval.s = wxmake_integer(yyvsp[0].s); free(yyvsp[0].s);}
460break;
461case 17:
462#line 105 "parser.y"
463{yyval.s = wxmake_real(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); }
464break;
465case 18:
466#line 107 "parser.y"
467{yyval.s = wxmake_exp(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); }
468break;
469case 19:
470#line 110 "parser.y"
471{yyval.s = wxmake_exp2(yyvsp[-4].s, yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-4].s); free(yyvsp[-2].s);
472 free(yyvsp[0].s); }
473break;
474case 20:
475#line 114 "parser.y"
476{yyval.s = yyvsp[0].s;}
477break;
478#line 461 "y_tab.c"
479 }
480 yyssp -= yym;
481 yystate = *yyssp;
482 yyvsp -= yym;
483 yym = yylhs[yyn];
484 if (yystate == 0 && yym == 0)
485 {
486#if YYDEBUG
487 if (yydebug)
488 printf("yydebug: after reduction, shifting from state 0 to\
489 state %d\n", YYFINAL);
490#endif
491 yystate = YYFINAL;
492 *++yyssp = YYFINAL;
493 *++yyvsp = yyval;
494 if (yychar < 0)
495 {
496 if ((yychar = yylex()) < 0) yychar = 0;
497#if YYDEBUG
498 if (yydebug)
499 {
500 yys = 0;
501 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
502 if (!yys) yys = "illegal-symbol";
503 printf("yydebug: state %d, reading %d (%s)\n",
504 YYFINAL, yychar, yys);
505 }
506#endif
507 }
508 if (yychar == 0) goto yyaccept;
509 goto yyloop;
510 }
511 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
512 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
513 yystate = yytable[yyn];
514 else
515 yystate = yydgoto[yym];
516#if YYDEBUG
517 if (yydebug)
518 printf("yydebug: after reduction, shifting from state %d \
519to state %d\n", *yyssp, yystate);
520#endif
521 if (yyssp >= yyss + yystacksize - 1)
522 {
523 goto yyoverflow;
524 }
525 *++yyssp = yystate;
526 *++yyvsp = yyval;
527 goto yyloop;
528yyoverflow:
529 yyerror("yacc stack overflow");
530yyabort:
531 return (1);
532yyaccept:
533 return (0);
534}
535
536#endif /* wxUSE_PROLOGIO */