[D3DCOMPILER_43] Sync with Wine Staging 4.18. CORE-16441
[reactos.git] / dll / directx / wine / d3dcompiler_43 / ppy.tab.c
1 /* A Bison parser, made by GNU Bison 3.4.1. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47 /* Identify Bison output. */
48 #define YYBISON 1
49
50 /* Bison version. */
51 #define YYBISON_VERSION "3.4.1"
52
53 /* Skeleton name. */
54 #define YYSKELETON_NAME "yacc.c"
55
56 /* Pure parsers. */
57 #define YYPURE 0
58
59 /* Push parsers. */
60 #define YYPUSH 0
61
62 /* Pull parsers. */
63 #define YYPULL 1
64
65
66 /* Substitute the variable and function names. */
67 #define yyparse ppy_parse
68 #define yylex ppy_lex
69 #define yyerror ppy_error
70 #define yydebug ppy_debug
71 #define yynerrs ppy_nerrs
72
73 #define yylval ppy_lval
74 #define yychar ppy_char
75
76 /* First part of user prologue. */
77 #line 22 "ppy.y"
78
79 #include <stdio.h>
80 #include <stdlib.h>
81 #include <stdarg.h>
82 #include <assert.h>
83 #include <ctype.h>
84 #include <string.h>
85 #include "wpp_private.h"
86
87
88 #define UNARY_OP(r, v, OP) \
89 switch(v.type) \
90 { \
91 case cv_sint: r.val.si = OP v.val.si; break; \
92 case cv_uint: r.val.ui = OP v.val.ui; break; \
93 case cv_slong: r.val.sl = OP v.val.sl; break; \
94 case cv_ulong: r.val.ul = OP v.val.ul; break; \
95 case cv_sll: r.val.sll = OP v.val.sll; break; \
96 case cv_ull: r.val.ull = OP v.val.ull; break; \
97 }
98
99 #define cv_signed(v) ((v.type & FLAG_SIGNED) != 0)
100
101 #define BIN_OP_INT(r, v1, v2, OP) \
102 r.type = v1.type; \
103 if(cv_signed(v1) && cv_signed(v2)) \
104 r.val.si = v1.val.si OP v2.val.si; \
105 else if(cv_signed(v1) && !cv_signed(v2)) \
106 r.val.si = v1.val.si OP (signed) v2.val.ui; \
107 else if(!cv_signed(v1) && cv_signed(v2)) \
108 r.val.si = (signed) v1.val.ui OP v2.val.si; \
109 else \
110 r.val.ui = v1.val.ui OP v2.val.ui;
111
112 #define BIN_OP_LONG(r, v1, v2, OP) \
113 r.type = v1.type; \
114 if(cv_signed(v1) && cv_signed(v2)) \
115 r.val.sl = v1.val.sl OP v2.val.sl; \
116 else if(cv_signed(v1) && !cv_signed(v2)) \
117 r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \
118 else if(!cv_signed(v1) && cv_signed(v2)) \
119 r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \
120 else \
121 r.val.ul = v1.val.ul OP v2.val.ul;
122
123 #define BIN_OP_LONGLONG(r, v1, v2, OP) \
124 r.type = v1.type; \
125 if(cv_signed(v1) && cv_signed(v2)) \
126 r.val.sll = v1.val.sll OP v2.val.sll; \
127 else if(cv_signed(v1) && !cv_signed(v2)) \
128 r.val.sll = v1.val.sll OP (__int64) v2.val.ull; \
129 else if(!cv_signed(v1) && cv_signed(v2)) \
130 r.val.sll = (__int64) v1.val.ull OP v2.val.sll; \
131 else \
132 r.val.ull = v1.val.ull OP v2.val.ull;
133
134 #define BIN_OP(r, v1, v2, OP) \
135 switch(v1.type & SIZE_MASK) \
136 { \
137 case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \
138 case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \
139 case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \
140 default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \
141 }
142
143
144 /*
145 * Prototypes
146 */
147 static int boolean(cval_t *v);
148 static void promote_equal_size(cval_t *v1, cval_t *v2);
149 static void cast_to_sint(cval_t *v);
150 static void cast_to_uint(cval_t *v);
151 static void cast_to_slong(cval_t *v);
152 static void cast_to_ulong(cval_t *v);
153 static void cast_to_sll(cval_t *v);
154 static void cast_to_ull(cval_t *v);
155 static marg_t *new_marg(char *str, def_arg_t type);
156 static marg_t *add_new_marg(char *str, def_arg_t type);
157 static int marg_index(char *id);
158 static mtext_t *new_mtext(char *str, int idx, def_exp_t type);
159 static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp);
160 static char *merge_text(char *s1, char *s2);
161
162 /*
163 * Local variables
164 */
165 static marg_t **macro_args; /* Macro parameters array while parsing */
166 static int nmacro_args;
167
168
169 #line 170 "ppy.tab.c"
170
171 # ifndef YY_NULLPTR
172 # if defined __cplusplus
173 # if 201103L <= __cplusplus
174 # define YY_NULLPTR nullptr
175 # else
176 # define YY_NULLPTR 0
177 # endif
178 # else
179 # define YY_NULLPTR ((void*)0)
180 # endif
181 # endif
182
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
187 #else
188 # define YYERROR_VERBOSE 0
189 #endif
190
191 /* Use api.header.include to #include this header
192 instead of duplicating it here. */
193 #ifndef YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED
194 # define YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED
195 /* Debug traces. */
196 #ifndef YYDEBUG
197 # define YYDEBUG 0
198 #endif
199 #if YYDEBUG
200 extern int ppy_debug;
201 #endif
202
203 /* Token type. */
204 #ifndef YYTOKENTYPE
205 # define YYTOKENTYPE
206 enum yytokentype
207 {
208 tRCINCLUDE = 258,
209 tIF = 259,
210 tIFDEF = 260,
211 tIFNDEF = 261,
212 tELSE = 262,
213 tELIF = 263,
214 tENDIF = 264,
215 tDEFINED = 265,
216 tNL = 266,
217 tINCLUDE = 267,
218 tLINE = 268,
219 tGCCLINE = 269,
220 tERROR = 270,
221 tWARNING = 271,
222 tPRAGMA = 272,
223 tPPIDENT = 273,
224 tUNDEF = 274,
225 tMACROEND = 275,
226 tCONCAT = 276,
227 tELIPSIS = 277,
228 tSTRINGIZE = 278,
229 tIDENT = 279,
230 tLITERAL = 280,
231 tMACRO = 281,
232 tDEFINE = 282,
233 tDQSTRING = 283,
234 tSQSTRING = 284,
235 tIQSTRING = 285,
236 tUINT = 286,
237 tSINT = 287,
238 tULONG = 288,
239 tSLONG = 289,
240 tULONGLONG = 290,
241 tSLONGLONG = 291,
242 tRCINCLUDEPATH = 292,
243 tLOGOR = 293,
244 tLOGAND = 294,
245 tEQ = 295,
246 tNE = 296,
247 tLTE = 297,
248 tGTE = 298,
249 tLSHIFT = 299,
250 tRSHIFT = 300
251 };
252 #endif
253
254 /* Value type. */
255 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
256 union YYSTYPE
257 {
258 #line 114 "ppy.y"
259
260 int sint;
261 unsigned int uint;
262 long slong;
263 unsigned long ulong;
264 __int64 sll;
265 unsigned __int64 ull;
266 int *iptr;
267 char *cptr;
268 cval_t cval;
269 marg_t *marg;
270 mtext_t *mtext;
271
272 #line 273 "ppy.tab.c"
273
274 };
275 typedef union YYSTYPE YYSTYPE;
276 # define YYSTYPE_IS_TRIVIAL 1
277 # define YYSTYPE_IS_DECLARED 1
278 #endif
279
280
281 extern YYSTYPE ppy_lval;
282
283 int ppy_parse (void);
284
285 #endif /* !YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED */
286
287
288
289 #ifdef short
290 # undef short
291 #endif
292
293 #ifdef YYTYPE_UINT8
294 typedef YYTYPE_UINT8 yytype_uint8;
295 #else
296 typedef unsigned char yytype_uint8;
297 #endif
298
299 #ifdef YYTYPE_INT8
300 typedef YYTYPE_INT8 yytype_int8;
301 #else
302 typedef signed char yytype_int8;
303 #endif
304
305 #ifdef YYTYPE_UINT16
306 typedef YYTYPE_UINT16 yytype_uint16;
307 #else
308 typedef unsigned short yytype_uint16;
309 #endif
310
311 #ifdef YYTYPE_INT16
312 typedef YYTYPE_INT16 yytype_int16;
313 #else
314 typedef short yytype_int16;
315 #endif
316
317 #ifndef YYSIZE_T
318 # ifdef __SIZE_TYPE__
319 # define YYSIZE_T __SIZE_TYPE__
320 # elif defined size_t
321 # define YYSIZE_T size_t
322 # elif ! defined YYSIZE_T
323 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
324 # define YYSIZE_T size_t
325 # else
326 # define YYSIZE_T unsigned
327 # endif
328 #endif
329
330 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
331
332 #ifndef YY_
333 # if defined YYENABLE_NLS && YYENABLE_NLS
334 # if ENABLE_NLS
335 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
336 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
337 # endif
338 # endif
339 # ifndef YY_
340 # define YY_(Msgid) Msgid
341 # endif
342 #endif
343
344 #ifndef YY_ATTRIBUTE
345 # if (defined __GNUC__ \
346 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
347 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
348 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
349 # else
350 # define YY_ATTRIBUTE(Spec) /* empty */
351 # endif
352 #endif
353
354 #ifndef YY_ATTRIBUTE_PURE
355 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
356 #endif
357
358 #ifndef YY_ATTRIBUTE_UNUSED
359 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
360 #endif
361
362 /* Suppress unused-variable warnings by "using" E. */
363 #if ! defined lint || defined __GNUC__
364 # define YYUSE(E) ((void) (E))
365 #else
366 # define YYUSE(E) /* empty */
367 #endif
368
369 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
370 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
371 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
372 _Pragma ("GCC diagnostic push") \
373 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
374 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
375 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
376 _Pragma ("GCC diagnostic pop")
377 #else
378 # define YY_INITIAL_VALUE(Value) Value
379 #endif
380 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
381 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
382 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
383 #endif
384 #ifndef YY_INITIAL_VALUE
385 # define YY_INITIAL_VALUE(Value) /* Nothing. */
386 #endif
387
388
389 #define YY_ASSERT(E) ((void) (0 && (E)))
390
391 #if ! defined yyoverflow || YYERROR_VERBOSE
392
393 /* The parser invokes alloca or malloc; define the necessary symbols. */
394
395 # ifdef YYSTACK_USE_ALLOCA
396 # if YYSTACK_USE_ALLOCA
397 # ifdef __GNUC__
398 # define YYSTACK_ALLOC __builtin_alloca
399 # elif defined __BUILTIN_VA_ARG_INCR
400 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
401 # elif defined _AIX
402 # define YYSTACK_ALLOC __alloca
403 # elif defined _MSC_VER
404 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
405 # define alloca _alloca
406 # else
407 # define YYSTACK_ALLOC alloca
408 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
409 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
410 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
411 # ifndef EXIT_SUCCESS
412 # define EXIT_SUCCESS 0
413 # endif
414 # endif
415 # endif
416 # endif
417 # endif
418
419 # ifdef YYSTACK_ALLOC
420 /* Pacify GCC's 'empty if-body' warning. */
421 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
422 # ifndef YYSTACK_ALLOC_MAXIMUM
423 /* The OS might guarantee only one guard page at the bottom of the stack,
424 and a page size can be as small as 4096 bytes. So we cannot safely
425 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
426 to allow for a few compiler-allocated temporary stack slots. */
427 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
428 # endif
429 # else
430 # define YYSTACK_ALLOC YYMALLOC
431 # define YYSTACK_FREE YYFREE
432 # ifndef YYSTACK_ALLOC_MAXIMUM
433 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
434 # endif
435 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
436 && ! ((defined YYMALLOC || defined malloc) \
437 && (defined YYFREE || defined free)))
438 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
439 # ifndef EXIT_SUCCESS
440 # define EXIT_SUCCESS 0
441 # endif
442 # endif
443 # ifndef YYMALLOC
444 # define YYMALLOC malloc
445 # if ! defined malloc && ! defined EXIT_SUCCESS
446 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
447 # endif
448 # endif
449 # ifndef YYFREE
450 # define YYFREE free
451 # if ! defined free && ! defined EXIT_SUCCESS
452 void free (void *); /* INFRINGES ON USER NAME SPACE */
453 # endif
454 # endif
455 # endif
456 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
457
458
459 #if (! defined yyoverflow \
460 && (! defined __cplusplus \
461 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
462
463 /* A type that is properly aligned for any stack member. */
464 union yyalloc
465 {
466 yytype_int16 yyss_alloc;
467 YYSTYPE yyvs_alloc;
468 };
469
470 /* The size of the maximum gap between one aligned stack and the next. */
471 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
472
473 /* The size of an array large to enough to hold all stacks, each with
474 N elements. */
475 # define YYSTACK_BYTES(N) \
476 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
477 + YYSTACK_GAP_MAXIMUM)
478
479 # define YYCOPY_NEEDED 1
480
481 /* Relocate STACK from its old location to the new one. The
482 local variables YYSIZE and YYSTACKSIZE give the old and new number of
483 elements in the stack, and YYPTR gives the new location of the
484 stack. Advance YYPTR to a properly aligned location for the next
485 stack. */
486 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
487 do \
488 { \
489 YYSIZE_T yynewbytes; \
490 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
491 Stack = &yyptr->Stack_alloc; \
492 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
493 yyptr += yynewbytes / sizeof (*yyptr); \
494 } \
495 while (0)
496
497 #endif
498
499 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
500 /* Copy COUNT objects from SRC to DST. The source and destination do
501 not overlap. */
502 # ifndef YYCOPY
503 # if defined __GNUC__ && 1 < __GNUC__
504 # define YYCOPY(Dst, Src, Count) \
505 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
506 # else
507 # define YYCOPY(Dst, Src, Count) \
508 do \
509 { \
510 YYSIZE_T yyi; \
511 for (yyi = 0; yyi < (Count); yyi++) \
512 (Dst)[yyi] = (Src)[yyi]; \
513 } \
514 while (0)
515 # endif
516 # endif
517 #endif /* !YYCOPY_NEEDED */
518
519 /* YYFINAL -- State number of the termination state. */
520 #define YYFINAL 2
521 /* YYLAST -- Last index in YYTABLE. */
522 #define YYLAST 303
523
524 /* YYNTOKENS -- Number of terminals. */
525 #define YYNTOKENS 62
526 /* YYNNTS -- Number of nonterminals. */
527 #define YYNNTS 13
528 /* YYNRULES -- Number of rules. */
529 #define YYNRULES 84
530 /* YYNSTATES -- Number of states. */
531 #define YYNSTATES 153
532
533 #define YYUNDEFTOK 2
534 #define YYMAXUTOK 300
535
536 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
537 as returned by yylex, with out-of-bounds checking. */
538 #define YYTRANSLATE(YYX) \
539 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
540
541 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
542 as returned by yylex. */
543 static const yytype_uint8 yytranslate[] =
544 {
545 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 58, 2, 2, 2, 2, 44, 2,
549 60, 61, 55, 53, 59, 54, 2, 56, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 39, 2,
551 47, 2, 49, 38, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 43, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 42, 2, 57, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
571 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
572 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
573 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
574 35, 36, 37, 40, 41, 45, 46, 48, 50, 51,
575 52
576 };
577
578 #if YYDEBUG
579 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
580 static const yytype_uint16 yyrline[] =
581 {
582 0, 169, 169, 170, 174, 175, 176, 177, 178, 195,
583 219, 245, 259, 260, 261, 264, 265, 266, 268, 270,
584 272, 274, 275, 276, 277, 278, 279, 292, 298, 299,
585 302, 303, 304, 305, 306, 307, 310, 313, 314, 317,
586 318, 321, 322, 326, 327, 333, 334, 337, 338, 339,
587 340, 341, 348, 357, 358, 359, 360, 361, 362, 363,
588 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,
589 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
590 384, 385, 386, 387, 388
591 };
592 #endif
593
594 #if YYDEBUG || YYERROR_VERBOSE || 0
595 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
596 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
597 static const char *const yytname[] =
598 {
599 "$end", "error", "$undefined", "tRCINCLUDE", "tIF", "tIFDEF", "tIFNDEF",
600 "tELSE", "tELIF", "tENDIF", "tDEFINED", "tNL", "tINCLUDE", "tLINE",
601 "tGCCLINE", "tERROR", "tWARNING", "tPRAGMA", "tPPIDENT", "tUNDEF",
602 "tMACROEND", "tCONCAT", "tELIPSIS", "tSTRINGIZE", "tIDENT", "tLITERAL",
603 "tMACRO", "tDEFINE", "tDQSTRING", "tSQSTRING", "tIQSTRING", "tUINT",
604 "tSINT", "tULONG", "tSLONG", "tULONGLONG", "tSLONGLONG",
605 "tRCINCLUDEPATH", "'?'", "':'", "tLOGOR", "tLOGAND", "'|'", "'^'", "'&'",
606 "tEQ", "tNE", "'<'", "tLTE", "'>'", "tGTE", "tLSHIFT", "tRSHIFT", "'+'",
607 "'-'", "'*'", "'/'", "'~'", "'!'", "','", "'('", "')'", "$accept",
608 "pp_file", "preprocessor", "opt_text", "text", "res_arg", "allmargs",
609 "emargs", "margs", "opt_mtexts", "mtexts", "mtext", "pp_expr", YY_NULLPTR
610 };
611 #endif
612
613 # ifdef YYPRINT
614 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
615 (internal) symbol number NUM (which must be that of a token). */
616 static const yytype_uint16 yytoknum[] =
617 {
618 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
619 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
620 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
621 285, 286, 287, 288, 289, 290, 291, 292, 63, 58,
622 293, 294, 124, 94, 38, 295, 296, 60, 297, 62,
623 298, 299, 300, 43, 45, 42, 47, 126, 33, 44,
624 40, 41
625 };
626 # endif
627
628 #define YYPACT_NINF -27
629
630 #define yypact_value_is_default(Yystate) \
631 (!!((Yystate) == (-27)))
632
633 #define YYTABLE_NINF -1
634
635 #define yytable_value_is_error(Yytable_value) \
636 0
637
638 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
639 STATE-NUM. */
640 static const yytype_int16 yypact[] =
641 {
642 -27, 142, -27, -26, -3, -12, -2, 30, -3, 41,
643 91, 21, 2, -19, -19, -19, -19, 32, -27, -19,
644 -27, -27, -27, -23, -27, -27, -27, -27, -27, -27,
645 -27, -3, -3, -3, -3, -3, 38, 66, 109, -27,
646 85, -27, 113, 133, 115, -27, 124, -27, -27, -27,
647 179, -9, 278, 280, 281, 282, 129, 283, -27, 271,
648 -10, -10, -27, -27, 57, -27, -3, -3, -3, -3,
649 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
650 -3, -3, -3, -3, -27, -27, -27, -27, -27, 285,
651 3, -27, -27, -27, -27, -27, -27, -27, -27, -27,
652 277, -27, 239, -27, 238, -27, 132, 167, 182, 196,
653 209, 221, 231, 231, 111, 111, 111, 111, 61, 61,
654 -10, -10, -27, -27, -27, -27, 4, 19, 266, -27,
655 -3, -27, 6, -27, 276, -27, -27, -27, -27, 290,
656 19, -27, -27, -27, 151, -27, 7, -27, -27, -27,
657 -27, 291, -27
658 };
659
660 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
661 Performed when YYTABLE does not specify something else to do. Zero
662 means the default is an error. */
663 static const yytype_uint8 yydefact[] =
664 {
665 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
666 0, 0, 0, 28, 28, 28, 28, 0, 36, 28,
667 3, 27, 26, 0, 61, 54, 53, 56, 55, 58,
668 57, 0, 0, 0, 0, 0, 0, 0, 0, 10,
669 0, 11, 0, 0, 0, 21, 0, 30, 31, 32,
670 0, 29, 0, 0, 0, 0, 37, 0, 59, 0,
671 79, 80, 81, 82, 0, 6, 0, 0, 0, 0,
672 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 7, 8, 9, 4, 5, 0,
674 0, 22, 33, 34, 35, 23, 24, 25, 12, 42,
675 0, 38, 39, 13, 0, 83, 0, 62, 63, 74,
676 72, 73, 64, 65, 66, 68, 67, 69, 77, 78,
677 70, 71, 75, 76, 15, 16, 0, 43, 0, 60,
678 0, 17, 0, 50, 0, 52, 47, 48, 49, 0,
679 44, 45, 40, 41, 84, 18, 0, 51, 14, 46,
680 19, 0, 20
681 };
682
683 /* YYPGOTO[NTERM-NUM]. */
684 static const yytype_int16 yypgoto[] =
685 {
686 -27, -27, -27, -11, -27, -27, -27, -27, -27, -27,
687 -27, 163, -8
688 };
689
690 /* YYDEFGOTO[NTERM-NUM]. */
691 static const yytype_int16 yydefgoto[] =
692 {
693 -1, 1, 20, 50, 51, 56, 100, 101, 102, 139,
694 140, 141, 36
695 };
696
697 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
698 positive, shift that token. If negative, reduce the rule whose
699 number is the opposite. If YYTABLE_NINF, syntax error. */
700 static const yytype_uint8 yytable[] =
701 {
702 40, 58, 21, 52, 53, 54, 47, 23, 57, 48,
703 49, 22, 37, 45, 125, 131, 92, 145, 150, 93,
704 94, 24, 38, 60, 61, 62, 63, 64, 25, 26,
705 27, 28, 29, 30, 46, 126, 132, 59, 146, 151,
706 133, 39, 134, 135, 136, 82, 83, 137, 138, 65,
707 31, 32, 41, 44, 33, 34, 55, 35, 106, 107,
708 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
709 118, 119, 120, 121, 122, 123, 66, 84, 67, 68,
710 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
711 79, 80, 81, 82, 83, 66, 86, 67, 68, 69,
712 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
713 80, 81, 82, 83, 80, 81, 82, 83, 105, 42,
714 85, 43, 144, 66, 87, 67, 68, 69, 70, 71,
715 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
716 82, 83, 2, 89, 88, 3, 4, 5, 6, 7,
717 8, 9, 90, 99, 10, 11, 12, 13, 14, 15,
718 16, 17, 78, 79, 80, 81, 82, 83, 18, 19,
719 66, 130, 67, 68, 69, 70, 71, 72, 73, 74,
720 75, 76, 77, 78, 79, 80, 81, 82, 83, 66,
721 91, 67, 68, 69, 70, 71, 72, 73, 74, 75,
722 76, 77, 78, 79, 80, 81, 82, 83, 68, 69,
723 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
724 80, 81, 82, 83, 69, 70, 71, 72, 73, 74,
725 75, 76, 77, 78, 79, 80, 81, 82, 83, 70,
726 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
727 81, 82, 83, 71, 72, 73, 74, 75, 76, 77,
728 78, 79, 80, 81, 82, 83, 72, 73, 74, 75,
729 76, 77, 78, 79, 80, 81, 82, 83, 74, 75,
730 76, 77, 78, 79, 80, 81, 82, 83, 142, 95,
731 143, 96, 97, 98, 103, 104, 124, 127, 128, 129,
732 147, 148, 152, 149
733 };
734
735 static const yytype_uint8 yycheck[] =
736 {
737 8, 24, 28, 14, 15, 16, 25, 10, 19, 28,
738 29, 37, 24, 11, 11, 11, 25, 11, 11, 28,
739 29, 24, 24, 31, 32, 33, 34, 35, 31, 32,
740 33, 34, 35, 36, 32, 32, 32, 60, 32, 32,
741 21, 11, 23, 24, 25, 55, 56, 28, 29, 11,
742 53, 54, 11, 32, 57, 58, 24, 60, 66, 67,
743 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
744 78, 79, 80, 81, 82, 83, 38, 11, 40, 41,
745 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
746 52, 53, 54, 55, 56, 38, 11, 40, 41, 42,
747 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
748 53, 54, 55, 56, 53, 54, 55, 56, 61, 28,
749 11, 30, 130, 38, 11, 40, 41, 42, 43, 44,
750 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
751 55, 56, 0, 28, 11, 3, 4, 5, 6, 7,
752 8, 9, 28, 24, 12, 13, 14, 15, 16, 17,
753 18, 19, 51, 52, 53, 54, 55, 56, 26, 27,
754 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
755 48, 49, 50, 51, 52, 53, 54, 55, 56, 38,
756 11, 40, 41, 42, 43, 44, 45, 46, 47, 48,
757 49, 50, 51, 52, 53, 54, 55, 56, 41, 42,
758 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
759 53, 54, 55, 56, 42, 43, 44, 45, 46, 47,
760 48, 49, 50, 51, 52, 53, 54, 55, 56, 43,
761 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
762 54, 55, 56, 44, 45, 46, 47, 48, 49, 50,
763 51, 52, 53, 54, 55, 56, 45, 46, 47, 48,
764 49, 50, 51, 52, 53, 54, 55, 56, 47, 48,
765 49, 50, 51, 52, 53, 54, 55, 56, 22, 11,
766 24, 11, 11, 11, 11, 24, 11, 20, 59, 61,
767 24, 11, 11, 140
768 };
769
770 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
771 symbol of state STATE-NUM. */
772 static const yytype_uint8 yystos[] =
773 {
774 0, 63, 0, 3, 4, 5, 6, 7, 8, 9,
775 12, 13, 14, 15, 16, 17, 18, 19, 26, 27,
776 64, 28, 37, 10, 24, 31, 32, 33, 34, 35,
777 36, 53, 54, 57, 58, 60, 74, 24, 24, 11,
778 74, 11, 28, 30, 32, 11, 32, 25, 28, 29,
779 65, 66, 65, 65, 65, 24, 67, 65, 24, 60,
780 74, 74, 74, 74, 74, 11, 38, 40, 41, 42,
781 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
782 53, 54, 55, 56, 11, 11, 11, 11, 11, 28,
783 28, 11, 25, 28, 29, 11, 11, 11, 11, 24,
784 68, 69, 70, 11, 24, 61, 74, 74, 74, 74,
785 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
786 74, 74, 74, 74, 11, 11, 32, 20, 59, 61,
787 39, 11, 32, 21, 23, 24, 25, 28, 29, 71,
788 72, 73, 22, 24, 74, 11, 32, 24, 11, 73,
789 11, 32, 11
790 };
791
792 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
793 static const yytype_uint8 yyr1[] =
794 {
795 0, 62, 63, 63, 64, 64, 64, 64, 64, 64,
796 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
797 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
798 66, 66, 66, 66, 66, 66, 67, 68, 68, 69,
799 69, 70, 70, 71, 71, 72, 72, 73, 73, 73,
800 73, 73, 73, 74, 74, 74, 74, 74, 74, 74,
801 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
802 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
803 74, 74, 74, 74, 74
804 };
805
806 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
807 static const yytype_uint8 yyr2[] =
808 {
809 0, 2, 0, 2, 3, 3, 3, 3, 3, 3,
810 2, 2, 3, 3, 6, 4, 4, 5, 6, 7,
811 8, 2, 3, 3, 3, 3, 2, 2, 0, 1,
812 1, 1, 1, 2, 2, 2, 0, 0, 1, 1,
813 3, 3, 1, 0, 1, 1, 2, 1, 1, 1,
814 1, 2, 1, 1, 1, 1, 1, 1, 1, 2,
815 4, 1, 3, 3, 3, 3, 3, 3, 3, 3,
816 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
817 2, 2, 2, 3, 5
818 };
819
820
821 #define yyerrok (yyerrstatus = 0)
822 #define yyclearin (yychar = YYEMPTY)
823 #define YYEMPTY (-2)
824 #define YYEOF 0
825
826 #define YYACCEPT goto yyacceptlab
827 #define YYABORT goto yyabortlab
828 #define YYERROR goto yyerrorlab
829
830
831 #define YYRECOVERING() (!!yyerrstatus)
832
833 #define YYBACKUP(Token, Value) \
834 do \
835 if (yychar == YYEMPTY) \
836 { \
837 yychar = (Token); \
838 yylval = (Value); \
839 YYPOPSTACK (yylen); \
840 yystate = *yyssp; \
841 goto yybackup; \
842 } \
843 else \
844 { \
845 yyerror (YY_("syntax error: cannot back up")); \
846 YYERROR; \
847 } \
848 while (0)
849
850 /* Error token number */
851 #define YYTERROR 1
852 #define YYERRCODE 256
853
854
855
856 /* Enable debugging if requested. */
857 #if YYDEBUG
858
859 # ifndef YYFPRINTF
860 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
861 # define YYFPRINTF fprintf
862 # endif
863
864 # define YYDPRINTF(Args) \
865 do { \
866 if (yydebug) \
867 YYFPRINTF Args; \
868 } while (0)
869
870 /* This macro is provided for backward compatibility. */
871 #ifndef YY_LOCATION_PRINT
872 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
873 #endif
874
875
876 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
877 do { \
878 if (yydebug) \
879 { \
880 YYFPRINTF (stderr, "%s ", Title); \
881 yy_symbol_print (stderr, \
882 Type, Value); \
883 YYFPRINTF (stderr, "\n"); \
884 } \
885 } while (0)
886
887
888 /*-----------------------------------.
889 | Print this symbol's value on YYO. |
890 `-----------------------------------*/
891
892 static void
893 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
894 {
895 FILE *yyoutput = yyo;
896 YYUSE (yyoutput);
897 if (!yyvaluep)
898 return;
899 # ifdef YYPRINT
900 if (yytype < YYNTOKENS)
901 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
902 # endif
903 YYUSE (yytype);
904 }
905
906
907 /*---------------------------.
908 | Print this symbol on YYO. |
909 `---------------------------*/
910
911 static void
912 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
913 {
914 YYFPRINTF (yyo, "%s %s (",
915 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
916
917 yy_symbol_value_print (yyo, yytype, yyvaluep);
918 YYFPRINTF (yyo, ")");
919 }
920
921 /*------------------------------------------------------------------.
922 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
923 | TOP (included). |
924 `------------------------------------------------------------------*/
925
926 static void
927 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
928 {
929 YYFPRINTF (stderr, "Stack now");
930 for (; yybottom <= yytop; yybottom++)
931 {
932 int yybot = *yybottom;
933 YYFPRINTF (stderr, " %d", yybot);
934 }
935 YYFPRINTF (stderr, "\n");
936 }
937
938 # define YY_STACK_PRINT(Bottom, Top) \
939 do { \
940 if (yydebug) \
941 yy_stack_print ((Bottom), (Top)); \
942 } while (0)
943
944
945 /*------------------------------------------------.
946 | Report that the YYRULE is going to be reduced. |
947 `------------------------------------------------*/
948
949 static void
950 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
951 {
952 unsigned long yylno = yyrline[yyrule];
953 int yynrhs = yyr2[yyrule];
954 int yyi;
955 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
956 yyrule - 1, yylno);
957 /* The symbols being reduced. */
958 for (yyi = 0; yyi < yynrhs; yyi++)
959 {
960 YYFPRINTF (stderr, " $%d = ", yyi + 1);
961 yy_symbol_print (stderr,
962 yystos[yyssp[yyi + 1 - yynrhs]],
963 &yyvsp[(yyi + 1) - (yynrhs)]
964 );
965 YYFPRINTF (stderr, "\n");
966 }
967 }
968
969 # define YY_REDUCE_PRINT(Rule) \
970 do { \
971 if (yydebug) \
972 yy_reduce_print (yyssp, yyvsp, Rule); \
973 } while (0)
974
975 /* Nonzero means print parse trace. It is left uninitialized so that
976 multiple parsers can coexist. */
977 int yydebug;
978 #else /* !YYDEBUG */
979 # define YYDPRINTF(Args)
980 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
981 # define YY_STACK_PRINT(Bottom, Top)
982 # define YY_REDUCE_PRINT(Rule)
983 #endif /* !YYDEBUG */
984
985
986 /* YYINITDEPTH -- initial size of the parser's stacks. */
987 #ifndef YYINITDEPTH
988 # define YYINITDEPTH 200
989 #endif
990
991 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
992 if the built-in stack extension method is used).
993
994 Do not make this value too large; the results are undefined if
995 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
996 evaluated with infinite-precision integer arithmetic. */
997
998 #ifndef YYMAXDEPTH
999 # define YYMAXDEPTH 10000
1000 #endif
1001
1002
1003 #if YYERROR_VERBOSE
1004
1005 # ifndef yystrlen
1006 # if defined __GLIBC__ && defined _STRING_H
1007 # define yystrlen strlen
1008 # else
1009 /* Return the length of YYSTR. */
1010 static YYSIZE_T
1011 yystrlen (const char *yystr)
1012 {
1013 YYSIZE_T yylen;
1014 for (yylen = 0; yystr[yylen]; yylen++)
1015 continue;
1016 return yylen;
1017 }
1018 # endif
1019 # endif
1020
1021 # ifndef yystpcpy
1022 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1023 # define yystpcpy stpcpy
1024 # else
1025 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1026 YYDEST. */
1027 static char *
1028 yystpcpy (char *yydest, const char *yysrc)
1029 {
1030 char *yyd = yydest;
1031 const char *yys = yysrc;
1032
1033 while ((*yyd++ = *yys++) != '\0')
1034 continue;
1035
1036 return yyd - 1;
1037 }
1038 # endif
1039 # endif
1040
1041 # ifndef yytnamerr
1042 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1043 quotes and backslashes, so that it's suitable for yyerror. The
1044 heuristic is that double-quoting is unnecessary unless the string
1045 contains an apostrophe, a comma, or backslash (other than
1046 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1047 null, do not copy; instead, return the length of what the result
1048 would have been. */
1049 static YYSIZE_T
1050 yytnamerr (char *yyres, const char *yystr)
1051 {
1052 if (*yystr == '"')
1053 {
1054 YYSIZE_T yyn = 0;
1055 char const *yyp = yystr;
1056
1057 for (;;)
1058 switch (*++yyp)
1059 {
1060 case '\'':
1061 case ',':
1062 goto do_not_strip_quotes;
1063
1064 case '\\':
1065 if (*++yyp != '\\')
1066 goto do_not_strip_quotes;
1067 else
1068 goto append;
1069
1070 append:
1071 default:
1072 if (yyres)
1073 yyres[yyn] = *yyp;
1074 yyn++;
1075 break;
1076
1077 case '"':
1078 if (yyres)
1079 yyres[yyn] = '\0';
1080 return yyn;
1081 }
1082 do_not_strip_quotes: ;
1083 }
1084
1085 if (! yyres)
1086 return yystrlen (yystr);
1087
1088 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
1089 }
1090 # endif
1091
1092 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1093 about the unexpected token YYTOKEN for the state stack whose top is
1094 YYSSP.
1095
1096 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1097 not large enough to hold the message. In that case, also set
1098 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1099 required number of bytes is too large to store. */
1100 static int
1101 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1102 yytype_int16 *yyssp, int yytoken)
1103 {
1104 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1105 YYSIZE_T yysize = yysize0;
1106 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1107 /* Internationalized format string. */
1108 const char *yyformat = YY_NULLPTR;
1109 /* Arguments of yyformat. */
1110 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1111 /* Number of reported tokens (one for the "unexpected", one per
1112 "expected"). */
1113 int yycount = 0;
1114
1115 /* There are many possibilities here to consider:
1116 - If this state is a consistent state with a default action, then
1117 the only way this function was invoked is if the default action
1118 is an error action. In that case, don't check for expected
1119 tokens because there are none.
1120 - The only way there can be no lookahead present (in yychar) is if
1121 this state is a consistent state with a default action. Thus,
1122 detecting the absence of a lookahead is sufficient to determine
1123 that there is no unexpected or expected token to report. In that
1124 case, just report a simple "syntax error".
1125 - Don't assume there isn't a lookahead just because this state is a
1126 consistent state with a default action. There might have been a
1127 previous inconsistent state, consistent state with a non-default
1128 action, or user semantic action that manipulated yychar.
1129 - Of course, the expected token list depends on states to have
1130 correct lookahead information, and it depends on the parser not
1131 to perform extra reductions after fetching a lookahead from the
1132 scanner and before detecting a syntax error. Thus, state merging
1133 (from LALR or IELR) and default reductions corrupt the expected
1134 token list. However, the list is correct for canonical LR with
1135 one exception: it will still contain any token that will not be
1136 accepted due to an error action in a later state.
1137 */
1138 if (yytoken != YYEMPTY)
1139 {
1140 int yyn = yypact[*yyssp];
1141 yyarg[yycount++] = yytname[yytoken];
1142 if (!yypact_value_is_default (yyn))
1143 {
1144 /* Start YYX at -YYN if negative to avoid negative indexes in
1145 YYCHECK. In other words, skip the first -YYN actions for
1146 this state because they are default actions. */
1147 int yyxbegin = yyn < 0 ? -yyn : 0;
1148 /* Stay within bounds of both yycheck and yytname. */
1149 int yychecklim = YYLAST - yyn + 1;
1150 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1151 int yyx;
1152
1153 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1154 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1155 && !yytable_value_is_error (yytable[yyx + yyn]))
1156 {
1157 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1158 {
1159 yycount = 1;
1160 yysize = yysize0;
1161 break;
1162 }
1163 yyarg[yycount++] = yytname[yyx];
1164 {
1165 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1166 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1167 yysize = yysize1;
1168 else
1169 return 2;
1170 }
1171 }
1172 }
1173 }
1174
1175 switch (yycount)
1176 {
1177 # define YYCASE_(N, S) \
1178 case N: \
1179 yyformat = S; \
1180 break
1181 default: /* Avoid compiler warnings. */
1182 YYCASE_(0, YY_("syntax error"));
1183 YYCASE_(1, YY_("syntax error, unexpected %s"));
1184 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1185 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1186 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1187 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1188 # undef YYCASE_
1189 }
1190
1191 {
1192 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1193 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1194 yysize = yysize1;
1195 else
1196 return 2;
1197 }
1198
1199 if (*yymsg_alloc < yysize)
1200 {
1201 *yymsg_alloc = 2 * yysize;
1202 if (! (yysize <= *yymsg_alloc
1203 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1204 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1205 return 1;
1206 }
1207
1208 /* Avoid sprintf, as that infringes on the user's name space.
1209 Don't have undefined behavior even if the translation
1210 produced a string with the wrong number of "%s"s. */
1211 {
1212 char *yyp = *yymsg;
1213 int yyi = 0;
1214 while ((*yyp = *yyformat) != '\0')
1215 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1216 {
1217 yyp += yytnamerr (yyp, yyarg[yyi++]);
1218 yyformat += 2;
1219 }
1220 else
1221 {
1222 yyp++;
1223 yyformat++;
1224 }
1225 }
1226 return 0;
1227 }
1228 #endif /* YYERROR_VERBOSE */
1229
1230 /*-----------------------------------------------.
1231 | Release the memory associated to this symbol. |
1232 `-----------------------------------------------*/
1233
1234 static void
1235 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1236 {
1237 YYUSE (yyvaluep);
1238 if (!yymsg)
1239 yymsg = "Deleting";
1240 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1241
1242 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1243 YYUSE (yytype);
1244 YY_IGNORE_MAYBE_UNINITIALIZED_END
1245 }
1246
1247
1248
1249
1250 /* The lookahead symbol. */
1251 int yychar;
1252
1253 /* The semantic value of the lookahead symbol. */
1254 YYSTYPE yylval;
1255 /* Number of syntax errors so far. */
1256 int yynerrs;
1257
1258
1259 /*----------.
1260 | yyparse. |
1261 `----------*/
1262
1263 int
1264 yyparse (void)
1265 {
1266 int yystate;
1267 /* Number of tokens to shift before error messages enabled. */
1268 int yyerrstatus;
1269
1270 /* The stacks and their tools:
1271 'yyss': related to states.
1272 'yyvs': related to semantic values.
1273
1274 Refer to the stacks through separate pointers, to allow yyoverflow
1275 to reallocate them elsewhere. */
1276
1277 /* The state stack. */
1278 yytype_int16 yyssa[YYINITDEPTH];
1279 yytype_int16 *yyss;
1280 yytype_int16 *yyssp;
1281
1282 /* The semantic value stack. */
1283 YYSTYPE yyvsa[YYINITDEPTH];
1284 YYSTYPE *yyvs;
1285 YYSTYPE *yyvsp;
1286
1287 YYSIZE_T yystacksize;
1288
1289 int yyn;
1290 int yyresult;
1291 /* Lookahead token as an internal (translated) token number. */
1292 int yytoken = 0;
1293 /* The variables used to return semantic value and location from the
1294 action routines. */
1295 YYSTYPE yyval;
1296
1297 #if YYERROR_VERBOSE
1298 /* Buffer for error messages, and its allocated size. */
1299 char yymsgbuf[128];
1300 char *yymsg = yymsgbuf;
1301 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1302 #endif
1303
1304 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1305
1306 /* The number of symbols on the RHS of the reduced rule.
1307 Keep to zero when no symbol should be popped. */
1308 int yylen = 0;
1309
1310 yyssp = yyss = yyssa;
1311 yyvsp = yyvs = yyvsa;
1312 yystacksize = YYINITDEPTH;
1313
1314 YYDPRINTF ((stderr, "Starting parse\n"));
1315
1316 yystate = 0;
1317 yyerrstatus = 0;
1318 yynerrs = 0;
1319 yychar = YYEMPTY; /* Cause a token to be read. */
1320 goto yysetstate;
1321
1322
1323 /*------------------------------------------------------------.
1324 | yynewstate -- push a new state, which is found in yystate. |
1325 `------------------------------------------------------------*/
1326 yynewstate:
1327 /* In all cases, when you get here, the value and location stacks
1328 have just been pushed. So pushing a state here evens the stacks. */
1329 yyssp++;
1330
1331
1332 /*--------------------------------------------------------------------.
1333 | yynewstate -- set current state (the top of the stack) to yystate. |
1334 `--------------------------------------------------------------------*/
1335 yysetstate:
1336 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1337 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1338 *yyssp = (yytype_int16) yystate;
1339
1340 if (yyss + yystacksize - 1 <= yyssp)
1341 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1342 goto yyexhaustedlab;
1343 #else
1344 {
1345 /* Get the current used size of the three stacks, in elements. */
1346 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1347
1348 # if defined yyoverflow
1349 {
1350 /* Give user a chance to reallocate the stack. Use copies of
1351 these so that the &'s don't force the real ones into
1352 memory. */
1353 YYSTYPE *yyvs1 = yyvs;
1354 yytype_int16 *yyss1 = yyss;
1355
1356 /* Each stack pointer address is followed by the size of the
1357 data in use in that stack, in bytes. This used to be a
1358 conditional around just the two extra args, but that might
1359 be undefined if yyoverflow is a macro. */
1360 yyoverflow (YY_("memory exhausted"),
1361 &yyss1, yysize * sizeof (*yyssp),
1362 &yyvs1, yysize * sizeof (*yyvsp),
1363 &yystacksize);
1364 yyss = yyss1;
1365 yyvs = yyvs1;
1366 }
1367 # else /* defined YYSTACK_RELOCATE */
1368 /* Extend the stack our own way. */
1369 if (YYMAXDEPTH <= yystacksize)
1370 goto yyexhaustedlab;
1371 yystacksize *= 2;
1372 if (YYMAXDEPTH < yystacksize)
1373 yystacksize = YYMAXDEPTH;
1374
1375 {
1376 yytype_int16 *yyss1 = yyss;
1377 union yyalloc *yyptr =
1378 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1379 if (! yyptr)
1380 goto yyexhaustedlab;
1381 YYSTACK_RELOCATE (yyss_alloc, yyss);
1382 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1383 # undef YYSTACK_RELOCATE
1384 if (yyss1 != yyssa)
1385 YYSTACK_FREE (yyss1);
1386 }
1387 # endif
1388
1389 yyssp = yyss + yysize - 1;
1390 yyvsp = yyvs + yysize - 1;
1391
1392 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1393 (unsigned long) yystacksize));
1394
1395 if (yyss + yystacksize - 1 <= yyssp)
1396 YYABORT;
1397 }
1398 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1399
1400 if (yystate == YYFINAL)
1401 YYACCEPT;
1402
1403 goto yybackup;
1404
1405
1406 /*-----------.
1407 | yybackup. |
1408 `-----------*/
1409 yybackup:
1410 /* Do appropriate processing given the current state. Read a
1411 lookahead token if we need one and don't already have one. */
1412
1413 /* First try to decide what to do without reference to lookahead token. */
1414 yyn = yypact[yystate];
1415 if (yypact_value_is_default (yyn))
1416 goto yydefault;
1417
1418 /* Not known => get a lookahead token if don't already have one. */
1419
1420 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1421 if (yychar == YYEMPTY)
1422 {
1423 YYDPRINTF ((stderr, "Reading a token: "));
1424 yychar = yylex ();
1425 }
1426
1427 if (yychar <= YYEOF)
1428 {
1429 yychar = yytoken = YYEOF;
1430 YYDPRINTF ((stderr, "Now at end of input.\n"));
1431 }
1432 else
1433 {
1434 yytoken = YYTRANSLATE (yychar);
1435 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1436 }
1437
1438 /* If the proper action on seeing token YYTOKEN is to reduce or to
1439 detect an error, take that action. */
1440 yyn += yytoken;
1441 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1442 goto yydefault;
1443 yyn = yytable[yyn];
1444 if (yyn <= 0)
1445 {
1446 if (yytable_value_is_error (yyn))
1447 goto yyerrlab;
1448 yyn = -yyn;
1449 goto yyreduce;
1450 }
1451
1452 /* Count tokens shifted since error; after three, turn off error
1453 status. */
1454 if (yyerrstatus)
1455 yyerrstatus--;
1456
1457 /* Shift the lookahead token. */
1458 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1459
1460 /* Discard the shifted token. */
1461 yychar = YYEMPTY;
1462
1463 yystate = yyn;
1464 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1465 *++yyvsp = yylval;
1466 YY_IGNORE_MAYBE_UNINITIALIZED_END
1467 goto yynewstate;
1468
1469
1470 /*-----------------------------------------------------------.
1471 | yydefault -- do the default action for the current state. |
1472 `-----------------------------------------------------------*/
1473 yydefault:
1474 yyn = yydefact[yystate];
1475 if (yyn == 0)
1476 goto yyerrlab;
1477 goto yyreduce;
1478
1479
1480 /*-----------------------------.
1481 | yyreduce -- do a reduction. |
1482 `-----------------------------*/
1483 yyreduce:
1484 /* yyn is the number of a rule to reduce with. */
1485 yylen = yyr2[yyn];
1486
1487 /* If YYLEN is nonzero, implement the default value of the action:
1488 '$$ = $1'.
1489
1490 Otherwise, the following line sets YYVAL to garbage.
1491 This behavior is undocumented and Bison
1492 users should not rely upon it. Assigning to YYVAL
1493 unconditionally makes the parser a bit smaller, and it avoids a
1494 GCC warning that YYVAL may be used uninitialized. */
1495 yyval = yyvsp[1-yylen];
1496
1497
1498 YY_REDUCE_PRINT (yyn);
1499 switch (yyn)
1500 {
1501 case 4:
1502 #line 174 "ppy.y"
1503 { pp_do_include((yyvsp[-1].cptr), 1); }
1504 #line 1505 "ppy.tab.c"
1505 break;
1506
1507 case 5:
1508 #line 175 "ppy.y"
1509 { pp_do_include((yyvsp[-1].cptr), 0); }
1510 #line 1511 "ppy.tab.c"
1511 break;
1512
1513 case 6:
1514 #line 176 "ppy.y"
1515 { pp_next_if_state(boolean(&(yyvsp[-1].cval))); }
1516 #line 1517 "ppy.tab.c"
1517 break;
1518
1519 case 7:
1520 #line 177 "ppy.y"
1521 { pp_next_if_state(pplookup((yyvsp[-1].cptr)) != NULL); free((yyvsp[-1].cptr)); }
1522 #line 1523 "ppy.tab.c"
1523 break;
1524
1525 case 8:
1526 #line 178 "ppy.y"
1527 {
1528 int t = pplookup((yyvsp[-1].cptr)) == NULL;
1529 if(pp_incl_state.state == 0 && t && !pp_incl_state.seen_junk)
1530 {
1531 pp_incl_state.state = 1;
1532 pp_incl_state.ppp = (yyvsp[-1].cptr);
1533 pp_incl_state.ifdepth = pp_get_if_depth();
1534 }
1535 else if(pp_incl_state.state != 1)
1536 {
1537 pp_incl_state.state = -1;
1538 free((yyvsp[-1].cptr));
1539 }
1540 else
1541 free((yyvsp[-1].cptr));
1542 pp_next_if_state(t);
1543 }
1544 #line 1545 "ppy.tab.c"
1545 break;
1546
1547 case 9:
1548 #line 195 "ppy.y"
1549 {
1550 pp_if_state_t s = pp_pop_if();
1551 switch(s)
1552 {
1553 case if_true:
1554 case if_elif:
1555 pp_push_if(if_elif);
1556 break;
1557 case if_false:
1558 pp_push_if(boolean(&(yyvsp[-1].cval)) ? if_true : if_false);
1559 break;
1560 case if_ignore:
1561 pp_push_if(if_ignore);
1562 break;
1563 case if_elsetrue:
1564 case if_elsefalse:
1565 ppy_error("#elif cannot follow #else");
1566 break;
1567 case if_error:
1568 break;
1569 default:
1570 pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s);
1571 }
1572 }
1573 #line 1574 "ppy.tab.c"
1574 break;
1575
1576 case 10:
1577 #line 219 "ppy.y"
1578 {
1579 pp_if_state_t s = pp_pop_if();
1580 switch(s)
1581 {
1582 case if_true:
1583 pp_push_if(if_elsefalse);
1584 break;
1585 case if_elif:
1586 pp_push_if(if_elif);
1587 break;
1588 case if_false:
1589 pp_push_if(if_elsetrue);
1590 break;
1591 case if_ignore:
1592 pp_push_if(if_ignore);
1593 break;
1594 case if_elsetrue:
1595 case if_elsefalse:
1596 ppy_error("#else clause already defined");
1597 break;
1598 case if_error:
1599 break;
1600 default:
1601 pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s);
1602 }
1603 }
1604 #line 1605 "ppy.tab.c"
1605 break;
1606
1607 case 11:
1608 #line 245 "ppy.y"
1609 {
1610 if(pp_pop_if() != if_error)
1611 {
1612 if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1)
1613 {
1614 pp_incl_state.state = 2;
1615 pp_incl_state.seen_junk = 0;
1616 }
1617 else if(pp_incl_state.state != 1)
1618 {
1619 pp_incl_state.state = -1;
1620 }
1621 }
1622 }
1623 #line 1624 "ppy.tab.c"
1624 break;
1625
1626 case 12:
1627 #line 259 "ppy.y"
1628 { pp_del_define((yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); }
1629 #line 1630 "ppy.tab.c"
1630 break;
1631
1632 case 13:
1633 #line 260 "ppy.y"
1634 { pp_add_define((yyvsp[-2].cptr), (yyvsp[-1].cptr)); free((yyvsp[-2].cptr)); free((yyvsp[-1].cptr)); }
1635 #line 1636 "ppy.tab.c"
1636 break;
1637
1638 case 14:
1639 #line 261 "ppy.y"
1640 {
1641 pp_add_macro((yyvsp[-5].cptr), macro_args, nmacro_args, (yyvsp[-1].mtext));
1642 }
1643 #line 1644 "ppy.tab.c"
1644 break;
1645
1646 case 15:
1647 #line 264 "ppy.y"
1648 { if((yyvsp[-1].cptr)) pp_writestring("# %d %s\n", (yyvsp[-2].sint) , (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); }
1649 #line 1650 "ppy.tab.c"
1650 break;
1651
1652 case 16:
1653 #line 265 "ppy.y"
1654 { if((yyvsp[-1].cptr)) pp_writestring("# %d %s\n", (yyvsp[-2].sint) , (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); }
1655 #line 1656 "ppy.tab.c"
1656 break;
1657
1658 case 17:
1659 #line 267 "ppy.y"
1660 { if((yyvsp[-2].cptr)) pp_writestring("# %d %s %d\n", (yyvsp[-3].sint), (yyvsp[-2].cptr), (yyvsp[-1].sint)); free((yyvsp[-2].cptr)); }
1661 #line 1662 "ppy.tab.c"
1662 break;
1663
1664 case 18:
1665 #line 269 "ppy.y"
1666 { if((yyvsp[-3].cptr)) pp_writestring("# %d %s %d %d\n", (yyvsp[-4].sint) ,(yyvsp[-3].cptr), (yyvsp[-2].sint), (yyvsp[-1].sint)); free((yyvsp[-3].cptr)); }
1667 #line 1668 "ppy.tab.c"
1668 break;
1669
1670 case 19:
1671 #line 271 "ppy.y"
1672 { if((yyvsp[-4].cptr)) pp_writestring("# %d %s %d %d %d\n", (yyvsp[-5].sint) ,(yyvsp[-4].cptr) ,(yyvsp[-3].sint) ,(yyvsp[-2].sint), (yyvsp[-1].sint)); free((yyvsp[-4].cptr)); }
1673 #line 1674 "ppy.tab.c"
1674 break;
1675
1676 case 20:
1677 #line 273 "ppy.y"
1678 { if((yyvsp[-5].cptr)) pp_writestring("# %d %s %d %d %d %d\n", (yyvsp[-6].sint) ,(yyvsp[-5].cptr) ,(yyvsp[-4].sint) ,(yyvsp[-3].sint), (yyvsp[-2].sint), (yyvsp[-1].sint)); free((yyvsp[-5].cptr)); }
1679 #line 1680 "ppy.tab.c"
1680 break;
1681
1682 case 22:
1683 #line 275 "ppy.y"
1684 { ppy_error("#error directive: '%s'", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); }
1685 #line 1686 "ppy.tab.c"
1686 break;
1687
1688 case 23:
1689 #line 276 "ppy.y"
1690 { ppy_warning("#warning directive: '%s'", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); }
1691 #line 1692 "ppy.tab.c"
1692 break;
1693
1694 case 24:
1695 #line 277 "ppy.y"
1696 { pp_writestring("#pragma %s\n", (yyvsp[-1].cptr) ? (yyvsp[-1].cptr) : ""); free((yyvsp[-1].cptr)); }
1697 #line 1698 "ppy.tab.c"
1698 break;
1699
1700 case 25:
1701 #line 278 "ppy.y"
1702 { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); }
1703 #line 1704 "ppy.tab.c"
1704 break;
1705
1706 case 26:
1707 #line 279 "ppy.y"
1708 {
1709 if((yyvsp[0].cptr))
1710 {
1711 int nl=strlen((yyvsp[0].cptr)) +3;
1712 char *fn=pp_xmalloc(nl);
1713 if(fn)
1714 {
1715 sprintf(fn,"\"%s\"",(yyvsp[0].cptr));
1716 pp_do_include(fn,1);
1717 }
1718 free((yyvsp[0].cptr));
1719 }
1720 }
1721 #line 1722 "ppy.tab.c"
1722 break;
1723
1724 case 27:
1725 #line 292 "ppy.y"
1726 {
1727 pp_do_include((yyvsp[0].cptr),1);
1728 }
1729 #line 1730 "ppy.tab.c"
1730 break;
1731
1732 case 28:
1733 #line 298 "ppy.y"
1734 { (yyval.cptr) = NULL; }
1735 #line 1736 "ppy.tab.c"
1736 break;
1737
1738 case 29:
1739 #line 299 "ppy.y"
1740 { (yyval.cptr) = (yyvsp[0].cptr); }
1741 #line 1742 "ppy.tab.c"
1742 break;
1743
1744 case 30:
1745 #line 302 "ppy.y"
1746 { (yyval.cptr) = (yyvsp[0].cptr); }
1747 #line 1748 "ppy.tab.c"
1748 break;
1749
1750 case 31:
1751 #line 303 "ppy.y"
1752 { (yyval.cptr) = (yyvsp[0].cptr); }
1753 #line 1754 "ppy.tab.c"
1754 break;
1755
1756 case 32:
1757 #line 304 "ppy.y"
1758 { (yyval.cptr) = (yyvsp[0].cptr); }
1759 #line 1760 "ppy.tab.c"
1760 break;
1761
1762 case 33:
1763 #line 305 "ppy.y"
1764 { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); }
1765 #line 1766 "ppy.tab.c"
1766 break;
1767
1768 case 34:
1769 #line 306 "ppy.y"
1770 { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); }
1771 #line 1772 "ppy.tab.c"
1772 break;
1773
1774 case 35:
1775 #line 307 "ppy.y"
1776 { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); }
1777 #line 1778 "ppy.tab.c"
1778 break;
1779
1780 case 36:
1781 #line 310 "ppy.y"
1782 { macro_args = NULL; nmacro_args = 0; }
1783 #line 1784 "ppy.tab.c"
1784 break;
1785
1786 case 37:
1787 #line 313 "ppy.y"
1788 { (yyval.sint) = 0; macro_args = NULL; nmacro_args = 0; }
1789 #line 1790 "ppy.tab.c"
1790 break;
1791
1792 case 38:
1793 #line 314 "ppy.y"
1794 { (yyval.sint) = nmacro_args; }
1795 #line 1796 "ppy.tab.c"
1796 break;
1797
1798 case 39:
1799 #line 317 "ppy.y"
1800 { (yyval.marg) = (yyvsp[0].marg); }
1801 #line 1802 "ppy.tab.c"
1802 break;
1803
1804 case 40:
1805 #line 318 "ppy.y"
1806 { (yyval.marg) = add_new_marg(NULL, arg_list); nmacro_args *= -1; }
1807 #line 1808 "ppy.tab.c"
1808 break;
1809
1810 case 41:
1811 #line 321 "ppy.y"
1812 { (yyval.marg) = add_new_marg((yyvsp[0].cptr), arg_single); }
1813 #line 1814 "ppy.tab.c"
1814 break;
1815
1816 case 42:
1817 #line 322 "ppy.y"
1818 { (yyval.marg) = add_new_marg((yyvsp[0].cptr), arg_single); }
1819 #line 1820 "ppy.tab.c"
1820 break;
1821
1822 case 43:
1823 #line 326 "ppy.y"
1824 { (yyval.mtext) = NULL; }
1825 #line 1826 "ppy.tab.c"
1826 break;
1827
1828 case 44:
1829 #line 327 "ppy.y"
1830 {
1831 for((yyval.mtext) = (yyvsp[0].mtext); (yyval.mtext) && (yyval.mtext)->prev; (yyval.mtext) = (yyval.mtext)->prev)
1832 ;
1833 }
1834 #line 1835 "ppy.tab.c"
1835 break;
1836
1837 case 45:
1838 #line 333 "ppy.y"
1839 { (yyval.mtext) = (yyvsp[0].mtext); }
1840 #line 1841 "ppy.tab.c"
1841 break;
1842
1843 case 46:
1844 #line 334 "ppy.y"
1845 { (yyval.mtext) = combine_mtext((yyvsp[-1].mtext), (yyvsp[0].mtext)); }
1846 #line 1847 "ppy.tab.c"
1847 break;
1848
1849 case 47:
1850 #line 337 "ppy.y"
1851 { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); }
1852 #line 1853 "ppy.tab.c"
1853 break;
1854
1855 case 48:
1856 #line 338 "ppy.y"
1857 { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); }
1858 #line 1859 "ppy.tab.c"
1859 break;
1860
1861 case 49:
1862 #line 339 "ppy.y"
1863 { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); }
1864 #line 1865 "ppy.tab.c"
1865 break;
1866
1867 case 50:
1868 #line 340 "ppy.y"
1869 { (yyval.mtext) = new_mtext(NULL, 0, exp_concat); }
1870 #line 1871 "ppy.tab.c"
1871 break;
1872
1873 case 51:
1874 #line 341 "ppy.y"
1875 {
1876 int mat = marg_index((yyvsp[0].cptr));
1877 if(mat < 0)
1878 ppy_error("Stringification identifier must be an argument parameter");
1879 else
1880 (yyval.mtext) = new_mtext(NULL, mat, exp_stringize);
1881 }
1882 #line 1883 "ppy.tab.c"
1883 break;
1884
1885 case 52:
1886 #line 348 "ppy.y"
1887 {
1888 int mat = marg_index((yyvsp[0].cptr));
1889 if(mat >= 0)
1890 (yyval.mtext) = new_mtext(NULL, mat, exp_subst);
1891 else if((yyvsp[0].cptr))
1892 (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text);
1893 }
1894 #line 1895 "ppy.tab.c"
1895 break;
1896
1897 case 53:
1898 #line 357 "ppy.y"
1899 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = (yyvsp[0].sint); }
1900 #line 1901 "ppy.tab.c"
1901 break;
1902
1903 case 54:
1904 #line 358 "ppy.y"
1905 { (yyval.cval).type = cv_uint; (yyval.cval).val.ui = (yyvsp[0].uint); }
1906 #line 1907 "ppy.tab.c"
1907 break;
1908
1909 case 55:
1910 #line 359 "ppy.y"
1911 { (yyval.cval).type = cv_slong; (yyval.cval).val.sl = (yyvsp[0].slong); }
1912 #line 1913 "ppy.tab.c"
1913 break;
1914
1915 case 56:
1916 #line 360 "ppy.y"
1917 { (yyval.cval).type = cv_ulong; (yyval.cval).val.ul = (yyvsp[0].ulong); }
1918 #line 1919 "ppy.tab.c"
1919 break;
1920
1921 case 57:
1922 #line 361 "ppy.y"
1923 { (yyval.cval).type = cv_sll; (yyval.cval).val.sll = (yyvsp[0].sll); }
1924 #line 1925 "ppy.tab.c"
1925 break;
1926
1927 case 58:
1928 #line 362 "ppy.y"
1929 { (yyval.cval).type = cv_ull; (yyval.cval).val.ull = (yyvsp[0].ull); }
1930 #line 1931 "ppy.tab.c"
1931 break;
1932
1933 case 59:
1934 #line 363 "ppy.y"
1935 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[0].cptr)) != NULL; }
1936 #line 1937 "ppy.tab.c"
1937 break;
1938
1939 case 60:
1940 #line 364 "ppy.y"
1941 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[-1].cptr)) != NULL; }
1942 #line 1943 "ppy.tab.c"
1943 break;
1944
1945 case 61:
1946 #line 365 "ppy.y"
1947 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = 0; }
1948 #line 1949 "ppy.tab.c"
1949 break;
1950
1951 case 62:
1952 #line 366 "ppy.y"
1953 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[-2].cval)) || boolean(&(yyvsp[0].cval)); }
1954 #line 1955 "ppy.tab.c"
1955 break;
1956
1957 case 63:
1958 #line 367 "ppy.y"
1959 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[-2].cval)) && boolean(&(yyvsp[0].cval)); }
1960 #line 1961 "ppy.tab.c"
1961 break;
1962
1963 case 64:
1964 #line 368 "ppy.y"
1965 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), ==); }
1966 #line 1967 "ppy.tab.c"
1967 break;
1968
1969 case 65:
1970 #line 369 "ppy.y"
1971 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), !=); }
1972 #line 1973 "ppy.tab.c"
1973 break;
1974
1975 case 66:
1976 #line 370 "ppy.y"
1977 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <); }
1978 #line 1979 "ppy.tab.c"
1979 break;
1980
1981 case 67:
1982 #line 371 "ppy.y"
1983 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >); }
1984 #line 1985 "ppy.tab.c"
1985 break;
1986
1987 case 68:
1988 #line 372 "ppy.y"
1989 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <=); }
1990 #line 1991 "ppy.tab.c"
1991 break;
1992
1993 case 69:
1994 #line 373 "ppy.y"
1995 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >=); }
1996 #line 1997 "ppy.tab.c"
1997 break;
1998
1999 case 70:
2000 #line 374 "ppy.y"
2001 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), +); }
2002 #line 2003 "ppy.tab.c"
2003 break;
2004
2005 case 71:
2006 #line 375 "ppy.y"
2007 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), -); }
2008 #line 2009 "ppy.tab.c"
2009 break;
2010
2011 case 72:
2012 #line 376 "ppy.y"
2013 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), ^); }
2014 #line 2015 "ppy.tab.c"
2015 break;
2016
2017 case 73:
2018 #line 377 "ppy.y"
2019 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), &); }
2020 #line 2021 "ppy.tab.c"
2021 break;
2022
2023 case 74:
2024 #line 378 "ppy.y"
2025 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), |); }
2026 #line 2027 "ppy.tab.c"
2027 break;
2028
2029 case 75:
2030 #line 379 "ppy.y"
2031 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), *); }
2032 #line 2033 "ppy.tab.c"
2033 break;
2034
2035 case 76:
2036 #line 380 "ppy.y"
2037 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), /); }
2038 #line 2039 "ppy.tab.c"
2039 break;
2040
2041 case 77:
2042 #line 381 "ppy.y"
2043 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <<); }
2044 #line 2045 "ppy.tab.c"
2045 break;
2046
2047 case 78:
2048 #line 382 "ppy.y"
2049 { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >>); }
2050 #line 2051 "ppy.tab.c"
2051 break;
2052
2053 case 79:
2054 #line 383 "ppy.y"
2055 { (yyval.cval) = (yyvsp[0].cval); }
2056 #line 2057 "ppy.tab.c"
2057 break;
2058
2059 case 80:
2060 #line 384 "ppy.y"
2061 { UNARY_OP((yyval.cval), (yyvsp[0].cval), -); }
2062 #line 2063 "ppy.tab.c"
2063 break;
2064
2065 case 81:
2066 #line 385 "ppy.y"
2067 { UNARY_OP((yyval.cval), (yyvsp[0].cval), ~); }
2068 #line 2069 "ppy.tab.c"
2069 break;
2070
2071 case 82:
2072 #line 386 "ppy.y"
2073 { (yyval.cval).type = cv_sint; (yyval.cval).val.si = !boolean(&(yyvsp[0].cval)); }
2074 #line 2075 "ppy.tab.c"
2075 break;
2076
2077 case 83:
2078 #line 387 "ppy.y"
2079 { (yyval.cval) = (yyvsp[-1].cval); }
2080 #line 2081 "ppy.tab.c"
2081 break;
2082
2083 case 84:
2084 #line 388 "ppy.y"
2085 { (yyval.cval) = boolean(&(yyvsp[-4].cval)) ? (yyvsp[-2].cval) : (yyvsp[0].cval); }
2086 #line 2087 "ppy.tab.c"
2087 break;
2088
2089
2090 #line 2091 "ppy.tab.c"
2091
2092 default: break;
2093 }
2094 /* User semantic actions sometimes alter yychar, and that requires
2095 that yytoken be updated with the new translation. We take the
2096 approach of translating immediately before every use of yytoken.
2097 One alternative is translating here after every semantic action,
2098 but that translation would be missed if the semantic action invokes
2099 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2100 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2101 incorrect destructor might then be invoked immediately. In the
2102 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2103 to an incorrect destructor call or verbose syntax error message
2104 before the lookahead is translated. */
2105 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2106
2107 YYPOPSTACK (yylen);
2108 yylen = 0;
2109 YY_STACK_PRINT (yyss, yyssp);
2110
2111 *++yyvsp = yyval;
2112
2113 /* Now 'shift' the result of the reduction. Determine what state
2114 that goes to, based on the state we popped back to and the rule
2115 number reduced by. */
2116 {
2117 const int yylhs = yyr1[yyn] - YYNTOKENS;
2118 const int yyi = yypgoto[yylhs] + *yyssp;
2119 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2120 ? yytable[yyi]
2121 : yydefgoto[yylhs]);
2122 }
2123
2124 goto yynewstate;
2125
2126
2127 /*--------------------------------------.
2128 | yyerrlab -- here on detecting error. |
2129 `--------------------------------------*/
2130 yyerrlab:
2131 /* Make sure we have latest lookahead translation. See comments at
2132 user semantic actions for why this is necessary. */
2133 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2134
2135 /* If not already recovering from an error, report this error. */
2136 if (!yyerrstatus)
2137 {
2138 ++yynerrs;
2139 #if ! YYERROR_VERBOSE
2140 yyerror (YY_("syntax error"));
2141 #else
2142 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2143 yyssp, yytoken)
2144 {
2145 char const *yymsgp = YY_("syntax error");
2146 int yysyntax_error_status;
2147 yysyntax_error_status = YYSYNTAX_ERROR;
2148 if (yysyntax_error_status == 0)
2149 yymsgp = yymsg;
2150 else if (yysyntax_error_status == 1)
2151 {
2152 if (yymsg != yymsgbuf)
2153 YYSTACK_FREE (yymsg);
2154 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2155 if (!yymsg)
2156 {
2157 yymsg = yymsgbuf;
2158 yymsg_alloc = sizeof yymsgbuf;
2159 yysyntax_error_status = 2;
2160 }
2161 else
2162 {
2163 yysyntax_error_status = YYSYNTAX_ERROR;
2164 yymsgp = yymsg;
2165 }
2166 }
2167 yyerror (yymsgp);
2168 if (yysyntax_error_status == 2)
2169 goto yyexhaustedlab;
2170 }
2171 # undef YYSYNTAX_ERROR
2172 #endif
2173 }
2174
2175
2176
2177 if (yyerrstatus == 3)
2178 {
2179 /* If just tried and failed to reuse lookahead token after an
2180 error, discard it. */
2181
2182 if (yychar <= YYEOF)
2183 {
2184 /* Return failure if at end of input. */
2185 if (yychar == YYEOF)
2186 YYABORT;
2187 }
2188 else
2189 {
2190 yydestruct ("Error: discarding",
2191 yytoken, &yylval);
2192 yychar = YYEMPTY;
2193 }
2194 }
2195
2196 /* Else will try to reuse lookahead token after shifting the error
2197 token. */
2198 goto yyerrlab1;
2199
2200
2201 /*---------------------------------------------------.
2202 | yyerrorlab -- error raised explicitly by YYERROR. |
2203 `---------------------------------------------------*/
2204 yyerrorlab:
2205 /* Pacify compilers when the user code never invokes YYERROR and the
2206 label yyerrorlab therefore never appears in user code. */
2207 if (0)
2208 YYERROR;
2209
2210 /* Do not reclaim the symbols of the rule whose action triggered
2211 this YYERROR. */
2212 YYPOPSTACK (yylen);
2213 yylen = 0;
2214 YY_STACK_PRINT (yyss, yyssp);
2215 yystate = *yyssp;
2216 goto yyerrlab1;
2217
2218
2219 /*-------------------------------------------------------------.
2220 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2221 `-------------------------------------------------------------*/
2222 yyerrlab1:
2223 yyerrstatus = 3; /* Each real token shifted decrements this. */
2224
2225 for (;;)
2226 {
2227 yyn = yypact[yystate];
2228 if (!yypact_value_is_default (yyn))
2229 {
2230 yyn += YYTERROR;
2231 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2232 {
2233 yyn = yytable[yyn];
2234 if (0 < yyn)
2235 break;
2236 }
2237 }
2238
2239 /* Pop the current state because it cannot handle the error token. */
2240 if (yyssp == yyss)
2241 YYABORT;
2242
2243
2244 yydestruct ("Error: popping",
2245 yystos[yystate], yyvsp);
2246 YYPOPSTACK (1);
2247 yystate = *yyssp;
2248 YY_STACK_PRINT (yyss, yyssp);
2249 }
2250
2251 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2252 *++yyvsp = yylval;
2253 YY_IGNORE_MAYBE_UNINITIALIZED_END
2254
2255
2256 /* Shift the error token. */
2257 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2258
2259 yystate = yyn;
2260 goto yynewstate;
2261
2262
2263 /*-------------------------------------.
2264 | yyacceptlab -- YYACCEPT comes here. |
2265 `-------------------------------------*/
2266 yyacceptlab:
2267 yyresult = 0;
2268 goto yyreturn;
2269
2270
2271 /*-----------------------------------.
2272 | yyabortlab -- YYABORT comes here. |
2273 `-----------------------------------*/
2274 yyabortlab:
2275 yyresult = 1;
2276 goto yyreturn;
2277
2278
2279 #if !defined yyoverflow || YYERROR_VERBOSE
2280 /*-------------------------------------------------.
2281 | yyexhaustedlab -- memory exhaustion comes here. |
2282 `-------------------------------------------------*/
2283 yyexhaustedlab:
2284 yyerror (YY_("memory exhausted"));
2285 yyresult = 2;
2286 /* Fall through. */
2287 #endif
2288
2289
2290 /*-----------------------------------------------------.
2291 | yyreturn -- parsing is finished, return the result. |
2292 `-----------------------------------------------------*/
2293 yyreturn:
2294 if (yychar != YYEMPTY)
2295 {
2296 /* Make sure we have latest lookahead translation. See comments at
2297 user semantic actions for why this is necessary. */
2298 yytoken = YYTRANSLATE (yychar);
2299 yydestruct ("Cleanup: discarding lookahead",
2300 yytoken, &yylval);
2301 }
2302 /* Do not reclaim the symbols of the rule whose action triggered
2303 this YYABORT or YYACCEPT. */
2304 YYPOPSTACK (yylen);
2305 YY_STACK_PRINT (yyss, yyssp);
2306 while (yyssp != yyss)
2307 {
2308 yydestruct ("Cleanup: popping",
2309 yystos[*yyssp], yyvsp);
2310 YYPOPSTACK (1);
2311 }
2312 #ifndef yyoverflow
2313 if (yyss != yyssa)
2314 YYSTACK_FREE (yyss);
2315 #endif
2316 #if YYERROR_VERBOSE
2317 if (yymsg != yymsgbuf)
2318 YYSTACK_FREE (yymsg);
2319 #endif
2320 return yyresult;
2321 }
2322 #line 391 "ppy.y"
2323
2324
2325 /*
2326 **************************************************************************
2327 * Support functions
2328 **************************************************************************
2329 */
2330
2331 static void cast_to_sint(cval_t *v)
2332 {
2333 switch(v->type)
2334 {
2335 case cv_sint: break;
2336 case cv_uint: break;
2337 case cv_slong: v->val.si = v->val.sl; break;
2338 case cv_ulong: v->val.si = v->val.ul; break;
2339 case cv_sll: v->val.si = v->val.sll; break;
2340 case cv_ull: v->val.si = v->val.ull; break;
2341 }
2342 v->type = cv_sint;
2343 }
2344
2345 static void cast_to_uint(cval_t *v)
2346 {
2347 switch(v->type)
2348 {
2349 case cv_sint: break;
2350 case cv_uint: break;
2351 case cv_slong: v->val.ui = v->val.sl; break;
2352 case cv_ulong: v->val.ui = v->val.ul; break;
2353 case cv_sll: v->val.ui = v->val.sll; break;
2354 case cv_ull: v->val.ui = v->val.ull; break;
2355 }
2356 v->type = cv_uint;
2357 }
2358
2359 static void cast_to_slong(cval_t *v)
2360 {
2361 switch(v->type)
2362 {
2363 case cv_sint: v->val.sl = v->val.si; break;
2364 case cv_uint: v->val.sl = v->val.ui; break;
2365 case cv_slong: break;
2366 case cv_ulong: break;
2367 case cv_sll: v->val.sl = v->val.sll; break;
2368 case cv_ull: v->val.sl = v->val.ull; break;
2369 }
2370 v->type = cv_slong;
2371 }
2372
2373 static void cast_to_ulong(cval_t *v)
2374 {
2375 switch(v->type)
2376 {
2377 case cv_sint: v->val.ul = v->val.si; break;
2378 case cv_uint: v->val.ul = v->val.ui; break;
2379 case cv_slong: break;
2380 case cv_ulong: break;
2381 case cv_sll: v->val.ul = v->val.sll; break;
2382 case cv_ull: v->val.ul = v->val.ull; break;
2383 }
2384 v->type = cv_ulong;
2385 }
2386
2387 static void cast_to_sll(cval_t *v)
2388 {
2389 switch(v->type)
2390 {
2391 case cv_sint: v->val.sll = v->val.si; break;
2392 case cv_uint: v->val.sll = v->val.ui; break;
2393 case cv_slong: v->val.sll = v->val.sl; break;
2394 case cv_ulong: v->val.sll = v->val.ul; break;
2395 case cv_sll: break;
2396 case cv_ull: break;
2397 }
2398 v->type = cv_sll;
2399 }
2400
2401 static void cast_to_ull(cval_t *v)
2402 {
2403 switch(v->type)
2404 {
2405 case cv_sint: v->val.ull = v->val.si; break;
2406 case cv_uint: v->val.ull = v->val.ui; break;
2407 case cv_slong: v->val.ull = v->val.sl; break;
2408 case cv_ulong: v->val.ull = v->val.ul; break;
2409 case cv_sll: break;
2410 case cv_ull: break;
2411 }
2412 v->type = cv_ull;
2413 }
2414
2415
2416 static void promote_equal_size(cval_t *v1, cval_t *v2)
2417 {
2418 #define cv_sizeof(v) ((int)(v->type & SIZE_MASK))
2419 int s1 = cv_sizeof(v1);
2420 int s2 = cv_sizeof(v2);
2421 #undef cv_sizeof
2422
2423 if(s1 == s2)
2424 return;
2425 else if(s1 > s2)
2426 {
2427 switch(v1->type)
2428 {
2429 case cv_sint: cast_to_sint(v2); break;
2430 case cv_uint: cast_to_uint(v2); break;
2431 case cv_slong: cast_to_slong(v2); break;
2432 case cv_ulong: cast_to_ulong(v2); break;
2433 case cv_sll: cast_to_sll(v2); break;
2434 case cv_ull: cast_to_ull(v2); break;
2435 }
2436 }
2437 else
2438 {
2439 switch(v2->type)
2440 {
2441 case cv_sint: cast_to_sint(v1); break;
2442 case cv_uint: cast_to_uint(v1); break;
2443 case cv_slong: cast_to_slong(v1); break;
2444 case cv_ulong: cast_to_ulong(v1); break;
2445 case cv_sll: cast_to_sll(v1); break;
2446 case cv_ull: cast_to_ull(v1); break;
2447 }
2448 }
2449 }
2450
2451
2452 static int boolean(cval_t *v)
2453 {
2454 switch(v->type)
2455 {
2456 case cv_sint: return v->val.si != 0;
2457 case cv_uint: return v->val.ui != 0;
2458 case cv_slong: return v->val.sl != 0;
2459 case cv_ulong: return v->val.ul != 0;
2460 case cv_sll: return v->val.sll != 0;
2461 case cv_ull: return v->val.ull != 0;
2462 }
2463 return 0;
2464 }
2465
2466 static marg_t *new_marg(char *str, def_arg_t type)
2467 {
2468 marg_t *ma = pp_xmalloc(sizeof(marg_t));
2469 if(!ma)
2470 return NULL;
2471 ma->arg = str;
2472 ma->type = type;
2473 ma->nnl = 0;
2474 return ma;
2475 }
2476
2477 static marg_t *add_new_marg(char *str, def_arg_t type)
2478 {
2479 marg_t **new_macro_args;
2480 marg_t *ma;
2481 if(!str)
2482 return NULL;
2483 new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0]));
2484 if(!new_macro_args)
2485 return NULL;
2486 macro_args = new_macro_args;
2487 ma = new_marg(str, type);
2488 if(!ma)
2489 return NULL;
2490 macro_args[nmacro_args] = ma;
2491 nmacro_args++;
2492 return ma;
2493 }
2494
2495 static int marg_index(char *id)
2496 {
2497 int t;
2498 if(!id)
2499 return -1;
2500 for(t = 0; t < nmacro_args; t++)
2501 {
2502 if(!strcmp(id, macro_args[t]->arg))
2503 break;
2504 }
2505 return t < nmacro_args ? t : -1;
2506 }
2507
2508 static mtext_t *new_mtext(char *str, int idx, def_exp_t type)
2509 {
2510 mtext_t *mt = pp_xmalloc(sizeof(mtext_t));
2511 if(!mt)
2512 return NULL;
2513 if(str == NULL)
2514 mt->subst.argidx = idx;
2515 else
2516 mt->subst.text = str;
2517 mt->type = type;
2518 mt->next = mt->prev = NULL;
2519 return mt;
2520 }
2521
2522 static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp)
2523 {
2524 if(!tail)
2525 return mtp;
2526
2527 if(!mtp)
2528 return tail;
2529
2530 if(tail->type == exp_text && mtp->type == exp_text)
2531 {
2532 char *new_text;
2533 new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1);
2534 if(!new_text)
2535 return mtp;
2536 tail->subst.text = new_text;
2537 strcat(tail->subst.text, mtp->subst.text);
2538 free(mtp->subst.text);
2539 free(mtp);
2540 return tail;
2541 }
2542
2543 if(tail->type == exp_concat && mtp->type == exp_concat)
2544 {
2545 free(mtp);
2546 return tail;
2547 }
2548
2549 if(tail->type == exp_concat && mtp->type == exp_text)
2550 {
2551 int len = strlen(mtp->subst.text);
2552 while(len)
2553 {
2554 /* FIXME: should delete space from head of string */
2555 if(isspace(mtp->subst.text[len-1] & 0xff))
2556 mtp->subst.text[--len] = '\0';
2557 else
2558 break;
2559 }
2560
2561 if(!len)
2562 {
2563 free(mtp->subst.text);
2564 free(mtp);
2565 return tail;
2566 }
2567 }
2568
2569 if(tail->type == exp_text && mtp->type == exp_concat)
2570 {
2571 int len = strlen(tail->subst.text);
2572 while(len)
2573 {
2574 if(isspace(tail->subst.text[len-1] & 0xff))
2575 tail->subst.text[--len] = '\0';
2576 else
2577 break;
2578 }
2579
2580 if(!len)
2581 {
2582 mtp->prev = tail->prev;
2583 mtp->next = tail->next;
2584 if(tail->prev)
2585 tail->prev->next = mtp;
2586 free(tail->subst.text);
2587 free(tail);
2588 return mtp;
2589 }
2590 }
2591
2592 tail->next = mtp;
2593 mtp->prev = tail;
2594
2595 return mtp;
2596 }
2597
2598 static char *merge_text(char *s1, char *s2)
2599 {
2600 int l1;
2601 int l2;
2602 char *snew;
2603 if(!s1)
2604 return s2;
2605 if(!s2)
2606 return s1;
2607 l1 = strlen(s1);
2608 l2 = strlen(s2);
2609 snew = pp_xrealloc(s1, l1+l2+1);
2610 if(!snew)
2611 {
2612 free(s2);
2613 return s1;
2614 }
2615 s1 = snew;
2616 memcpy(s1+l1, s2, l2+1);
2617 free(s2);
2618 return s1;
2619 }