tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / byacc / dist / test / calc1.tab.c
blobad3d81b51a1c9ace30d5b0cceb56bc8382b2f85e
1 /* $NetBSD: calc1.tab.c,v 1.1.1.4 2013/04/06 14:45:29 christos Exp $ */
3 #ifndef lint
4 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
5 #endif
7 #define YYBYACC 1
8 #define YYMAJOR 1
9 #define YYMINOR 9
11 #define YYEMPTY (-1)
12 #define yyclearin (yychar = YYEMPTY)
13 #define yyerrok (yyerrflag = 0)
14 #define YYRECOVERING() (yyerrflag != 0)
17 #ifndef yyparse
18 #define yyparse calc1_parse
19 #endif /* yyparse */
21 #ifndef yylex
22 #define yylex calc1_lex
23 #endif /* yylex */
25 #ifndef yyerror
26 #define yyerror calc1_error
27 #endif /* yyerror */
29 #ifndef yychar
30 #define yychar calc1_char
31 #endif /* yychar */
33 #ifndef yyval
34 #define yyval calc1_val
35 #endif /* yyval */
37 #ifndef yylval
38 #define yylval calc1_lval
39 #endif /* yylval */
41 #ifndef yydebug
42 #define yydebug calc1_debug
43 #endif /* yydebug */
45 #ifndef yynerrs
46 #define yynerrs calc1_nerrs
47 #endif /* yynerrs */
49 #ifndef yyerrflag
50 #define yyerrflag calc1_errflag
51 #endif /* yyerrflag */
53 #ifndef yylhs
54 #define yylhs calc1_lhs
55 #endif /* yylhs */
57 #ifndef yylen
58 #define yylen calc1_len
59 #endif /* yylen */
61 #ifndef yydefred
62 #define yydefred calc1_defred
63 #endif /* yydefred */
65 #ifndef yydgoto
66 #define yydgoto calc1_dgoto
67 #endif /* yydgoto */
69 #ifndef yysindex
70 #define yysindex calc1_sindex
71 #endif /* yysindex */
73 #ifndef yyrindex
74 #define yyrindex calc1_rindex
75 #endif /* yyrindex */
77 #ifndef yygindex
78 #define yygindex calc1_gindex
79 #endif /* yygindex */
81 #ifndef yytable
82 #define yytable calc1_table
83 #endif /* yytable */
85 #ifndef yycheck
86 #define yycheck calc1_check
87 #endif /* yycheck */
89 #ifndef yyname
90 #define yyname calc1_name
91 #endif /* yyname */
93 #ifndef yyrule
94 #define yyrule calc1_rule
95 #endif /* yyrule */
96 #define YYPREFIX "calc1_"
98 #define YYPURE 0
100 #line 2 "calc1.y"
102 /* http://dinosaur.compilertools.net/yacc/index.html */
104 #include <stdlib.h>
105 #include <stdio.h>
106 #include <ctype.h>
107 #include <math.h>
109 typedef struct interval
111 double lo, hi;
113 INTERVAL;
115 INTERVAL vmul(double, double, INTERVAL);
116 INTERVAL vdiv(double, double, INTERVAL);
118 extern int yylex(void);
119 static void yyerror(const char *s);
121 int dcheck(INTERVAL);
123 double dreg[26];
124 INTERVAL vreg[26];
126 #line 31 "calc1.y"
127 #ifdef YYSTYPE
128 #undef YYSTYPE_IS_DECLARED
129 #define YYSTYPE_IS_DECLARED 1
130 #endif
131 #ifndef YYSTYPE_IS_DECLARED
132 #define YYSTYPE_IS_DECLARED 1
133 typedef union
135 int ival;
136 double dval;
137 INTERVAL vval;
138 } YYSTYPE;
139 #endif /* !YYSTYPE_IS_DECLARED */
140 #line 139 "calc1.tab.c"
142 /* compatibility with bison */
143 #ifdef YYPARSE_PARAM
144 /* compatibility with FreeBSD */
145 # ifdef YYPARSE_PARAM_TYPE
146 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
147 # else
148 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
149 # endif
150 #else
151 # define YYPARSE_DECL() yyparse(void)
152 #endif
154 /* Parameters sent to lex. */
155 #ifdef YYLEX_PARAM
156 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
157 # define YYLEX yylex(YYLEX_PARAM)
158 #else
159 # define YYLEX_DECL() yylex(void)
160 # define YYLEX yylex()
161 #endif
163 /* Parameters sent to yyerror. */
164 #ifndef YYERROR_DECL
165 #define YYERROR_DECL() yyerror(const char *s)
166 #endif
167 #ifndef YYERROR_CALL
168 #define YYERROR_CALL(msg) yyerror(msg)
169 #endif
171 extern int YYPARSE_DECL();
173 #define DREG 257
174 #define VREG 258
175 #define CONST 259
176 #define UMINUS 260
177 #define YYERRCODE 256
178 static const short calc1_lhs[] = { -1,
179 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
180 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 2,
183 static const short calc1_len[] = { 2,
184 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
185 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
186 3, 3, 3, 3, 3, 3, 2, 3,
188 static const short calc1_defred[] = { 0,
189 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
190 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
191 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
192 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
193 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
194 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
195 13, 17,
197 static const short calc1_dgoto[] = { 7,
198 32, 9, 0,
200 static const short calc1_sindex[] = { -40,
201 -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
202 -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
203 -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
204 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
205 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
206 -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
207 0, 0,
209 static const short calc1_rindex[] = { 0,
210 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
213 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
214 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
215 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
216 0, 0,
218 static const short calc1_gindex[] = { 0,
219 4, 124, 0,
221 #define YYTABLESIZE 225
222 static const short calc1_table[] = { 6,
223 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
224 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
225 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
226 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
227 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
228 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
229 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
230 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
231 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
232 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
233 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
234 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
235 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
236 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
237 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
238 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
239 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
240 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
241 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
244 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
245 14, 4, 13, 0, 4,
247 static const short calc1_check[] = { 40,
248 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
249 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
250 -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
251 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
252 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
253 -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
254 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
255 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
256 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
257 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
258 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
259 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
260 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
261 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
262 -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
263 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
264 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
265 -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
266 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
268 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
269 -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
270 258, 259, 257, -1, 259,
272 #define YYFINAL 7
273 #ifndef YYDEBUG
274 #define YYDEBUG 0
275 #endif
276 #define YYMAXTOKEN 260
277 #if YYDEBUG
278 static const char *yyname[] = {
280 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
281 0,0,0,0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,
282 0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
283 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
284 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
285 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
286 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
287 0,0,"DREG","VREG","CONST","UMINUS",
289 static const char *yyrule[] = {
290 "$accept : line",
291 "lines :",
292 "lines : lines line",
293 "line : dexp '\\n'",
294 "line : vexp '\\n'",
295 "line : DREG '=' dexp '\\n'",
296 "line : VREG '=' vexp '\\n'",
297 "line : error '\\n'",
298 "dexp : CONST",
299 "dexp : DREG",
300 "dexp : dexp '+' dexp",
301 "dexp : dexp '-' dexp",
302 "dexp : dexp '*' dexp",
303 "dexp : dexp '/' dexp",
304 "dexp : '-' dexp",
305 "dexp : '(' dexp ')'",
306 "vexp : dexp",
307 "vexp : '(' dexp ',' dexp ')'",
308 "vexp : VREG",
309 "vexp : vexp '+' vexp",
310 "vexp : dexp '+' vexp",
311 "vexp : vexp '-' vexp",
312 "vexp : dexp '-' vexp",
313 "vexp : vexp '*' vexp",
314 "vexp : dexp '*' vexp",
315 "vexp : vexp '/' vexp",
316 "vexp : dexp '/' vexp",
317 "vexp : '-' vexp",
318 "vexp : '(' vexp ')'",
321 #endif
323 int yydebug;
324 int yynerrs;
326 int yyerrflag;
327 int yychar;
328 YYSTYPE yyval;
329 YYSTYPE yylval;
331 /* define the initial stack-sizes */
332 #ifdef YYSTACKSIZE
333 #undef YYMAXDEPTH
334 #define YYMAXDEPTH YYSTACKSIZE
335 #else
336 #ifdef YYMAXDEPTH
337 #define YYSTACKSIZE YYMAXDEPTH
338 #else
339 #define YYSTACKSIZE 500
340 #define YYMAXDEPTH 500
341 #endif
342 #endif
344 #define YYINITSTACKSIZE 500
346 typedef struct {
347 unsigned stacksize;
348 short *s_base;
349 short *s_mark;
350 short *s_last;
351 YYSTYPE *l_base;
352 YYSTYPE *l_mark;
353 } YYSTACKDATA;
354 /* variables for the parser stack */
355 static YYSTACKDATA yystack;
356 #line 176 "calc1.y"
357 /* beginning of subroutines section */
359 #define BSZ 50 /* buffer size for floating point numbers */
361 /* lexical analysis */
363 static void
364 yyerror(const char *s)
366 fprintf(stderr, "%s\n", s);
370 yylex(void)
372 int c;
374 while ((c = getchar()) == ' ')
375 { /* skip over blanks */
378 if (isupper(c))
380 yylval.ival = c - 'A';
381 return (VREG);
383 if (islower(c))
385 yylval.ival = c - 'a';
386 return (DREG);
389 if (isdigit(c) || c == '.')
391 /* gobble up digits, points, exponents */
392 char buf[BSZ + 1], *cp = buf;
393 int dot = 0, expr = 0;
395 for (; (cp - buf) < BSZ; ++cp, c = getchar())
398 *cp = (char) c;
399 if (isdigit(c))
400 continue;
401 if (c == '.')
403 if (dot++ || expr)
404 return ('.'); /* will cause syntax error */
405 continue;
408 if (c == 'e')
410 if (expr++)
411 return ('e'); /* will cause syntax error */
412 continue;
415 /* end of number */
416 break;
418 *cp = '\0';
420 if ((cp - buf) >= BSZ)
421 printf("constant too long: truncated\n");
422 else
423 ungetc(c, stdin); /* push back last char read */
424 yylval.dval = atof(buf);
425 return (CONST);
427 return (c);
430 static INTERVAL
431 hilo(double a, double b, double c, double d)
433 /* returns the smallest interval containing a, b, c, and d */
434 /* used by *, / routines */
435 INTERVAL v;
437 if (a > b)
439 v.hi = a;
440 v.lo = b;
442 else
444 v.hi = b;
445 v.lo = a;
448 if (c > d)
450 if (c > v.hi)
451 v.hi = c;
452 if (d < v.lo)
453 v.lo = d;
455 else
457 if (d > v.hi)
458 v.hi = d;
459 if (c < v.lo)
460 v.lo = c;
462 return (v);
465 INTERVAL
466 vmul(double a, double b, INTERVAL v)
468 return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
472 dcheck(INTERVAL v)
474 if (v.hi >= 0. && v.lo <= 0.)
476 printf("divisor interval contains 0.\n");
477 return (1);
479 return (0);
482 INTERVAL
483 vdiv(double a, double b, INTERVAL v)
485 return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
487 #line 486 "calc1.tab.c"
489 #if YYDEBUG
490 #include <stdio.h> /* needed for printf */
491 #endif
493 #include <stdlib.h> /* needed for malloc, etc */
494 #include <string.h> /* needed for memset */
496 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
497 static int yygrowstack(YYSTACKDATA *data)
499 int i;
500 unsigned newsize;
501 short *newss;
502 YYSTYPE *newvs;
504 if ((newsize = data->stacksize) == 0)
505 newsize = YYINITSTACKSIZE;
506 else if (newsize >= YYMAXDEPTH)
507 return -1;
508 else if ((newsize *= 2) > YYMAXDEPTH)
509 newsize = YYMAXDEPTH;
511 i = (int) (data->s_mark - data->s_base);
512 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
513 if (newss == 0)
514 return -1;
516 data->s_base = newss;
517 data->s_mark = newss + i;
519 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
520 if (newvs == 0)
521 return -1;
523 data->l_base = newvs;
524 data->l_mark = newvs + i;
526 data->stacksize = newsize;
527 data->s_last = data->s_base + newsize - 1;
528 return 0;
531 #if YYPURE || defined(YY_NO_LEAKS)
532 static void yyfreestack(YYSTACKDATA *data)
534 free(data->s_base);
535 free(data->l_base);
536 memset(data, 0, sizeof(*data));
538 #else
539 #define yyfreestack(data) /* nothing */
540 #endif
542 #define YYABORT goto yyabort
543 #define YYREJECT goto yyabort
544 #define YYACCEPT goto yyaccept
545 #define YYERROR goto yyerrlab
548 YYPARSE_DECL()
550 int yym, yyn, yystate;
551 #if YYDEBUG
552 const char *yys;
554 if ((yys = getenv("YYDEBUG")) != 0)
556 yyn = *yys;
557 if (yyn >= '0' && yyn <= '9')
558 yydebug = yyn - '0';
560 #endif
562 yynerrs = 0;
563 yyerrflag = 0;
564 yychar = YYEMPTY;
565 yystate = 0;
567 #if YYPURE
568 memset(&yystack, 0, sizeof(yystack));
569 #endif
571 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
572 yystack.s_mark = yystack.s_base;
573 yystack.l_mark = yystack.l_base;
574 yystate = 0;
575 *yystack.s_mark = 0;
577 yyloop:
578 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
579 if (yychar < 0)
581 if ((yychar = YYLEX) < 0) yychar = 0;
582 #if YYDEBUG
583 if (yydebug)
585 yys = 0;
586 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
587 if (!yys) yys = "illegal-symbol";
588 printf("%sdebug: state %d, reading %d (%s)\n",
589 YYPREFIX, yystate, yychar, yys);
591 #endif
593 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
594 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
596 #if YYDEBUG
597 if (yydebug)
598 printf("%sdebug: state %d, shifting to state %d\n",
599 YYPREFIX, yystate, yytable[yyn]);
600 #endif
601 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
603 goto yyoverflow;
605 yystate = yytable[yyn];
606 *++yystack.s_mark = yytable[yyn];
607 *++yystack.l_mark = yylval;
608 yychar = YYEMPTY;
609 if (yyerrflag > 0) --yyerrflag;
610 goto yyloop;
612 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
613 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
615 yyn = yytable[yyn];
616 goto yyreduce;
618 if (yyerrflag) goto yyinrecovery;
620 yyerror("syntax error");
622 goto yyerrlab;
624 yyerrlab:
625 ++yynerrs;
627 yyinrecovery:
628 if (yyerrflag < 3)
630 yyerrflag = 3;
631 for (;;)
633 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
634 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
636 #if YYDEBUG
637 if (yydebug)
638 printf("%sdebug: state %d, error recovery shifting\
639 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
640 #endif
641 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
643 goto yyoverflow;
645 yystate = yytable[yyn];
646 *++yystack.s_mark = yytable[yyn];
647 *++yystack.l_mark = yylval;
648 goto yyloop;
650 else
652 #if YYDEBUG
653 if (yydebug)
654 printf("%sdebug: error recovery discarding state %d\n",
655 YYPREFIX, *yystack.s_mark);
656 #endif
657 if (yystack.s_mark <= yystack.s_base) goto yyabort;
658 --yystack.s_mark;
659 --yystack.l_mark;
663 else
665 if (yychar == 0) goto yyabort;
666 #if YYDEBUG
667 if (yydebug)
669 yys = 0;
670 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
671 if (!yys) yys = "illegal-symbol";
672 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
673 YYPREFIX, yystate, yychar, yys);
675 #endif
676 yychar = YYEMPTY;
677 goto yyloop;
680 yyreduce:
681 #if YYDEBUG
682 if (yydebug)
683 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
684 YYPREFIX, yystate, yyn, yyrule[yyn]);
685 #endif
686 yym = yylen[yyn];
687 if (yym)
688 yyval = yystack.l_mark[1-yym];
689 else
690 memset(&yyval, 0, sizeof yyval);
691 switch (yyn)
693 case 3:
694 #line 57 "calc1.y"
696 (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
698 break;
699 case 4:
700 #line 61 "calc1.y"
702 (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
704 break;
705 case 5:
706 #line 65 "calc1.y"
708 dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
710 break;
711 case 6:
712 #line 69 "calc1.y"
714 vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
716 break;
717 case 7:
718 #line 73 "calc1.y"
720 yyerrok;
722 break;
723 case 9:
724 #line 80 "calc1.y"
726 yyval.dval = dreg[yystack.l_mark[0].ival];
728 break;
729 case 10:
730 #line 84 "calc1.y"
732 yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
734 break;
735 case 11:
736 #line 88 "calc1.y"
738 yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
740 break;
741 case 12:
742 #line 92 "calc1.y"
744 yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
746 break;
747 case 13:
748 #line 96 "calc1.y"
750 yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
752 break;
753 case 14:
754 #line 100 "calc1.y"
756 yyval.dval = -yystack.l_mark[0].dval;
758 break;
759 case 15:
760 #line 104 "calc1.y"
762 yyval.dval = yystack.l_mark[-1].dval;
764 break;
765 case 16:
766 #line 110 "calc1.y"
768 yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
770 break;
771 case 17:
772 #line 114 "calc1.y"
774 yyval.vval.lo = yystack.l_mark[-3].dval;
775 yyval.vval.hi = yystack.l_mark[-1].dval;
776 if ( yyval.vval.lo > yyval.vval.hi )
778 (void) printf("interval out of order\n");
779 YYERROR;
782 break;
783 case 18:
784 #line 124 "calc1.y"
786 yyval.vval = vreg[yystack.l_mark[0].ival];
788 break;
789 case 19:
790 #line 128 "calc1.y"
792 yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
793 yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
795 break;
796 case 20:
797 #line 133 "calc1.y"
799 yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
800 yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
802 break;
803 case 21:
804 #line 138 "calc1.y"
806 yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
807 yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
809 break;
810 case 22:
811 #line 143 "calc1.y"
813 yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
814 yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
816 break;
817 case 23:
818 #line 148 "calc1.y"
820 yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
822 break;
823 case 24:
824 #line 152 "calc1.y"
826 yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
828 break;
829 case 25:
830 #line 156 "calc1.y"
832 if (dcheck(yystack.l_mark[0].vval)) YYERROR;
833 yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
835 break;
836 case 26:
837 #line 161 "calc1.y"
839 if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
840 yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
842 break;
843 case 27:
844 #line 166 "calc1.y"
846 yyval.vval.hi = -yystack.l_mark[0].vval.lo;
847 yyval.vval.lo = -yystack.l_mark[0].vval.hi;
849 break;
850 case 28:
851 #line 171 "calc1.y"
853 yyval.vval = yystack.l_mark[-1].vval;
855 break;
856 #line 855 "calc1.tab.c"
858 yystack.s_mark -= yym;
859 yystate = *yystack.s_mark;
860 yystack.l_mark -= yym;
861 yym = yylhs[yyn];
862 if (yystate == 0 && yym == 0)
864 #if YYDEBUG
865 if (yydebug)
866 printf("%sdebug: after reduction, shifting from state 0 to\
867 state %d\n", YYPREFIX, YYFINAL);
868 #endif
869 yystate = YYFINAL;
870 *++yystack.s_mark = YYFINAL;
871 *++yystack.l_mark = yyval;
872 if (yychar < 0)
874 if ((yychar = YYLEX) < 0) yychar = 0;
875 #if YYDEBUG
876 if (yydebug)
878 yys = 0;
879 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
880 if (!yys) yys = "illegal-symbol";
881 printf("%sdebug: state %d, reading %d (%s)\n",
882 YYPREFIX, YYFINAL, yychar, yys);
884 #endif
886 if (yychar == 0) goto yyaccept;
887 goto yyloop;
889 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
890 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
891 yystate = yytable[yyn];
892 else
893 yystate = yydgoto[yym];
894 #if YYDEBUG
895 if (yydebug)
896 printf("%sdebug: after reduction, shifting from state %d \
897 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
898 #endif
899 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
901 goto yyoverflow;
903 *++yystack.s_mark = (short) yystate;
904 *++yystack.l_mark = yyval;
905 goto yyloop;
907 yyoverflow:
908 yyerror("yacc stack overflow");
910 yyabort:
911 yyfreestack(&yystack);
912 return (1);
914 yyaccept:
915 yyfreestack(&yystack);
916 return (0);