Annotation of GNUtools/cc/cexp.c, revision 1.1.1.1

1.1       root        1: 
                      2: /*  A Bison parser, made from cexp.y  */
                      3: 
                      4: #define YYBISON 1  /* Identify Bison output.  */
                      5: 
                      6: #define        INT     258
                      7: #define        CHAR    259
                      8: #define        NAME    260
                      9: #define        ERROR   261
                     10: #define        OR      262
                     11: #define        AND     263
                     12: #define        EQUAL   264
                     13: #define        NOTEQUAL        265
                     14: #define        LEQ     266
                     15: #define        GEQ     267
                     16: #define        LSH     268
                     17: #define        RSH     269
                     18: #define        UNARY   270
                     19: 
                     20: #line 26 "cexp.y"
                     21: 
                     22: #include "config.h"
                     23: #include <setjmp.h>
                     24: /* #define YYDEBUG 1 */
                     25: 
                     26: #ifdef MULTIBYTE_CHARS
                     27: #include <stdlib.h>
                     28: #include <locale.h>
                     29: #endif
                     30: 
                     31: #include <stdio.h>
                     32: 
                     33: typedef unsigned char U_CHAR;
                     34: 
                     35: /* This is used for communicating lists of keywords with cccp.c.  */
                     36: struct arglist {
                     37:   struct arglist *next;
                     38:   U_CHAR *name;
                     39:   int length;
                     40:   int argno;
                     41: };
                     42: 
                     43: /* Define a generic NULL if one hasn't already been defined.  */
                     44: 
                     45: #ifndef NULL
                     46: #define NULL 0
                     47: #endif
                     48: 
                     49: #ifndef GENERIC_PTR
                     50: #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
                     51: #define GENERIC_PTR void *
                     52: #else
                     53: #define GENERIC_PTR char *
                     54: #endif
                     55: #endif
                     56: 
                     57: #ifndef NULL_PTR
                     58: #define NULL_PTR ((GENERIC_PTR)0)
                     59: #endif
                     60: 
                     61: int yylex ();
                     62: void yyerror ();
                     63: int expression_value;
                     64: 
                     65: static jmp_buf parse_return_error;
                     66: 
                     67: /* Nonzero means count most punctuation as part of a name.  */
                     68: static int keyword_parsing = 0;
                     69: 
                     70: /* some external tables of character types */
                     71: extern unsigned char is_idstart[], is_idchar[], is_hor_space[];
                     72: 
                     73: extern char *xmalloc ();
                     74: 
                     75: /* Flag for -pedantic.  */
                     76: extern int pedantic;
                     77: 
                     78: /* Flag for -traditional.  */
                     79: extern int traditional;
                     80: 
                     81: #ifndef CHAR_TYPE_SIZE
                     82: #define CHAR_TYPE_SIZE BITS_PER_UNIT
                     83: #endif
                     84: 
                     85: #ifndef INT_TYPE_SIZE
                     86: #define INT_TYPE_SIZE BITS_PER_WORD
                     87: #endif
                     88: 
                     89: #ifndef LONG_TYPE_SIZE
                     90: #define LONG_TYPE_SIZE BITS_PER_WORD
                     91: #endif
                     92: 
                     93: #ifndef WCHAR_TYPE_SIZE
                     94: #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
                     95: #endif
                     96: 
                     97: #ifndef MAX_CHAR_TYPE_SIZE
                     98: #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
                     99: #endif
                    100: 
                    101: #ifndef MAX_INT_TYPE_SIZE
                    102: #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
                    103: #endif
                    104: 
                    105: #ifndef MAX_LONG_TYPE_SIZE
                    106: #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
                    107: #endif
                    108: 
                    109: #ifndef MAX_WCHAR_TYPE_SIZE
                    110: #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
                    111: #endif
                    112: 
                    113: /* Yield nonzero if adding two numbers with A's and B's signs can yield a
                    114:    number with SUM's sign, where A, B, and SUM are all C integers.  */
                    115: #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
                    116: 
                    117: static void integer_overflow ();
                    118: static long left_shift ();
                    119: static long right_shift ();
                    120: 
                    121: #line 127 "cexp.y"
                    122: typedef union {
                    123:   struct constant {long value; int unsignedp;} integer;
                    124:   struct name {U_CHAR *address; int length;} name;
                    125:   struct arglist *keywords;
                    126:   int voidval;
                    127:   char *sval;
                    128: } YYSTYPE;
                    129: 
                    130: #ifndef YYLTYPE
                    131: typedef
                    132:   struct yyltype
                    133:     {
                    134:       int timestamp;
                    135:       int first_line;
                    136:       int first_column;
                    137:       int last_line;
                    138:       int last_column;
                    139:       char *text;
                    140:    }
                    141:   yyltype;
                    142: 
                    143: #define YYLTYPE yyltype
                    144: #endif
                    145: 
                    146: #include <stdio.h>
                    147: 
                    148: #ifndef __STDC__
                    149: #define const
                    150: #endif
                    151: 
                    152: 
                    153: 
                    154: #define        YYFINAL         73
                    155: #define        YYFLAG          -32768
                    156: #define        YYNTBASE        34
                    157: 
                    158: #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 39)
                    159: 
                    160: static const char yytranslate[] = {     0,
                    161:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    162:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    163:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    164:      2,     2,    29,     2,    31,     2,    27,    14,     2,    32,
                    165:     33,    25,    23,     9,    24,     2,    26,     2,     2,     2,
                    166:      2,     2,     2,     2,     2,     2,     2,     8,     2,    17,
                    167:      2,    18,     7,     2,     2,     2,     2,     2,     2,     2,
                    168:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    169:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    170:      2,     2,     2,    13,     2,     2,     2,     2,     2,     2,
                    171:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    172:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    173:      2,     2,     2,    12,     2,    30,     2,     2,     2,     2,
                    174:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    175:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    176:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    177:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    178:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    179:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    180:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    181:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    182:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    183:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    184:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    185:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    186:      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
                    187:      6,    10,    11,    15,    16,    19,    20,    21,    22,    28
                    188: };
                    189: 
                    190: static const short yyprhs[] = {     0,
                    191:      0,     2,     4,     8,    11,    14,    17,    20,    23,    24,
                    192:     31,    35,    39,    43,    47,    51,    55,    59,    63,    67,
                    193:     71,    75,    79,    83,    87,    91,    95,    99,   103,   107,
                    194:    113,   115,   117,   119,   120,   125
                    195: };
                    196: 
                    197: static const short yyrhs[] = {    35,
                    198:      0,    36,     0,    35,     9,    36,     0,    24,    36,     0,
                    199:     29,    36,     0,    23,    36,     0,    30,    36,     0,    31,
                    200:      5,     0,     0,    31,     5,    37,    32,    38,    33,     0,
                    201:     32,    35,    33,     0,    36,    25,    36,     0,    36,    26,
                    202:     36,     0,    36,    27,    36,     0,    36,    23,    36,     0,
                    203:     36,    24,    36,     0,    36,    21,    36,     0,    36,    22,
                    204:     36,     0,    36,    15,    36,     0,    36,    16,    36,     0,
                    205:     36,    19,    36,     0,    36,    20,    36,     0,    36,    17,
                    206:     36,     0,    36,    18,    36,     0,    36,    14,    36,     0,
                    207:     36,    13,    36,     0,    36,    12,    36,     0,    36,    11,
                    208:     36,     0,    36,    10,    36,     0,    36,     7,    36,     8,
                    209:     36,     0,     3,     0,     4,     0,     5,     0,     0,    32,
                    210:     38,    33,    38,     0,     5,    38,     0
                    211: };
                    212: 
                    213: #if YYDEBUG != 0
                    214: static const short yyrline[] = { 0,
                    215:    159,   164,   165,   172,   177,   180,   182,   185,   189,   191,
                    216:    196,   201,   213,   228,   239,   246,   253,   259,   265,   268,
                    217:    271,   277,   283,   289,   295,   298,   301,   304,   307,   310,
                    218:    313,   315,   317,   322,   324,   337
                    219: };
                    220: 
                    221: static const char * const yytname[] = {   "$","error","$illegal.","INT","CHAR",
                    222: "NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
                    223: "'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
                    224: "'~'","'#'","'('","')'","start","exp1","exp","@1","keywords",""
                    225: };
                    226: #endif
                    227: 
                    228: static const short yyr1[] = {     0,
                    229:     34,    35,    35,    36,    36,    36,    36,    36,    37,    36,
                    230:     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
                    231:     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
                    232:     36,    36,    36,    38,    38,    38
                    233: };
                    234: 
                    235: static const short yyr2[] = {     0,
                    236:      1,     1,     3,     2,     2,     2,     2,     2,     0,     6,
                    237:      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
                    238:      3,     3,     3,     3,     3,     3,     3,     3,     3,     5,
                    239:      1,     1,     1,     0,     4,     2
                    240: };
                    241: 
                    242: static const short yydefact[] = {     0,
                    243:     31,    32,    33,     0,     0,     0,     0,     0,     0,     1,
                    244:      2,     6,     4,     5,     7,     8,     0,     0,     0,     0,
                    245:      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
                    246:      0,     0,     0,     0,     0,     0,     0,     0,    11,     3,
                    247:      0,    29,    28,    27,    26,    25,    19,    20,    23,    24,
                    248:     21,    22,    17,    18,    15,    16,    12,    13,    14,    34,
                    249:      0,    34,    34,     0,    30,    36,     0,    10,    34,    35,
                    250:      0,     0,     0
                    251: };
                    252: 
                    253: static const short yydefgoto[] = {    71,
                    254:     10,    11,    38,    64
                    255: };
                    256: 
                    257: static const short yypact[] = {    31,
                    258: -32768,-32768,-32768,    31,    31,    31,    31,     4,    31,     3,
                    259:     80,-32768,-32768,-32768,-32768,     6,    32,    31,    31,    31,
                    260:     31,    31,    31,    31,    31,    31,    31,    31,    31,    31,
                    261:     31,    31,    31,    31,    31,    31,    31,     7,-32768,    80,
                    262:     59,    97,   113,   128,   142,   155,    25,    25,   162,   162,
                    263:    162,   162,   167,   167,   -19,   -19,-32768,-32768,-32768,     5,
                    264:     31,     5,     5,   -20,    80,-32768,    20,-32768,     5,-32768,
                    265:     40,    56,-32768
                    266: };
                    267: 
                    268: static const short yypgoto[] = {-32768,
                    269:     49,    -4,-32768,   -58
                    270: };
                    271: 
                    272: 
                    273: #define        YYLAST          194
                    274: 
                    275: 
                    276: static const short yytable[] = {    12,
                    277:     13,    14,    15,    66,    67,    35,    36,    37,    16,    62,
                    278:     70,    18,    68,    40,    41,    42,    43,    44,    45,    46,
                    279:     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
                    280:     57,    58,    59,     1,     2,     3,    63,    -9,    60,    72,
                    281:     18,    27,    28,    29,    30,    31,    32,    33,    34,    35,
                    282:     36,    37,    69,     4,     5,    73,    65,    17,     0,     6,
                    283:      7,     8,     9,     0,    39,    19,    61,     0,    20,    21,
                    284:     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
                    285:     32,    33,    34,    35,    36,    37,    19,     0,     0,    20,
                    286:     21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
                    287:     31,    32,    33,    34,    35,    36,    37,    21,    22,    23,
                    288:     24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
                    289:     34,    35,    36,    37,    22,    23,    24,    25,    26,    27,
                    290:     28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
                    291:     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
                    292:     33,    34,    35,    36,    37,    24,    25,    26,    27,    28,
                    293:     29,    30,    31,    32,    33,    34,    35,    36,    37,    25,
                    294:     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
                    295:     36,    37,    31,    32,    33,    34,    35,    36,    37,    33,
                    296:     34,    35,    36,    37
                    297: };
                    298: 
                    299: static const short yycheck[] = {     4,
                    300:      5,     6,     7,    62,    63,    25,    26,    27,     5,     5,
                    301:     69,     9,    33,    18,    19,    20,    21,    22,    23,    24,
                    302:     25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
                    303:     35,    36,    37,     3,     4,     5,    32,    32,    32,     0,
                    304:      9,    17,    18,    19,    20,    21,    22,    23,    24,    25,
                    305:     26,    27,    33,    23,    24,     0,    61,     9,    -1,    29,
                    306:     30,    31,    32,    -1,    33,     7,     8,    -1,    10,    11,
                    307:     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
                    308:     22,    23,    24,    25,    26,    27,     7,    -1,    -1,    10,
                    309:     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
                    310:     21,    22,    23,    24,    25,    26,    27,    11,    12,    13,
                    311:     14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
                    312:     24,    25,    26,    27,    12,    13,    14,    15,    16,    17,
                    313:     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
                    314:     13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
                    315:     23,    24,    25,    26,    27,    14,    15,    16,    17,    18,
                    316:     19,    20,    21,    22,    23,    24,    25,    26,    27,    15,
                    317:     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
                    318:     26,    27,    21,    22,    23,    24,    25,    26,    27,    23,
                    319:     24,    25,    26,    27
                    320: };
                    321: /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
                    322: #line 3 "bison.simple"
                    323: 
                    324: /* Skeleton output parser for bison,
                    325:    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
                    326: 
                    327:    This program is free software; you can redistribute it and/or modify
                    328:    it under the terms of the GNU General Public License as published by
                    329:    the Free Software Foundation; either version 1, or (at your option)
                    330:    any later version.
                    331: 
                    332:    This program is distributed in the hope that it will be useful,
                    333:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                    334:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    335:    GNU General Public License for more details.
                    336: 
                    337:    You should have received a copy of the GNU General Public License
                    338:    along with this program; if not, write to the Free Software
                    339:    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
                    340: 
                    341: 
                    342: #ifndef alloca
                    343: #ifdef __GNUC__
                    344: #define alloca __builtin_alloca
                    345: #else /* not GNU C.  */
                    346: #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
                    347: #include <alloca.h>
                    348: #else /* not sparc */
                    349: #if defined (MSDOS) && !defined (__TURBOC__)
                    350: #include <malloc.h>
                    351: #else /* not MSDOS, or __TURBOC__ */
                    352: #if defined(_AIX)
                    353: #include <malloc.h>
                    354:  #pragma alloca
                    355: #endif /* not _AIX */
                    356: #endif /* not MSDOS, or __TURBOC__ */
                    357: #endif /* not sparc.  */
                    358: #endif /* not GNU C.  */
                    359: #endif /* alloca not defined.  */
                    360: 
                    361: /* This is the parser code that is written into each bison parser
                    362:   when the %semantic_parser declaration is not specified in the grammar.
                    363:   It was written by Richard Stallman by simplifying the hairy parser
                    364:   used when %semantic_parser is specified.  */
                    365: 
                    366: /* Note: there must be only one dollar sign in this file.
                    367:    It is replaced by the list of actions, each action
                    368:    as one case of the switch.  */
                    369: 
                    370: #define yyerrok                (yyerrstatus = 0)
                    371: #define yyclearin      (yychar = YYEMPTY)
                    372: #define YYEMPTY                -2
                    373: #define YYEOF          0
                    374: #define YYACCEPT       return(0)
                    375: #define YYABORT        return(1)
                    376: #define YYERROR                goto yyerrlab1
                    377: /* Like YYERROR except do call yyerror.
                    378:    This remains here temporarily to ease the
                    379:    transition to the new meaning of YYERROR, for GCC.
                    380:    Once GCC version 2 has supplanted version 1, this can go.  */
                    381: #define YYFAIL         goto yyerrlab
                    382: #define YYRECOVERING()  (!!yyerrstatus)
                    383: #define YYBACKUP(token, value) \
                    384: do                                                             \
                    385:   if (yychar == YYEMPTY && yylen == 1)                         \
                    386:     { yychar = (token), yylval = (value);                      \
                    387:       yychar1 = YYTRANSLATE (yychar);                          \
                    388:       YYPOPSTACK;                                              \
                    389:       goto yybackup;                                           \
                    390:     }                                                          \
                    391:   else                                                         \
                    392:     { yyerror ("syntax error: cannot back up"); YYERROR; }     \
                    393: while (0)
                    394: 
                    395: #define YYTERROR       1
                    396: #define YYERRCODE      256
                    397: 
                    398: #ifndef YYPURE
                    399: #define YYLEX          yylex()
                    400: #endif
                    401: 
                    402: #ifdef YYPURE
                    403: #ifdef YYLSP_NEEDED
                    404: #define YYLEX          yylex(&yylval, &yylloc)
                    405: #else
                    406: #define YYLEX          yylex(&yylval)
                    407: #endif
                    408: #endif
                    409: 
                    410: /* If nonreentrant, generate the variables here */
                    411: 
                    412: #ifndef YYPURE
                    413: 
                    414: int    yychar;                 /*  the lookahead symbol                */
                    415: YYSTYPE        yylval;                 /*  the semantic value of the           */
                    416:                                /*  lookahead symbol                    */
                    417: 
                    418: #ifdef YYLSP_NEEDED
                    419: YYLTYPE yylloc;                        /*  location data for the lookahead     */
                    420:                                /*  symbol                              */
                    421: #endif
                    422: 
                    423: int yynerrs;                   /*  number of parse errors so far       */
                    424: #endif  /* not YYPURE */
                    425: 
                    426: #if YYDEBUG != 0
                    427: int yydebug;                   /*  nonzero means print parse trace     */
                    428: /* Since this is uninitialized, it does not stop multiple parsers
                    429:    from coexisting.  */
                    430: #endif
                    431: 
                    432: /*  YYINITDEPTH indicates the initial size of the parser's stacks      */
                    433: 
                    434: #ifndef        YYINITDEPTH
                    435: #define YYINITDEPTH 200
                    436: #endif
                    437: 
                    438: /*  YYMAXDEPTH is the maximum size the stacks can grow to
                    439:     (effective only if the built-in stack extension method is used).  */
                    440: 
                    441: #if YYMAXDEPTH == 0
                    442: #undef YYMAXDEPTH
                    443: #endif
                    444: 
                    445: #ifndef YYMAXDEPTH
                    446: #define YYMAXDEPTH 10000
                    447: #endif
                    448: 
                    449: #if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
                    450: #define __yy_bcopy(FROM,TO,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
                    451: #else                          /* not GNU C or C++ */
                    452: #ifndef __cplusplus
                    453: 
                    454: /* This is the most reliable way to avoid incompatibilities
                    455:    in available built-in functions on various systems.  */
                    456: static void
                    457: __yy_bcopy (from, to, count)
                    458:      char *from;
                    459:      char *to;
                    460:      int count;
                    461: {
                    462:   register char *f = from;
                    463:   register char *t = to;
                    464:   register int i = count;
                    465: 
                    466:   while (i-- > 0)
                    467:     *t++ = *f++;
                    468: }
                    469: 
                    470: #else /* __cplusplus */
                    471: 
                    472: /* This is the most reliable way to avoid incompatibilities
                    473:    in available built-in functions on various systems.  */
                    474: static void
                    475: __yy_bcopy (char *from, char *to, int count)
                    476: {
                    477:   register char *f = from;
                    478:   register char *t = to;
                    479:   register int i = count;
                    480: 
                    481:   while (i-- > 0)
                    482:     *t++ = *f++;
                    483: }
                    484: 
                    485: #endif
                    486: #endif
                    487: 
                    488: #line 169 "bison.simple"
                    489: int
                    490: yyparse()
                    491: {
                    492:   register int yystate;
                    493:   register int yyn;
                    494:   register short *yyssp;
                    495:   register YYSTYPE *yyvsp;
                    496:   int yyerrstatus;     /*  number of tokens to shift before error messages enabled */
                    497:   int yychar1;         /*  lookahead token as an internal (translated) token number */
                    498: 
                    499:   short        yyssa[YYINITDEPTH];     /*  the state stack                     */
                    500:   YYSTYPE yyvsa[YYINITDEPTH];  /*  the semantic value stack            */
                    501: 
                    502:   short *yyss = yyssa;         /*  refer to the stacks thru separate pointers */
                    503:   YYSTYPE *yyvs = yyvsa;       /*  to allow yyoverflow to reallocate them elsewhere */
                    504: 
                    505: #ifdef YYLSP_NEEDED
                    506:   YYLTYPE yylsa[YYINITDEPTH];  /*  the location stack                  */
                    507:   YYLTYPE *yyls = yylsa;
                    508:   YYLTYPE *yylsp;
                    509: 
                    510: #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
                    511: #else
                    512: #define YYPOPSTACK   (yyvsp--, yyssp--)
                    513: #endif
                    514: 
                    515:   int yystacksize = YYINITDEPTH;
                    516: 
                    517: #ifdef YYPURE
                    518:   int yychar;
                    519:   YYSTYPE yylval;
                    520:   int yynerrs;
                    521: #ifdef YYLSP_NEEDED
                    522:   YYLTYPE yylloc;
                    523: #endif
                    524: #endif
                    525: 
                    526:   YYSTYPE yyval;               /*  the variable used to return         */
                    527:                                /*  semantic values from the action     */
                    528:                                /*  routines                            */
                    529: 
                    530:   int yylen;
                    531: 
                    532: #if YYDEBUG != 0
                    533:   if (yydebug)
                    534:     fprintf(stderr, "Starting parse\n");
                    535: #endif
                    536: 
                    537:   yystate = 0;
                    538:   yyerrstatus = 0;
                    539:   yynerrs = 0;
                    540:   yychar = YYEMPTY;            /* Cause a token to be read.  */
                    541: 
                    542:   /* Initialize stack pointers.
                    543:      Waste one element of value and location stack
                    544:      so that they stay on the same level as the state stack.  */
                    545: 
                    546:   yyssp = yyss - 1;
                    547:   yyvsp = yyvs;
                    548: #ifdef YYLSP_NEEDED
                    549:   yylsp = yyls;
                    550: #endif
                    551: 
                    552: /* Push a new state, which is found in  yystate  .  */
                    553: /* In all cases, when you get here, the value and location stacks
                    554:    have just been pushed. so pushing a state here evens the stacks.  */
                    555: yynewstate:
                    556: 
                    557:   *++yyssp = yystate;
                    558: 
                    559:   if (yyssp >= yyss + yystacksize - 1)
                    560:     {
                    561:       /* Give user a chance to reallocate the stack */
                    562:       /* Use copies of these so that the &'s don't force the real ones into memory. */
                    563:       YYSTYPE *yyvs1 = yyvs;
                    564:       short *yyss1 = yyss;
                    565: #ifdef YYLSP_NEEDED
                    566:       YYLTYPE *yyls1 = yyls;
                    567: #endif
                    568: 
                    569:       /* Get the current used size of the three stacks, in elements.  */
                    570:       int size = yyssp - yyss + 1;
                    571: 
                    572: #ifdef yyoverflow
                    573:       /* Each stack pointer address is followed by the size of
                    574:         the data in use in that stack, in bytes.  */
                    575:       yyoverflow("parser stack overflow",
                    576:                 &yyss1, size * sizeof (*yyssp),
                    577:                 &yyvs1, size * sizeof (*yyvsp),
                    578: #ifdef YYLSP_NEEDED
                    579:                 &yyls1, size * sizeof (*yylsp),
                    580: #endif
                    581:                 &yystacksize);
                    582: 
                    583:       yyss = yyss1; yyvs = yyvs1;
                    584: #ifdef YYLSP_NEEDED
                    585:       yyls = yyls1;
                    586: #endif
                    587: #else /* no yyoverflow */
                    588:       /* Extend the stack our own way.  */
                    589:       if (yystacksize >= YYMAXDEPTH)
                    590:        {
                    591:          yyerror("parser stack overflow");
                    592:          return 2;
                    593:        }
                    594:       yystacksize *= 2;
                    595:       if (yystacksize > YYMAXDEPTH)
                    596:        yystacksize = YYMAXDEPTH;
                    597:       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
                    598:       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
                    599:       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
                    600:       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
                    601: #ifdef YYLSP_NEEDED
                    602:       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
                    603:       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
                    604: #endif
                    605: #endif /* no yyoverflow */
                    606: 
                    607:       yyssp = yyss + size - 1;
                    608:       yyvsp = yyvs + size - 1;
                    609: #ifdef YYLSP_NEEDED
                    610:       yylsp = yyls + size - 1;
                    611: #endif
                    612: 
                    613: #if YYDEBUG != 0
                    614:       if (yydebug)
                    615:        fprintf(stderr, "Stack size increased to %d\n", yystacksize);
                    616: #endif
                    617: 
                    618:       if (yyssp >= yyss + yystacksize - 1)
                    619:        YYABORT;
                    620:     }
                    621: 
                    622: #if YYDEBUG != 0
                    623:   if (yydebug)
                    624:     fprintf(stderr, "Entering state %d\n", yystate);
                    625: #endif
                    626: 
                    627:  yybackup:
                    628: 
                    629: /* Do appropriate processing given the current state.  */
                    630: /* Read a lookahead token if we need one and don't already have one.  */
                    631: /* yyresume: */
                    632: 
                    633:   /* First try to decide what to do without reference to lookahead token.  */
                    634: 
                    635:   yyn = yypact[yystate];
                    636:   if (yyn == YYFLAG)
                    637:     goto yydefault;
                    638: 
                    639:   /* Not known => get a lookahead token if don't already have one.  */
                    640: 
                    641:   /* yychar is either YYEMPTY or YYEOF
                    642:      or a valid token in external form.  */
                    643: 
                    644:   if (yychar == YYEMPTY)
                    645:     {
                    646: #if YYDEBUG != 0
                    647:       if (yydebug)
                    648:        fprintf(stderr, "Reading a token: ");
                    649: #endif
                    650:       yychar = YYLEX;
                    651:     }
                    652: 
                    653:   /* Convert token to internal form (in yychar1) for indexing tables with */
                    654: 
                    655:   if (yychar <= 0)             /* This means end of input. */
                    656:     {
                    657:       yychar1 = 0;
                    658:       yychar = YYEOF;          /* Don't call YYLEX any more */
                    659: 
                    660: #if YYDEBUG != 0
                    661:       if (yydebug)
                    662:        fprintf(stderr, "Now at end of input.\n");
                    663: #endif
                    664:     }
                    665:   else
                    666:     {
                    667:       yychar1 = YYTRANSLATE(yychar);
                    668: 
                    669: #if YYDEBUG != 0
                    670:       if (yydebug)
                    671:        {
                    672:          fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
                    673:          /* Give the individual parser a way to print the precise meaning
                    674:             of a token, for further debugging info.  */
                    675: #ifdef YYPRINT
                    676:          YYPRINT (stderr, yychar, yylval);
                    677: #endif
                    678:          fprintf (stderr, ")\n");
                    679:        }
                    680: #endif
                    681:     }
                    682: 
                    683:   yyn += yychar1;
                    684:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
                    685:     goto yydefault;
                    686: 
                    687:   yyn = yytable[yyn];
                    688: 
                    689:   /* yyn is what to do for this token type in this state.
                    690:      Negative => reduce, -yyn is rule number.
                    691:      Positive => shift, yyn is new state.
                    692:        New state is final state => don't bother to shift,
                    693:        just return success.
                    694:      0, or most negative number => error.  */
                    695: 
                    696:   if (yyn < 0)
                    697:     {
                    698:       if (yyn == YYFLAG)
                    699:        goto yyerrlab;
                    700:       yyn = -yyn;
                    701:       goto yyreduce;
                    702:     }
                    703:   else if (yyn == 0)
                    704:     goto yyerrlab;
                    705: 
                    706:   if (yyn == YYFINAL)
                    707:     YYACCEPT;
                    708: 
                    709:   /* Shift the lookahead token.  */
                    710: 
                    711: #if YYDEBUG != 0
                    712:   if (yydebug)
                    713:     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
                    714: #endif
                    715: 
                    716:   /* Discard the token being shifted unless it is eof.  */
                    717:   if (yychar != YYEOF)
                    718:     yychar = YYEMPTY;
                    719: 
                    720:   *++yyvsp = yylval;
                    721: #ifdef YYLSP_NEEDED
                    722:   *++yylsp = yylloc;
                    723: #endif
                    724: 
                    725:   /* count tokens shifted since error; after three, turn off error status.  */
                    726:   if (yyerrstatus) yyerrstatus--;
                    727: 
                    728:   yystate = yyn;
                    729:   goto yynewstate;
                    730: 
                    731: /* Do the default action for the current state.  */
                    732: yydefault:
                    733: 
                    734:   yyn = yydefact[yystate];
                    735:   if (yyn == 0)
                    736:     goto yyerrlab;
                    737: 
                    738: /* Do a reduction.  yyn is the number of a rule to reduce with.  */
                    739: yyreduce:
                    740:   yylen = yyr2[yyn];
                    741:   yyval = yyvsp[1-yylen]; /* implement default value of the action */
                    742: 
                    743: #if YYDEBUG != 0
                    744:   if (yydebug)
                    745:     {
                    746:       int i;
                    747: 
                    748:       fprintf (stderr, "Reducing via rule %d (line %d), ",
                    749:               yyn, yyrline[yyn]);
                    750: 
                    751:       /* Print the symboles being reduced, and their result.  */
                    752:       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
                    753:        fprintf (stderr, "%s ", yytname[yyrhs[i]]);
                    754:       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
                    755:     }
                    756: #endif
                    757: 
                    758: 
                    759:   switch (yyn) {
                    760: 
                    761: case 1:
                    762: #line 160 "cexp.y"
                    763: { expression_value = yyvsp[0].integer.value; ;
                    764:     break;}
                    765: case 3:
                    766: #line 166 "cexp.y"
                    767: { if (pedantic)
                    768:                            pedwarn ("comma operator in operand of `#if'");
                    769:                          yyval.integer = yyvsp[0].integer; ;
                    770:     break;}
                    771: case 4:
                    772: #line 173 "cexp.y"
                    773: { yyval.integer.value = - yyvsp[0].integer.value;
                    774:                          if ((yyval.integer.value & yyvsp[0].integer.value) < 0 && ! yyvsp[0].integer.unsignedp)
                    775:                            integer_overflow ();
                    776:                          yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
                    777:     break;}
                    778: case 5:
                    779: #line 178 "cexp.y"
                    780: { yyval.integer.value = ! yyvsp[0].integer.value;
                    781:                          yyval.integer.unsignedp = 0; ;
                    782:     break;}
                    783: case 6:
                    784: #line 181 "cexp.y"
                    785: { yyval.integer = yyvsp[0].integer; ;
                    786:     break;}
                    787: case 7:
                    788: #line 183 "cexp.y"
                    789: { yyval.integer.value = ~ yyvsp[0].integer.value;
                    790:                          yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
                    791:     break;}
                    792: case 8:
                    793: #line 186 "cexp.y"
                    794: { yyval.integer.value = check_assertion (yyvsp[0].name.address, yyvsp[0].name.length,
                    795:                                                      0, NULL_PTR);
                    796:                          yyval.integer.unsignedp = 0; ;
                    797:     break;}
                    798: case 9:
                    799: #line 190 "cexp.y"
                    800: { keyword_parsing = 1; ;
                    801:     break;}
                    802: case 10:
                    803: #line 192 "cexp.y"
                    804: { yyval.integer.value = check_assertion (yyvsp[-4].name.address, yyvsp[-4].name.length,
                    805:                                                      1, yyvsp[-1].keywords);
                    806:                          keyword_parsing = 0;
                    807:                          yyval.integer.unsignedp = 0; ;
                    808:     break;}
                    809: case 11:
                    810: #line 197 "cexp.y"
                    811: { yyval.integer = yyvsp[-1].integer; ;
                    812:     break;}
                    813: case 12:
                    814: #line 202 "cexp.y"
                    815: { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    816:                          if (yyval.integer.unsignedp)
                    817:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value * yyvsp[0].integer.value;
                    818:                          else
                    819:                            {
                    820:                              yyval.integer.value = yyvsp[-2].integer.value * yyvsp[0].integer.value;
                    821:                              if (yyvsp[-2].integer.value
                    822:                                  && (yyval.integer.value / yyvsp[-2].integer.value != yyvsp[0].integer.value
                    823:                                      || (yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0))
                    824:                                integer_overflow ();
                    825:                            } ;
                    826:     break;}
                    827: case 13:
                    828: #line 214 "cexp.y"
                    829: { if (yyvsp[0].integer.value == 0)
                    830:                            {
                    831:                              error ("division by zero in #if");
                    832:                              yyvsp[0].integer.value = 1;
                    833:                            }
                    834:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    835:                          if (yyval.integer.unsignedp)
                    836:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value / yyvsp[0].integer.value;
                    837:                          else
                    838:                            {
                    839:                              yyval.integer.value = yyvsp[-2].integer.value / yyvsp[0].integer.value;
                    840:                              if ((yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0)
                    841:                                integer_overflow ();
                    842:                            } ;
                    843:     break;}
                    844: case 14:
                    845: #line 229 "cexp.y"
                    846: { if (yyvsp[0].integer.value == 0)
                    847:                            {
                    848:                              error ("division by zero in #if");
                    849:                              yyvsp[0].integer.value = 1;
                    850:                            }
                    851:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    852:                          if (yyval.integer.unsignedp)
                    853:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value % yyvsp[0].integer.value;
                    854:                          else
                    855:                            yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value; ;
                    856:     break;}
                    857: case 15:
                    858: #line 240 "cexp.y"
                    859: { yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value;
                    860:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    861:                          if (! yyval.integer.unsignedp
                    862:                              && ! possible_sum_sign (yyvsp[-2].integer.value, yyvsp[0].integer.value,
                    863:                                                      yyval.integer.value))
                    864:                            integer_overflow (); ;
                    865:     break;}
                    866: case 16:
                    867: #line 247 "cexp.y"
                    868: { yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value;
                    869:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    870:                          if (! yyval.integer.unsignedp
                    871:                              && ! possible_sum_sign (yyval.integer.value, yyvsp[0].integer.value,
                    872:                                                      yyvsp[-2].integer.value))
                    873:                            integer_overflow (); ;
                    874:     break;}
                    875: case 17:
                    876: #line 254 "cexp.y"
                    877: { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
                    878:                          if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp)
                    879:                            yyval.integer.value = right_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
                    880:                          else
                    881:                            yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
                    882:     break;}
                    883: case 18:
                    884: #line 260 "cexp.y"
                    885: { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
                    886:                          if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp)
                    887:                            yyval.integer.value = left_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
                    888:                          else
                    889:                            yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
                    890:     break;}
                    891: case 19:
                    892: #line 266 "cexp.y"
                    893: { yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
                    894:                          yyval.integer.unsignedp = 0; ;
                    895:     break;}
                    896: case 20:
                    897: #line 269 "cexp.y"
                    898: { yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
                    899:                          yyval.integer.unsignedp = 0; ;
                    900:     break;}
                    901: case 21:
                    902: #line 272 "cexp.y"
                    903: { yyval.integer.unsignedp = 0;
                    904:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    905:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value <= yyvsp[0].integer.value;
                    906:                          else
                    907:                            yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value; ;
                    908:     break;}
                    909: case 22:
                    910: #line 278 "cexp.y"
                    911: { yyval.integer.unsignedp = 0;
                    912:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    913:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value >= yyvsp[0].integer.value;
                    914:                          else
                    915:                            yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value; ;
                    916:     break;}
                    917: case 23:
                    918: #line 284 "cexp.y"
                    919: { yyval.integer.unsignedp = 0;
                    920:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    921:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value < yyvsp[0].integer.value;
                    922:                          else
                    923:                            yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value; ;
                    924:     break;}
                    925: case 24:
                    926: #line 290 "cexp.y"
                    927: { yyval.integer.unsignedp = 0;
                    928:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    929:                            yyval.integer.value = (unsigned long) yyvsp[-2].integer.value > yyvsp[0].integer.value;
                    930:                          else
                    931:                            yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value; ;
                    932:     break;}
                    933: case 25:
                    934: #line 296 "cexp.y"
                    935: { yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value;
                    936:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
                    937:     break;}
                    938: case 26:
                    939: #line 299 "cexp.y"
                    940: { yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value;
                    941:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
                    942:     break;}
                    943: case 27:
                    944: #line 302 "cexp.y"
                    945: { yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value;
                    946:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
                    947:     break;}
                    948: case 28:
                    949: #line 305 "cexp.y"
                    950: { yyval.integer.value = (yyvsp[-2].integer.value && yyvsp[0].integer.value);
                    951:                          yyval.integer.unsignedp = 0; ;
                    952:     break;}
                    953: case 29:
                    954: #line 308 "cexp.y"
                    955: { yyval.integer.value = (yyvsp[-2].integer.value || yyvsp[0].integer.value);
                    956:                          yyval.integer.unsignedp = 0; ;
                    957:     break;}
                    958: case 30:
                    959: #line 311 "cexp.y"
                    960: { yyval.integer.value = yyvsp[-4].integer.value ? yyvsp[-2].integer.value : yyvsp[0].integer.value;
                    961:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
                    962:     break;}
                    963: case 31:
                    964: #line 314 "cexp.y"
                    965: { yyval.integer = yylval.integer; ;
                    966:     break;}
                    967: case 32:
                    968: #line 316 "cexp.y"
                    969: { yyval.integer = yylval.integer; ;
                    970:     break;}
                    971: case 33:
                    972: #line 318 "cexp.y"
                    973: { yyval.integer.value = 0;
                    974:                          yyval.integer.unsignedp = 0; ;
                    975:     break;}
                    976: case 34:
                    977: #line 323 "cexp.y"
                    978: { yyval.keywords = 0; ;
                    979:     break;}
                    980: case 35:
                    981: #line 325 "cexp.y"
                    982: { struct arglist *temp;
                    983:                          yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
                    984:                          yyval.keywords->next = yyvsp[-2].keywords;
                    985:                          yyval.keywords->name = (U_CHAR *) "(";
                    986:                          yyval.keywords->length = 1;
                    987:                          temp = yyval.keywords;
                    988:                          while (temp != 0 && temp->next != 0)
                    989:                            temp = temp->next;
                    990:                          temp->next = (struct arglist *) xmalloc (sizeof (struct arglist));
                    991:                          temp->next->next = yyvsp[0].keywords;
                    992:                          temp->next->name = (U_CHAR *) ")";
                    993:                          temp->next->length = 1; ;
                    994:     break;}
                    995: case 36:
                    996: #line 338 "cexp.y"
                    997: { yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
                    998:                          yyval.keywords->name = yyvsp[-1].name.address;
                    999:                          yyval.keywords->length = yyvsp[-1].name.length;
                   1000:                          yyval.keywords->next = yyvsp[0].keywords; ;
                   1001:     break;}
                   1002: }
                   1003:    /* the action file gets copied in in place of this dollarsign */
                   1004: #line 440 "bison.simple"
                   1005: 
                   1006:   yyvsp -= yylen;
                   1007:   yyssp -= yylen;
                   1008: #ifdef YYLSP_NEEDED
                   1009:   yylsp -= yylen;
                   1010: #endif
                   1011: 
                   1012: #if YYDEBUG != 0
                   1013:   if (yydebug)
                   1014:     {
                   1015:       short *ssp1 = yyss - 1;
                   1016:       fprintf (stderr, "state stack now");
                   1017:       while (ssp1 != yyssp)
                   1018:        fprintf (stderr, " %d", *++ssp1);
                   1019:       fprintf (stderr, "\n");
                   1020:     }
                   1021: #endif
                   1022: 
                   1023:   *++yyvsp = yyval;
                   1024: 
                   1025: #ifdef YYLSP_NEEDED
                   1026:   yylsp++;
                   1027:   if (yylen == 0)
                   1028:     {
                   1029:       yylsp->first_line = yylloc.first_line;
                   1030:       yylsp->first_column = yylloc.first_column;
                   1031:       yylsp->last_line = (yylsp-1)->last_line;
                   1032:       yylsp->last_column = (yylsp-1)->last_column;
                   1033:       yylsp->text = 0;
                   1034:     }
                   1035:   else
                   1036:     {
                   1037:       yylsp->last_line = (yylsp+yylen-1)->last_line;
                   1038:       yylsp->last_column = (yylsp+yylen-1)->last_column;
                   1039:     }
                   1040: #endif
                   1041: 
                   1042:   /* Now "shift" the result of the reduction.
                   1043:      Determine what state that goes to,
                   1044:      based on the state we popped back to
                   1045:      and the rule number reduced by.  */
                   1046: 
                   1047:   yyn = yyr1[yyn];
                   1048: 
                   1049:   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
                   1050:   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
                   1051:     yystate = yytable[yystate];
                   1052:   else
                   1053:     yystate = yydefgoto[yyn - YYNTBASE];
                   1054: 
                   1055:   goto yynewstate;
                   1056: 
                   1057: yyerrlab:   /* here on detecting error */
                   1058: 
                   1059:   if (! yyerrstatus)
                   1060:     /* If not already recovering from an error, report this error.  */
                   1061:     {
                   1062:       ++yynerrs;
                   1063: 
                   1064: #ifdef YYERROR_VERBOSE
                   1065:       yyn = yypact[yystate];
                   1066: 
                   1067:       if (yyn > YYFLAG && yyn < YYLAST)
                   1068:        {
                   1069:          int size = 0;
                   1070:          char *msg;
                   1071:          int x, count;
                   1072: 
                   1073:          count = 0;
                   1074:          for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
                   1075:            if (yycheck[x + yyn] == x)
                   1076:              size += strlen(yytname[x]) + 15, count++;
                   1077:          msg = (char *) malloc(size + 15);
                   1078:          if (msg != 0)
                   1079:            {
                   1080:              strcpy(msg, "parse error");
                   1081: 
                   1082:              if (count < 5)
                   1083:                {
                   1084:                  count = 0;
                   1085:                  for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
                   1086:                    if (yycheck[x + yyn] == x)
                   1087:                      {
                   1088:                        strcat(msg, count == 0 ? ", expecting `" : " or `");
                   1089:                        strcat(msg, yytname[x]);
                   1090:                        strcat(msg, "'");
                   1091:                        count++;
                   1092:                      }
                   1093:                }
                   1094:              yyerror(msg);
                   1095:              free(msg);
                   1096:            }
                   1097:          else
                   1098:            yyerror ("parse error; also virtual memory exceeded");
                   1099:        }
                   1100:       else
                   1101: #endif /* YYERROR_VERBOSE */
                   1102:        yyerror("parse error");
                   1103:     }
                   1104: 
                   1105: yyerrlab1:   /* here on error raised explicitly by an action */
                   1106: 
                   1107:   if (yyerrstatus == 3)
                   1108:     {
                   1109:       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
                   1110: 
                   1111:       /* return failure if at end of input */
                   1112:       if (yychar == YYEOF)
                   1113:        YYABORT;
                   1114: 
                   1115: #if YYDEBUG != 0
                   1116:       if (yydebug)
                   1117:        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
                   1118: #endif
                   1119: 
                   1120:       yychar = YYEMPTY;
                   1121:     }
                   1122: 
                   1123:   /* Else will try to reuse lookahead token
                   1124:      after shifting the error token.  */
                   1125: 
                   1126:   yyerrstatus = 3;             /* Each real token shifted decrements this */
                   1127: 
                   1128:   goto yyerrhandle;
                   1129: 
                   1130: yyerrdefault:  /* current state does not do anything special for the error token. */
                   1131: 
                   1132: #if 0
                   1133:   /* This is wrong; only states that explicitly want error tokens
                   1134:      should shift them.  */
                   1135:   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
                   1136:   if (yyn) goto yydefault;
                   1137: #endif
                   1138: 
                   1139: yyerrpop:   /* pop the current state because it cannot handle the error token */
                   1140: 
                   1141:   if (yyssp == yyss) YYABORT;
                   1142:   yyvsp--;
                   1143:   yystate = *--yyssp;
                   1144: #ifdef YYLSP_NEEDED
                   1145:   yylsp--;
                   1146: #endif
                   1147: 
                   1148: #if YYDEBUG != 0
                   1149:   if (yydebug)
                   1150:     {
                   1151:       short *ssp1 = yyss - 1;
                   1152:       fprintf (stderr, "Error: state stack now");
                   1153:       while (ssp1 != yyssp)
                   1154:        fprintf (stderr, " %d", *++ssp1);
                   1155:       fprintf (stderr, "\n");
                   1156:     }
                   1157: #endif
                   1158: 
                   1159: yyerrhandle:
                   1160: 
                   1161:   yyn = yypact[yystate];
                   1162:   if (yyn == YYFLAG)
                   1163:     goto yyerrdefault;
                   1164: 
                   1165:   yyn += YYTERROR;
                   1166:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
                   1167:     goto yyerrdefault;
                   1168: 
                   1169:   yyn = yytable[yyn];
                   1170:   if (yyn < 0)
                   1171:     {
                   1172:       if (yyn == YYFLAG)
                   1173:        goto yyerrpop;
                   1174:       yyn = -yyn;
                   1175:       goto yyreduce;
                   1176:     }
                   1177:   else if (yyn == 0)
                   1178:     goto yyerrpop;
                   1179: 
                   1180:   if (yyn == YYFINAL)
                   1181:     YYACCEPT;
                   1182: 
                   1183: #if YYDEBUG != 0
                   1184:   if (yydebug)
                   1185:     fprintf(stderr, "Shifting error token, ");
                   1186: #endif
                   1187: 
                   1188:   *++yyvsp = yylval;
                   1189: #ifdef YYLSP_NEEDED
                   1190:   *++yylsp = yylloc;
                   1191: #endif
                   1192: 
                   1193:   yystate = yyn;
                   1194:   goto yynewstate;
                   1195: }
                   1196: #line 343 "cexp.y"
                   1197: 
                   1198: 
                   1199: /* During parsing of a C expression, the pointer to the next character
                   1200:    is in this variable.  */
                   1201: 
                   1202: static char *lexptr;
                   1203: 
                   1204: /* Take care of parsing a number (anything that starts with a digit).
                   1205:    Set yylval and return the token type; update lexptr.
                   1206:    LEN is the number of characters in it.  */
                   1207: 
                   1208: /* maybe needs to actually deal with floating point numbers */
                   1209: 
                   1210: int
                   1211: parse_number (olen)
                   1212:      int olen;
                   1213: {
                   1214:   register char *p = lexptr;
                   1215:   register int c;
                   1216:   register unsigned long n = 0, nd, ULONG_MAX_over_base;
                   1217:   register int base = 10;
                   1218:   register int len = olen;
                   1219:   register int overflow = 0;
                   1220:   register int digit, largest_digit = 0;
                   1221:   int spec_long = 0;
                   1222: 
                   1223:   for (c = 0; c < len; c++)
                   1224:     if (p[c] == '.') {
                   1225:       /* It's a float since it contains a point.  */
                   1226:       yyerror ("floating point numbers not allowed in #if expressions");
                   1227:       return ERROR;
                   1228:     }
                   1229: 
                   1230:   yylval.integer.unsignedp = 0;
                   1231: 
                   1232:   if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2))) {
                   1233:     p += 2;
                   1234:     base = 16;
                   1235:     len -= 2;
                   1236:   }
                   1237:   else if (*p == '0')
                   1238:     base = 8;
                   1239: 
                   1240:   ULONG_MAX_over_base = (unsigned long) -1 / base;
                   1241: 
                   1242:   for (; len > 0; len--) {
                   1243:     c = *p++;
                   1244: 
                   1245:     if (c >= '0' && c <= '9')
                   1246:       digit = c - '0';
                   1247:     else if (base == 16 && c >= 'a' && c <= 'f')
                   1248:       digit = c - 'a' + 10;
                   1249:     else if (base == 16 && c >= 'A' && c <= 'F')
                   1250:       digit = c - 'A' + 10;
                   1251:     else {
                   1252:       /* `l' means long, and `u' means unsigned.  */
                   1253:       while (1) {
                   1254:        if (c == 'l' || c == 'L')
                   1255:          {
                   1256:            if (spec_long)
                   1257:              yyerror ("two `l's in integer constant");
                   1258:            spec_long = 1;
                   1259:          }
                   1260:        else if (c == 'u' || c == 'U')
                   1261:          {
                   1262:            if (yylval.integer.unsignedp)
                   1263:              yyerror ("two `u's in integer constant");
                   1264:            yylval.integer.unsignedp = 1;
                   1265:          }
                   1266:        else
                   1267:          break;
                   1268: 
                   1269:        if (--len == 0)
                   1270:          break;
                   1271:        c = *p++;
                   1272:       }
                   1273:       /* Don't look for any more digits after the suffixes.  */
                   1274:       break;
                   1275:     }
                   1276:     if (largest_digit < digit)
                   1277:       largest_digit = digit;
                   1278:     nd = n * base + digit;
                   1279:     overflow |= ULONG_MAX_over_base < n | nd < n;
                   1280:     n = nd;
                   1281:   }
                   1282: 
                   1283:   if (len != 0) {
                   1284:     yyerror ("Invalid number in #if expression");
                   1285:     return ERROR;
                   1286:   }
                   1287: 
                   1288:   if (base <= largest_digit)
                   1289:     warning ("integer constant contains digits beyond the radix");
                   1290: 
                   1291:   if (overflow)
                   1292:     warning ("integer constant out of range");
                   1293: 
                   1294:   /* If too big to be signed, consider it unsigned.  */
                   1295:   if ((long) n < 0 && ! yylval.integer.unsignedp)
                   1296:     {
                   1297:       if (base == 10)
                   1298:        warning ("integer constant is so large that it is unsigned");
                   1299:       yylval.integer.unsignedp = 1;
                   1300:     }
                   1301: 
                   1302:   lexptr = p;
                   1303:   yylval.integer.value = n;
                   1304:   return INT;
                   1305: }
                   1306: 
                   1307: struct token {
                   1308:   char *operator;
                   1309:   int token;
                   1310: };
                   1311: 
                   1312: static struct token tokentab2[] = {
                   1313:   {"&&", AND},
                   1314:   {"||", OR},
                   1315:   {"<<", LSH},
                   1316:   {">>", RSH},
                   1317:   {"==", EQUAL},
                   1318:   {"!=", NOTEQUAL},
                   1319:   {"<=", LEQ},
                   1320:   {">=", GEQ},
                   1321:   {"++", ERROR},
                   1322:   {"--", ERROR},
                   1323:   {NULL, ERROR}
                   1324: };
                   1325: 
                   1326: /* Read one token, getting characters through lexptr.  */
                   1327: 
                   1328: int
                   1329: yylex ()
                   1330: {
                   1331:   register int c;
                   1332:   register int namelen;
                   1333:   register unsigned char *tokstart;
                   1334:   register struct token *toktab;
                   1335:   int wide_flag;
                   1336: 
                   1337:  retry:
                   1338: 
                   1339:   tokstart = (unsigned char *) lexptr;
                   1340:   c = *tokstart;
                   1341:   /* See if it is a special token of length 2.  */
                   1342:   if (! keyword_parsing)
                   1343:     for (toktab = tokentab2; toktab->operator != NULL; toktab++)
                   1344:       if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
                   1345:        lexptr += 2;
                   1346:        if (toktab->token == ERROR)
                   1347:          {
                   1348:            char *buf = (char *) alloca (40);
                   1349:            sprintf (buf, "`%s' not allowed in operand of `#if'", toktab->operator);
                   1350:            yyerror (buf);
                   1351:          }
                   1352:        return toktab->token;
                   1353:       }
                   1354: 
                   1355:   switch (c) {
                   1356:   case 0:
                   1357:     return 0;
                   1358:     
                   1359:   case ' ':
                   1360:   case '\t':
                   1361:   case '\r':
                   1362:   case '\n':
                   1363:     lexptr++;
                   1364:     goto retry;
                   1365:     
                   1366:   case 'L':
                   1367:     /* Capital L may start a wide-string or wide-character constant.  */
                   1368:     if (lexptr[1] == '\'')
                   1369:       {
                   1370:        lexptr++;
                   1371:        wide_flag = 1;
                   1372:        goto char_constant;
                   1373:       }
                   1374:     if (lexptr[1] == '"')
                   1375:       {
                   1376:        lexptr++;
                   1377:        wide_flag = 1;
                   1378:        goto string_constant;
                   1379:       }
                   1380:     break;
                   1381: 
                   1382:   case '\'':
                   1383:     wide_flag = 0;
                   1384:   char_constant:
                   1385:     lexptr++;
                   1386:     if (keyword_parsing) {
                   1387:       char *start_ptr = lexptr - 1;
                   1388:       while (1) {
                   1389:        c = *lexptr++;
                   1390:        if (c == '\\')
                   1391:          c = parse_escape (&lexptr);
                   1392:        else if (c == '\'')
                   1393:          break;
                   1394:       }
                   1395:       yylval.name.address = tokstart;
                   1396:       yylval.name.length = lexptr - start_ptr;
                   1397:       return NAME;
                   1398:     }
                   1399: 
                   1400:     /* This code for reading a character constant
                   1401:        handles multicharacter constants and wide characters.
                   1402:        It is mostly copied from c-lex.c.  */
                   1403:     {
                   1404:       register int result = 0;
                   1405:       register num_chars = 0;
                   1406:       unsigned width = MAX_CHAR_TYPE_SIZE;
                   1407:       int max_chars;
                   1408:       char *token_buffer;
                   1409: 
                   1410:       if (wide_flag)
                   1411:        {
                   1412:          width = MAX_WCHAR_TYPE_SIZE;
                   1413: #ifdef MULTIBYTE_CHARS
                   1414:          max_chars = MB_CUR_MAX;
                   1415: #else
                   1416:          max_chars = 1;
                   1417: #endif
                   1418:        }
                   1419:       else
                   1420:        max_chars = MAX_LONG_TYPE_SIZE / width;
                   1421: 
                   1422:       token_buffer = (char *) alloca (max_chars + 1);
                   1423: 
                   1424:       while (1)
                   1425:        {
                   1426:          c = *lexptr++;
                   1427: 
                   1428:          if (c == '\'' || c == EOF)
                   1429:            break;
                   1430: 
                   1431:          if (c == '\\')
                   1432:            {
                   1433:              c = parse_escape (&lexptr);
                   1434:              if (width < HOST_BITS_PER_INT
                   1435:                  && (unsigned) c >= (1 << width))
                   1436:                pedwarn ("escape sequence out of range for character");
                   1437:            }
                   1438: 
                   1439:          num_chars++;
                   1440: 
                   1441:          /* Merge character into result; ignore excess chars.  */
                   1442:          if (num_chars < max_chars + 1)
                   1443:            {
                   1444:              if (width < HOST_BITS_PER_INT)
                   1445:                result = (result << width) | (c & ((1 << width) - 1));
                   1446:              else
                   1447:                result = c;
                   1448:              token_buffer[num_chars - 1] = c;
                   1449:            }
                   1450:        }
                   1451: 
                   1452:       token_buffer[num_chars] = 0;
                   1453: 
                   1454:       if (c != '\'')
                   1455:        error ("malformatted character constant");
                   1456:       else if (num_chars == 0)
                   1457:        error ("empty character constant");
                   1458:       else if (num_chars > max_chars)
                   1459:        {
                   1460:          num_chars = max_chars;
                   1461:          error ("character constant too long");
                   1462:        }
                   1463:       else if (num_chars != 1 && ! traditional)
                   1464:        warning ("multi-character character constant");
                   1465: 
                   1466:       /* If char type is signed, sign-extend the constant.  */
                   1467:       if (! wide_flag)
                   1468:        {
                   1469:          int num_bits = num_chars * width;
                   1470: 
                   1471:          if (lookup ("__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__")-1, -1)
                   1472:              || ((result >> (num_bits - 1)) & 1) == 0)
                   1473:            yylval.integer.value
                   1474:              = result & ((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
                   1475:          else
                   1476:            yylval.integer.value
                   1477:              = result | ~((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
                   1478:        }
                   1479:       else
                   1480:        {
                   1481: #ifdef MULTIBYTE_CHARS
                   1482:          /* Set the initial shift state and convert the next sequence.  */
                   1483:          result = 0;
                   1484:          /* In all locales L'\0' is zero and mbtowc will return zero,
                   1485:             so don't use it.  */
                   1486:          if (num_chars > 1
                   1487:              || (num_chars == 1 && token_buffer[0] != '\0'))
                   1488:            {
                   1489:              wchar_t wc;
                   1490:              (void) mbtowc (NULL_PTR, NULL_PTR, 0);
                   1491:              if (mbtowc (& wc, token_buffer, num_chars) == num_chars)
                   1492:                result = wc;
                   1493:              else
                   1494:                warning ("Ignoring invalid multibyte character");
                   1495:            }
                   1496: #endif
                   1497:          yylval.integer.value = result;
                   1498:        }
                   1499:     }
                   1500: 
                   1501:     /* This is always a signed type.  */
                   1502:     yylval.integer.unsignedp = 0;
                   1503:     
                   1504:     return CHAR;
                   1505: 
                   1506:     /* some of these chars are invalid in constant expressions;
                   1507:        maybe do something about them later */
                   1508:   case '/':
                   1509:   case '+':
                   1510:   case '-':
                   1511:   case '*':
                   1512:   case '%':
                   1513:   case '|':
                   1514:   case '&':
                   1515:   case '^':
                   1516:   case '~':
                   1517:   case '!':
                   1518:   case '@':
                   1519:   case '<':
                   1520:   case '>':
                   1521:   case '[':
                   1522:   case ']':
                   1523:   case '.':
                   1524:   case '?':
                   1525:   case ':':
                   1526:   case '=':
                   1527:   case '{':
                   1528:   case '}':
                   1529:   case ',':
                   1530:   case '#':
                   1531:     if (keyword_parsing)
                   1532:       break;
                   1533:   case '(':
                   1534:   case ')':
                   1535:     lexptr++;
                   1536:     return c;
                   1537: 
                   1538:   case '"':
                   1539:   string_constant:
                   1540:     if (keyword_parsing) {
                   1541:       char *start_ptr = lexptr;
                   1542:       lexptr++;
                   1543:       while (1) {
                   1544:        c = *lexptr++;
                   1545:        if (c == '\\')
                   1546:          c = parse_escape (&lexptr);
                   1547:        else if (c == '"')
                   1548:          break;
                   1549:       }
                   1550:       yylval.name.address = tokstart;
                   1551:       yylval.name.length = lexptr - start_ptr;
                   1552:       return NAME;
                   1553:     }
                   1554:     yyerror ("string constants not allowed in #if expressions");
                   1555:     return ERROR;
                   1556:   }
                   1557: 
                   1558:   if (c >= '0' && c <= '9' && !keyword_parsing) {
                   1559:     /* It's a number */
                   1560:     for (namelen = 0;
                   1561:         c = tokstart[namelen], is_idchar[c] || c == '.'; 
                   1562:         namelen++)
                   1563:       ;
                   1564:     return parse_number (namelen);
                   1565:   }
                   1566: 
                   1567:   /* It is a name.  See how long it is.  */
                   1568: 
                   1569:   if (keyword_parsing) {
                   1570:     for (namelen = 0;; namelen++) {
                   1571:       if (is_hor_space[tokstart[namelen]])
                   1572:        break;
                   1573:       if (tokstart[namelen] == '(' || tokstart[namelen] == ')')
                   1574:        break;
                   1575:       if (tokstart[namelen] == '"' || tokstart[namelen] == '\'')
                   1576:        break;
                   1577:     }
                   1578:   } else {
                   1579:     if (!is_idstart[c]) {
                   1580:       yyerror ("Invalid token in expression");
                   1581:       return ERROR;
                   1582:     }
                   1583: 
                   1584:     for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
                   1585:       ;
                   1586:   }
                   1587:   
                   1588:   lexptr += namelen;
                   1589:   yylval.name.address = tokstart;
                   1590:   yylval.name.length = namelen;
                   1591:   return NAME;
                   1592: }
                   1593: 
                   1594: 
                   1595: /* Parse a C escape sequence.  STRING_PTR points to a variable
                   1596:    containing a pointer to the string to parse.  That pointer
                   1597:    is updated past the characters we use.  The value of the
                   1598:    escape sequence is returned.
                   1599: 
                   1600:    A negative value means the sequence \ newline was seen,
                   1601:    which is supposed to be equivalent to nothing at all.
                   1602: 
                   1603:    If \ is followed by a null character, we return a negative
                   1604:    value and leave the string pointer pointing at the null character.
                   1605: 
                   1606:    If \ is followed by 000, we return 0 and leave the string pointer
                   1607:    after the zeros.  A value of 0 does not mean end of string.  */
                   1608: 
                   1609: int
                   1610: parse_escape (string_ptr)
                   1611:      char **string_ptr;
                   1612: {
                   1613:   register int c = *(*string_ptr)++;
                   1614:   switch (c)
                   1615:     {
                   1616:     case 'a':
                   1617:       return TARGET_BELL;
                   1618:     case 'b':
                   1619:       return TARGET_BS;
                   1620:     case 'e':
                   1621:     case 'E':
                   1622:       if (pedantic)
                   1623:        pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
                   1624:       return 033;
                   1625:     case 'f':
                   1626:       return TARGET_FF;
                   1627:     case 'n':
                   1628:       return TARGET_NEWLINE;
                   1629:     case 'r':
                   1630:       return TARGET_CR;
                   1631:     case 't':
                   1632:       return TARGET_TAB;
                   1633:     case 'v':
                   1634:       return TARGET_VT;
                   1635:     case '\n':
                   1636:       return -2;
                   1637:     case 0:
                   1638:       (*string_ptr)--;
                   1639:       return 0;
                   1640:       
                   1641:     case '0':
                   1642:     case '1':
                   1643:     case '2':
                   1644:     case '3':
                   1645:     case '4':
                   1646:     case '5':
                   1647:     case '6':
                   1648:     case '7':
                   1649:       {
                   1650:        register int i = c - '0';
                   1651:        register int count = 0;
                   1652:        while (++count < 3)
                   1653:          {
                   1654:            c = *(*string_ptr)++;
                   1655:            if (c >= '0' && c <= '7')
                   1656:              i = (i << 3) + c - '0';
                   1657:            else
                   1658:              {
                   1659:                (*string_ptr)--;
                   1660:                break;
                   1661:              }
                   1662:          }
                   1663:        if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0)
                   1664:          {
                   1665:            i &= (1 << MAX_CHAR_TYPE_SIZE) - 1;
                   1666:            warning ("octal character constant does not fit in a byte");
                   1667:          }
                   1668:        return i;
                   1669:       }
                   1670:     case 'x':
                   1671:       {
                   1672:        register unsigned i = 0, overflow = 0, digits_found = 0, digit;
                   1673:        for (;;)
                   1674:          {
                   1675:            c = *(*string_ptr)++;
                   1676:            if (c >= '0' && c <= '9')
                   1677:              digit = c - '0';
                   1678:            else if (c >= 'a' && c <= 'f')
                   1679:              digit = c - 'a' + 10;
                   1680:            else if (c >= 'A' && c <= 'F')
                   1681:              digit = c - 'A' + 10;
                   1682:            else
                   1683:              {
                   1684:                (*string_ptr)--;
                   1685:                break;
                   1686:              }
                   1687:            overflow |= i ^ (i << 4 >> 4);
                   1688:            i = (i << 4) + digit;
                   1689:            digits_found = 1;
                   1690:          }
                   1691:        if (!digits_found)
                   1692:          yyerror ("\\x used with no following hex digits");
                   1693:        if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
                   1694:          {
                   1695:            i &= (1 << BITS_PER_UNIT) - 1;
                   1696:            warning ("hex character constant does not fit in a byte");
                   1697:          }
                   1698:        return i;
                   1699:       }
                   1700:     default:
                   1701:       return c;
                   1702:     }
                   1703: }
                   1704: 
                   1705: void
                   1706: yyerror (s)
                   1707:      char *s;
                   1708: {
                   1709:   error (s);
                   1710:   longjmp (parse_return_error, 1);
                   1711: }
                   1712: 
                   1713: static void
                   1714: integer_overflow ()
                   1715: {
                   1716:   if (pedantic)
                   1717:     pedwarn ("integer overflow in preprocessor expression");
                   1718: }
                   1719: 
                   1720: static long
                   1721: left_shift (a, b)
                   1722:      struct constant *a;
                   1723:      unsigned long b;
                   1724: {
                   1725:   if (b >= HOST_BITS_PER_LONG)
                   1726:     {
                   1727:       if (! a->unsignedp && a->value != 0)
                   1728:        integer_overflow ();
                   1729:       return 0;
                   1730:     }
                   1731:   else if (a->unsignedp)
                   1732:     return (unsigned long) a->value << b;
                   1733:   else
                   1734:     {
                   1735:       long l = a->value << b;
                   1736:       if (l >> b != a->value)
                   1737:        integer_overflow ();
                   1738:       return l;
                   1739:     }
                   1740: }
                   1741: 
                   1742: static long
                   1743: right_shift (a, b)
                   1744:      struct constant *a;
                   1745:      unsigned long b;
                   1746: {
                   1747:   if (b >= HOST_BITS_PER_LONG)
                   1748:     return a->unsignedp ? 0 : a->value >> (HOST_BITS_PER_LONG - 1);
                   1749:   else if (a->unsignedp)
                   1750:     return (unsigned long) a->value >> b;
                   1751:   else
                   1752:     return a->value >> b;
                   1753: }
                   1754: 
                   1755: /* This page contains the entry point to this file.  */
                   1756: 
                   1757: /* Parse STRING as an expression, and complain if this fails
                   1758:    to use up all of the contents of STRING.  */
                   1759: /* We do not support C comments.  They should be removed before
                   1760:    this function is called.  */
                   1761: 
                   1762: int
                   1763: parse_c_expression (string)
                   1764:      char *string;
                   1765: {
                   1766:   lexptr = string;
                   1767:   
                   1768:   if (lexptr == 0 || *lexptr == 0) {
                   1769:     error ("empty #if expression");
                   1770:     return 0;                  /* don't include the #if group */
                   1771:   }
                   1772: 
                   1773:   /* if there is some sort of scanning error, just return 0 and assume
                   1774:      the parsing routine has printed an error message somewhere.
                   1775:      there is surely a better thing to do than this.     */
                   1776:   if (setjmp (parse_return_error))
                   1777:     return 0;
                   1778: 
                   1779:   if (yyparse ())
                   1780:     return 0;                  /* actually this is never reached
                   1781:                                   the way things stand. */
                   1782:   if (*lexptr)
                   1783:     error ("Junk after end of expression.");
                   1784: 
                   1785:   return expression_value;     /* set by yyparse () */
                   1786: }
                   1787: 
                   1788: #ifdef TEST_EXP_READER
                   1789: extern int yydebug;
                   1790: 
                   1791: /* Main program for testing purposes.  */
                   1792: int
                   1793: main ()
                   1794: {
                   1795:   int n, c;
                   1796:   char buf[1024];
                   1797: 
                   1798: /*
                   1799:   yydebug = 1;
                   1800: */
                   1801:   initialize_random_junk ();
                   1802: 
                   1803:   for (;;) {
                   1804:     printf ("enter expression: ");
                   1805:     n = 0;
                   1806:     while ((buf[n] = getchar ()) != '\n' && buf[n] != EOF)
                   1807:       n++;
                   1808:     if (buf[n] == EOF)
                   1809:       break;
                   1810:     buf[n] = '\0';
                   1811:     printf ("parser returned %d\n", parse_c_expression (buf));
                   1812:   }
                   1813: 
                   1814:   return 0;
                   1815: }
                   1816: 
                   1817: /* table to tell if char can be part of a C identifier. */
                   1818: unsigned char is_idchar[256];
                   1819: /* table to tell if char can be first char of a c identifier. */
                   1820: unsigned char is_idstart[256];
                   1821: /* table to tell if c is horizontal space.  isspace () thinks that
                   1822:    newline is space; this is not a good idea for this program. */
                   1823: char is_hor_space[256];
                   1824: 
                   1825: /*
                   1826:  * initialize random junk in the hash table and maybe other places
                   1827:  */
                   1828: initialize_random_junk ()
                   1829: {
                   1830:   register int i;
                   1831: 
                   1832:   /*
                   1833:    * Set up is_idchar and is_idstart tables.  These should be
                   1834:    * faster than saying (is_alpha (c) || c == '_'), etc.
                   1835:    * Must do set up these things before calling any routines tthat
                   1836:    * refer to them.
                   1837:    */
                   1838:   for (i = 'a'; i <= 'z'; i++) {
                   1839:     ++is_idchar[i - 'a' + 'A'];
                   1840:     ++is_idchar[i];
                   1841:     ++is_idstart[i - 'a' + 'A'];
                   1842:     ++is_idstart[i];
                   1843:   }
                   1844:   for (i = '0'; i <= '9'; i++)
                   1845:     ++is_idchar[i];
                   1846:   ++is_idchar['_'];
                   1847:   ++is_idstart['_'];
                   1848: #if DOLLARS_IN_IDENTIFIERS
                   1849:   ++is_idchar['$'];
                   1850:   ++is_idstart['$'];
                   1851: #endif
                   1852: 
                   1853:   /* horizontal space table */
                   1854:   ++is_hor_space[' '];
                   1855:   ++is_hor_space['\t'];
                   1856: }
                   1857: 
                   1858: error (msg)
                   1859: {
                   1860:   printf ("error: %s\n", msg);
                   1861: }
                   1862: 
                   1863: warning (msg)
                   1864: {
                   1865:   printf ("warning: %s\n", msg);
                   1866: }
                   1867: 
                   1868: struct hashnode *
                   1869: lookup (name, len, hash)
                   1870:      char *name;
                   1871:      int len;
                   1872:      int hash;
                   1873: {
                   1874:   return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
                   1875: }
                   1876: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.