[BACK]Return to calc.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / demos / calc

Annotation of OpenXM_contrib/gmp/demos/calc/calc.c, Revision 1.1.1.1

1.1       ohara       1: /* A Bison parser, made from calc.y
                      2:    by GNU bison 1.34.  */
                      3:
                      4: #define YYBISON 1  /* Identify Bison output.  */
                      5:
                      6: # define       EOS     257
                      7: # define       BAD     258
                      8: # define       HELP    259
                      9: # define       HEX     260
                     10: # define       DECIMAL 261
                     11: # define       QUIT    262
                     12: # define       ABS     263
                     13: # define       BIN     264
                     14: # define       FIB     265
                     15: # define       GCD     266
                     16: # define       KRON    267
                     17: # define       LCM     268
                     18: # define       LUCNUM  269
                     19: # define       NEXTPRIME       270
                     20: # define       POWM    271
                     21: # define       ROOT    272
                     22: # define       SQRT    273
                     23: # define       NUMBER  274
                     24: # define       VARIABLE        275
                     25: # define       LOR     276
                     26: # define       LAND    277
                     27: # define       EQ      278
                     28: # define       NE      279
                     29: # define       LE      280
                     30: # define       GE      281
                     31: # define       LSHIFT  282
                     32: # define       RSHIFT  283
                     33: # define       UMINUS  284
                     34:
                     35: #line 1 "calc.y"
                     36:
                     37: /* A simple integer desk calculator using yacc and gmp.
                     38:
                     39: Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
                     40:
                     41: This file is part of the GNU MP Library.
                     42:
                     43: This program is free software; you can redistribute it and/or modify it under
                     44: the terms of the GNU General Public License as published by the Free Software
                     45: Foundation; either version 2 of the License, or (at your option) any later
                     46: version.
                     47:
                     48: This program is distributed in the hope that it will be useful, but WITHOUT ANY
                     49: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
                     50: PARTICULAR PURPOSE.  See the GNU General Public License for more details.
                     51:
                     52: You should have received a copy of the GNU General Public License along with
                     53: this program; if not, write to the Free Software Foundation, Inc., 59 Temple
                     54: Place - Suite 330, Boston, MA 02111-1307, USA. */
                     55:
                     56:
                     57: /* This is a simple program, meant only to show one way to use GMP for this
                     58:    sort of thing.  There's few features, and error checking is minimal.
                     59:    Standard input is read, calc_help() below shows the inputs accepted.
                     60:
                     61:    Expressions are evaluated as they're read.  If user defined functions
                     62:    were wanted it'd be necessary to build a parse tree like pexpr.c does, or
                     63:    a list of operations for a stack based evaluator.  That would also make
                     64:    it possible to detect and optimize evaluations "mod m" like pexpr.c does.
                     65:
                     66:    A stack is used for intermediate values in the expression evaluation,
                     67:    separate from the yacc parser stack.  This is simple, makes error
                     68:    recovery easy, minimizes the junk around mpz calls in the rules, and
                     69:    saves initializing or clearing "mpz_t"s during a calculation.  A
                     70:    disadvantage though is that variables must be copied to the stack to be
                     71:    worked on.  A more sophisticated calculator or language system might be
                     72:    able to avoid that when executing a compiled or semi-compiled form.
                     73:
                     74:    Avoiding repeated initializing and clearing of "mpz_t"s is important.  In
                     75:    this program the time spent parsing is obviously much greater than any
                     76:    possible saving from this, but a proper calculator or language should
                     77:    take some trouble over it.  Don't be surprised if an init/clear takes 3
                     78:    or more times as long as a 10 limb addition, depending on the system (see
                     79:    the mpz_init_realloc_clear example in tune/README).  */
                     80:
                     81:
                     82: #include <stdio.h>
                     83: #include <stdlib.h>
                     84: #include <string.h>
                     85: #include "gmp.h"
                     86: #define NO_CALC_H /* because it conflicts with normal calc.c stuff */
                     87: #include "calc-common.h"
                     88:
                     89:
                     90: #define numberof(x)  (sizeof (x) / sizeof ((x)[0]))
                     91:
                     92:
                     93: void
                     94: calc_help (void)
                     95: {
                     96:   printf ("Examples:\n");
                     97:   printf ("    2+3*4        expressions are evaluated\n");
                     98:   printf ("    x=5^6        variables a to z can be set and used\n");
                     99:   printf ("Operators:\n");
                    100:   printf ("    + - *        arithmetic\n");
                    101:   printf ("    / %%          division and remainder (rounding towards negative infinity)\n");
                    102:   printf ("    ^            exponentiation\n");
                    103:   printf ("    !            factorial\n");
                    104:   printf ("    << >>        left and right shifts\n");
                    105:   printf ("    <= >= >      \\ comparisons, giving 1 if true, 0 if false\n");
                    106:   printf ("    == != <      /\n");
                    107:   printf ("    && ||        logical and/or, giving 1 if true, 0 if false\n");
                    108:   printf ("Functions:\n");
                    109:   printf ("    abs(n)       absolute value\n");
                    110:   printf ("    bin(n,m)     binomial coefficient\n");
                    111:   printf ("    fib(n)       fibonacci number\n");
                    112:   printf ("    gcd(a,b,..)  greatest common divisor\n");
                    113:   printf ("    kron(a,b)    kronecker symbol\n");
                    114:   printf ("    lcm(a,b,..)  least common multiple\n");
                    115:   printf ("    lucnum(n)    lucas number\n");
                    116:   printf ("    nextprime(n) next prime after n\n");
                    117:   printf ("    powm(b,e,m)  modulo powering, b^e%%m\n");
                    118:   printf ("    root(n,r)    r-th root\n");
                    119:   printf ("    sqrt(n)      square root\n");
                    120:   printf ("Other:\n");
                    121:   printf ("    hex          \\ set hex or decimal for input and output\n");
                    122:   printf ("    decimal      /   (\"0x\" can be used for hex too)\n");
                    123:   printf ("    quit         exit program (EOF works too)\n");
                    124:   printf ("    ;            statements are separated with a ; or newline\n");
                    125:   printf ("    \\            continue expressions with \\ before newline\n");
                    126:   printf ("    # xxx        comments are # though to newline\n");
                    127:   printf ("Hex numbers must be entered in upper case, to distinguish them from the\n");
                    128:   printf ("variables a to f (like in bc).\n");
                    129: }
                    130:
                    131:
                    132: int  ibase = 0;
                    133: int  obase = 10;
                    134:
                    135:
                    136: /* The stack is a fixed size, which means there's a limit on the nesting
                    137:    allowed in expressions.  A more sophisticated program could let it grow
                    138:    dynamically.  */
                    139:
                    140: mpz_t    stack[100];
                    141: mpz_ptr  sp = stack[0];
                    142:
                    143: #define CHECK_OVERFLOW()                                                  \
                    144:   if (sp >= stack[numberof(stack)])                                       \
                    145:     {                                                                     \
                    146:       fprintf (stderr,                                                    \
                    147:                "Value stack overflow, too much nesting in expression\n"); \
                    148:       YYERROR;                                                            \
                    149:     }
                    150:
                    151: #define CHECK_EMPTY()                                                   \
                    152:   if (sp != stack[0])                                                   \
                    153:     {                                                                   \
                    154:       fprintf (stderr, "Oops, expected the value stack to be empty\n"); \
                    155:       sp = stack[0];                                                    \
                    156:     }
                    157:
                    158:
                    159: mpz_t  variable[26];
                    160:
                    161: #define CHECK_VARIABLE(var)                                             \
                    162:   if ((var) < 0 || (var) >= numberof (variable))                        \
                    163:     {                                                                   \
                    164:       fprintf (stderr, "Oops, bad variable somehow: %d\n", var);        \
                    165:       YYERROR;                                                          \
                    166:     }
                    167:
                    168:
                    169: #define CHECK_UI(name,z)                        \
                    170:   if (! mpz_fits_ulong_p (z))                   \
                    171:     {                                           \
                    172:       fprintf (stderr, "%s too big\n", name);   \
                    173:       YYERROR;                                  \
                    174:     }
                    175:
                    176:
                    177: #line 143 "calc.y"
                    178: #ifndef YYSTYPE
                    179: typedef union {
                    180:   char  *str;
                    181:   int   var;
                    182: } yystype;
                    183: # define YYSTYPE yystype
                    184: #endif
                    185: #ifndef YYDEBUG
                    186: # define YYDEBUG 0
                    187: #endif
                    188:
                    189:
                    190:
                    191: #define        YYFINAL         118
                    192: #define        YYFLAG          -32768
                    193: #define        YYNTBASE        44
                    194:
                    195: /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
                    196: #define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 50)
                    197:
                    198: /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
                    199: static const char yytranslate[] =
                    200: {
                    201:        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    202:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    203:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    204:        2,     2,     2,    39,     2,     2,     2,    36,     2,     2,
                    205:       41,    42,    34,    32,    43,    33,     2,    35,     2,     2,
                    206:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    207:       24,    40,    25,     2,     2,     2,     2,     2,     2,     2,
                    208:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    209:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    210:        2,     2,     2,     2,    38,     2,     2,     2,     2,     2,
                    211:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    212:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    213:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    214:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    215:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    216:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    217:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    218:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    219:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    220:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    221:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    222:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    223:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    224:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    225:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    226:        2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
                    227:        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
                    228:       16,    17,    18,    19,    20,    21,    22,    23,    26,    27,
                    229:       28,    29,    30,    31,    37
                    230: };
                    231:
                    232: #if YYDEBUG
                    233: static const short yyprhs[] =
                    234: {
                    235:        0,     0,     2,     5,     8,    12,    15,    16,    18,    22,
                    236:       24,    26,    28,    30,    34,    38,    42,    46,    50,    54,
                    237:       58,    62,    66,    69,    72,    76,    80,    84,    88,    92,
                    238:       96,   100,   104,   109,   116,   121,   126,   133,   138,   143,
                    239:      148,   157,   164,   169,   171,   173,   175,   179,   181
                    240: };
                    241: static const short yyrhs[] =
                    242: {
                    243:       46,     0,    45,    46,     0,    46,     3,     0,    45,    46,
                    244:        3,     0,     1,     3,     0,     0,    47,     0,    21,    40,
                    245:       47,     0,     5,     0,     6,     0,     7,     0,     8,     0,
                    246:       41,    47,    42,     0,    47,    32,    47,     0,    47,    33,
                    247:       47,     0,    47,    34,    47,     0,    47,    35,    47,     0,
                    248:       47,    36,    47,     0,    47,    38,    47,     0,    47,    30,
                    249:       47,     0,    47,    31,    47,     0,    47,    39,     0,    33,
                    250:       47,     0,    47,    24,    47,     0,    47,    28,    47,     0,
                    251:       47,    26,    47,     0,    47,    27,    47,     0,    47,    29,
                    252:       47,     0,    47,    25,    47,     0,    47,    23,    47,     0,
                    253:       47,    22,    47,     0,     9,    41,    47,    42,     0,    10,
                    254:       41,    47,    43,    47,    42,     0,    11,    41,    47,    42,
                    255:        0,    12,    41,    48,    42,     0,    13,    41,    47,    43,
                    256:       47,    42,     0,    14,    41,    49,    42,     0,    15,    41,
                    257:       47,    42,     0,    16,    41,    47,    42,     0,    17,    41,
                    258:       47,    43,    47,    43,    47,    42,     0,    18,    41,    47,
                    259:       43,    47,    42,     0,    19,    41,    47,    42,     0,    21,
                    260:        0,    20,     0,    47,     0,    48,    43,    47,     0,    47,
                    261:        0,    49,    43,    47,     0
                    262: };
                    263:
                    264: #endif
                    265:
                    266: #if YYDEBUG
                    267: /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
                    268: static const short yyrline[] =
                    269: {
                    270:        0,   167,   169,   171,   173,   174,   176,   178,   183,   189,
                    271:      190,   191,   192,   197,   199,   200,   201,   202,   203,   204,
                    272:      206,   208,   210,   212,   214,   215,   216,   217,   218,   219,
                    273:      221,   222,   224,   225,   227,   229,   230,   232,   233,   235,
                    274:      236,   237,   239,   241,   247,   257,   259,   261,   263
                    275: };
                    276: #endif
                    277:
                    278:
                    279: #if (YYDEBUG) || defined YYERROR_VERBOSE
                    280:
                    281: /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
                    282: static const char *const yytname[] =
                    283: {
                    284:   "$", "error", "$undefined.", "EOS", "BAD", "HELP", "HEX", "DECIMAL",
                    285:   "QUIT", "ABS", "BIN", "FIB", "GCD", "KRON", "LCM", "LUCNUM",
                    286:   "NEXTPRIME", "POWM", "ROOT", "SQRT", "NUMBER", "VARIABLE", "LOR",
                    287:   "LAND", "'<'", "'>'", "EQ", "NE", "LE", "GE", "LSHIFT", "RSHIFT", "'+'",
                    288:   "'-'", "'*'", "'/'", "'%'", "UMINUS", "'^'", "'!'", "'='", "'('", "')'",
                    289:   "','", "top", "statements", "statement", "e", "gcdlist", "lcmlist", 0
                    290: };
                    291: #endif
                    292:
                    293: /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
                    294: static const short yyr1[] =
                    295: {
                    296:        0,    44,    44,    45,    45,    45,    46,    46,    46,    46,
                    297:       46,    46,    46,    47,    47,    47,    47,    47,    47,    47,
                    298:       47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
                    299:       47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
                    300:       47,    47,    47,    47,    47,    48,    48,    49,    49
                    301: };
                    302:
                    303: /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
                    304: static const short yyr2[] =
                    305: {
                    306:        0,     1,     2,     2,     3,     2,     0,     1,     3,     1,
                    307:        1,     1,     1,     3,     3,     3,     3,     3,     3,     3,
                    308:        3,     3,     2,     2,     3,     3,     3,     3,     3,     3,
                    309:        3,     3,     4,     6,     4,     4,     6,     4,     4,     4,
                    310:        8,     6,     4,     1,     1,     1,     3,     1,     3
                    311: };
                    312:
                    313: /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
                    314:    doesn't specify something else to do.  Zero means the default is an
                    315:    error. */
                    316: static const short yydefact[] =
                    317: {
                    318:        0,     0,     9,    10,    11,    12,     0,     0,     0,     0,
                    319:        0,     0,     0,     0,     0,     0,     0,    44,    43,     0,
                    320:        0,     6,     1,     7,     5,     0,     0,     0,     0,     0,
                    321:        0,     0,     0,     0,     0,     0,     0,    43,    23,     0,
                    322:        2,     3,     0,     0,     0,     0,     0,     0,     0,     0,
                    323:        0,     0,     0,     0,     0,     0,     0,     0,    22,     0,
                    324:        0,     0,    45,     0,     0,    47,     0,     0,     0,     0,
                    325:        0,     0,     8,    13,     4,    31,    30,    24,    29,    26,
                    326:       27,    25,    28,    20,    21,    14,    15,    16,    17,    18,
                    327:       19,    32,     0,    34,    35,     0,     0,    37,     0,    38,
                    328:       39,     0,     0,    42,     0,    46,     0,    48,     0,     0,
                    329:       33,    36,     0,    41,     0,    40,     0,     0,     0
                    330: };
                    331:
                    332: static const short yydefgoto[] =
                    333: {
                    334:      116,    21,    22,    23,    63,    66
                    335: };
                    336:
                    337: static const short yypact[] =
                    338: {
                    339:       39,    17,-32768,-32768,-32768,-32768,   -20,     0,     2,    25,
                    340:       28,    30,    33,    34,    37,    40,    46,-32768,   -18,   122,
                    341:      122,    89,    67,   462,-32768,   122,   122,   122,   122,   122,
                    342:      122,   122,   122,   122,   122,   122,   122,-32768,   -36,   252,
                    343:       87,-32768,   122,   122,   122,   122,   122,   122,   122,   122,
                    344:      122,   122,   122,   122,   122,   122,   122,   122,-32768,   273,
                    345:      142,   294,   462,   -38,   164,   462,   -24,   315,   336,   186,
                    346:      208,   357,   462,-32768,-32768,   479,   495,   511,   511,   511,
                    347:      511,   511,   511,    29,    29,    50,    50,   -36,   -36,   -36,
                    348:      -36,-32768,   122,-32768,-32768,   122,   122,-32768,   122,-32768,
                    349:   -32768,   122,   122,-32768,   378,   462,   399,   462,   230,   420,
                    350:   -32768,-32768,   122,-32768,   441,-32768,    91,    92,-32768
                    351: };
                    352:
                    353: static const short yypgoto[] =
                    354: {
                    355:   -32768,-32768,    90,   -19,-32768,-32768
                    356: };
                    357:
                    358:
                    359: #define        YYLAST          550
                    360:
                    361:
                    362: static const short yytable[] =
                    363: {
                    364:       38,    39,    57,    58,    94,    95,    59,    60,    61,    62,
                    365:       64,    65,    67,    68,    69,    70,    71,    72,    97,    98,
                    366:       24,    25,    36,    75,    76,    77,    78,    79,    80,    81,
                    367:       82,    83,    84,    85,    86,    87,    88,    89,    90,    -6,
                    368:        1,    26,    -6,    27,     2,     3,     4,     5,     6,     7,
                    369:        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
                    370:       18,    52,    53,    54,    55,    56,    28,    57,    58,    29,
                    371:       41,    30,    19,   104,    31,    32,   105,   106,    33,   107,
                    372:       20,    34,   108,   109,    54,    55,    56,    35,    57,    58,
                    373:       74,   117,   118,   114,     2,     3,     4,     5,     6,     7,
                    374:        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
                    375:       18,    40,     0,     0,     0,     0,     0,     0,     0,     0,
                    376:        0,     0,    19,     0,     0,     0,     0,     0,     0,     0,
                    377:       20,     6,     7,     8,     9,    10,    11,    12,    13,    14,
                    378:       15,    16,    17,    37,     0,     0,     0,     0,     0,     0,
                    379:        0,     0,     0,     0,     0,    19,     0,     0,     0,     0,
                    380:        0,     0,     0,    20,    42,    43,    44,    45,    46,    47,
                    381:       48,    49,    50,    51,    52,    53,    54,    55,    56,     0,
                    382:       57,    58,     0,     0,     0,    92,    42,    43,    44,    45,
                    383:       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
                    384:       56,     0,    57,    58,     0,     0,     0,    96,    42,    43,
                    385:       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
                    386:       54,    55,    56,     0,    57,    58,     0,     0,     0,   101,
                    387:       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
                    388:       52,    53,    54,    55,    56,     0,    57,    58,     0,     0,
                    389:        0,   102,    42,    43,    44,    45,    46,    47,    48,    49,
                    390:       50,    51,    52,    53,    54,    55,    56,     0,    57,    58,
                    391:        0,     0,     0,   112,    42,    43,    44,    45,    46,    47,
                    392:       48,    49,    50,    51,    52,    53,    54,    55,    56,     0,
                    393:       57,    58,     0,     0,    73,    42,    43,    44,    45,    46,
                    394:       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
                    395:        0,    57,    58,     0,     0,    91,    42,    43,    44,    45,
                    396:       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
                    397:       56,     0,    57,    58,     0,     0,    93,    42,    43,    44,
                    398:       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
                    399:       55,    56,     0,    57,    58,     0,     0,    99,    42,    43,
                    400:       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
                    401:       54,    55,    56,     0,    57,    58,     0,     0,   100,    42,
                    402:       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
                    403:       53,    54,    55,    56,     0,    57,    58,     0,     0,   103,
                    404:       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
                    405:       52,    53,    54,    55,    56,     0,    57,    58,     0,     0,
                    406:      110,    42,    43,    44,    45,    46,    47,    48,    49,    50,
                    407:       51,    52,    53,    54,    55,    56,     0,    57,    58,     0,
                    408:        0,   111,    42,    43,    44,    45,    46,    47,    48,    49,
                    409:       50,    51,    52,    53,    54,    55,    56,     0,    57,    58,
                    410:        0,     0,   113,    42,    43,    44,    45,    46,    47,    48,
                    411:       49,    50,    51,    52,    53,    54,    55,    56,     0,    57,
                    412:       58,     0,     0,   115,    42,    43,    44,    45,    46,    47,
                    413:       48,    49,    50,    51,    52,    53,    54,    55,    56,     0,
                    414:       57,    58,    43,    44,    45,    46,    47,    48,    49,    50,
                    415:       51,    52,    53,    54,    55,    56,     0,    57,    58,    44,
                    416:       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
                    417:       55,    56,     0,    57,    58,-32768,-32768,-32768,-32768,-32768,
                    418:   -32768,    50,    51,    52,    53,    54,    55,    56,     0,    57,
                    419:       58
                    420: };
                    421:
                    422: static const short yycheck[] =
                    423: {
                    424:       19,    20,    38,    39,    42,    43,    25,    26,    27,    28,
                    425:       29,    30,    31,    32,    33,    34,    35,    36,    42,    43,
                    426:        3,    41,    40,    42,    43,    44,    45,    46,    47,    48,
                    427:       49,    50,    51,    52,    53,    54,    55,    56,    57,     0,
                    428:        1,    41,     3,    41,     5,     6,     7,     8,     9,    10,
                    429:       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
                    430:       21,    32,    33,    34,    35,    36,    41,    38,    39,    41,
                    431:        3,    41,    33,    92,    41,    41,    95,    96,    41,    98,
                    432:       41,    41,   101,   102,    34,    35,    36,    41,    38,    39,
                    433:        3,     0,     0,   112,     5,     6,     7,     8,     9,    10,
                    434:       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
                    435:       21,    21,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
                    436:       -1,    -1,    33,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
                    437:       41,     9,    10,    11,    12,    13,    14,    15,    16,    17,
                    438:       18,    19,    20,    21,    -1,    -1,    -1,    -1,    -1,    -1,
                    439:       -1,    -1,    -1,    -1,    -1,    33,    -1,    -1,    -1,    -1,
                    440:       -1,    -1,    -1,    41,    22,    23,    24,    25,    26,    27,
                    441:       28,    29,    30,    31,    32,    33,    34,    35,    36,    -1,
                    442:       38,    39,    -1,    -1,    -1,    43,    22,    23,    24,    25,
                    443:       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
                    444:       36,    -1,    38,    39,    -1,    -1,    -1,    43,    22,    23,
                    445:       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
                    446:       34,    35,    36,    -1,    38,    39,    -1,    -1,    -1,    43,
                    447:       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
                    448:       32,    33,    34,    35,    36,    -1,    38,    39,    -1,    -1,
                    449:       -1,    43,    22,    23,    24,    25,    26,    27,    28,    29,
                    450:       30,    31,    32,    33,    34,    35,    36,    -1,    38,    39,
                    451:       -1,    -1,    -1,    43,    22,    23,    24,    25,    26,    27,
                    452:       28,    29,    30,    31,    32,    33,    34,    35,    36,    -1,
                    453:       38,    39,    -1,    -1,    42,    22,    23,    24,    25,    26,
                    454:       27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
                    455:       -1,    38,    39,    -1,    -1,    42,    22,    23,    24,    25,
                    456:       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
                    457:       36,    -1,    38,    39,    -1,    -1,    42,    22,    23,    24,
                    458:       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
                    459:       35,    36,    -1,    38,    39,    -1,    -1,    42,    22,    23,
                    460:       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
                    461:       34,    35,    36,    -1,    38,    39,    -1,    -1,    42,    22,
                    462:       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
                    463:       33,    34,    35,    36,    -1,    38,    39,    -1,    -1,    42,
                    464:       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
                    465:       32,    33,    34,    35,    36,    -1,    38,    39,    -1,    -1,
                    466:       42,    22,    23,    24,    25,    26,    27,    28,    29,    30,
                    467:       31,    32,    33,    34,    35,    36,    -1,    38,    39,    -1,
                    468:       -1,    42,    22,    23,    24,    25,    26,    27,    28,    29,
                    469:       30,    31,    32,    33,    34,    35,    36,    -1,    38,    39,
                    470:       -1,    -1,    42,    22,    23,    24,    25,    26,    27,    28,
                    471:       29,    30,    31,    32,    33,    34,    35,    36,    -1,    38,
                    472:       39,    -1,    -1,    42,    22,    23,    24,    25,    26,    27,
                    473:       28,    29,    30,    31,    32,    33,    34,    35,    36,    -1,
                    474:       38,    39,    23,    24,    25,    26,    27,    28,    29,    30,
                    475:       31,    32,    33,    34,    35,    36,    -1,    38,    39,    24,
                    476:       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
                    477:       35,    36,    -1,    38,    39,    24,    25,    26,    27,    28,
                    478:       29,    30,    31,    32,    33,    34,    35,    36,    -1,    38,
                    479:       39
                    480: };
                    481: /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
                    482: #line 3 "/usr/share/bison/bison.simple"
                    483:
                    484: /* Skeleton output parser for bison,
                    485:
                    486:    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
                    487:    Foundation, Inc.
                    488:
                    489:    This program is free software; you can redistribute it and/or modify
                    490:    it under the terms of the GNU General Public License as published by
                    491:    the Free Software Foundation; either version 2, or (at your option)
                    492:    any later version.
                    493:
                    494:    This program is distributed in the hope that it will be useful,
                    495:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                    496:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    497:    GNU General Public License for more details.
                    498:
                    499:    You should have received a copy of the GNU General Public License
                    500:    along with this program; if not, write to the Free Software
                    501:    Foundation, Inc., 59 Temple Place - Suite 330,
                    502:    Boston, MA 02111-1307, USA.  */
                    503:
                    504: /* As a special exception, when this file is copied by Bison into a
                    505:    Bison output file, you may use that output file without restriction.
                    506:    This special exception was added by the Free Software Foundation
                    507:    in version 1.24 of Bison.  */
                    508:
                    509: /* This is the parser code that is written into each bison parser when
                    510:    the %semantic_parser declaration is not specified in the grammar.
                    511:    It was written by Richard Stallman by simplifying the hairy parser
                    512:    used when %semantic_parser is specified.  */
                    513:
                    514: /* All symbols defined below should begin with yy or YY, to avoid
                    515:    infringing on user name space.  This should be done even for local
                    516:    variables, as they might otherwise be expanded by user macros.
                    517:    There are some unavoidable exceptions within include files to
                    518:    define necessary library symbols; they are noted "INFRINGES ON
                    519:    USER NAME SPACE" below.  */
                    520:
                    521: #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
                    522:
                    523: /* The parser invokes alloca or malloc; define the necessary symbols.  */
                    524:
                    525: # if YYSTACK_USE_ALLOCA
                    526: #  define YYSTACK_ALLOC alloca
                    527: # else
                    528: #  ifndef YYSTACK_USE_ALLOCA
                    529: #   if defined (alloca) || defined (_ALLOCA_H)
                    530: #    define YYSTACK_ALLOC alloca
                    531: #   else
                    532: #    ifdef __GNUC__
                    533: #     define YYSTACK_ALLOC __builtin_alloca
                    534: #    endif
                    535: #   endif
                    536: #  endif
                    537: # endif
                    538:
                    539: # ifdef YYSTACK_ALLOC
                    540:    /* Pacify GCC's `empty if-body' warning. */
                    541: #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
                    542: # else
                    543: #  if defined (__STDC__) || defined (__cplusplus)
                    544: #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
                    545: #   define YYSIZE_T size_t
                    546: #  endif
                    547: #  define YYSTACK_ALLOC malloc
                    548: #  define YYSTACK_FREE free
                    549: # endif
                    550:
                    551: /* A type that is properly aligned for any stack member.  */
                    552: union yyalloc
                    553: {
                    554:   short yyss;
                    555:   YYSTYPE yyvs;
                    556: # if YYLSP_NEEDED
                    557:   YYLTYPE yyls;
                    558: # endif
                    559: };
                    560:
                    561: /* The size of the maximum gap between one aligned stack and the next.  */
                    562: # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
                    563:
                    564: /* The size of an array large to enough to hold all stacks, each with
                    565:    N elements.  */
                    566: # if YYLSP_NEEDED
                    567: #  define YYSTACK_BYTES(N) \
                    568:      ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))     \
                    569:       + 2 * YYSTACK_GAP_MAX)
                    570: # else
                    571: #  define YYSTACK_BYTES(N) \
                    572:      ((N) * (sizeof (short) + sizeof (YYSTYPE))                                \
                    573:       + YYSTACK_GAP_MAX)
                    574: # endif
                    575:
                    576: /* Relocate the TYPE STACK from its old location to the new one.  The
                    577:    local variables YYSIZE and YYSTACKSIZE give the old and new number of
                    578:    elements in the stack, and YYPTR gives the new location of the
                    579:    stack.  Advance YYPTR to a properly aligned location for the next
                    580:    stack.  */
                    581: # define YYSTACK_RELOCATE(Type, Stack)                                 \
                    582:     do                                                                 \
                    583:       {                                                                        \
                    584:        YYSIZE_T yynewbytes;                                            \
                    585:        yymemcpy ((char *) yyptr, (char *) (Stack),                     \
                    586:                  yysize * (YYSIZE_T) sizeof (Type));                   \
                    587:        Stack = &yyptr->Stack;                                          \
                    588:        yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX;     \
                    589:        yyptr += yynewbytes / sizeof (*yyptr);                          \
                    590:       }                                                                        \
                    591:     while (0)
                    592:
                    593: #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
                    594:
                    595:
                    596: #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
                    597: # define YYSIZE_T __SIZE_TYPE__
                    598: #endif
                    599: #if ! defined (YYSIZE_T) && defined (size_t)
                    600: # define YYSIZE_T size_t
                    601: #endif
                    602: #if ! defined (YYSIZE_T)
                    603: # if defined (__STDC__) || defined (__cplusplus)
                    604: #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
                    605: #  define YYSIZE_T size_t
                    606: # endif
                    607: #endif
                    608: #if ! defined (YYSIZE_T)
                    609: # define YYSIZE_T unsigned int
                    610: #endif
                    611:
                    612: #define yyerrok                (yyerrstatus = 0)
                    613: #define yyclearin      (yychar = YYEMPTY)
                    614: #define YYEMPTY                -2
                    615: #define YYEOF          0
                    616: #define YYACCEPT       goto yyacceptlab
                    617: #define YYABORT        goto yyabortlab
                    618: #define YYERROR                goto yyerrlab1
                    619: /* Like YYERROR except do call yyerror.  This remains here temporarily
                    620:    to ease the transition to the new meaning of YYERROR, for GCC.
                    621:    Once GCC version 2 has supplanted version 1, this can go.  */
                    622: #define YYFAIL         goto yyerrlab
                    623: #define YYRECOVERING()  (!!yyerrstatus)
                    624: #define YYBACKUP(Token, Value)                                 \
                    625: do                                                             \
                    626:   if (yychar == YYEMPTY && yylen == 1)                         \
                    627:     {                                                          \
                    628:       yychar = (Token);                                                \
                    629:       yylval = (Value);                                                \
                    630:       yychar1 = YYTRANSLATE (yychar);                          \
                    631:       YYPOPSTACK;                                              \
                    632:       goto yybackup;                                           \
                    633:     }                                                          \
                    634:   else                                                         \
                    635:     {                                                          \
                    636:       yyerror ("syntax error: cannot back up");                        \
                    637:       YYERROR;                                                 \
                    638:     }                                                          \
                    639: while (0)
                    640:
                    641: #define YYTERROR       1
                    642: #define YYERRCODE      256
                    643:
                    644:
                    645: /* YYLLOC_DEFAULT -- Compute the default location (before the actions
                    646:    are run).
                    647:
                    648:    When YYLLOC_DEFAULT is run, CURRENT is set the location of the
                    649:    first token.  By default, to implement support for ranges, extend
                    650:    its range to the last symbol.  */
                    651:
                    652: #ifndef YYLLOC_DEFAULT
                    653: # define YYLLOC_DEFAULT(Current, Rhs, N)               \
                    654:    Current.last_line   = Rhs[N].last_line;     \
                    655:    Current.last_column = Rhs[N].last_column;
                    656: #endif
                    657:
                    658:
                    659: /* YYLEX -- calling `yylex' with the right arguments.  */
                    660:
                    661: #if YYPURE
                    662: # if YYLSP_NEEDED
                    663: #  ifdef YYLEX_PARAM
                    664: #   define YYLEX               yylex (&yylval, &yylloc, YYLEX_PARAM)
                    665: #  else
                    666: #   define YYLEX               yylex (&yylval, &yylloc)
                    667: #  endif
                    668: # else /* !YYLSP_NEEDED */
                    669: #  ifdef YYLEX_PARAM
                    670: #   define YYLEX               yylex (&yylval, YYLEX_PARAM)
                    671: #  else
                    672: #   define YYLEX               yylex (&yylval)
                    673: #  endif
                    674: # endif /* !YYLSP_NEEDED */
                    675: #else /* !YYPURE */
                    676: # define YYLEX                 yylex ()
                    677: #endif /* !YYPURE */
                    678:
                    679:
                    680: /* Enable debugging if requested.  */
                    681: #if YYDEBUG
                    682:
                    683: # ifndef YYFPRINTF
                    684: #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
                    685: #  define YYFPRINTF fprintf
                    686: # endif
                    687:
                    688: # define YYDPRINTF(Args)                       \
                    689: do {                                           \
                    690:   if (yydebug)                                 \
                    691:     YYFPRINTF Args;                            \
                    692: } while (0)
                    693: /* Nonzero means print parse trace.  It is left uninitialized so that
                    694:    multiple parsers can coexist.  */
                    695: int yydebug;
                    696: #else /* !YYDEBUG */
                    697: # define YYDPRINTF(Args)
                    698: #endif /* !YYDEBUG */
                    699:
                    700: /* YYINITDEPTH -- initial size of the parser's stacks.  */
                    701: #ifndef        YYINITDEPTH
                    702: # define YYINITDEPTH 200
                    703: #endif
                    704:
                    705: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
                    706:    if the built-in stack extension method is used).
                    707:
                    708:    Do not make this value too large; the results are undefined if
                    709:    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
                    710:    evaluated with infinite-precision integer arithmetic.  */
                    711:
                    712: #if YYMAXDEPTH == 0
                    713: # undef YYMAXDEPTH
                    714: #endif
                    715:
                    716: #ifndef YYMAXDEPTH
                    717: # define YYMAXDEPTH 10000
                    718: #endif
                    719: 
                    720: #if ! defined (yyoverflow) && ! defined (yymemcpy)
                    721: # if __GNUC__ > 1              /* GNU C and GNU C++ define this.  */
                    722: #  define yymemcpy __builtin_memcpy
                    723: # else                         /* not GNU C or C++ */
                    724:
                    725: /* This is the most reliable way to avoid incompatibilities
                    726:    in available built-in functions on various systems.  */
                    727: static void
                    728: #  if defined (__STDC__) || defined (__cplusplus)
                    729: yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
                    730: #  else
                    731: yymemcpy (yyto, yyfrom, yycount)
                    732:      char *yyto;
                    733:      const char *yyfrom;
                    734:      YYSIZE_T yycount;
                    735: #  endif
                    736: {
                    737:   register const char *yyf = yyfrom;
                    738:   register char *yyt = yyto;
                    739:   register YYSIZE_T yyi = yycount;
                    740:
                    741:   while (yyi-- != 0)
                    742:     *yyt++ = *yyf++;
                    743: }
                    744: # endif
                    745: #endif
                    746:
                    747: #ifdef YYERROR_VERBOSE
                    748:
                    749: # ifndef yystrlen
                    750: #  if defined (__GLIBC__) && defined (_STRING_H)
                    751: #   define yystrlen strlen
                    752: #  else
                    753: /* Return the length of YYSTR.  */
                    754: static YYSIZE_T
                    755: #   if defined (__STDC__) || defined (__cplusplus)
                    756: yystrlen (const char *yystr)
                    757: #   else
                    758: yystrlen (yystr)
                    759:      const char *yystr;
                    760: #   endif
                    761: {
                    762:   register const char *yys = yystr;
                    763:
                    764:   while (*yys++ != '\0')
                    765:     continue;
                    766:
                    767:   return yys - yystr - 1;
                    768: }
                    769: #  endif
                    770: # endif
                    771:
                    772: # ifndef yystpcpy
                    773: #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
                    774: #   define yystpcpy stpcpy
                    775: #  else
                    776: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
                    777:    YYDEST.  */
                    778: static char *
                    779: #   if defined (__STDC__) || defined (__cplusplus)
                    780: yystpcpy (char *yydest, const char *yysrc)
                    781: #   else
                    782: yystpcpy (yydest, yysrc)
                    783:      char *yydest;
                    784:      const char *yysrc;
                    785: #   endif
                    786: {
                    787:   register char *yyd = yydest;
                    788:   register const char *yys = yysrc;
                    789:
                    790:   while ((*yyd++ = *yys++) != '\0')
                    791:     continue;
                    792:
                    793:   return yyd - 1;
                    794: }
                    795: #  endif
                    796: # endif
                    797: #endif
                    798: 
                    799: #line 319 "/usr/share/bison/bison.simple"
                    800:
                    801:
                    802: /* The user can define YYPARSE_PARAM as the name of an argument to be passed
                    803:    into yyparse.  The argument should have type void *.
                    804:    It should actually point to an object.
                    805:    Grammar actions can access the variable by casting it
                    806:    to the proper pointer type.  */
                    807:
                    808: #ifdef YYPARSE_PARAM
                    809: # if defined (__STDC__) || defined (__cplusplus)
                    810: #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
                    811: #  define YYPARSE_PARAM_DECL
                    812: # else
                    813: #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
                    814: #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
                    815: # endif
                    816: #else /* !YYPARSE_PARAM */
                    817: # define YYPARSE_PARAM_ARG
                    818: # define YYPARSE_PARAM_DECL
                    819: #endif /* !YYPARSE_PARAM */
                    820:
                    821: /* Prevent warning if -Wstrict-prototypes.  */
                    822: #ifdef __GNUC__
                    823: # ifdef YYPARSE_PARAM
                    824: int yyparse (void *);
                    825: # else
                    826: int yyparse (void);
                    827: # endif
                    828: #endif
                    829:
                    830: /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
                    831:    variables are global, or local to YYPARSE.  */
                    832:
                    833: #define YY_DECL_NON_LSP_VARIABLES                      \
                    834: /* The lookahead symbol.  */                           \
                    835: int yychar;                                            \
                    836:                                                        \
                    837: /* The semantic value of the lookahead symbol. */      \
                    838: YYSTYPE yylval;                                                \
                    839:                                                        \
                    840: /* Number of parse errors so far.  */                  \
                    841: int yynerrs;
                    842:
                    843: #if YYLSP_NEEDED
                    844: # define YY_DECL_VARIABLES                     \
                    845: YY_DECL_NON_LSP_VARIABLES                      \
                    846:                                                \
                    847: /* Location data for the lookahead symbol.  */ \
                    848: YYLTYPE yylloc;
                    849: #else
                    850: # define YY_DECL_VARIABLES                     \
                    851: YY_DECL_NON_LSP_VARIABLES
                    852: #endif
                    853:
                    854:
                    855: /* If nonreentrant, generate the variables here. */
                    856:
                    857: #if !YYPURE
                    858: YY_DECL_VARIABLES
                    859: #endif  /* !YYPURE */
                    860:
                    861: int
                    862: yyparse (YYPARSE_PARAM_ARG)
                    863:      YYPARSE_PARAM_DECL
                    864: {
                    865:   /* If reentrant, generate the variables here. */
                    866: #if YYPURE
                    867:   YY_DECL_VARIABLES
                    868: #endif  /* !YYPURE */
                    869:
                    870:   register int yystate;
                    871:   register int yyn;
                    872:   int yyresult;
                    873:   /* Number of tokens to shift before error messages enabled.  */
                    874:   int yyerrstatus;
                    875:   /* Lookahead token as an internal (translated) token number.  */
                    876:   int yychar1 = 0;
                    877:
                    878:   /* Three stacks and their tools:
                    879:      `yyss': related to states,
                    880:      `yyvs': related to semantic values,
                    881:      `yyls': related to locations.
                    882:
                    883:      Refer to the stacks thru separate pointers, to allow yyoverflow
                    884:      to reallocate them elsewhere.  */
                    885:
                    886:   /* The state stack. */
                    887:   short        yyssa[YYINITDEPTH];
                    888:   short *yyss = yyssa;
                    889:   register short *yyssp;
                    890:
                    891:   /* The semantic value stack.  */
                    892:   YYSTYPE yyvsa[YYINITDEPTH];
                    893:   YYSTYPE *yyvs = yyvsa;
                    894:   register YYSTYPE *yyvsp;
                    895:
                    896: #if YYLSP_NEEDED
                    897:   /* The location stack.  */
                    898:   YYLTYPE yylsa[YYINITDEPTH];
                    899:   YYLTYPE *yyls = yylsa;
                    900:   YYLTYPE *yylsp;
                    901: #endif
                    902:
                    903: #if YYLSP_NEEDED
                    904: # define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
                    905: #else
                    906: # define YYPOPSTACK   (yyvsp--, yyssp--)
                    907: #endif
                    908:
                    909:   YYSIZE_T yystacksize = YYINITDEPTH;
                    910:
                    911:
                    912:   /* The variables used to return semantic value and location from the
                    913:      action routines.  */
                    914:   YYSTYPE yyval;
                    915: #if YYLSP_NEEDED
                    916:   YYLTYPE yyloc;
                    917: #endif
                    918:
                    919:   /* When reducing, the number of symbols on the RHS of the reduced
                    920:      rule. */
                    921:   int yylen;
                    922:
                    923:   YYDPRINTF ((stderr, "Starting parse\n"));
                    924:
                    925:   yystate = 0;
                    926:   yyerrstatus = 0;
                    927:   yynerrs = 0;
                    928:   yychar = YYEMPTY;            /* Cause a token to be read.  */
                    929:
                    930:   /* Initialize stack pointers.
                    931:      Waste one element of value and location stack
                    932:      so that they stay on the same level as the state stack.
                    933:      The wasted elements are never initialized.  */
                    934:
                    935:   yyssp = yyss;
                    936:   yyvsp = yyvs;
                    937: #if YYLSP_NEEDED
                    938:   yylsp = yyls;
                    939: #endif
                    940:   goto yysetstate;
                    941:
                    942: /*------------------------------------------------------------.
                    943: | yynewstate -- Push a new state, which is found in yystate.  |
                    944: `------------------------------------------------------------*/
                    945:  yynewstate:
                    946:   /* In all cases, when you get here, the value and location stacks
                    947:      have just been pushed. so pushing a state here evens the stacks.
                    948:      */
                    949:   yyssp++;
                    950:
                    951:  yysetstate:
                    952:   *yyssp = yystate;
                    953:
                    954:   if (yyssp >= yyss + yystacksize - 1)
                    955:     {
                    956:       /* Get the current used size of the three stacks, in elements.  */
                    957:       YYSIZE_T yysize = yyssp - yyss + 1;
                    958:
                    959: #ifdef yyoverflow
                    960:       {
                    961:        /* Give user a chance to reallocate the stack. Use copies of
                    962:           these so that the &'s don't force the real ones into
                    963:           memory.  */
                    964:        YYSTYPE *yyvs1 = yyvs;
                    965:        short *yyss1 = yyss;
                    966:
                    967:        /* Each stack pointer address is followed by the size of the
                    968:           data in use in that stack, in bytes.  */
                    969: # if YYLSP_NEEDED
                    970:        YYLTYPE *yyls1 = yyls;
                    971:        /* This used to be a conditional around just the two extra args,
                    972:           but that might be undefined if yyoverflow is a macro.  */
                    973:        yyoverflow ("parser stack overflow",
                    974:                    &yyss1, yysize * sizeof (*yyssp),
                    975:                    &yyvs1, yysize * sizeof (*yyvsp),
                    976:                    &yyls1, yysize * sizeof (*yylsp),
                    977:                    &yystacksize);
                    978:        yyls = yyls1;
                    979: # else
                    980:        yyoverflow ("parser stack overflow",
                    981:                    &yyss1, yysize * sizeof (*yyssp),
                    982:                    &yyvs1, yysize * sizeof (*yyvsp),
                    983:                    &yystacksize);
                    984: # endif
                    985:        yyss = yyss1;
                    986:        yyvs = yyvs1;
                    987:       }
                    988: #else /* no yyoverflow */
                    989:       /* Extend the stack our own way.  */
                    990:       if (yystacksize >= YYMAXDEPTH)
                    991:        goto yyoverflowlab;
                    992:       yystacksize *= 2;
                    993:       if (yystacksize > YYMAXDEPTH)
                    994:        yystacksize = YYMAXDEPTH;
                    995:
                    996:       {
                    997:        short *yyss1 = yyss;
                    998:        union yyalloc *yyptr =
                    999:          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
                   1000:        if (! yyptr)
                   1001:          goto yyoverflowlab;
                   1002:        YYSTACK_RELOCATE (short, yyss);
                   1003:        YYSTACK_RELOCATE (YYSTYPE, yyvs);
                   1004: # if YYLSP_NEEDED
                   1005:        YYSTACK_RELOCATE (YYLTYPE, yyls);
                   1006: # endif
                   1007: # undef YYSTACK_RELOCATE
                   1008:        if (yyss1 != yyssa)
                   1009:          YYSTACK_FREE (yyss1);
                   1010:       }
                   1011: #endif /* no yyoverflow */
                   1012:
                   1013:       yyssp = yyss + yysize - 1;
                   1014:       yyvsp = yyvs + yysize - 1;
                   1015: #if YYLSP_NEEDED
                   1016:       yylsp = yyls + yysize - 1;
                   1017: #endif
                   1018:
                   1019:       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                   1020:                  (unsigned long int) yystacksize));
                   1021:
                   1022:       if (yyssp >= yyss + yystacksize - 1)
                   1023:        YYABORT;
                   1024:     }
                   1025:
                   1026:   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
                   1027:
                   1028:   goto yybackup;
                   1029:
                   1030:
                   1031: /*-----------.
                   1032: | yybackup.  |
                   1033: `-----------*/
                   1034: yybackup:
                   1035:
                   1036: /* Do appropriate processing given the current state.  */
                   1037: /* Read a lookahead token if we need one and don't already have one.  */
                   1038: /* yyresume: */
                   1039:
                   1040:   /* First try to decide what to do without reference to lookahead token.  */
                   1041:
                   1042:   yyn = yypact[yystate];
                   1043:   if (yyn == YYFLAG)
                   1044:     goto yydefault;
                   1045:
                   1046:   /* Not known => get a lookahead token if don't already have one.  */
                   1047:
                   1048:   /* yychar is either YYEMPTY or YYEOF
                   1049:      or a valid token in external form.  */
                   1050:
                   1051:   if (yychar == YYEMPTY)
                   1052:     {
                   1053:       YYDPRINTF ((stderr, "Reading a token: "));
                   1054:       yychar = YYLEX;
                   1055:     }
                   1056:
                   1057:   /* Convert token to internal form (in yychar1) for indexing tables with */
                   1058:
                   1059:   if (yychar <= 0)             /* This means end of input. */
                   1060:     {
                   1061:       yychar1 = 0;
                   1062:       yychar = YYEOF;          /* Don't call YYLEX any more */
                   1063:
                   1064:       YYDPRINTF ((stderr, "Now at end of input.\n"));
                   1065:     }
                   1066:   else
                   1067:     {
                   1068:       yychar1 = YYTRANSLATE (yychar);
                   1069:
                   1070: #if YYDEBUG
                   1071:      /* We have to keep this `#if YYDEBUG', since we use variables
                   1072:        which are defined only if `YYDEBUG' is set.  */
                   1073:       if (yydebug)
                   1074:        {
                   1075:          YYFPRINTF (stderr, "Next token is %d (%s",
                   1076:                     yychar, yytname[yychar1]);
                   1077:          /* Give the individual parser a way to print the precise
                   1078:             meaning of a token, for further debugging info.  */
                   1079: # ifdef YYPRINT
                   1080:          YYPRINT (stderr, yychar, yylval);
                   1081: # endif
                   1082:          YYFPRINTF (stderr, ")\n");
                   1083:        }
                   1084: #endif
                   1085:     }
                   1086:
                   1087:   yyn += yychar1;
                   1088:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
                   1089:     goto yydefault;
                   1090:
                   1091:   yyn = yytable[yyn];
                   1092:
                   1093:   /* yyn is what to do for this token type in this state.
                   1094:      Negative => reduce, -yyn is rule number.
                   1095:      Positive => shift, yyn is new state.
                   1096:        New state is final state => don't bother to shift,
                   1097:        just return success.
                   1098:      0, or most negative number => error.  */
                   1099:
                   1100:   if (yyn < 0)
                   1101:     {
                   1102:       if (yyn == YYFLAG)
                   1103:        goto yyerrlab;
                   1104:       yyn = -yyn;
                   1105:       goto yyreduce;
                   1106:     }
                   1107:   else if (yyn == 0)
                   1108:     goto yyerrlab;
                   1109:
                   1110:   if (yyn == YYFINAL)
                   1111:     YYACCEPT;
                   1112:
                   1113:   /* Shift the lookahead token.  */
                   1114:   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
                   1115:              yychar, yytname[yychar1]));
                   1116:
                   1117:   /* Discard the token being shifted unless it is eof.  */
                   1118:   if (yychar != YYEOF)
                   1119:     yychar = YYEMPTY;
                   1120:
                   1121:   *++yyvsp = yylval;
                   1122: #if YYLSP_NEEDED
                   1123:   *++yylsp = yylloc;
                   1124: #endif
                   1125:
                   1126:   /* Count tokens shifted since error; after three, turn off error
                   1127:      status.  */
                   1128:   if (yyerrstatus)
                   1129:     yyerrstatus--;
                   1130:
                   1131:   yystate = yyn;
                   1132:   goto yynewstate;
                   1133:
                   1134:
                   1135: /*-----------------------------------------------------------.
                   1136: | yydefault -- do the default action for the current state.  |
                   1137: `-----------------------------------------------------------*/
                   1138: yydefault:
                   1139:   yyn = yydefact[yystate];
                   1140:   if (yyn == 0)
                   1141:     goto yyerrlab;
                   1142:   goto yyreduce;
                   1143:
                   1144:
                   1145: /*-----------------------------.
                   1146: | yyreduce -- Do a reduction.  |
                   1147: `-----------------------------*/
                   1148: yyreduce:
                   1149:   /* yyn is the number of a rule to reduce with.  */
                   1150:   yylen = yyr2[yyn];
                   1151:
                   1152:   /* If YYLEN is nonzero, implement the default value of the action:
                   1153:      `$$ = $1'.
                   1154:
                   1155:      Otherwise, the following line sets YYVAL to the semantic value of
                   1156:      the lookahead token.  This behavior is undocumented and Bison
                   1157:      users should not rely upon it.  Assigning to YYVAL
                   1158:      unconditionally makes the parser a bit smaller, and it avoids a
                   1159:      GCC warning that YYVAL may be used uninitialized.  */
                   1160:   yyval = yyvsp[1-yylen];
                   1161:
                   1162: #if YYLSP_NEEDED
                   1163:   /* Similarly for the default location.  Let the user run additional
                   1164:      commands if for instance locations are ranges.  */
                   1165:   yyloc = yylsp[1-yylen];
                   1166:   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
                   1167: #endif
                   1168:
                   1169: #if YYDEBUG
                   1170:   /* We have to keep this `#if YYDEBUG', since we use variables which
                   1171:      are defined only if `YYDEBUG' is set.  */
                   1172:   if (yydebug)
                   1173:     {
                   1174:       int yyi;
                   1175:
                   1176:       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
                   1177:                 yyn, yyrline[yyn]);
                   1178:
                   1179:       /* Print the symbols being reduced, and their result.  */
                   1180:       for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
                   1181:        YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
                   1182:       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
                   1183:     }
                   1184: #endif
                   1185:
                   1186:   switch (yyn) {
                   1187:
                   1188: case 5:
                   1189: #line 174 "calc.y"
                   1190: { sp = stack[0]; yyerrok; }
                   1191:     break;
                   1192: case 7:
                   1193: #line 178 "calc.y"
                   1194: {
                   1195:       mpz_out_str (stdout, obase, sp); putchar ('\n');
                   1196:       sp--;
                   1197:       CHECK_EMPTY ();
                   1198:     }
                   1199:     break;
                   1200: case 8:
                   1201: #line 183 "calc.y"
                   1202: {
                   1203:       CHECK_VARIABLE (yyvsp[-2].var);
                   1204:       mpz_swap (variable[yyvsp[-2].var], sp);
                   1205:       sp--;
                   1206:       CHECK_EMPTY ();
                   1207:     }
                   1208:     break;
                   1209: case 9:
                   1210: #line 189 "calc.y"
                   1211: { calc_help (); }
                   1212:     break;
                   1213: case 10:
                   1214: #line 190 "calc.y"
                   1215: { ibase = 16; obase = -16; }
                   1216:     break;
                   1217: case 11:
                   1218: #line 191 "calc.y"
                   1219: { ibase = 0;  obase = 10; }
                   1220:     break;
                   1221: case 12:
                   1222: #line 192 "calc.y"
                   1223: { exit (0); }
                   1224:     break;
                   1225: case 14:
                   1226: #line 199 "calc.y"
                   1227: { sp--; mpz_add    (sp, sp, sp+1); }
                   1228:     break;
                   1229: case 15:
                   1230: #line 200 "calc.y"
                   1231: { sp--; mpz_sub    (sp, sp, sp+1); }
                   1232:     break;
                   1233: case 16:
                   1234: #line 201 "calc.y"
                   1235: { sp--; mpz_mul    (sp, sp, sp+1); }
                   1236:     break;
                   1237: case 17:
                   1238: #line 202 "calc.y"
                   1239: { sp--; mpz_fdiv_q (sp, sp, sp+1); }
                   1240:     break;
                   1241: case 18:
                   1242: #line 203 "calc.y"
                   1243: { sp--; mpz_fdiv_r (sp, sp, sp+1); }
                   1244:     break;
                   1245: case 19:
                   1246: #line 204 "calc.y"
                   1247: { CHECK_UI ("Exponent", sp);
                   1248:                      sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }
                   1249:     break;
                   1250: case 20:
                   1251: #line 206 "calc.y"
                   1252: { CHECK_UI ("Shift count", sp);
                   1253:                      sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }
                   1254:     break;
                   1255: case 21:
                   1256: #line 208 "calc.y"
                   1257: { CHECK_UI ("Shift count", sp);
                   1258:                      sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }
                   1259:     break;
                   1260: case 22:
                   1261: #line 210 "calc.y"
                   1262: { CHECK_UI ("Factorial", sp);
                   1263:                      mpz_fac_ui (sp, mpz_get_ui (sp)); }
                   1264:     break;
                   1265: case 23:
                   1266: #line 212 "calc.y"
                   1267: { mpz_neg (sp, sp); }
                   1268:     break;
                   1269: case 24:
                   1270: #line 214 "calc.y"
                   1271: { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <  0); }
                   1272:     break;
                   1273: case 25:
                   1274: #line 215 "calc.y"
                   1275: { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }
                   1276:     break;
                   1277: case 26:
                   1278: #line 216 "calc.y"
                   1279: { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }
                   1280:     break;
                   1281: case 27:
                   1282: #line 217 "calc.y"
                   1283: { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }
                   1284:     break;
                   1285: case 28:
                   1286: #line 218 "calc.y"
                   1287: { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }
                   1288:     break;
                   1289: case 29:
                   1290: #line 219 "calc.y"
                   1291: { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >  0); }
                   1292:     break;
                   1293: case 30:
                   1294: #line 221 "calc.y"
                   1295: { sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }
                   1296:     break;
                   1297: case 31:
                   1298: #line 222 "calc.y"
                   1299: { sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }
                   1300:     break;
                   1301: case 32:
                   1302: #line 224 "calc.y"
                   1303: { mpz_abs (sp, sp); }
                   1304:     break;
                   1305: case 33:
                   1306: #line 225 "calc.y"
                   1307: { sp--; CHECK_UI ("Binomial base", sp+1);
                   1308:                                     mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }
                   1309:     break;
                   1310: case 34:
                   1311: #line 227 "calc.y"
                   1312: { CHECK_UI ("Fibonacci", sp);
                   1313:                                     mpz_fib_ui (sp, mpz_get_ui (sp)); }
                   1314:     break;
                   1315: case 36:
                   1316: #line 230 "calc.y"
                   1317: { sp--; mpz_set_si (sp,
                   1318:                                           mpz_kronecker (sp, sp+1)); }
                   1319:     break;
                   1320: case 38:
                   1321: #line 233 "calc.y"
                   1322: { CHECK_UI ("Lucas number", sp);
                   1323:                                     mpz_lucnum_ui (sp, mpz_get_ui (sp)); }
                   1324:     break;
                   1325: case 39:
                   1326: #line 235 "calc.y"
                   1327: { mpz_nextprime (sp, sp); }
                   1328:     break;
                   1329: case 40:
                   1330: #line 236 "calc.y"
                   1331: { sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }
                   1332:     break;
                   1333: case 41:
                   1334: #line 237 "calc.y"
                   1335: { sp--; CHECK_UI ("Nth-root", sp+1);
                   1336:                                     mpz_root (sp, sp, mpz_get_ui (sp+1)); }
                   1337:     break;
                   1338: case 42:
                   1339: #line 239 "calc.y"
                   1340: { mpz_sqrt (sp, sp); }
                   1341:     break;
                   1342: case 43:
                   1343: #line 241 "calc.y"
                   1344: {
                   1345:         sp++;
                   1346:         CHECK_OVERFLOW ();
                   1347:         CHECK_VARIABLE (yyvsp[0].var);
                   1348:         mpz_set (sp, variable[yyvsp[0].var]);
                   1349:       }
                   1350:     break;
                   1351: case 44:
                   1352: #line 247 "calc.y"
                   1353: {
                   1354:         sp++;
                   1355:         CHECK_OVERFLOW ();
                   1356:         if (mpz_set_str (sp, yyvsp[0].str, ibase) != 0)
                   1357:           {
                   1358:             fprintf (stderr, "Invalid number: %s\n", yyvsp[0].str);
                   1359:             YYERROR;
                   1360:           }
                   1361:       }
                   1362:     break;
                   1363: case 46:
                   1364: #line 259 "calc.y"
                   1365: { sp--; mpz_gcd (sp, sp, sp+1); }
                   1366:     break;
                   1367: case 48:
                   1368: #line 263 "calc.y"
                   1369: { sp--; mpz_lcm (sp, sp, sp+1); }
                   1370:     break;
                   1371: }
                   1372:
                   1373: #line 705 "/usr/share/bison/bison.simple"
                   1374:
                   1375: 
                   1376:   yyvsp -= yylen;
                   1377:   yyssp -= yylen;
                   1378: #if YYLSP_NEEDED
                   1379:   yylsp -= yylen;
                   1380: #endif
                   1381:
                   1382: #if YYDEBUG
                   1383:   if (yydebug)
                   1384:     {
                   1385:       short *yyssp1 = yyss - 1;
                   1386:       YYFPRINTF (stderr, "state stack now");
                   1387:       while (yyssp1 != yyssp)
                   1388:        YYFPRINTF (stderr, " %d", *++yyssp1);
                   1389:       YYFPRINTF (stderr, "\n");
                   1390:     }
                   1391: #endif
                   1392:
                   1393:   *++yyvsp = yyval;
                   1394: #if YYLSP_NEEDED
                   1395:   *++yylsp = yyloc;
                   1396: #endif
                   1397:
                   1398:   /* Now `shift' the result of the reduction.  Determine what state
                   1399:      that goes to, based on the state we popped back to and the rule
                   1400:      number reduced by.  */
                   1401:
                   1402:   yyn = yyr1[yyn];
                   1403:
                   1404:   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
                   1405:   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
                   1406:     yystate = yytable[yystate];
                   1407:   else
                   1408:     yystate = yydefgoto[yyn - YYNTBASE];
                   1409:
                   1410:   goto yynewstate;
                   1411:
                   1412:
                   1413: /*------------------------------------.
                   1414: | yyerrlab -- here on detecting error |
                   1415: `------------------------------------*/
                   1416: yyerrlab:
                   1417:   /* If not already recovering from an error, report this error.  */
                   1418:   if (!yyerrstatus)
                   1419:     {
                   1420:       ++yynerrs;
                   1421:
                   1422: #ifdef YYERROR_VERBOSE
                   1423:       yyn = yypact[yystate];
                   1424:
                   1425:       if (yyn > YYFLAG && yyn < YYLAST)
                   1426:        {
                   1427:          YYSIZE_T yysize = 0;
                   1428:          char *yymsg;
                   1429:          int yyx, yycount;
                   1430:
                   1431:          yycount = 0;
                   1432:          /* Start YYX at -YYN if negative to avoid negative indexes in
                   1433:             YYCHECK.  */
                   1434:          for (yyx = yyn < 0 ? -yyn : 0;
                   1435:               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
                   1436:            if (yycheck[yyx + yyn] == yyx)
                   1437:              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
                   1438:          yysize += yystrlen ("parse error, unexpected ") + 1;
                   1439:          yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
                   1440:          yymsg = (char *) YYSTACK_ALLOC (yysize);
                   1441:          if (yymsg != 0)
                   1442:            {
                   1443:              char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
                   1444:              yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
                   1445:
                   1446:              if (yycount < 5)
                   1447:                {
                   1448:                  yycount = 0;
                   1449:                  for (yyx = yyn < 0 ? -yyn : 0;
                   1450:                       yyx < (int) (sizeof (yytname) / sizeof (char *));
                   1451:                       yyx++)
                   1452:                    if (yycheck[yyx + yyn] == yyx)
                   1453:                      {
                   1454:                        const char *yyq = ! yycount ? ", expecting " : " or ";
                   1455:                        yyp = yystpcpy (yyp, yyq);
                   1456:                        yyp = yystpcpy (yyp, yytname[yyx]);
                   1457:                        yycount++;
                   1458:                      }
                   1459:                }
                   1460:              yyerror (yymsg);
                   1461:              YYSTACK_FREE (yymsg);
                   1462:            }
                   1463:          else
                   1464:            yyerror ("parse error; also virtual memory exhausted");
                   1465:        }
                   1466:       else
                   1467: #endif /* defined (YYERROR_VERBOSE) */
                   1468:        yyerror ("parse error");
                   1469:     }
                   1470:   goto yyerrlab1;
                   1471:
                   1472:
                   1473: /*--------------------------------------------------.
                   1474: | yyerrlab1 -- error raised explicitly by an action |
                   1475: `--------------------------------------------------*/
                   1476: yyerrlab1:
                   1477:   if (yyerrstatus == 3)
                   1478:     {
                   1479:       /* If just tried and failed to reuse lookahead token after an
                   1480:         error, discard it.  */
                   1481:
                   1482:       /* return failure if at end of input */
                   1483:       if (yychar == YYEOF)
                   1484:        YYABORT;
                   1485:       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
                   1486:                  yychar, yytname[yychar1]));
                   1487:       yychar = YYEMPTY;
                   1488:     }
                   1489:
                   1490:   /* Else will try to reuse lookahead token after shifting the error
                   1491:      token.  */
                   1492:
                   1493:   yyerrstatus = 3;             /* Each real token shifted decrements this */
                   1494:
                   1495:   goto yyerrhandle;
                   1496:
                   1497:
                   1498: /*-------------------------------------------------------------------.
                   1499: | yyerrdefault -- current state does not do anything special for the |
                   1500: | error token.                                                       |
                   1501: `-------------------------------------------------------------------*/
                   1502: yyerrdefault:
                   1503: #if 0
                   1504:   /* This is wrong; only states that explicitly want error tokens
                   1505:      should shift them.  */
                   1506:
                   1507:   /* If its default is to accept any token, ok.  Otherwise pop it.  */
                   1508:   yyn = yydefact[yystate];
                   1509:   if (yyn)
                   1510:     goto yydefault;
                   1511: #endif
                   1512:
                   1513:
                   1514: /*---------------------------------------------------------------.
                   1515: | yyerrpop -- pop the current state because it cannot handle the |
                   1516: | error token                                                    |
                   1517: `---------------------------------------------------------------*/
                   1518: yyerrpop:
                   1519:   if (yyssp == yyss)
                   1520:     YYABORT;
                   1521:   yyvsp--;
                   1522:   yystate = *--yyssp;
                   1523: #if YYLSP_NEEDED
                   1524:   yylsp--;
                   1525: #endif
                   1526:
                   1527: #if YYDEBUG
                   1528:   if (yydebug)
                   1529:     {
                   1530:       short *yyssp1 = yyss - 1;
                   1531:       YYFPRINTF (stderr, "Error: state stack now");
                   1532:       while (yyssp1 != yyssp)
                   1533:        YYFPRINTF (stderr, " %d", *++yyssp1);
                   1534:       YYFPRINTF (stderr, "\n");
                   1535:     }
                   1536: #endif
                   1537:
                   1538: /*--------------.
                   1539: | yyerrhandle.  |
                   1540: `--------------*/
                   1541: yyerrhandle:
                   1542:   yyn = yypact[yystate];
                   1543:   if (yyn == YYFLAG)
                   1544:     goto yyerrdefault;
                   1545:
                   1546:   yyn += YYTERROR;
                   1547:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
                   1548:     goto yyerrdefault;
                   1549:
                   1550:   yyn = yytable[yyn];
                   1551:   if (yyn < 0)
                   1552:     {
                   1553:       if (yyn == YYFLAG)
                   1554:        goto yyerrpop;
                   1555:       yyn = -yyn;
                   1556:       goto yyreduce;
                   1557:     }
                   1558:   else if (yyn == 0)
                   1559:     goto yyerrpop;
                   1560:
                   1561:   if (yyn == YYFINAL)
                   1562:     YYACCEPT;
                   1563:
                   1564:   YYDPRINTF ((stderr, "Shifting error token, "));
                   1565:
                   1566:   *++yyvsp = yylval;
                   1567: #if YYLSP_NEEDED
                   1568:   *++yylsp = yylloc;
                   1569: #endif
                   1570:
                   1571:   yystate = yyn;
                   1572:   goto yynewstate;
                   1573:
                   1574:
                   1575: /*-------------------------------------.
                   1576: | yyacceptlab -- YYACCEPT comes here.  |
                   1577: `-------------------------------------*/
                   1578: yyacceptlab:
                   1579:   yyresult = 0;
                   1580:   goto yyreturn;
                   1581:
                   1582: /*-----------------------------------.
                   1583: | yyabortlab -- YYABORT comes here.  |
                   1584: `-----------------------------------*/
                   1585: yyabortlab:
                   1586:   yyresult = 1;
                   1587:   goto yyreturn;
                   1588:
                   1589: /*---------------------------------------------.
                   1590: | yyoverflowab -- parser overflow comes here.  |
                   1591: `---------------------------------------------*/
                   1592: yyoverflowlab:
                   1593:   yyerror ("parser stack overflow");
                   1594:   yyresult = 2;
                   1595:   /* Fall through.  */
                   1596:
                   1597: yyreturn:
                   1598: #ifndef yyoverflow
                   1599:   if (yyss != yyssa)
                   1600:     YYSTACK_FREE (yyss);
                   1601: #endif
                   1602:   return yyresult;
                   1603: }
                   1604: #line 265 "calc.y"
                   1605:
                   1606:
                   1607: yyerror (char *s)
                   1608: {
                   1609:   fprintf (stderr, "%s\n", s);
                   1610: }
                   1611:
                   1612: int calc_option_readline = -1;
                   1613:
                   1614: int
                   1615: main (int argc, char *argv[])
                   1616: {
                   1617:   int  i;
                   1618:
                   1619:   for (i = 1; i < argc; i++)
                   1620:     {
                   1621:       if (strcmp (argv[i], "--readline") == 0)
                   1622:         calc_option_readline = 1;
                   1623:       else if (strcmp (argv[i], "--noreadline") == 0)
                   1624:         calc_option_readline = 0;
                   1625:       else if (strcmp (argv[i], "--help") == 0)
                   1626:         {
                   1627:           printf ("Usage: calc [--option]...\n");
                   1628:           printf ("  --readline    use readline\n");
                   1629:           printf ("  --noreadline  don't use readline\n");
                   1630:           printf ("  --help        this message\n");
                   1631:           printf ("Readline is only available when compiled in,\n");
                   1632:           printf ("and in that case it's the default on a tty.\n");
                   1633:           exit (0);
                   1634:         }
                   1635:       else
                   1636:         {
                   1637:           fprintf (stderr, "Unrecognised option: %s\n", argv[i]);
                   1638:           exit (1);
                   1639:         }
                   1640:     }
                   1641:
                   1642: #if WITH_READLINE
                   1643:   calc_init_readline ();
                   1644: #else
                   1645:   if (calc_option_readline == 1)
                   1646:     {
                   1647:       fprintf (stderr, "Readline support not available\n");
                   1648:       exit (1);
                   1649:     }
                   1650: #endif
                   1651:
                   1652:   for (i = 0; i < numberof (variable); i++)
                   1653:     mpz_init (variable[i]);
                   1654:
                   1655:   for (i = 0; i < numberof (stack); i++)
                   1656:     mpz_init (stack[i]);
                   1657:
                   1658:   return yyparse ();
                   1659: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>