Annotation of gcc/cexp.c, revision 1.1.1.6

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

unix.superglobalmegacorp.com

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