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