Home | History | Annotate | Line # | Download | only in yacc
calc1.tab.c revision 1.1.1.8
      1  1.1.1.3  christos /*	$NetBSD: calc1.tab.c,v 1.1.1.8 2026/01/18 16:39:06 christos Exp $	*/
      2  1.1.1.3  christos 
      3      1.1  christos /* original parser id follows */
      4      1.1  christos /* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
      5      1.1  christos /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
      6      1.1  christos 
      7      1.1  christos #define YYBYACC 1
      8  1.1.1.6  christos #define YYMAJOR 2
      9  1.1.1.6  christos #define YYMINOR 0
     10      1.1  christos #define YYCHECK "yyyymmdd"
     11      1.1  christos 
     12      1.1  christos #define YYEMPTY        (-1)
     13      1.1  christos #define yyclearin      (yychar = YYEMPTY)
     14      1.1  christos #define yyerrok        (yyerrflag = 0)
     15      1.1  christos #define YYRECOVERING() (yyerrflag != 0)
     16      1.1  christos #define YYENOMEM       (-2)
     17      1.1  christos #define YYEOF          0
     18      1.1  christos 
     19      1.1  christos #ifndef yyparse
     20      1.1  christos #define yyparse    calc1_parse
     21      1.1  christos #endif /* yyparse */
     22      1.1  christos 
     23      1.1  christos #ifndef yylex
     24      1.1  christos #define yylex      calc1_lex
     25      1.1  christos #endif /* yylex */
     26      1.1  christos 
     27      1.1  christos #ifndef yyerror
     28      1.1  christos #define yyerror    calc1_error
     29      1.1  christos #endif /* yyerror */
     30      1.1  christos 
     31      1.1  christos #ifndef yychar
     32      1.1  christos #define yychar     calc1_char
     33      1.1  christos #endif /* yychar */
     34      1.1  christos 
     35      1.1  christos #ifndef yyval
     36      1.1  christos #define yyval      calc1_val
     37      1.1  christos #endif /* yyval */
     38      1.1  christos 
     39      1.1  christos #ifndef yylval
     40      1.1  christos #define yylval     calc1_lval
     41      1.1  christos #endif /* yylval */
     42      1.1  christos 
     43      1.1  christos #ifndef yydebug
     44      1.1  christos #define yydebug    calc1_debug
     45      1.1  christos #endif /* yydebug */
     46      1.1  christos 
     47      1.1  christos #ifndef yynerrs
     48      1.1  christos #define yynerrs    calc1_nerrs
     49      1.1  christos #endif /* yynerrs */
     50      1.1  christos 
     51      1.1  christos #ifndef yyerrflag
     52      1.1  christos #define yyerrflag  calc1_errflag
     53      1.1  christos #endif /* yyerrflag */
     54      1.1  christos 
     55      1.1  christos #ifndef yylhs
     56      1.1  christos #define yylhs      calc1_lhs
     57      1.1  christos #endif /* yylhs */
     58      1.1  christos 
     59      1.1  christos #ifndef yylen
     60      1.1  christos #define yylen      calc1_len
     61      1.1  christos #endif /* yylen */
     62      1.1  christos 
     63      1.1  christos #ifndef yydefred
     64      1.1  christos #define yydefred   calc1_defred
     65      1.1  christos #endif /* yydefred */
     66      1.1  christos 
     67      1.1  christos #ifndef yydgoto
     68      1.1  christos #define yydgoto    calc1_dgoto
     69      1.1  christos #endif /* yydgoto */
     70      1.1  christos 
     71      1.1  christos #ifndef yysindex
     72      1.1  christos #define yysindex   calc1_sindex
     73      1.1  christos #endif /* yysindex */
     74      1.1  christos 
     75      1.1  christos #ifndef yyrindex
     76      1.1  christos #define yyrindex   calc1_rindex
     77      1.1  christos #endif /* yyrindex */
     78      1.1  christos 
     79      1.1  christos #ifndef yygindex
     80      1.1  christos #define yygindex   calc1_gindex
     81      1.1  christos #endif /* yygindex */
     82      1.1  christos 
     83      1.1  christos #ifndef yytable
     84      1.1  christos #define yytable    calc1_table
     85      1.1  christos #endif /* yytable */
     86      1.1  christos 
     87      1.1  christos #ifndef yycheck
     88      1.1  christos #define yycheck    calc1_check
     89      1.1  christos #endif /* yycheck */
     90      1.1  christos 
     91      1.1  christos #ifndef yyname
     92      1.1  christos #define yyname     calc1_name
     93      1.1  christos #endif /* yyname */
     94      1.1  christos 
     95      1.1  christos #ifndef yyrule
     96      1.1  christos #define yyrule     calc1_rule
     97      1.1  christos #endif /* yyrule */
     98      1.1  christos #define YYPREFIX "calc1_"
     99      1.1  christos 
    100      1.1  christos #define YYPURE 0
    101      1.1  christos 
    102      1.1  christos #line 2 "calc1.y"
    103      1.1  christos 
    104      1.1  christos /* http://dinosaur.compilertools.net/yacc/index.html */
    105      1.1  christos 
    106      1.1  christos #include <stdlib.h>
    107      1.1  christos #include <stdio.h>
    108      1.1  christos #include <ctype.h>
    109      1.1  christos #include <math.h>
    110      1.1  christos 
    111      1.1  christos typedef struct interval
    112      1.1  christos {
    113      1.1  christos     double lo, hi;
    114      1.1  christos }
    115      1.1  christos INTERVAL;
    116      1.1  christos 
    117      1.1  christos INTERVAL vmul(double, double, INTERVAL);
    118      1.1  christos INTERVAL vdiv(double, double, INTERVAL);
    119      1.1  christos 
    120      1.1  christos extern int yylex(void);
    121      1.1  christos static void yyerror(const char *s);
    122      1.1  christos 
    123      1.1  christos int dcheck(INTERVAL);
    124      1.1  christos 
    125      1.1  christos double dreg[26];
    126      1.1  christos INTERVAL vreg[26];
    127      1.1  christos 
    128      1.1  christos #ifdef YYSTYPE
    129      1.1  christos #undef  YYSTYPE_IS_DECLARED
    130      1.1  christos #define YYSTYPE_IS_DECLARED 1
    131      1.1  christos #endif
    132      1.1  christos #ifndef YYSTYPE_IS_DECLARED
    133      1.1  christos #define YYSTYPE_IS_DECLARED 1
    134  1.1.1.4  christos #line 31 "calc1.y"
    135  1.1.1.7  christos typedef union YYSTYPE
    136      1.1  christos {
    137      1.1  christos 	int ival;
    138      1.1  christos 	double dval;
    139      1.1  christos 	INTERVAL vval;
    140      1.1  christos } YYSTYPE;
    141      1.1  christos #endif /* !YYSTYPE_IS_DECLARED */
    142      1.1  christos #line 141 "calc1.tab.c"
    143      1.1  christos 
    144      1.1  christos /* compatibility with bison */
    145      1.1  christos #ifdef YYPARSE_PARAM
    146      1.1  christos /* compatibility with FreeBSD */
    147      1.1  christos # ifdef YYPARSE_PARAM_TYPE
    148      1.1  christos #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
    149      1.1  christos # else
    150      1.1  christos #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
    151      1.1  christos # endif
    152      1.1  christos #else
    153      1.1  christos # define YYPARSE_DECL() yyparse(void)
    154      1.1  christos #endif
    155      1.1  christos 
    156      1.1  christos /* Parameters sent to lex. */
    157      1.1  christos #ifdef YYLEX_PARAM
    158      1.1  christos # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
    159      1.1  christos # define YYLEX yylex(YYLEX_PARAM)
    160      1.1  christos #else
    161      1.1  christos # define YYLEX_DECL() yylex(void)
    162      1.1  christos # define YYLEX yylex()
    163      1.1  christos #endif
    164      1.1  christos 
    165      1.1  christos /* Parameters sent to yyerror. */
    166      1.1  christos #ifndef YYERROR_DECL
    167      1.1  christos #define YYERROR_DECL() yyerror(const char *s)
    168      1.1  christos #endif
    169      1.1  christos #ifndef YYERROR_CALL
    170      1.1  christos #define YYERROR_CALL(msg) yyerror(msg)
    171      1.1  christos #endif
    172      1.1  christos 
    173      1.1  christos extern int YYPARSE_DECL();
    174      1.1  christos 
    175      1.1  christos #define DREG 257
    176      1.1  christos #define VREG 258
    177      1.1  christos #define CONST 259
    178      1.1  christos #define UMINUS 260
    179      1.1  christos #define YYERRCODE 256
    180  1.1.1.7  christos typedef int YYINT;
    181      1.1  christos static const YYINT calc1_lhs[] = {                       -1,
    182      1.1  christos     3,    3,    0,    0,    0,    0,    0,    1,    1,    1,
    183      1.1  christos     1,    1,    1,    1,    1,    2,    2,    2,    2,    2,
    184      1.1  christos     2,    2,    2,    2,    2,    2,    2,    2,
    185      1.1  christos };
    186      1.1  christos static const YYINT calc1_len[] = {                        2,
    187      1.1  christos     0,    2,    2,    2,    4,    4,    2,    1,    1,    3,
    188      1.1  christos     3,    3,    3,    2,    3,    1,    5,    1,    3,    3,
    189      1.1  christos     3,    3,    3,    3,    3,    3,    2,    3,
    190      1.1  christos };
    191      1.1  christos static const YYINT calc1_defred[] = {                     0,
    192      1.1  christos     0,    0,    0,    8,    0,    0,    0,    0,    0,    7,
    193      1.1  christos     0,    0,    9,   18,   14,   27,    0,    0,    0,    0,
    194      1.1  christos     0,    0,    3,    0,    0,    0,    0,    4,    0,    0,
    195      1.1  christos     0,    0,    0,   15,    0,   28,    0,    0,    0,    0,
    196      1.1  christos    12,   24,   13,   26,    0,    0,   23,   25,   14,    0,
    197      1.1  christos     0,    0,    0,    0,    5,    6,    0,    0,    0,   12,
    198      1.1  christos    13,   17,
    199      1.1  christos };
    200      1.1  christos static const YYINT calc1_dgoto[] = {                      7,
    201      1.1  christos    32,    9,    0,
    202      1.1  christos };
    203      1.1  christos static const YYINT calc1_sindex[] = {                   -40,
    204      1.1  christos    -8,  -48,  -47,    0,  -37,  -37,    0,    2,   17,    0,
    205      1.1  christos   -34,  -37,    0,    0,    0,    0,  -25,   90,  -37,  -37,
    206      1.1  christos   -37,  -37,    0,  -37,  -37,  -37,  -37,    0,  -34,  -34,
    207      1.1  christos    25,  125,   31,    0,  -34,    0,  -11,   37,  -11,   37,
    208      1.1  christos     0,    0,    0,    0,   37,   37,    0,    0,    0,  111,
    209      1.1  christos   -34,  -34,  -34,  -34,    0,    0,  118,   69,   69,    0,
    210      1.1  christos     0,    0,
    211      1.1  christos };
    212      1.1  christos static const YYINT calc1_rindex[] = {                     0,
    213      1.1  christos     0,   38,   44,    0,    0,    0,    0,    0,    0,    0,
    214      1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    215      1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    216      1.1  christos     0,   -9,    0,    0,    0,    0,   51,   -3,   56,   61,
    217      1.1  christos     0,    0,    0,    0,   67,   72,    0,    0,    0,    0,
    218      1.1  christos     0,    0,    0,    0,    0,    0,    0,   78,   83,    0,
    219      1.1  christos     0,    0,
    220      1.1  christos };
    221      1.1  christos static const YYINT calc1_gindex[] = {                     0,
    222      1.1  christos     4,  124,    0,
    223      1.1  christos };
    224      1.1  christos #define YYTABLESIZE 225
    225      1.1  christos static const YYINT calc1_table[] = {                      6,
    226      1.1  christos    16,   10,    6,    8,    5,   30,   20,    5,   15,   17,
    227      1.1  christos    29,   23,   11,   12,   31,   34,   21,   19,   35,   20,
    228      1.1  christos     0,   22,   37,   39,   41,   43,   28,    0,    0,    0,
    229      1.1  christos    21,   16,   49,   50,   55,   22,    0,   20,   57,   20,
    230      1.1  christos    56,   20,    0,   21,   19,    0,   20,    9,   22,    0,
    231      1.1  christos     0,    0,    0,   18,   58,   59,   60,   61,   26,   24,
    232      1.1  christos    10,   25,    0,   27,    0,   11,   53,   51,    0,   52,
    233      1.1  christos    22,   54,   26,   24,    0,   25,   19,   27,   26,    9,
    234      1.1  christos     9,   21,    9,   27,    9,   18,   18,   10,   18,    0,
    235      1.1  christos    18,   10,   11,   10,   10,   10,   11,    0,   11,   11,
    236      1.1  christos    11,   22,    0,   22,    0,   22,    0,   19,    0,   19,
    237      1.1  christos    53,   19,   21,    0,   21,   54,   21,    0,   10,    0,
    238      1.1  christos    10,    0,   10,   11,    0,   11,    0,   11,   16,   18,
    239      1.1  christos    36,   26,   24,    0,   25,   33,   27,    0,    0,    0,
    240      1.1  christos     0,    0,   38,   40,   42,   44,    0,   45,   46,   47,
    241      1.1  christos    48,   34,   53,   51,    0,   52,    0,   54,   62,   53,
    242      1.1  christos    51,    0,   52,    0,   54,    0,   21,   19,    0,   20,
    243      1.1  christos     0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
    244      1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    245      1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    246      1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    247      1.1  christos     0,    0,    0,    0,    0,    1,    2,    3,    4,   13,
    248      1.1  christos    14,    4,   13,    0,    4,
    249      1.1  christos };
    250      1.1  christos static const YYINT calc1_check[] = {                     40,
    251      1.1  christos    10,   10,   40,    0,   45,   40,   10,   45,    5,    6,
    252      1.1  christos    45,   10,   61,   61,   11,   41,   42,   43,   44,   45,
    253      1.1  christos    -1,   47,   19,   20,   21,   22,   10,   -1,   -1,   -1,
    254      1.1  christos    42,   41,   29,   30,   10,   47,   -1,   41,   35,   43,
    255      1.1  christos    10,   45,   -1,   42,   43,   -1,   45,   10,   47,   -1,
    256      1.1  christos    -1,   -1,   -1,   10,   51,   52,   53,   54,   42,   43,
    257      1.1  christos    10,   45,   -1,   47,   -1,   10,   42,   43,   -1,   45,
    258      1.1  christos    10,   47,   42,   43,   -1,   45,   10,   47,   42,   42,
    259      1.1  christos    43,   10,   45,   47,   47,   42,   43,   10,   45,   -1,
    260      1.1  christos    47,   41,   10,   43,   44,   45,   41,   -1,   43,   44,
    261      1.1  christos    45,   41,   -1,   43,   -1,   45,   -1,   41,   -1,   43,
    262      1.1  christos    42,   45,   41,   -1,   43,   47,   45,   -1,   41,   -1,
    263      1.1  christos    43,   -1,   45,   41,   -1,   43,   -1,   45,    5,    6,
    264      1.1  christos    41,   42,   43,   -1,   45,   12,   47,   -1,   -1,   -1,
    265      1.1  christos    -1,   -1,   19,   20,   21,   22,   -1,   24,   25,   26,
    266      1.1  christos    27,   41,   42,   43,   -1,   45,   -1,   47,   41,   42,
    267      1.1  christos    43,   -1,   45,   -1,   47,   -1,   42,   43,   -1,   45,
    268      1.1  christos    -1,   47,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    269      1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    270      1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    271      1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    272      1.1  christos    -1,   -1,   -1,   -1,   -1,  256,  257,  258,  259,  257,
    273      1.1  christos   258,  259,  257,   -1,  259,
    274      1.1  christos };
    275      1.1  christos #define YYFINAL 7
    276      1.1  christos #ifndef YYDEBUG
    277      1.1  christos #define YYDEBUG 0
    278      1.1  christos #endif
    279      1.1  christos #define YYMAXTOKEN 260
    280      1.1  christos #define YYUNDFTOKEN 266
    281      1.1  christos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
    282      1.1  christos #if YYDEBUG
    283  1.1.1.8  christos #ifndef NULL
    284  1.1.1.8  christos #define NULL (void*)0
    285  1.1.1.8  christos #endif
    286      1.1  christos static const char *const calc1_name[] = {
    287      1.1  christos 
    288  1.1.1.8  christos "end-of-file",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'\\n'",NULL,NULL,
    289  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    290  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'('","')'","'*'","'+'",
    291  1.1.1.8  christos "','","'-'",NULL,"'/'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    292  1.1.1.8  christos NULL,NULL,"'='",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    293  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    294  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    295  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    296  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    297  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    298  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    299  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    300  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    301  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    302  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    303  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    304  1.1.1.8  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,"DREG","VREG","CONST","UMINUS",NULL,NULL,
    305  1.1.1.8  christos NULL,NULL,NULL,"illegal-symbol",
    306      1.1  christos };
    307      1.1  christos static const char *const calc1_rule[] = {
    308      1.1  christos "$accept : line",
    309      1.1  christos "lines :",
    310      1.1  christos "lines : lines line",
    311      1.1  christos "line : dexp '\\n'",
    312      1.1  christos "line : vexp '\\n'",
    313      1.1  christos "line : DREG '=' dexp '\\n'",
    314      1.1  christos "line : VREG '=' vexp '\\n'",
    315      1.1  christos "line : error '\\n'",
    316      1.1  christos "dexp : CONST",
    317      1.1  christos "dexp : DREG",
    318      1.1  christos "dexp : dexp '+' dexp",
    319      1.1  christos "dexp : dexp '-' dexp",
    320      1.1  christos "dexp : dexp '*' dexp",
    321      1.1  christos "dexp : dexp '/' dexp",
    322      1.1  christos "dexp : '-' dexp",
    323      1.1  christos "dexp : '(' dexp ')'",
    324      1.1  christos "vexp : dexp",
    325      1.1  christos "vexp : '(' dexp ',' dexp ')'",
    326      1.1  christos "vexp : VREG",
    327      1.1  christos "vexp : vexp '+' vexp",
    328      1.1  christos "vexp : dexp '+' vexp",
    329      1.1  christos "vexp : vexp '-' vexp",
    330      1.1  christos "vexp : dexp '-' vexp",
    331      1.1  christos "vexp : vexp '*' vexp",
    332      1.1  christos "vexp : dexp '*' vexp",
    333      1.1  christos "vexp : vexp '/' vexp",
    334      1.1  christos "vexp : dexp '/' vexp",
    335      1.1  christos "vexp : '-' vexp",
    336      1.1  christos "vexp : '(' vexp ')'",
    337      1.1  christos 
    338      1.1  christos };
    339      1.1  christos #endif
    340      1.1  christos 
    341  1.1.1.5  christos #if YYDEBUG
    342      1.1  christos int      yydebug;
    343  1.1.1.5  christos #endif
    344      1.1  christos 
    345      1.1  christos int      yyerrflag;
    346      1.1  christos int      yychar;
    347      1.1  christos YYSTYPE  yyval;
    348      1.1  christos YYSTYPE  yylval;
    349  1.1.1.5  christos int      yynerrs;
    350      1.1  christos 
    351      1.1  christos /* define the initial stack-sizes */
    352      1.1  christos #ifdef YYSTACKSIZE
    353      1.1  christos #undef YYMAXDEPTH
    354      1.1  christos #define YYMAXDEPTH  YYSTACKSIZE
    355      1.1  christos #else
    356      1.1  christos #ifdef YYMAXDEPTH
    357      1.1  christos #define YYSTACKSIZE YYMAXDEPTH
    358      1.1  christos #else
    359      1.1  christos #define YYSTACKSIZE 10000
    360      1.1  christos #define YYMAXDEPTH  10000
    361      1.1  christos #endif
    362      1.1  christos #endif
    363      1.1  christos 
    364      1.1  christos #define YYINITSTACKSIZE 200
    365      1.1  christos 
    366      1.1  christos typedef struct {
    367      1.1  christos     unsigned stacksize;
    368      1.1  christos     YYINT    *s_base;
    369      1.1  christos     YYINT    *s_mark;
    370      1.1  christos     YYINT    *s_last;
    371      1.1  christos     YYSTYPE  *l_base;
    372      1.1  christos     YYSTYPE  *l_mark;
    373      1.1  christos } YYSTACKDATA;
    374      1.1  christos /* variables for the parser stack */
    375      1.1  christos static YYSTACKDATA yystack;
    376      1.1  christos #line 176 "calc1.y"
    377      1.1  christos 	/* beginning of subroutines section */
    378      1.1  christos 
    379      1.1  christos #define BSZ 50			/* buffer size for floating point numbers */
    380      1.1  christos 
    381      1.1  christos 	/* lexical analysis */
    382      1.1  christos 
    383      1.1  christos static void
    384      1.1  christos yyerror(const char *s)
    385      1.1  christos {
    386      1.1  christos     fprintf(stderr, "%s\n", s);
    387      1.1  christos }
    388      1.1  christos 
    389      1.1  christos int
    390      1.1  christos yylex(void)
    391      1.1  christos {
    392      1.1  christos     int c;
    393      1.1  christos 
    394      1.1  christos     while ((c = getchar()) == ' ')
    395      1.1  christos     {				/* skip over blanks */
    396      1.1  christos     }
    397      1.1  christos 
    398      1.1  christos     if (isupper(c))
    399      1.1  christos     {
    400      1.1  christos 	yylval.ival = c - 'A';
    401      1.1  christos 	return (VREG);
    402      1.1  christos     }
    403      1.1  christos     if (islower(c))
    404      1.1  christos     {
    405      1.1  christos 	yylval.ival = c - 'a';
    406      1.1  christos 	return (DREG);
    407      1.1  christos     }
    408      1.1  christos 
    409      1.1  christos     if (isdigit(c) || c == '.')
    410      1.1  christos     {
    411      1.1  christos 	/* gobble up digits, points, exponents */
    412      1.1  christos 	char buf[BSZ + 1], *cp = buf;
    413      1.1  christos 	int dot = 0, expr = 0;
    414      1.1  christos 
    415      1.1  christos 	for (; (cp - buf) < BSZ; ++cp, c = getchar())
    416      1.1  christos 	{
    417      1.1  christos 
    418      1.1  christos 	    *cp = (char) c;
    419      1.1  christos 	    if (isdigit(c))
    420      1.1  christos 		continue;
    421      1.1  christos 	    if (c == '.')
    422      1.1  christos 	    {
    423      1.1  christos 		if (dot++ || expr)
    424      1.1  christos 		    return ('.');	/* will cause syntax error */
    425      1.1  christos 		continue;
    426      1.1  christos 	    }
    427      1.1  christos 
    428      1.1  christos 	    if (c == 'e')
    429      1.1  christos 	    {
    430      1.1  christos 		if (expr++)
    431      1.1  christos 		    return ('e');	/*  will  cause  syntax  error  */
    432      1.1  christos 		continue;
    433      1.1  christos 	    }
    434      1.1  christos 
    435      1.1  christos 	    /*  end  of  number  */
    436      1.1  christos 	    break;
    437      1.1  christos 	}
    438      1.1  christos 	*cp = '\0';
    439      1.1  christos 
    440      1.1  christos 	if ((cp - buf) >= BSZ)
    441      1.1  christos 	    printf("constant  too  long:  truncated\n");
    442      1.1  christos 	else
    443      1.1  christos 	    ungetc(c, stdin);	/*  push  back  last  char  read  */
    444      1.1  christos 	yylval.dval = atof(buf);
    445      1.1  christos 	return (CONST);
    446      1.1  christos     }
    447      1.1  christos     return (c);
    448      1.1  christos }
    449      1.1  christos 
    450      1.1  christos static INTERVAL
    451      1.1  christos hilo(double a, double b, double c, double d)
    452      1.1  christos {
    453      1.1  christos     /*  returns  the  smallest  interval  containing  a,  b,  c,  and  d  */
    454      1.1  christos     /*  used  by  *,  /  routines  */
    455      1.1  christos     INTERVAL v;
    456      1.1  christos 
    457      1.1  christos     if (a > b)
    458      1.1  christos     {
    459      1.1  christos 	v.hi = a;
    460      1.1  christos 	v.lo = b;
    461      1.1  christos     }
    462      1.1  christos     else
    463      1.1  christos     {
    464      1.1  christos 	v.hi = b;
    465      1.1  christos 	v.lo = a;
    466      1.1  christos     }
    467      1.1  christos 
    468      1.1  christos     if (c > d)
    469      1.1  christos     {
    470      1.1  christos 	if (c > v.hi)
    471      1.1  christos 	    v.hi = c;
    472      1.1  christos 	if (d < v.lo)
    473      1.1  christos 	    v.lo = d;
    474      1.1  christos     }
    475      1.1  christos     else
    476      1.1  christos     {
    477      1.1  christos 	if (d > v.hi)
    478      1.1  christos 	    v.hi = d;
    479      1.1  christos 	if (c < v.lo)
    480      1.1  christos 	    v.lo = c;
    481      1.1  christos     }
    482      1.1  christos     return (v);
    483      1.1  christos }
    484      1.1  christos 
    485      1.1  christos INTERVAL
    486      1.1  christos vmul(double a, double b, INTERVAL v)
    487      1.1  christos {
    488      1.1  christos     return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
    489      1.1  christos }
    490      1.1  christos 
    491      1.1  christos int
    492      1.1  christos dcheck(INTERVAL v)
    493      1.1  christos {
    494      1.1  christos     if (v.hi >= 0. && v.lo <= 0.)
    495      1.1  christos     {
    496      1.1  christos 	printf("divisor  interval  contains  0.\n");
    497      1.1  christos 	return (1);
    498      1.1  christos     }
    499      1.1  christos     return (0);
    500      1.1  christos }
    501      1.1  christos 
    502      1.1  christos INTERVAL
    503      1.1  christos vdiv(double a, double b, INTERVAL v)
    504      1.1  christos {
    505      1.1  christos     return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
    506      1.1  christos }
    507  1.1.1.8  christos #line 506 "calc1.tab.c"
    508      1.1  christos 
    509      1.1  christos #if YYDEBUG
    510  1.1.1.4  christos #include <stdio.h>	/* needed for printf */
    511      1.1  christos #endif
    512      1.1  christos 
    513      1.1  christos #include <stdlib.h>	/* needed for malloc, etc */
    514      1.1  christos #include <string.h>	/* needed for memset */
    515      1.1  christos 
    516      1.1  christos /* allocate initial stack or double stack size, up to YYMAXDEPTH */
    517      1.1  christos static int yygrowstack(YYSTACKDATA *data)
    518      1.1  christos {
    519      1.1  christos     int i;
    520      1.1  christos     unsigned newsize;
    521      1.1  christos     YYINT *newss;
    522      1.1  christos     YYSTYPE *newvs;
    523      1.1  christos 
    524      1.1  christos     if ((newsize = data->stacksize) == 0)
    525      1.1  christos         newsize = YYINITSTACKSIZE;
    526      1.1  christos     else if (newsize >= YYMAXDEPTH)
    527      1.1  christos         return YYENOMEM;
    528      1.1  christos     else if ((newsize *= 2) > YYMAXDEPTH)
    529      1.1  christos         newsize = YYMAXDEPTH;
    530      1.1  christos 
    531      1.1  christos     i = (int) (data->s_mark - data->s_base);
    532      1.1  christos     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
    533  1.1.1.8  christos     if (newss == NULL)
    534      1.1  christos         return YYENOMEM;
    535      1.1  christos 
    536      1.1  christos     data->s_base = newss;
    537      1.1  christos     data->s_mark = newss + i;
    538      1.1  christos 
    539      1.1  christos     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
    540  1.1.1.8  christos     if (newvs == NULL)
    541      1.1  christos         return YYENOMEM;
    542      1.1  christos 
    543      1.1  christos     data->l_base = newvs;
    544      1.1  christos     data->l_mark = newvs + i;
    545      1.1  christos 
    546      1.1  christos     data->stacksize = newsize;
    547      1.1  christos     data->s_last = data->s_base + newsize - 1;
    548      1.1  christos     return 0;
    549      1.1  christos }
    550      1.1  christos 
    551      1.1  christos #if YYPURE || defined(YY_NO_LEAKS)
    552      1.1  christos static void yyfreestack(YYSTACKDATA *data)
    553      1.1  christos {
    554      1.1  christos     free(data->s_base);
    555      1.1  christos     free(data->l_base);
    556      1.1  christos     memset(data, 0, sizeof(*data));
    557      1.1  christos }
    558      1.1  christos #else
    559      1.1  christos #define yyfreestack(data) /* nothing */
    560      1.1  christos #endif
    561      1.1  christos 
    562      1.1  christos #define YYABORT  goto yyabort
    563      1.1  christos #define YYREJECT goto yyabort
    564      1.1  christos #define YYACCEPT goto yyaccept
    565      1.1  christos #define YYERROR  goto yyerrlab
    566      1.1  christos 
    567      1.1  christos int
    568      1.1  christos YYPARSE_DECL()
    569      1.1  christos {
    570      1.1  christos     int yym, yyn, yystate;
    571      1.1  christos #if YYDEBUG
    572      1.1  christos     const char *yys;
    573      1.1  christos 
    574  1.1.1.8  christos     if ((yys = getenv("YYDEBUG")) != NULL)
    575      1.1  christos     {
    576      1.1  christos         yyn = *yys;
    577      1.1  christos         if (yyn >= '0' && yyn <= '9')
    578      1.1  christos             yydebug = yyn - '0';
    579      1.1  christos     }
    580      1.1  christos #endif
    581      1.1  christos 
    582  1.1.1.7  christos     /* yym is set below */
    583  1.1.1.7  christos     /* yyn is set below */
    584      1.1  christos     yynerrs = 0;
    585      1.1  christos     yyerrflag = 0;
    586      1.1  christos     yychar = YYEMPTY;
    587      1.1  christos     yystate = 0;
    588      1.1  christos 
    589      1.1  christos #if YYPURE
    590      1.1  christos     memset(&yystack, 0, sizeof(yystack));
    591      1.1  christos #endif
    592      1.1  christos 
    593      1.1  christos     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    594      1.1  christos     yystack.s_mark = yystack.s_base;
    595      1.1  christos     yystack.l_mark = yystack.l_base;
    596      1.1  christos     yystate = 0;
    597      1.1  christos     *yystack.s_mark = 0;
    598      1.1  christos 
    599      1.1  christos yyloop:
    600      1.1  christos     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
    601      1.1  christos     if (yychar < 0)
    602      1.1  christos     {
    603  1.1.1.4  christos         yychar = YYLEX;
    604  1.1.1.4  christos         if (yychar < 0) yychar = YYEOF;
    605      1.1  christos #if YYDEBUG
    606      1.1  christos         if (yydebug)
    607      1.1  christos         {
    608  1.1.1.4  christos             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
    609      1.1  christos             printf("%sdebug: state %d, reading %d (%s)\n",
    610      1.1  christos                     YYPREFIX, yystate, yychar, yys);
    611      1.1  christos         }
    612      1.1  christos #endif
    613      1.1  christos     }
    614  1.1.1.4  christos     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
    615  1.1.1.4  christos             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    616      1.1  christos     {
    617      1.1  christos #if YYDEBUG
    618      1.1  christos         if (yydebug)
    619      1.1  christos             printf("%sdebug: state %d, shifting to state %d\n",
    620      1.1  christos                     YYPREFIX, yystate, yytable[yyn]);
    621      1.1  christos #endif
    622  1.1.1.4  christos         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    623      1.1  christos         yystate = yytable[yyn];
    624      1.1  christos         *++yystack.s_mark = yytable[yyn];
    625      1.1  christos         *++yystack.l_mark = yylval;
    626      1.1  christos         yychar = YYEMPTY;
    627      1.1  christos         if (yyerrflag > 0)  --yyerrflag;
    628      1.1  christos         goto yyloop;
    629      1.1  christos     }
    630  1.1.1.4  christos     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
    631  1.1.1.4  christos             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    632      1.1  christos     {
    633      1.1  christos         yyn = yytable[yyn];
    634      1.1  christos         goto yyreduce;
    635      1.1  christos     }
    636  1.1.1.4  christos     if (yyerrflag != 0) goto yyinrecovery;
    637      1.1  christos 
    638      1.1  christos     YYERROR_CALL("syntax error");
    639      1.1  christos 
    640  1.1.1.4  christos     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
    641      1.1  christos yyerrlab:
    642      1.1  christos     ++yynerrs;
    643      1.1  christos 
    644      1.1  christos yyinrecovery:
    645      1.1  christos     if (yyerrflag < 3)
    646      1.1  christos     {
    647      1.1  christos         yyerrflag = 3;
    648      1.1  christos         for (;;)
    649      1.1  christos         {
    650  1.1.1.4  christos             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
    651  1.1.1.4  christos                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
    652      1.1  christos             {
    653      1.1  christos #if YYDEBUG
    654      1.1  christos                 if (yydebug)
    655      1.1  christos                     printf("%sdebug: state %d, error recovery shifting\
    656      1.1  christos  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
    657      1.1  christos #endif
    658  1.1.1.4  christos                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    659      1.1  christos                 yystate = yytable[yyn];
    660      1.1  christos                 *++yystack.s_mark = yytable[yyn];
    661      1.1  christos                 *++yystack.l_mark = yylval;
    662      1.1  christos                 goto yyloop;
    663      1.1  christos             }
    664      1.1  christos             else
    665      1.1  christos             {
    666      1.1  christos #if YYDEBUG
    667      1.1  christos                 if (yydebug)
    668      1.1  christos                     printf("%sdebug: error recovery discarding state %d\n",
    669      1.1  christos                             YYPREFIX, *yystack.s_mark);
    670      1.1  christos #endif
    671      1.1  christos                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
    672      1.1  christos                 --yystack.s_mark;
    673      1.1  christos                 --yystack.l_mark;
    674      1.1  christos             }
    675      1.1  christos         }
    676      1.1  christos     }
    677      1.1  christos     else
    678      1.1  christos     {
    679      1.1  christos         if (yychar == YYEOF) goto yyabort;
    680      1.1  christos #if YYDEBUG
    681      1.1  christos         if (yydebug)
    682      1.1  christos         {
    683  1.1.1.4  christos             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
    684      1.1  christos             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
    685      1.1  christos                     YYPREFIX, yystate, yychar, yys);
    686      1.1  christos         }
    687      1.1  christos #endif
    688      1.1  christos         yychar = YYEMPTY;
    689      1.1  christos         goto yyloop;
    690      1.1  christos     }
    691      1.1  christos 
    692      1.1  christos yyreduce:
    693      1.1  christos #if YYDEBUG
    694      1.1  christos     if (yydebug)
    695      1.1  christos         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
    696      1.1  christos                 YYPREFIX, yystate, yyn, yyrule[yyn]);
    697      1.1  christos #endif
    698      1.1  christos     yym = yylen[yyn];
    699  1.1.1.4  christos     if (yym > 0)
    700      1.1  christos         yyval = yystack.l_mark[1-yym];
    701      1.1  christos     else
    702      1.1  christos         memset(&yyval, 0, sizeof yyval);
    703  1.1.1.4  christos 
    704      1.1  christos     switch (yyn)
    705      1.1  christos     {
    706      1.1  christos case 3:
    707      1.1  christos #line 57 "calc1.y"
    708      1.1  christos 	{
    709      1.1  christos 		(void) printf("%15.8f\n", yystack.l_mark[-1].dval);
    710      1.1  christos 	}
    711  1.1.1.8  christos #line 710 "calc1.tab.c"
    712      1.1  christos break;
    713      1.1  christos case 4:
    714      1.1  christos #line 61 "calc1.y"
    715      1.1  christos 	{
    716      1.1  christos 		(void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
    717      1.1  christos 	}
    718  1.1.1.8  christos #line 717 "calc1.tab.c"
    719      1.1  christos break;
    720      1.1  christos case 5:
    721      1.1  christos #line 65 "calc1.y"
    722      1.1  christos 	{
    723      1.1  christos 		dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
    724      1.1  christos 	}
    725  1.1.1.8  christos #line 724 "calc1.tab.c"
    726      1.1  christos break;
    727      1.1  christos case 6:
    728      1.1  christos #line 69 "calc1.y"
    729      1.1  christos 	{
    730      1.1  christos 		vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
    731      1.1  christos 	}
    732  1.1.1.8  christos #line 731 "calc1.tab.c"
    733      1.1  christos break;
    734      1.1  christos case 7:
    735      1.1  christos #line 73 "calc1.y"
    736      1.1  christos 	{
    737      1.1  christos 		yyerrok;
    738      1.1  christos 	}
    739  1.1.1.8  christos #line 738 "calc1.tab.c"
    740      1.1  christos break;
    741      1.1  christos case 9:
    742      1.1  christos #line 80 "calc1.y"
    743      1.1  christos 	{
    744      1.1  christos 		yyval.dval = dreg[yystack.l_mark[0].ival];
    745      1.1  christos 	}
    746  1.1.1.8  christos #line 745 "calc1.tab.c"
    747      1.1  christos break;
    748      1.1  christos case 10:
    749      1.1  christos #line 84 "calc1.y"
    750      1.1  christos 	{
    751      1.1  christos 		yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
    752      1.1  christos 	}
    753  1.1.1.8  christos #line 752 "calc1.tab.c"
    754      1.1  christos break;
    755      1.1  christos case 11:
    756      1.1  christos #line 88 "calc1.y"
    757      1.1  christos 	{
    758      1.1  christos 		yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
    759      1.1  christos 	}
    760  1.1.1.8  christos #line 759 "calc1.tab.c"
    761      1.1  christos break;
    762      1.1  christos case 12:
    763      1.1  christos #line 92 "calc1.y"
    764      1.1  christos 	{
    765      1.1  christos 		yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
    766      1.1  christos 	}
    767  1.1.1.8  christos #line 766 "calc1.tab.c"
    768      1.1  christos break;
    769      1.1  christos case 13:
    770      1.1  christos #line 96 "calc1.y"
    771      1.1  christos 	{
    772      1.1  christos 		yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
    773      1.1  christos 	}
    774  1.1.1.8  christos #line 773 "calc1.tab.c"
    775      1.1  christos break;
    776      1.1  christos case 14:
    777      1.1  christos #line 100 "calc1.y"
    778      1.1  christos 	{
    779      1.1  christos 		yyval.dval = -yystack.l_mark[0].dval;
    780      1.1  christos 	}
    781  1.1.1.8  christos #line 780 "calc1.tab.c"
    782      1.1  christos break;
    783      1.1  christos case 15:
    784      1.1  christos #line 104 "calc1.y"
    785      1.1  christos 	{
    786      1.1  christos 		yyval.dval = yystack.l_mark[-1].dval;
    787      1.1  christos 	}
    788  1.1.1.8  christos #line 787 "calc1.tab.c"
    789      1.1  christos break;
    790      1.1  christos case 16:
    791      1.1  christos #line 110 "calc1.y"
    792      1.1  christos 	{
    793      1.1  christos 		yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
    794      1.1  christos 	}
    795  1.1.1.8  christos #line 794 "calc1.tab.c"
    796      1.1  christos break;
    797      1.1  christos case 17:
    798      1.1  christos #line 114 "calc1.y"
    799      1.1  christos 	{
    800      1.1  christos 		yyval.vval.lo = yystack.l_mark[-3].dval;
    801      1.1  christos 		yyval.vval.hi = yystack.l_mark[-1].dval;
    802  1.1.1.8  christos 		if ( yyval.vval.lo > yyval.vval.hi )
    803      1.1  christos 		{
    804      1.1  christos 			(void) printf("interval out of order\n");
    805      1.1  christos 			YYERROR;
    806      1.1  christos 		}
    807      1.1  christos 	}
    808  1.1.1.8  christos #line 807 "calc1.tab.c"
    809      1.1  christos break;
    810      1.1  christos case 18:
    811      1.1  christos #line 124 "calc1.y"
    812      1.1  christos 	{
    813      1.1  christos 		yyval.vval = vreg[yystack.l_mark[0].ival];
    814      1.1  christos 	}
    815  1.1.1.8  christos #line 814 "calc1.tab.c"
    816      1.1  christos break;
    817      1.1  christos case 19:
    818      1.1  christos #line 128 "calc1.y"
    819      1.1  christos 	{
    820      1.1  christos 		yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
    821      1.1  christos 		yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
    822      1.1  christos 	}
    823  1.1.1.8  christos #line 822 "calc1.tab.c"
    824      1.1  christos break;
    825      1.1  christos case 20:
    826      1.1  christos #line 133 "calc1.y"
    827      1.1  christos 	{
    828      1.1  christos 		yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
    829      1.1  christos 		yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
    830      1.1  christos 	}
    831  1.1.1.8  christos #line 830 "calc1.tab.c"
    832      1.1  christos break;
    833      1.1  christos case 21:
    834      1.1  christos #line 138 "calc1.y"
    835      1.1  christos 	{
    836      1.1  christos 		yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
    837      1.1  christos 		yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
    838      1.1  christos 	}
    839  1.1.1.8  christos #line 838 "calc1.tab.c"
    840      1.1  christos break;
    841      1.1  christos case 22:
    842      1.1  christos #line 143 "calc1.y"
    843      1.1  christos 	{
    844      1.1  christos 		yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
    845      1.1  christos 		yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
    846      1.1  christos 	}
    847  1.1.1.8  christos #line 846 "calc1.tab.c"
    848      1.1  christos break;
    849      1.1  christos case 23:
    850      1.1  christos #line 148 "calc1.y"
    851      1.1  christos 	{
    852      1.1  christos 		yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
    853      1.1  christos 	}
    854  1.1.1.8  christos #line 853 "calc1.tab.c"
    855      1.1  christos break;
    856      1.1  christos case 24:
    857      1.1  christos #line 152 "calc1.y"
    858      1.1  christos 	{
    859      1.1  christos 		yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
    860      1.1  christos 	}
    861  1.1.1.8  christos #line 860 "calc1.tab.c"
    862      1.1  christos break;
    863      1.1  christos case 25:
    864      1.1  christos #line 156 "calc1.y"
    865      1.1  christos 	{
    866      1.1  christos 		if (dcheck(yystack.l_mark[0].vval)) YYERROR;
    867      1.1  christos 		yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
    868      1.1  christos 	}
    869  1.1.1.8  christos #line 868 "calc1.tab.c"
    870      1.1  christos break;
    871      1.1  christos case 26:
    872      1.1  christos #line 161 "calc1.y"
    873      1.1  christos 	{
    874      1.1  christos 		if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
    875      1.1  christos 		yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
    876      1.1  christos 	}
    877  1.1.1.8  christos #line 876 "calc1.tab.c"
    878      1.1  christos break;
    879      1.1  christos case 27:
    880      1.1  christos #line 166 "calc1.y"
    881      1.1  christos 	{
    882      1.1  christos 		yyval.vval.hi = -yystack.l_mark[0].vval.lo;
    883      1.1  christos 		yyval.vval.lo = -yystack.l_mark[0].vval.hi;
    884      1.1  christos 	}
    885  1.1.1.8  christos #line 884 "calc1.tab.c"
    886      1.1  christos break;
    887      1.1  christos case 28:
    888      1.1  christos #line 171 "calc1.y"
    889      1.1  christos 	{
    890      1.1  christos 		yyval.vval = yystack.l_mark[-1].vval;
    891      1.1  christos 	}
    892  1.1.1.8  christos #line 891 "calc1.tab.c"
    893      1.1  christos break;
    894  1.1.1.8  christos #line 893 "calc1.tab.c"
    895      1.1  christos     }
    896      1.1  christos     yystack.s_mark -= yym;
    897      1.1  christos     yystate = *yystack.s_mark;
    898      1.1  christos     yystack.l_mark -= yym;
    899      1.1  christos     yym = yylhs[yyn];
    900      1.1  christos     if (yystate == 0 && yym == 0)
    901      1.1  christos     {
    902      1.1  christos #if YYDEBUG
    903      1.1  christos         if (yydebug)
    904      1.1  christos             printf("%sdebug: after reduction, shifting from state 0 to\
    905      1.1  christos  state %d\n", YYPREFIX, YYFINAL);
    906      1.1  christos #endif
    907      1.1  christos         yystate = YYFINAL;
    908      1.1  christos         *++yystack.s_mark = YYFINAL;
    909      1.1  christos         *++yystack.l_mark = yyval;
    910      1.1  christos         if (yychar < 0)
    911      1.1  christos         {
    912  1.1.1.4  christos             yychar = YYLEX;
    913  1.1.1.4  christos             if (yychar < 0) yychar = YYEOF;
    914      1.1  christos #if YYDEBUG
    915      1.1  christos             if (yydebug)
    916      1.1  christos             {
    917  1.1.1.4  christos                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
    918      1.1  christos                 printf("%sdebug: state %d, reading %d (%s)\n",
    919      1.1  christos                         YYPREFIX, YYFINAL, yychar, yys);
    920      1.1  christos             }
    921      1.1  christos #endif
    922      1.1  christos         }
    923      1.1  christos         if (yychar == YYEOF) goto yyaccept;
    924      1.1  christos         goto yyloop;
    925      1.1  christos     }
    926  1.1.1.4  christos     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
    927  1.1.1.4  christos             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
    928      1.1  christos         yystate = yytable[yyn];
    929      1.1  christos     else
    930      1.1  christos         yystate = yydgoto[yym];
    931      1.1  christos #if YYDEBUG
    932      1.1  christos     if (yydebug)
    933      1.1  christos         printf("%sdebug: after reduction, shifting from state %d \
    934      1.1  christos to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
    935      1.1  christos #endif
    936  1.1.1.4  christos     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    937      1.1  christos     *++yystack.s_mark = (YYINT) yystate;
    938      1.1  christos     *++yystack.l_mark = yyval;
    939      1.1  christos     goto yyloop;
    940      1.1  christos 
    941      1.1  christos yyoverflow:
    942      1.1  christos     YYERROR_CALL("yacc stack overflow");
    943      1.1  christos 
    944      1.1  christos yyabort:
    945      1.1  christos     yyfreestack(&yystack);
    946      1.1  christos     return (1);
    947      1.1  christos 
    948      1.1  christos yyaccept:
    949      1.1  christos     yyfreestack(&yystack);
    950      1.1  christos     return (0);
    951      1.1  christos }
    952