OSDN Git Service

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