From dffb99c172d74986c9cbcd2ce42d73b822c5bcd9 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 26 Oct 2019 13:00:33 +0100 Subject: [PATCH] [D3DCOMPILER_43] Sync with Wine Staging 4.18. CORE-16441 --- .../wine/d3dcompiler_43/CMakeLists.txt | 15 +- dll/directx/wine/d3dcompiler_43/asmparser.c | 2 - dll/directx/wine/d3dcompiler_43/asmshader.l | 2 - .../wine/d3dcompiler_43/asmshader.tab.c | 1191 +++-- .../wine/d3dcompiler_43/asmshader.tab.h | 21 +- dll/directx/wine/d3dcompiler_43/asmshader.y | 10 +- .../wine/d3dcompiler_43/asmshader.yy.c | 1327 +++-- .../wine/d3dcompiler_43/asmshader.yy.h | 711 +++ dll/directx/wine/d3dcompiler_43/blob.c | 53 +- .../wine/d3dcompiler_43/bytecodewriter.c | 2 - dll/directx/wine/d3dcompiler_43/compiler.c | 232 +- .../wine/d3dcompiler_43/d3dcompiler_private.h | 73 +- dll/directx/wine/d3dcompiler_43/hlsl.l | 2 - dll/directx/wine/d3dcompiler_43/hlsl.tab.c | 2054 ++++--- dll/directx/wine/d3dcompiler_43/hlsl.tab.h | 17 +- dll/directx/wine/d3dcompiler_43/hlsl.y | 361 +- dll/directx/wine/d3dcompiler_43/hlsl.yy.c | 1165 ++-- dll/directx/wine/d3dcompiler_43/hlsl.yy.h | 715 +++ dll/directx/wine/d3dcompiler_43/main.c | 2 - dll/directx/wine/d3dcompiler_43/ppl.l | 1547 ++++++ dll/directx/wine/d3dcompiler_43/ppl.yy.c | 4757 +++++++++++++++++ dll/directx/wine/d3dcompiler_43/ppl.yy.h | 730 +++ dll/directx/wine/d3dcompiler_43/ppy.tab.c | 2619 +++++++++ dll/directx/wine/d3dcompiler_43/ppy.tab.h | 129 + dll/directx/wine/d3dcompiler_43/ppy.y | 687 +++ dll/directx/wine/d3dcompiler_43/preproc.c | 447 ++ dll/directx/wine/d3dcompiler_43/reflection.c | 48 +- dll/directx/wine/d3dcompiler_43/utils.c | 220 +- dll/directx/wine/d3dcompiler_43/wpp_private.h | 250 + media/doc/README.WINE | 2 +- 30 files changed, 16251 insertions(+), 3140 deletions(-) create mode 100644 dll/directx/wine/d3dcompiler_43/asmshader.yy.h create mode 100644 dll/directx/wine/d3dcompiler_43/hlsl.yy.h create mode 100644 dll/directx/wine/d3dcompiler_43/ppl.l create mode 100644 dll/directx/wine/d3dcompiler_43/ppl.yy.c create mode 100644 dll/directx/wine/d3dcompiler_43/ppl.yy.h create mode 100644 dll/directx/wine/d3dcompiler_43/ppy.tab.c create mode 100644 dll/directx/wine/d3dcompiler_43/ppy.tab.h create mode 100644 dll/directx/wine/d3dcompiler_43/ppy.y create mode 100644 dll/directx/wine/d3dcompiler_43/preproc.c create mode 100644 dll/directx/wine/d3dcompiler_43/wpp_private.h diff --git a/dll/directx/wine/d3dcompiler_43/CMakeLists.txt b/dll/directx/wine/d3dcompiler_43/CMakeLists.txt index 7c5cb428400..a036c7ea3e6 100644 --- a/dll/directx/wine/d3dcompiler_43/CMakeLists.txt +++ b/dll/directx/wine/d3dcompiler_43/CMakeLists.txt @@ -8,14 +8,11 @@ spec2def(d3dcompiler_43.dll d3dcompiler_43.spec ADD_IMPORTLIB) list(APPEND SOURCE asmparser.c - asmshader.tab.c - asmshader.yy.c blob.c bytecodewriter.c compiler.c - hlsl.tab.c - hlsl.yy.c main.c + preproc.c reflection.c utils.c precomp.h @@ -23,6 +20,12 @@ list(APPEND SOURCE add_library(d3dcompiler_43 MODULE ${SOURCE} + asmshader.tab.c + asmshader.yy.c + hlsl.tab.c + hlsl.yy.c + ppy.tab.c + ppl.yy.c version.rc ${CMAKE_CURRENT_BINARY_DIR}/d3dcompiler_43.def) @@ -32,11 +35,13 @@ set_source_files_properties( asmshader.yy.c hlsl.tab.c hlsl.yy.c + ppy.tab.c + ppl.yy.c PROPERTIES COMPILE_FLAGS "-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"") set_module_type(d3dcompiler_43 win32dll) target_link_libraries(d3dcompiler_43 dx10guid uuid wine wpp) add_importlibs(d3dcompiler_43 msvcrt kernel32 ntdll) add_dependencies(d3dcompiler_43 d3d_idl_headers) -#add_pch(d3dcompiler_43 precomp.h SOURCE) +add_pch(d3dcompiler_43 precomp.h SOURCE) add_cd_file(TARGET d3dcompiler_43 DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/wine/d3dcompiler_43/asmparser.c b/dll/directx/wine/d3dcompiler_43/asmparser.c index 2d167dece57..16e86d94dab 100644 --- a/dll/directx/wine/d3dcompiler_43/asmparser.c +++ b/dll/directx/wine/d3dcompiler_43/asmparser.c @@ -20,8 +20,6 @@ * */ -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #include "d3dcompiler_private.h" diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.l b/dll/directx/wine/d3dcompiler_43/asmshader.l index 35a404817f5..63ecddd1899 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.l +++ b/dll/directx/wine/d3dcompiler_43/asmshader.l @@ -20,8 +20,6 @@ */ %{ -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #include "d3dcompiler_private.h" diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.tab.c b/dll/directx/wine/d3dcompiler_43/asmshader.tab.c index 53e79a219fe..4ac2b9dee0d 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.tab.c +++ b/dll/directx/wine/d3dcompiler_43/asmshader.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -69,8 +73,10 @@ #define yylval asmshader_lval #define yychar asmshader_char -/* Copy the first part of user declarations. */ -#line 22 "asmshader.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 22 "asmshader.y" + +#include "wine/debug.h" #include "d3dcompiler_private.h" @@ -78,13 +84,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(asmshader); struct asm_parser asm_ctx; -void asmparser_message(struct asm_parser *ctx, const char *fmt, ...) +void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt, ...) { - va_list args; + __ms_va_list args; - va_start(args, fmt); + __ms_va_start(args, fmt); compilation_message(&ctx->messages, fmt, args); - va_end(args); + __ms_va_end(args); } static void asmshader_error(char const *s) { @@ -114,13 +120,17 @@ int asmshader_lex(void); -#line 122 "asmshader.tab.c" /* yacc.c:339 */ +#line 124 "asmshader.tab.c" # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -132,7 +142,10 @@ int asmshader_lex(void); # define YYERROR_VERBOSE 0 #endif - +/* Use api.header.include to #include this header + instead of duplicating it here. */ +#ifndef YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED +# define YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -311,10 +324,9 @@ extern int asmshader_debug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 70 "asmshader.y" /* yacc.c:355 */ +#line 68 "asmshader.y" struct { float val; @@ -349,8 +361,10 @@ union YYSTYPE struct rel_reg rel_reg; struct src_regs sregs; -#line 357 "asmshader.tab.c" /* yacc.c:355 */ +#line 365 "asmshader.tab.c" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -360,11 +374,9 @@ extern YYSTYPE asmshader_lval; int asmshader_parse (void); +#endif /* !YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED */ -/* Copy the second part of user declarations. */ - -#line 372 "asmshader.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -385,13 +397,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -403,7 +415,7 @@ typedef short int yytype_int16; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -439,15 +451,6 @@ typedef short int yytype_int16; # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -455,7 +458,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -475,6 +478,8 @@ typedef short int yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -617,16 +622,16 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 552 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 417 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -677,29 +682,29 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 311, 311, 316, 321, 326, 331, 336, 341, 346, - 351, 356, 361, 366, 371, 376, 382, 383, 388, 392, - 397, 403, 408, 413, 418, 423, 428, 433, 438, 443, - 448, 453, 458, 463, 468, 473, 478, 483, 488, 493, - 498, 503, 508, 513, 518, 523, 528, 533, 538, 543, - 548, 553, 558, 563, 575, 587, 610, 633, 655, 677, - 687, 702, 709, 716, 720, 724, 728, 733, 738, 743, - 748, 753, 758, 763, 768, 773, 778, 783, 788, 793, - 798, 803, 808, 813, 818, 823, 828, 833, 838, 843, - 849, 854, 859, 864, 875, 880, 885, 890, 895, 900, - 905, 910, 915, 920, 925, 930, 935, 940, 945, 950, - 955, 960, 965, 970, 975, 980, 987, 995, 1004, 1008, - 1012, 1016, 1022, 1028, 1034, 1038, 1042, 1048, 1052, 1056, - 1060, 1064, 1068, 1072, 1076, 1082, 1088, 1093, 1100, 1115, - 1121, 1137, 1141, 1163, 1168, 1182, 1186, 1199, 1204, 1209, - 1214, 1219, 1224, 1229, 1234, 1239, 1245, 1250, 1261, 1269, - 1277, 1285, 1310, 1324, 1338, 1348, 1352, 1357, 1365, 1373, - 1381, 1390, 1399, 1409, 1413, 1417, 1421, 1425, 1429, 1434, - 1438, 1443, 1447, 1453, 1457, 1461, 1465, 1469, 1473, 1479, - 1483, 1489, 1495, 1501, 1507, 1513, 1517, 1521, 1525, 1529, - 1533, 1538, 1539, 1540, 1541, 1542, 1543, 1545, 1551, 1557, - 1563, 1569, 1575, 1581, 1587, 1593, 1599, 1605, 1611, 1617, - 1623, 1630, 1634, 1639, 1643, 1647, 1651, 1656, 1664 + 0, 309, 309, 314, 319, 324, 329, 334, 339, 344, + 349, 354, 359, 364, 369, 374, 380, 381, 386, 390, + 395, 401, 406, 411, 416, 421, 426, 431, 436, 441, + 446, 451, 456, 461, 466, 471, 476, 481, 486, 491, + 496, 501, 506, 511, 516, 521, 526, 531, 536, 541, + 546, 551, 556, 561, 573, 585, 608, 631, 653, 675, + 685, 700, 707, 714, 718, 722, 726, 731, 736, 741, + 746, 751, 756, 761, 766, 771, 776, 781, 786, 791, + 796, 801, 806, 811, 816, 821, 826, 831, 836, 841, + 847, 852, 857, 862, 873, 878, 883, 888, 893, 898, + 903, 908, 913, 918, 923, 928, 933, 938, 943, 948, + 953, 958, 963, 968, 973, 978, 985, 993, 1002, 1006, + 1010, 1014, 1020, 1026, 1032, 1036, 1040, 1046, 1050, 1054, + 1058, 1062, 1066, 1070, 1074, 1080, 1086, 1091, 1098, 1113, + 1119, 1135, 1139, 1161, 1166, 1180, 1184, 1197, 1202, 1207, + 1212, 1217, 1222, 1227, 1232, 1237, 1243, 1248, 1259, 1267, + 1275, 1283, 1308, 1322, 1336, 1346, 1350, 1355, 1363, 1371, + 1379, 1388, 1397, 1407, 1411, 1415, 1419, 1423, 1427, 1432, + 1436, 1441, 1445, 1451, 1455, 1459, 1463, 1467, 1471, 1477, + 1481, 1487, 1493, 1499, 1505, 1511, 1515, 1519, 1523, 1527, + 1531, 1536, 1537, 1538, 1539, 1540, 1541, 1543, 1549, 1555, + 1561, 1567, 1573, 1579, 1585, 1591, 1597, 1603, 1609, 1615, + 1621, 1628, 1632, 1637, 1641, 1645, 1649, 1654, 1662 }; #endif @@ -1218,22 +1223,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -1273,37 +1278,37 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -1337,7 +1342,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -1348,7 +1353,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -1452,7 +1457,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1470,7 +1478,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1548,10 +1556,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1563,6 +1571,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1574,9 +1583,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1702,23 +1712,33 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -1734,14 +1754,10 @@ yyparse (void) &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1757,35 +1773,33 @@ yyparse (void) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1843,7 +1857,6 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; @@ -1858,7 +1871,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1878,455 +1891,455 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 312 "asmshader.y" /* yacc.c:1646 */ + case 2: +#line 310 "asmshader.y" { asm_ctx.funcs->end(&asm_ctx); } -#line 1891 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1900 "asmshader.tab.c" break; case 3: -#line 317 "asmshader.y" /* yacc.c:1646 */ +#line 315 "asmshader.y" { TRACE("Vertex shader 1.0\n"); create_vs10_parser(&asm_ctx); } -#line 1900 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1909 "asmshader.tab.c" break; case 4: -#line 322 "asmshader.y" /* yacc.c:1646 */ +#line 320 "asmshader.y" { TRACE("Vertex shader 1.1\n"); create_vs11_parser(&asm_ctx); } -#line 1909 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1918 "asmshader.tab.c" break; case 5: -#line 327 "asmshader.y" /* yacc.c:1646 */ +#line 325 "asmshader.y" { TRACE("Vertex shader 2.0\n"); create_vs20_parser(&asm_ctx); } -#line 1918 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1927 "asmshader.tab.c" break; case 6: -#line 332 "asmshader.y" /* yacc.c:1646 */ +#line 330 "asmshader.y" { TRACE("Vertex shader 2.x\n"); create_vs2x_parser(&asm_ctx); } -#line 1927 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1936 "asmshader.tab.c" break; case 7: -#line 337 "asmshader.y" /* yacc.c:1646 */ +#line 335 "asmshader.y" { TRACE("Vertex shader 3.0\n"); create_vs30_parser(&asm_ctx); } -#line 1936 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1945 "asmshader.tab.c" break; case 8: -#line 342 "asmshader.y" /* yacc.c:1646 */ +#line 340 "asmshader.y" { TRACE("Pixel shader 1.0\n"); create_ps10_parser(&asm_ctx); } -#line 1945 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1954 "asmshader.tab.c" break; case 9: -#line 347 "asmshader.y" /* yacc.c:1646 */ +#line 345 "asmshader.y" { TRACE("Pixel shader 1.1\n"); create_ps11_parser(&asm_ctx); } -#line 1954 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1963 "asmshader.tab.c" break; case 10: -#line 352 "asmshader.y" /* yacc.c:1646 */ +#line 350 "asmshader.y" { TRACE("Pixel shader 1.2\n"); create_ps12_parser(&asm_ctx); } -#line 1963 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1972 "asmshader.tab.c" break; case 11: -#line 357 "asmshader.y" /* yacc.c:1646 */ +#line 355 "asmshader.y" { TRACE("Pixel shader 1.3\n"); create_ps13_parser(&asm_ctx); } -#line 1972 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1981 "asmshader.tab.c" break; case 12: -#line 362 "asmshader.y" /* yacc.c:1646 */ +#line 360 "asmshader.y" { TRACE("Pixel shader 1.4\n"); create_ps14_parser(&asm_ctx); } -#line 1981 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1990 "asmshader.tab.c" break; case 13: -#line 367 "asmshader.y" /* yacc.c:1646 */ +#line 365 "asmshader.y" { TRACE("Pixel shader 2.0\n"); create_ps20_parser(&asm_ctx); } -#line 1990 "asmshader.tab.c" /* yacc.c:1646 */ +#line 1999 "asmshader.tab.c" break; case 14: -#line 372 "asmshader.y" /* yacc.c:1646 */ +#line 370 "asmshader.y" { TRACE("Pixel shader 2.x\n"); create_ps2x_parser(&asm_ctx); } -#line 1999 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2008 "asmshader.tab.c" break; case 15: -#line 377 "asmshader.y" /* yacc.c:1646 */ +#line 375 "asmshader.y" { TRACE("Pixel shader 3.0\n"); create_ps30_parser(&asm_ctx); } -#line 2008 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2017 "asmshader.tab.c" break; case 17: -#line 384 "asmshader.y" /* yacc.c:1646 */ +#line 382 "asmshader.y" { /* Nothing to do */ } -#line 2016 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2025 "asmshader.tab.c" break; case 18: -#line 389 "asmshader.y" /* yacc.c:1646 */ +#line 387 "asmshader.y" { } -#line 2024 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2033 "asmshader.tab.c" break; case 19: -#line 393 "asmshader.y" /* yacc.c:1646 */ +#line 391 "asmshader.y" { TRACE("predicate\n"); asm_ctx.funcs->predicate(&asm_ctx, &(yyvsp[-1].reg)); } -#line 2033 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2042 "asmshader.tab.c" break; case 20: -#line 398 "asmshader.y" /* yacc.c:1646 */ +#line 396 "asmshader.y" { TRACE("coissue\n"); asm_ctx.funcs->coissue(&asm_ctx); } -#line 2042 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2051 "asmshader.tab.c" break; case 21: -#line 404 "asmshader.y" /* yacc.c:1646 */ +#line 402 "asmshader.y" { TRACE("ADD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_ADD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2051 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2060 "asmshader.tab.c" break; case 22: -#line 409 "asmshader.y" /* yacc.c:1646 */ +#line 407 "asmshader.y" { TRACE("NOP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_NOP, 0, 0, 0, 0, 0, 0); } -#line 2060 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2069 "asmshader.tab.c" break; case 23: -#line 414 "asmshader.y" /* yacc.c:1646 */ +#line 412 "asmshader.y" { TRACE("MOV\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_MOV, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2069 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2078 "asmshader.tab.c" break; case 24: -#line 419 "asmshader.y" /* yacc.c:1646 */ +#line 417 "asmshader.y" { TRACE("SUB\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_SUB, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2078 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2087 "asmshader.tab.c" break; case 25: -#line 424 "asmshader.y" /* yacc.c:1646 */ +#line 422 "asmshader.y" { TRACE("MAD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_MAD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 3); } -#line 2087 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2096 "asmshader.tab.c" break; case 26: -#line 429 "asmshader.y" /* yacc.c:1646 */ +#line 427 "asmshader.y" { TRACE("MUL\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_MUL, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2096 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2105 "asmshader.tab.c" break; case 27: -#line 434 "asmshader.y" /* yacc.c:1646 */ +#line 432 "asmshader.y" { TRACE("RCP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_RCP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2105 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2114 "asmshader.tab.c" break; case 28: -#line 439 "asmshader.y" /* yacc.c:1646 */ +#line 437 "asmshader.y" { TRACE("RSQ\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_RSQ, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2114 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2123 "asmshader.tab.c" break; case 29: -#line 444 "asmshader.y" /* yacc.c:1646 */ +#line 442 "asmshader.y" { TRACE("DP3\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_DP3, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2123 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2132 "asmshader.tab.c" break; case 30: -#line 449 "asmshader.y" /* yacc.c:1646 */ +#line 447 "asmshader.y" { TRACE("DP4\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_DP4, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2132 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2141 "asmshader.tab.c" break; case 31: -#line 454 "asmshader.y" /* yacc.c:1646 */ +#line 452 "asmshader.y" { TRACE("MIN\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_MIN, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2141 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2150 "asmshader.tab.c" break; case 32: -#line 459 "asmshader.y" /* yacc.c:1646 */ +#line 457 "asmshader.y" { TRACE("MAX\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_MAX, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2150 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2159 "asmshader.tab.c" break; case 33: -#line 464 "asmshader.y" /* yacc.c:1646 */ +#line 462 "asmshader.y" { TRACE("SLT\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_SLT, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2159 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2168 "asmshader.tab.c" break; case 34: -#line 469 "asmshader.y" /* yacc.c:1646 */ +#line 467 "asmshader.y" { TRACE("SGE\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_SGE, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2168 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2177 "asmshader.tab.c" break; case 35: -#line 474 "asmshader.y" /* yacc.c:1646 */ +#line 472 "asmshader.y" { TRACE("ABS\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_ABS, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2177 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2186 "asmshader.tab.c" break; case 36: -#line 479 "asmshader.y" /* yacc.c:1646 */ +#line 477 "asmshader.y" { TRACE("EXP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_EXP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2186 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2195 "asmshader.tab.c" break; case 37: -#line 484 "asmshader.y" /* yacc.c:1646 */ +#line 482 "asmshader.y" { TRACE("LOG\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_LOG, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2195 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2204 "asmshader.tab.c" break; case 38: -#line 489 "asmshader.y" /* yacc.c:1646 */ +#line 487 "asmshader.y" { TRACE("LOGP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_LOGP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2204 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2213 "asmshader.tab.c" break; case 39: -#line 494 "asmshader.y" /* yacc.c:1646 */ +#line 492 "asmshader.y" { TRACE("EXPP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_EXPP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2213 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2222 "asmshader.tab.c" break; case 40: -#line 499 "asmshader.y" /* yacc.c:1646 */ +#line 497 "asmshader.y" { TRACE("DST\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_DST, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2222 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2231 "asmshader.tab.c" break; case 41: -#line 504 "asmshader.y" /* yacc.c:1646 */ +#line 502 "asmshader.y" { TRACE("LRP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_LRP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 3); } -#line 2231 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2240 "asmshader.tab.c" break; case 42: -#line 509 "asmshader.y" /* yacc.c:1646 */ +#line 507 "asmshader.y" { TRACE("FRC\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_FRC, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2240 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2249 "asmshader.tab.c" break; case 43: -#line 514 "asmshader.y" /* yacc.c:1646 */ +#line 512 "asmshader.y" { TRACE("POW\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_POW, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2249 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2258 "asmshader.tab.c" break; case 44: -#line 519 "asmshader.y" /* yacc.c:1646 */ +#line 517 "asmshader.y" { TRACE("CRS\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_CRS, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2258 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2267 "asmshader.tab.c" break; case 45: -#line 524 "asmshader.y" /* yacc.c:1646 */ +#line 522 "asmshader.y" { TRACE("SGN\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_SGN, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 3); } -#line 2267 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2276 "asmshader.tab.c" break; case 46: -#line 529 "asmshader.y" /* yacc.c:1646 */ +#line 527 "asmshader.y" { TRACE("NRM\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_NRM, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2276 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2285 "asmshader.tab.c" break; case 47: -#line 534 "asmshader.y" /* yacc.c:1646 */ +#line 532 "asmshader.y" { TRACE("SINCOS\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_SINCOS, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2285 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2294 "asmshader.tab.c" break; case 48: -#line 539 "asmshader.y" /* yacc.c:1646 */ +#line 537 "asmshader.y" { TRACE("M4x4\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_M4x4, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2294 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2303 "asmshader.tab.c" break; case 49: -#line 544 "asmshader.y" /* yacc.c:1646 */ +#line 542 "asmshader.y" { TRACE("M4x3\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_M4x3, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2303 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2312 "asmshader.tab.c" break; case 50: -#line 549 "asmshader.y" /* yacc.c:1646 */ +#line 547 "asmshader.y" { TRACE("M3x4\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_M3x4, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2312 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2321 "asmshader.tab.c" break; case 51: -#line 554 "asmshader.y" /* yacc.c:1646 */ +#line 552 "asmshader.y" { TRACE("M3x3\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_M3x3, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2321 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2330 "asmshader.tab.c" break; case 52: -#line 559 "asmshader.y" /* yacc.c:1646 */ +#line 557 "asmshader.y" { TRACE("M3x2\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_M3x2, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2330 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2339 "asmshader.tab.c" break; case 53: -#line 564 "asmshader.y" /* yacc.c:1646 */ +#line 562 "asmshader.y" { struct shader_reg reg; TRACE("Output reg declaration\n"); @@ -2338,11 +2351,11 @@ yyreduce: reg.u.writemask = BWRITERSP_WRITEMASK_ALL; asm_ctx.funcs->dcl_output(&asm_ctx, (yyvsp[-1].declaration).dclusage, (yyvsp[-1].declaration).regnum, ®); } -#line 2346 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2355 "asmshader.tab.c" break; case 54: -#line 576 "asmshader.y" /* yacc.c:1646 */ +#line 574 "asmshader.y" { struct shader_reg reg; TRACE("Output reg declaration\n"); @@ -2354,11 +2367,11 @@ yyreduce: reg.u.writemask = (yyvsp[0].writemask); asm_ctx.funcs->dcl_output(&asm_ctx, (yyvsp[-2].declaration).dclusage, (yyvsp[-2].declaration).regnum, ®); } -#line 2362 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2371 "asmshader.tab.c" break; case 55: -#line 588 "asmshader.y" /* yacc.c:1646 */ +#line 586 "asmshader.y" { struct shader_reg reg; TRACE("Input reg declaration\n"); @@ -2381,11 +2394,11 @@ yyreduce: reg.u.writemask = BWRITERSP_WRITEMASK_ALL; asm_ctx.funcs->dcl_input(&asm_ctx, (yyvsp[-2].declaration).dclusage, (yyvsp[-2].declaration).regnum, (yyvsp[-1].modshift).mod, ®); } -#line 2389 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2398 "asmshader.tab.c" break; case 56: -#line 611 "asmshader.y" /* yacc.c:1646 */ +#line 609 "asmshader.y" { struct shader_reg reg; TRACE("Input reg declaration\n"); @@ -2408,11 +2421,11 @@ yyreduce: reg.u.writemask = (yyvsp[0].writemask); asm_ctx.funcs->dcl_input(&asm_ctx, (yyvsp[-3].declaration).dclusage, (yyvsp[-3].declaration).regnum, (yyvsp[-2].modshift).mod, ®); } -#line 2416 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2425 "asmshader.tab.c" break; case 57: -#line 634 "asmshader.y" /* yacc.c:1646 */ +#line 632 "asmshader.y" { struct shader_reg reg; TRACE("Input reg declaration\n"); @@ -2434,11 +2447,11 @@ yyreduce: reg.u.writemask = BWRITERSP_WRITEMASK_ALL; asm_ctx.funcs->dcl_input(&asm_ctx, 0, 0, (yyvsp[-1].modshift).mod, ®); } -#line 2442 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2451 "asmshader.tab.c" break; case 58: -#line 656 "asmshader.y" /* yacc.c:1646 */ +#line 654 "asmshader.y" { struct shader_reg reg; TRACE("Input reg declaration\n"); @@ -2460,11 +2473,11 @@ yyreduce: reg.u.writemask = (yyvsp[0].writemask); asm_ctx.funcs->dcl_input(&asm_ctx, 0, 0, (yyvsp[-2].modshift).mod, ®); } -#line 2468 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2477 "asmshader.tab.c" break; case 59: -#line 678 "asmshader.y" /* yacc.c:1646 */ +#line 676 "asmshader.y" { TRACE("Sampler declared\n"); if((yyvsp[-1].modshift).shift != 0) { @@ -2474,11 +2487,11 @@ yyreduce: } asm_ctx.funcs->dcl_sampler(&asm_ctx, (yyvsp[-2].samplertype), (yyvsp[-1].modshift).mod, (yyvsp[0].regnum), asm_ctx.line_no); } -#line 2482 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2491 "asmshader.tab.c" break; case 60: -#line 688 "asmshader.y" /* yacc.c:1646 */ +#line 686 "asmshader.y" { TRACE("Sampler declared\n"); if((yyvsp[-1].modshift).shift != 0) { @@ -2493,301 +2506,301 @@ yyreduce: } asm_ctx.funcs->dcl_sampler(&asm_ctx, BWRITERSTT_UNKNOWN, (yyvsp[-1].modshift).mod, (yyvsp[0].regnum), asm_ctx.line_no); } -#line 2501 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2510 "asmshader.tab.c" break; case 61: -#line 703 "asmshader.y" /* yacc.c:1646 */ +#line 701 "asmshader.y" { TRACE("Error rule: sampler decl of input reg\n"); asmparser_message(&asm_ctx, "Line %u: Sampler declarations of input regs is not valid\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 2512 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2521 "asmshader.tab.c" break; case 62: -#line 710 "asmshader.y" /* yacc.c:1646 */ +#line 708 "asmshader.y" { TRACE("Error rule: sampler decl of output reg\n"); asmparser_message(&asm_ctx, "Line %u: Sampler declarations of output regs is not valid\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 2523 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2532 "asmshader.tab.c" break; case 63: -#line 717 "asmshader.y" /* yacc.c:1646 */ +#line 715 "asmshader.y" { asm_ctx.funcs->constF(&asm_ctx, (yyvsp[-8].regnum), (yyvsp[-6].immval).val, (yyvsp[-4].immval).val, (yyvsp[-2].immval).val, (yyvsp[0].immval).val); } -#line 2531 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2540 "asmshader.tab.c" break; case 64: -#line 721 "asmshader.y" /* yacc.c:1646 */ +#line 719 "asmshader.y" { asm_ctx.funcs->constI(&asm_ctx, (yyvsp[-8].regnum), (yyvsp[-6].immval).val, (yyvsp[-4].immval).val, (yyvsp[-2].immval).val, (yyvsp[0].immval).val); } -#line 2539 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2548 "asmshader.tab.c" break; case 65: -#line 725 "asmshader.y" /* yacc.c:1646 */ +#line 723 "asmshader.y" { asm_ctx.funcs->constB(&asm_ctx, (yyvsp[-2].regnum), (yyvsp[0].immbool)); } -#line 2547 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2556 "asmshader.tab.c" break; case 66: -#line 729 "asmshader.y" /* yacc.c:1646 */ +#line 727 "asmshader.y" { TRACE("REP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_REP, 0, 0, 0, 0, &(yyvsp[0].sregs), 1); } -#line 2556 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2565 "asmshader.tab.c" break; case 67: -#line 734 "asmshader.y" /* yacc.c:1646 */ +#line 732 "asmshader.y" { TRACE("ENDREP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_ENDREP, 0, 0, 0, 0, 0, 0); } -#line 2565 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2574 "asmshader.tab.c" break; case 68: -#line 739 "asmshader.y" /* yacc.c:1646 */ +#line 737 "asmshader.y" { TRACE("IF\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_IF, 0, 0, 0, 0, &(yyvsp[0].sregs), 1); } -#line 2574 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2583 "asmshader.tab.c" break; case 69: -#line 744 "asmshader.y" /* yacc.c:1646 */ +#line 742 "asmshader.y" { TRACE("IFC\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_IFC, 0, 0, (yyvsp[-1].comptype), 0, &(yyvsp[0].sregs), 2); } -#line 2583 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2592 "asmshader.tab.c" break; case 70: -#line 749 "asmshader.y" /* yacc.c:1646 */ +#line 747 "asmshader.y" { TRACE("ELSE\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_ELSE, 0, 0, 0, 0, 0, 0); } -#line 2592 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2601 "asmshader.tab.c" break; case 71: -#line 754 "asmshader.y" /* yacc.c:1646 */ +#line 752 "asmshader.y" { TRACE("ENDIF\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_ENDIF, 0, 0, 0, 0, 0, 0); } -#line 2601 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2610 "asmshader.tab.c" break; case 72: -#line 759 "asmshader.y" /* yacc.c:1646 */ +#line 757 "asmshader.y" { TRACE("BREAK\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_BREAK, 0, 0, 0, 0, 0, 0); } -#line 2610 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2619 "asmshader.tab.c" break; case 73: -#line 764 "asmshader.y" /* yacc.c:1646 */ +#line 762 "asmshader.y" { TRACE("BREAKC\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_BREAKC, 0, 0, (yyvsp[-1].comptype), 0, &(yyvsp[0].sregs), 2); } -#line 2619 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2628 "asmshader.tab.c" break; case 74: -#line 769 "asmshader.y" /* yacc.c:1646 */ +#line 767 "asmshader.y" { TRACE("BREAKP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_BREAKP, 0, 0, 0, 0, &(yyvsp[0].sregs), 1); } -#line 2628 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2637 "asmshader.tab.c" break; case 75: -#line 774 "asmshader.y" /* yacc.c:1646 */ +#line 772 "asmshader.y" { TRACE("CALL\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_CALL, 0, 0, 0, 0, &(yyvsp[0].sregs), 1); } -#line 2637 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2646 "asmshader.tab.c" break; case 76: -#line 779 "asmshader.y" /* yacc.c:1646 */ +#line 777 "asmshader.y" { TRACE("CALLNZ\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_CALLNZ, 0, 0, 0, 0, &(yyvsp[0].sregs), 2); } -#line 2646 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2655 "asmshader.tab.c" break; case 77: -#line 784 "asmshader.y" /* yacc.c:1646 */ +#line 782 "asmshader.y" { TRACE("LOOP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_LOOP, 0, 0, 0, 0, &(yyvsp[0].sregs), 2); } -#line 2655 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2664 "asmshader.tab.c" break; case 78: -#line 789 "asmshader.y" /* yacc.c:1646 */ +#line 787 "asmshader.y" { TRACE("RET\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_RET, 0, 0, 0, 0, 0, 0); } -#line 2664 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2673 "asmshader.tab.c" break; case 79: -#line 794 "asmshader.y" /* yacc.c:1646 */ +#line 792 "asmshader.y" { TRACE("ENDLOOP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_ENDLOOP, 0, 0, 0, 0, 0, 0); } -#line 2673 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2682 "asmshader.tab.c" break; case 80: -#line 799 "asmshader.y" /* yacc.c:1646 */ +#line 797 "asmshader.y" { TRACE("LABEL\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_LABEL, 0, 0, 0, 0, &(yyvsp[0].sregs), 1); } -#line 2682 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2691 "asmshader.tab.c" break; case 81: -#line 804 "asmshader.y" /* yacc.c:1646 */ +#line 802 "asmshader.y" { TRACE("SETP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_SETP, 0, 0, (yyvsp[-3].comptype), &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2691 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2700 "asmshader.tab.c" break; case 82: -#line 809 "asmshader.y" /* yacc.c:1646 */ +#line 807 "asmshader.y" { TRACE("TEXLDL\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXLDL, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2700 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2709 "asmshader.tab.c" break; case 83: -#line 814 "asmshader.y" /* yacc.c:1646 */ +#line 812 "asmshader.y" { TRACE("LIT\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_LIT, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2709 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2718 "asmshader.tab.c" break; case 84: -#line 819 "asmshader.y" /* yacc.c:1646 */ +#line 817 "asmshader.y" { TRACE("MOVA\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_MOVA, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2718 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2727 "asmshader.tab.c" break; case 85: -#line 824 "asmshader.y" /* yacc.c:1646 */ +#line 822 "asmshader.y" { TRACE("CND\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_CND, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 3); } -#line 2727 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2736 "asmshader.tab.c" break; case 86: -#line 829 "asmshader.y" /* yacc.c:1646 */ +#line 827 "asmshader.y" { TRACE("CMP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_CMP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 3); } -#line 2736 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2745 "asmshader.tab.c" break; case 87: -#line 834 "asmshader.y" /* yacc.c:1646 */ +#line 832 "asmshader.y" { TRACE("DP2ADD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_DP2ADD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 3); } -#line 2745 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2754 "asmshader.tab.c" break; case 88: -#line 839 "asmshader.y" /* yacc.c:1646 */ +#line 837 "asmshader.y" { TRACE("TEXCOORD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXCOORD, (yyvsp[-1].modshift).mod, (yyvsp[-1].modshift).shift, 0, &(yyvsp[0].reg), 0, 0); } -#line 2754 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2763 "asmshader.tab.c" break; case 89: -#line 844 "asmshader.y" /* yacc.c:1646 */ +#line 842 "asmshader.y" { TRACE("TEXCRD\n"); /* texcoord and texcrd share the same opcode */ asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXCOORD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2764 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2773 "asmshader.tab.c" break; case 90: -#line 850 "asmshader.y" /* yacc.c:1646 */ +#line 848 "asmshader.y" { TRACE("TEXKILL\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXKILL, 0, 0, 0, &(yyvsp[0].reg), 0, 0); } -#line 2773 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2782 "asmshader.tab.c" break; case 91: -#line 855 "asmshader.y" /* yacc.c:1646 */ +#line 853 "asmshader.y" { TRACE("TEX\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEX, (yyvsp[-1].modshift).mod, (yyvsp[-1].modshift).shift, 0, &(yyvsp[0].reg), 0, 0); } -#line 2782 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2791 "asmshader.tab.c" break; case 92: -#line 860 "asmshader.y" /* yacc.c:1646 */ +#line 858 "asmshader.y" { TRACE("TEXDEPTH\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXDEPTH, (yyvsp[-1].modshift).mod, (yyvsp[-1].modshift).shift, 0, &(yyvsp[0].reg), 0, 0); } -#line 2791 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2800 "asmshader.tab.c" break; case 93: -#line 865 "asmshader.y" /* yacc.c:1646 */ +#line 863 "asmshader.y" { TRACE("TEXLD\n"); /* There is more than one acceptable syntax for texld: @@ -2798,209 +2811,209 @@ yyreduce: These variations are handled in asmparser.c */ asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEX, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2806 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2815 "asmshader.tab.c" break; case 94: -#line 876 "asmshader.y" /* yacc.c:1646 */ +#line 874 "asmshader.y" { TRACE("TEXLDP\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXLDP, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2815 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2824 "asmshader.tab.c" break; case 95: -#line 881 "asmshader.y" /* yacc.c:1646 */ +#line 879 "asmshader.y" { TRACE("TEXLDB\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXLDB, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2824 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2833 "asmshader.tab.c" break; case 96: -#line 886 "asmshader.y" /* yacc.c:1646 */ +#line 884 "asmshader.y" { TRACE("TEXBEM\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXBEM, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2833 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2842 "asmshader.tab.c" break; case 97: -#line 891 "asmshader.y" /* yacc.c:1646 */ +#line 889 "asmshader.y" { TRACE("TEXBEML\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXBEML, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2842 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2851 "asmshader.tab.c" break; case 98: -#line 896 "asmshader.y" /* yacc.c:1646 */ +#line 894 "asmshader.y" { TRACE("TEXREG2AR\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXREG2AR, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2851 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2860 "asmshader.tab.c" break; case 99: -#line 901 "asmshader.y" /* yacc.c:1646 */ +#line 899 "asmshader.y" { TRACE("TEXREG2GB\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXREG2GB, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2860 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2869 "asmshader.tab.c" break; case 100: -#line 906 "asmshader.y" /* yacc.c:1646 */ +#line 904 "asmshader.y" { TRACE("TEXREG2RGB\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXREG2RGB, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2869 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2878 "asmshader.tab.c" break; case 101: -#line 911 "asmshader.y" /* yacc.c:1646 */ +#line 909 "asmshader.y" { TRACE("TEXM3x2PAD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x2PAD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2878 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2887 "asmshader.tab.c" break; case 102: -#line 916 "asmshader.y" /* yacc.c:1646 */ +#line 914 "asmshader.y" { TRACE("INSTR_TEXM3x3PAD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x3PAD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2887 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2896 "asmshader.tab.c" break; case 103: -#line 921 "asmshader.y" /* yacc.c:1646 */ +#line 919 "asmshader.y" { TRACE("TEXM3x3SPEC\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x3SPEC, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2896 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2905 "asmshader.tab.c" break; case 104: -#line 926 "asmshader.y" /* yacc.c:1646 */ +#line 924 "asmshader.y" { TRACE("TEXM3x3VSPEC\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x3VSPEC, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2905 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2914 "asmshader.tab.c" break; case 105: -#line 931 "asmshader.y" /* yacc.c:1646 */ +#line 929 "asmshader.y" { TRACE("TEXM3x3TEX\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x3TEX, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2914 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2923 "asmshader.tab.c" break; case 106: -#line 936 "asmshader.y" /* yacc.c:1646 */ +#line 934 "asmshader.y" { TRACE("TEXDP3TEX\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXDP3TEX, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2923 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2932 "asmshader.tab.c" break; case 107: -#line 941 "asmshader.y" /* yacc.c:1646 */ +#line 939 "asmshader.y" { TRACE("TEXM3x2DEPTH\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x2DEPTH, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2932 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2941 "asmshader.tab.c" break; case 108: -#line 946 "asmshader.y" /* yacc.c:1646 */ +#line 944 "asmshader.y" { TRACE("TEXM3x2TEX\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x2TEX, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2941 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2950 "asmshader.tab.c" break; case 109: -#line 951 "asmshader.y" /* yacc.c:1646 */ +#line 949 "asmshader.y" { TRACE("TEXDP3\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXDP3, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2950 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2959 "asmshader.tab.c" break; case 110: -#line 956 "asmshader.y" /* yacc.c:1646 */ +#line 954 "asmshader.y" { TRACE("TEXM3x3\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXM3x3, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2959 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2968 "asmshader.tab.c" break; case 111: -#line 961 "asmshader.y" /* yacc.c:1646 */ +#line 959 "asmshader.y" { TRACE("BEM\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_BEM, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 2); } -#line 2968 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2977 "asmshader.tab.c" break; case 112: -#line 966 "asmshader.y" /* yacc.c:1646 */ +#line 964 "asmshader.y" { TRACE("DSX\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_DSX, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2977 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2986 "asmshader.tab.c" break; case 113: -#line 971 "asmshader.y" /* yacc.c:1646 */ +#line 969 "asmshader.y" { TRACE("DSY\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_DSY, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 1); } -#line 2986 "asmshader.tab.c" /* yacc.c:1646 */ +#line 2995 "asmshader.tab.c" break; case 114: -#line 976 "asmshader.y" /* yacc.c:1646 */ +#line 974 "asmshader.y" { TRACE("TEXLDD\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXLDD, (yyvsp[-3].modshift).mod, (yyvsp[-3].modshift).shift, 0, &(yyvsp[-2].reg), &(yyvsp[0].sregs), 4); } -#line 2995 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3004 "asmshader.tab.c" break; case 115: -#line 981 "asmshader.y" /* yacc.c:1646 */ +#line 979 "asmshader.y" { TRACE("PHASE\n"); asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_PHASE, 0, 0, 0, 0, 0, 0); } -#line 3004 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3013 "asmshader.tab.c" break; case 116: -#line 988 "asmshader.y" /* yacc.c:1646 */ +#line 986 "asmshader.y" { (yyval.reg).regnum = (yyvsp[-1].reg).regnum; (yyval.reg).type = (yyvsp[-1].reg).type; @@ -3008,11 +3021,11 @@ yyreduce: (yyval.reg).srcmod = BWRITERSPSM_NONE; set_rel_reg(&(yyval.reg), &(yyvsp[0].rel_reg)); } -#line 3016 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3025 "asmshader.tab.c" break; case 117: -#line 996 "asmshader.y" /* yacc.c:1646 */ +#line 994 "asmshader.y" { (yyval.reg).regnum = (yyvsp[-1].reg).regnum; (yyval.reg).type = (yyvsp[-1].reg).type; @@ -3020,186 +3033,186 @@ yyreduce: (yyval.reg).srcmod = BWRITERSPSM_NONE; (yyval.reg).rel_reg = NULL; } -#line 3028 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3037 "asmshader.tab.c" break; case 118: -#line 1005 "asmshader.y" /* yacc.c:1646 */ +#line 1003 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_TEMP; } -#line 3036 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3045 "asmshader.tab.c" break; case 119: -#line 1009 "asmshader.y" /* yacc.c:1646 */ +#line 1007 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_OUTPUT; } -#line 3044 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3053 "asmshader.tab.c" break; case 120: -#line 1013 "asmshader.y" /* yacc.c:1646 */ +#line 1011 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_INPUT; } -#line 3052 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3061 "asmshader.tab.c" break; case 121: -#line 1017 "asmshader.y" /* yacc.c:1646 */ +#line 1015 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register c%u is not a valid destination register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3062 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3071 "asmshader.tab.c" break; case 122: -#line 1023 "asmshader.y" /* yacc.c:1646 */ +#line 1021 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register i%u is not a valid destination register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3072 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3081 "asmshader.tab.c" break; case 123: -#line 1029 "asmshader.y" /* yacc.c:1646 */ +#line 1027 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register b%u is not a valid destination register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3082 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3091 "asmshader.tab.c" break; case 124: -#line 1035 "asmshader.y" /* yacc.c:1646 */ +#line 1033 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_TEXTURE; } -#line 3090 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3099 "asmshader.tab.c" break; case 125: -#line 1039 "asmshader.y" /* yacc.c:1646 */ +#line 1037 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_TEXCRDOUT; } -#line 3098 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3107 "asmshader.tab.c" break; case 126: -#line 1043 "asmshader.y" /* yacc.c:1646 */ +#line 1041 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register s%u is not a valid destination register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3108 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3117 "asmshader.tab.c" break; case 127: -#line 1049 "asmshader.y" /* yacc.c:1646 */ +#line 1047 "asmshader.y" { (yyval.reg).regnum = BWRITERSRO_POSITION; (yyval.reg).type = BWRITERSPR_RASTOUT; } -#line 3116 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3125 "asmshader.tab.c" break; case 128: -#line 1053 "asmshader.y" /* yacc.c:1646 */ +#line 1051 "asmshader.y" { (yyval.reg).regnum = BWRITERSRO_POINT_SIZE; (yyval.reg).type = BWRITERSPR_RASTOUT; } -#line 3124 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3133 "asmshader.tab.c" break; case 129: -#line 1057 "asmshader.y" /* yacc.c:1646 */ +#line 1055 "asmshader.y" { (yyval.reg).regnum = BWRITERSRO_FOG; (yyval.reg).type = BWRITERSPR_RASTOUT; } -#line 3132 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3141 "asmshader.tab.c" break; case 130: -#line 1061 "asmshader.y" /* yacc.c:1646 */ +#line 1059 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_ATTROUT; } -#line 3140 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3149 "asmshader.tab.c" break; case 131: -#line 1065 "asmshader.y" /* yacc.c:1646 */ +#line 1063 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_COLOROUT; } -#line 3148 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3157 "asmshader.tab.c" break; case 132: -#line 1069 "asmshader.y" /* yacc.c:1646 */ +#line 1067 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_DEPTHOUT; } -#line 3156 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3165 "asmshader.tab.c" break; case 133: -#line 1073 "asmshader.y" /* yacc.c:1646 */ +#line 1071 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_PREDICATE; } -#line 3164 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3173 "asmshader.tab.c" break; case 134: -#line 1077 "asmshader.y" /* yacc.c:1646 */ +#line 1075 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register vPos is not a valid destination register\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3174 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3183 "asmshader.tab.c" break; case 135: -#line 1083 "asmshader.y" /* yacc.c:1646 */ +#line 1081 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register vFace is not a valid destination register\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3184 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3193 "asmshader.tab.c" break; case 136: -#line 1089 "asmshader.y" /* yacc.c:1646 */ +#line 1087 "asmshader.y" { /* index 0 is hardcoded for the addr register */ (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_ADDR; } -#line 3193 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3202 "asmshader.tab.c" break; case 137: -#line 1094 "asmshader.y" /* yacc.c:1646 */ +#line 1092 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register aL is not a valid destination register\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3203 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3212 "asmshader.tab.c" break; case 138: -#line 1101 "asmshader.y" /* yacc.c:1646 */ +#line 1099 "asmshader.y" { if((yyvsp[0].wm_components).writemask == SWIZZLE_ERR) { asmparser_message(&asm_ctx, "Line %u: Invalid writemask specified\n", @@ -3213,21 +3226,21 @@ yyreduce: TRACE("Writemask: %x\n", (yyval.writemask)); } } -#line 3221 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3230 "asmshader.tab.c" break; case 139: -#line 1116 "asmshader.y" /* yacc.c:1646 */ +#line 1114 "asmshader.y" { (yyval.wm_components).writemask = 1 << (yyvsp[0].component); (yyval.wm_components).last = (yyvsp[0].component); (yyval.wm_components).idx = 1; } -#line 3231 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3240 "asmshader.tab.c" break; case 140: -#line 1122 "asmshader.y" /* yacc.c:1646 */ +#line 1120 "asmshader.y" { if((yyvsp[-1].wm_components).writemask == SWIZZLE_ERR || (yyvsp[-1].wm_components).idx == 4) /* Wrong writemask */ @@ -3241,20 +3254,20 @@ yyreduce: } } } -#line 3249 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3258 "asmshader.tab.c" break; case 141: -#line 1137 "asmshader.y" /* yacc.c:1646 */ +#line 1135 "asmshader.y" { (yyval.swizzle) = BWRITERVS_NOSWIZZLE; TRACE("Default swizzle: %08x\n", (yyval.swizzle)); } -#line 3258 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3267 "asmshader.tab.c" break; case 142: -#line 1142 "asmshader.y" /* yacc.c:1646 */ +#line 1140 "asmshader.y" { if((yyvsp[0].sw_components).swizzle == SWIZZLE_ERR) { asmparser_message(&asm_ctx, "Line %u: Invalid swizzle\n", @@ -3275,20 +3288,20 @@ yyreduce: TRACE("Got a swizzle: %08x\n", (yyval.swizzle)); } } -#line 3283 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3292 "asmshader.tab.c" break; case 143: -#line 1164 "asmshader.y" /* yacc.c:1646 */ +#line 1162 "asmshader.y" { (yyval.sw_components).swizzle = (yyvsp[0].component); (yyval.sw_components).idx = 1; } -#line 3292 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3301 "asmshader.tab.c" break; case 144: -#line 1169 "asmshader.y" /* yacc.c:1646 */ +#line 1167 "asmshader.y" { if((yyvsp[-1].sw_components).idx == 4) { /* Too many sw_components */ @@ -3300,20 +3313,20 @@ yyreduce: (yyval.sw_components).idx = (yyvsp[-1].sw_components).idx + 1; } } -#line 3308 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3317 "asmshader.tab.c" break; case 145: -#line 1182 "asmshader.y" /* yacc.c:1646 */ +#line 1180 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 0; } -#line 3317 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3326 "asmshader.tab.c" break; case 146: -#line 1187 "asmshader.y" /* yacc.c:1646 */ +#line 1185 "asmshader.y" { (yyval.modshift).mod = (yyvsp[-1].modshift).mod | (yyvsp[0].modshift).mod; if((yyvsp[-1].modshift).shift && (yyvsp[0].modshift).shift) { @@ -3325,101 +3338,101 @@ yyreduce: (yyval.modshift).shift = (yyvsp[-1].modshift).shift | (yyvsp[0].modshift).shift; } } -#line 3333 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3342 "asmshader.tab.c" break; case 147: -#line 1200 "asmshader.y" /* yacc.c:1646 */ +#line 1198 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 1; } -#line 3342 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3351 "asmshader.tab.c" break; case 148: -#line 1205 "asmshader.y" /* yacc.c:1646 */ +#line 1203 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 2; } -#line 3351 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3360 "asmshader.tab.c" break; case 149: -#line 1210 "asmshader.y" /* yacc.c:1646 */ +#line 1208 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 3; } -#line 3360 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3369 "asmshader.tab.c" break; case 150: -#line 1215 "asmshader.y" /* yacc.c:1646 */ +#line 1213 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 15; } -#line 3369 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3378 "asmshader.tab.c" break; case 151: -#line 1220 "asmshader.y" /* yacc.c:1646 */ +#line 1218 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 14; } -#line 3378 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3387 "asmshader.tab.c" break; case 152: -#line 1225 "asmshader.y" /* yacc.c:1646 */ +#line 1223 "asmshader.y" { (yyval.modshift).mod = 0; (yyval.modshift).shift = 13; } -#line 3387 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3396 "asmshader.tab.c" break; case 153: -#line 1230 "asmshader.y" /* yacc.c:1646 */ +#line 1228 "asmshader.y" { (yyval.modshift).mod = BWRITERSPDM_SATURATE; (yyval.modshift).shift = 0; } -#line 3396 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3405 "asmshader.tab.c" break; case 154: -#line 1235 "asmshader.y" /* yacc.c:1646 */ +#line 1233 "asmshader.y" { (yyval.modshift).mod = BWRITERSPDM_PARTIALPRECISION; (yyval.modshift).shift = 0; } -#line 3405 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3414 "asmshader.tab.c" break; case 155: -#line 1240 "asmshader.y" /* yacc.c:1646 */ +#line 1238 "asmshader.y" { (yyval.modshift).mod = BWRITERSPDM_MSAMPCENTROID; (yyval.modshift).shift = 0; } -#line 3414 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3423 "asmshader.tab.c" break; case 156: -#line 1246 "asmshader.y" /* yacc.c:1646 */ +#line 1244 "asmshader.y" { (yyval.sregs).reg[0] = (yyvsp[0].reg); (yyval.sregs).count = 1; } -#line 3423 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3432 "asmshader.tab.c" break; case 157: -#line 1251 "asmshader.y" /* yacc.c:1646 */ +#line 1249 "asmshader.y" { if((yyval.sregs).count == MAX_SRC_REGS){ asmparser_message(&asm_ctx, "Line %u: Too many source registers in this instruction\n", @@ -3429,11 +3442,11 @@ yyreduce: else (yyval.sregs).reg[(yyval.sregs).count++] = (yyvsp[0].reg); } -#line 3437 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3446 "asmshader.tab.c" break; case 158: -#line 1262 "asmshader.y" /* yacc.c:1646 */ +#line 1260 "asmshader.y" { (yyval.reg).type = (yyvsp[-2].reg).type; (yyval.reg).regnum = (yyvsp[-2].reg).regnum; @@ -3441,11 +3454,11 @@ yyreduce: (yyval.reg).srcmod = BWRITERSPSM_NONE; set_rel_reg(&(yyval.reg), &(yyvsp[-1].rel_reg)); } -#line 3449 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3458 "asmshader.tab.c" break; case 159: -#line 1270 "asmshader.y" /* yacc.c:1646 */ +#line 1268 "asmshader.y" { (yyval.reg).type = (yyvsp[-3].reg).type; (yyval.reg).regnum = (yyvsp[-3].reg).regnum; @@ -3453,11 +3466,11 @@ yyreduce: (yyval.reg).srcmod = (yyvsp[-1].srcmod); (yyval.reg).u.swizzle = (yyvsp[0].swizzle); } -#line 3461 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3470 "asmshader.tab.c" break; case 160: -#line 1278 "asmshader.y" /* yacc.c:1646 */ +#line 1276 "asmshader.y" { (yyval.reg).type = (yyvsp[-2].reg).type; (yyval.reg).regnum = (yyvsp[-2].reg).regnum; @@ -3465,11 +3478,11 @@ yyreduce: set_rel_reg(&(yyval.reg), &(yyvsp[-1].rel_reg)); (yyval.reg).u.swizzle = (yyvsp[0].swizzle); } -#line 3473 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3482 "asmshader.tab.c" break; case 161: -#line 1286 "asmshader.y" /* yacc.c:1646 */ +#line 1284 "asmshader.y" { (yyval.reg).type = (yyvsp[-3].reg).type; (yyval.reg).regnum = (yyvsp[-3].reg).regnum; @@ -3494,11 +3507,11 @@ yyreduce: } (yyval.reg).u.swizzle = (yyvsp[0].swizzle); } -#line 3502 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3511 "asmshader.tab.c" break; case 162: -#line 1311 "asmshader.y" /* yacc.c:1646 */ +#line 1309 "asmshader.y" { if((yyvsp[-4].immval).val != 1.0 || (!(yyvsp[-4].immval).integer)) { asmparser_message(&asm_ctx, "Line %u: Only \"1 - reg\" is valid for D3DSPSM_COMP, " @@ -3512,11 +3525,11 @@ yyreduce: set_rel_reg(&(yyval.reg), &(yyvsp[-1].rel_reg)); (yyval.reg).u.swizzle = (yyvsp[0].swizzle); } -#line 3520 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3529 "asmshader.tab.c" break; case 163: -#line 1325 "asmshader.y" /* yacc.c:1646 */ +#line 1323 "asmshader.y" { /* For nicer error reporting */ if((yyvsp[-5].immval).val != 1.0 || (!(yyvsp[-5].immval).integer)) { @@ -3530,11 +3543,11 @@ yyreduce: set_parse_status(&asm_ctx.status, PARSE_ERR); } } -#line 3538 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3547 "asmshader.tab.c" break; case 164: -#line 1339 "asmshader.y" /* yacc.c:1646 */ +#line 1337 "asmshader.y" { (yyval.reg).type = (yyvsp[-1].reg).type; (yyval.reg).regnum = (yyvsp[-1].reg).regnum; @@ -3542,29 +3555,29 @@ yyreduce: (yyval.reg).srcmod = BWRITERSPSM_NOT; (yyval.reg).u.swizzle = (yyvsp[0].swizzle); } -#line 3550 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3559 "asmshader.tab.c" break; case 165: -#line 1348 "asmshader.y" /* yacc.c:1646 */ +#line 1346 "asmshader.y" { (yyval.rel_reg).has_rel_reg = FALSE; (yyval.rel_reg).additional_offset = 0; } -#line 3559 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3568 "asmshader.tab.c" break; case 166: -#line 1353 "asmshader.y" /* yacc.c:1646 */ +#line 1351 "asmshader.y" { (yyval.rel_reg).has_rel_reg = FALSE; (yyval.rel_reg).additional_offset = (yyvsp[-1].immval).val; } -#line 3568 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3577 "asmshader.tab.c" break; case 167: -#line 1358 "asmshader.y" /* yacc.c:1646 */ +#line 1356 "asmshader.y" { (yyval.rel_reg).has_rel_reg = TRUE; (yyval.rel_reg).type = (yyvsp[-2].reg).type; @@ -3572,11 +3585,11 @@ yyreduce: (yyval.rel_reg).rel_regnum = (yyvsp[-2].reg).regnum; (yyval.rel_reg).swizzle = (yyvsp[-1].swizzle); } -#line 3580 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3589 "asmshader.tab.c" break; case 168: -#line 1366 "asmshader.y" /* yacc.c:1646 */ +#line 1364 "asmshader.y" { (yyval.rel_reg).has_rel_reg = TRUE; (yyval.rel_reg).type = (yyvsp[-2].reg).type; @@ -3584,11 +3597,11 @@ yyreduce: (yyval.rel_reg).rel_regnum = (yyvsp[-2].reg).regnum; (yyval.rel_reg).swizzle = (yyvsp[-1].swizzle); } -#line 3592 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3601 "asmshader.tab.c" break; case 169: -#line 1374 "asmshader.y" /* yacc.c:1646 */ +#line 1372 "asmshader.y" { (yyval.rel_reg).has_rel_reg = TRUE; (yyval.rel_reg).type = (yyvsp[-4].reg).type; @@ -3596,11 +3609,11 @@ yyreduce: (yyval.rel_reg).rel_regnum = (yyvsp[-4].reg).regnum; (yyval.rel_reg).swizzle = (yyvsp[-3].swizzle); } -#line 3604 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3613 "asmshader.tab.c" break; case 170: -#line 1382 "asmshader.y" /* yacc.c:1646 */ +#line 1380 "asmshader.y" { (yyval.rel_reg).has_rel_reg = TRUE; (yyval.rel_reg).type = (yyvsp[-4].reg).type; @@ -3608,11 +3621,11 @@ yyreduce: (yyval.rel_reg).rel_regnum = (yyvsp[-4].reg).regnum; (yyval.rel_reg).swizzle = (yyvsp[-3].swizzle); } -#line 3616 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3625 "asmshader.tab.c" break; case 171: -#line 1391 "asmshader.y" /* yacc.c:1646 */ +#line 1389 "asmshader.y" { if(!(yyvsp[0].immval).integer) { asmparser_message(&asm_ctx, "Line %u: Unexpected float %f\n", @@ -3621,11 +3634,11 @@ yyreduce: } (yyval.immval).val = (yyvsp[0].immval).val; } -#line 3629 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3638 "asmshader.tab.c" break; case 172: -#line 1400 "asmshader.y" /* yacc.c:1646 */ +#line 1398 "asmshader.y" { if(!(yyvsp[0].immval).integer) { asmparser_message(&asm_ctx, "Line %u: Unexpected float %f\n", @@ -3634,473 +3647,473 @@ yyreduce: } (yyval.immval).val = (yyvsp[-2].immval).val + (yyvsp[0].immval).val; } -#line 3642 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3651 "asmshader.tab.c" break; case 173: -#line 1410 "asmshader.y" /* yacc.c:1646 */ +#line 1408 "asmshader.y" { (yyval.srcmod) = BWRITERSPSM_BIAS; } -#line 3650 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3659 "asmshader.tab.c" break; case 174: -#line 1414 "asmshader.y" /* yacc.c:1646 */ +#line 1412 "asmshader.y" { (yyval.srcmod) = BWRITERSPSM_X2; } -#line 3658 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3667 "asmshader.tab.c" break; case 175: -#line 1418 "asmshader.y" /* yacc.c:1646 */ +#line 1416 "asmshader.y" { (yyval.srcmod) = BWRITERSPSM_SIGN; } -#line 3666 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3675 "asmshader.tab.c" break; case 176: -#line 1422 "asmshader.y" /* yacc.c:1646 */ +#line 1420 "asmshader.y" { (yyval.srcmod) = BWRITERSPSM_DZ; } -#line 3674 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3683 "asmshader.tab.c" break; case 177: -#line 1426 "asmshader.y" /* yacc.c:1646 */ +#line 1424 "asmshader.y" { (yyval.srcmod) = BWRITERSPSM_DW; } -#line 3682 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3691 "asmshader.tab.c" break; case 178: -#line 1430 "asmshader.y" /* yacc.c:1646 */ +#line 1428 "asmshader.y" { (yyval.srcmod) = BWRITERSPSM_ABS; } -#line 3690 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3699 "asmshader.tab.c" break; case 179: -#line 1435 "asmshader.y" /* yacc.c:1646 */ +#line 1433 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_ADDR; } -#line 3698 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3707 "asmshader.tab.c" break; case 180: -#line 1439 "asmshader.y" /* yacc.c:1646 */ +#line 1437 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_LOOP; } -#line 3706 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3715 "asmshader.tab.c" break; case 181: -#line 1444 "asmshader.y" /* yacc.c:1646 */ +#line 1442 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_TEMP; } -#line 3714 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3723 "asmshader.tab.c" break; case 182: -#line 1448 "asmshader.y" /* yacc.c:1646 */ +#line 1446 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register o%u is not a valid source register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3724 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3733 "asmshader.tab.c" break; case 183: -#line 1454 "asmshader.y" /* yacc.c:1646 */ +#line 1452 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_INPUT; } -#line 3732 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3741 "asmshader.tab.c" break; case 184: -#line 1458 "asmshader.y" /* yacc.c:1646 */ +#line 1456 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_CONST; } -#line 3740 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3749 "asmshader.tab.c" break; case 185: -#line 1462 "asmshader.y" /* yacc.c:1646 */ +#line 1460 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_CONSTINT; } -#line 3748 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3757 "asmshader.tab.c" break; case 186: -#line 1466 "asmshader.y" /* yacc.c:1646 */ +#line 1464 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_CONSTBOOL; } -#line 3756 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3765 "asmshader.tab.c" break; case 187: -#line 1470 "asmshader.y" /* yacc.c:1646 */ +#line 1468 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_TEXTURE; } -#line 3764 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3773 "asmshader.tab.c" break; case 188: -#line 1474 "asmshader.y" /* yacc.c:1646 */ +#line 1472 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register oT%u is not a valid source register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3774 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3783 "asmshader.tab.c" break; case 189: -#line 1480 "asmshader.y" /* yacc.c:1646 */ +#line 1478 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_SAMPLER; } -#line 3782 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3791 "asmshader.tab.c" break; case 190: -#line 1484 "asmshader.y" /* yacc.c:1646 */ +#line 1482 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register oPos is not a valid source register\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3792 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3801 "asmshader.tab.c" break; case 191: -#line 1490 "asmshader.y" /* yacc.c:1646 */ +#line 1488 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register oFog is not a valid source register\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3802 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3811 "asmshader.tab.c" break; case 192: -#line 1496 "asmshader.y" /* yacc.c:1646 */ +#line 1494 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register oD%u is not a valid source register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3812 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3821 "asmshader.tab.c" break; case 193: -#line 1502 "asmshader.y" /* yacc.c:1646 */ +#line 1500 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register oC%u is not a valid source register\n", asm_ctx.line_no, (yyvsp[0].regnum)); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3822 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3831 "asmshader.tab.c" break; case 194: -#line 1508 "asmshader.y" /* yacc.c:1646 */ +#line 1506 "asmshader.y" { asmparser_message(&asm_ctx, "Line %u: Register oDepth is not a valid source register\n", asm_ctx.line_no); set_parse_status(&asm_ctx.status, PARSE_WARN); } -#line 3832 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3841 "asmshader.tab.c" break; case 195: -#line 1514 "asmshader.y" /* yacc.c:1646 */ +#line 1512 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_PREDICATE; } -#line 3840 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3849 "asmshader.tab.c" break; case 196: -#line 1518 "asmshader.y" /* yacc.c:1646 */ +#line 1516 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_MISCTYPE; } -#line 3848 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3857 "asmshader.tab.c" break; case 197: -#line 1522 "asmshader.y" /* yacc.c:1646 */ +#line 1520 "asmshader.y" { (yyval.reg).regnum = 1; (yyval.reg).type = BWRITERSPR_MISCTYPE; } -#line 3856 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3865 "asmshader.tab.c" break; case 198: -#line 1526 "asmshader.y" /* yacc.c:1646 */ +#line 1524 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_ADDR; } -#line 3864 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3873 "asmshader.tab.c" break; case 199: -#line 1530 "asmshader.y" /* yacc.c:1646 */ +#line 1528 "asmshader.y" { (yyval.reg).regnum = 0; (yyval.reg).type = BWRITERSPR_LOOP; } -#line 3872 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3881 "asmshader.tab.c" break; case 200: -#line 1534 "asmshader.y" /* yacc.c:1646 */ +#line 1532 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_LABEL; } -#line 3880 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3889 "asmshader.tab.c" break; case 201: -#line 1538 "asmshader.y" /* yacc.c:1646 */ +#line 1536 "asmshader.y" { (yyval.comptype) = BWRITER_COMPARISON_GT; } -#line 3886 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3895 "asmshader.tab.c" break; case 202: -#line 1539 "asmshader.y" /* yacc.c:1646 */ +#line 1537 "asmshader.y" { (yyval.comptype) = BWRITER_COMPARISON_LT; } -#line 3892 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3901 "asmshader.tab.c" break; case 203: -#line 1540 "asmshader.y" /* yacc.c:1646 */ +#line 1538 "asmshader.y" { (yyval.comptype) = BWRITER_COMPARISON_GE; } -#line 3898 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3907 "asmshader.tab.c" break; case 204: -#line 1541 "asmshader.y" /* yacc.c:1646 */ +#line 1539 "asmshader.y" { (yyval.comptype) = BWRITER_COMPARISON_LE; } -#line 3904 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3913 "asmshader.tab.c" break; case 205: -#line 1542 "asmshader.y" /* yacc.c:1646 */ +#line 1540 "asmshader.y" { (yyval.comptype) = BWRITER_COMPARISON_EQ; } -#line 3910 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3919 "asmshader.tab.c" break; case 206: -#line 1543 "asmshader.y" /* yacc.c:1646 */ +#line 1541 "asmshader.y" { (yyval.comptype) = BWRITER_COMPARISON_NE; } -#line 3916 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3925 "asmshader.tab.c" break; case 207: -#line 1546 "asmshader.y" /* yacc.c:1646 */ +#line 1544 "asmshader.y" { TRACE("dcl_position%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_POSITION; } -#line 3926 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3935 "asmshader.tab.c" break; case 208: -#line 1552 "asmshader.y" /* yacc.c:1646 */ +#line 1550 "asmshader.y" { TRACE("dcl_blendweight%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_BLENDWEIGHT; } -#line 3936 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3945 "asmshader.tab.c" break; case 209: -#line 1558 "asmshader.y" /* yacc.c:1646 */ +#line 1556 "asmshader.y" { TRACE("dcl_blendindices%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_BLENDINDICES; } -#line 3946 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3955 "asmshader.tab.c" break; case 210: -#line 1564 "asmshader.y" /* yacc.c:1646 */ +#line 1562 "asmshader.y" { TRACE("dcl_normal%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_NORMAL; } -#line 3956 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3965 "asmshader.tab.c" break; case 211: -#line 1570 "asmshader.y" /* yacc.c:1646 */ +#line 1568 "asmshader.y" { TRACE("dcl_psize%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_PSIZE; } -#line 3966 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3975 "asmshader.tab.c" break; case 212: -#line 1576 "asmshader.y" /* yacc.c:1646 */ +#line 1574 "asmshader.y" { TRACE("dcl_texcoord%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_TEXCOORD; } -#line 3976 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3985 "asmshader.tab.c" break; case 213: -#line 1582 "asmshader.y" /* yacc.c:1646 */ +#line 1580 "asmshader.y" { TRACE("dcl_tangent%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_TANGENT; } -#line 3986 "asmshader.tab.c" /* yacc.c:1646 */ +#line 3995 "asmshader.tab.c" break; case 214: -#line 1588 "asmshader.y" /* yacc.c:1646 */ +#line 1586 "asmshader.y" { TRACE("dcl_binormal%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_BINORMAL; } -#line 3996 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4005 "asmshader.tab.c" break; case 215: -#line 1594 "asmshader.y" /* yacc.c:1646 */ +#line 1592 "asmshader.y" { TRACE("dcl_tessfactor%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_TESSFACTOR; } -#line 4006 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4015 "asmshader.tab.c" break; case 216: -#line 1600 "asmshader.y" /* yacc.c:1646 */ +#line 1598 "asmshader.y" { TRACE("dcl_positiont%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_POSITIONT; } -#line 4016 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4025 "asmshader.tab.c" break; case 217: -#line 1606 "asmshader.y" /* yacc.c:1646 */ +#line 1604 "asmshader.y" { TRACE("dcl_color%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_COLOR; } -#line 4026 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4035 "asmshader.tab.c" break; case 218: -#line 1612 "asmshader.y" /* yacc.c:1646 */ +#line 1610 "asmshader.y" { TRACE("dcl_fog%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_FOG; } -#line 4036 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4045 "asmshader.tab.c" break; case 219: -#line 1618 "asmshader.y" /* yacc.c:1646 */ +#line 1616 "asmshader.y" { TRACE("dcl_depth%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_DEPTH; } -#line 4046 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4055 "asmshader.tab.c" break; case 220: -#line 1624 "asmshader.y" /* yacc.c:1646 */ +#line 1622 "asmshader.y" { TRACE("dcl_sample%u\n", (yyvsp[0].regnum)); (yyval.declaration).regnum = (yyvsp[0].regnum); (yyval.declaration).dclusage = BWRITERDECLUSAGE_SAMPLE; } -#line 4056 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4065 "asmshader.tab.c" break; case 221: -#line 1631 "asmshader.y" /* yacc.c:1646 */ +#line 1629 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_INPUT; } -#line 4064 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4073 "asmshader.tab.c" break; case 222: -#line 1635 "asmshader.y" /* yacc.c:1646 */ +#line 1633 "asmshader.y" { (yyval.reg).regnum = (yyvsp[0].regnum); (yyval.reg).type = BWRITERSPR_TEXTURE; } -#line 4072 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4081 "asmshader.tab.c" break; case 223: -#line 1640 "asmshader.y" /* yacc.c:1646 */ +#line 1638 "asmshader.y" { (yyval.samplertype) = BWRITERSTT_1D; } -#line 4080 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4089 "asmshader.tab.c" break; case 224: -#line 1644 "asmshader.y" /* yacc.c:1646 */ +#line 1642 "asmshader.y" { (yyval.samplertype) = BWRITERSTT_2D; } -#line 4088 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4097 "asmshader.tab.c" break; case 225: -#line 1648 "asmshader.y" /* yacc.c:1646 */ +#line 1646 "asmshader.y" { (yyval.samplertype) = BWRITERSTT_CUBE; } -#line 4096 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4105 "asmshader.tab.c" break; case 226: -#line 1652 "asmshader.y" /* yacc.c:1646 */ +#line 1650 "asmshader.y" { (yyval.samplertype) = BWRITERSTT_VOLUME; } -#line 4104 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4113 "asmshader.tab.c" break; case 227: -#line 1657 "asmshader.y" /* yacc.c:1646 */ +#line 1655 "asmshader.y" { (yyval.reg).type = BWRITERSPR_PREDICATE; (yyval.reg).regnum = 0; @@ -4108,11 +4121,11 @@ yyreduce: (yyval.reg).srcmod = BWRITERSPSM_NONE; (yyval.reg).u.swizzle = (yyvsp[-1].swizzle); } -#line 4116 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4125 "asmshader.tab.c" break; case 228: -#line 1665 "asmshader.y" /* yacc.c:1646 */ +#line 1663 "asmshader.y" { (yyval.reg).type = BWRITERSPR_PREDICATE; (yyval.reg).regnum = 0; @@ -4120,11 +4133,12 @@ yyreduce: (yyval.reg).srcmod = BWRITERSPSM_NOT; (yyval.reg).u.swizzle = (yyvsp[-1].swizzle); } -#line 4128 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4137 "asmshader.tab.c" break; -#line 4132 "asmshader.tab.c" /* yacc.c:1646 */ +#line 4141 "asmshader.tab.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4149,14 +4163,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -4239,12 +4252,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -4306,6 +4317,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -4313,6 +4325,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -4323,6 +4336,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -4352,7 +4369,7 @@ yyreturn: #endif return yyresult; } -#line 1673 "asmshader.y" /* yacc.c:1906 */ +#line 1671 "asmshader.y" struct bwriter_shader *parse_asm_shader(char **messages) diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.tab.h b/dll/directx/wine/d3dcompiler_43/asmshader.tab.h index 3f76060d912..58408c95844 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.tab.h +++ b/dll/directx/wine/d3dcompiler_43/asmshader.tab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +31,11 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_ASMSHADER_ASMSHADER_TAB_H_INCLUDED -# define YY_ASMSHADER_ASMSHADER_TAB_H_INCLUDED +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +#ifndef YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED +# define YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -210,10 +214,9 @@ extern int asmshader_debug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 70 "asmshader.y" /* yacc.c:1909 */ +#line 68 "asmshader.y" struct { float val; @@ -248,8 +251,10 @@ union YYSTYPE struct rel_reg rel_reg; struct src_regs sregs; -#line 252 "asmshader.tab.h" /* yacc.c:1909 */ +#line 255 "asmshader.tab.h" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -259,4 +264,4 @@ extern YYSTYPE asmshader_lval; int asmshader_parse (void); -#endif /* !YY_ASMSHADER_ASMSHADER_TAB_H_INCLUDED */ +#endif /* !YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED */ diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.y b/dll/directx/wine/d3dcompiler_43/asmshader.y index 5948d57d5ed..32b37d0885d 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.y +++ b/dll/directx/wine/d3dcompiler_43/asmshader.y @@ -20,8 +20,6 @@ */ %{ -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #include "d3dcompiler_private.h" @@ -30,13 +28,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(asmshader); struct asm_parser asm_ctx; -void asmparser_message(struct asm_parser *ctx, const char *fmt, ...) +void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt, ...) { - va_list args; + __ms_va_list args; - va_start(args, fmt); + __ms_va_start(args, fmt); compilation_message(&ctx->messages, fmt, args); - va_end(args); + __ms_va_end(args); } static void asmshader_error(char const *s) { diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.yy.c b/dll/directx/wine/d3dcompiler_43/asmshader.yy.c index 1b31cec460f..bf9ca37e361 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.yy.c +++ b/dll/directx/wine/d3dcompiler_43/asmshader.yy.c @@ -1,6 +1,6 @@ -#line 2 "asmshader.yy.c" +#line 1 "asmshader.yy.c" -#line 4 "asmshader.yy.c" +#line 3 "asmshader.yy.c" #define YY_INT_ALIGNED short int @@ -8,11 +8,17 @@ #define yy_create_buffer asmshader__create_buffer #define yy_delete_buffer asmshader__delete_buffer -#define yy_flex_debug asmshader__flex_debug +#define yy_scan_buffer asmshader__scan_buffer +#define yy_scan_string asmshader__scan_string +#define yy_scan_bytes asmshader__scan_bytes #define yy_init_buffer asmshader__init_buffer #define yy_flush_buffer asmshader__flush_buffer #define yy_load_buffer_state asmshader__load_buffer_state #define yy_switch_to_buffer asmshader__switch_to_buffer +#define yypush_buffer_state asmshader_push_buffer_state +#define yypop_buffer_state asmshader_pop_buffer_state +#define yyensure_buffer_stack asmshader_ensure_buffer_stack +#define yy_flex_debug asmshader__flex_debug #define yyin asmshader_in #define yyleng asmshader_leng #define yylex asmshader_lex @@ -27,12 +33,246 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define asmshader__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer asmshader__create_buffer +#endif + +#ifdef yy_delete_buffer +#define asmshader__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer asmshader__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define asmshader__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer asmshader__scan_buffer +#endif + +#ifdef yy_scan_string +#define asmshader__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string asmshader__scan_string +#endif + +#ifdef yy_scan_bytes +#define asmshader__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes asmshader__scan_bytes +#endif + +#ifdef yy_init_buffer +#define asmshader__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer asmshader__init_buffer +#endif + +#ifdef yy_flush_buffer +#define asmshader__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer asmshader__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define asmshader__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state asmshader__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define asmshader__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer asmshader__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define asmshader_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state asmshader_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define asmshader_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state asmshader_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define asmshader_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack asmshader_ensure_buffer_stack +#endif + +#ifdef yylex +#define asmshader_lex_ALREADY_DEFINED +#else +#define yylex asmshader_lex +#endif + +#ifdef yyrestart +#define asmshader_restart_ALREADY_DEFINED +#else +#define yyrestart asmshader_restart +#endif + +#ifdef yylex_init +#define asmshader_lex_init_ALREADY_DEFINED +#else +#define yylex_init asmshader_lex_init +#endif + +#ifdef yylex_init_extra +#define asmshader_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra asmshader_lex_init_extra +#endif + +#ifdef yylex_destroy +#define asmshader_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy asmshader_lex_destroy +#endif + +#ifdef yyget_debug +#define asmshader_get_debug_ALREADY_DEFINED +#else +#define yyget_debug asmshader_get_debug +#endif + +#ifdef yyset_debug +#define asmshader_set_debug_ALREADY_DEFINED +#else +#define yyset_debug asmshader_set_debug +#endif + +#ifdef yyget_extra +#define asmshader_get_extra_ALREADY_DEFINED +#else +#define yyget_extra asmshader_get_extra +#endif + +#ifdef yyset_extra +#define asmshader_set_extra_ALREADY_DEFINED +#else +#define yyset_extra asmshader_set_extra +#endif + +#ifdef yyget_in +#define asmshader_get_in_ALREADY_DEFINED +#else +#define yyget_in asmshader_get_in +#endif + +#ifdef yyset_in +#define asmshader_set_in_ALREADY_DEFINED +#else +#define yyset_in asmshader_set_in +#endif + +#ifdef yyget_out +#define asmshader_get_out_ALREADY_DEFINED +#else +#define yyget_out asmshader_get_out +#endif + +#ifdef yyset_out +#define asmshader_set_out_ALREADY_DEFINED +#else +#define yyset_out asmshader_set_out +#endif + +#ifdef yyget_leng +#define asmshader_get_leng_ALREADY_DEFINED +#else +#define yyget_leng asmshader_get_leng +#endif + +#ifdef yyget_text +#define asmshader_get_text_ALREADY_DEFINED +#else +#define yyget_text asmshader_get_text +#endif + +#ifdef yyget_lineno +#define asmshader_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno asmshader_get_lineno +#endif + +#ifdef yyset_lineno +#define asmshader_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno asmshader_set_lineno +#endif + +#ifdef yywrap +#define asmshader_wrap_ALREADY_DEFINED +#else +#define yywrap asmshader_wrap +#endif + +#ifdef yyalloc +#define asmshader_alloc_ALREADY_DEFINED +#else +#define yyalloc asmshader_alloc +#endif + +#ifdef yyrealloc +#define asmshader_realloc_ALREADY_DEFINED +#else +#define yyrealloc asmshader_realloc +#endif + +#ifdef yyfree +#define asmshader_free_ALREADY_DEFINED +#else +#define yyfree asmshader_free +#endif + +#ifdef yytext +#define asmshader_text_ALREADY_DEFINED +#else +#define yytext asmshader_text +#endif + +#ifdef yyleng +#define asmshader_leng_ALREADY_DEFINED +#else +#define yyleng asmshader_leng +#endif + +#ifdef yyin +#define asmshader_in_ALREADY_DEFINED +#else +#define yyin asmshader_in +#endif + +#ifdef yyout +#define asmshader_out_ALREADY_DEFINED +#else +#define yyout asmshader_out +#endif + +#ifdef yy_flex_debug +#define asmshader__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug asmshader__flex_debug +#endif + +#ifdef yylineno +#define asmshader_lineno_ALREADY_DEFINED +#else +#define yylineno asmshader_lineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -103,60 +343,48 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus +/* begin standard C++ headers. */ -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE asmshader_restart(asmshader_in ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -181,37 +409,37 @@ typedef unsigned int flex_uint32_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -extern int asmshader_leng; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif -extern FILE *asmshader_in, *asmshader_out; +extern int yyleng; + +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up asmshader_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up asmshader_text again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -224,7 +452,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -252,7 +480,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -269,8 +497,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via asmshader_restart()), so that the user can continue scanning by - * just pointing asmshader_in at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -280,7 +508,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -291,106 +519,101 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when asmshader_text is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int asmshader_leng; +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow asmshader_wrap()'s to do buffer switches - * instead of setting up a fresh asmshader_in. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void asmshader_restart (FILE *input_file ); -void asmshader__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE asmshader__create_buffer (FILE *file,int size ); -void asmshader__delete_buffer (YY_BUFFER_STATE b ); -void asmshader__flush_buffer (YY_BUFFER_STATE b ); -void asmshader_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void asmshader_pop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void asmshader_ensure_buffer_stack (void ); -static void asmshader__load_buffer_state (void ); -static void asmshader__init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER asmshader__flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE asmshader__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE asmshader__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE asmshader__scan_bytes (yyconst char *bytes,int len ); - -void *asmshader_alloc (yy_size_t ); -void *asmshader_realloc (void *,yy_size_t ); -void asmshader_free (void * ); - -#define yy_new_buffer asmshader__create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - asmshader_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - asmshader__create_buffer(asmshader_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - asmshader_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - asmshader__create_buffer(asmshader_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define asmshader_wrap(n) 1 +#define asmshader_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *asmshader_in = (FILE *) 0, *asmshader_out = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int asmshader_lineno; +extern int yylineno; +int yylineno = 1; -int asmshader_lineno = 1; +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -extern char *asmshader_text; -#define yytext_ptr asmshader_text - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up asmshader_text. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - asmshader_leng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 174 #define YY_END_OF_BUFFER 175 /* This struct is not used in this scanner, @@ -400,7 +623,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[481] = +static const flex_int16_t yy_accept[481] = { 0, 0, 0, 175, 173, 171, 172, 173, 149, 173, 141, 142, 143, 139, 140, 119, 173, 136, 170, 173, 120, @@ -456,7 +679,7 @@ static yyconst flex_int16_t yy_accept[481] = 0, 0, 151, 158, 74, 71, 152, 151, 152, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -488,7 +711,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[56] = +static const YY_CHAR yy_meta[56] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 4, 4, 4, 4, 4, 4, 4, @@ -498,7 +721,7 @@ static yyconst flex_int32_t yy_meta[56] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[491] = +static const flex_int16_t yy_base[491] = { 0, 0, 0, 889, 890, 886, 890, 884, 890, 883, 890, 890, 890, 890, 44, 51, 872, 45, 0, 67, 59, @@ -555,7 +778,7 @@ static yyconst flex_int16_t yy_base[491] = 635, 645, 649, 658, 666, 674, 682, 691, 699, 711 } ; -static yyconst flex_int16_t yy_def[491] = +static const flex_int16_t yy_def[491] = { 0, 480, 1, 480, 480, 480, 480, 480, 480, 481, 480, 480, 480, 480, 480, 480, 480, 482, 483, 480, 480, @@ -612,7 +835,7 @@ static yyconst flex_int16_t yy_def[491] = 480, 480, 480, 480, 480, 480, 480, 480, 480, 480 } ; -static yyconst flex_int16_t yy_nxt[946] = +static const flex_int16_t yy_nxt[946] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, 17, 17, 17, 17, @@ -720,7 +943,7 @@ static yyconst flex_int16_t yy_nxt[946] = 480, 480, 480, 480, 480 } ; -static yyconst flex_int16_t yy_chk[946] = +static const flex_int16_t yy_chk[946] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -831,8 +1054,8 @@ static yyconst flex_int16_t yy_chk[946] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int asmshader__flex_debug; -int asmshader__flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -841,7 +1064,7 @@ int asmshader__flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *asmshader_text; +char *yytext; #line 1 "asmshader.l" /* * Direct3D shader assembler @@ -864,14 +1087,13 @@ char *asmshader_text; * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #line 23 "asmshader.l" -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #include "d3dcompiler_private.h" #include "asmshader.tab.h" WINE_DEFAULT_DEBUG_CHANNEL(asmshader); +#line 1096 "asmshader.yy.c" #define YY_NO_INPUT 1 /* Swizzles and writemasks consist of a dot and up to 4 x, y, z or w characters, * or up to 4 a, r, g, b characters. There are different rules for swizzles and @@ -882,7 +1104,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(asmshader); /* Not really a register, but it is considered as such */ /* Comments */ /* Whitespaces are spaces, tabs and newlines */ -#line 886 "asmshader.yy.c" +#line 1107 "asmshader.yy.c" #define INITIAL 0 @@ -893,41 +1115,41 @@ WINE_DEFAULT_DEBUG_CHANNEL(asmshader); */ #include #endif - + #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int asmshader_lex_destroy (void ); +int yylex_destroy ( void ); -int asmshader_get_debug (void ); +int yyget_debug ( void ); -void asmshader_set_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE asmshader_get_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void asmshader_set_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *asmshader_get_in (void ); +FILE *yyget_in ( void ); -void asmshader_set_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *asmshader_get_out (void ); +FILE *yyget_out ( void ); -void asmshader_set_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -int asmshader_get_leng (void ); + int yyget_leng ( void ); -char *asmshader_get_text (void ); +char *yyget_text ( void ); -int asmshader_get_lineno (void ); +int yyget_lineno ( void ); -void asmshader_set_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -935,26 +1157,29 @@ void asmshader_set_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int asmshader_wrap (void ); +extern "C" int yywrap ( void ); #else -extern int asmshader_wrap (void ); +extern int yywrap ( void ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif @@ -974,7 +1199,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( asmshader_text, asmshader_leng, 1, asmshader_out )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -985,20 +1210,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( asmshader_in )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( asmshader_in ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, asmshader_in))==0 && ferror(asmshader_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1006,7 +1231,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(asmshader_in); \ + clearerr(yyin); \ } \ }\ \ @@ -1039,12 +1264,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int asmshader_lex (void); +extern int yylex (void); -#define YY_DECL int asmshader_lex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after asmshader_text and asmshader_leng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1053,7 +1278,7 @@ extern int asmshader_lex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1063,16 +1288,10 @@ extern int asmshader_lex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 105 "asmshader.l" - - - /* Common instructions(vertex and pixel shaders) */ -#line 1075 "asmshader.yy.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -1084,26 +1303,34 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! asmshader_in ) - asmshader_in = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! asmshader_out ) - asmshader_out = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - asmshader_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - asmshader__create_buffer(asmshader_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - asmshader__load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 103 "asmshader.l" + + +#line 106 "asmshader.l" + /* Common instructions(vertex and pixel shaders) */ +#line 1327 "asmshader.yy.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of asmshader_text. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1115,7 +1342,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1125,9 +1352,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 481 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 480 ); @@ -1152,564 +1379,564 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 108 "asmshader.l" +#line 107 "asmshader.l" {return INSTR_ADD; } YY_BREAK case 2: YY_RULE_SETUP -#line 109 "asmshader.l" +#line 108 "asmshader.l" {return INSTR_NOP; } YY_BREAK case 3: YY_RULE_SETUP -#line 110 "asmshader.l" +#line 109 "asmshader.l" {return INSTR_MOV; } YY_BREAK case 4: YY_RULE_SETUP -#line 111 "asmshader.l" +#line 110 "asmshader.l" {return INSTR_SUB; } YY_BREAK case 5: YY_RULE_SETUP -#line 112 "asmshader.l" +#line 111 "asmshader.l" {return INSTR_MAD; } YY_BREAK case 6: YY_RULE_SETUP -#line 113 "asmshader.l" +#line 112 "asmshader.l" {return INSTR_MUL; } YY_BREAK case 7: YY_RULE_SETUP -#line 114 "asmshader.l" +#line 113 "asmshader.l" {return INSTR_RCP; } YY_BREAK case 8: YY_RULE_SETUP -#line 115 "asmshader.l" +#line 114 "asmshader.l" {return INSTR_RSQ; } YY_BREAK case 9: YY_RULE_SETUP -#line 116 "asmshader.l" +#line 115 "asmshader.l" {return INSTR_DP3; } YY_BREAK case 10: YY_RULE_SETUP -#line 117 "asmshader.l" +#line 116 "asmshader.l" {return INSTR_DP4; } YY_BREAK case 11: YY_RULE_SETUP -#line 118 "asmshader.l" +#line 117 "asmshader.l" {return INSTR_MIN; } YY_BREAK case 12: YY_RULE_SETUP -#line 119 "asmshader.l" +#line 118 "asmshader.l" {return INSTR_MAX; } YY_BREAK case 13: YY_RULE_SETUP -#line 120 "asmshader.l" +#line 119 "asmshader.l" {return INSTR_SLT; } YY_BREAK case 14: YY_RULE_SETUP -#line 121 "asmshader.l" +#line 120 "asmshader.l" {return INSTR_SGE; } YY_BREAK case 15: YY_RULE_SETUP -#line 122 "asmshader.l" +#line 121 "asmshader.l" {return INSTR_ABS; } YY_BREAK case 16: YY_RULE_SETUP -#line 123 "asmshader.l" +#line 122 "asmshader.l" {return INSTR_EXP; } YY_BREAK case 17: YY_RULE_SETUP -#line 124 "asmshader.l" +#line 123 "asmshader.l" {return INSTR_LOG; } YY_BREAK case 18: YY_RULE_SETUP -#line 125 "asmshader.l" +#line 124 "asmshader.l" {return INSTR_EXPP; } YY_BREAK case 19: YY_RULE_SETUP -#line 126 "asmshader.l" +#line 125 "asmshader.l" {return INSTR_LOGP; } YY_BREAK case 20: YY_RULE_SETUP -#line 127 "asmshader.l" +#line 126 "asmshader.l" {return INSTR_DST; } YY_BREAK case 21: YY_RULE_SETUP -#line 128 "asmshader.l" +#line 127 "asmshader.l" {return INSTR_LRP; } YY_BREAK case 22: YY_RULE_SETUP -#line 129 "asmshader.l" +#line 128 "asmshader.l" {return INSTR_FRC; } YY_BREAK case 23: YY_RULE_SETUP -#line 130 "asmshader.l" +#line 129 "asmshader.l" {return INSTR_POW; } YY_BREAK case 24: YY_RULE_SETUP -#line 131 "asmshader.l" +#line 130 "asmshader.l" {return INSTR_CRS; } YY_BREAK case 25: YY_RULE_SETUP -#line 132 "asmshader.l" +#line 131 "asmshader.l" {return INSTR_SGN; } YY_BREAK case 26: YY_RULE_SETUP -#line 133 "asmshader.l" +#line 132 "asmshader.l" {return INSTR_NRM; } YY_BREAK case 27: YY_RULE_SETUP -#line 134 "asmshader.l" +#line 133 "asmshader.l" {return INSTR_SINCOS; } YY_BREAK case 28: YY_RULE_SETUP -#line 135 "asmshader.l" +#line 134 "asmshader.l" {return INSTR_M4x4; } YY_BREAK case 29: YY_RULE_SETUP -#line 136 "asmshader.l" +#line 135 "asmshader.l" {return INSTR_M4x3; } YY_BREAK case 30: YY_RULE_SETUP -#line 137 "asmshader.l" +#line 136 "asmshader.l" {return INSTR_M3x4; } YY_BREAK case 31: YY_RULE_SETUP -#line 138 "asmshader.l" +#line 137 "asmshader.l" {return INSTR_M3x3; } YY_BREAK case 32: YY_RULE_SETUP -#line 139 "asmshader.l" +#line 138 "asmshader.l" {return INSTR_M3x2; } YY_BREAK case 33: YY_RULE_SETUP -#line 140 "asmshader.l" +#line 139 "asmshader.l" {return INSTR_DCL; } YY_BREAK case 34: YY_RULE_SETUP -#line 141 "asmshader.l" +#line 140 "asmshader.l" {return INSTR_DEF; } YY_BREAK case 35: YY_RULE_SETUP -#line 142 "asmshader.l" +#line 141 "asmshader.l" {return INSTR_DEFB; } YY_BREAK case 36: YY_RULE_SETUP -#line 143 "asmshader.l" +#line 142 "asmshader.l" {return INSTR_DEFI; } YY_BREAK case 37: YY_RULE_SETUP -#line 144 "asmshader.l" +#line 143 "asmshader.l" {return INSTR_REP; } YY_BREAK case 38: YY_RULE_SETUP -#line 145 "asmshader.l" +#line 144 "asmshader.l" {return INSTR_ENDREP; } YY_BREAK case 39: YY_RULE_SETUP -#line 146 "asmshader.l" +#line 145 "asmshader.l" {return INSTR_IF; } YY_BREAK case 40: YY_RULE_SETUP -#line 147 "asmshader.l" +#line 146 "asmshader.l" {return INSTR_ELSE; } YY_BREAK case 41: YY_RULE_SETUP -#line 148 "asmshader.l" +#line 147 "asmshader.l" {return INSTR_ENDIF; } YY_BREAK case 42: YY_RULE_SETUP -#line 149 "asmshader.l" +#line 148 "asmshader.l" {return INSTR_BREAK; } YY_BREAK case 43: YY_RULE_SETUP -#line 150 "asmshader.l" +#line 149 "asmshader.l" {return INSTR_BREAKP; } YY_BREAK case 44: YY_RULE_SETUP -#line 151 "asmshader.l" +#line 150 "asmshader.l" {return INSTR_CALL; } YY_BREAK case 45: YY_RULE_SETUP -#line 152 "asmshader.l" +#line 151 "asmshader.l" {return INSTR_CALLNZ; } YY_BREAK case 46: YY_RULE_SETUP -#line 153 "asmshader.l" +#line 152 "asmshader.l" {return INSTR_LOOP; } YY_BREAK case 47: YY_RULE_SETUP -#line 154 "asmshader.l" +#line 153 "asmshader.l" {return INSTR_RET; } YY_BREAK case 48: YY_RULE_SETUP -#line 155 "asmshader.l" +#line 154 "asmshader.l" {return INSTR_ENDLOOP; } YY_BREAK case 49: YY_RULE_SETUP -#line 156 "asmshader.l" +#line 155 "asmshader.l" {return INSTR_LABEL; } YY_BREAK case 50: YY_RULE_SETUP -#line 157 "asmshader.l" +#line 156 "asmshader.l" {return INSTR_SETP; } YY_BREAK case 51: YY_RULE_SETUP -#line 158 "asmshader.l" +#line 157 "asmshader.l" {return INSTR_TEXLDL; } YY_BREAK /* Vertex shader only instructions */ case 52: YY_RULE_SETUP -#line 161 "asmshader.l" +#line 160 "asmshader.l" {return INSTR_LIT; } YY_BREAK case 53: YY_RULE_SETUP -#line 162 "asmshader.l" +#line 161 "asmshader.l" {return INSTR_MOVA; } YY_BREAK /* Pixel shader only instructions */ case 54: YY_RULE_SETUP -#line 165 "asmshader.l" +#line 164 "asmshader.l" {return INSTR_CND; } YY_BREAK case 55: YY_RULE_SETUP -#line 166 "asmshader.l" +#line 165 "asmshader.l" {return INSTR_CMP; } YY_BREAK case 56: YY_RULE_SETUP -#line 167 "asmshader.l" +#line 166 "asmshader.l" {return INSTR_DP2ADD; } YY_BREAK case 57: YY_RULE_SETUP -#line 168 "asmshader.l" +#line 167 "asmshader.l" {return INSTR_TEXCOORD; } YY_BREAK case 58: YY_RULE_SETUP -#line 169 "asmshader.l" +#line 168 "asmshader.l" {return INSTR_TEXCRD; } YY_BREAK case 59: YY_RULE_SETUP -#line 170 "asmshader.l" +#line 169 "asmshader.l" {return INSTR_TEXKILL; } YY_BREAK case 60: YY_RULE_SETUP -#line 171 "asmshader.l" +#line 170 "asmshader.l" {return INSTR_TEX; } YY_BREAK case 61: YY_RULE_SETUP -#line 172 "asmshader.l" +#line 171 "asmshader.l" {return INSTR_TEXLD; } YY_BREAK case 62: YY_RULE_SETUP -#line 173 "asmshader.l" +#line 172 "asmshader.l" {return INSTR_TEXBEM; } YY_BREAK case 63: YY_RULE_SETUP -#line 174 "asmshader.l" +#line 173 "asmshader.l" {return INSTR_TEXBEML; } YY_BREAK case 64: YY_RULE_SETUP -#line 175 "asmshader.l" +#line 174 "asmshader.l" {return INSTR_TEXREG2AR; } YY_BREAK case 65: YY_RULE_SETUP -#line 176 "asmshader.l" +#line 175 "asmshader.l" {return INSTR_TEXREG2GB; } YY_BREAK case 66: YY_RULE_SETUP -#line 177 "asmshader.l" +#line 176 "asmshader.l" {return INSTR_TEXREG2RGB; } YY_BREAK case 67: YY_RULE_SETUP -#line 178 "asmshader.l" +#line 177 "asmshader.l" {return INSTR_TEXM3x2PAD; } YY_BREAK case 68: YY_RULE_SETUP -#line 179 "asmshader.l" +#line 178 "asmshader.l" {return INSTR_TEXM3x2TEX; } YY_BREAK case 69: YY_RULE_SETUP -#line 180 "asmshader.l" +#line 179 "asmshader.l" {return INSTR_TEXM3x3PAD; } YY_BREAK case 70: YY_RULE_SETUP -#line 181 "asmshader.l" +#line 180 "asmshader.l" {return INSTR_TEXM3x3SPEC; } YY_BREAK case 71: YY_RULE_SETUP -#line 182 "asmshader.l" +#line 181 "asmshader.l" {return INSTR_TEXM3x3VSPEC; } YY_BREAK case 72: YY_RULE_SETUP -#line 183 "asmshader.l" +#line 182 "asmshader.l" {return INSTR_TEXM3x3TEX; } YY_BREAK case 73: YY_RULE_SETUP -#line 184 "asmshader.l" +#line 183 "asmshader.l" {return INSTR_TEXDP3TEX; } YY_BREAK case 74: YY_RULE_SETUP -#line 185 "asmshader.l" +#line 184 "asmshader.l" {return INSTR_TEXM3x2DEPTH; } YY_BREAK case 75: YY_RULE_SETUP -#line 186 "asmshader.l" +#line 185 "asmshader.l" {return INSTR_TEXDP3; } YY_BREAK case 76: YY_RULE_SETUP -#line 187 "asmshader.l" +#line 186 "asmshader.l" {return INSTR_TEXM3x3; } YY_BREAK case 77: YY_RULE_SETUP -#line 188 "asmshader.l" +#line 187 "asmshader.l" {return INSTR_TEXDEPTH; } YY_BREAK case 78: YY_RULE_SETUP -#line 189 "asmshader.l" +#line 188 "asmshader.l" {return INSTR_BEM; } YY_BREAK case 79: YY_RULE_SETUP -#line 190 "asmshader.l" +#line 189 "asmshader.l" {return INSTR_DSX; } YY_BREAK case 80: YY_RULE_SETUP -#line 191 "asmshader.l" +#line 190 "asmshader.l" {return INSTR_DSY; } YY_BREAK case 81: YY_RULE_SETUP -#line 192 "asmshader.l" +#line 191 "asmshader.l" {return INSTR_TEXLDP; } YY_BREAK case 82: YY_RULE_SETUP -#line 193 "asmshader.l" +#line 192 "asmshader.l" {return INSTR_TEXLDB; } YY_BREAK case 83: YY_RULE_SETUP -#line 194 "asmshader.l" +#line 193 "asmshader.l" {return INSTR_TEXLDD; } YY_BREAK case 84: YY_RULE_SETUP -#line 195 "asmshader.l" +#line 194 "asmshader.l" {return INSTR_PHASE; } YY_BREAK case 85: YY_RULE_SETUP -#line 197 "asmshader.l" +#line 196 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_TEMP; } YY_BREAK case 86: YY_RULE_SETUP -#line 201 "asmshader.l" +#line 200 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_OUTPUT; } YY_BREAK case 87: YY_RULE_SETUP -#line 205 "asmshader.l" +#line 204 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_INPUT; } YY_BREAK case 88: YY_RULE_SETUP -#line 209 "asmshader.l" +#line 208 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_CONSTFLOAT; } YY_BREAK case 89: YY_RULE_SETUP -#line 213 "asmshader.l" +#line 212 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_CONSTINT; } YY_BREAK case 90: YY_RULE_SETUP -#line 217 "asmshader.l" +#line 216 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_CONSTBOOL; } YY_BREAK case 91: YY_RULE_SETUP -#line 221 "asmshader.l" +#line 220 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_TEXTURE; } YY_BREAK case 92: YY_RULE_SETUP -#line 225 "asmshader.l" +#line 224 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 2); + asmshader_lval.regnum = atoi(yytext + 2); return REG_TEXCRDOUT; } YY_BREAK case 93: YY_RULE_SETUP -#line 229 "asmshader.l" +#line 228 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_SAMPLER; } YY_BREAK case 94: YY_RULE_SETUP -#line 233 "asmshader.l" +#line 232 "asmshader.l" {return REG_OPOS; } YY_BREAK case 95: YY_RULE_SETUP -#line 234 "asmshader.l" +#line 233 "asmshader.l" {return REG_OFOG; } YY_BREAK case 96: YY_RULE_SETUP -#line 235 "asmshader.l" +#line 234 "asmshader.l" {return REG_OPTS; } YY_BREAK case 97: YY_RULE_SETUP -#line 236 "asmshader.l" +#line 235 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 2); + asmshader_lval.regnum = atoi(yytext + 2); return REG_VERTEXCOLOR; } YY_BREAK case 98: YY_RULE_SETUP -#line 240 "asmshader.l" +#line 239 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 2); + asmshader_lval.regnum = atoi(yytext + 2); return REG_FRAGCOLOR; } YY_BREAK case 99: YY_RULE_SETUP -#line 244 "asmshader.l" +#line 243 "asmshader.l" {return REG_FRAGDEPTH; } YY_BREAK case 100: YY_RULE_SETUP -#line 245 "asmshader.l" +#line 244 "asmshader.l" {return REG_VPOS; } YY_BREAK case 101: YY_RULE_SETUP -#line 246 "asmshader.l" +#line 245 "asmshader.l" {return REG_VFACE; } YY_BREAK case 102: YY_RULE_SETUP -#line 247 "asmshader.l" +#line 246 "asmshader.l" {return REG_ADDRESS; } YY_BREAK case 103: YY_RULE_SETUP -#line 248 "asmshader.l" +#line 247 "asmshader.l" {return REG_LOOP; } YY_BREAK case 104: YY_RULE_SETUP -#line 249 "asmshader.l" +#line 248 "asmshader.l" {return REG_PREDICATE; } YY_BREAK case 105: YY_RULE_SETUP -#line 251 "asmshader.l" +#line 250 "asmshader.l" { - asmshader_lval.regnum = atoi(asmshader_text + 1); + asmshader_lval.regnum = atoi(yytext + 1); return REG_LABEL; } YY_BREAK @@ -1718,79 +1945,79 @@ YY_RULE_SETUP */ case 106: YY_RULE_SETUP -#line 259 "asmshader.l" +#line 258 "asmshader.l" {return VER_VS10; } YY_BREAK case 107: YY_RULE_SETUP -#line 260 "asmshader.l" +#line 259 "asmshader.l" {return VER_VS11; } YY_BREAK case 108: YY_RULE_SETUP -#line 262 "asmshader.l" +#line 261 "asmshader.l" {return VER_VS20; } YY_BREAK case 109: YY_RULE_SETUP -#line 263 "asmshader.l" +#line 262 "asmshader.l" {return VER_VS2X; } YY_BREAK case 110: YY_RULE_SETUP -#line 264 "asmshader.l" +#line 263 "asmshader.l" {return VER_VS30; } YY_BREAK case 111: YY_RULE_SETUP -#line 266 "asmshader.l" +#line 265 "asmshader.l" {return VER_PS10; } YY_BREAK case 112: YY_RULE_SETUP -#line 267 "asmshader.l" +#line 266 "asmshader.l" {return VER_PS11; } YY_BREAK case 113: YY_RULE_SETUP -#line 268 "asmshader.l" +#line 267 "asmshader.l" {return VER_PS12; } YY_BREAK case 114: YY_RULE_SETUP -#line 269 "asmshader.l" +#line 268 "asmshader.l" {return VER_PS13; } YY_BREAK case 115: YY_RULE_SETUP -#line 270 "asmshader.l" +#line 269 "asmshader.l" {return VER_PS14; } YY_BREAK case 116: YY_RULE_SETUP -#line 272 "asmshader.l" +#line 271 "asmshader.l" {return VER_PS20; } YY_BREAK case 117: YY_RULE_SETUP -#line 273 "asmshader.l" +#line 272 "asmshader.l" {return VER_PS2X; } YY_BREAK case 118: YY_RULE_SETUP -#line 274 "asmshader.l" +#line 273 "asmshader.l" {return VER_PS30; } YY_BREAK case 119: YY_RULE_SETUP -#line 276 "asmshader.l" -{return asmshader_text[0]; } +#line 275 "asmshader.l" +{return yytext[0]; } YY_BREAK case 120: YY_RULE_SETUP -#line 277 "asmshader.l" +#line 276 "asmshader.l" { - switch(asmshader_text[0]) { + switch(yytext[0]) { case 'x': case 'r': asmshader_lval.component = 0; @@ -1814,92 +2041,92 @@ YY_RULE_SETUP /* Output modifiers */ case 121: YY_RULE_SETUP -#line 300 "asmshader.l" +#line 299 "asmshader.l" {return SHIFT_X2; } YY_BREAK case 122: YY_RULE_SETUP -#line 301 "asmshader.l" +#line 300 "asmshader.l" {return SHIFT_X4; } YY_BREAK case 123: YY_RULE_SETUP -#line 302 "asmshader.l" +#line 301 "asmshader.l" {return SHIFT_X8; } YY_BREAK case 124: YY_RULE_SETUP -#line 303 "asmshader.l" +#line 302 "asmshader.l" {return SHIFT_D2; } YY_BREAK case 125: YY_RULE_SETUP -#line 304 "asmshader.l" +#line 303 "asmshader.l" {return SHIFT_D4; } YY_BREAK case 126: YY_RULE_SETUP -#line 305 "asmshader.l" +#line 304 "asmshader.l" {return SHIFT_D8; } YY_BREAK case 127: YY_RULE_SETUP -#line 306 "asmshader.l" +#line 305 "asmshader.l" {return MOD_SAT; } YY_BREAK case 128: YY_RULE_SETUP -#line 307 "asmshader.l" +#line 306 "asmshader.l" {return MOD_PP; } YY_BREAK case 129: YY_RULE_SETUP -#line 308 "asmshader.l" +#line 307 "asmshader.l" {return MOD_CENTROID; } YY_BREAK /* compare params */ case 130: YY_RULE_SETUP -#line 311 "asmshader.l" +#line 310 "asmshader.l" {return COMP_GT; } YY_BREAK case 131: YY_RULE_SETUP -#line 312 "asmshader.l" +#line 311 "asmshader.l" {return COMP_LT; } YY_BREAK case 132: YY_RULE_SETUP -#line 313 "asmshader.l" +#line 312 "asmshader.l" {return COMP_GE; } YY_BREAK case 133: YY_RULE_SETUP -#line 314 "asmshader.l" +#line 313 "asmshader.l" {return COMP_LE; } YY_BREAK case 134: YY_RULE_SETUP -#line 315 "asmshader.l" +#line 314 "asmshader.l" {return COMP_EQ; } YY_BREAK case 135: YY_RULE_SETUP -#line 316 "asmshader.l" +#line 315 "asmshader.l" {return COMP_NE; } YY_BREAK case 136: YY_RULE_SETUP -#line 318 "asmshader.l" +#line 317 "asmshader.l" { - asmshader_lval.immval.val = atof(asmshader_text); - asmshader_lval.immval.integer = ((strstr(asmshader_text, ".") == NULL) && (strstr(asmshader_text, "f") == NULL)); + asmshader_lval.immval.val = atof(yytext); + asmshader_lval.immval.integer = ((strstr(yytext, ".") == NULL) && (strstr(yytext, "f") == NULL)); return IMMVAL; } YY_BREAK case 137: YY_RULE_SETUP -#line 323 "asmshader.l" +#line 322 "asmshader.l" { asmshader_lval.immbool = TRUE; return IMMBOOL; @@ -1907,7 +2134,7 @@ YY_RULE_SETUP YY_BREAK case 138: YY_RULE_SETUP -#line 327 "asmshader.l" +#line 326 "asmshader.l" { asmshader_lval.immbool = FALSE; return IMMBOOL; @@ -1915,296 +2142,296 @@ YY_RULE_SETUP YY_BREAK case 139: YY_RULE_SETUP -#line 332 "asmshader.l" -{return asmshader_text[0]; } +#line 331 "asmshader.l" +{return yytext[0]; } YY_BREAK case 140: YY_RULE_SETUP -#line 333 "asmshader.l" -{return asmshader_text[0]; } +#line 332 "asmshader.l" +{return yytext[0]; } YY_BREAK case 141: YY_RULE_SETUP -#line 334 "asmshader.l" -{return asmshader_text[0]; } +#line 333 "asmshader.l" +{return yytext[0]; } YY_BREAK case 142: YY_RULE_SETUP -#line 335 "asmshader.l" -{return asmshader_text[0]; } +#line 334 "asmshader.l" +{return yytext[0]; } YY_BREAK /* for relative addressing */ case 143: YY_RULE_SETUP -#line 338 "asmshader.l" -{return asmshader_text[0]; } +#line 337 "asmshader.l" +{return yytext[0]; } YY_BREAK case 144: YY_RULE_SETUP -#line 340 "asmshader.l" +#line 339 "asmshader.l" {return SMOD_BIAS; } YY_BREAK /* No _x2 here; it is identical to MOD_X2 */ case 145: YY_RULE_SETUP -#line 342 "asmshader.l" +#line 341 "asmshader.l" {return SMOD_SCALEBIAS; } YY_BREAK case 146: YY_RULE_SETUP -#line 343 "asmshader.l" +#line 342 "asmshader.l" {return SMOD_DZ; } YY_BREAK case 147: YY_RULE_SETUP -#line 344 "asmshader.l" +#line 343 "asmshader.l" {return SMOD_DW; } YY_BREAK case 148: YY_RULE_SETUP -#line 345 "asmshader.l" +#line 344 "asmshader.l" {return SMOD_ABS; } YY_BREAK case 149: YY_RULE_SETUP -#line 347 "asmshader.l" +#line 346 "asmshader.l" {return SMOD_NOT; } YY_BREAK case 150: YY_RULE_SETUP -#line 349 "asmshader.l" +#line 348 "asmshader.l" { - if(asmshader_text[strlen("_position")] == '\0') { + if(yytext[strlen("_position")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_position")); + asmshader_lval.regnum = atoi(yytext + strlen("_position")); } return USAGE_POSITION; } YY_BREAK case 151: YY_RULE_SETUP -#line 357 "asmshader.l" +#line 356 "asmshader.l" { - if(asmshader_text[strlen("_blendweight")] == '\0') { + if(yytext[strlen("_blendweight")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_blendweight")); + asmshader_lval.regnum = atoi(yytext + strlen("_blendweight")); } return USAGE_BLENDWEIGHT; } YY_BREAK case 152: YY_RULE_SETUP -#line 365 "asmshader.l" +#line 364 "asmshader.l" { - if(asmshader_text[strlen("_blendindices")] == '\0') { + if(yytext[strlen("_blendindices")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_blendindices")); + asmshader_lval.regnum = atoi(yytext + strlen("_blendindices")); } return USAGE_BLENDINDICES; } YY_BREAK case 153: YY_RULE_SETUP -#line 373 "asmshader.l" +#line 372 "asmshader.l" { - if(asmshader_text[strlen("_normal")] == '\0') { + if(yytext[strlen("_normal")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_normal")); + asmshader_lval.regnum = atoi(yytext + strlen("_normal")); } return USAGE_NORMAL; } YY_BREAK case 154: YY_RULE_SETUP -#line 381 "asmshader.l" +#line 380 "asmshader.l" { - if(asmshader_text[strlen("_psize")] == '\0') { + if(yytext[strlen("_psize")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_psize")); + asmshader_lval.regnum = atoi(yytext + strlen("_psize")); } return USAGE_PSIZE; } YY_BREAK case 155: YY_RULE_SETUP -#line 389 "asmshader.l" +#line 388 "asmshader.l" { - if(asmshader_text[strlen("_texcoord")] == '\0') { + if(yytext[strlen("_texcoord")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_texcoord")); + asmshader_lval.regnum = atoi(yytext + strlen("_texcoord")); } return USAGE_TEXCOORD; } YY_BREAK case 156: YY_RULE_SETUP -#line 397 "asmshader.l" +#line 396 "asmshader.l" { - if(asmshader_text[strlen("_tangent")] == '\0') { + if(yytext[strlen("_tangent")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_tangent")); + asmshader_lval.regnum = atoi(yytext + strlen("_tangent")); } return USAGE_TANGENT; } YY_BREAK case 157: YY_RULE_SETUP -#line 405 "asmshader.l" +#line 404 "asmshader.l" { - if(asmshader_text[strlen("_binormal")] == '\0') { + if(yytext[strlen("_binormal")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_binormal")); + asmshader_lval.regnum = atoi(yytext + strlen("_binormal")); } return USAGE_BINORMAL; } YY_BREAK case 158: YY_RULE_SETUP -#line 413 "asmshader.l" +#line 412 "asmshader.l" { - if(asmshader_text[strlen("_tessfactor")] == '\0') { + if(yytext[strlen("_tessfactor")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_tessfactor")); + asmshader_lval.regnum = atoi(yytext + strlen("_tessfactor")); } return USAGE_TESSFACTOR; } YY_BREAK case 159: YY_RULE_SETUP -#line 421 "asmshader.l" +#line 420 "asmshader.l" { - if(asmshader_text[strlen("_positiont")] == '\0') { + if(yytext[strlen("_positiont")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_positiont")); + asmshader_lval.regnum = atoi(yytext + strlen("_positiont")); } return USAGE_POSITIONT; } YY_BREAK case 160: YY_RULE_SETUP -#line 429 "asmshader.l" +#line 428 "asmshader.l" { - if(asmshader_text[strlen("_color")] == '\0') { + if(yytext[strlen("_color")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_color")); + asmshader_lval.regnum = atoi(yytext + strlen("_color")); } return USAGE_COLOR; } YY_BREAK case 161: YY_RULE_SETUP -#line 437 "asmshader.l" +#line 436 "asmshader.l" { - if(asmshader_text[strlen("_fog")] == '\0') { + if(yytext[strlen("_fog")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_fog")); + asmshader_lval.regnum = atoi(yytext + strlen("_fog")); } return USAGE_FOG; } YY_BREAK case 162: YY_RULE_SETUP -#line 445 "asmshader.l" +#line 444 "asmshader.l" { - if(asmshader_text[strlen("_depth")] == '\0') { + if(yytext[strlen("_depth")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_depth")); + asmshader_lval.regnum = atoi(yytext + strlen("_depth")); } return USAGE_DEPTH; } YY_BREAK case 163: YY_RULE_SETUP -#line 453 "asmshader.l" +#line 452 "asmshader.l" { - if(asmshader_text[strlen("_sample")] == '\0') { + if(yytext[strlen("_sample")] == '\0') { asmshader_lval.regnum = 0; } else { - asmshader_lval.regnum = atoi(asmshader_text + strlen("_sample")); + asmshader_lval.regnum = atoi(yytext + strlen("_sample")); } return USAGE_SAMPLE; } YY_BREAK case 164: YY_RULE_SETUP -#line 462 "asmshader.l" +#line 461 "asmshader.l" { return SAMPTYPE_1D; } YY_BREAK case 165: YY_RULE_SETUP -#line 463 "asmshader.l" +#line 462 "asmshader.l" { return SAMPTYPE_2D; } YY_BREAK case 166: YY_RULE_SETUP -#line 464 "asmshader.l" +#line 463 "asmshader.l" { return SAMPTYPE_CUBE; } YY_BREAK case 167: YY_RULE_SETUP -#line 465 "asmshader.l" +#line 464 "asmshader.l" { return SAMPTYPE_VOLUME; } YY_BREAK case 168: /* rule 168 can match eol */ YY_RULE_SETUP -#line 467 "asmshader.l" +#line 466 "asmshader.l" { /* TODO: update current line information */ - TRACE("line info update: %s", asmshader_text); + TRACE("line info update: %s", yytext); } YY_BREAK /* Skip comments */ case 169: YY_RULE_SETUP -#line 473 "asmshader.l" +#line 472 "asmshader.l" { } YY_BREAK case 170: YY_RULE_SETUP -#line 474 "asmshader.l" +#line 473 "asmshader.l" { } YY_BREAK case 171: YY_RULE_SETUP -#line 476 "asmshader.l" +#line 475 "asmshader.l" { /* Do nothing */ } YY_BREAK case 172: /* rule 172 can match eol */ YY_RULE_SETUP -#line 477 "asmshader.l" +#line 476 "asmshader.l" { asm_ctx.line_no++; } YY_BREAK case 173: YY_RULE_SETUP -#line 481 "asmshader.l" +#line 480 "asmshader.l" { - asmparser_message(&asm_ctx, "Line %u: Unexpected input %s\n", asm_ctx.line_no, asmshader_text); + asmparser_message(&asm_ctx, "Line %u: Unexpected input %s\n", asm_ctx.line_no, yytext); set_parse_status(&asm_ctx.status, PARSE_ERR); } YY_BREAK case 174: YY_RULE_SETUP -#line 486 "asmshader.l" +#line 485 "asmshader.l" ECHO; YY_BREAK -#line 2208 "asmshader.yy.c" +#line 2434 "asmshader.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2221,15 +2448,15 @@ case YY_STATE_EOF(INITIAL): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed asmshader_in at a new source and called - * asmshader_lex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = asmshader_in; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -2283,11 +2510,11 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( asmshader_wrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * asmshader_text, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -2336,7 +2563,8 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of asmshader_lex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2347,9 +2575,9 @@ case YY_STATE_EOF(INITIAL): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2378,7 +2606,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2398,7 +2626,7 @@ static int yy_get_next_buffer (void) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -2414,11 +2642,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - asmshader_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2436,7 +2665,7 @@ static int yy_get_next_buffer (void) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); + (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -2446,7 +2675,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - asmshader_restart(asmshader_in ); + yyrestart( yyin ); } else @@ -2460,12 +2689,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) asmshader_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -2481,14 +2713,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2498,9 +2730,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 481 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -2513,10 +2745,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2526,14 +2758,18 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 481 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 480); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2558,7 +2794,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2575,14 +2811,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - asmshader_restart(asmshader_in ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( asmshader_wrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2601,7 +2837,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve asmshader_text */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -2613,32 +2849,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void asmshader_restart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - asmshader_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - asmshader__create_buffer(asmshader_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - asmshader__init_buffer(YY_CURRENT_BUFFER,input_file ); - asmshader__load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void asmshader__switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * asmshader_pop_buffer_state(); - * asmshader_push_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - asmshader_ensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2651,21 +2887,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - asmshader__load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (asmshader_wrap()) processing, but the only time this flag - * is looked at is after asmshader_wrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void asmshader__load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - asmshader_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2675,35 +2911,35 @@ static void asmshader__load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE asmshader__create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) asmshader_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in asmshader__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) asmshader_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in asmshader__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - asmshader__init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with asmshader__create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void asmshader__delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2713,27 +2949,27 @@ static void asmshader__load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - asmshader_free((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - asmshader_free((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a asmshader_restart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void asmshader__init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - asmshader__flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then asmshader__init_buffer was _probably_ - * called from asmshader_restart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2750,7 +2986,7 @@ static void asmshader__load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void asmshader__flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2770,7 +3006,7 @@ static void asmshader__load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - asmshader__load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2779,14 +3015,14 @@ static void asmshader__load_buffer_state (void) * @param new_buffer The new state. * */ -void asmshader_push_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - asmshader_ensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from asmshader__switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2800,8 +3036,8 @@ void asmshader_push_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from asmshader__switch_to_buffer. */ - asmshader__load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -2809,18 +3045,18 @@ void asmshader_push_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void asmshader_pop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - asmshader__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - asmshader__load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2828,9 +3064,9 @@ void asmshader_pop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void asmshader_ensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { @@ -2838,15 +3074,15 @@ static void asmshader_ensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)asmshader_alloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in asmshader_ensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2855,15 +3091,15 @@ static void asmshader_ensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)asmshader_realloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in asmshader_ensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2875,9 +3111,9 @@ static void asmshader_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE asmshader__scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2885,49 +3121,49 @@ YY_BUFFER_STATE asmshader__scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) asmshader_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in asmshader__scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - asmshader__switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to asmshader_lex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * asmshader__scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE asmshader__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return asmshader__scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to asmshader_lex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE asmshader__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; @@ -2935,19 +3171,19 @@ YY_BUFFER_STATE asmshader__scan_bytes (yyconst char * yybytes, int _yybytes_le int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) asmshader_alloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in asmshader__scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = asmshader__scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in asmshader__scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2961,9 +3197,9 @@ YY_BUFFER_STATE asmshader__scan_bytes (yyconst char * yybytes, int _yybytes_le #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2973,14 +3209,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up asmshader_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - asmshader_text[asmshader_leng] = (yy_hold_char); \ - (yy_c_buf_p) = asmshader_text + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - asmshader_leng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -2989,126 +3225,126 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int asmshader_get_lineno (void) +int yyget_lineno (void) { - - return asmshader_lineno; + + return yylineno; } /** Get the input stream. * */ -FILE *asmshader_get_in (void) +FILE *yyget_in (void) { - return asmshader_in; + return yyin; } /** Get the output stream. * */ -FILE *asmshader_get_out (void) +FILE *yyget_out (void) { - return asmshader_out; + return yyout; } /** Get the length of the current token. * */ -int asmshader_get_leng (void) +int yyget_leng (void) { - return asmshader_leng; + return yyleng; } /** Get the current token. * */ -char *asmshader_get_text (void) +char *yyget_text (void) { - return asmshader_text; + return yytext; } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void asmshader_set_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - asmshader_lineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * - * @see asmshader__switch_to_buffer + * @see yy_switch_to_buffer */ -void asmshader_set_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - asmshader_in = in_str ; + yyin = _in_str ; } -void asmshader_set_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - asmshader_out = out_str ; + yyout = _out_str ; } -int asmshader_get_debug (void) +int yyget_debug (void) { - return asmshader__flex_debug; + return yy_flex_debug; } -void asmshader_set_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - asmshader__flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from asmshader_lex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - asmshader_in = stdin; - asmshader_out = stdout; + yyin = stdin; + yyout = stdout; #else - asmshader_in = (FILE *) 0; - asmshader_out = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * asmshader_lex_init() + * yylex_init() */ return 0; } -/* asmshader_lex_destroy is for both reentrant and non-reentrant scanners. */ -int asmshader_lex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - asmshader__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - asmshader_pop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - asmshader_free((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * asmshader_lex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -3119,18 +3355,19 @@ int asmshader_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -3138,13 +3375,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *asmshader_alloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *asmshader_realloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -3152,18 +3390,17 @@ void *asmshader_realloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void asmshader_free (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see asmshader_realloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 486 "asmshader.l" - +#line 485 "asmshader.l" struct bwriter_shader *SlAssembleShader(const char *text, char **messages) { diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.yy.h b/dll/directx/wine/d3dcompiler_43/asmshader.yy.h new file mode 100644 index 00000000000..4a5a5f772a0 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/asmshader.yy.h @@ -0,0 +1,711 @@ +#ifndef asmshader_HEADER_H +#define asmshader_HEADER_H 1 +#define asmshader_IN_HEADER 1 + +#line 5 "asmshader.yy.h" + +#line 7 "asmshader.yy.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define asmshader__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer asmshader__create_buffer +#endif + +#ifdef yy_delete_buffer +#define asmshader__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer asmshader__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define asmshader__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer asmshader__scan_buffer +#endif + +#ifdef yy_scan_string +#define asmshader__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string asmshader__scan_string +#endif + +#ifdef yy_scan_bytes +#define asmshader__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes asmshader__scan_bytes +#endif + +#ifdef yy_init_buffer +#define asmshader__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer asmshader__init_buffer +#endif + +#ifdef yy_flush_buffer +#define asmshader__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer asmshader__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define asmshader__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state asmshader__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define asmshader__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer asmshader__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define asmshader_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state asmshader_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define asmshader_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state asmshader_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define asmshader_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack asmshader_ensure_buffer_stack +#endif + +#ifdef yylex +#define asmshader_lex_ALREADY_DEFINED +#else +#define yylex asmshader_lex +#endif + +#ifdef yyrestart +#define asmshader_restart_ALREADY_DEFINED +#else +#define yyrestart asmshader_restart +#endif + +#ifdef yylex_init +#define asmshader_lex_init_ALREADY_DEFINED +#else +#define yylex_init asmshader_lex_init +#endif + +#ifdef yylex_init_extra +#define asmshader_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra asmshader_lex_init_extra +#endif + +#ifdef yylex_destroy +#define asmshader_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy asmshader_lex_destroy +#endif + +#ifdef yyget_debug +#define asmshader_get_debug_ALREADY_DEFINED +#else +#define yyget_debug asmshader_get_debug +#endif + +#ifdef yyset_debug +#define asmshader_set_debug_ALREADY_DEFINED +#else +#define yyset_debug asmshader_set_debug +#endif + +#ifdef yyget_extra +#define asmshader_get_extra_ALREADY_DEFINED +#else +#define yyget_extra asmshader_get_extra +#endif + +#ifdef yyset_extra +#define asmshader_set_extra_ALREADY_DEFINED +#else +#define yyset_extra asmshader_set_extra +#endif + +#ifdef yyget_in +#define asmshader_get_in_ALREADY_DEFINED +#else +#define yyget_in asmshader_get_in +#endif + +#ifdef yyset_in +#define asmshader_set_in_ALREADY_DEFINED +#else +#define yyset_in asmshader_set_in +#endif + +#ifdef yyget_out +#define asmshader_get_out_ALREADY_DEFINED +#else +#define yyget_out asmshader_get_out +#endif + +#ifdef yyset_out +#define asmshader_set_out_ALREADY_DEFINED +#else +#define yyset_out asmshader_set_out +#endif + +#ifdef yyget_leng +#define asmshader_get_leng_ALREADY_DEFINED +#else +#define yyget_leng asmshader_get_leng +#endif + +#ifdef yyget_text +#define asmshader_get_text_ALREADY_DEFINED +#else +#define yyget_text asmshader_get_text +#endif + +#ifdef yyget_lineno +#define asmshader_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno asmshader_get_lineno +#endif + +#ifdef yyset_lineno +#define asmshader_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno asmshader_set_lineno +#endif + +#ifdef yywrap +#define asmshader_wrap_ALREADY_DEFINED +#else +#define yywrap asmshader_wrap +#endif + +#ifdef yyalloc +#define asmshader_alloc_ALREADY_DEFINED +#else +#define yyalloc asmshader_alloc +#endif + +#ifdef yyrealloc +#define asmshader_realloc_ALREADY_DEFINED +#else +#define yyrealloc asmshader_realloc +#endif + +#ifdef yyfree +#define asmshader_free_ALREADY_DEFINED +#else +#define yyfree asmshader_free +#endif + +#ifdef yytext +#define asmshader_text_ALREADY_DEFINED +#else +#define yytext asmshader_text +#endif + +#ifdef yyleng +#define asmshader_leng_ALREADY_DEFINED +#else +#define yyleng asmshader_leng +#endif + +#ifdef yyin +#define asmshader_in_ALREADY_DEFINED +#else +#define yyin asmshader_in +#endif + +#ifdef yyout +#define asmshader_out_ALREADY_DEFINED +#else +#define yyout asmshader_out +#endif + +#ifdef yy_flex_debug +#define asmshader__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug asmshader__flex_debug +#endif + +#ifdef yylineno +#define asmshader_lineno_ALREADY_DEFINED +#else +#define yylineno asmshader_lineno +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +/* Begin user sect3 */ + +#define asmshader_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +extern int yylineno; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef asmshader__create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef asmshader__delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef asmshader__scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef asmshader__scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef asmshader__scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef asmshader__init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef asmshader__flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef asmshader__load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef asmshader__switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef asmshader_push_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef asmshader_pop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef asmshader_ensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef asmshader_lex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef asmshader_restart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef asmshader_lex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef asmshader_lex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef asmshader_lex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef asmshader_get_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef asmshader_set_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef asmshader_get_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef asmshader_set_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef asmshader_get_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef asmshader_set_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef asmshader_get_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef asmshader_set_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef asmshader_get_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef asmshader_get_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef asmshader_get_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef asmshader_set_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef asmshader_get_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef asmshader_set_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef asmshader_wrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef asmshader_get_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef asmshader_set_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef asmshader_get_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef asmshader_set_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef asmshader_alloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef asmshader_realloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef asmshader_free_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef asmshader_text_ALREADY_DEFINED +#undef yytext +#endif +#ifndef asmshader_leng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef asmshader_in_ALREADY_DEFINED +#undef yyin +#endif +#ifndef asmshader_out_ALREADY_DEFINED +#undef yyout +#endif +#ifndef asmshader__flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef asmshader_lineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef asmshader_tables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef asmshader_tables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef asmshader_TABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 485 "asmshader.l" + + +#line 709 "asmshader.yy.h" +#undef asmshader_IN_HEADER +#endif /* asmshader_HEADER_H */ diff --git a/dll/directx/wine/d3dcompiler_43/blob.c b/dll/directx/wine/d3dcompiler_43/blob.c index f22dc7183d5..5cc49fe5699 100644 --- a/dll/directx/wine/d3dcompiler_43/blob.c +++ b/dll/directx/wine/d3dcompiler_43/blob.c @@ -19,9 +19,6 @@ * */ -#include "config.h" -#include "wine/port.h" - #include "d3dcompiler_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler); @@ -466,9 +463,55 @@ HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents) { - FIXME("filename %s, contents %p\n", debugstr_w(filename), contents); + struct d3dcompiler_blob *object; + SIZE_T data_size; + DWORD read_size; + HANDLE file; + HRESULT hr; - return E_NOTIMPL; + TRACE("filename %s, contents %p.\n", debugstr_w(filename), contents); + + file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) + return HRESULT_FROM_WIN32(GetLastError()); + + data_size = GetFileSize(file, NULL); + if (data_size == INVALID_FILE_SIZE) + { + CloseHandle(file); + return HRESULT_FROM_WIN32(GetLastError()); + } + + if (!(object = heap_alloc_zero(sizeof(*object)))) + { + CloseHandle(file); + return E_OUTOFMEMORY; + } + + if (FAILED(hr = d3dcompiler_blob_init(object, data_size))) + { + WARN("Failed to initialize blob, hr %#x.\n", hr); + CloseHandle(file); + heap_free(object); + return hr; + } + + if (!ReadFile(file, object->data, data_size, &read_size, NULL) || (read_size != data_size)) + { + WARN("Failed to read file contents.\n"); + CloseHandle(file); + heap_free(object->data); + heap_free(object); + return E_FAIL; + } + CloseHandle(file); + object->size = read_size; + + *contents = &object->ID3DBlob_iface; + + TRACE("Returning ID3DBlob %p.\n", *contents); + + return S_OK; } HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob* blob, const WCHAR *filename, BOOL overwrite) diff --git a/dll/directx/wine/d3dcompiler_43/bytecodewriter.c b/dll/directx/wine/d3dcompiler_43/bytecodewriter.c index a3e6f63fd92..14162ab212b 100644 --- a/dll/directx/wine/d3dcompiler_43/bytecodewriter.c +++ b/dll/directx/wine/d3dcompiler_43/bytecodewriter.c @@ -20,8 +20,6 @@ * */ -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #include "d3d9types.h" diff --git a/dll/directx/wine/d3dcompiler_43/compiler.c b/dll/directx/wine/d3dcompiler_43/compiler.c index 53d2a430a58..990df0ded56 100644 --- a/dll/directx/wine/d3dcompiler_43/compiler.c +++ b/dll/directx/wine/d3dcompiler_43/compiler.c @@ -18,13 +18,12 @@ */ #define COBJMACROS -#include "config.h" -#include "wine/port.h" +#include +#include #include "wine/debug.h" -#include "wine/unicode.h" #include "d3dcompiler_private.h" -#include "wine/wpp.h" +#include "wpp_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler); @@ -61,6 +60,15 @@ static int wpp_output_capacity, wpp_output_size; static char *wpp_messages; static int wpp_messages_capacity, wpp_messages_size; +struct define +{ + struct define *next; + char *name; + char *value; +}; + +static struct define *cmdline_defines; + /* Mutex used to guarantee a single invocation of the D3DXAssembleShader function (or its variants) at a time. This is needed as wpp isn't thread-safe */ @@ -75,7 +83,7 @@ static CRITICAL_SECTION_DEBUG wpp_mutex_debug = static CRITICAL_SECTION wpp_mutex = { &wpp_mutex_debug, -1, 0, 0, 0, 0 }; /* Preprocessor error reporting functions */ -static void wpp_write_message(const char *fmt, va_list args) +static void wpp_write_message(const char *fmt, __ms_va_list args) { char* newbuffer; int rc, newsize; @@ -115,35 +123,43 @@ static void wpp_write_message(const char *fmt, va_list args) } } -static void PRINTF_ATTR(1,2) wpp_write_message_var(const char *fmt, ...) +static void WINAPIV PRINTF_ATTR(1,2) wpp_write_message_var(const char *fmt, ...) { - va_list args; + __ms_va_list args; - va_start(args, fmt); + __ms_va_start(args, fmt); wpp_write_message(fmt, args); - va_end(args); + __ms_va_end(args); } -static void wpp_error(const char *file, int line, int col, const char *_near, - const char *msg, va_list ap) +int WINAPIV ppy_error(const char *msg, ...) { - wpp_write_message_var("%s:%d:%d: %s: ", file ? file : "'main file'", - line, col, "Error"); + __ms_va_list ap; + __ms_va_start(ap, msg); + wpp_write_message_var("%s:%d:%d: %s: ", + pp_status.input ? pp_status.input : "'main file'", + pp_status.line_number, pp_status.char_number, "Error"); wpp_write_message(msg, ap); wpp_write_message_var("\n"); + __ms_va_end(ap); + pp_status.state = 1; + return 1; } -static void wpp_warning(const char *file, int line, int col, const char *_near, - const char *msg, va_list ap) +int WINAPIV ppy_warning(const char *msg, ...) { - wpp_write_message_var("%s:%d:%d: %s: ", file ? file : "'main file'", - line, col, "Warning"); + __ms_va_list ap; + __ms_va_start(ap, msg); + wpp_write_message_var("%s:%d:%d: %s: ", + pp_status.input ? pp_status.input : "'main file'", + pp_status.line_number, pp_status.char_number, "Warning"); wpp_write_message(msg, ap); wpp_write_message_var("\n"); + __ms_va_end(ap); + return 0; } -static char *wpp_lookup_mem(const char *filename, int type, const char *parent_name, - char **include_path, int include_path_count) +char *wpp_lookup(const char *filename, int type, const char *parent_name) { /* We don't check for file existence here. We will potentially fail on * the following wpp_open_mem(). */ @@ -176,7 +192,7 @@ static char *wpp_lookup_mem(const char *filename, int type, const char *parent_n return path; } -static void *wpp_open_mem(const char *filename, int type) +void *wpp_open(const char *filename, int type) { struct mem_file_desc *desc; HRESULT hr; @@ -239,7 +255,7 @@ error: return NULL; } -static void wpp_close_mem(void *file) +void wpp_close(void *file) { struct mem_file_desc *desc = file; @@ -255,7 +271,7 @@ static void wpp_close_mem(void *file) } } -static int wpp_read_mem(void *file, char *buffer, unsigned int len) +int wpp_read(void *file, char *buffer, unsigned int len) { struct mem_file_desc *desc = file; @@ -265,7 +281,7 @@ static int wpp_read_mem(void *file, char *buffer, unsigned int len) return len; } -static void wpp_write_mem(const char *buffer, unsigned int len) +void wpp_write(const char *buffer, unsigned int len) { char *new_wpp_output; @@ -307,6 +323,164 @@ static int wpp_close_output(void) return 1; } +static void add_cmdline_defines(void) +{ + struct define *def; + + for (def = cmdline_defines; def; def = def->next) + { + if (def->value) pp_add_define( def->name, def->value ); + } +} + +static void del_cmdline_defines(void) +{ + struct define *def; + + for (def = cmdline_defines; def; def = def->next) + { + if (def->value) pp_del_define( def->name ); + } +} + +static void add_special_defines(void) +{ + time_t now = time(NULL); + pp_entry_t *ppp; + char buf[32]; + + strftime(buf, sizeof(buf), "\"%b %d %Y\"", localtime(&now)); + pp_add_define( "__DATE__", buf ); + + strftime(buf, sizeof(buf), "\"%H:%M:%S\"", localtime(&now)); + pp_add_define( "__TIME__", buf ); + + ppp = pp_add_define( "__FILE__", "" ); + if(ppp) + ppp->type = def_special; + + ppp = pp_add_define( "__LINE__", "" ); + if(ppp) + ppp->type = def_special; +} + +static void del_special_defines(void) +{ + pp_del_define( "__DATE__" ); + pp_del_define( "__TIME__" ); + pp_del_define( "__FILE__" ); + pp_del_define( "__LINE__" ); +} + + +/* add a define to the preprocessor list */ +int wpp_add_define( const char *name, const char *value ) +{ + struct define *def; + + if (!value) value = ""; + + for (def = cmdline_defines; def; def = def->next) + { + if (!strcmp( def->name, name )) + { + char *new_value = pp_xstrdup(value); + if(!new_value) + return 1; + free( def->value ); + def->value = new_value; + + return 0; + } + } + + def = pp_xmalloc( sizeof(*def) ); + if(!def) + return 1; + def->next = cmdline_defines; + def->name = pp_xstrdup(name); + if(!def->name) + { + free(def); + return 1; + } + def->value = pp_xstrdup(value); + if(!def->value) + { + free(def->name); + free(def); + return 1; + } + cmdline_defines = def; + return 0; +} + + +/* undefine a previously added definition */ +void wpp_del_define( const char *name ) +{ + struct define *def; + + for (def = cmdline_defines; def; def = def->next) + { + if (!strcmp( def->name, name )) + { + free( def->value ); + def->value = NULL; + return; + } + } +} + + +/* the main preprocessor parsing loop */ +int wpp_parse( const char *input, FILE *output ) +{ + int ret; + + pp_status.input = NULL; + pp_status.line_number = 1; + pp_status.char_number = 1; + pp_status.state = 0; + + ret = pp_push_define_state(); + if(ret) + return ret; + add_cmdline_defines(); + add_special_defines(); + + if (!input) pp_status.file = stdin; + else if (!(pp_status.file = wpp_open(input, 1))) + { + ppy_error("Could not open %s\n", input); + del_special_defines(); + del_cmdline_defines(); + pp_pop_define_state(); + return 2; + } + + pp_status.input = input ? pp_xstrdup(input) : NULL; + + ppy_out = output; + pp_writestring("# 1 \"%s\" 1\n", input ? input : ""); + + ret = ppy_parse(); + /* If there were errors during processing, return an error code */ + if (!ret && pp_status.state) ret = pp_status.state; + + if (input) + { + wpp_close(pp_status.file); + free(pp_status.input); + } + /* Clean if_stack, it could remain dirty on errors */ + while (pp_get_if_depth()) pp_pop_if(); + del_special_defines(); + del_cmdline_defines(); + pp_pop_define_state(); + return ret; +} + static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **error_messages) { @@ -314,17 +488,6 @@ static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char HRESULT hr = S_OK; const D3D_SHADER_MACRO *def = defines; - static const struct wpp_callbacks wpp_callbacks = - { - wpp_lookup_mem, - wpp_open_mem, - wpp_close_mem, - wpp_read_mem, - wpp_write_mem, - wpp_error, - wpp_warning, - }; - if (def != NULL) { while (def->Name != NULL) @@ -339,7 +502,6 @@ static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char wpp_output_size = wpp_output_capacity = 0; wpp_output = NULL; - wpp_set_callbacks(&wpp_callbacks); wpp_messages_size = wpp_messages_capacity = 0; wpp_messages = NULL; current_shader.buffer = data; diff --git a/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h b/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h index 68ff9623287..45dbff7225b 100644 --- a/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h +++ b/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h @@ -25,6 +25,7 @@ #include "wine/debug.h" #include "wine/list.h" #include "wine/rbtree.h" +#include "wine/heap.h" #define COBJMACROS #include "windef.h" @@ -284,8 +285,8 @@ struct bwriter_shader *parse_asm_shader(char **messages) DECLSPEC_HIDDEN; #define PRINTF_ATTR(fmt,args) #endif -void compilation_message(struct compilation_messages *msg, const char *fmt, va_list args) DECLSPEC_HIDDEN; -void asmparser_message(struct asm_parser *ctx, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN; +void compilation_message(struct compilation_messages *msg, const char *fmt, __ms_va_list args) DECLSPEC_HIDDEN; +void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN; static inline void set_parse_status(enum parse_status *current, enum parse_status update) { if (update == PARSE_ERR) @@ -705,13 +706,11 @@ struct source_location enum hlsl_ir_node_type { - HLSL_IR_VAR = 0, - HLSL_IR_ASSIGNMENT, + HLSL_IR_ASSIGNMENT = 0, HLSL_IR_CONSTANT, HLSL_IR_CONSTRUCTOR, HLSL_IR_DEREF, HLSL_IR_EXPR, - HLSL_IR_FUNCTION_DECL, HLSL_IR_IF, HLSL_IR_LOOP, HLSL_IR_JUMP, @@ -755,12 +754,13 @@ struct reg_reservation struct hlsl_ir_var { - struct hlsl_ir_node node; + struct hlsl_type *data_type; + struct source_location loc; const char *name; const char *semantic; unsigned int modifiers; const struct reg_reservation *reg_reservation; - struct list scope_entry; + struct list scope_entry, param_entry; struct hlsl_var_allocation *allocation; }; @@ -775,7 +775,8 @@ struct hlsl_ir_function struct hlsl_ir_function_decl { - struct hlsl_ir_node node; + struct hlsl_type *return_type; + struct source_location loc; struct wine_rb_entry entry; struct hlsl_ir_function *func; const char *semantic; @@ -951,7 +952,8 @@ struct hlsl_ir_constant struct hlsl_ir_constructor { struct hlsl_ir_node node; - struct list *arguments; + struct hlsl_ir_node *args[16]; + unsigned int args_count; }; struct hlsl_scope @@ -978,6 +980,12 @@ struct parse_colon_attribute struct reg_reservation *reg_reservation; }; +struct parse_initializer +{ + struct hlsl_ir_node **args; + unsigned int args_count; +}; + struct parse_variable_def { struct list entry; @@ -987,7 +995,7 @@ struct parse_variable_def unsigned int array_size; const char *semantic; struct reg_reservation *reg_reservation; - struct list *initializer; + struct parse_initializer initializer; }; struct parse_function @@ -1054,16 +1062,10 @@ enum hlsl_error_level HLSL_LEVEL_NOTE, }; -void hlsl_message(const char *fmt, ...) PRINTF_ATTR(1,2) DECLSPEC_HIDDEN; -void hlsl_report_message(const char *filename, DWORD line, DWORD column, +void WINAPIV hlsl_message(const char *fmt, ...) PRINTF_ATTR(1,2) DECLSPEC_HIDDEN; +void WINAPIV hlsl_report_message(const char *filename, DWORD line, DWORD column, enum hlsl_error_level level, const char *fmt, ...) PRINTF_ATTR(5,6) DECLSPEC_HIDDEN; -static inline struct hlsl_ir_var *var_from_node(const struct hlsl_ir_node *node) -{ - assert(node->type == HLSL_IR_VAR); - return CONTAINING_RECORD(node, struct hlsl_ir_var, node); -} - static inline struct hlsl_ir_expr *expr_from_node(const struct hlsl_ir_node *node) { assert(node->type == HLSL_IR_EXPR); @@ -1134,28 +1136,6 @@ struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **ope struct source_location *loc) DECLSPEC_HIDDEN; struct hlsl_ir_expr *new_cast(struct hlsl_ir_node *node, struct hlsl_type *type, struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_mul(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_div(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_mod(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_lt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_gt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_le(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_ge(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_eq(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; -struct hlsl_ir_expr *hlsl_ne(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) DECLSPEC_HIDDEN; struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var) DECLSPEC_HIDDEN; struct hlsl_ir_deref *new_record_deref(struct hlsl_ir_node *record, struct hlsl_struct_field *field) DECLSPEC_HIDDEN; struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assign_op assign_op, @@ -1178,6 +1158,19 @@ void free_instr(struct hlsl_ir_node *node) DECLSPEC_HIDDEN; void free_instr_list(struct list *list) DECLSPEC_HIDDEN; void free_function_rb(struct wine_rb_entry *entry, void *context) DECLSPEC_HIDDEN; +static inline struct hlsl_ir_node *new_unary_expr(enum hlsl_ir_expr_op op, + struct hlsl_ir_node *op1, struct source_location loc) +{ + struct hlsl_ir_node *operands[3] = {op1}; + return &new_expr(op, operands, &loc)->node; +} + +static inline struct hlsl_ir_node *new_binary_expr(enum hlsl_ir_expr_op op, + struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location loc) +{ + struct hlsl_ir_node *operands[3] = {op1, op2}; + return &new_expr(op, operands, &loc)->node; +} #define MAKE_TAG(ch0, ch1, ch2, ch3) \ ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \ diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.l b/dll/directx/wine/d3dcompiler_43/hlsl.l index f40e3c9a049..2994c7dea62 100644 --- a/dll/directx/wine/d3dcompiler_43/hlsl.l +++ b/dll/directx/wine/d3dcompiler_43/hlsl.l @@ -20,8 +20,6 @@ */ %{ -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #define YY_NO_UNISTD_H diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.tab.c b/dll/directx/wine/d3dcompiler_43/hlsl.tab.c index 465416c053a..d84de231ea7 100644 --- a/dll/directx/wine/d3dcompiler_43/hlsl.tab.c +++ b/dll/directx/wine/d3dcompiler_43/hlsl.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -70,10 +74,9 @@ #define yychar hlsl_char #define yylloc hlsl_lloc -/* Copy the first part of user declarations. */ -#line 21 "hlsl.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 21 "hlsl.y" -#include "config.h" #include "wine/debug.h" #include @@ -89,13 +92,13 @@ struct hlsl_parse_ctx hlsl_ctx; struct YYLTYPE; static void set_location(struct source_location *loc, const struct YYLTYPE *l); -void hlsl_message(const char *fmt, ...) +void WINAPIV hlsl_message(const char *fmt, ...) { - va_list args; + __ms_va_list args; - va_start(args, fmt); + __ms_va_start(args, fmt); compilation_message(&hlsl_ctx.messages, fmt, args); - va_end(args); + __ms_va_end(args); } static const char *hlsl_get_error_level_name(enum hlsl_error_level level) @@ -109,18 +112,18 @@ static const char *hlsl_get_error_level_name(enum hlsl_error_level level) return names[level]; } -void hlsl_report_message(const char *filename, DWORD line, DWORD column, +void WINAPIV hlsl_report_message(const char *filename, DWORD line, DWORD column, enum hlsl_error_level level, const char *fmt, ...) { - va_list args; + __ms_va_list args; char *string = NULL; int rc, size = 0; while (1) { - va_start(args, fmt); + __ms_va_start(args, fmt); rc = vsnprintf(string, size, fmt, args); - va_end(args); + __ms_va_end(args); if (rc >= 0 && rc < size) break; @@ -177,7 +180,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) BOOL ret; TRACE("Declaring variable %s.\n", decl->name); - if (decl->node.data_type->type == HLSL_CLASS_MATRIX) + if (decl->data_type->type == HLSL_CLASS_MATRIX) { if (!(decl->modifiers & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR))) { @@ -186,7 +189,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) } } else - check_invalid_matrix_modifiers(decl->modifiers, &decl->node.loc); + check_invalid_matrix_modifiers(decl->modifiers, &decl->loc); if (local) { @@ -194,12 +197,12 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) | HLSL_STORAGE_GROUPSHARED | HLSL_STORAGE_UNIFORM); if (invalid) { - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "modifier '%s' invalid for local variables", debug_modifiers(invalid)); } if (decl->semantic) { - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "semantics are not allowed on local variables"); return FALSE; } @@ -208,7 +211,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) { if (find_function(decl->name)) { - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "redefinition of '%s'", decl->name); return FALSE; } @@ -218,9 +221,9 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) { struct hlsl_ir_var *old = get_variable(hlsl_ctx.cur_scope, decl->name); - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "\"%s\" already declared", decl->name); - hlsl_report_message(old->node.loc.file, old->node.loc.line, old->node.loc.col, HLSL_LEVEL_NOTE, + hlsl_report_message(old->loc.file, old->loc.line, old->loc.col, HLSL_LEVEL_NOTE, "\"%s\" was previously declared here", old->name); return FALSE; } @@ -312,9 +315,8 @@ static void declare_predefined_types(struct hlsl_scope *scope) static struct hlsl_ir_if *loop_condition(struct list *cond_list) { + struct hlsl_ir_node *cond, *not_cond; struct hlsl_ir_if *out_cond; - struct hlsl_ir_expr *not_cond; - struct hlsl_ir_node *cond, *operands[3]; struct hlsl_ir_jump *jump; unsigned int count = list_count(cond_list); @@ -331,16 +333,13 @@ static struct hlsl_ir_if *loop_condition(struct list *cond_list) return NULL; } out_cond->node.type = HLSL_IR_IF; - operands[0] = cond; - operands[1] = operands[2] = NULL; - not_cond = new_expr(HLSL_IR_UNOP_LOGIC_NOT, operands, &cond->loc); - if (!not_cond) + if (!(not_cond = new_unary_expr(HLSL_IR_UNOP_LOGIC_NOT, cond, cond->loc))) { ERR("Out of memory.\n"); d3dcompiler_free(out_cond); return NULL; } - out_cond->condition = ¬_cond->node; + out_cond->condition = not_cond; jump = d3dcompiler_alloc(sizeof(*jump)); if (!jump) { @@ -433,29 +432,24 @@ oom: return NULL; } -static unsigned int initializer_size(struct list *initializer) +static unsigned int initializer_size(const struct parse_initializer *initializer) { - unsigned int count = 0; - struct hlsl_ir_node *node; + unsigned int count = 0, i; - LIST_FOR_EACH_ENTRY(node, initializer, struct hlsl_ir_node, entry) + for (i = 0; i < initializer->args_count; ++i) { - count += components_count_type(node->data_type); + count += components_count_type(initializer->args[i]->data_type); } - TRACE("Initializer size = %u\n", count); + TRACE("Initializer size = %u.\n", count); return count; } -static unsigned int components_count_expr_list(struct list *list) +static void free_parse_initializer(struct parse_initializer *initializer) { - struct hlsl_ir_node *node; - unsigned int count = 0; - - LIST_FOR_EACH_ENTRY(node, list, struct hlsl_ir_node, entry) - { - count += components_count_type(node->data_type); - } - return count; + unsigned int i; + for (i = 0; i < initializer->args_count; ++i) + free_instr(initializer->args[i]); + d3dcompiler_free(initializer->args); } static struct hlsl_ir_swizzle *new_swizzle(DWORD s, unsigned int components, @@ -555,35 +549,35 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha return NULL; } -static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, struct list *initializer) +static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, + struct parse_initializer *initializer) { - struct hlsl_type *type = var->node.data_type; - struct hlsl_ir_node *node; + struct hlsl_type *type = var->data_type; struct hlsl_struct_field *field; - struct list *cur_node; struct hlsl_ir_node *assignment; struct hlsl_ir_deref *deref; + unsigned int i = 0; if (initializer_size(initializer) != components_count_type(type)) { - hlsl_report_message(var->node.loc.file, var->node.loc.line, var->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(var->loc.file, var->loc.line, var->loc.col, HLSL_LEVEL_ERROR, "structure initializer mismatch"); - free_instr_list(initializer); + free_parse_initializer(initializer); return; } - cur_node = list_head(initializer); - assert(cur_node); - node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry); + LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry) { - if (!cur_node) + struct hlsl_ir_node *node = initializer->args[i]; + + if (i++ >= initializer->args_count) { - d3dcompiler_free(initializer); + d3dcompiler_free(initializer->args); return; } if (components_count_type(field->type) == components_count_type(node->data_type)) { - deref = new_record_deref(&var->node, field); + deref = new_record_deref(&new_var_deref(var)->node, field); if (!deref) { ERR("Out of memory.\n"); @@ -595,19 +589,12 @@ static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, s } else FIXME("Initializing with \"mismatched\" fields is not supported yet.\n"); - cur_node = list_next(initializer, cur_node); - node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry); } /* Free initializer elements in excess. */ - while (cur_node) - { - struct list *next = list_next(initializer, cur_node); - free_instr(node); - cur_node = next; - node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry); - } - d3dcompiler_free(initializer); + for (; i < initializer->args_count; ++i) + free_instr(initializer->args[i]); + d3dcompiler_free(initializer->args); } static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, struct list *var_list) @@ -641,13 +628,12 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, d3dcompiler_free(v); continue; } - var->node.type = HLSL_IR_VAR; if (v->array_size) type = new_array_type(basic_type, v->array_size); else type = basic_type; - var->node.data_type = type; - var->node.loc = v->loc; + var->data_type = type; + var->loc = v->loc; var->name = v->name; var->modifiers = modifiers; var->semantic = v->semantic; @@ -660,7 +646,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, local = FALSE; } - if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer) + if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer.args_count) { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "const variable without initializer"); @@ -678,10 +664,9 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, } TRACE("Declared variable %s.\n", var->name); - if (v->initializer) + if (v->initializer.args_count) { - unsigned int size = initializer_size(v->initializer); - struct hlsl_ir_node *node; + unsigned int size = initializer_size(&v->initializer); TRACE("Variable with initializer.\n"); if (type->type <= HLSL_CLASS_LAST_NUMERIC @@ -691,7 +676,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "'%s' initializer does not match", v->name); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } @@ -701,43 +686,43 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "'%s' initializer does not match", v->name); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } if (type->type == HLSL_CLASS_STRUCT) { - struct_var_initializer(statements_list, var, v->initializer); + struct_var_initializer(statements_list, var, &v->initializer); d3dcompiler_free(v); continue; } if (type->type > HLSL_CLASS_LAST_NUMERIC) { FIXME("Initializers for non scalar/struct variables not supported yet.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } if (v->array_size > 0) { FIXME("Initializing arrays is not supported yet.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } - if (list_count(v->initializer) > 1) + if (v->initializer.args_count > 1) { FIXME("Complex initializers are not supported yet.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } - node = LIST_ENTRY(list_head(v->initializer), struct hlsl_ir_node, entry); - assignment = make_assignment(&var->node, ASSIGN_OP_ASSIGN, - BWRITERSP_WRITEMASK_ALL, node); + + assignment = make_assignment(&new_var_deref(var)->node, ASSIGN_OP_ASSIGN, + BWRITERSP_WRITEMASK_ALL, v->initializer.args[0]); + d3dcompiler_free(v->initializer.args); list_add_tail(statements_list, &assignment->entry); - d3dcompiler_free(v->initializer); } d3dcompiler_free(v); } @@ -785,11 +770,11 @@ static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, s field->name = v->name; field->modifiers = modifiers; field->semantic = v->semantic; - if (v->initializer) + if (v->initializer.args_count) { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "struct field with an initializer.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); } list_add_tail(list, &field->entry); d3dcompiler_free(v); @@ -872,9 +857,8 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param, ERR("Out of memory.\n"); return FALSE; } - decl->node.type = HLSL_IR_VAR; - decl->node.data_type = param->type; - decl->node.loc = *loc; + decl->data_type = param->type; + decl->loc = *loc; decl->name = param->name; decl->semantic = param->semantic; decl->reg_reservation = param->reg_reservation; @@ -885,7 +869,7 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param, free_declaration(decl); return FALSE; } - list_add_tail(list, &decl->node.entry); + list_add_tail(list, &decl->param_entry); return TRUE; } @@ -955,13 +939,17 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr } -#line 959 "hlsl.tab.c" /* yacc.c:339 */ +#line 943 "hlsl.tab.c" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULL 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -973,8 +961,8 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "hlsl.tab.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED # define YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED /* Debug traces. */ @@ -1097,10 +1085,9 @@ extern int hlsl_debug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 910 "hlsl.y" /* yacc.c:355 */ +#line 890 "hlsl.y" struct hlsl_type *type; INT intval; @@ -1108,11 +1095,11 @@ union YYSTYPE BOOL boolval; char *name; DWORD modifiers; - struct hlsl_ir_var *var; struct hlsl_ir_node *instr; struct list *list; struct parse_function function; struct parse_parameter parameter; + struct parse_initializer initializer; struct parse_variable_def *variable_def; struct parse_if_body if_body; enum parse_unary_op unary_op; @@ -1120,8 +1107,10 @@ union YYSTYPE struct reg_reservation *reg_reservation; struct parse_colon_attribute colon_attribute; -#line 1124 "hlsl.tab.c" /* yacc.c:355 */ +#line 1111 "hlsl.tab.c" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -1147,9 +1136,7 @@ int hlsl_parse (void); #endif /* !YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 1153 "hlsl.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -1170,13 +1157,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -1188,7 +1175,7 @@ typedef short int yytype_int16; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -1206,14 +1193,24 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -1221,7 +1218,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -1241,6 +1238,8 @@ typedef short int yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -1374,27 +1373,27 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 821 +#define YYLAST 820 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 129 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 65 +#define YYNNTS 64 /* YYNRULES -- Number of rules. */ -#define YYNRULES 175 +#define YYNRULES 174 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 321 +#define YYNSTATES 320 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 359 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1439,24 +1438,24 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 1095, 1095, 1097, 1134, 1138, 1141, 1146, 1168, 1185, - 1186, 1188, 1214, 1224, 1225, 1226, 1229, 1233, 1252, 1256, - 1261, 1268, 1275, 1305, 1310, 1317, 1321, 1322, 1325, 1329, - 1334, 1340, 1346, 1351, 1360, 1365, 1370, 1384, 1398, 1409, - 1412, 1423, 1427, 1431, 1436, 1440, 1459, 1479, 1483, 1488, - 1493, 1498, 1503, 1508, 1516, 1534, 1535, 1536, 1547, 1555, - 1564, 1570, 1576, 1584, 1590, 1593, 1598, 1604, 1610, 1619, - 1632, 1635, 1643, 1646, 1650, 1654, 1658, 1662, 1666, 1670, - 1674, 1678, 1682, 1686, 1691, 1697, 1701, 1706, 1711, 1717, - 1723, 1727, 1732, 1736, 1743, 1744, 1745, 1746, 1747, 1748, - 1751, 1774, 1798, 1803, 1809, 1824, 1839, 1847, 1859, 1864, - 1872, 1886, 1900, 1914, 1925, 1930, 1944, 1948, 1967, 1986, - 2040, 2100, 2136, 2140, 2156, 2172, 2192, 2224, 2228, 2232, - 2236, 2241, 2245, 2252, 2259, 2267, 2271, 2278, 2286, 2290, - 2294, 2299, 2303, 2310, 2317, 2324, 2332, 2336, 2343, 2351, - 2355, 2360, 2364, 2369, 2373, 2378, 2382, 2387, 2391, 2396, - 2400, 2405, 2409, 2426, 2430, 2434, 2438, 2442, 2446, 2450, - 2454, 2458, 2462, 2466, 2471, 2475 + 0, 1074, 1074, 1076, 1113, 1117, 1120, 1125, 1147, 1164, + 1165, 1167, 1193, 1203, 1204, 1205, 1208, 1212, 1231, 1235, + 1240, 1247, 1254, 1284, 1289, 1296, 1300, 1301, 1304, 1308, + 1313, 1319, 1325, 1330, 1339, 1344, 1349, 1363, 1377, 1388, + 1391, 1402, 1406, 1410, 1415, 1419, 1438, 1458, 1462, 1467, + 1472, 1477, 1482, 1487, 1495, 1513, 1514, 1515, 1526, 1534, + 1543, 1549, 1555, 1563, 1569, 1572, 1577, 1583, 1589, 1598, + 1611, 1614, 1622, 1625, 1629, 1633, 1637, 1641, 1645, 1649, + 1653, 1657, 1661, 1665, 1670, 1677, 1681, 1686, 1691, 1698, + 1706, 1710, 1715, 1719, 1726, 1727, 1728, 1729, 1730, 1731, + 1734, 1757, 1781, 1786, 1792, 1807, 1822, 1830, 1842, 1847, + 1855, 1869, 1883, 1897, 1917, 1922, 1926, 1942, 1958, 2012, + 2072, 2110, 2114, 2127, 2140, 2157, 2189, 2193, 2197, 2201, + 2206, 2210, 2217, 2224, 2232, 2236, 2243, 2251, 2255, 2259, + 2264, 2268, 2275, 2282, 2289, 2297, 2301, 2308, 2316, 2320, + 2325, 2329, 2334, 2338, 2343, 2347, 2352, 2356, 2361, 2365, + 2370, 2374, 2391, 2395, 2399, 2403, 2407, 2411, 2415, 2419, + 2423, 2427, 2431, 2436, 2440 }; #endif @@ -1503,11 +1502,11 @@ static const char *const yytname[] = "complex_initializer", "initializer_expr", "initializer_expr_list", "boolean", "statement_list", "statement", "jump_statement", "selection_statement", "if_body", "loop_statement", "expr_statement", - "primary_expr", "variable", "postfix_expr", "unary_expr", "unary_op", - "mul_expr", "add_expr", "shift_expr", "relational_expr", "equality_expr", + "primary_expr", "postfix_expr", "unary_expr", "unary_op", "mul_expr", + "add_expr", "shift_expr", "relational_expr", "equality_expr", "bitand_expr", "bitxor_expr", "bitor_expr", "logicand_expr", "logicor_expr", "conditional_expr", "assignment_expr", "assign_op", - "expr", YY_NULL + "expr", YY_NULLPTR }; #endif @@ -1532,10 +1531,10 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -237 +#define YYPACT_NINF -228 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-237))) + (!!((Yystate) == (-228))) #define YYTABLE_NINF -35 @@ -1546,39 +1545,38 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -237, 674, -237, 750, 750, 750, 750, 750, 750, 750, - 750, 750, 750, 750, 750, -50, -237, -237, -237, 100, - -237, -237, -237, -78, -237, -237, -237, 39, -237, -237, - -237, -237, -237, -237, -237, -237, -237, 100, 39, -237, - -237, -237, -237, -237, -237, -54, 0, -42, -237, -237, - 3, -237, -10, -237, -237, -237, -237, -237, 13, 6, - -237, -237, 121, -237, -54, -5, -237, 100, 613, 5, - -237, 100, -237, 354, 134, 18, -237, 30, 134, 36, - 70, 115, 15, -237, -237, 100, 17, -237, -237, 613, - 613, -237, -237, -237, 613, -237, -237, -237, -237, 258, - -237, -237, -237, -16, 138, 613, 116, -34, -37, -49, - -38, 64, 106, 67, 161, -55, -237, -237, -57, -3, - 130, -237, -237, -237, 354, 153, 168, 613, 174, -237, - -237, -237, 39, 246, -237, -237, -237, -237, -237, 20, - 156, 137, 23, -237, 158, -237, -237, -237, -237, -237, - -237, 258, 81, 177, -237, -237, 613, 100, -237, -237, - -237, -237, -237, -237, -237, -237, -237, -237, -237, 613, - -237, 613, 613, 613, 613, 613, 613, 613, 613, 613, - 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, - 613, -237, 178, -237, 433, 215, -237, 613, 22, 613, - -63, -237, -237, -237, -237, 184, -237, 100, -237, 366, - 170, 185, 181, 183, -62, -237, 613, -8, -237, -237, - -237, -237, -237, -237, 116, 116, -34, -34, -37, -37, - -37, -37, -49, -49, -38, 64, 106, 67, 161, 60, - -237, 100, 613, -237, -237, -237, 187, 473, 86, -237, - 99, 182, 24, -44, 100, -237, 188, 191, -237, 721, - 5, 194, -237, 124, -237, 613, 136, -19, 613, 473, - 258, 473, 354, 354, 200, -237, 29, -237, -237, -237, - -237, -237, -237, 258, -237, 613, -237, 613, -237, -237, - 100, -237, 552, 140, 613, 613, 289, -237, -237, 193, - -237, -237, 100, -237, -237, 198, -237, 205, 148, 164, - 354, -237, 5, -237, -237, 354, 354, -237, -237, -237, - -237 + -228, 673, -228, 749, 749, 749, 749, 749, 749, 749, + 749, 749, 749, 749, 749, -66, -228, -228, -228, 80, + -228, -228, -228, 107, -228, -228, -228, 38, -228, -228, + -228, -228, -228, -228, -228, -228, -228, 80, 38, -228, + -228, -228, -228, -228, -228, -64, -51, -72, -228, -228, + -44, -228, -29, -228, -228, -228, -228, -228, 24, -20, + -228, -228, 83, -228, -64, -55, -228, 80, 612, 33, + -228, 80, -228, 353, 5, 1, -228, 8, 5, 77, + 92, 95, -10, -228, -228, 80, 4, -228, -228, 612, + 612, -228, -228, -228, 612, -228, -228, -228, -228, 257, + -228, -228, -15, 137, 612, 97, 70, -54, 86, -24, + 118, 96, 129, 175, -58, -228, -228, -76, -3, 141, + -228, -228, -228, 353, 150, 152, 612, 160, -228, -228, + -228, 38, 245, -228, -228, -228, -228, -228, 21, 172, + 167, 20, -228, 168, -228, -228, -228, -228, -228, -228, + 257, -38, 173, -228, -228, 612, 80, -228, -228, -228, + -228, -228, -228, -228, -228, -228, -228, -228, 612, -228, + 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, + 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, + -228, 178, -228, 432, 215, -228, 612, 23, 612, 11, + -228, -228, -228, -228, 184, -228, 80, -228, 365, 169, + 185, 182, 183, -85, -228, 612, -12, -228, -228, -228, + -228, -228, -228, 97, 97, 70, 70, -54, -54, -54, + -54, 86, 86, -24, 118, 96, 129, 175, 128, -228, + 80, 612, -228, -228, -228, 186, 472, 82, -228, 85, + 189, 28, 29, 80, -228, 188, 191, -228, 720, 33, + 194, -228, 98, -228, 612, 122, 10, 612, 472, 257, + 472, 353, 353, 200, -228, 66, -228, -228, -228, -228, + -228, -228, 257, -228, 612, -228, 612, -228, -228, 80, + -228, 551, 123, 612, 612, 289, -228, -228, 193, -228, + -228, 80, -228, -228, 206, -228, 204, 126, 135, 353, + -228, 33, -228, -228, 353, 353, -228, -228, -228, -228 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1595,54 +1593,53 @@ static const yytype_uint8 yydefact[] = 47, 53, 0, 44, 70, 0, 60, 0, 72, 28, 8, 0, 23, 72, 0, 54, 16, 0, 0, 13, 15, 0, 0, 62, 59, 0, 0, 91, 90, 72, - 72, 115, 110, 111, 72, 127, 128, 129, 130, 0, - 112, 116, 113, 122, 131, 72, 135, 138, 141, 146, - 149, 151, 153, 155, 157, 159, 161, 174, 0, 0, - 68, 29, 30, 67, 72, 0, 0, 72, 0, 108, - 96, 94, 0, 72, 92, 97, 98, 99, 95, 0, - 0, 0, 72, 16, 0, 25, 63, 61, 58, 123, - 124, 0, 0, 0, 117, 118, 72, 0, 169, 170, - 164, 165, 166, 167, 168, 171, 172, 173, 163, 72, - 125, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 113, 110, 111, 72, 126, 127, 128, 129, 0, + 112, 115, 121, 130, 72, 134, 137, 140, 145, 148, + 150, 152, 154, 156, 158, 160, 173, 0, 0, 68, + 29, 30, 67, 72, 0, 0, 72, 0, 108, 96, + 94, 0, 72, 92, 97, 98, 99, 95, 0, 0, + 0, 72, 16, 0, 25, 63, 61, 58, 122, 123, + 0, 0, 0, 116, 117, 72, 0, 168, 169, 163, + 164, 165, 166, 167, 170, 171, 172, 162, 72, 124, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 72, 71, 0, 31, 72, 0, 25, 72, 0, 72, - 0, 24, 93, 109, 54, 0, 12, 0, 17, 0, - 72, 0, 39, 0, 70, 114, 72, 0, 119, 162, - 132, 133, 134, 131, 136, 137, 139, 140, 144, 145, - 142, 143, 147, 148, 150, 152, 154, 156, 158, 0, - 175, 0, 72, 69, 84, 87, 0, 72, 0, 100, - 0, 0, 0, 0, 0, 11, 0, 35, 36, 72, - 28, 0, 88, 0, 120, 72, 0, 0, 72, 72, - 0, 72, 72, 72, 0, 19, 0, 45, 39, 41, - 43, 42, 40, 0, 22, 72, 121, 72, 160, 32, - 0, 85, 72, 0, 72, 72, 102, 101, 104, 0, - 18, 37, 0, 126, 89, 0, 86, 0, 0, 0, - 72, 46, 28, 33, 105, 72, 72, 103, 38, 107, - 106 + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 71, 0, 31, 72, 0, 25, 72, 0, 72, 0, + 24, 93, 109, 54, 0, 12, 0, 17, 0, 72, + 0, 39, 0, 70, 114, 72, 0, 118, 161, 131, + 132, 133, 130, 135, 136, 138, 139, 143, 144, 141, + 142, 146, 147, 149, 151, 153, 155, 157, 0, 174, + 0, 72, 69, 84, 87, 0, 72, 0, 100, 0, + 0, 0, 0, 0, 11, 0, 35, 36, 72, 28, + 0, 88, 0, 119, 72, 0, 0, 72, 72, 0, + 72, 72, 72, 0, 19, 0, 45, 39, 41, 43, + 42, 40, 0, 22, 72, 120, 72, 159, 32, 0, + 85, 72, 0, 72, 72, 102, 101, 104, 0, 18, + 37, 0, 125, 89, 0, 86, 0, 0, 0, 72, + 46, 28, 33, 105, 72, 72, 103, 38, 107, 106 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -237, -237, -237, -237, 304, -237, -123, -36, 179, -237, - -237, -237, 298, -122, -237, -236, -237, -237, -237, -237, - 45, -237, -237, -13, 68, 323, -237, 260, 240, 82, - -237, -4, 259, -47, -1, -237, -176, 89, -237, -237, - -104, -237, -237, -237, -237, -221, -237, -237, -237, -23, - -237, 11, 37, 2, 97, 149, 147, 150, 151, 146, - -237, -237, -99, -237, -52 + -228, -228, -228, -228, 308, -228, -120, -36, 179, -228, + -228, -228, 299, -110, -228, -227, -228, -228, -228, -228, + 46, -228, -228, -13, 67, 323, -228, 259, 243, 84, + -228, -4, 258, -47, -1, -228, -173, 90, -228, -228, + -104, -228, -228, -228, -228, -208, -228, -228, -23, -228, + 74, 99, -5, 103, 149, 151, 148, 153, 147, -228, + -228, -99, -228, -52 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 17, 18, 19, 20, 21, 45, 142, 208, - 22, 23, 130, 73, 81, 120, 121, 122, 213, 257, - 258, 259, 282, 200, 63, 131, 25, 65, 66, 26, - 46, 82, 48, 69, 99, 243, 262, 263, 100, 133, - 134, 135, 136, 297, 137, 138, 101, 102, 103, 104, + -1, 1, 17, 18, 19, 20, 21, 45, 141, 207, + 22, 23, 129, 73, 81, 119, 120, 121, 212, 256, + 257, 258, 281, 199, 63, 130, 25, 65, 66, 26, + 46, 82, 48, 69, 99, 242, 261, 262, 100, 132, + 133, 134, 135, 296, 136, 137, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 169, 139 + 115, 116, 168, 138 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1651,175 +1648,175 @@ static const yytype_int16 yydefgoto[] = static const yytype_int16 yytable[] = { 27, 64, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 38, 39, 40, 62, 47, 118, 83, 244, 207, - 195, 188, 77, 212, 284, 67, 271, 49, 50, 202, - 3, 64, 4, 192, 178, 179, 42, 43, 44, 182, - 5, 176, 152, 177, 6, 216, 216, 183, 294, 64, - 295, 7, 41, 68, 190, 8, 204, 154, 155, 191, - 9, 68, 76, 180, 181, 52, 149, 150, 10, 71, - 219, 11, 132, 189, 247, 198, 318, 53, 54, 55, - 56, 57, 170, 193, 174, 175, 153, 207, 291, 58, - 13, 240, 292, 151, 14, 245, 42, 43, 44, 156, - 84, 157, 74, 190, 217, 70, 85, 59, 264, 60, - 72, 304, 42, 75, 44, 119, 304, 245, 78, 76, - 146, 218, 148, 132, -14, 203, 71, 249, 85, 275, - 206, 190, 132, 190, 300, 71, 143, 239, 214, 61, - 71, 209, 141, 245, -26, 248, 144, 250, 220, 221, - 222, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 288, 261, 296, 298, - 265, 190, 53, 54, 55, 56, 57, 3, -27, 4, - 228, 229, 230, 231, 140, 224, 225, 5, 245, 184, - 215, 6, 190, 245, 186, 272, 254, 190, 7, 42, - 43, 44, 8, 252, 60, 266, 317, 9, 273, 209, - 190, 319, 320, 226, 227, 10, 293, 158, 11, 159, - 79, 43, 80, 145, 160, 161, 162, 163, 164, 165, - 166, 167, 185, 286, 61, 287, 187, 13, 171, 172, - 173, 14, 308, 309, 194, 289, 270, 290, 205, 307, - 276, 190, 168, 3, 305, 4, 204, 315, 283, 190, - 124, 196, 303, 5, 87, 125, 312, 6, 126, 211, - 302, 132, 132, 316, 7, 190, 197, 255, 8, 232, - 233, 127, 199, 9, 52, 216, 241, 246, 251, 256, - -34, 10, 260, 274, 11, 268, 53, 54, 55, 56, - 57, 277, 278, 285, 299, 310, 311, 313, 140, 132, - 314, 88, 12, 13, 132, 132, 37, 14, 128, 89, - 90, 51, 210, 301, 24, 147, 59, 86, 60, 269, - 123, 267, 235, 234, 238, 0, 236, 0, 237, 0, - 0, 0, 0, 0, 0, 91, 0, 0, 0, 92, - 93, 129, 50, 201, 94, 0, 0, 0, 61, 0, - 0, 3, 0, 4, 95, 96, 97, 98, 124, 0, - 0, 5, 87, 125, 0, 6, 126, 0, 0, 0, - 0, 0, 7, 0, 0, 0, 8, 0, 0, 127, - 0, 9, 52, 0, 0, 0, 0, 0, 0, 10, - 0, 0, 11, 0, 53, 54, 55, 56, 57, 0, - 0, 0, 0, 0, 0, 0, 253, 0, 0, 88, - 12, 13, 0, 0, 0, 14, 128, 89, 90, 0, - 0, 0, 0, 0, 59, 0, 60, 0, 0, 0, - 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, - 5, 87, 0, 91, 6, 0, 0, 92, 93, 129, - 50, 7, 94, 0, 0, 8, 61, 0, 0, 0, - 9, 0, 95, 96, 97, 98, 0, 0, 10, 0, - 3, 11, 4, 0, 0, 0, 0, 0, 0, 0, - 5, 87, 0, 0, 6, 0, 0, 0, 88, 0, - 13, 7, 0, 0, 14, 8, 89, 90, 0, 0, - 9, 0, 0, 0, 0, 0, 0, 0, 10, 0, - 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 91, 0, 0, 0, 92, 93, 88, 242, - 13, 94, 0, 0, 14, 0, 89, 90, 0, 0, - 0, 95, 96, 97, 98, 0, 0, 0, 0, 3, + 36, 38, 39, 40, 62, 47, 117, 83, 187, 194, + 243, 206, 77, 215, 175, 67, 176, 3, 201, 4, + 68, 64, 283, 191, 211, 189, 41, 5, 270, 71, + 190, 6, 151, 53, 54, 55, 56, 57, 7, 64, + 84, 68, 8, 181, 70, 139, 85, 9, 153, 154, + 293, 182, 294, 72, 52, 10, 148, 149, 11, 218, + 188, 214, 131, 189, 197, 60, 53, 54, 55, 56, + 57, 169, 192, 74, 317, 246, 152, 13, 58, 206, + 239, 14, 78, 150, 244, 145, 42, 43, 44, 189, + 155, 71, 156, 216, 263, 61, 59, -14, 60, 147, + 42, 43, 44, 303, 142, 85, 244, 290, 303, 215, + 217, 291, 131, 42, 75, 44, 202, 205, 248, 203, + 76, 131, 189, 274, 189, 76, 238, 213, 61, 71, + 208, 140, 244, 118, 247, 143, 249, 219, 220, 221, + 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 287, 260, 295, 297, 177, + 178, 299, 227, 228, 229, 230, 3, 71, 4, 42, + 43, 44, 79, 43, 80, -26, 5, 244, 173, 174, + 6, 271, 244, 189, 272, 253, 189, 7, 179, 180, + -27, 8, 251, 144, 265, 316, 9, 285, 208, 286, + 318, 319, 49, 50, 10, 292, 157, 11, 158, 170, + 171, 172, 184, 159, 160, 161, 162, 163, 164, 165, + 166, 288, 306, 289, 189, 314, 13, 189, 264, 189, + 14, 307, 308, 183, 315, 269, 189, 223, 224, 275, + 186, 167, 3, 304, 4, 193, 185, 282, 195, 123, + 196, 302, 5, 87, 124, 311, 6, 125, 198, 301, + 131, 131, 203, 7, 225, 226, 254, 8, 204, 210, + 126, 215, 9, 52, 231, 232, 240, 245, 250, 255, + 10, -34, 259, 11, 267, 53, 54, 55, 56, 57, + 273, 276, 277, 284, 298, 309, 310, 139, 131, 313, + 88, 12, 13, 131, 131, 312, 14, 127, 89, 90, + 37, 209, 51, 300, 24, 59, 86, 60, 146, 122, + 268, 266, 233, 235, 237, 234, 0, 0, 0, 236, + 0, 0, 0, 0, 91, 0, 0, 0, 92, 93, + 128, 50, 200, 94, 0, 0, 0, 61, 0, 0, + 3, 0, 4, 95, 96, 97, 98, 123, 0, 0, + 5, 87, 124, 0, 6, 125, 0, 0, 0, 0, + 0, 7, 0, 0, 0, 8, 0, 0, 126, 0, + 9, 52, 0, 0, 0, 0, 0, 0, 10, 0, + 0, 11, 0, 53, 54, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 0, 252, 0, 0, 88, 12, + 13, 0, 0, 0, 14, 127, 89, 90, 0, 0, + 0, 0, 0, 59, 0, 60, 0, 0, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, - 87, 0, 91, 6, 0, 0, 92, 93, 129, 0, - 7, 94, 0, 0, 8, 0, 0, 0, 0, 9, - 0, 95, 96, 97, 98, 0, 0, 10, 0, 0, + 87, 0, 91, 6, 0, 0, 92, 93, 128, 50, + 7, 94, 0, 0, 8, 61, 0, 0, 0, 9, + 0, 95, 96, 97, 98, 0, 0, 10, 0, 3, + 11, 4, 0, 0, 0, 0, 0, 0, 0, 5, + 87, 0, 0, 6, 0, 0, 0, 88, 0, 13, + 7, 0, 0, 14, 8, 89, 90, 0, 0, 9, + 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 88, 0, 13, - 3, 0, 4, 14, 0, 89, 90, 0, 0, 0, - 5, 87, 0, 0, 6, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, - 9, 91, 0, 0, 0, 92, 93, 0, 10, 306, - 94, 11, 0, 0, 0, 0, 0, 0, 0, 0, - 95, 96, 97, 98, 2, 0, 0, 0, 88, 0, - 13, 3, 0, 4, 14, 0, 89, 90, 0, 0, - 0, 5, 0, 0, 0, 6, 0, 0, 0, 0, - 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, - 0, 9, 91, 0, 0, 0, 92, 93, 0, 10, - 0, 94, 11, 0, 0, 0, 0, 0, 3, 0, - 4, 95, 96, 97, 98, 0, 0, 0, 5, 0, - 12, 13, 6, 0, 279, 14, 280, 0, 0, 7, - 281, 0, 0, 8, 0, 0, 0, 3, 9, 4, - 0, 0, 0, 0, 0, 0, 10, 5, 0, 11, - 0, 6, 15, 0, 0, 0, 0, 0, 7, 16, - 0, 0, 8, 0, 0, 0, 0, 9, 13, 0, - 0, 0, 14, 0, 0, 10, 0, 0, 11, 0, + 0, 91, 0, 0, 0, 92, 93, 88, 241, 13, + 94, 0, 0, 14, 0, 89, 90, 0, 0, 0, + 95, 96, 97, 98, 0, 0, 0, 0, 3, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 5, 87, + 0, 91, 6, 0, 0, 92, 93, 128, 0, 7, + 94, 0, 0, 8, 0, 0, 0, 0, 9, 0, + 95, 96, 97, 98, 0, 0, 10, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, - 0, 14 + 0, 0, 0, 0, 0, 0, 88, 0, 13, 3, + 0, 4, 14, 0, 89, 90, 0, 0, 0, 5, + 87, 0, 0, 6, 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 8, 0, 0, 0, 0, 9, + 91, 0, 0, 0, 92, 93, 0, 10, 305, 94, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 95, + 96, 97, 98, 2, 0, 0, 0, 88, 0, 13, + 3, 0, 4, 14, 0, 89, 90, 0, 0, 0, + 5, 0, 0, 0, 6, 0, 0, 0, 0, 0, + 0, 7, 0, 0, 0, 8, 0, 0, 0, 0, + 9, 91, 0, 0, 0, 92, 93, 0, 10, 0, + 94, 11, 0, 0, 0, 0, 0, 3, 0, 4, + 95, 96, 97, 98, 0, 0, 0, 5, 0, 12, + 13, 6, 0, 278, 14, 279, 0, 0, 7, 280, + 0, 0, 8, 0, 0, 0, 3, 9, 4, 0, + 0, 0, 0, 0, 0, 10, 5, 0, 11, 0, + 6, 15, 0, 0, 0, 0, 0, 7, 16, 0, + 0, 8, 0, 0, 0, 0, 9, 13, 0, 0, + 0, 14, 0, 0, 10, 0, 0, 11, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, + 14 }; static const yytype_int16 yycheck[] = { 1, 37, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 27, 19, 68, 64, 194, 142, - 124, 76, 58, 145, 260, 38, 247, 105, 106, 133, - 7, 67, 9, 36, 83, 84, 99, 100, 101, 77, - 17, 78, 94, 80, 21, 108, 108, 85, 269, 85, - 271, 28, 102, 115, 111, 32, 100, 73, 74, 116, - 37, 115, 106, 112, 113, 26, 89, 90, 45, 111, - 169, 48, 73, 128, 196, 127, 312, 38, 39, 40, - 41, 42, 105, 119, 118, 119, 99, 210, 107, 50, - 67, 190, 111, 94, 71, 194, 99, 100, 101, 115, - 105, 117, 112, 111, 156, 105, 111, 68, 116, 70, - 107, 287, 99, 100, 101, 110, 292, 216, 112, 106, - 105, 157, 105, 124, 106, 105, 111, 105, 111, 105, - 107, 111, 133, 111, 105, 111, 106, 189, 151, 100, - 111, 142, 74, 242, 108, 197, 78, 199, 171, 172, + 11, 12, 13, 14, 27, 19, 68, 64, 76, 123, + 193, 141, 58, 108, 78, 38, 80, 7, 132, 9, + 115, 67, 259, 36, 144, 111, 102, 17, 246, 111, + 116, 21, 94, 38, 39, 40, 41, 42, 28, 85, + 105, 115, 32, 77, 105, 50, 111, 37, 73, 74, + 268, 85, 270, 107, 26, 45, 89, 90, 48, 168, + 128, 109, 73, 111, 126, 70, 38, 39, 40, 41, + 42, 104, 118, 112, 311, 195, 99, 67, 50, 209, + 189, 71, 112, 94, 193, 105, 99, 100, 101, 111, + 115, 111, 117, 155, 116, 100, 68, 106, 70, 105, + 99, 100, 101, 286, 106, 111, 215, 107, 291, 108, + 156, 111, 123, 99, 100, 101, 105, 107, 105, 100, + 106, 132, 111, 105, 111, 106, 188, 150, 100, 111, + 141, 74, 241, 110, 196, 78, 198, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 265, 214, 272, 273, - 110, 111, 38, 39, 40, 41, 42, 7, 108, 9, - 178, 179, 180, 181, 50, 174, 175, 17, 287, 125, - 109, 21, 111, 292, 127, 109, 209, 111, 28, 99, - 100, 101, 32, 207, 70, 241, 310, 37, 109, 210, - 111, 315, 316, 176, 177, 45, 268, 79, 48, 81, - 99, 100, 101, 108, 86, 87, 88, 89, 90, 91, - 92, 93, 126, 109, 100, 111, 75, 67, 122, 123, - 124, 71, 294, 295, 114, 109, 247, 111, 111, 109, - 254, 111, 114, 7, 290, 9, 100, 109, 259, 111, - 14, 108, 285, 17, 18, 19, 302, 21, 22, 111, - 283, 272, 273, 109, 28, 111, 108, 107, 32, 182, - 183, 35, 108, 37, 26, 108, 108, 72, 104, 104, - 109, 45, 109, 111, 48, 108, 38, 39, 40, 41, - 42, 113, 111, 109, 104, 16, 113, 109, 50, 310, - 105, 65, 66, 67, 315, 316, 12, 71, 72, 73, - 74, 23, 143, 278, 1, 85, 68, 67, 70, 247, - 71, 242, 185, 184, 188, -1, 186, -1, 187, -1, - -1, -1, -1, -1, -1, 99, -1, -1, -1, 103, - 104, 105, 106, 107, 108, -1, -1, -1, 100, -1, - -1, 7, -1, 9, 118, 119, 120, 121, 14, -1, - -1, 17, 18, 19, -1, 21, 22, -1, -1, -1, - -1, -1, 28, -1, -1, -1, 32, -1, -1, 35, - -1, 37, 26, -1, -1, -1, -1, -1, -1, 45, - -1, -1, 48, -1, 38, 39, 40, 41, 42, -1, - -1, -1, -1, -1, -1, -1, 50, -1, -1, 65, - 66, 67, -1, -1, -1, 71, 72, 73, 74, -1, - -1, -1, -1, -1, 68, -1, 70, -1, -1, -1, - 7, -1, 9, -1, -1, -1, -1, -1, -1, -1, - 17, 18, -1, 99, 21, -1, -1, 103, 104, 105, - 106, 28, 108, -1, -1, 32, 100, -1, -1, -1, - 37, -1, 118, 119, 120, 121, -1, -1, 45, -1, - 7, 48, 9, -1, -1, -1, -1, -1, -1, -1, - 17, 18, -1, -1, 21, -1, -1, -1, 65, -1, - 67, 28, -1, -1, 71, 32, 73, 74, -1, -1, - 37, -1, -1, -1, -1, -1, -1, -1, 45, -1, - -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 99, -1, -1, -1, 103, 104, 65, 106, - 67, 108, -1, -1, 71, -1, 73, 74, -1, -1, - -1, 118, 119, 120, 121, -1, -1, -1, -1, 7, + 183, 184, 185, 186, 187, 264, 213, 271, 272, 83, + 84, 105, 177, 178, 179, 180, 7, 111, 9, 99, + 100, 101, 99, 100, 101, 108, 17, 286, 118, 119, + 21, 109, 291, 111, 109, 208, 111, 28, 112, 113, + 108, 32, 206, 108, 240, 309, 37, 109, 209, 111, + 314, 315, 105, 106, 45, 267, 79, 48, 81, 122, + 123, 124, 126, 86, 87, 88, 89, 90, 91, 92, + 93, 109, 109, 111, 111, 109, 67, 111, 110, 111, + 71, 293, 294, 125, 109, 246, 111, 173, 174, 253, + 75, 114, 7, 289, 9, 114, 127, 258, 108, 14, + 108, 284, 17, 18, 19, 301, 21, 22, 108, 282, + 271, 272, 100, 28, 175, 176, 107, 32, 111, 111, + 35, 108, 37, 26, 181, 182, 108, 72, 104, 104, + 45, 109, 109, 48, 108, 38, 39, 40, 41, 42, + 111, 113, 111, 109, 104, 16, 113, 50, 309, 105, + 65, 66, 67, 314, 315, 109, 71, 72, 73, 74, + 12, 142, 23, 277, 1, 68, 67, 70, 85, 71, + 246, 241, 183, 185, 187, 184, -1, -1, -1, 186, + -1, -1, -1, -1, 99, -1, -1, -1, 103, 104, + 105, 106, 107, 108, -1, -1, -1, 100, -1, -1, + 7, -1, 9, 118, 119, 120, 121, 14, -1, -1, + 17, 18, 19, -1, 21, 22, -1, -1, -1, -1, + -1, 28, -1, -1, -1, 32, -1, -1, 35, -1, + 37, 26, -1, -1, -1, -1, -1, -1, 45, -1, + -1, 48, -1, 38, 39, 40, 41, 42, -1, -1, + -1, -1, -1, -1, -1, 50, -1, -1, 65, 66, + 67, -1, -1, -1, 71, 72, 73, 74, -1, -1, + -1, -1, -1, 68, -1, 70, -1, -1, -1, 7, -1, 9, -1, -1, -1, -1, -1, -1, -1, 17, - 18, -1, 99, 21, -1, -1, 103, 104, 105, -1, - 28, 108, -1, -1, 32, -1, -1, -1, -1, 37, - -1, 118, 119, 120, 121, -1, -1, 45, -1, -1, + 18, -1, 99, 21, -1, -1, 103, 104, 105, 106, + 28, 108, -1, -1, 32, 100, -1, -1, -1, 37, + -1, 118, 119, 120, 121, -1, -1, 45, -1, 7, + 48, 9, -1, -1, -1, -1, -1, -1, -1, 17, + 18, -1, -1, 21, -1, -1, -1, 65, -1, 67, + 28, -1, -1, 71, 32, 73, 74, -1, -1, 37, + -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, -1, 67, - 7, -1, 9, 71, -1, 73, 74, -1, -1, -1, - 17, 18, -1, -1, 21, -1, -1, -1, -1, -1, - -1, 28, -1, -1, -1, 32, -1, -1, -1, -1, - 37, 99, -1, -1, -1, 103, 104, -1, 45, 107, - 108, 48, -1, -1, -1, -1, -1, -1, -1, -1, - 118, 119, 120, 121, 0, -1, -1, -1, 65, -1, - 67, 7, -1, 9, 71, -1, 73, 74, -1, -1, - -1, 17, -1, -1, -1, 21, -1, -1, -1, -1, - -1, -1, 28, -1, -1, -1, 32, -1, -1, -1, - -1, 37, 99, -1, -1, -1, 103, 104, -1, 45, - -1, 108, 48, -1, -1, -1, -1, -1, 7, -1, - 9, 118, 119, 120, 121, -1, -1, -1, 17, -1, - 66, 67, 21, -1, 23, 71, 25, -1, -1, 28, - 29, -1, -1, 32, -1, -1, -1, 7, 37, 9, - -1, -1, -1, -1, -1, -1, 45, 17, -1, 48, - -1, 21, 98, -1, -1, -1, -1, -1, 28, 105, - -1, -1, 32, -1, -1, -1, -1, 37, 67, -1, - -1, -1, 71, -1, -1, 45, -1, -1, 48, -1, + -1, 99, -1, -1, -1, 103, 104, 65, 106, 67, + 108, -1, -1, 71, -1, 73, 74, -1, -1, -1, + 118, 119, 120, 121, -1, -1, -1, -1, 7, -1, + 9, -1, -1, -1, -1, -1, -1, -1, 17, 18, + -1, 99, 21, -1, -1, 103, 104, 105, -1, 28, + 108, -1, -1, 32, -1, -1, -1, -1, 37, -1, + 118, 119, 120, 121, -1, -1, 45, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, - -1, 71 + -1, -1, -1, -1, -1, -1, 65, -1, 67, 7, + -1, 9, 71, -1, 73, 74, -1, -1, -1, 17, + 18, -1, -1, 21, -1, -1, -1, -1, -1, -1, + 28, -1, -1, -1, 32, -1, -1, -1, -1, 37, + 99, -1, -1, -1, 103, 104, -1, 45, 107, 108, + 48, -1, -1, -1, -1, -1, -1, -1, -1, 118, + 119, 120, 121, 0, -1, -1, -1, 65, -1, 67, + 7, -1, 9, 71, -1, 73, 74, -1, -1, -1, + 17, -1, -1, -1, 21, -1, -1, -1, -1, -1, + -1, 28, -1, -1, -1, 32, -1, -1, -1, -1, + 37, 99, -1, -1, -1, 103, 104, -1, 45, -1, + 108, 48, -1, -1, -1, -1, -1, 7, -1, 9, + 118, 119, 120, 121, -1, -1, -1, 17, -1, 66, + 67, 21, -1, 23, 71, 25, -1, -1, 28, 29, + -1, -1, 32, -1, -1, -1, 7, 37, 9, -1, + -1, -1, -1, -1, -1, 45, 17, -1, 48, -1, + 21, 98, -1, -1, -1, -1, -1, 28, 105, -1, + -1, 32, -1, -1, -1, -1, 37, 67, -1, -1, + -1, 71, -1, -1, 45, -1, -1, 48, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, + 71 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1837,28 +1834,27 @@ static const yytype_uint8 yystos[] = 101, 143, 160, 162, 105, 111, 156, 18, 65, 73, 74, 99, 103, 104, 108, 118, 119, 120, 121, 163, 167, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 193, 110, - 144, 145, 146, 161, 14, 19, 22, 35, 72, 105, - 141, 154, 163, 168, 169, 170, 171, 173, 174, 193, - 50, 153, 137, 106, 153, 108, 105, 157, 105, 178, - 178, 163, 193, 152, 73, 74, 115, 117, 79, 81, - 86, 87, 88, 89, 90, 91, 92, 93, 114, 192, - 178, 122, 123, 124, 118, 119, 78, 80, 83, 84, - 112, 113, 77, 85, 125, 126, 127, 75, 76, 128, - 111, 116, 36, 136, 114, 169, 108, 108, 193, 108, - 152, 107, 169, 105, 100, 111, 107, 135, 138, 163, - 137, 111, 142, 147, 152, 109, 108, 193, 136, 191, - 178, 178, 178, 178, 180, 180, 181, 181, 182, 182, - 182, 182, 183, 183, 184, 185, 186, 187, 188, 193, - 191, 108, 106, 164, 165, 191, 72, 142, 193, 105, - 193, 104, 160, 50, 152, 107, 104, 148, 149, 150, - 109, 162, 165, 166, 116, 110, 136, 166, 108, 158, - 163, 174, 109, 109, 111, 105, 160, 113, 111, 23, - 25, 29, 151, 163, 144, 109, 109, 111, 191, 109, - 111, 107, 111, 193, 174, 174, 169, 172, 169, 104, - 105, 149, 152, 178, 165, 136, 107, 109, 193, 193, - 16, 113, 136, 109, 105, 109, 109, 169, 144, 169, - 169 + 184, 185, 186, 187, 188, 189, 190, 192, 110, 144, + 145, 146, 161, 14, 19, 22, 35, 72, 105, 141, + 154, 163, 168, 169, 170, 171, 173, 174, 192, 50, + 153, 137, 106, 153, 108, 105, 157, 105, 177, 177, + 163, 192, 152, 73, 74, 115, 117, 79, 81, 86, + 87, 88, 89, 90, 91, 92, 93, 114, 191, 177, + 122, 123, 124, 118, 119, 78, 80, 83, 84, 112, + 113, 77, 85, 125, 126, 127, 75, 76, 128, 111, + 116, 36, 136, 114, 169, 108, 108, 192, 108, 152, + 107, 169, 105, 100, 111, 107, 135, 138, 163, 137, + 111, 142, 147, 152, 109, 108, 192, 136, 190, 177, + 177, 177, 177, 179, 179, 180, 180, 181, 181, 181, + 181, 182, 182, 183, 184, 185, 186, 187, 192, 190, + 108, 106, 164, 165, 190, 72, 142, 192, 105, 192, + 104, 160, 50, 152, 107, 104, 148, 149, 150, 109, + 162, 165, 166, 116, 110, 136, 166, 108, 158, 163, + 174, 109, 109, 111, 105, 160, 113, 111, 23, 25, + 29, 151, 163, 144, 109, 109, 111, 190, 109, 111, + 107, 111, 192, 174, 174, 169, 172, 169, 104, 105, + 149, 152, 177, 165, 136, 107, 109, 192, 192, 16, + 113, 136, 109, 105, 109, 109, 169, 144, 169, 169 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ @@ -1875,13 +1871,13 @@ static const yytype_uint8 yyr1[] = 163, 163, 163, 163, 164, 164, 164, 165, 166, 166, 167, 167, 168, 168, 169, 169, 169, 169, 169, 169, 170, 171, 172, 172, 173, 173, 173, 173, 174, 174, - 175, 175, 175, 175, 175, 176, 177, 177, 177, 177, - 177, 177, 178, 178, 178, 178, 178, 179, 179, 179, - 179, 180, 180, 180, 180, 181, 181, 181, 182, 182, - 182, 183, 183, 183, 183, 183, 184, 184, 184, 185, - 185, 186, 186, 187, 187, 188, 188, 189, 189, 190, - 190, 191, 191, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 193, 193 + 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, + 176, 177, 177, 177, 177, 177, 178, 178, 178, 178, + 179, 179, 179, 179, 180, 180, 180, 181, 181, 181, + 182, 182, 182, 182, 182, 183, 183, 183, 184, 184, + 185, 185, 186, 186, 187, 187, 188, 188, 189, 189, + 190, 190, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 192, 192 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -1898,13 +1894,13 @@ static const yytype_uint8 yyr2[] = 2, 2, 2, 2, 1, 3, 4, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 5, 1, 3, 5, 7, 8, 8, 1, 2, - 1, 1, 1, 1, 3, 1, 1, 2, 2, 3, - 4, 5, 1, 2, 2, 2, 6, 1, 1, 1, - 1, 1, 3, 3, 3, 1, 3, 3, 1, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 5, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3 + 1, 1, 1, 1, 3, 1, 2, 2, 3, 4, + 5, 1, 2, 2, 2, 6, 1, 1, 1, 1, + 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3 }; @@ -1920,22 +1916,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -1993,11 +1989,11 @@ do { \ /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ -__attribute__((__unused__)) -static unsigned +YY_ATTRIBUTE_UNUSED +static int yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) { - unsigned res = 0; + int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { @@ -2040,40 +2036,40 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); YYUSE (yylocationp); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - YY_LOCATION_PRINT (yyoutput, *yylocationp); - YYFPRINTF (yyoutput, ": "); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); - YYFPRINTF (yyoutput, ")"); + YY_LOCATION_PRINT (yyo, *yylocationp); + YYFPRINTF (yyo, ": "); + yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -2107,7 +2103,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -2118,7 +2114,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] , &(yylsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } @@ -2222,7 +2218,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -2240,7 +2239,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -2256,11 +2255,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -2317,11 +2316,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -2333,6 +2332,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -2344,9 +2344,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -2491,23 +2492,33 @@ yyparse (void) yylsp[0] = yylloc; goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -2525,15 +2536,11 @@ yyparse (void) &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); - - yyls = yyls1; yyss = yyss1; yyvs = yyvs1; + yyls = yyls1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -2550,36 +2557,34 @@ yyparse (void) YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -2652,7 +2657,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -2668,20 +2673,21 @@ yyreduce: GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; - /* Default location. */ + /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + yyerror_range[1] = yyloc; YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 1095 "hlsl.y" /* yacc.c:1646 */ + case 2: +#line 1074 "hlsl.y" { } -#line 2681 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2687 "hlsl.tab.c" break; case 3: -#line 1098 "hlsl.y" /* yacc.c:1646 */ +#line 1077 "hlsl.y" { const struct hlsl_ir_function_decl *decl; @@ -2690,62 +2696,62 @@ yyreduce: { if (decl->body && (yyvsp[0].function).decl->body) { - hlsl_report_message((yyvsp[0].function).decl->node.loc.file, (yyvsp[0].function).decl->node.loc.line, - (yyvsp[0].function).decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message((yyvsp[0].function).decl->loc.file, (yyvsp[0].function).decl->loc.line, + (yyvsp[0].function).decl->loc.col, HLSL_LEVEL_ERROR, "redefinition of function %s", debugstr_a((yyvsp[0].function).name)); - return 1; + YYABORT; } - else if (!compare_hlsl_types(decl->node.data_type, (yyvsp[0].function).decl->node.data_type)) + else if (!compare_hlsl_types(decl->return_type, (yyvsp[0].function).decl->return_type)) { - hlsl_report_message((yyvsp[0].function).decl->node.loc.file, (yyvsp[0].function).decl->node.loc.line, - (yyvsp[0].function).decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message((yyvsp[0].function).decl->loc.file, (yyvsp[0].function).decl->loc.line, + (yyvsp[0].function).decl->loc.col, HLSL_LEVEL_ERROR, "redefining function %s with a different return type", debugstr_a((yyvsp[0].function).name)); - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_NOTE, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_NOTE, "%s previously declared here", debugstr_a((yyvsp[0].function).name)); - return 1; + YYABORT; } } - if ((yyvsp[0].function).decl->node.data_type->base_type == HLSL_TYPE_VOID && (yyvsp[0].function).decl->semantic) + if ((yyvsp[0].function).decl->return_type->base_type == HLSL_TYPE_VOID && (yyvsp[0].function).decl->semantic) { - hlsl_report_message((yyvsp[0].function).decl->node.loc.file, (yyvsp[0].function).decl->node.loc.line, - (yyvsp[0].function).decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message((yyvsp[0].function).decl->loc.file, (yyvsp[0].function).decl->loc.line, + (yyvsp[0].function).decl->loc.col, HLSL_LEVEL_ERROR, "void function with a semantic"); } TRACE("Adding function '%s' to the function list.\n", (yyvsp[0].function).name); add_function_decl(&hlsl_ctx.functions, (yyvsp[0].function).name, (yyvsp[0].function).decl, FALSE); } -#line 2722 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2728 "hlsl.tab.c" break; case 4: -#line 1135 "hlsl.y" /* yacc.c:1646 */ +#line 1114 "hlsl.y" { TRACE("Declaration statement parsed.\n"); } -#line 2730 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2736 "hlsl.tab.c" break; case 5: -#line 1139 "hlsl.y" /* yacc.c:1646 */ +#line 1118 "hlsl.y" { } -#line 2737 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2743 "hlsl.tab.c" break; case 6: -#line 1142 "hlsl.y" /* yacc.c:1646 */ +#line 1121 "hlsl.y" { TRACE("Skipping stray semicolon.\n"); } -#line 2745 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2751 "hlsl.tab.c" break; case 7: -#line 1147 "hlsl.y" /* yacc.c:1646 */ +#line 1126 "hlsl.y" { const char **new_array = NULL; @@ -2766,11 +2772,11 @@ yyreduce: d3dcompiler_free((yyvsp[0].name)); } } -#line 2770 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2776 "hlsl.tab.c" break; case 8: -#line 1169 "hlsl.y" /* yacc.c:1646 */ +#line 1148 "hlsl.y" { struct source_location loc; @@ -2786,11 +2792,11 @@ yyreduce: } (yyval.list) = declare_vars((yyvsp[-2].type), 0, (yyvsp[-1].list)); } -#line 2790 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2796 "hlsl.tab.c" break; case 11: -#line 1189 "hlsl.y" /* yacc.c:1646 */ +#line 1168 "hlsl.y" { BOOL ret; struct source_location loc; @@ -2804,7 +2810,7 @@ yyreduce: { hlsl_report_message(hlsl_ctx.source_file, (yylsp[-3]).first_line, (yylsp[-3]).first_column, HLSL_LEVEL_ERROR, "redefinition of '%s'", (yyvsp[-3].name)); - return 1; + YYABORT; } ret = add_type_to_scope(hlsl_ctx.cur_scope, (yyval.type)); @@ -2812,14 +2818,14 @@ yyreduce: { hlsl_report_message(hlsl_ctx.source_file, (yylsp[-3]).first_line, (yylsp[-3]).first_column, HLSL_LEVEL_ERROR, "redefinition of struct '%s'", (yyvsp[-3].name)); - return 1; + YYABORT; } } -#line 2819 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2825 "hlsl.tab.c" break; case 12: -#line 1215 "hlsl.y" /* yacc.c:1646 */ +#line 1194 "hlsl.y" { struct source_location loc; @@ -2828,20 +2834,20 @@ yyreduce: check_invalid_matrix_modifiers((yyvsp[-4].modifiers), &loc); (yyval.type) = new_struct_type(NULL, (yyvsp[-4].modifiers), (yyvsp[-1].list)); } -#line 2832 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2838 "hlsl.tab.c" break; case 16: -#line 1229 "hlsl.y" /* yacc.c:1646 */ +#line 1208 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); } -#line 2841 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2847 "hlsl.tab.c" break; case 17: -#line 1234 "hlsl.y" /* yacc.c:1646 */ +#line 1213 "hlsl.y" { BOOL ret; struct hlsl_struct_field *field, *next; @@ -2859,54 +2865,54 @@ yyreduce: } d3dcompiler_free((yyvsp[0].list)); } -#line 2863 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2869 "hlsl.tab.c" break; case 18: -#line 1253 "hlsl.y" /* yacc.c:1646 */ +#line 1232 "hlsl.y" { (yyval.list) = gen_struct_fields((yyvsp[-2].type), (yyvsp[-3].modifiers), (yyvsp[-1].list)); } -#line 2871 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2877 "hlsl.tab.c" break; case 19: -#line 1257 "hlsl.y" /* yacc.c:1646 */ +#line 1236 "hlsl.y" { (yyval.list) = gen_struct_fields((yyvsp[-2].type), 0, (yyvsp[-1].list)); } -#line 2879 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2885 "hlsl.tab.c" break; case 20: -#line 1262 "hlsl.y" /* yacc.c:1646 */ +#line 1241 "hlsl.y" { TRACE("Function %s parsed.\n", (yyvsp[-1].function).name); (yyval.function) = (yyvsp[-1].function); (yyval.function).decl->body = (yyvsp[0].list); pop_scope(&hlsl_ctx); } -#line 2890 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2896 "hlsl.tab.c" break; case 21: -#line 1269 "hlsl.y" /* yacc.c:1646 */ +#line 1248 "hlsl.y" { TRACE("Function prototype for %s.\n", (yyvsp[-1].function).name); (yyval.function) = (yyvsp[-1].function); pop_scope(&hlsl_ctx); } -#line 2900 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2906 "hlsl.tab.c" break; case 22: -#line 1276 "hlsl.y" /* yacc.c:1646 */ +#line 1255 "hlsl.y" { if (get_variable(hlsl_ctx.globals, (yyvsp[-4].name))) { hlsl_report_message(hlsl_ctx.source_file, (yylsp[-4]).first_line, (yylsp[-4]).first_column, HLSL_LEVEL_ERROR, "redefinition of '%s'\n", (yyvsp[-4].name)); - return 1; + YYABORT; } if ((yyvsp[-5].type)->base_type == HLSL_TYPE_VOID && (yyvsp[0].colon_attribute).semantic) { @@ -2923,87 +2929,87 @@ yyreduce: if (!(yyval.function).decl) { ERR("Out of memory.\n"); - return -1; + YYABORT; } (yyval.function).name = (yyvsp[-4].name); (yyval.function).decl->semantic = (yyvsp[0].colon_attribute).semantic; - set_location(&(yyval.function).decl->node.loc, &(yylsp[-4])); + set_location(&(yyval.function).decl->loc, &(yylsp[-4])); } -#line 2933 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2939 "hlsl.tab.c" break; case 23: -#line 1306 "hlsl.y" /* yacc.c:1646 */ +#line 1285 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); } -#line 2942 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2948 "hlsl.tab.c" break; case 24: -#line 1311 "hlsl.y" /* yacc.c:1646 */ +#line 1290 "hlsl.y" { pop_scope(&hlsl_ctx); (yyval.list) = (yyvsp[-1].list); } -#line 2951 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2957 "hlsl.tab.c" break; case 25: -#line 1317 "hlsl.y" /* yacc.c:1646 */ +#line 1296 "hlsl.y" { push_scope(&hlsl_ctx); } -#line 2959 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2965 "hlsl.tab.c" break; case 28: -#line 1325 "hlsl.y" /* yacc.c:1646 */ +#line 1304 "hlsl.y" { (yyval.colon_attribute).semantic = NULL; (yyval.colon_attribute).reg_reservation = NULL; } -#line 2968 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2974 "hlsl.tab.c" break; case 29: -#line 1330 "hlsl.y" /* yacc.c:1646 */ +#line 1309 "hlsl.y" { (yyval.colon_attribute).semantic = (yyvsp[0].name); (yyval.colon_attribute).reg_reservation = NULL; } -#line 2977 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2983 "hlsl.tab.c" break; case 30: -#line 1335 "hlsl.y" /* yacc.c:1646 */ +#line 1314 "hlsl.y" { (yyval.colon_attribute).semantic = NULL; (yyval.colon_attribute).reg_reservation = (yyvsp[0].reg_reservation); } -#line 2986 "hlsl.tab.c" /* yacc.c:1646 */ +#line 2992 "hlsl.tab.c" break; case 31: -#line 1341 "hlsl.y" /* yacc.c:1646 */ +#line 1320 "hlsl.y" { (yyval.name) = (yyvsp[0].name); } -#line 2994 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3000 "hlsl.tab.c" break; case 32: -#line 1347 "hlsl.y" /* yacc.c:1646 */ +#line 1326 "hlsl.y" { (yyval.reg_reservation) = parse_reg_reservation((yyvsp[-1].name)); d3dcompiler_free((yyvsp[-1].name)); } -#line 3003 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3009 "hlsl.tab.c" break; case 33: -#line 1352 "hlsl.y" /* yacc.c:1646 */ +#line 1331 "hlsl.y" { FIXME("Ignoring shader target %s in a register reservation.\n", debugstr_a((yyvsp[-3].name))); d3dcompiler_free((yyvsp[-3].name)); @@ -3011,28 +3017,28 @@ yyreduce: (yyval.reg_reservation) = parse_reg_reservation((yyvsp[-1].name)); d3dcompiler_free((yyvsp[-1].name)); } -#line 3015 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3021 "hlsl.tab.c" break; case 34: -#line 1361 "hlsl.y" /* yacc.c:1646 */ +#line 1340 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); } -#line 3024 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3030 "hlsl.tab.c" break; case 35: -#line 1366 "hlsl.y" /* yacc.c:1646 */ +#line 1345 "hlsl.y" { (yyval.list) = (yyvsp[0].list); } -#line 3032 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3038 "hlsl.tab.c" break; case 36: -#line 1371 "hlsl.y" /* yacc.c:1646 */ +#line 1350 "hlsl.y" { struct source_location loc; @@ -3043,14 +3049,14 @@ yyreduce: { ERR("Error adding function parameter %s.\n", (yyvsp[0].parameter).name); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } } -#line 3050 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3056 "hlsl.tab.c" break; case 37: -#line 1385 "hlsl.y" /* yacc.c:1646 */ +#line 1364 "hlsl.y" { struct source_location loc; @@ -3060,14 +3066,14 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "duplicate parameter %s", (yyvsp[0].parameter).name); - return 1; + YYABORT; } } -#line 3067 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3073 "hlsl.tab.c" break; case 38: -#line 1399 "hlsl.y" /* yacc.c:1646 */ +#line 1378 "hlsl.y" { (yyval.parameter).modifiers = (yyvsp[-4].modifiers) ? (yyvsp[-4].modifiers) : HLSL_MODIFIER_IN; (yyval.parameter).modifiers |= (yyvsp[-3].modifiers); @@ -3076,164 +3082,164 @@ yyreduce: (yyval.parameter).semantic = (yyvsp[0].colon_attribute).semantic; (yyval.parameter).reg_reservation = (yyvsp[0].colon_attribute).reg_reservation; } -#line 3080 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3086 "hlsl.tab.c" break; case 39: -#line 1409 "hlsl.y" /* yacc.c:1646 */ +#line 1388 "hlsl.y" { (yyval.modifiers) = 0; } -#line 3088 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3094 "hlsl.tab.c" break; case 40: -#line 1413 "hlsl.y" /* yacc.c:1646 */ +#line 1392 "hlsl.y" { if ((yyvsp[-1].modifiers) & (yyvsp[0].modifiers)) { hlsl_report_message(hlsl_ctx.source_file, (yylsp[0]).first_line, (yylsp[0]).first_column, HLSL_LEVEL_ERROR, "duplicate input-output modifiers"); - return 1; + YYABORT; } (yyval.modifiers) = (yyvsp[-1].modifiers) | (yyvsp[0].modifiers); } -#line 3102 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3108 "hlsl.tab.c" break; case 41: -#line 1424 "hlsl.y" /* yacc.c:1646 */ +#line 1403 "hlsl.y" { (yyval.modifiers) = HLSL_MODIFIER_IN; } -#line 3110 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3116 "hlsl.tab.c" break; case 42: -#line 1428 "hlsl.y" /* yacc.c:1646 */ +#line 1407 "hlsl.y" { (yyval.modifiers) = HLSL_MODIFIER_OUT; } -#line 3118 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3124 "hlsl.tab.c" break; case 43: -#line 1432 "hlsl.y" /* yacc.c:1646 */ +#line 1411 "hlsl.y" { (yyval.modifiers) = HLSL_MODIFIER_IN | HLSL_MODIFIER_OUT; } -#line 3126 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3132 "hlsl.tab.c" break; case 44: -#line 1437 "hlsl.y" /* yacc.c:1646 */ +#line 1416 "hlsl.y" { (yyval.type) = (yyvsp[0].type); } -#line 3134 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3140 "hlsl.tab.c" break; case 45: -#line 1441 "hlsl.y" /* yacc.c:1646 */ +#line 1420 "hlsl.y" { if ((yyvsp[-3].type)->type != HLSL_CLASS_SCALAR) { hlsl_message("Line %u: vectors of non-scalar types are not allowed.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } if ((yyvsp[-1].intval) < 1 || (yyvsp[-1].intval) > 4) { hlsl_message("Line %u: vector size must be between 1 and 4.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } (yyval.type) = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, (yyvsp[-3].type)->base_type, (yyvsp[-1].intval), 1); } -#line 3157 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3163 "hlsl.tab.c" break; case 46: -#line 1460 "hlsl.y" /* yacc.c:1646 */ +#line 1439 "hlsl.y" { if ((yyvsp[-5].type)->type != HLSL_CLASS_SCALAR) { hlsl_message("Line %u: matrices of non-scalar types are not allowed.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } if ((yyvsp[-3].intval) < 1 || (yyvsp[-3].intval) > 4 || (yyvsp[-1].intval) < 1 || (yyvsp[-1].intval) > 4) { hlsl_message("Line %u: matrix dimensions must be between 1 and 4.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } (yyval.type) = new_hlsl_type(NULL, HLSL_CLASS_MATRIX, (yyvsp[-5].type)->base_type, (yyvsp[-3].intval), (yyvsp[-1].intval)); } -#line 3180 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3186 "hlsl.tab.c" break; case 47: -#line 1480 "hlsl.y" /* yacc.c:1646 */ +#line 1459 "hlsl.y" { (yyval.type) = new_hlsl_type(d3dcompiler_strdup("void"), HLSL_CLASS_OBJECT, HLSL_TYPE_VOID, 1, 1); } -#line 3188 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3194 "hlsl.tab.c" break; case 48: -#line 1484 "hlsl.y" /* yacc.c:1646 */ +#line 1463 "hlsl.y" { (yyval.type) = new_hlsl_type(d3dcompiler_strdup("sampler"), HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); (yyval.type)->sampler_dim = HLSL_SAMPLER_DIM_GENERIC; } -#line 3197 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3203 "hlsl.tab.c" break; case 49: -#line 1489 "hlsl.y" /* yacc.c:1646 */ +#line 1468 "hlsl.y" { (yyval.type) = new_hlsl_type(d3dcompiler_strdup("sampler1D"), HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); (yyval.type)->sampler_dim = HLSL_SAMPLER_DIM_1D; } -#line 3206 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3212 "hlsl.tab.c" break; case 50: -#line 1494 "hlsl.y" /* yacc.c:1646 */ +#line 1473 "hlsl.y" { (yyval.type) = new_hlsl_type(d3dcompiler_strdup("sampler2D"), HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); (yyval.type)->sampler_dim = HLSL_SAMPLER_DIM_2D; } -#line 3215 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3221 "hlsl.tab.c" break; case 51: -#line 1499 "hlsl.y" /* yacc.c:1646 */ +#line 1478 "hlsl.y" { (yyval.type) = new_hlsl_type(d3dcompiler_strdup("sampler3D"), HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); (yyval.type)->sampler_dim = HLSL_SAMPLER_DIM_3D; } -#line 3224 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3230 "hlsl.tab.c" break; case 52: -#line 1504 "hlsl.y" /* yacc.c:1646 */ +#line 1483 "hlsl.y" { (yyval.type) = new_hlsl_type(d3dcompiler_strdup("samplerCUBE"), HLSL_CLASS_OBJECT, HLSL_TYPE_SAMPLER, 1, 1); (yyval.type)->sampler_dim = HLSL_SAMPLER_DIM_CUBE; } -#line 3233 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3239 "hlsl.tab.c" break; case 53: -#line 1509 "hlsl.y" /* yacc.c:1646 */ +#line 1488 "hlsl.y" { struct hlsl_type *type; @@ -3241,11 +3247,11 @@ yyreduce: (yyval.type) = type; d3dcompiler_free((yyvsp[0].name)); } -#line 3245 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3251 "hlsl.tab.c" break; case 54: -#line 1517 "hlsl.y" /* yacc.c:1646 */ +#line 1496 "hlsl.y" { struct hlsl_type *type; @@ -3262,122 +3268,122 @@ yyreduce: } d3dcompiler_free((yyvsp[0].name)); } -#line 3266 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3272 "hlsl.tab.c" break; case 57: -#line 1537 "hlsl.y" /* yacc.c:1646 */ +#line 1516 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); if (!(yyval.list)) { ERR("Out of memory\n"); - return -1; + YYABORT; } list_init((yyval.list)); } -#line 3280 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3286 "hlsl.tab.c" break; case 58: -#line 1548 "hlsl.y" /* yacc.c:1646 */ +#line 1527 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-4])); if (!add_typedef((yyvsp[-3].modifiers), (yyvsp[-2].type), (yyvsp[-1].list), &loc)) - return 1; + YYABORT; } -#line 3292 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3298 "hlsl.tab.c" break; case 59: -#line 1556 "hlsl.y" /* yacc.c:1646 */ +#line 1535 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-3])); if (!add_typedef(0, (yyvsp[-2].type), (yyvsp[-1].list), &loc)) - return 1; + YYABORT; } -#line 3304 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3310 "hlsl.tab.c" break; case 60: -#line 1565 "hlsl.y" /* yacc.c:1646 */ +#line 1544 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); list_add_head((yyval.list), &(yyvsp[0].variable_def)->entry); } -#line 3314 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3320 "hlsl.tab.c" break; case 61: -#line 1571 "hlsl.y" /* yacc.c:1646 */ +#line 1550 "hlsl.y" { (yyval.list) = (yyvsp[-2].list); list_add_tail((yyval.list), &(yyvsp[0].variable_def)->entry); } -#line 3323 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3329 "hlsl.tab.c" break; case 62: -#line 1577 "hlsl.y" /* yacc.c:1646 */ +#line 1556 "hlsl.y" { (yyval.variable_def) = d3dcompiler_alloc(sizeof(*(yyval.variable_def))); set_location(&(yyval.variable_def)->loc, &(yylsp[-1])); (yyval.variable_def)->name = (yyvsp[-1].name); (yyval.variable_def)->array_size = (yyvsp[0].intval); } -#line 3334 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3340 "hlsl.tab.c" break; case 63: -#line 1585 "hlsl.y" /* yacc.c:1646 */ +#line 1564 "hlsl.y" { (yyval.list) = declare_vars((yyvsp[-2].type), (yyvsp[-3].modifiers), (yyvsp[-1].list)); } -#line 3342 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3348 "hlsl.tab.c" break; case 64: -#line 1590 "hlsl.y" /* yacc.c:1646 */ +#line 1569 "hlsl.y" { (yyval.list) = NULL; } -#line 3350 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3356 "hlsl.tab.c" break; case 65: -#line 1594 "hlsl.y" /* yacc.c:1646 */ +#line 1573 "hlsl.y" { (yyval.list) = (yyvsp[0].list); } -#line 3358 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3364 "hlsl.tab.c" break; case 66: -#line 1599 "hlsl.y" /* yacc.c:1646 */ +#line 1578 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); list_add_head((yyval.list), &(yyvsp[0].variable_def)->entry); } -#line 3368 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3374 "hlsl.tab.c" break; case 67: -#line 1605 "hlsl.y" /* yacc.c:1646 */ +#line 1584 "hlsl.y" { (yyval.list) = (yyvsp[-2].list); list_add_tail((yyval.list), &(yyvsp[0].variable_def)->entry); } -#line 3377 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3383 "hlsl.tab.c" break; case 68: -#line 1611 "hlsl.y" /* yacc.c:1646 */ +#line 1590 "hlsl.y" { (yyval.variable_def) = d3dcompiler_alloc(sizeof(*(yyval.variable_def))); set_location(&(yyval.variable_def)->loc, &(yylsp[-2])); @@ -3386,11 +3392,11 @@ yyreduce: (yyval.variable_def)->semantic = (yyvsp[0].colon_attribute).semantic; (yyval.variable_def)->reg_reservation = (yyvsp[0].colon_attribute).reg_reservation; } -#line 3390 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3396 "hlsl.tab.c" break; case 69: -#line 1620 "hlsl.y" /* yacc.c:1646 */ +#line 1599 "hlsl.y" { TRACE("Declaration with initializer.\n"); (yyval.variable_def) = d3dcompiler_alloc(sizeof(*(yyval.variable_def))); @@ -3399,220 +3405,224 @@ yyreduce: (yyval.variable_def)->array_size = (yyvsp[-3].intval); (yyval.variable_def)->semantic = (yyvsp[-2].colon_attribute).semantic; (yyval.variable_def)->reg_reservation = (yyvsp[-2].colon_attribute).reg_reservation; - (yyval.variable_def)->initializer = (yyvsp[0].list); + (yyval.variable_def)->initializer = (yyvsp[0].initializer); } -#line 3405 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3411 "hlsl.tab.c" break; case 70: -#line 1632 "hlsl.y" /* yacc.c:1646 */ +#line 1611 "hlsl.y" { (yyval.intval) = 0; } -#line 3413 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3419 "hlsl.tab.c" break; case 71: -#line 1636 "hlsl.y" /* yacc.c:1646 */ +#line 1615 "hlsl.y" { FIXME("Array.\n"); (yyval.intval) = 0; free_instr((yyvsp[-1].instr)); } -#line 3423 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3429 "hlsl.tab.c" break; case 72: -#line 1643 "hlsl.y" /* yacc.c:1646 */ +#line 1622 "hlsl.y" { (yyval.modifiers) = 0; } -#line 3431 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3437 "hlsl.tab.c" break; case 73: -#line 1647 "hlsl.y" /* yacc.c:1646 */ +#line 1626 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_EXTERN, &(yylsp[-1])); } -#line 3439 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3445 "hlsl.tab.c" break; case 74: -#line 1651 "hlsl.y" /* yacc.c:1646 */ +#line 1630 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_NOINTERPOLATION, &(yylsp[-1])); } -#line 3447 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3453 "hlsl.tab.c" break; case 75: -#line 1655 "hlsl.y" /* yacc.c:1646 */ +#line 1634 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_MODIFIER_PRECISE, &(yylsp[-1])); } -#line 3455 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3461 "hlsl.tab.c" break; case 76: -#line 1659 "hlsl.y" /* yacc.c:1646 */ +#line 1638 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_SHARED, &(yylsp[-1])); } -#line 3463 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3469 "hlsl.tab.c" break; case 77: -#line 1663 "hlsl.y" /* yacc.c:1646 */ +#line 1642 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_GROUPSHARED, &(yylsp[-1])); } -#line 3471 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3477 "hlsl.tab.c" break; case 78: -#line 1667 "hlsl.y" /* yacc.c:1646 */ +#line 1646 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_STATIC, &(yylsp[-1])); } -#line 3479 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3485 "hlsl.tab.c" break; case 79: -#line 1671 "hlsl.y" /* yacc.c:1646 */ +#line 1650 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_UNIFORM, &(yylsp[-1])); } -#line 3487 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3493 "hlsl.tab.c" break; case 80: -#line 1675 "hlsl.y" /* yacc.c:1646 */ +#line 1654 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_STORAGE_VOLATILE, &(yylsp[-1])); } -#line 3495 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3501 "hlsl.tab.c" break; case 81: -#line 1679 "hlsl.y" /* yacc.c:1646 */ +#line 1658 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_MODIFIER_CONST, &(yylsp[-1])); } -#line 3503 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3509 "hlsl.tab.c" break; case 82: -#line 1683 "hlsl.y" /* yacc.c:1646 */ +#line 1662 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_MODIFIER_ROW_MAJOR, &(yylsp[-1])); } -#line 3511 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3517 "hlsl.tab.c" break; case 83: -#line 1687 "hlsl.y" /* yacc.c:1646 */ +#line 1666 "hlsl.y" { (yyval.modifiers) = add_modifier((yyvsp[0].modifiers), HLSL_MODIFIER_COLUMN_MAJOR, &(yylsp[-1])); } -#line 3519 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3525 "hlsl.tab.c" break; case 84: -#line 1692 "hlsl.y" /* yacc.c:1646 */ +#line 1671 "hlsl.y" { - (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); - list_init((yyval.list)); - list_add_head((yyval.list), &(yyvsp[0].instr)->entry); + (yyval.initializer).args_count = 1; + if (!((yyval.initializer).args = d3dcompiler_alloc(sizeof(*(yyval.initializer).args)))) + YYABORT; + (yyval.initializer).args[0] = (yyvsp[0].instr); } -#line 3529 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3536 "hlsl.tab.c" break; case 85: -#line 1698 "hlsl.y" /* yacc.c:1646 */ +#line 1678 "hlsl.y" { - (yyval.list) = (yyvsp[-1].list); + (yyval.initializer) = (yyvsp[-1].initializer); } -#line 3537 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3544 "hlsl.tab.c" break; case 86: -#line 1702 "hlsl.y" /* yacc.c:1646 */ +#line 1682 "hlsl.y" { - (yyval.list) = (yyvsp[-2].list); + (yyval.initializer) = (yyvsp[-2].initializer); } -#line 3545 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3552 "hlsl.tab.c" break; case 87: -#line 1707 "hlsl.y" /* yacc.c:1646 */ +#line 1687 "hlsl.y" { (yyval.instr) = (yyvsp[0].instr); } -#line 3553 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3560 "hlsl.tab.c" break; case 88: -#line 1712 "hlsl.y" /* yacc.c:1646 */ +#line 1692 "hlsl.y" { - (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); - list_init((yyval.list)); - list_add_head((yyval.list), &(yyvsp[0].instr)->entry); + (yyval.initializer).args_count = 1; + if (!((yyval.initializer).args = d3dcompiler_alloc(sizeof(*(yyval.initializer).args)))) + YYABORT; + (yyval.initializer).args[0] = (yyvsp[0].instr); } -#line 3563 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3571 "hlsl.tab.c" break; case 89: -#line 1718 "hlsl.y" /* yacc.c:1646 */ +#line 1699 "hlsl.y" { - (yyval.list) = (yyvsp[-2].list); - list_add_tail((yyval.list), &(yyvsp[0].instr)->entry); + (yyval.initializer) = (yyvsp[-2].initializer); + if (!((yyval.initializer).args = d3dcompiler_realloc((yyval.initializer).args, ((yyval.initializer).args_count + 1) * sizeof(*(yyval.initializer).args)))) + YYABORT; + (yyval.initializer).args[(yyval.initializer).args_count++] = (yyvsp[0].instr); } -#line 3572 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3582 "hlsl.tab.c" break; case 90: -#line 1724 "hlsl.y" /* yacc.c:1646 */ +#line 1707 "hlsl.y" { (yyval.boolval) = TRUE; } -#line 3580 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3590 "hlsl.tab.c" break; case 91: -#line 1728 "hlsl.y" /* yacc.c:1646 */ +#line 1711 "hlsl.y" { (yyval.boolval) = FALSE; } -#line 3588 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3598 "hlsl.tab.c" break; case 92: -#line 1733 "hlsl.y" /* yacc.c:1646 */ +#line 1716 "hlsl.y" { (yyval.list) = (yyvsp[0].list); } -#line 3596 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3606 "hlsl.tab.c" break; case 93: -#line 1737 "hlsl.y" /* yacc.c:1646 */ +#line 1720 "hlsl.y" { (yyval.list) = (yyvsp[-1].list); list_move_tail((yyval.list), (yyvsp[0].list)); d3dcompiler_free((yyvsp[0].list)); } -#line 3606 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3616 "hlsl.tab.c" break; case 100: -#line 1752 "hlsl.y" /* yacc.c:1646 */ +#line 1735 "hlsl.y" { struct hlsl_ir_jump *jump = d3dcompiler_alloc(sizeof(*jump)); if (!jump) { ERR("Out of memory\n"); - return -1; + YYABORT; } jump->node.type = HLSL_IR_JUMP; set_location(&jump->node.loc, &(yylsp[-2])); @@ -3628,17 +3638,17 @@ yyreduce: list_init((yyval.list)); list_add_tail((yyval.list), &jump->node.entry); } -#line 3632 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3642 "hlsl.tab.c" break; case 101: -#line 1775 "hlsl.y" /* yacc.c:1646 */ +#line 1758 "hlsl.y" { struct hlsl_ir_if *instr = d3dcompiler_alloc(sizeof(*instr)); if (!instr) { ERR("Out of memory\n"); - return -1; + YYABORT; } instr->node.type = HLSL_IR_IF; set_location(&instr->node.loc, &(yylsp[-4])); @@ -3655,29 +3665,29 @@ yyreduce: list_init((yyval.list)); list_add_head((yyval.list), &instr->node.entry); } -#line 3659 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3669 "hlsl.tab.c" break; case 102: -#line 1799 "hlsl.y" /* yacc.c:1646 */ +#line 1782 "hlsl.y" { (yyval.if_body).then_instrs = (yyvsp[0].list); (yyval.if_body).else_instrs = NULL; } -#line 3668 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3678 "hlsl.tab.c" break; case 103: -#line 1804 "hlsl.y" /* yacc.c:1646 */ +#line 1787 "hlsl.y" { (yyval.if_body).then_instrs = (yyvsp[-2].list); (yyval.if_body).else_instrs = (yyvsp[0].list); } -#line 3677 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3687 "hlsl.tab.c" break; case 104: -#line 1810 "hlsl.y" /* yacc.c:1646 */ +#line 1793 "hlsl.y" { struct source_location loc; struct list *cond = d3dcompiler_alloc(sizeof(*cond)); @@ -3685,18 +3695,18 @@ yyreduce: if (!cond) { ERR("Out of memory.\n"); - return -1; + YYABORT; } list_init(cond); list_add_head(cond, &(yyvsp[-2].instr)->entry); set_location(&loc, &(yylsp[-4])); (yyval.list) = create_loop(LOOP_WHILE, NULL, cond, NULL, (yyvsp[0].list), &loc); } -#line 3696 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3706 "hlsl.tab.c" break; case 105: -#line 1825 "hlsl.y" /* yacc.c:1646 */ +#line 1808 "hlsl.y" { struct source_location loc; struct list *cond = d3dcompiler_alloc(sizeof(*cond)); @@ -3704,18 +3714,18 @@ yyreduce: if (!cond) { ERR("Out of memory.\n"); - return -1; + YYABORT; } list_init(cond); list_add_head(cond, &(yyvsp[-2].instr)->entry); set_location(&loc, &(yylsp[-6])); (yyval.list) = create_loop(LOOP_DO_WHILE, NULL, cond, NULL, (yyvsp[-5].list), &loc); } -#line 3715 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3725 "hlsl.tab.c" break; case 106: -#line 1840 "hlsl.y" /* yacc.c:1646 */ +#line 1823 "hlsl.y" { struct source_location loc; @@ -3723,11 +3733,11 @@ yyreduce: (yyval.list) = create_loop(LOOP_FOR, (yyvsp[-4].list), (yyvsp[-3].list), (yyvsp[-2].instr), (yyvsp[0].list), &loc); pop_scope(&hlsl_ctx); } -#line 3727 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3737 "hlsl.tab.c" break; case 107: -#line 1848 "hlsl.y" /* yacc.c:1646 */ +#line 1831 "hlsl.y" { struct source_location loc; @@ -3738,37 +3748,37 @@ yyreduce: (yyval.list) = create_loop(LOOP_FOR, (yyvsp[-4].list), (yyvsp[-3].list), (yyvsp[-2].instr), (yyvsp[0].list), &loc); pop_scope(&hlsl_ctx); } -#line 3742 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3752 "hlsl.tab.c" break; case 108: -#line 1860 "hlsl.y" /* yacc.c:1646 */ +#line 1843 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); } -#line 3751 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3761 "hlsl.tab.c" break; case 109: -#line 1865 "hlsl.y" /* yacc.c:1646 */ +#line 1848 "hlsl.y" { (yyval.list) = d3dcompiler_alloc(sizeof(*(yyval.list))); list_init((yyval.list)); if ((yyvsp[-1].instr)) list_add_head((yyval.list), &(yyvsp[-1].instr)->entry); } -#line 3762 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3772 "hlsl.tab.c" break; case 110: -#line 1873 "hlsl.y" /* yacc.c:1646 */ +#line 1856 "hlsl.y" { struct hlsl_ir_constant *c = d3dcompiler_alloc(sizeof(*c)); if (!c) { ERR("Out of memory.\n"); - return -1; + YYABORT; } c->node.type = HLSL_IR_CONSTANT; set_location(&c->node.loc, &yylloc); @@ -3776,17 +3786,17 @@ yyreduce: c->v.value.f[0] = (yyvsp[0].floatval); (yyval.instr) = &c->node; } -#line 3780 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3790 "hlsl.tab.c" break; case 111: -#line 1887 "hlsl.y" /* yacc.c:1646 */ +#line 1870 "hlsl.y" { struct hlsl_ir_constant *c = d3dcompiler_alloc(sizeof(*c)); if (!c) { ERR("Out of memory.\n"); - return -1; + YYABORT; } c->node.type = HLSL_IR_CONSTANT; set_location(&c->node.loc, &yylloc); @@ -3794,17 +3804,17 @@ yyreduce: c->v.value.i[0] = (yyvsp[0].intval); (yyval.instr) = &c->node; } -#line 3798 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3808 "hlsl.tab.c" break; case 112: -#line 1901 "hlsl.y" /* yacc.c:1646 */ +#line 1884 "hlsl.y" { struct hlsl_ir_constant *c = d3dcompiler_alloc(sizeof(*c)); if (!c) { ERR("Out of memory.\n"); - return -1; + YYABORT; } c->node.type = HLSL_IR_CONSTANT; set_location(&c->node.loc, &yylloc); @@ -3812,14 +3822,23 @@ yyreduce: c->v.value.b[0] = (yyvsp[0].boolval); (yyval.instr) = &c->node; } -#line 3816 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3826 "hlsl.tab.c" break; case 113: -#line 1915 "hlsl.y" /* yacc.c:1646 */ +#line 1898 "hlsl.y" { - struct hlsl_ir_deref *deref = new_var_deref((yyvsp[0].var)); - if (deref) + struct hlsl_ir_deref *deref; + struct hlsl_ir_var *var; + + if (!(var = get_variable(hlsl_ctx.cur_scope, (yyvsp[0].name)))) + { + hlsl_message("Line %d: variable '%s' not declared\n", + hlsl_ctx.line_no, (yyvsp[0].name)); + set_parse_status(&hlsl_ctx.status, PARSE_ERR); + YYABORT; + } + if ((deref = new_var_deref(var))) { (yyval.instr) = &deref->node; set_location(&(yyval.instr)->loc, &(yylsp[0])); @@ -3827,46 +3846,48 @@ yyreduce: else (yyval.instr) = NULL; } -#line 3831 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3850 "hlsl.tab.c" break; case 114: -#line 1926 "hlsl.y" /* yacc.c:1646 */ +#line 1918 "hlsl.y" { (yyval.instr) = (yyvsp[-1].instr); } -#line 3839 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3858 "hlsl.tab.c" break; case 115: -#line 1931 "hlsl.y" /* yacc.c:1646 */ - { - struct hlsl_ir_var *var; - var = get_variable(hlsl_ctx.cur_scope, (yyvsp[0].name)); - if (!var) - { - hlsl_message("Line %d: variable '%s' not declared\n", - hlsl_ctx.line_no, (yyvsp[0].name)); - set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; - } - (yyval.var) = var; - } -#line 3856 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 116: -#line 1945 "hlsl.y" /* yacc.c:1646 */ +#line 1923 "hlsl.y" { (yyval.instr) = (yyvsp[0].instr); } -#line 3864 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3866 "hlsl.tab.c" + break; + + case 116: +#line 1927 "hlsl.y" + { + struct source_location loc; + + set_location(&loc, &(yylsp[0])); + if ((yyvsp[-1].instr)->data_type->modifiers & HLSL_MODIFIER_CONST) + { + hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, + "modifying a const expression"); + YYABORT; + } + (yyval.instr) = new_unary_expr(HLSL_IR_UNOP_POSTINC, (yyvsp[-1].instr), loc); + /* Post increment/decrement expressions are considered const */ + (yyval.instr)->data_type = clone_hlsl_type((yyval.instr)->data_type); + (yyval.instr)->data_type->modifiers |= HLSL_MODIFIER_CONST; + } +#line 3886 "hlsl.tab.c" break; case 117: -#line 1949 "hlsl.y" /* yacc.c:1646 */ +#line 1943 "hlsl.y" { - struct hlsl_ir_node *operands[3]; struct source_location loc; set_location(&loc, &(yylsp[0])); @@ -3874,43 +3895,18 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "modifying a const expression"); - return 1; + YYABORT; } - operands[0] = (yyvsp[-1].instr); - operands[1] = operands[2] = NULL; - (yyval.instr) = &new_expr(HLSL_IR_UNOP_POSTINC, operands, &loc)->node; + (yyval.instr) = new_unary_expr(HLSL_IR_UNOP_POSTDEC, (yyvsp[-1].instr), loc); /* Post increment/decrement expressions are considered const */ (yyval.instr)->data_type = clone_hlsl_type((yyval.instr)->data_type); (yyval.instr)->data_type->modifiers |= HLSL_MODIFIER_CONST; } -#line 3887 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3906 "hlsl.tab.c" break; case 118: -#line 1968 "hlsl.y" /* yacc.c:1646 */ - { - struct hlsl_ir_node *operands[3]; - struct source_location loc; - - set_location(&loc, &(yylsp[0])); - if ((yyvsp[-1].instr)->data_type->modifiers & HLSL_MODIFIER_CONST) - { - hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, - "modifying a const expression"); - return 1; - } - operands[0] = (yyvsp[-1].instr); - operands[1] = operands[2] = NULL; - (yyval.instr) = &new_expr(HLSL_IR_UNOP_POSTDEC, operands, &loc)->node; - /* Post increment/decrement expressions are considered const */ - (yyval.instr)->data_type = clone_hlsl_type((yyval.instr)->data_type); - (yyval.instr)->data_type->modifiers |= HLSL_MODIFIER_CONST; - } -#line 3910 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 119: -#line 1987 "hlsl.y" /* yacc.c:1646 */ +#line 1959 "hlsl.y" { struct source_location loc; @@ -3930,7 +3926,7 @@ yyreduce: if (!deref) { ERR("Out of memory\n"); - return -1; + YYABORT; } deref->node.loc = loc; (yyval.instr) = &deref->node; @@ -3941,7 +3937,7 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "invalid subscript %s", debugstr_a((yyvsp[0].name))); - return 1; + YYABORT; } } else if ((yyvsp[-2].instr)->data_type->type <= HLSL_CLASS_LAST_NUMERIC) @@ -3953,7 +3949,7 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "invalid swizzle %s", debugstr_a((yyvsp[0].name))); - return 1; + YYABORT; } (yyval.instr) = &swizzle->node; } @@ -3961,14 +3957,14 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "invalid subscript %s", debugstr_a((yyvsp[0].name))); - return 1; + YYABORT; } } -#line 3968 "hlsl.tab.c" /* yacc.c:1646 */ +#line 3964 "hlsl.tab.c" break; - case 120: -#line 2041 "hlsl.y" /* yacc.c:1646 */ + case 119: +#line 2013 "hlsl.y" { /* This may be an array dereference or a vector/matrix * subcomponent access. @@ -3981,7 +3977,7 @@ yyreduce: if (!deref) { ERR("Out of memory\n"); - return -1; + YYABORT; } deref->node.type = HLSL_IR_DEREF; set_location(&loc, &(yylsp[-2])); @@ -4009,7 +4005,7 @@ yyreduce: d3dcompiler_free(deref); free_instr((yyvsp[-3].instr)); free_instr((yyvsp[-1].instr)); - return 1; + YYABORT; } if ((yyvsp[-1].instr)->data_type->type != HLSL_CLASS_SCALAR) { @@ -4018,7 +4014,7 @@ yyreduce: d3dcompiler_free(deref); free_instr((yyvsp[-3].instr)); free_instr((yyvsp[-1].instr)); - return 1; + YYABORT; } deref->type = HLSL_IR_DEREF_ARRAY; deref->v.array.array = (yyvsp[-3].instr); @@ -4026,11 +4022,11 @@ yyreduce: (yyval.instr) = &deref->node; } -#line 4030 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4026 "hlsl.tab.c" break; - case 121: -#line 2101 "hlsl.y" /* yacc.c:1646 */ + case 120: +#line 2073 "hlsl.y" { struct hlsl_ir_constructor *constructor; @@ -4040,46 +4036,64 @@ yyreduce: hlsl_message("Line %u: unexpected modifier in a constructor.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } if ((yyvsp[-3].type)->type > HLSL_CLASS_LAST_NUMERIC) { hlsl_message("Line %u: constructors are allowed only for numeric data types.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } - if ((yyvsp[-3].type)->dimx * (yyvsp[-3].type)->dimy != components_count_expr_list((yyvsp[-1].list))) + if ((yyvsp[-3].type)->dimx * (yyvsp[-3].type)->dimy != initializer_size(&(yyvsp[-1].initializer))) { hlsl_message("Line %u: wrong number of components in constructor.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } + assert((yyvsp[-1].initializer).args_count <= ARRAY_SIZE(constructor->args)); constructor = d3dcompiler_alloc(sizeof(*constructor)); constructor->node.type = HLSL_IR_CONSTRUCTOR; set_location(&constructor->node.loc, &(yylsp[-2])); constructor->node.data_type = (yyvsp[-3].type); - constructor->arguments = (yyvsp[-1].list); - + constructor->args_count = (yyvsp[-1].initializer).args_count; + memcpy(constructor->args, (yyvsp[-1].initializer).args, (yyvsp[-1].initializer).args_count * sizeof(*(yyvsp[-1].initializer).args)); + d3dcompiler_free((yyvsp[-1].initializer).args); (yyval.instr) = &constructor->node; } -#line 4069 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4067 "hlsl.tab.c" break; - case 122: -#line 2137 "hlsl.y" /* yacc.c:1646 */ + case 121: +#line 2111 "hlsl.y" { (yyval.instr) = (yyvsp[0].instr); } -#line 4077 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4075 "hlsl.tab.c" + break; + + case 122: +#line 2115 "hlsl.y" + { + struct source_location loc; + + set_location(&loc, &(yylsp[-1])); + if ((yyvsp[0].instr)->data_type->modifiers & HLSL_MODIFIER_CONST) + { + hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, + "modifying a const expression"); + YYABORT; + } + (yyval.instr) = new_unary_expr(HLSL_IR_UNOP_PREINC, (yyvsp[0].instr), loc); + } +#line 4092 "hlsl.tab.c" break; case 123: -#line 2141 "hlsl.y" /* yacc.c:1646 */ +#line 2128 "hlsl.y" { - struct hlsl_ir_node *operands[3]; struct source_location loc; set_location(&loc, &(yylsp[-1])); @@ -4087,41 +4101,18 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "modifying a const expression"); - return 1; + YYABORT; } - operands[0] = (yyvsp[0].instr); - operands[1] = operands[2] = NULL; - (yyval.instr) = &new_expr(HLSL_IR_UNOP_PREINC, operands, &loc)->node; + (yyval.instr) = new_unary_expr(HLSL_IR_UNOP_PREDEC, (yyvsp[0].instr), loc); } -#line 4097 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4109 "hlsl.tab.c" break; case 124: -#line 2157 "hlsl.y" /* yacc.c:1646 */ - { - struct hlsl_ir_node *operands[3]; - struct source_location loc; - - set_location(&loc, &(yylsp[-1])); - if ((yyvsp[0].instr)->data_type->modifiers & HLSL_MODIFIER_CONST) - { - hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, - "modifying a const expression"); - return 1; - } - operands[0] = (yyvsp[0].instr); - operands[1] = operands[2] = NULL; - (yyval.instr) = &new_expr(HLSL_IR_UNOP_PREDEC, operands, &loc)->node; - } -#line 4117 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 125: -#line 2173 "hlsl.y" /* yacc.c:1646 */ +#line 2141 "hlsl.y" { enum hlsl_ir_expr_op ops[] = {0, HLSL_IR_UNOP_NEG, HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_BIT_NOT}; - struct hlsl_ir_node *operands[3]; struct source_location loc; if ((yyvsp[-1].unary_op) == UNARY_OP_PLUS) @@ -4130,17 +4121,15 @@ yyreduce: } else { - operands[0] = (yyvsp[0].instr); - operands[1] = operands[2] = NULL; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &new_expr(ops[(yyvsp[-1].unary_op)], operands, &loc)->node; + (yyval.instr) = new_unary_expr(ops[(yyvsp[-1].unary_op)], (yyvsp[0].instr), loc); } } -#line 4140 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4129 "hlsl.tab.c" break; - case 126: -#line 2193 "hlsl.y" /* yacc.c:1646 */ + case 125: +#line 2158 "hlsl.y" { struct hlsl_ir_expr *expr; struct hlsl_type *src_type = (yyvsp[0].instr)->data_type; @@ -4152,7 +4141,7 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "unexpected modifier in a cast"); - return 1; + YYABORT; } if ((yyvsp[-2].intval)) @@ -4165,330 +4154,330 @@ yyreduce: hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "can't cast from %s to %s", debug_hlsl_type(src_type), debug_hlsl_type(dst_type)); - return 1; + YYABORT; } expr = new_cast((yyvsp[0].instr), dst_type, &loc); (yyval.instr) = expr ? &expr->node : NULL; } -#line 4175 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4164 "hlsl.tab.c" break; - case 127: -#line 2225 "hlsl.y" /* yacc.c:1646 */ + case 126: +#line 2190 "hlsl.y" { (yyval.unary_op) = UNARY_OP_PLUS; } -#line 4183 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4172 "hlsl.tab.c" break; - case 128: -#line 2229 "hlsl.y" /* yacc.c:1646 */ + case 127: +#line 2194 "hlsl.y" { (yyval.unary_op) = UNARY_OP_MINUS; } -#line 4191 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4180 "hlsl.tab.c" break; - case 129: -#line 2233 "hlsl.y" /* yacc.c:1646 */ + case 128: +#line 2198 "hlsl.y" { (yyval.unary_op) = UNARY_OP_LOGICNOT; } -#line 4199 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4188 "hlsl.tab.c" break; - case 130: -#line 2237 "hlsl.y" /* yacc.c:1646 */ + case 129: +#line 2202 "hlsl.y" { (yyval.unary_op) = UNARY_OP_BITNOT; } -#line 4207 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4196 "hlsl.tab.c" + break; + + case 130: +#line 2207 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4204 "hlsl.tab.c" break; case 131: -#line 2242 "hlsl.y" /* yacc.c:1646 */ +#line 2211 "hlsl.y" { - (yyval.instr) = (yyvsp[0].instr); + struct source_location loc; + + set_location(&loc, &(yylsp[-1])); + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_MUL, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4215 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4215 "hlsl.tab.c" break; case 132: -#line 2246 "hlsl.y" /* yacc.c:1646 */ +#line 2218 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_mul((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_DIV, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4226 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4226 "hlsl.tab.c" break; case 133: -#line 2253 "hlsl.y" /* yacc.c:1646 */ +#line 2225 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_div((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_MOD, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4237 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4237 "hlsl.tab.c" break; case 134: -#line 2260 "hlsl.y" /* yacc.c:1646 */ +#line 2233 "hlsl.y" { - struct source_location loc; - - set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_mod((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = (yyvsp[0].instr); } -#line 4248 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4245 "hlsl.tab.c" break; case 135: -#line 2268 "hlsl.y" /* yacc.c:1646 */ +#line 2237 "hlsl.y" { - (yyval.instr) = (yyvsp[0].instr); + struct source_location loc; + + set_location(&loc, &(yylsp[-1])); + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_ADD, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4256 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4256 "hlsl.tab.c" break; case 136: -#line 2272 "hlsl.y" /* yacc.c:1646 */ +#line 2244 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_add((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_SUB, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4267 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4267 "hlsl.tab.c" break; case 137: -#line 2279 "hlsl.y" /* yacc.c:1646 */ +#line 2252 "hlsl.y" { - struct source_location loc; - - set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_sub((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = (yyvsp[0].instr); } -#line 4278 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4275 "hlsl.tab.c" break; case 138: -#line 2287 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4286 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 139: -#line 2291 "hlsl.y" /* yacc.c:1646 */ +#line 2256 "hlsl.y" { FIXME("Left shift\n"); } -#line 4294 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4283 "hlsl.tab.c" break; - case 140: -#line 2295 "hlsl.y" /* yacc.c:1646 */ + case 139: +#line 2260 "hlsl.y" { FIXME("Right shift\n"); } -#line 4302 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4291 "hlsl.tab.c" + break; + + case 140: +#line 2265 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4299 "hlsl.tab.c" break; case 141: -#line 2300 "hlsl.y" /* yacc.c:1646 */ +#line 2269 "hlsl.y" { - (yyval.instr) = (yyvsp[0].instr); + struct source_location loc; + + set_location(&loc, &(yylsp[-1])); + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_LESS, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4310 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4310 "hlsl.tab.c" break; case 142: -#line 2304 "hlsl.y" /* yacc.c:1646 */ +#line 2276 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_lt((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_GREATER, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4321 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4321 "hlsl.tab.c" break; case 143: -#line 2311 "hlsl.y" /* yacc.c:1646 */ +#line 2283 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_gt((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_LEQUAL, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4332 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4332 "hlsl.tab.c" break; case 144: -#line 2318 "hlsl.y" /* yacc.c:1646 */ +#line 2290 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_le((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_GEQUAL, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4343 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4343 "hlsl.tab.c" break; case 145: -#line 2325 "hlsl.y" /* yacc.c:1646 */ +#line 2298 "hlsl.y" { - struct source_location loc; - - set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_ge((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = (yyvsp[0].instr); } -#line 4354 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4351 "hlsl.tab.c" break; case 146: -#line 2333 "hlsl.y" /* yacc.c:1646 */ +#line 2302 "hlsl.y" { - (yyval.instr) = (yyvsp[0].instr); + struct source_location loc; + + set_location(&loc, &(yylsp[-1])); + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_EQUAL, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4362 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4362 "hlsl.tab.c" break; case 147: -#line 2337 "hlsl.y" /* yacc.c:1646 */ +#line 2309 "hlsl.y" { struct source_location loc; set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_eq((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = new_binary_expr(HLSL_IR_BINOP_NEQUAL, (yyvsp[-2].instr), (yyvsp[0].instr), loc); } -#line 4373 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4373 "hlsl.tab.c" break; case 148: -#line 2344 "hlsl.y" /* yacc.c:1646 */ +#line 2317 "hlsl.y" { - struct source_location loc; - - set_location(&loc, &(yylsp[-1])); - (yyval.instr) = &hlsl_ne((yyvsp[-2].instr), (yyvsp[0].instr), &loc)->node; + (yyval.instr) = (yyvsp[0].instr); } -#line 4384 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4381 "hlsl.tab.c" break; case 149: -#line 2352 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4392 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 150: -#line 2356 "hlsl.y" /* yacc.c:1646 */ +#line 2321 "hlsl.y" { FIXME("bitwise AND\n"); } -#line 4400 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4389 "hlsl.tab.c" + break; + + case 150: +#line 2326 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4397 "hlsl.tab.c" break; case 151: -#line 2361 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4408 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 152: -#line 2365 "hlsl.y" /* yacc.c:1646 */ +#line 2330 "hlsl.y" { FIXME("bitwise XOR\n"); } -#line 4416 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4405 "hlsl.tab.c" + break; + + case 152: +#line 2335 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4413 "hlsl.tab.c" break; case 153: -#line 2370 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4424 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 154: -#line 2374 "hlsl.y" /* yacc.c:1646 */ +#line 2339 "hlsl.y" { FIXME("bitwise OR\n"); } -#line 4432 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4421 "hlsl.tab.c" + break; + + case 154: +#line 2344 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4429 "hlsl.tab.c" break; case 155: -#line 2379 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4440 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 156: -#line 2383 "hlsl.y" /* yacc.c:1646 */ +#line 2348 "hlsl.y" { FIXME("logic AND\n"); } -#line 4448 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4437 "hlsl.tab.c" + break; + + case 156: +#line 2353 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4445 "hlsl.tab.c" break; case 157: -#line 2388 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4456 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 158: -#line 2392 "hlsl.y" /* yacc.c:1646 */ +#line 2357 "hlsl.y" { FIXME("logic OR\n"); } -#line 4464 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4453 "hlsl.tab.c" + break; + + case 158: +#line 2362 "hlsl.y" + { + (yyval.instr) = (yyvsp[0].instr); + } +#line 4461 "hlsl.tab.c" break; case 159: -#line 2397 "hlsl.y" /* yacc.c:1646 */ - { - (yyval.instr) = (yyvsp[0].instr); - } -#line 4472 "hlsl.tab.c" /* yacc.c:1646 */ - break; - - case 160: -#line 2401 "hlsl.y" /* yacc.c:1646 */ +#line 2366 "hlsl.y" { FIXME("ternary operator\n"); } -#line 4480 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4469 "hlsl.tab.c" break; - case 161: -#line 2406 "hlsl.y" /* yacc.c:1646 */ + case 160: +#line 2371 "hlsl.y" { (yyval.instr) = (yyvsp[0].instr); } -#line 4488 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4477 "hlsl.tab.c" break; - case 162: -#line 2410 "hlsl.y" /* yacc.c:1646 */ + case 161: +#line 2375 "hlsl.y" { struct source_location loc; @@ -4497,122 +4486,123 @@ yyreduce: { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "l-value is const"); - return 1; + YYABORT; } (yyval.instr) = make_assignment((yyvsp[-2].instr), (yyvsp[-1].assign_op), BWRITERSP_WRITEMASK_ALL, (yyvsp[0].instr)); if (!(yyval.instr)) - return 1; + YYABORT; (yyval.instr)->loc = loc; } -#line 4508 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4497 "hlsl.tab.c" break; - case 163: -#line 2427 "hlsl.y" /* yacc.c:1646 */ + case 162: +#line 2392 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_ASSIGN; } -#line 4516 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4505 "hlsl.tab.c" break; - case 164: -#line 2431 "hlsl.y" /* yacc.c:1646 */ + case 163: +#line 2396 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_ADD; } -#line 4524 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4513 "hlsl.tab.c" break; - case 165: -#line 2435 "hlsl.y" /* yacc.c:1646 */ + case 164: +#line 2400 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_SUB; } -#line 4532 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4521 "hlsl.tab.c" break; - case 166: -#line 2439 "hlsl.y" /* yacc.c:1646 */ + case 165: +#line 2404 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_MUL; } -#line 4540 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4529 "hlsl.tab.c" break; - case 167: -#line 2443 "hlsl.y" /* yacc.c:1646 */ + case 166: +#line 2408 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_DIV; } -#line 4548 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4537 "hlsl.tab.c" break; - case 168: -#line 2447 "hlsl.y" /* yacc.c:1646 */ + case 167: +#line 2412 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_MOD; } -#line 4556 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4545 "hlsl.tab.c" break; - case 169: -#line 2451 "hlsl.y" /* yacc.c:1646 */ + case 168: +#line 2416 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_LSHIFT; } -#line 4564 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4553 "hlsl.tab.c" break; - case 170: -#line 2455 "hlsl.y" /* yacc.c:1646 */ + case 169: +#line 2420 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_RSHIFT; } -#line 4572 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4561 "hlsl.tab.c" break; - case 171: -#line 2459 "hlsl.y" /* yacc.c:1646 */ + case 170: +#line 2424 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_AND; } -#line 4580 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4569 "hlsl.tab.c" break; - case 172: -#line 2463 "hlsl.y" /* yacc.c:1646 */ + case 171: +#line 2428 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_OR; } -#line 4588 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4577 "hlsl.tab.c" break; - case 173: -#line 2467 "hlsl.y" /* yacc.c:1646 */ + case 172: +#line 2432 "hlsl.y" { (yyval.assign_op) = ASSIGN_OP_XOR; } -#line 4596 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4585 "hlsl.tab.c" break; - case 174: -#line 2472 "hlsl.y" /* yacc.c:1646 */ + case 173: +#line 2437 "hlsl.y" { (yyval.instr) = (yyvsp[0].instr); } -#line 4604 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4593 "hlsl.tab.c" break; - case 175: -#line 2476 "hlsl.y" /* yacc.c:1646 */ + case 174: +#line 2441 "hlsl.y" { FIXME("Comma expression\n"); } -#line 4612 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4601 "hlsl.tab.c" break; -#line 4616 "hlsl.tab.c" /* yacc.c:1646 */ +#line 4605 "hlsl.tab.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4638,14 +4628,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -4728,14 +4717,11 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -4801,6 +4787,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -4808,6 +4795,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -4818,6 +4806,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -4847,7 +4839,7 @@ yyreturn: #endif return yyresult; } -#line 2480 "hlsl.y" /* yacc.c:1906 */ +#line 2445 "hlsl.y" static void set_location(struct source_location *loc, const struct YYLTYPE *l) diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.tab.h b/dll/directx/wine/d3dcompiler_43/hlsl.tab.h index 9a15a5ebb3c..e2f1a686bf1 100644 --- a/dll/directx/wine/d3dcompiler_43/hlsl.tab.h +++ b/dll/directx/wine/d3dcompiler_43/hlsl.tab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + #ifndef YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED # define YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED /* Debug traces. */ @@ -152,10 +156,9 @@ extern int hlsl_debug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 910 "hlsl.y" /* yacc.c:1909 */ +#line 890 "hlsl.y" struct hlsl_type *type; INT intval; @@ -163,11 +166,11 @@ union YYSTYPE BOOL boolval; char *name; DWORD modifiers; - struct hlsl_ir_var *var; struct hlsl_ir_node *instr; struct list *list; struct parse_function function; struct parse_parameter parameter; + struct parse_initializer initializer; struct parse_variable_def *variable_def; struct parse_if_body if_body; enum parse_unary_op unary_op; @@ -175,8 +178,10 @@ union YYSTYPE struct reg_reservation *reg_reservation; struct parse_colon_attribute colon_attribute; -#line 179 "hlsl.tab.h" /* yacc.c:1909 */ +#line 182 "hlsl.tab.h" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.y b/dll/directx/wine/d3dcompiler_43/hlsl.y index c2c415f8585..d81d6afa9cc 100644 --- a/dll/directx/wine/d3dcompiler_43/hlsl.y +++ b/dll/directx/wine/d3dcompiler_43/hlsl.y @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ %{ -#include "config.h" #include "wine/debug.h" #include @@ -35,13 +34,13 @@ struct hlsl_parse_ctx hlsl_ctx; struct YYLTYPE; static void set_location(struct source_location *loc, const struct YYLTYPE *l); -void hlsl_message(const char *fmt, ...) +void WINAPIV hlsl_message(const char *fmt, ...) { - va_list args; + __ms_va_list args; - va_start(args, fmt); + __ms_va_start(args, fmt); compilation_message(&hlsl_ctx.messages, fmt, args); - va_end(args); + __ms_va_end(args); } static const char *hlsl_get_error_level_name(enum hlsl_error_level level) @@ -55,18 +54,18 @@ static const char *hlsl_get_error_level_name(enum hlsl_error_level level) return names[level]; } -void hlsl_report_message(const char *filename, DWORD line, DWORD column, +void WINAPIV hlsl_report_message(const char *filename, DWORD line, DWORD column, enum hlsl_error_level level, const char *fmt, ...) { - va_list args; + __ms_va_list args; char *string = NULL; int rc, size = 0; while (1) { - va_start(args, fmt); + __ms_va_start(args, fmt); rc = vsnprintf(string, size, fmt, args); - va_end(args); + __ms_va_end(args); if (rc >= 0 && rc < size) break; @@ -123,7 +122,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) BOOL ret; TRACE("Declaring variable %s.\n", decl->name); - if (decl->node.data_type->type == HLSL_CLASS_MATRIX) + if (decl->data_type->type == HLSL_CLASS_MATRIX) { if (!(decl->modifiers & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR))) { @@ -132,7 +131,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) } } else - check_invalid_matrix_modifiers(decl->modifiers, &decl->node.loc); + check_invalid_matrix_modifiers(decl->modifiers, &decl->loc); if (local) { @@ -140,12 +139,12 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) | HLSL_STORAGE_GROUPSHARED | HLSL_STORAGE_UNIFORM); if (invalid) { - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "modifier '%s' invalid for local variables", debug_modifiers(invalid)); } if (decl->semantic) { - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "semantics are not allowed on local variables"); return FALSE; } @@ -154,7 +153,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) { if (find_function(decl->name)) { - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "redefinition of '%s'", decl->name); return FALSE; } @@ -164,9 +163,9 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) { struct hlsl_ir_var *old = get_variable(hlsl_ctx.cur_scope, decl->name); - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR, "\"%s\" already declared", decl->name); - hlsl_report_message(old->node.loc.file, old->node.loc.line, old->node.loc.col, HLSL_LEVEL_NOTE, + hlsl_report_message(old->loc.file, old->loc.line, old->loc.col, HLSL_LEVEL_NOTE, "\"%s\" was previously declared here", old->name); return FALSE; } @@ -258,9 +257,8 @@ static void declare_predefined_types(struct hlsl_scope *scope) static struct hlsl_ir_if *loop_condition(struct list *cond_list) { + struct hlsl_ir_node *cond, *not_cond; struct hlsl_ir_if *out_cond; - struct hlsl_ir_expr *not_cond; - struct hlsl_ir_node *cond, *operands[3]; struct hlsl_ir_jump *jump; unsigned int count = list_count(cond_list); @@ -277,16 +275,13 @@ static struct hlsl_ir_if *loop_condition(struct list *cond_list) return NULL; } out_cond->node.type = HLSL_IR_IF; - operands[0] = cond; - operands[1] = operands[2] = NULL; - not_cond = new_expr(HLSL_IR_UNOP_LOGIC_NOT, operands, &cond->loc); - if (!not_cond) + if (!(not_cond = new_unary_expr(HLSL_IR_UNOP_LOGIC_NOT, cond, cond->loc))) { ERR("Out of memory.\n"); d3dcompiler_free(out_cond); return NULL; } - out_cond->condition = ¬_cond->node; + out_cond->condition = not_cond; jump = d3dcompiler_alloc(sizeof(*jump)); if (!jump) { @@ -379,29 +374,24 @@ oom: return NULL; } -static unsigned int initializer_size(struct list *initializer) +static unsigned int initializer_size(const struct parse_initializer *initializer) { - unsigned int count = 0; - struct hlsl_ir_node *node; + unsigned int count = 0, i; - LIST_FOR_EACH_ENTRY(node, initializer, struct hlsl_ir_node, entry) + for (i = 0; i < initializer->args_count; ++i) { - count += components_count_type(node->data_type); + count += components_count_type(initializer->args[i]->data_type); } - TRACE("Initializer size = %u\n", count); + TRACE("Initializer size = %u.\n", count); return count; } -static unsigned int components_count_expr_list(struct list *list) +static void free_parse_initializer(struct parse_initializer *initializer) { - struct hlsl_ir_node *node; - unsigned int count = 0; - - LIST_FOR_EACH_ENTRY(node, list, struct hlsl_ir_node, entry) - { - count += components_count_type(node->data_type); - } - return count; + unsigned int i; + for (i = 0; i < initializer->args_count; ++i) + free_instr(initializer->args[i]); + d3dcompiler_free(initializer->args); } static struct hlsl_ir_swizzle *new_swizzle(DWORD s, unsigned int components, @@ -501,35 +491,35 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha return NULL; } -static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, struct list *initializer) +static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, + struct parse_initializer *initializer) { - struct hlsl_type *type = var->node.data_type; - struct hlsl_ir_node *node; + struct hlsl_type *type = var->data_type; struct hlsl_struct_field *field; - struct list *cur_node; struct hlsl_ir_node *assignment; struct hlsl_ir_deref *deref; + unsigned int i = 0; if (initializer_size(initializer) != components_count_type(type)) { - hlsl_report_message(var->node.loc.file, var->node.loc.line, var->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message(var->loc.file, var->loc.line, var->loc.col, HLSL_LEVEL_ERROR, "structure initializer mismatch"); - free_instr_list(initializer); + free_parse_initializer(initializer); return; } - cur_node = list_head(initializer); - assert(cur_node); - node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry); + LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry) { - if (!cur_node) + struct hlsl_ir_node *node = initializer->args[i]; + + if (i++ >= initializer->args_count) { - d3dcompiler_free(initializer); + d3dcompiler_free(initializer->args); return; } if (components_count_type(field->type) == components_count_type(node->data_type)) { - deref = new_record_deref(&var->node, field); + deref = new_record_deref(&new_var_deref(var)->node, field); if (!deref) { ERR("Out of memory.\n"); @@ -541,19 +531,12 @@ static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, s } else FIXME("Initializing with \"mismatched\" fields is not supported yet.\n"); - cur_node = list_next(initializer, cur_node); - node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry); } /* Free initializer elements in excess. */ - while (cur_node) - { - struct list *next = list_next(initializer, cur_node); - free_instr(node); - cur_node = next; - node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry); - } - d3dcompiler_free(initializer); + for (; i < initializer->args_count; ++i) + free_instr(initializer->args[i]); + d3dcompiler_free(initializer->args); } static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, struct list *var_list) @@ -587,13 +570,12 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, d3dcompiler_free(v); continue; } - var->node.type = HLSL_IR_VAR; if (v->array_size) type = new_array_type(basic_type, v->array_size); else type = basic_type; - var->node.data_type = type; - var->node.loc = v->loc; + var->data_type = type; + var->loc = v->loc; var->name = v->name; var->modifiers = modifiers; var->semantic = v->semantic; @@ -606,7 +588,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, local = FALSE; } - if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer) + if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer.args_count) { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "const variable without initializer"); @@ -624,10 +606,9 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, } TRACE("Declared variable %s.\n", var->name); - if (v->initializer) + if (v->initializer.args_count) { - unsigned int size = initializer_size(v->initializer); - struct hlsl_ir_node *node; + unsigned int size = initializer_size(&v->initializer); TRACE("Variable with initializer.\n"); if (type->type <= HLSL_CLASS_LAST_NUMERIC @@ -637,7 +618,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "'%s' initializer does not match", v->name); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } @@ -647,43 +628,43 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "'%s' initializer does not match", v->name); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } if (type->type == HLSL_CLASS_STRUCT) { - struct_var_initializer(statements_list, var, v->initializer); + struct_var_initializer(statements_list, var, &v->initializer); d3dcompiler_free(v); continue; } if (type->type > HLSL_CLASS_LAST_NUMERIC) { FIXME("Initializers for non scalar/struct variables not supported yet.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } if (v->array_size > 0) { FIXME("Initializing arrays is not supported yet.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } - if (list_count(v->initializer) > 1) + if (v->initializer.args_count > 1) { FIXME("Complex initializers are not supported yet.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); d3dcompiler_free(v); continue; } - node = LIST_ENTRY(list_head(v->initializer), struct hlsl_ir_node, entry); - assignment = make_assignment(&var->node, ASSIGN_OP_ASSIGN, - BWRITERSP_WRITEMASK_ALL, node); + + assignment = make_assignment(&new_var_deref(var)->node, ASSIGN_OP_ASSIGN, + BWRITERSP_WRITEMASK_ALL, v->initializer.args[0]); + d3dcompiler_free(v->initializer.args); list_add_tail(statements_list, &assignment->entry); - d3dcompiler_free(v->initializer); } d3dcompiler_free(v); } @@ -731,11 +712,11 @@ static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, s field->name = v->name; field->modifiers = modifiers; field->semantic = v->semantic; - if (v->initializer) + if (v->initializer.args_count) { hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR, "struct field with an initializer.\n"); - free_instr_list(v->initializer); + free_parse_initializer(&v->initializer); } list_add_tail(list, &field->entry); d3dcompiler_free(v); @@ -818,9 +799,8 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param, ERR("Out of memory.\n"); return FALSE; } - decl->node.type = HLSL_IR_VAR; - decl->node.data_type = param->type; - decl->node.loc = *loc; + decl->data_type = param->type; + decl->loc = *loc; decl->name = param->name; decl->semantic = param->semantic; decl->reg_reservation = param->reg_reservation; @@ -831,7 +811,7 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param, free_declaration(decl); return FALSE; } - list_add_tail(list, &decl->node.entry); + list_add_tail(list, &decl->param_entry); return TRUE; } @@ -903,7 +883,7 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr %} %locations -%error-verbose +%define parse.error verbose %expect 1 %union @@ -914,11 +894,11 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr BOOL boolval; char *name; DWORD modifiers; - struct hlsl_ir_var *var; struct hlsl_ir_node *instr; struct list *list; struct parse_function function; struct parse_parameter parameter; + struct parse_initializer initializer; struct parse_variable_def *variable_def; struct parse_if_body if_body; enum parse_unary_op unary_op; @@ -1042,15 +1022,14 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr %type unnamed_struct_spec %type type_specs %type type_spec -%type complex_initializer -%type initializer_expr_list +%type complex_initializer +%type initializer_expr_list %type initializer_expr %type var_modifiers %type field %type parameters %type param_list %type expr -%type variable %type array %type statement %type statement_list @@ -1103,28 +1082,28 @@ hlsl_prog: /* empty */ { if (decl->body && $2.decl->body) { - hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line, - $2.decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message($2.decl->loc.file, $2.decl->loc.line, + $2.decl->loc.col, HLSL_LEVEL_ERROR, "redefinition of function %s", debugstr_a($2.name)); - return 1; + YYABORT; } - else if (!compare_hlsl_types(decl->node.data_type, $2.decl->node.data_type)) + else if (!compare_hlsl_types(decl->return_type, $2.decl->return_type)) { - hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line, - $2.decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message($2.decl->loc.file, $2.decl->loc.line, + $2.decl->loc.col, HLSL_LEVEL_ERROR, "redefining function %s with a different return type", debugstr_a($2.name)); - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_NOTE, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_NOTE, "%s previously declared here", debugstr_a($2.name)); - return 1; + YYABORT; } } - if ($2.decl->node.data_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic) + if ($2.decl->return_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic) { - hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line, - $2.decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message($2.decl->loc.file, $2.decl->loc.line, + $2.decl->loc.col, HLSL_LEVEL_ERROR, "void function with a semantic"); } @@ -1199,7 +1178,7 @@ named_struct_spec: var_modifiers KW_STRUCT any_identifier '{' fields_list { hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column, HLSL_LEVEL_ERROR, "redefinition of '%s'", $3); - return 1; + YYABORT; } ret = add_type_to_scope(hlsl_ctx.cur_scope, $$); @@ -1207,7 +1186,7 @@ named_struct_spec: var_modifiers KW_STRUCT any_identifier '{' fields_list { hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column, HLSL_LEVEL_ERROR, "redefinition of struct '%s'", $3); - return 1; + YYABORT; } } @@ -1278,7 +1257,7 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c { hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column, HLSL_LEVEL_ERROR, "redefinition of '%s'\n", $3); - return 1; + YYABORT; } if ($2->base_type == HLSL_TYPE_VOID && $7.semantic) { @@ -1295,11 +1274,11 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c if (!$$.decl) { ERR("Out of memory.\n"); - return -1; + YYABORT; } $$.name = $3; $$.decl->semantic = $7.semantic; - set_location(&$$.decl->node.loc, &@3); + set_location(&$$.decl->loc, &@3); } compound_statement: '{' '}' @@ -1378,7 +1357,7 @@ param_list: parameter { ERR("Error adding function parameter %s.\n", $1.name); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } } | param_list ',' parameter @@ -1391,7 +1370,7 @@ param_list: parameter { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "duplicate parameter %s", $3.name); - return 1; + YYABORT; } } @@ -1415,7 +1394,7 @@ input_mods: /* Empty */ { hlsl_report_message(hlsl_ctx.source_file, @2.first_line, @2.first_column, HLSL_LEVEL_ERROR, "duplicate input-output modifiers"); - return 1; + YYABORT; } $$ = $1 | $2; } @@ -1444,14 +1423,14 @@ type: base_type hlsl_message("Line %u: vectors of non-scalar types are not allowed.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } if ($5 < 1 || $5 > 4) { hlsl_message("Line %u: vector size must be between 1 and 4.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } $$ = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1); @@ -1463,14 +1442,14 @@ type: base_type hlsl_message("Line %u: matrices of non-scalar types are not allowed.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } if ($5 < 1 || $5 > 4 || $7 < 1 || $7 > 4) { hlsl_message("Line %u: matrix dimensions must be between 1 and 4.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; + YYABORT; } $$ = new_hlsl_type(NULL, HLSL_CLASS_MATRIX, $3->base_type, $5, $7); @@ -1539,7 +1518,7 @@ declaration_statement: declaration if (!$$) { ERR("Out of memory\n"); - return -1; + YYABORT; } list_init($$); } @@ -1550,7 +1529,7 @@ typedef: KW_TYPEDEF var_modifiers type type_specs ';' set_location(&loc, &@1); if (!add_typedef($2, $3, $4, &loc)) - return 1; + YYABORT; } | KW_TYPEDEF struct_spec type_specs ';' { @@ -1558,7 +1537,7 @@ typedef: KW_TYPEDEF var_modifiers type type_specs ';' set_location(&loc, &@1); if (!add_typedef(0, $2, $3, &loc)) - return 1; + YYABORT; } type_specs: type_spec @@ -1690,9 +1669,10 @@ var_modifiers: /* Empty */ complex_initializer: initializer_expr { - $$ = d3dcompiler_alloc(sizeof(*$$)); - list_init($$); - list_add_head($$, &$1->entry); + $$.args_count = 1; + if (!($$.args = d3dcompiler_alloc(sizeof(*$$.args)))) + YYABORT; + $$.args[0] = $1; } | '{' initializer_expr_list '}' { @@ -1710,14 +1690,17 @@ initializer_expr: assignment_expr initializer_expr_list: initializer_expr { - $$ = d3dcompiler_alloc(sizeof(*$$)); - list_init($$); - list_add_head($$, &$1->entry); + $$.args_count = 1; + if (!($$.args = d3dcompiler_alloc(sizeof(*$$.args)))) + YYABORT; + $$.args[0] = $1; } | initializer_expr_list ',' initializer_expr { $$ = $1; - list_add_tail($$, &$3->entry); + if (!($$.args = d3dcompiler_realloc($$.args, ($$.args_count + 1) * sizeof(*$$.args)))) + YYABORT; + $$.args[$$.args_count++] = $3; } boolean: KW_TRUE @@ -1754,7 +1737,7 @@ jump_statement: KW_RETURN expr ';' if (!jump) { ERR("Out of memory\n"); - return -1; + YYABORT; } jump->node.type = HLSL_IR_JUMP; set_location(&jump->node.loc, &@1); @@ -1777,7 +1760,7 @@ selection_statement: KW_IF '(' expr ')' if_body if (!instr) { ERR("Out of memory\n"); - return -1; + YYABORT; } instr->node.type = HLSL_IR_IF; set_location(&instr->node.loc, &@1); @@ -1814,7 +1797,7 @@ loop_statement: KW_WHILE '(' expr ')' statement if (!cond) { ERR("Out of memory.\n"); - return -1; + YYABORT; } list_init(cond); list_add_head(cond, &$3->entry); @@ -1829,7 +1812,7 @@ loop_statement: KW_WHILE '(' expr ')' statement if (!cond) { ERR("Out of memory.\n"); - return -1; + YYABORT; } list_init(cond); list_add_head(cond, &$5->entry); @@ -1875,7 +1858,7 @@ primary_expr: C_FLOAT if (!c) { ERR("Out of memory.\n"); - return -1; + YYABORT; } c->node.type = HLSL_IR_CONSTANT; set_location(&c->node.loc, &yylloc); @@ -1889,7 +1872,7 @@ primary_expr: C_FLOAT if (!c) { ERR("Out of memory.\n"); - return -1; + YYABORT; } c->node.type = HLSL_IR_CONSTANT; set_location(&c->node.loc, &yylloc); @@ -1903,7 +1886,7 @@ primary_expr: C_FLOAT if (!c) { ERR("Out of memory.\n"); - return -1; + YYABORT; } c->node.type = HLSL_IR_CONSTANT; set_location(&c->node.loc, &yylloc); @@ -1911,10 +1894,19 @@ primary_expr: C_FLOAT c->v.value.b[0] = $1; $$ = &c->node; } - | variable + | VAR_IDENTIFIER { - struct hlsl_ir_deref *deref = new_var_deref($1); - if (deref) + struct hlsl_ir_deref *deref; + struct hlsl_ir_var *var; + + if (!(var = get_variable(hlsl_ctx.cur_scope, $1))) + { + hlsl_message("Line %d: variable '%s' not declared\n", + hlsl_ctx.line_no, $1); + set_parse_status(&hlsl_ctx.status, PARSE_ERR); + YYABORT; + } + if ((deref = new_var_deref(var))) { $$ = &deref->node; set_location(&$$->loc, &@1); @@ -1927,27 +1919,12 @@ primary_expr: C_FLOAT $$ = $2; } -variable: VAR_IDENTIFIER - { - struct hlsl_ir_var *var; - var = get_variable(hlsl_ctx.cur_scope, $1); - if (!var) - { - hlsl_message("Line %d: variable '%s' not declared\n", - hlsl_ctx.line_no, $1); - set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return 1; - } - $$ = var; - } - postfix_expr: primary_expr { $$ = $1; } | postfix_expr OP_INC { - struct hlsl_ir_node *operands[3]; struct source_location loc; set_location(&loc, &@2); @@ -1955,18 +1932,15 @@ postfix_expr: primary_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "modifying a const expression"); - return 1; + YYABORT; } - operands[0] = $1; - operands[1] = operands[2] = NULL; - $$ = &new_expr(HLSL_IR_UNOP_POSTINC, operands, &loc)->node; + $$ = new_unary_expr(HLSL_IR_UNOP_POSTINC, $1, loc); /* Post increment/decrement expressions are considered const */ $$->data_type = clone_hlsl_type($$->data_type); $$->data_type->modifiers |= HLSL_MODIFIER_CONST; } | postfix_expr OP_DEC { - struct hlsl_ir_node *operands[3]; struct source_location loc; set_location(&loc, &@2); @@ -1974,11 +1948,9 @@ postfix_expr: primary_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "modifying a const expression"); - return 1; + YYABORT; } - operands[0] = $1; - operands[1] = operands[2] = NULL; - $$ = &new_expr(HLSL_IR_UNOP_POSTDEC, operands, &loc)->node; + $$ = new_unary_expr(HLSL_IR_UNOP_POSTDEC, $1, loc); /* Post increment/decrement expressions are considered const */ $$->data_type = clone_hlsl_type($$->data_type); $$->data_type->modifiers |= HLSL_MODIFIER_CONST; @@ -2003,7 +1975,7 @@ postfix_expr: primary_expr if (!deref) { ERR("Out of memory\n"); - return -1; + YYABORT; } deref->node.loc = loc; $$ = &deref->node; @@ -2014,7 +1986,7 @@ postfix_expr: primary_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "invalid subscript %s", debugstr_a($3)); - return 1; + YYABORT; } } else if ($1->data_type->type <= HLSL_CLASS_LAST_NUMERIC) @@ -2026,7 +1998,7 @@ postfix_expr: primary_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "invalid swizzle %s", debugstr_a($3)); - return 1; + YYABORT; } $$ = &swizzle->node; } @@ -2034,7 +2006,7 @@ postfix_expr: primary_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "invalid subscript %s", debugstr_a($3)); - return 1; + YYABORT; } } | postfix_expr '[' expr ']' @@ -2050,7 +2022,7 @@ postfix_expr: primary_expr if (!deref) { ERR("Out of memory\n"); - return -1; + YYABORT; } deref->node.type = HLSL_IR_DEREF; set_location(&loc, &@2); @@ -2078,7 +2050,7 @@ postfix_expr: primary_expr d3dcompiler_free(deref); free_instr($1); free_instr($3); - return 1; + YYABORT; } if ($3->data_type->type != HLSL_CLASS_SCALAR) { @@ -2087,7 +2059,7 @@ postfix_expr: primary_expr d3dcompiler_free(deref); free_instr($1); free_instr($3); - return 1; + YYABORT; } deref->type = HLSL_IR_DEREF_ARRAY; deref->v.array.array = $1; @@ -2107,29 +2079,31 @@ postfix_expr: primary_expr hlsl_message("Line %u: unexpected modifier in a constructor.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } if ($2->type > HLSL_CLASS_LAST_NUMERIC) { hlsl_message("Line %u: constructors are allowed only for numeric data types.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } - if ($2->dimx * $2->dimy != components_count_expr_list($4)) + if ($2->dimx * $2->dimy != initializer_size(&$4)) { hlsl_message("Line %u: wrong number of components in constructor.\n", hlsl_ctx.line_no); set_parse_status(&hlsl_ctx.status, PARSE_ERR); - return -1; + YYABORT; } + assert($4.args_count <= ARRAY_SIZE(constructor->args)); constructor = d3dcompiler_alloc(sizeof(*constructor)); constructor->node.type = HLSL_IR_CONSTRUCTOR; set_location(&constructor->node.loc, &@3); constructor->node.data_type = $2; - constructor->arguments = $4; - + constructor->args_count = $4.args_count; + memcpy(constructor->args, $4.args, $4.args_count * sizeof(*$4.args)); + d3dcompiler_free($4.args); $$ = &constructor->node; } @@ -2139,7 +2113,6 @@ unary_expr: postfix_expr } | OP_INC unary_expr { - struct hlsl_ir_node *operands[3]; struct source_location loc; set_location(&loc, &@1); @@ -2147,15 +2120,12 @@ unary_expr: postfix_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "modifying a const expression"); - return 1; + YYABORT; } - operands[0] = $2; - operands[1] = operands[2] = NULL; - $$ = &new_expr(HLSL_IR_UNOP_PREINC, operands, &loc)->node; + $$ = new_unary_expr(HLSL_IR_UNOP_PREINC, $2, loc); } | OP_DEC unary_expr { - struct hlsl_ir_node *operands[3]; struct source_location loc; set_location(&loc, &@1); @@ -2163,17 +2133,14 @@ unary_expr: postfix_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "modifying a const expression"); - return 1; + YYABORT; } - operands[0] = $2; - operands[1] = operands[2] = NULL; - $$ = &new_expr(HLSL_IR_UNOP_PREDEC, operands, &loc)->node; + $$ = new_unary_expr(HLSL_IR_UNOP_PREDEC, $2, loc); } | unary_op unary_expr { enum hlsl_ir_expr_op ops[] = {0, HLSL_IR_UNOP_NEG, HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_BIT_NOT}; - struct hlsl_ir_node *operands[3]; struct source_location loc; if ($1 == UNARY_OP_PLUS) @@ -2182,10 +2149,8 @@ unary_expr: postfix_expr } else { - operands[0] = $2; - operands[1] = operands[2] = NULL; set_location(&loc, &@1); - $$ = &new_expr(ops[$1], operands, &loc)->node; + $$ = new_unary_expr(ops[$1], $2, loc); } } /* var_modifiers just to avoid shift/reduce conflicts */ @@ -2201,7 +2166,7 @@ unary_expr: postfix_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "unexpected modifier in a cast"); - return 1; + YYABORT; } if ($4) @@ -2214,7 +2179,7 @@ unary_expr: postfix_expr hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "can't cast from %s to %s", debug_hlsl_type(src_type), debug_hlsl_type(dst_type)); - return 1; + YYABORT; } expr = new_cast($6, dst_type, &loc); @@ -2247,21 +2212,21 @@ mul_expr: unary_expr struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_mul($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_MUL, $1, $3, loc); } | mul_expr '/' unary_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_div($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_DIV, $1, $3, loc); } | mul_expr '%' unary_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_mod($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_MOD, $1, $3, loc); } add_expr: mul_expr @@ -2273,14 +2238,14 @@ add_expr: mul_expr struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_add($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_ADD, $1, $3, loc); } | add_expr '-' mul_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_sub($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_SUB, $1, $3, loc); } shift_expr: add_expr @@ -2305,28 +2270,28 @@ relational_expr: shift_expr struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_lt($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_LESS, $1, $3, loc); } | relational_expr '>' shift_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_gt($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_GREATER, $1, $3, loc); } | relational_expr OP_LE shift_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_le($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_LEQUAL, $1, $3, loc); } | relational_expr OP_GE shift_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_ge($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_GEQUAL, $1, $3, loc); } equality_expr: relational_expr @@ -2338,14 +2303,14 @@ equality_expr: relational_expr struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_eq($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_EQUAL, $1, $3, loc); } | equality_expr OP_NE relational_expr { struct source_location loc; set_location(&loc, &@2); - $$ = &hlsl_ne($1, $3, &loc)->node; + $$ = new_binary_expr(HLSL_IR_BINOP_NEQUAL, $1, $3, loc); } bitand_expr: equality_expr @@ -2415,11 +2380,11 @@ assignment_expr: conditional_expr { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "l-value is const"); - return 1; + YYABORT; } $$ = make_assignment($1, $2, BWRITERSP_WRITEMASK_ALL, $3); if (!$$) - return 1; + YYABORT; $$->loc = loc; } diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.yy.c b/dll/directx/wine/d3dcompiler_43/hlsl.yy.c index 9a91a4dd743..43b3bdb45d7 100644 --- a/dll/directx/wine/d3dcompiler_43/hlsl.yy.c +++ b/dll/directx/wine/d3dcompiler_43/hlsl.yy.c @@ -1,6 +1,6 @@ -#line 2 "hlsl.yy.c" +#line 1 "hlsl.yy.c" -#line 4 "hlsl.yy.c" +#line 3 "hlsl.yy.c" #define YY_INT_ALIGNED short int @@ -8,11 +8,17 @@ #define yy_create_buffer hlsl__create_buffer #define yy_delete_buffer hlsl__delete_buffer -#define yy_flex_debug hlsl__flex_debug +#define yy_scan_buffer hlsl__scan_buffer +#define yy_scan_string hlsl__scan_string +#define yy_scan_bytes hlsl__scan_bytes #define yy_init_buffer hlsl__init_buffer #define yy_flush_buffer hlsl__flush_buffer #define yy_load_buffer_state hlsl__load_buffer_state #define yy_switch_to_buffer hlsl__switch_to_buffer +#define yypush_buffer_state hlsl_push_buffer_state +#define yypop_buffer_state hlsl_pop_buffer_state +#define yyensure_buffer_stack hlsl_ensure_buffer_stack +#define yy_flex_debug hlsl__flex_debug #define yyin hlsl_in #define yyleng hlsl_leng #define yylex hlsl_lex @@ -27,12 +33,246 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define hlsl__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer hlsl__create_buffer +#endif + +#ifdef yy_delete_buffer +#define hlsl__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer hlsl__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define hlsl__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer hlsl__scan_buffer +#endif + +#ifdef yy_scan_string +#define hlsl__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string hlsl__scan_string +#endif + +#ifdef yy_scan_bytes +#define hlsl__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes hlsl__scan_bytes +#endif + +#ifdef yy_init_buffer +#define hlsl__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer hlsl__init_buffer +#endif + +#ifdef yy_flush_buffer +#define hlsl__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer hlsl__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define hlsl__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state hlsl__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define hlsl__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer hlsl__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define hlsl_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state hlsl_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define hlsl_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state hlsl_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define hlsl_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack hlsl_ensure_buffer_stack +#endif + +#ifdef yylex +#define hlsl_lex_ALREADY_DEFINED +#else +#define yylex hlsl_lex +#endif + +#ifdef yyrestart +#define hlsl_restart_ALREADY_DEFINED +#else +#define yyrestart hlsl_restart +#endif + +#ifdef yylex_init +#define hlsl_lex_init_ALREADY_DEFINED +#else +#define yylex_init hlsl_lex_init +#endif + +#ifdef yylex_init_extra +#define hlsl_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra hlsl_lex_init_extra +#endif + +#ifdef yylex_destroy +#define hlsl_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy hlsl_lex_destroy +#endif + +#ifdef yyget_debug +#define hlsl_get_debug_ALREADY_DEFINED +#else +#define yyget_debug hlsl_get_debug +#endif + +#ifdef yyset_debug +#define hlsl_set_debug_ALREADY_DEFINED +#else +#define yyset_debug hlsl_set_debug +#endif + +#ifdef yyget_extra +#define hlsl_get_extra_ALREADY_DEFINED +#else +#define yyget_extra hlsl_get_extra +#endif + +#ifdef yyset_extra +#define hlsl_set_extra_ALREADY_DEFINED +#else +#define yyset_extra hlsl_set_extra +#endif + +#ifdef yyget_in +#define hlsl_get_in_ALREADY_DEFINED +#else +#define yyget_in hlsl_get_in +#endif + +#ifdef yyset_in +#define hlsl_set_in_ALREADY_DEFINED +#else +#define yyset_in hlsl_set_in +#endif + +#ifdef yyget_out +#define hlsl_get_out_ALREADY_DEFINED +#else +#define yyget_out hlsl_get_out +#endif + +#ifdef yyset_out +#define hlsl_set_out_ALREADY_DEFINED +#else +#define yyset_out hlsl_set_out +#endif + +#ifdef yyget_leng +#define hlsl_get_leng_ALREADY_DEFINED +#else +#define yyget_leng hlsl_get_leng +#endif + +#ifdef yyget_text +#define hlsl_get_text_ALREADY_DEFINED +#else +#define yyget_text hlsl_get_text +#endif + +#ifdef yyget_lineno +#define hlsl_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno hlsl_get_lineno +#endif + +#ifdef yyset_lineno +#define hlsl_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno hlsl_set_lineno +#endif + +#ifdef yywrap +#define hlsl_wrap_ALREADY_DEFINED +#else +#define yywrap hlsl_wrap +#endif + +#ifdef yyalloc +#define hlsl_alloc_ALREADY_DEFINED +#else +#define yyalloc hlsl_alloc +#endif + +#ifdef yyrealloc +#define hlsl_realloc_ALREADY_DEFINED +#else +#define yyrealloc hlsl_realloc +#endif + +#ifdef yyfree +#define hlsl_free_ALREADY_DEFINED +#else +#define yyfree hlsl_free +#endif + +#ifdef yytext +#define hlsl_text_ALREADY_DEFINED +#else +#define yytext hlsl_text +#endif + +#ifdef yyleng +#define hlsl_leng_ALREADY_DEFINED +#else +#define yyleng hlsl_leng +#endif + +#ifdef yyin +#define hlsl_in_ALREADY_DEFINED +#else +#define yyin hlsl_in +#endif + +#ifdef yyout +#define hlsl_out_ALREADY_DEFINED +#else +#define yyout hlsl_out +#endif + +#ifdef yy_flex_debug +#define hlsl__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug hlsl__flex_debug +#endif + +#ifdef yylineno +#define hlsl_lineno_ALREADY_DEFINED +#else +#define yylineno hlsl_lineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -103,65 +343,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus +/* begin standard C++ headers. */ -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE hlsl_restart(hlsl_in ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -178,30 +414,30 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t hlsl_leng; +extern int yyleng; -extern FILE *hlsl_in, *hlsl_out; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up hlsl_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up hlsl_text again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -216,12 +452,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -244,7 +480,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -261,8 +497,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via hlsl_restart()), so that the user can continue scanning by - * just pointing hlsl_in at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -272,7 +508,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -283,106 +519,101 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when hlsl_text is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t hlsl_leng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow hlsl_wrap()'s to do buffer switches - * instead of setting up a fresh hlsl_in. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void hlsl_restart (FILE *input_file ); -void hlsl__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE hlsl__create_buffer (FILE *file,int size ); -void hlsl__delete_buffer (YY_BUFFER_STATE b ); -void hlsl__flush_buffer (YY_BUFFER_STATE b ); -void hlsl_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void hlsl_pop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void hlsl_ensure_buffer_stack (void ); -static void hlsl__load_buffer_state (void ); -static void hlsl__init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER hlsl__flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE hlsl__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE hlsl__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE hlsl__scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *hlsl_alloc (yy_size_t ); -void *hlsl_realloc (void *,yy_size_t ); -void hlsl_free (void * ); - -#define yy_new_buffer hlsl__create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - hlsl_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - hlsl__create_buffer(hlsl_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - hlsl_ensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - hlsl__create_buffer(hlsl_in,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define hlsl_wrap() 1 +#define hlsl_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *hlsl_in = (FILE *) 0, *hlsl_out = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int hlsl_lineno; +extern int yylineno; +int yylineno = 1; -int hlsl_lineno = 1; +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -extern char *hlsl_text; -#define yytext_ptr hlsl_text - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up hlsl_text. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - hlsl_leng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 125 #define YY_END_OF_BUFFER 126 /* This struct is not used in this scanner, @@ -392,7 +623,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[717] = +static const flex_int16_t yy_accept[717] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 124, 108, 109, 124, 124, 124, 124, 124, 124, @@ -475,7 +706,7 @@ static yyconst flex_int16_t yy_accept[717] = 112, 0, 0, 0, 113, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -507,7 +738,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[72] = +static const YY_CHAR yy_meta[72] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, @@ -519,7 +750,7 @@ static yyconst flex_int32_t yy_meta[72] = 1 } ; -static yyconst flex_int16_t yy_base[725] = +static const flex_int16_t yy_base[725] = { 0, 0, 65, 74, 80, 83, 101, 70, 72, 76, 78, 938, 939, 935, 939, 933, 910, 81, 909, 97, 908, @@ -603,7 +834,7 @@ static yyconst flex_int16_t yy_base[725] = 518, 522, 526, 379 } ; -static yyconst flex_int16_t yy_def[725] = +static const flex_int16_t yy_def[725] = { 0, 716, 1, 717, 717, 718, 718, 719, 719, 720, 720, 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, @@ -687,7 +918,7 @@ static yyconst flex_int16_t yy_def[725] = 716, 716, 716, 716 } ; -static yyconst flex_int16_t yy_nxt[1011] = +static const flex_int16_t yy_nxt[1011] = { 0, 12, 13, 14, 15, 16, 12, 17, 18, 19, 12, 12, 20, 21, 22, 23, 24, 25, 26, 26, 26, @@ -802,7 +1033,7 @@ static yyconst flex_int16_t yy_nxt[1011] = 716, 716, 716, 716, 716, 716, 716, 716, 716, 716 } ; -static yyconst flex_int16_t yy_chk[1011] = +static const flex_int16_t yy_chk[1011] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -920,8 +1151,8 @@ static yyconst flex_int16_t yy_chk[1011] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int hlsl__flex_debug; -int hlsl__flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -930,7 +1161,7 @@ int hlsl__flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *hlsl_text; +char *yytext; #line 1 "hlsl.l" /* * HLSL parser @@ -953,8 +1184,6 @@ char *hlsl_text; * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #line 23 "hlsl.l" -#include "config.h" -#include "wine/port.h" #include "wine/debug.h" #define YY_NO_UNISTD_H @@ -967,12 +1196,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(hlsl_parser); do { \ hlsl_lloc.first_column = hlsl_ctx.column; \ hlsl_lloc.first_line = hlsl_ctx.line_no; \ - hlsl_ctx.column += hlsl_leng; \ + hlsl_ctx.column += yyleng; \ } while(0); +#line 1202 "hlsl.yy.c" #define YY_NO_INPUT 1 -#line 976 "hlsl.yy.c" +#line 1205 "hlsl.yy.c" #define INITIAL 0 #define pp 1 @@ -992,36 +1222,36 @@ WINE_DEFAULT_DEBUG_CHANNEL(hlsl_parser); #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int hlsl_lex_destroy (void ); +int yylex_destroy ( void ); -int hlsl_get_debug (void ); +int yyget_debug ( void ); -void hlsl_set_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE hlsl_get_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void hlsl_set_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *hlsl_get_in (void ); +FILE *yyget_in ( void ); -void hlsl_set_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *hlsl_get_out (void ); +FILE *yyget_out ( void ); -void hlsl_set_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t hlsl_get_leng (void ); + int yyget_leng ( void ); -char *hlsl_get_text (void ); +char *yyget_text ( void ); -int hlsl_get_lineno (void ); +int yyget_lineno ( void ); -void hlsl_set_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1029,33 +1259,41 @@ void hlsl_set_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int hlsl_wrap (void ); +extern "C" int yywrap ( void ); #else -extern int hlsl_wrap (void ); +extern int yywrap ( void ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1063,7 +1301,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( hlsl_text, hlsl_leng, 1, hlsl_out )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1074,20 +1312,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( hlsl_in )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( hlsl_in ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, hlsl_in))==0 && ferror(hlsl_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1095,7 +1333,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(hlsl_in); \ + clearerr(yyin); \ } \ }\ \ @@ -1128,12 +1366,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int hlsl_lex (void); +extern int yylex (void); -#define YY_DECL int hlsl_lex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after hlsl_text and hlsl_leng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1142,27 +1380,23 @@ extern int hlsl_lex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ - if ( hlsl_leng > 0 ) \ + if ( yyleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (hlsl_text[hlsl_leng - 1] == '\n'); \ + (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 60 "hlsl.l" - -#line 1165 "hlsl.yy.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -1174,26 +1408,31 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! hlsl_in ) - hlsl_in = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! hlsl_out ) - hlsl_out = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - hlsl_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - hlsl__create_buffer(hlsl_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - hlsl__load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 58 "hlsl.l" + +#line 1429 "hlsl.yy.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of hlsl_text. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1206,7 +1445,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1216,9 +1455,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 717 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 716 ); @@ -1243,520 +1482,520 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 61 "hlsl.l" +#line 59 "hlsl.l" { - hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, hlsl_text); + hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext); set_parse_status(&hlsl_ctx.status, PARSE_ERR); } YY_BREAK case 2: YY_RULE_SETUP -#line 65 "hlsl.l" +#line 63 "hlsl.l" { - hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, hlsl_text); + hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext); set_parse_status(&hlsl_ctx.status, PARSE_ERR); } YY_BREAK case 3: YY_RULE_SETUP -#line 69 "hlsl.l" +#line 67 "hlsl.l" { - hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, hlsl_text); + hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext); set_parse_status(&hlsl_ctx.status, PARSE_ERR); } YY_BREAK case 4: YY_RULE_SETUP -#line 73 "hlsl.l" +#line 71 "hlsl.l" { - hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, hlsl_text); + hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext); set_parse_status(&hlsl_ctx.status, PARSE_ERR); } YY_BREAK case 5: YY_RULE_SETUP -#line 78 "hlsl.l" +#line 76 "hlsl.l" {return KW_BLENDSTATE; } YY_BREAK case 6: YY_RULE_SETUP -#line 79 "hlsl.l" +#line 77 "hlsl.l" {return KW_BREAK; } YY_BREAK case 7: YY_RULE_SETUP -#line 80 "hlsl.l" +#line 78 "hlsl.l" {return KW_BUFFER; } YY_BREAK case 8: YY_RULE_SETUP -#line 81 "hlsl.l" +#line 79 "hlsl.l" {return KW_CBUFFER; } YY_BREAK case 9: YY_RULE_SETUP -#line 82 "hlsl.l" +#line 80 "hlsl.l" {return KW_COMPILE; } YY_BREAK case 10: YY_RULE_SETUP -#line 83 "hlsl.l" +#line 81 "hlsl.l" {return KW_CONST; } YY_BREAK case 11: YY_RULE_SETUP -#line 84 "hlsl.l" +#line 82 "hlsl.l" {return KW_CONTINUE; } YY_BREAK case 12: YY_RULE_SETUP -#line 85 "hlsl.l" +#line 83 "hlsl.l" {return KW_DEPTHSTENCILSTATE; } YY_BREAK case 13: YY_RULE_SETUP -#line 86 "hlsl.l" +#line 84 "hlsl.l" {return KW_DEPTHSTENCILVIEW; } YY_BREAK case 14: YY_RULE_SETUP -#line 87 "hlsl.l" +#line 85 "hlsl.l" {return KW_DISCARD; } YY_BREAK case 15: YY_RULE_SETUP -#line 88 "hlsl.l" +#line 86 "hlsl.l" {return KW_DO; } YY_BREAK case 16: YY_RULE_SETUP -#line 89 "hlsl.l" +#line 87 "hlsl.l" {return KW_DOUBLE; } YY_BREAK case 17: YY_RULE_SETUP -#line 90 "hlsl.l" +#line 88 "hlsl.l" {return KW_ELSE; } YY_BREAK case 18: YY_RULE_SETUP -#line 91 "hlsl.l" +#line 89 "hlsl.l" {return KW_EXTERN; } YY_BREAK case 19: YY_RULE_SETUP -#line 92 "hlsl.l" +#line 90 "hlsl.l" {return KW_FALSE; } YY_BREAK case 20: YY_RULE_SETUP -#line 93 "hlsl.l" +#line 91 "hlsl.l" {return KW_FOR; } YY_BREAK case 21: YY_RULE_SETUP -#line 94 "hlsl.l" +#line 92 "hlsl.l" {return KW_GEOMETRYSHADER; } YY_BREAK case 22: YY_RULE_SETUP -#line 95 "hlsl.l" +#line 93 "hlsl.l" {return KW_GROUPSHARED; } YY_BREAK case 23: YY_RULE_SETUP -#line 96 "hlsl.l" +#line 94 "hlsl.l" {return KW_IF; } YY_BREAK case 24: YY_RULE_SETUP -#line 97 "hlsl.l" +#line 95 "hlsl.l" {return KW_IN; } YY_BREAK case 25: YY_RULE_SETUP -#line 98 "hlsl.l" +#line 96 "hlsl.l" {return KW_INLINE; } YY_BREAK case 26: YY_RULE_SETUP -#line 99 "hlsl.l" +#line 97 "hlsl.l" {return KW_INOUT; } YY_BREAK case 27: YY_RULE_SETUP -#line 100 "hlsl.l" +#line 98 "hlsl.l" {return KW_MATRIX; } YY_BREAK case 28: YY_RULE_SETUP -#line 101 "hlsl.l" +#line 99 "hlsl.l" {return KW_NAMESPACE; } YY_BREAK case 29: YY_RULE_SETUP -#line 102 "hlsl.l" +#line 100 "hlsl.l" {return KW_NOINTERPOLATION; } YY_BREAK case 30: YY_RULE_SETUP -#line 103 "hlsl.l" +#line 101 "hlsl.l" {return KW_OUT; } YY_BREAK case 31: YY_RULE_SETUP -#line 104 "hlsl.l" +#line 102 "hlsl.l" {return KW_PASS; } YY_BREAK case 32: YY_RULE_SETUP -#line 105 "hlsl.l" +#line 103 "hlsl.l" {return KW_PIXELSHADER; } YY_BREAK case 33: YY_RULE_SETUP -#line 106 "hlsl.l" +#line 104 "hlsl.l" {return KW_PRECISE; } YY_BREAK case 34: YY_RULE_SETUP -#line 107 "hlsl.l" +#line 105 "hlsl.l" {return KW_RASTERIZERSTATE; } YY_BREAK case 35: YY_RULE_SETUP -#line 108 "hlsl.l" +#line 106 "hlsl.l" {return KW_RENDERTARGETVIEW; } YY_BREAK case 36: YY_RULE_SETUP -#line 109 "hlsl.l" +#line 107 "hlsl.l" {return KW_RETURN; } YY_BREAK case 37: YY_RULE_SETUP -#line 110 "hlsl.l" +#line 108 "hlsl.l" {return KW_REGISTER; } YY_BREAK case 38: YY_RULE_SETUP -#line 111 "hlsl.l" +#line 109 "hlsl.l" {return KW_SAMPLER; } YY_BREAK case 39: YY_RULE_SETUP -#line 112 "hlsl.l" +#line 110 "hlsl.l" {return KW_SAMPLER1D; } YY_BREAK case 40: YY_RULE_SETUP -#line 113 "hlsl.l" +#line 111 "hlsl.l" {return KW_SAMPLER2D; } YY_BREAK case 41: YY_RULE_SETUP -#line 114 "hlsl.l" +#line 112 "hlsl.l" {return KW_SAMPLER3D; } YY_BREAK case 42: YY_RULE_SETUP -#line 115 "hlsl.l" +#line 113 "hlsl.l" {return KW_SAMPLERCUBE; } YY_BREAK case 43: YY_RULE_SETUP -#line 116 "hlsl.l" +#line 114 "hlsl.l" {return KW_SAMPLER_STATE; } YY_BREAK case 44: YY_RULE_SETUP -#line 117 "hlsl.l" +#line 115 "hlsl.l" {return KW_SAMPLERCOMPARISONSTATE;} YY_BREAK case 45: YY_RULE_SETUP -#line 118 "hlsl.l" +#line 116 "hlsl.l" {return KW_SHARED; } YY_BREAK case 46: YY_RULE_SETUP -#line 119 "hlsl.l" +#line 117 "hlsl.l" {return KW_STATEBLOCK; } YY_BREAK case 47: YY_RULE_SETUP -#line 120 "hlsl.l" +#line 118 "hlsl.l" {return KW_STATEBLOCK_STATE; } YY_BREAK case 48: YY_RULE_SETUP -#line 121 "hlsl.l" +#line 119 "hlsl.l" {return KW_STATIC; } YY_BREAK case 49: YY_RULE_SETUP -#line 122 "hlsl.l" +#line 120 "hlsl.l" {return KW_STRING; } YY_BREAK case 50: YY_RULE_SETUP -#line 123 "hlsl.l" +#line 121 "hlsl.l" {return KW_STRUCT; } YY_BREAK case 51: YY_RULE_SETUP -#line 124 "hlsl.l" +#line 122 "hlsl.l" {return KW_SWITCH; } YY_BREAK case 52: YY_RULE_SETUP -#line 125 "hlsl.l" +#line 123 "hlsl.l" {return KW_TBUFFER; } YY_BREAK case 53: YY_RULE_SETUP -#line 126 "hlsl.l" +#line 124 "hlsl.l" {return KW_TECHNIQUE; } YY_BREAK case 54: YY_RULE_SETUP -#line 127 "hlsl.l" +#line 125 "hlsl.l" {return KW_TECHNIQUE10; } YY_BREAK case 55: YY_RULE_SETUP -#line 128 "hlsl.l" +#line 126 "hlsl.l" {return KW_TEXTURE; } YY_BREAK case 56: YY_RULE_SETUP -#line 129 "hlsl.l" +#line 127 "hlsl.l" {return KW_TEXTURE1D; } YY_BREAK case 57: YY_RULE_SETUP -#line 130 "hlsl.l" +#line 128 "hlsl.l" {return KW_TEXTURE1DARRAY; } YY_BREAK case 58: YY_RULE_SETUP -#line 131 "hlsl.l" +#line 129 "hlsl.l" {return KW_TEXTURE2D; } YY_BREAK case 59: YY_RULE_SETUP -#line 132 "hlsl.l" +#line 130 "hlsl.l" {return KW_TEXTURE2DARRAY; } YY_BREAK case 60: YY_RULE_SETUP -#line 133 "hlsl.l" +#line 131 "hlsl.l" {return KW_TEXTURE2DMS; } YY_BREAK case 61: YY_RULE_SETUP -#line 134 "hlsl.l" +#line 132 "hlsl.l" {return KW_TEXTURE2DMSARRAY; } YY_BREAK case 62: YY_RULE_SETUP -#line 135 "hlsl.l" +#line 133 "hlsl.l" {return KW_TEXTURE3D; } YY_BREAK case 63: YY_RULE_SETUP -#line 136 "hlsl.l" +#line 134 "hlsl.l" {return KW_TEXTURE3DARRAY; } YY_BREAK case 64: YY_RULE_SETUP -#line 137 "hlsl.l" +#line 135 "hlsl.l" {return KW_TEXTURECUBE; } YY_BREAK case 65: YY_RULE_SETUP -#line 138 "hlsl.l" +#line 136 "hlsl.l" {return KW_TRUE; } YY_BREAK case 66: YY_RULE_SETUP -#line 139 "hlsl.l" +#line 137 "hlsl.l" {return KW_TYPEDEF; } YY_BREAK case 67: YY_RULE_SETUP -#line 140 "hlsl.l" +#line 138 "hlsl.l" {return KW_UNIFORM; } YY_BREAK case 68: YY_RULE_SETUP -#line 141 "hlsl.l" +#line 139 "hlsl.l" {return KW_VECTOR; } YY_BREAK case 69: YY_RULE_SETUP -#line 142 "hlsl.l" +#line 140 "hlsl.l" {return KW_VERTEXSHADER; } YY_BREAK case 70: YY_RULE_SETUP -#line 143 "hlsl.l" +#line 141 "hlsl.l" {return KW_VOID; } YY_BREAK case 71: YY_RULE_SETUP -#line 144 "hlsl.l" +#line 142 "hlsl.l" {return KW_VOLATILE; } YY_BREAK case 72: YY_RULE_SETUP -#line 145 "hlsl.l" +#line 143 "hlsl.l" {return KW_WHILE; } YY_BREAK case 73: YY_RULE_SETUP -#line 147 "hlsl.l" +#line 145 "hlsl.l" {return OP_INC; } YY_BREAK case 74: YY_RULE_SETUP -#line 148 "hlsl.l" +#line 146 "hlsl.l" {return OP_DEC; } YY_BREAK case 75: YY_RULE_SETUP -#line 149 "hlsl.l" +#line 147 "hlsl.l" {return OP_AND; } YY_BREAK case 76: YY_RULE_SETUP -#line 150 "hlsl.l" +#line 148 "hlsl.l" {return OP_OR; } YY_BREAK case 77: YY_RULE_SETUP -#line 151 "hlsl.l" +#line 149 "hlsl.l" {return OP_EQ; } YY_BREAK case 78: YY_RULE_SETUP -#line 152 "hlsl.l" +#line 150 "hlsl.l" {return OP_LEFTSHIFT; } YY_BREAK case 79: YY_RULE_SETUP -#line 153 "hlsl.l" +#line 151 "hlsl.l" {return OP_LEFTSHIFTASSIGN; } YY_BREAK case 80: YY_RULE_SETUP -#line 154 "hlsl.l" +#line 152 "hlsl.l" {return OP_RIGHTSHIFT; } YY_BREAK case 81: YY_RULE_SETUP -#line 155 "hlsl.l" +#line 153 "hlsl.l" {return OP_RIGHTSHIFTASSIGN; } YY_BREAK case 82: YY_RULE_SETUP -#line 156 "hlsl.l" +#line 154 "hlsl.l" {return OP_ELLIPSIS; } YY_BREAK case 83: YY_RULE_SETUP -#line 157 "hlsl.l" +#line 155 "hlsl.l" {return OP_LE; } YY_BREAK case 84: YY_RULE_SETUP -#line 158 "hlsl.l" +#line 156 "hlsl.l" {return OP_GE; } YY_BREAK case 85: YY_RULE_SETUP -#line 159 "hlsl.l" +#line 157 "hlsl.l" {return OP_NE; } YY_BREAK case 86: YY_RULE_SETUP -#line 160 "hlsl.l" +#line 158 "hlsl.l" {return OP_ADDASSIGN; } YY_BREAK case 87: YY_RULE_SETUP -#line 161 "hlsl.l" +#line 159 "hlsl.l" {return OP_SUBASSIGN; } YY_BREAK case 88: YY_RULE_SETUP -#line 162 "hlsl.l" +#line 160 "hlsl.l" {return OP_MULASSIGN; } YY_BREAK case 89: YY_RULE_SETUP -#line 163 "hlsl.l" +#line 161 "hlsl.l" {return OP_DIVASSIGN; } YY_BREAK case 90: YY_RULE_SETUP -#line 164 "hlsl.l" +#line 162 "hlsl.l" {return OP_MODASSIGN; } YY_BREAK case 91: YY_RULE_SETUP -#line 165 "hlsl.l" +#line 163 "hlsl.l" {return OP_ANDASSIGN; } YY_BREAK case 92: YY_RULE_SETUP -#line 166 "hlsl.l" +#line 164 "hlsl.l" {return OP_ORASSIGN; } YY_BREAK case 93: YY_RULE_SETUP -#line 167 "hlsl.l" +#line 165 "hlsl.l" {return OP_XORASSIGN; } YY_BREAK case 94: YY_RULE_SETUP -#line 168 "hlsl.l" +#line 166 "hlsl.l" {return OP_UNKNOWN1; } YY_BREAK case 95: YY_RULE_SETUP -#line 169 "hlsl.l" +#line 167 "hlsl.l" {return OP_UNKNOWN2; } YY_BREAK case 96: YY_RULE_SETUP -#line 170 "hlsl.l" +#line 168 "hlsl.l" {return OP_UNKNOWN3; } YY_BREAK case 97: YY_RULE_SETUP -#line 171 "hlsl.l" +#line 169 "hlsl.l" {return OP_UNKNOWN4; } YY_BREAK case 98: YY_RULE_SETUP -#line 173 "hlsl.l" +#line 171 "hlsl.l" {return KW_COLUMN_MAJOR; } YY_BREAK case 99: YY_RULE_SETUP -#line 174 "hlsl.l" +#line 172 "hlsl.l" {return KW_ROW_MAJOR; } YY_BREAK case 100: YY_RULE_SETUP -#line 176 "hlsl.l" +#line 174 "hlsl.l" { - hlsl_lval.name = d3dcompiler_strdup(hlsl_text); - if (get_variable(hlsl_ctx.cur_scope, hlsl_text) - || find_function(hlsl_text)) + hlsl_lval.name = d3dcompiler_strdup(yytext); + if (get_variable(hlsl_ctx.cur_scope, yytext) + || find_function(yytext)) return VAR_IDENTIFIER; - else if (get_type(hlsl_ctx.cur_scope, hlsl_text, TRUE)) + else if (get_type(hlsl_ctx.cur_scope, yytext, TRUE)) return TYPE_IDENTIFIER; else return NEW_IDENTIFIER; @@ -1764,66 +2003,66 @@ YY_RULE_SETUP YY_BREAK case 101: YY_RULE_SETUP -#line 187 "hlsl.l" +#line 185 "hlsl.l" { - hlsl_lval.floatval = atof(hlsl_text); + hlsl_lval.floatval = atof(yytext); return C_FLOAT; } YY_BREAK case 102: YY_RULE_SETUP -#line 191 "hlsl.l" +#line 189 "hlsl.l" { - hlsl_lval.floatval = atof(hlsl_text); + hlsl_lval.floatval = atof(yytext); return C_FLOAT; } YY_BREAK case 103: YY_RULE_SETUP -#line 195 "hlsl.l" +#line 193 "hlsl.l" { - hlsl_lval.floatval = atof(hlsl_text); + hlsl_lval.floatval = atof(yytext); return C_FLOAT; } YY_BREAK case 104: YY_RULE_SETUP -#line 199 "hlsl.l" +#line 197 "hlsl.l" { - sscanf(hlsl_text, "0x%x", &hlsl_lval.intval); + sscanf(yytext, "0x%x", &hlsl_lval.intval); return C_INTEGER; } YY_BREAK case 105: YY_RULE_SETUP -#line 203 "hlsl.l" +#line 201 "hlsl.l" { - sscanf(hlsl_text, "0%o", &hlsl_lval.intval); + sscanf(yytext, "0%o", &hlsl_lval.intval); return C_INTEGER; } YY_BREAK case 106: YY_RULE_SETUP -#line 207 "hlsl.l" +#line 205 "hlsl.l" { - hlsl_lval.intval = (atoi(hlsl_text)); + hlsl_lval.intval = (atoi(yytext)); return C_INTEGER; } YY_BREAK case 107: YY_RULE_SETUP -#line 212 "hlsl.l" +#line 210 "hlsl.l" {} YY_BREAK case 108: YY_RULE_SETUP -#line 214 "hlsl.l" +#line 212 "hlsl.l" {} YY_BREAK case 109: /* rule 109 can match eol */ YY_RULE_SETUP -#line 215 "hlsl.l" +#line 213 "hlsl.l" { hlsl_ctx.line_no++; hlsl_ctx.column = 1; @@ -1831,14 +2070,14 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 220 "hlsl.l" +#line 218 "hlsl.l" { BEGIN pp; } YY_BREAK case 111: YY_RULE_SETUP -#line 224 "hlsl.l" +#line 222 "hlsl.l" { TRACE("Got a #pragma.\n"); BEGIN pp_pragma; @@ -1846,7 +2085,7 @@ YY_RULE_SETUP YY_BREAK case 112: YY_RULE_SETUP -#line 228 "hlsl.l" +#line 226 "hlsl.l" { TRACE("#pragma setting row_major mode.\n"); hlsl_ctx.matrix_majority = HLSL_ROW_MAJOR; @@ -1855,7 +2094,7 @@ YY_RULE_SETUP YY_BREAK case 113: YY_RULE_SETUP -#line 233 "hlsl.l" +#line 231 "hlsl.l" { TRACE("#pragma setting column_major mode.\n"); hlsl_ctx.matrix_majority = HLSL_COLUMN_MAJOR; @@ -1865,7 +2104,7 @@ YY_RULE_SETUP case 114: /* rule 114 can match eol */ YY_RULE_SETUP -#line 238 "hlsl.l" +#line 236 "hlsl.l" { FIXME("Unsupported preprocessor #pragma directive at line %u.\n", hlsl_ctx.line_no); BEGIN INITIAL; @@ -1873,25 +2112,25 @@ YY_RULE_SETUP YY_BREAK case 115: YY_RULE_SETUP -#line 242 "hlsl.l" +#line 240 "hlsl.l" {} YY_BREAK case 116: YY_RULE_SETUP -#line 243 "hlsl.l" +#line 241 "hlsl.l" { TRACE("Preprocessor line info.\n"); BEGIN pp_line; - hlsl_lval.intval = (atoi(hlsl_text)); + hlsl_lval.intval = (atoi(yytext)); return PRE_LINE; } YY_BREAK case 117: /* rule 117 can match eol */ YY_RULE_SETUP -#line 249 "hlsl.l" +#line 247 "hlsl.l" { - char *string = d3dcompiler_strdup(hlsl_text + 1); + char *string = d3dcompiler_strdup(yytext + 1); BEGIN pp_ignore; string[strlen(string) - 1] = 0; @@ -1901,13 +2140,13 @@ YY_RULE_SETUP YY_BREAK case 118: YY_RULE_SETUP -#line 257 "hlsl.l" +#line 255 "hlsl.l" {} YY_BREAK case 119: /* rule 119 can match eol */ YY_RULE_SETUP -#line 258 "hlsl.l" +#line 256 "hlsl.l" { FIXME("Malformed preprocessor line directive?\n"); BEGIN INITIAL; @@ -1916,20 +2155,20 @@ YY_RULE_SETUP case 120: /* rule 120 can match eol */ YY_RULE_SETUP -#line 262 "hlsl.l" +#line 260 "hlsl.l" { BEGIN INITIAL; } YY_BREAK case 121: YY_RULE_SETUP -#line 265 "hlsl.l" +#line 263 "hlsl.l" {} YY_BREAK case 122: /* rule 122 can match eol */ YY_RULE_SETUP -#line 266 "hlsl.l" +#line 264 "hlsl.l" { FIXME("Unexpected preprocessor directive.\n"); BEGIN INITIAL; @@ -1937,22 +2176,22 @@ YY_RULE_SETUP YY_BREAK case 123: YY_RULE_SETUP -#line 270 "hlsl.l" +#line 268 "hlsl.l" {} YY_BREAK case 124: YY_RULE_SETUP -#line 272 "hlsl.l" +#line 270 "hlsl.l" { - return hlsl_text[0]; + return yytext[0]; } YY_BREAK case 125: YY_RULE_SETUP -#line 276 "hlsl.l" +#line 274 "hlsl.l" ECHO; YY_BREAK -#line 1956 "hlsl.yy.c" +#line 2194 "hlsl.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(pp): case YY_STATE_EOF(pp_line): @@ -1973,15 +2212,15 @@ case YY_STATE_EOF(pp_ignore): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed hlsl_in at a new source and called - * hlsl_lex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = hlsl_in; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -2035,11 +2274,11 @@ case YY_STATE_EOF(pp_ignore): { (yy_did_buffer_switch_on_eof) = 0; - if ( hlsl_wrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * hlsl_text, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -2088,7 +2327,8 @@ case YY_STATE_EOF(pp_ignore): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of hlsl_lex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2099,9 +2339,9 @@ case YY_STATE_EOF(pp_ignore): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2130,7 +2370,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2143,7 +2383,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2157,7 +2397,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2166,11 +2406,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - hlsl_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2198,7 +2439,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - hlsl_restart(hlsl_in ); + yyrestart( yyin ); } else @@ -2212,12 +2453,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) hlsl_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -2233,15 +2477,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2251,9 +2495,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 717 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -2266,10 +2510,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2279,14 +2523,18 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 717 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 716); return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2311,7 +2559,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2328,14 +2576,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - hlsl_restart(hlsl_in ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( hlsl_wrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2354,7 +2602,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve hlsl_text */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); @@ -2368,32 +2616,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void hlsl_restart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - hlsl_ensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - hlsl__create_buffer(hlsl_in,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - hlsl__init_buffer(YY_CURRENT_BUFFER,input_file ); - hlsl__load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void hlsl__switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * hlsl_pop_buffer_state(); - * hlsl_push_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - hlsl_ensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2406,21 +2654,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - hlsl__load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (hlsl_wrap()) processing, but the only time this flag - * is looked at is after hlsl_wrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void hlsl__load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - hlsl_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2430,35 +2678,35 @@ static void hlsl__load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE hlsl__create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) hlsl_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in hlsl__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) hlsl_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in hlsl__create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - hlsl__init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with hlsl__create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void hlsl__delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2468,27 +2716,27 @@ static void hlsl__load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - hlsl_free((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - hlsl_free((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a hlsl_restart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void hlsl__init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - hlsl__flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then hlsl__init_buffer was _probably_ - * called from hlsl_restart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2505,7 +2753,7 @@ static void hlsl__load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void hlsl__flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2525,7 +2773,7 @@ static void hlsl__load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - hlsl__load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2534,14 +2782,14 @@ static void hlsl__load_buffer_state (void) * @param new_buffer The new state. * */ -void hlsl_push_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - hlsl_ensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from hlsl__switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2555,8 +2803,8 @@ void hlsl_push_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from hlsl__switch_to_buffer. */ - hlsl__load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -2564,18 +2812,18 @@ void hlsl_push_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void hlsl_pop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - hlsl__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - hlsl__load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2583,7 +2831,7 @@ void hlsl_pop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void hlsl_ensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -2593,15 +2841,15 @@ static void hlsl_ensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)hlsl_alloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in hlsl_ensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2610,15 +2858,15 @@ static void hlsl_ensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)hlsl_realloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in hlsl_ensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2630,9 +2878,9 @@ static void hlsl_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE hlsl__scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2640,69 +2888,69 @@ YY_BUFFER_STATE hlsl__scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) hlsl_alloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in hlsl__scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - hlsl__switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to hlsl_lex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * hlsl__scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE hlsl__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return hlsl__scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to hlsl_lex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE hlsl__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) hlsl_alloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in hlsl__scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = hlsl__scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in hlsl__scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2716,9 +2964,9 @@ YY_BUFFER_STATE hlsl__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_l #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2728,14 +2976,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up hlsl_text. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - hlsl_text[hlsl_leng] = (yy_hold_char); \ - (yy_c_buf_p) = hlsl_text + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - hlsl_leng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -2744,126 +2992,126 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int hlsl_get_lineno (void) +int yyget_lineno (void) { - - return hlsl_lineno; + + return yylineno; } /** Get the input stream. * */ -FILE *hlsl_get_in (void) +FILE *yyget_in (void) { - return hlsl_in; + return yyin; } /** Get the output stream. * */ -FILE *hlsl_get_out (void) +FILE *yyget_out (void) { - return hlsl_out; + return yyout; } /** Get the length of the current token. * */ -yy_size_t hlsl_get_leng (void) +int yyget_leng (void) { - return hlsl_leng; + return yyleng; } /** Get the current token. * */ -char *hlsl_get_text (void) +char *yyget_text (void) { - return hlsl_text; + return yytext; } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void hlsl_set_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - hlsl_lineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * - * @see hlsl__switch_to_buffer + * @see yy_switch_to_buffer */ -void hlsl_set_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - hlsl_in = in_str ; + yyin = _in_str ; } -void hlsl_set_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - hlsl_out = out_str ; + yyout = _out_str ; } -int hlsl_get_debug (void) +int yyget_debug (void) { - return hlsl__flex_debug; + return yy_flex_debug; } -void hlsl_set_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - hlsl__flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from hlsl_lex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - hlsl_in = stdin; - hlsl_out = stdout; + yyin = stdin; + yyout = stdout; #else - hlsl_in = (FILE *) 0; - hlsl_out = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * hlsl_lex_init() + * yylex_init() */ return 0; } -/* hlsl_lex_destroy is for both reentrant and non-reentrant scanners. */ -int hlsl_lex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - hlsl__delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - hlsl_pop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - hlsl_free((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * hlsl_lex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -2874,18 +3122,19 @@ int hlsl_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2893,13 +3142,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *hlsl_alloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *hlsl_realloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2907,18 +3157,17 @@ void *hlsl_realloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void hlsl_free (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see hlsl_realloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 275 "hlsl.l" - +#line 274 "hlsl.l" struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD minor, diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.yy.h b/dll/directx/wine/d3dcompiler_43/hlsl.yy.h new file mode 100644 index 00000000000..c77233e4734 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/hlsl.yy.h @@ -0,0 +1,715 @@ +#ifndef hlsl_HEADER_H +#define hlsl_HEADER_H 1 +#define hlsl_IN_HEADER 1 + +#line 5 "hlsl.yy.h" + +#line 7 "hlsl.yy.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define hlsl__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer hlsl__create_buffer +#endif + +#ifdef yy_delete_buffer +#define hlsl__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer hlsl__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define hlsl__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer hlsl__scan_buffer +#endif + +#ifdef yy_scan_string +#define hlsl__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string hlsl__scan_string +#endif + +#ifdef yy_scan_bytes +#define hlsl__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes hlsl__scan_bytes +#endif + +#ifdef yy_init_buffer +#define hlsl__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer hlsl__init_buffer +#endif + +#ifdef yy_flush_buffer +#define hlsl__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer hlsl__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define hlsl__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state hlsl__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define hlsl__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer hlsl__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define hlsl_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state hlsl_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define hlsl_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state hlsl_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define hlsl_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack hlsl_ensure_buffer_stack +#endif + +#ifdef yylex +#define hlsl_lex_ALREADY_DEFINED +#else +#define yylex hlsl_lex +#endif + +#ifdef yyrestart +#define hlsl_restart_ALREADY_DEFINED +#else +#define yyrestart hlsl_restart +#endif + +#ifdef yylex_init +#define hlsl_lex_init_ALREADY_DEFINED +#else +#define yylex_init hlsl_lex_init +#endif + +#ifdef yylex_init_extra +#define hlsl_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra hlsl_lex_init_extra +#endif + +#ifdef yylex_destroy +#define hlsl_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy hlsl_lex_destroy +#endif + +#ifdef yyget_debug +#define hlsl_get_debug_ALREADY_DEFINED +#else +#define yyget_debug hlsl_get_debug +#endif + +#ifdef yyset_debug +#define hlsl_set_debug_ALREADY_DEFINED +#else +#define yyset_debug hlsl_set_debug +#endif + +#ifdef yyget_extra +#define hlsl_get_extra_ALREADY_DEFINED +#else +#define yyget_extra hlsl_get_extra +#endif + +#ifdef yyset_extra +#define hlsl_set_extra_ALREADY_DEFINED +#else +#define yyset_extra hlsl_set_extra +#endif + +#ifdef yyget_in +#define hlsl_get_in_ALREADY_DEFINED +#else +#define yyget_in hlsl_get_in +#endif + +#ifdef yyset_in +#define hlsl_set_in_ALREADY_DEFINED +#else +#define yyset_in hlsl_set_in +#endif + +#ifdef yyget_out +#define hlsl_get_out_ALREADY_DEFINED +#else +#define yyget_out hlsl_get_out +#endif + +#ifdef yyset_out +#define hlsl_set_out_ALREADY_DEFINED +#else +#define yyset_out hlsl_set_out +#endif + +#ifdef yyget_leng +#define hlsl_get_leng_ALREADY_DEFINED +#else +#define yyget_leng hlsl_get_leng +#endif + +#ifdef yyget_text +#define hlsl_get_text_ALREADY_DEFINED +#else +#define yyget_text hlsl_get_text +#endif + +#ifdef yyget_lineno +#define hlsl_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno hlsl_get_lineno +#endif + +#ifdef yyset_lineno +#define hlsl_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno hlsl_set_lineno +#endif + +#ifdef yywrap +#define hlsl_wrap_ALREADY_DEFINED +#else +#define yywrap hlsl_wrap +#endif + +#ifdef yyalloc +#define hlsl_alloc_ALREADY_DEFINED +#else +#define yyalloc hlsl_alloc +#endif + +#ifdef yyrealloc +#define hlsl_realloc_ALREADY_DEFINED +#else +#define yyrealloc hlsl_realloc +#endif + +#ifdef yyfree +#define hlsl_free_ALREADY_DEFINED +#else +#define yyfree hlsl_free +#endif + +#ifdef yytext +#define hlsl_text_ALREADY_DEFINED +#else +#define yytext hlsl_text +#endif + +#ifdef yyleng +#define hlsl_leng_ALREADY_DEFINED +#else +#define yyleng hlsl_leng +#endif + +#ifdef yyin +#define hlsl_in_ALREADY_DEFINED +#else +#define yyin hlsl_in +#endif + +#ifdef yyout +#define hlsl_out_ALREADY_DEFINED +#else +#define yyout hlsl_out +#endif + +#ifdef yy_flex_debug +#define hlsl__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug hlsl__flex_debug +#endif + +#ifdef yylineno +#define hlsl_lineno_ALREADY_DEFINED +#else +#define yylineno hlsl_lineno +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +/* Begin user sect3 */ + +#define hlsl_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +extern int yylineno; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define pp 1 +#define pp_line 2 +#define pp_pragma 3 +#define pp_ignore 4 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef hlsl__create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef hlsl__delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef hlsl__scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef hlsl__scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef hlsl__scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef hlsl__init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef hlsl__flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef hlsl__load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef hlsl__switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef hlsl_push_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef hlsl_pop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef hlsl_ensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef hlsl_lex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef hlsl_restart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef hlsl_lex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef hlsl_lex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef hlsl_lex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef hlsl_get_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef hlsl_set_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef hlsl_get_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef hlsl_set_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef hlsl_get_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef hlsl_set_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef hlsl_get_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef hlsl_set_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef hlsl_get_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef hlsl_get_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef hlsl_get_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef hlsl_set_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef hlsl_get_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef hlsl_set_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef hlsl_wrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef hlsl_get_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef hlsl_set_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef hlsl_get_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef hlsl_set_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef hlsl_alloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef hlsl_realloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef hlsl_free_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef hlsl_text_ALREADY_DEFINED +#undef yytext +#endif +#ifndef hlsl_leng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef hlsl_in_ALREADY_DEFINED +#undef yyin +#endif +#ifndef hlsl_out_ALREADY_DEFINED +#undef yyout +#endif +#ifndef hlsl__flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef hlsl_lineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef hlsl_tables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef hlsl_tables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef hlsl_TABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 274 "hlsl.l" + + +#line 713 "hlsl.yy.h" +#undef hlsl_IN_HEADER +#endif /* hlsl_HEADER_H */ diff --git a/dll/directx/wine/d3dcompiler_43/main.c b/dll/directx/wine/d3dcompiler_43/main.c index 929cec0a7a4..3404655ac8e 100644 --- a/dll/directx/wine/d3dcompiler_43/main.c +++ b/dll/directx/wine/d3dcompiler_43/main.c @@ -19,8 +19,6 @@ * */ -#include "config.h" - #include #include "windef.h" diff --git a/dll/directx/wine/d3dcompiler_43/ppl.l b/dll/directx/wine/d3dcompiler_43/ppl.l new file mode 100644 index 00000000000..624dec4c99f --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/ppl.l @@ -0,0 +1,1547 @@ +/* -*-C-*- + * Wrc preprocessor lexical analysis + * + * Copyright 1999-2000 Bertho A. Stultiens (BS) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + *------------------------------------------------------------------------- + * The preprocessor's lexographical grammar (approximately): + * + * pp := {ws} # {ws} if {ws} {expr} {ws} \n + * | {ws} # {ws} ifdef {ws} {id} {ws} \n + * | {ws} # {ws} ifndef {ws} {id} {ws} \n + * | {ws} # {ws} elif {ws} {expr} {ws} \n + * | {ws} # {ws} else {ws} \n + * | {ws} # {ws} endif {ws} \n + * | {ws} # {ws} include {ws} < {anytext} > \n + * | {ws} # {ws} include {ws} " {anytext} " \n + * | {ws} # {ws} define {ws} {anytext} \n + * | {ws} # {ws} define( {arglist} ) {ws} {expansion} \n + * | {ws} # {ws} pragma {ws} {anytext} \n + * | {ws} # {ws} ident {ws} {anytext} \n + * | {ws} # {ws} error {ws} {anytext} \n + * | {ws} # {ws} warning {ws} {anytext} \n + * | {ws} # {ws} line {ws} " {anytext} " {number} \n + * | {ws} # {ws} {number} " {anytext} " {number} [ {number} [{number}] ] \n + * | {ws} # {ws} \n + * + * ws := [ \t\r\f\v]* + * + * expr := {expr} [+-*%^/|&] {expr} + * | {expr} {logor|logand} {expr} + * | [!~+-] {expr} + * | {expr} ? {expr} : {expr} + * + * logor := || + * + * logand := && + * + * id := [a-zA-Z_][a-zA-Z0-9_]* + * + * anytext := [^\n]* (see note) + * + * arglist := + * | {id} + * | {arglist} , {id} + * | {arglist} , {id} ... + * + * expansion := {id} + * | # {id} + * | {anytext} + * | {anytext} ## {anytext} + * + * number := [0-9]+ + * + * Note: "anytext" is not always "[^\n]*". This is because the + * trailing context must be considered as well. + * + * The only certain assumption for the preprocessor to make is that + * directives start at the beginning of the line, followed by a '#' + * and end with a newline. + * Any directive may be suffixed with a line-continuation. Also + * classical comment / *...* / (note: no comments within comments, + * therefore spaces) is considered to be a line-continuation + * (according to gcc and egcs AFAIK, ANSI is a bit vague). + * Comments have not been added to the above grammar for simplicity + * reasons. However, it is allowed to enter comment anywhere within + * the directives as long as they do not interfere with the context. + * All comments are considered to be deletable whitespace (both + * classical form "/ *...* /" and C++ form "//...\n"). + * + * All recursive scans, except for macro-expansion, are done by the + * parser, whereas the simple state transitions of non-recursive + * directives are done in the scanner. This results in the many + * exclusive start-conditions of the scanner. + * + * Macro expansions are slightly more difficult because they have to + * prescan the arguments. Parameter substitution is literal if the + * substitution is # or ## (either side). This enables new identifiers + * to be created (see 'info cpp' node Macro|Pitfalls|Prescan for more + * information). + * + * FIXME: Variable macro parameters is recognized, but not yet + * expanded. I have to reread the ANSI standard on the subject (yes, + * ANSI defines it). + * + * The following special defines are supported: + * __FILE__ -> "thissource.c" + * __LINE__ -> 123 + * __DATE__ -> "May 1 2000" + * __TIME__ -> "23:59:59" + * These macros expand, as expected, into their ANSI defined values. + * + * The same include prevention is implemented as gcc and egcs does. + * This results in faster processing because we do not read the text + * at all. Some wine-sources attempt to include the same file 4 or 5 + * times. This strategy also saves a lot blank output-lines, which in + * its turn improves the real resource scanner/parser. + * + */ + +/* + * Special flex options and exclusive scanner start-conditions + */ +%option stack +%option 8bit never-interactive +%option noinput nounput +%option prefix="ppy_" + +%x pp_pp +%x pp_eol +%x pp_inc +%x pp_dqs +%x pp_sqs +%x pp_iqs +%x pp_comment +%x pp_def +%x pp_define +%x pp_macro +%x pp_mbody +%x pp_macign +%x pp_macscan +%x pp_macexp +%x pp_if +%x pp_ifd +%x pp_ifignored +%x pp_endif +%x pp_line +%x pp_defined +%x pp_ignore +%x RCINCL + +ws [ \v\f\t\r] +cident [a-zA-Z_][0-9a-zA-Z_]* +ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL] + +%{ +#include +#include +#include +#include +#include +#include +#include + +#define YY_NO_UNISTD_H + +#include "wpp_private.h" +#include "ppy.tab.h" + +/* + * Make sure that we are running an appropriate version of flex. + */ +#if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005) +#error Must use flex version 2.5.1 or higher (yy_scan_* routines are required). +#endif + +#define YY_READ_BUF_SIZE 65536 /* So we read most of a file at once */ + +#define yy_current_state() YY_START +#define yy_pp_state(x) yy_pop_state(); yy_push_state(x) + +/* + * Always update the current character position within a line + */ +#define YY_USER_ACTION pp_status.char_number+=ppy_leng; + +/* + * Buffer management for includes and expansions + */ +#define MAXBUFFERSTACK 128 /* Nesting more than 128 includes or macro expansion textss is insane */ + +typedef struct bufferstackentry { + YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */ + void *filehandle; /* Handle to be used with wpp_callbacks->read */ + pp_entry_t *define; /* Points to expanding define or NULL if handling includes */ + int line_number; /* Line that we were handling */ + int char_number; /* The current position on that line */ + char *filename; /* Filename that we were handling */ + int if_depth; /* How many #if:s deep to check matching #endif:s */ + int ncontinuations; /* Remember the continuation state */ + int should_pop; /* Set if we must pop the start-state on EOF */ + /* Include management */ + include_state_t incl; + char *include_filename; +} bufferstackentry_t; + +#define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */ + +/* + * Macro expansion nesting + * We need the stack to handle expansions while scanning + * a macro's arguments. The TOS must always be the macro + * that receives the current expansion from the scanner. + */ +#define MAXMACEXPSTACK 128 /* Nesting more than 128 macro expansions is insane */ + +typedef struct macexpstackentry { + pp_entry_t *ppp; /* This macro we are scanning */ + char **args; /* With these arguments */ + char **ppargs; /* Resulting in these preprocessed arguments */ + int *nnls; /* Number of newlines per argument */ + int nargs; /* And this many arguments scanned */ + int parentheses; /* Nesting level of () */ + int curargsize; /* Current scanning argument's size */ + int curargalloc; /* Current scanning argument's block allocated */ + char *curarg; /* Current scanning argument's content */ +} macexpstackentry_t; + +#define MACROPARENTHESES() (top_macro()->parentheses) + +/* + * Prototypes + */ +static void newline(int); +static int make_number(int radix, YYSTYPE *val, const char *str, int len); +static void put_buffer(const char *s, int len); +/* Buffer management */ +static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop); +static bufferstackentry_t *pop_buffer(void); +/* String functions */ +static void new_string(void); +static void add_string(const char *str, int len); +static char *get_string(void); +static void put_string(void); +static int string_start(void); +/* Macro functions */ +static void push_macro(pp_entry_t *ppp); +static macexpstackentry_t *top_macro(void); +static macexpstackentry_t *pop_macro(void); +static void free_macro(macexpstackentry_t *mep); +static void add_text_to_macro(const char *text, int len); +static void macro_add_arg(int last); +static void macro_add_expansion(void); +/* Expansion */ +static void expand_special(pp_entry_t *ppp); +static void expand_define(pp_entry_t *ppp); +static void expand_macro(macexpstackentry_t *mep); + +/* + * Local variables + */ +static int ncontinuations; + +static int strbuf_idx = 0; +static int strbuf_alloc = 0; +static char *strbuffer = NULL; +static int str_startline; + +static macexpstackentry_t *macexpstack[MAXMACEXPSTACK]; +static int macexpstackidx = 0; + +static bufferstackentry_t bufferstack[MAXBUFFERSTACK]; +static int bufferstackidx = 0; + +/* + * Global variables + */ +include_state_t pp_incl_state = +{ + -1, /* state */ + NULL, /* ppp */ + 0, /* ifdepth */ + 0 /* seen_junk */ +}; + +includelogicentry_t *pp_includelogiclist = NULL; + +#define YY_INPUT(buf,result,max_size) \ + { \ + result = wpp_read(pp_status.file, buf, max_size); \ + } + +#define BUFFERINITIALCAPACITY 256 + +void WINAPIV pp_writestring(const char *format, ...) +{ + __ms_va_list valist; + int len; + static char *buffer; + static int buffercapacity; + char *new_buffer; + + if(buffercapacity == 0) + { + buffer = pp_xmalloc(BUFFERINITIALCAPACITY); + if(buffer == NULL) + return; + buffercapacity = BUFFERINITIALCAPACITY; + } + + __ms_va_start(valist, format); + len = vsnprintf(buffer, buffercapacity, + format, valist); + __ms_va_end(valist); + /* If the string is longer than buffersize, vsnprintf returns + * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ + while(len > buffercapacity || len < 0) + { + do + { + buffercapacity *= 2; + } while(len > buffercapacity); + + new_buffer = pp_xrealloc(buffer, buffercapacity); + if(new_buffer == NULL) + return; + buffer = new_buffer; + __ms_va_start(valist, format); + len = vsnprintf(buffer, buffercapacity, + format, valist); + __ms_va_end(valist); + } + + wpp_write(buffer, len); +} + +%} + +/* + ************************************************************************** + * The scanner starts here + ************************************************************************** + */ + +%% + /* + * Catch line-continuations. + * Note: Gcc keeps the line-continuations in, for example, strings + * intact. However, I prefer to remove them all so that the next + * scanner will not need to reduce the continuation state. + * + * <*>\\\n newline(0); + */ + + /* + * Detect the leading # of a preprocessor directive. + */ +^{ws}*# pp_incl_state.seen_junk++; yy_push_state(pp_pp); + + /* + * Scan for the preprocessor directives + */ +{ws}*include{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);} +{ws}*define{ws}* yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol); +{ws}*error{ws}* yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR; +{ws}*warning{ws}* yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING; +{ws}*pragma{ws}* yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA; +{ws}*ident{ws}* yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT; +{ws}*undef{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);} +{ws}*ifdef{ws}* yy_pp_state(pp_ifd); return tIFDEF; +{ws}*ifndef{ws}* pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF; +{ws}*if{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_if);} else {yy_pp_state(pp_ifignored);} return tIF; +{ws}*elif{ws}* yy_pp_state(pp_if); return tELIF; +{ws}*else{ws}* yy_pp_state(pp_endif); return tELSE; +{ws}*endif{ws}* yy_pp_state(pp_endif); return tENDIF; +{ws}*line{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);} +{ws}+ if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);} +{ws}*[a-z]+ ppy_error("Invalid preprocessor token '%s'", ppy_text); +\r?\n newline(1); yy_pop_state(); return tNL; /* This could be the null-token */ +\\\r?\n newline(0); +\\\r? ppy_error("Preprocessor junk '%s'", ppy_text); +. return *ppy_text; + + /* + * Handle #include and #line + */ +[0-9]+ return make_number(10, &ppy_lval, ppy_text, ppy_leng); +\< new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_iqs); +\" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); +{ws}+ ; +\n newline(1); yy_pop_state(); return tNL; +\\\r?\n newline(0); +(\\\r?)|(.) ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line"); + + /* + * Ignore all input when a false clause is parsed + */ +[^#/\\\n]+ ; +\n newline(1); +\\\r?\n newline(0); +(\\\r?)|(.) ; + + /* + * Handle #if and #elif. + * These require conditionals to be evaluated, but we do not + * want to jam the scanner normally when we see these tokens. + * Note: tIDENT is handled below. + */ + +0[0-7]*{ul}? return make_number(8, &ppy_lval, ppy_text, ppy_leng); +0[0-7]*[8-9]+{ul}? ppy_error("Invalid octal digit"); +[1-9][0-9]*{ul}? return make_number(10, &ppy_lval, ppy_text, ppy_leng); +0[xX][0-9a-fA-F]+{ul}? return make_number(16, &ppy_lval, ppy_text, ppy_leng); +0[xX] ppy_error("Invalid hex number"); +defined yy_push_state(pp_defined); return tDEFINED; +"<<" return tLSHIFT; +">>" return tRSHIFT; +"&&" return tLOGAND; +"||" return tLOGOR; +"==" return tEQ; +"!=" return tNE; +"<=" return tLTE; +">=" return tGTE; +\n newline(1); yy_pop_state(); return tNL; +\\\r?\n newline(0); +\\\r? ppy_error("Junk in conditional expression"); +{ws}+ ; +\' new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); +\" ppy_error("String constants not allowed in conditionals"); +. return *ppy_text; + +[^\n]+ ppy_lval.sint = 0; return tSINT; +\n newline(1); yy_pop_state(); return tNL; + + /* + * Handle #ifdef, #ifndef and #undef + * to get only an untranslated/unexpanded identifier + */ +{cident} ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; +{ws}+ ; +\n newline(1); yy_pop_state(); return tNL; +\\\r?\n newline(0); +(\\\r?)|(.) ppy_error("Identifier expected"); + + /* + * Handle #else and #endif. + */ +{ws}+ ; +\n newline(1); yy_pop_state(); return tNL; +\\\r?\n newline(0); +. ppy_error("Garbage after #else or #endif."); + + /* + * Handle the special 'defined' keyword. + * This is necessary to get the identifier prior to any + * substitutions. + */ +{cident} yy_pop_state(); ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; +{ws}+ ; +(\()|(\)) return *ppy_text; +\\\r?\n newline(0); +(\\.)|(\n)|(.) ppy_error("Identifier expected"); + + /* + * Handle #error, #warning, #pragma and #ident. + * Pass everything literally to the parser, which + * will act appropriately. + * Comments are stripped from the literal text. + */ +[^/\\\n]+ if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } +\/[^/\\\n*]* if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } +(\\\r?)|(\/[^/*]) if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } +\n newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; } +\\\r?\n newline(0); + + /* + * Handle left side of #define + */ +{cident}\( ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; +{cident} ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE; +{ws}+ ; +\\\r?\n newline(0); +(\\\r?)|(\n)|(.) perror("Identifier expected"); + + /* + * Scan the substitution of a define + */ +[^'"/\\\n]+ ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; +(\\\r?)|(\/[^/*]) ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; +\\\r?\n{ws}+ newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; +\\\r?\n newline(0); +\n newline(1); yy_pop_state(); return tNL; +\' new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); +\" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + + /* + * Scan the definition macro arguments + */ +\){ws}* yy_pp_state(pp_mbody); return tMACROEND; +{ws}+ ; +{cident} ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; +, return ','; +"..." return tELIPSIS; +(\\\r?)|(\n)|(.)|(\.\.?) ppy_error("Argument identifier expected"); +\\\r?\n newline(0); + + /* + * Scan the substitution of a macro + */ +[^a-zA-Z0-9'"#/\\\n]+ ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; +{cident} ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; +\#\# return tCONCAT; +\# return tSTRINGIZE; +[0-9][a-zA-Z0-9]*[^a-zA-Z0-9'"#/\\\n]* ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; +(\\\r?)|(\/[^/*'"#\\\n]*) ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; +\\\r?\n{ws}+ newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; +\\\r?\n newline(0); +\n newline(1); yy_pop_state(); return tNL; +\' new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); +\" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + + /* + * Macro expansion text scanning. + * This state is active just after the identifier is scanned + * that triggers an expansion. We *must* delete the leading + * whitespace before we can start scanning for arguments. + * + * If we do not see a '(' as next trailing token, then we have + * a false alarm. We just continue with a nose-bleed... + */ +{ws}*/\( yy_pp_state(pp_macscan); +{ws}*\n { + if(yy_top_state() != pp_macscan) + newline(0); + } +{ws}*\\\r?\n newline(0); +{ws}+|{ws}*\\\r?|. { + macexpstackentry_t *mac = pop_macro(); + yy_pop_state(); + put_buffer(mac->ppp->ident, strlen(mac->ppp->ident)); + put_buffer(ppy_text, ppy_leng); + free_macro(mac); + } + + /* + * Macro expansion argument text scanning. + * This state is active when a macro's arguments are being read for expansion. + */ +\( { + if(++MACROPARENTHESES() > 1) + add_text_to_macro(ppy_text, ppy_leng); + } +\) { + if(--MACROPARENTHESES() == 0) + { + yy_pop_state(); + macro_add_arg(1); + } + else + add_text_to_macro(ppy_text, ppy_leng); + } +, { + if(MACROPARENTHESES() > 1) + add_text_to_macro(ppy_text, ppy_leng); + else + macro_add_arg(0); + } +\" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); +\' new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); +"/*" yy_push_state(pp_comment); add_text_to_macro(" ", 1); +\n pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(ppy_text, ppy_leng); +([^/(),\\\n"']+)|(\/[^/*(),\\\n'"]*)|(\\\r?)|(.) add_text_to_macro(ppy_text, ppy_leng); +\\\r?\n newline(0); + + /* + * Comment handling (almost all start-conditions) + */ +"/*" yy_push_state(pp_comment); +[^*\n]*|"*"+[^*/\n]* ; +\n newline(0); +"*"+"/" yy_pop_state(); + + /* + * Remove C++ style comment (almost all start-conditions) + */ +"//"[^\n]* { + if(ppy_text[ppy_leng-1] == '\\') + ppy_warning("C++ style comment ends with an escaped newline (escape ignored)"); + } + + /* + * Single, double and <> quoted constants + */ +\" pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); +\' pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); +[^"\\\n]+ add_string(ppy_text, ppy_leng); +\" { + add_string(ppy_text, ppy_leng); + yy_pop_state(); + switch(yy_current_state()) + { + case pp_pp: + case pp_define: + case pp_mbody: + case pp_inc: + case RCINCL: + if (yy_current_state()==RCINCL) yy_pop_state(); + ppy_lval.cptr = get_string(); + return tDQSTRING; + case pp_line: + ppy_lval.cptr = get_string(); + return tDQSTRING; + default: + put_string(); + } + } +[^'\\\n]+ add_string(ppy_text, ppy_leng); +\' { + add_string(ppy_text, ppy_leng); + yy_pop_state(); + switch(yy_current_state()) + { + case pp_if: + case pp_define: + case pp_mbody: + ppy_lval.cptr = get_string(); + return tSQSTRING; + default: + put_string(); + } + } +[^\>\\\n]+ add_string(ppy_text, ppy_leng); +\> { + add_string(ppy_text, ppy_leng); + yy_pop_state(); + ppy_lval.cptr = get_string(); + return tIQSTRING; + } +\\\r?\n { + /* + * This is tricky; we need to remove the line-continuation + * from preprocessor strings, but OTOH retain them in all + * other strings. This is because the resource grammar is + * even more braindead than initially analysed and line- + * continuations in strings introduce, sigh, newlines in + * the output. There goes the concept of non-breaking, non- + * spacing whitespace. + */ + switch(yy_top_state()) + { + case pp_pp: + case pp_define: + case pp_mbody: + case pp_inc: + case pp_line: + newline(0); + break; + default: + add_string(ppy_text, ppy_leng); + newline(-1); + } + } +\\. add_string(ppy_text, ppy_leng); +\n { + newline(1); + add_string(ppy_text, ppy_leng); + ppy_warning("Newline in string constant encountered (started line %d)", string_start()); + } + + /* + * Identifier scanning + */ +{cident} { + pp_entry_t *ppp; + pp_incl_state.seen_junk++; + if(!(ppp = pplookup(ppy_text))) + { + if(yy_current_state() == pp_inc) + ppy_error("Expected include filename"); + + else if(yy_current_state() == pp_if) + { + ppy_lval.cptr = pp_xstrdup(ppy_text); + return tIDENT; + } + else { + if((yy_current_state()==INITIAL) && (strcasecmp(ppy_text,"RCINCLUDE")==0)){ + yy_push_state(RCINCL); + return tRCINCLUDE; + } + else put_buffer(ppy_text, ppy_leng); + } + } + else if(!ppp->expanding) + { + switch(ppp->type) + { + case def_special: + expand_special(ppp); + break; + case def_define: + expand_define(ppp); + break; + case def_macro: + yy_push_state(pp_macign); + push_macro(ppp); + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type); + } + } + else put_buffer(ppy_text, ppy_leng); + } + + /* + * Everything else that needs to be passed and + * newline and continuation handling + */ +[^a-zA-Z_#'"/\\\n \r\t\f\v]+|(\/|\\)[^a-zA-Z_/*'"\\\n \r\t\v\f]* pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); +{ws}+ put_buffer(ppy_text, ppy_leng); +\n newline(1); +\\\r?\n newline(0); +\\\r? pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); + + /* + * Special catcher for macro argmument expansion to prevent + * newlines to propagate to the output or admin. + */ +(\n)|(.)|(\\\r?(\n|.)) put_buffer(ppy_text, ppy_leng); + +[A-Za-z0-9_\.\\/]+ { + ppy_lval.cptr=pp_xstrdup(ppy_text); + yy_pop_state(); + return tRCINCLUDEPATH; + } + +{ws}+ ; + +\" { + new_string(); add_string(ppy_text,ppy_leng);yy_push_state(pp_dqs); + } + + /* + * This is a 'catch-all' rule to discover errors in the scanner + * in an orderly manner. + */ +<*>. pp_incl_state.seen_junk++; ppy_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_text); + +<> { + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + bufferstackentry_t *bep = pop_buffer(); + + if((!bep && pp_get_if_depth()) || (bep && pp_get_if_depth() != bep->if_depth)) + ppy_warning("Unmatched #if/#endif at end of file"); + + if(!bep) + { + if(YY_START != INITIAL) + { + ppy_error("Unexpected end of file during preprocessing"); + BEGIN(INITIAL); + } + yyterminate(); + } + else if(bep->should_pop == 2) + { + macexpstackentry_t *mac; + mac = pop_macro(); + expand_macro(mac); + } + ppy__delete_buffer(b); + } + +%% +/* + ************************************************************************** + * Support functions + ************************************************************************** + */ + +#ifndef ppy_wrap +int ppy_wrap(void) +{ + return 1; +} +#endif + + +/* + *------------------------------------------------------------------------- + * Output newlines or set them as continuations + * + * Input: -1 - Don't count this one, but update local position (see pp_dqs) + * 0 - Line-continuation seen and cache output + * 1 - Newline seen and flush output + *------------------------------------------------------------------------- + */ +static void newline(int dowrite) +{ + pp_status.line_number++; + pp_status.char_number = 1; + + if(dowrite == -1) + return; + + ncontinuations++; + if(dowrite) + { + for(;ncontinuations; ncontinuations--) + put_buffer("\n", 1); + } +} + + +/* + *------------------------------------------------------------------------- + * Make a number out of an any-base and suffixed string + * + * Possible number extensions: + * - "" int + * - "L" long int + * - "LL" long long int + * - "U" unsigned int + * - "UL" unsigned long int + * - "ULL" unsigned long long int + * - "LU" unsigned long int + * - "LLU" unsigned long long int + * - "LUL" invalid + * + * FIXME: + * The sizes of resulting 'int' and 'long' are compiler specific. + * I depend on sizeof(int) > 2 here (although a relatively safe + * assumption). + * Long longs are not yet implemented because this is very compiler + * specific and I don't want to think too much about the problems. + * + *------------------------------------------------------------------------- + */ +static int make_number(int radix, YYSTYPE *val, const char *str, int len) +{ + int is_l = 0; + int is_ll = 0; + int is_u = 0; + char ext[4]; + long l; + + ext[3] = '\0'; + ext[2] = toupper(str[len-1]); + ext[1] = len > 1 ? toupper(str[len-2]) : ' '; + ext[0] = len > 2 ? toupper(str[len-3]) : ' '; + + if(!strcmp(ext, "LUL")) + { + ppy_error("Invalid constant suffix"); + return 0; + } + else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL")) + { + is_ll++; + is_u++; + } + else if(!strcmp(ext+1, "LU") || !strcmp(ext+1, "UL")) + { + is_l++; + is_u++; + } + else if(!strcmp(ext+1, "LL")) + { + is_ll++; + } + else if(!strcmp(ext+2, "L")) + { + is_l++; + } + else if(!strcmp(ext+2, "U")) + { + is_u++; + } + + if(is_u && is_ll) + { + errno = 0; + val->ull = _strtoui64(str, NULL, radix); + if (val->ull == ULLONG_MAX && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tULONGLONG; + } + else if(!is_u && is_ll) + { + errno = 0; + val->sll = _strtoi64(str, NULL, radix); + if ((val->sll == LLONG_MIN || val->sll == LLONG_MAX) && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tSLONGLONG; + } + else if(is_u && is_l) + { + errno = 0; + val->ulong = strtoul(str, NULL, radix); + if (val->ulong == ULONG_MAX && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tULONG; + } + else if(!is_u && is_l) + { + errno = 0; + val->slong = strtol(str, NULL, radix); + if ((val->slong == LONG_MIN || val->slong == LONG_MAX) && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tSLONG; + } + else if(is_u && !is_l) + { + unsigned long ul; + errno = 0; + ul = strtoul(str, NULL, radix); + if ((ul == ULONG_MAX && errno == ERANGE) || (ul > UINT_MAX)) + ppy_error("integer constant %s is too large\n", str); + val->uint = (unsigned int)ul; + return tUINT; + } + + /* Else it must be an int... */ + errno = 0; + l = strtol(str, NULL, radix); + if (((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE) || + (l > INT_MAX) || (l < INT_MIN)) + ppy_error("integer constant %s is too large\n", str); + val->sint = (int)l; + return tSINT; +} + + +/* + *------------------------------------------------------------------------- + * Macro and define expansion support + * + * FIXME: Variable macro arguments. + *------------------------------------------------------------------------- + */ +static void expand_special(pp_entry_t *ppp) +{ + static char *buf = NULL; + char *new_buf; + + assert(ppp->type == def_special); + + if(!strcmp(ppp->ident, "__LINE__")) + { + new_buf = pp_xrealloc(buf, 32); + if(!new_buf) + return; + buf = new_buf; + sprintf(buf, "%d", pp_status.line_number); + } + else if(!strcmp(ppp->ident, "__FILE__")) + { + new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + if(!new_buf) + return; + buf = new_buf; + sprintf(buf, "\"%s\"", pp_status.input); + } + else + pp_internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident); + + if(buf && buf[0]) + { + push_buffer(ppp, NULL, NULL, 0); + yy_scan_string(buf); + } +} + +static void expand_define(pp_entry_t *ppp) +{ + assert(ppp->type == def_define); + + if(ppp->subst.text && ppp->subst.text[0]) + { + push_buffer(ppp, NULL, NULL, 0); + yy_scan_string(ppp->subst.text); + } +} + +static int curdef_idx = 0; +static int curdef_alloc = 0; +static char *curdef_text = NULL; + +static void add_text(const char *str, int len) +{ + int new_alloc; + char *new_text; + + if(len == 0) + return; + if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len) + { + new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0])); + if(!new_text) + return; + curdef_text = new_text; + curdef_alloc = new_alloc; + if(curdef_alloc > 65536) + ppy_warning("Reallocating macro-expansion buffer larger than 64kB"); + } + memcpy(&curdef_text[curdef_idx], str, len); + curdef_idx += len; +} + +static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl) +{ + char *cptr; + char *exp; + int tag; + int n; + + if(mtp == NULL) + return NULL; + + switch(mtp->type) + { + case exp_text: + add_text(mtp->subst.text, strlen(mtp->subst.text)); + break; + + case exp_stringize: + cptr = mep->args[mtp->subst.argidx]; + add_text("\"", 1); + while(*cptr) + { + if(*cptr == '"' || *cptr == '\\') + add_text("\\", 1); + add_text(cptr, 1); + cptr++; + } + add_text("\"", 1); + break; + + case exp_concat: + /* Remove trailing whitespace from current expansion text */ + while(curdef_idx) + { + if(isspace(curdef_text[curdef_idx-1] & 0xff)) + curdef_idx--; + else + break; + } + /* tag current position and recursively expand the next part */ + tag = curdef_idx; + mtp = add_expand_text(mtp->next, mep, nnl); + + /* Now get rid of the leading space of the expansion */ + cptr = &curdef_text[tag]; + n = curdef_idx - tag; + while(n) + { + if(isspace(*cptr & 0xff)) + { + cptr++; + n--; + } + else + break; + } + if(cptr != &curdef_text[tag]) + { + memmove(&curdef_text[tag], cptr, n); + curdef_idx -= (curdef_idx - tag) - n; + } + break; + + case exp_subst: + if((mtp->next && mtp->next->type == exp_concat) || (mtp->prev && mtp->prev->type == exp_concat)) + exp = mep->args[mtp->subst.argidx]; + else + exp = mep->ppargs[mtp->subst.argidx]; + if(exp) + { + add_text(exp, strlen(exp)); + *nnl -= mep->nnls[mtp->subst.argidx]; + cptr = strchr(exp, '\n'); + while(cptr) + { + *cptr = ' '; + cptr = strchr(cptr+1, '\n'); + } + mep->nnls[mtp->subst.argidx] = 0; + } + break; + + default: + pp_internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type); + } + return mtp; +} + +static void expand_macro(macexpstackentry_t *mep) +{ + mtext_t *mtp; + int n, k; + char *cptr; + int nnl = 0; + pp_entry_t *ppp = mep->ppp; + int nargs = mep->nargs; + + assert(ppp->type == def_macro); + assert(ppp->expanding == 0); + + if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs)) + { + ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs); + return; + } + + for(n = 0; n < nargs; n++) + nnl += mep->nnls[n]; + + curdef_idx = 0; + + for(mtp = ppp->subst.mtext; mtp; mtp = mtp->next) + { + if(!(mtp = add_expand_text(mtp, mep, &nnl))) + break; + } + + for(n = 0; n < nnl; n++) + add_text("\n", 1); + + /* To make sure there is room and termination (see below) */ + add_text(" \0", 2); + + /* Strip trailing whitespace from expansion */ + for(k = curdef_idx, cptr = &curdef_text[curdef_idx-1]; k > 0; k--, cptr--) + { + if(!isspace(*cptr & 0xff)) + break; + } + + /* + * We must add *one* whitespace to make sure that there + * is a token-separation after the expansion. + */ + *(++cptr) = ' '; + *(++cptr) = '\0'; + k++; + + /* Strip leading whitespace from expansion */ + for(n = 0, cptr = curdef_text; n < k; n++, cptr++) + { + if(!isspace(*cptr & 0xff)) + break; + } + + if(k - n > 0) + { + push_buffer(ppp, NULL, NULL, 0); + /*yy_scan_bytes(curdef_text + n, k - n);*/ + yy_scan_string(curdef_text + n); + } +} + +/* + *------------------------------------------------------------------------- + * String collection routines + *------------------------------------------------------------------------- + */ +static void new_string(void) +{ +#ifdef DEBUG + if(strbuf_idx) + ppy_warning("new_string: strbuf_idx != 0"); +#endif + strbuf_idx = 0; + str_startline = pp_status.line_number; +} + +static void add_string(const char *str, int len) +{ + int new_alloc; + char *new_buffer; + + if(len == 0) + return; + if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len) + { + new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0])); + if(!new_buffer) + return; + strbuffer = new_buffer; + strbuf_alloc = new_alloc; + if(strbuf_alloc > 65536) + ppy_warning("Reallocating string buffer larger than 64kB"); + } + memcpy(&strbuffer[strbuf_idx], str, len); + strbuf_idx += len; +} + +static char *get_string(void) +{ + char *str = pp_xmalloc(strbuf_idx + 1); + if(!str) + return NULL; + memcpy(str, strbuffer, strbuf_idx); + str[strbuf_idx] = '\0'; +#ifdef DEBUG + strbuf_idx = 0; +#endif + return str; +} + +static void put_string(void) +{ + put_buffer(strbuffer, strbuf_idx); +#ifdef DEBUG + strbuf_idx = 0; +#endif +} + +static int string_start(void) +{ + return str_startline; +} + + +/* + *------------------------------------------------------------------------- + * Buffer management + *------------------------------------------------------------------------- + */ +static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop) +{ + if(bufferstackidx >= MAXBUFFERSTACK) + pp_internal_error(__FILE__, __LINE__, "Buffer stack overflow"); + + memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0])); + bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER; + bufferstack[bufferstackidx].filehandle = pp_status.file; + bufferstack[bufferstackidx].define = ppp; + bufferstack[bufferstackidx].line_number = pp_status.line_number; + bufferstack[bufferstackidx].char_number = pp_status.char_number; + bufferstack[bufferstackidx].if_depth = pp_get_if_depth(); + bufferstack[bufferstackidx].should_pop = pop; + bufferstack[bufferstackidx].filename = pp_status.input; + bufferstack[bufferstackidx].ncontinuations = ncontinuations; + bufferstack[bufferstackidx].incl = pp_incl_state; + bufferstack[bufferstackidx].include_filename = incname; + + if(ppp) + ppp->expanding = 1; + else if(filename) + { + /* These will track the ppy_error to the correct file and line */ + pp_status.line_number = 1; + pp_status.char_number = 1; + pp_status.input = filename; + ncontinuations = 0; + } + else if(!pop) + pp_internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to"); + bufferstackidx++; +} + +static bufferstackentry_t *pop_buffer(void) +{ + if(bufferstackidx < 0) + pp_internal_error(__FILE__, __LINE__, "Bufferstack underflow?"); + + if(bufferstackidx == 0) + return NULL; + + bufferstackidx--; + + if(bufferstack[bufferstackidx].define) + bufferstack[bufferstackidx].define->expanding = 0; + else + { + includelogicentry_t *iep = NULL; + + if(!bufferstack[bufferstackidx].should_pop) + { + wpp_close(pp_status.file); + pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename); + + /* We have EOF, check the include logic */ + if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp) + { + pp_entry_t *ppp = pplookup(pp_incl_state.ppp); + if(ppp) + { + iep = pp_xmalloc(sizeof(includelogicentry_t)); + if (iep) + { + iep->ppp = ppp; + ppp->iep = iep; + iep->filename = bufferstack[bufferstackidx].include_filename; + iep->prev = NULL; + iep->next = pp_includelogiclist; + if(iep->next) + iep->next->prev = iep; + pp_includelogiclist = iep; + } + } + } + free(pp_incl_state.ppp); + pp_incl_state = bufferstack[bufferstackidx].incl; + + } + if (bufferstack[bufferstackidx].include_filename) + { + free(pp_status.input); + pp_status.input = bufferstack[bufferstackidx].filename; + } + pp_status.line_number = bufferstack[bufferstackidx].line_number; + pp_status.char_number = bufferstack[bufferstackidx].char_number; + ncontinuations = bufferstack[bufferstackidx].ncontinuations; + if (!iep) + free(bufferstack[bufferstackidx].include_filename); + } + + pp_status.file = bufferstack[bufferstackidx].filehandle; + ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate); + + if(bufferstack[bufferstackidx].should_pop) + { + if(yy_current_state() == pp_macexp) + macro_add_expansion(); + else + pp_internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state"); + yy_pop_state(); + } + + return &bufferstack[bufferstackidx]; +} + + +/* + *------------------------------------------------------------------------- + * Macro nestng support + *------------------------------------------------------------------------- + */ +static void push_macro(pp_entry_t *ppp) +{ + if(macexpstackidx >= MAXMACEXPSTACK) + { + ppy_error("Too many nested macros"); + return; + } + + macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0])); + if(!macexpstack[macexpstackidx]) + return; + memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0])); + macexpstack[macexpstackidx]->ppp = ppp; + macexpstackidx++; +} + +static macexpstackentry_t *top_macro(void) +{ + return macexpstackidx > 0 ? macexpstack[macexpstackidx-1] : NULL; +} + +static macexpstackentry_t *pop_macro(void) +{ + if(macexpstackidx <= 0) + pp_internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n"); + return macexpstack[--macexpstackidx]; +} + +static void free_macro(macexpstackentry_t *mep) +{ + int i; + + for(i = 0; i < mep->nargs; i++) + free(mep->args[i]); + free(mep->args); + free(mep->nnls); + free(mep->curarg); + free(mep); +} + +static void add_text_to_macro(const char *text, int len) +{ + macexpstackentry_t *mep = top_macro(); + + assert(mep->ppp->expanding == 0); + + if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */ + { + char *new_curarg; + int new_alloc = mep->curargalloc + ((ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1); + new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0])); + if(!new_curarg) + return; + mep->curarg = new_curarg; + mep->curargalloc = new_alloc; + } + memcpy(mep->curarg + mep->curargsize, text, len); + mep->curargsize += len; + mep->curarg[mep->curargsize] = '\0'; +} + +static void macro_add_arg(int last) +{ + int nnl = 0; + char *cptr; + char **new_args, **new_ppargs; + int *new_nnls; + macexpstackentry_t *mep = top_macro(); + + assert(mep->ppp->expanding == 0); + + new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); + if(!new_args) + return; + mep->args = new_args; + + new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); + if(!new_ppargs) + return; + mep->ppargs = new_ppargs; + + new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + if(!new_nnls) + return; + mep->nnls = new_nnls; + + mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + if(!mep->args[mep->nargs]) + return; + cptr = mep->args[mep->nargs]-1; + while((cptr = strchr(cptr+1, '\n'))) + { + nnl++; + } + mep->nnls[mep->nargs] = nnl; + mep->nargs++; + free(mep->curarg); + mep->curargalloc = mep->curargsize = 0; + mep->curarg = NULL; + + /* Each macro argument must be expanded to cope with stingize */ + if(last || mep->args[mep->nargs-1][0]) + { + yy_push_state(pp_macexp); + push_buffer(NULL, NULL, NULL, last ? 2 : 1); + yy_scan_string(mep->args[mep->nargs-1]); + /*mep->bufferstackidx = bufferstackidx; But not nested! */ + } +} + +static void macro_add_expansion(void) +{ + macexpstackentry_t *mep = top_macro(); + + assert(mep->ppp->expanding == 0); + + mep->ppargs[mep->nargs-1] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + free(mep->curarg); + mep->curargalloc = mep->curargsize = 0; + mep->curarg = NULL; +} + + +/* + *------------------------------------------------------------------------- + * Output management + *------------------------------------------------------------------------- + */ +static void put_buffer(const char *s, int len) +{ + if(top_macro()) + add_text_to_macro(s, len); + else + wpp_write(s, len); +} + + +/* + *------------------------------------------------------------------------- + * Include management + *------------------------------------------------------------------------- + */ +void pp_do_include(char *fname, int type) +{ + char *newpath; + int n; + includelogicentry_t *iep; + void *fp; + + if(!fname) + return; + + for(iep = pp_includelogiclist; iep; iep = iep->next) + { + if(!strcmp(iep->filename, fname)) + { + /* + * We are done. The file was included before. + * If the define was deleted, then this entry would have + * been deleted too. + */ + free(fname); + return; + } + } + + n = strlen(fname); + + if(n <= 2) + { + ppy_error("Empty include filename"); + free(fname); + return; + } + + /* Undo the effect of the quotation */ + fname[n-1] = '\0'; + + if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL) + { + ppy_error("Unable to open include file %s", fname+1); + free(fname); + return; + } + + fname[n-1] = *fname; /* Redo the quotes */ + push_buffer(NULL, newpath, fname, 0); + pp_incl_state.seen_junk = 0; + pp_incl_state.state = 0; + pp_incl_state.ppp = NULL; + + pp_status.file = fp; + ppy__switch_to_buffer(ppy__create_buffer(NULL, YY_BUF_SIZE)); + + pp_writestring("# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); +} + +/* + *------------------------------------------------------------------------- + * Push/pop preprocessor ignore state when processing conditionals + * which are false. + *------------------------------------------------------------------------- + */ +void pp_push_ignore_state(void) +{ + yy_push_state(pp_ignore); +} + +void pp_pop_ignore_state(void) +{ + yy_pop_state(); +} diff --git a/dll/directx/wine/d3dcompiler_43/ppl.yy.c b/dll/directx/wine/d3dcompiler_43/ppl.yy.c new file mode 100644 index 00000000000..90019d4cd71 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/ppl.yy.c @@ -0,0 +1,4757 @@ +#line 1 "ppl.yy.c" + +#line 3 "ppl.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer ppy__create_buffer +#define yy_delete_buffer ppy__delete_buffer +#define yy_scan_buffer ppy__scan_buffer +#define yy_scan_string ppy__scan_string +#define yy_scan_bytes ppy__scan_bytes +#define yy_init_buffer ppy__init_buffer +#define yy_flush_buffer ppy__flush_buffer +#define yy_load_buffer_state ppy__load_buffer_state +#define yy_switch_to_buffer ppy__switch_to_buffer +#define yypush_buffer_state ppy_push_buffer_state +#define yypop_buffer_state ppy_pop_buffer_state +#define yyensure_buffer_stack ppy_ensure_buffer_stack +#define yy_flex_debug ppy__flex_debug +#define yyin ppy_in +#define yyleng ppy_leng +#define yylex ppy_lex +#define yylineno ppy_lineno +#define yyout ppy_out +#define yyrestart ppy_restart +#define yytext ppy_text +#define yywrap ppy_wrap +#define yyalloc ppy_alloc +#define yyrealloc ppy_realloc +#define yyfree ppy_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define ppy__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer ppy__create_buffer +#endif + +#ifdef yy_delete_buffer +#define ppy__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer ppy__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define ppy__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer ppy__scan_buffer +#endif + +#ifdef yy_scan_string +#define ppy__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string ppy__scan_string +#endif + +#ifdef yy_scan_bytes +#define ppy__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes ppy__scan_bytes +#endif + +#ifdef yy_init_buffer +#define ppy__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer ppy__init_buffer +#endif + +#ifdef yy_flush_buffer +#define ppy__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer ppy__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define ppy__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state ppy__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define ppy__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer ppy__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define ppy_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state ppy_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define ppy_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state ppy_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define ppy_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack ppy_ensure_buffer_stack +#endif + +#ifdef yylex +#define ppy_lex_ALREADY_DEFINED +#else +#define yylex ppy_lex +#endif + +#ifdef yyrestart +#define ppy_restart_ALREADY_DEFINED +#else +#define yyrestart ppy_restart +#endif + +#ifdef yylex_init +#define ppy_lex_init_ALREADY_DEFINED +#else +#define yylex_init ppy_lex_init +#endif + +#ifdef yylex_init_extra +#define ppy_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra ppy_lex_init_extra +#endif + +#ifdef yylex_destroy +#define ppy_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy ppy_lex_destroy +#endif + +#ifdef yyget_debug +#define ppy_get_debug_ALREADY_DEFINED +#else +#define yyget_debug ppy_get_debug +#endif + +#ifdef yyset_debug +#define ppy_set_debug_ALREADY_DEFINED +#else +#define yyset_debug ppy_set_debug +#endif + +#ifdef yyget_extra +#define ppy_get_extra_ALREADY_DEFINED +#else +#define yyget_extra ppy_get_extra +#endif + +#ifdef yyset_extra +#define ppy_set_extra_ALREADY_DEFINED +#else +#define yyset_extra ppy_set_extra +#endif + +#ifdef yyget_in +#define ppy_get_in_ALREADY_DEFINED +#else +#define yyget_in ppy_get_in +#endif + +#ifdef yyset_in +#define ppy_set_in_ALREADY_DEFINED +#else +#define yyset_in ppy_set_in +#endif + +#ifdef yyget_out +#define ppy_get_out_ALREADY_DEFINED +#else +#define yyget_out ppy_get_out +#endif + +#ifdef yyset_out +#define ppy_set_out_ALREADY_DEFINED +#else +#define yyset_out ppy_set_out +#endif + +#ifdef yyget_leng +#define ppy_get_leng_ALREADY_DEFINED +#else +#define yyget_leng ppy_get_leng +#endif + +#ifdef yyget_text +#define ppy_get_text_ALREADY_DEFINED +#else +#define yyget_text ppy_get_text +#endif + +#ifdef yyget_lineno +#define ppy_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno ppy_get_lineno +#endif + +#ifdef yyset_lineno +#define ppy_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno ppy_set_lineno +#endif + +#ifdef yywrap +#define ppy_wrap_ALREADY_DEFINED +#else +#define yywrap ppy_wrap +#endif + +#ifdef yyalloc +#define ppy_alloc_ALREADY_DEFINED +#else +#define yyalloc ppy_alloc +#endif + +#ifdef yyrealloc +#define ppy_realloc_ALREADY_DEFINED +#else +#define yyrealloc ppy_realloc +#endif + +#ifdef yyfree +#define ppy_free_ALREADY_DEFINED +#else +#define yyfree ppy_free +#endif + +#ifdef yytext +#define ppy_text_ALREADY_DEFINED +#else +#define yytext ppy_text +#endif + +#ifdef yyleng +#define ppy_leng_ALREADY_DEFINED +#else +#define yyleng ppy_leng +#endif + +#ifdef yyin +#define ppy_in_ALREADY_DEFINED +#else +#define yyin ppy_in +#endif + +#ifdef yyout +#define ppy_out_ALREADY_DEFINED +#else +#define yyout ppy_out +#endif + +#ifdef yy_flex_debug +#define ppy__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug ppy__flex_debug +#endif + +#ifdef yylineno +#define ppy_lineno_ALREADY_DEFINED +#else +#define yylineno ppy_lineno +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +#define YY_NUM_RULES 145 +#define YY_END_OF_BUFFER 146 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[421] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 119, 119, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 146, 135, 136, 137, + 123, 144, 124, 135, 134, 135, 136, 1, 21, 16, + 18, 16, 21, 20, 17, 17, 17, 17, 17, 17, + 17, 17, 70, 73, 71, 72, 28, 25, 26, 24, + 28, 23, 28, 28, 125, 133, 126, 144, 127, 128, + 144, 129, 130, 119, 120, 119, 79, 77, 79, 79, + + 76, 79, 80, 84, 86, 85, 144, 81, 92, 88, + 92, 87, 90, 92, 92, 89, 92, 94, 102, 104, + 97, 103, 99, 98, 95, 99, 94, 108, 108, 106, + 105, 108, 116, 115, 112, 113, 109, 110, 111, 116, + 116, 135, 136, 140, 123, 140, 124, 135, 134, 135, + 53, 50, 47, 53, 52, 53, 51, 53, 33, 35, + 53, 53, 53, 53, 49, 53, 53, 60, 57, 58, + 60, 56, 60, 54, 55, 64, 61, 62, 64, 64, + 22, 69, 66, 69, 67, 69, 65, 69, 29, 30, + 32, 32, 32, 29, 1, 142, 145, 143, 141, 141, + + 135, 136, 135, 118, 122, 134, 138, 139, 136, 1, + 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, + 19, 20, 17, 17, 17, 17, 17, 11, 17, 17, + 17, 17, 17, 70, 71, 72, 74, 72, 25, 27, + 28, 125, 132, 131, 132, 127, 129, 119, 119, 119, + 121, 77, 75, 76, 78, 79, 80, 81, 83, 81, + 88, 87, 92, 89, 93, 92, 94, 96, 99, 98, + 98, 95, 101, 99, 94, 108, 106, 105, 108, 107, + 108, 116, 116, 114, 117, 116, 135, 140, 140, 50, + 44, 41, 33, 34, 33, 33, 37, 35, 35, 35, + + 39, 45, 43, 46, 40, 48, 49, 134, 42, 57, + 56, 59, 60, 54, 61, 63, 0, 22, 66, 65, + 69, 68, 69, 29, 31, 32, 29, 142, 141, 122, + 122, 17, 17, 17, 17, 17, 17, 11, 17, 17, + 17, 17, 17, 17, 17, 71, 82, 91, 100, 34, + 34, 33, 33, 33, 36, 35, 35, 35, 134, 122, + 17, 12, 13, 17, 17, 17, 17, 17, 17, 15, + 17, 17, 17, 34, 34, 34, 33, 36, 36, 35, + 134, 17, 12, 13, 14, 4, 7, 9, 17, 17, + 15, 17, 8, 17, 34, 36, 36, 36, 134, 3, + + 14, 4, 7, 9, 10, 17, 6, 8, 17, 36, + 134, 3, 10, 2, 6, 5, 38, 2, 5, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 1, 1, 8, 9, 10, + 11, 12, 1, 13, 1, 14, 15, 16, 17, 17, + 17, 17, 17, 17, 17, 18, 18, 1, 1, 19, + 20, 21, 1, 1, 22, 22, 22, 22, 22, 22, + 23, 23, 23, 23, 23, 24, 23, 23, 23, 23, + 23, 23, 23, 23, 25, 23, 23, 26, 23, 23, + 1, 27, 1, 1, 28, 1, 29, 30, 31, 32, + + 33, 34, 35, 36, 37, 36, 36, 38, 39, 40, + 41, 42, 36, 43, 44, 45, 46, 36, 47, 48, + 36, 36, 1, 49, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[50] = + { 0, + 1, 2, 3, 2, 1, 4, 5, 1, 6, 7, + 8, 9, 8, 10, 11, 12, 12, 12, 1, 1, + 13, 14, 15, 15, 15, 15, 16, 17, 14, 14, + 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 1 + } ; + +static const flex_int16_t yy_base[467] = + { 0, + 0, 48, 55, 0, 102, 103, 130, 0, 177, 178, + 179, 182, 186, 187, 104, 107, 214, 0, 261, 262, + 289, 0, 338, 0, 386, 389, 414, 439, 466, 0, + 515, 0, 564, 0, 1129, 1128, 399, 403, 612, 638, + 665, 0, 428, 618, 714, 763, 1130, 0, 49, 1920, + 1920, 1920, 1920, 96, 0, 109, 118, 1920, 1920, 811, + 1920, 1126, 111, 111, 858, 1095, 154, 161, 1090, 1083, + 1085, 1095, 0, 1920, 184, 124, 1920, 196, 1920, 1920, + 254, 1920, 0, 199, 0, 1920, 1920, 269, 0, 1920, + 1120, 0, 1920, 0, 1920, 263, 1920, 208, 1920, 267, + + 1112, 277, 0, 1920, 1920, 1920, 271, 281, 1920, 393, + 1920, 396, 1920, 1107, 396, 0, 406, 0, 1920, 1920, + 1113, 1920, 400, 905, 0, 418, 954, 1920, 430, 1920, + 1920, 433, 0, 1920, 1920, 1920, 1920, 1920, 1920, 432, + 435, 0, 449, 1920, 1920, 1920, 1920, 444, 0, 1003, + 1920, 456, 1920, 1099, 1920, 1110, 1920, 449, 1037, 714, + 443, 1097, 603, 0, 623, 1083, 1066, 1920, 615, 1920, + 619, 0, 632, 0, 1920, 1920, 644, 1920, 635, 634, + 635, 1920, 655, 1920, 1920, 646, 0, 659, 0, 1920, + 1920, 725, 738, 741, 1920, 742, 1920, 1920, 0, 735, + + 0, 747, 741, 1920, 0, 0, 1920, 1111, 755, 1920, + 0, 0, 1079, 747, 754, 1074, 1067, 1069, 1079, 1920, + 1920, 1104, 1069, 717, 1070, 1058, 1067, 777, 1063, 1052, + 1062, 1056, 1041, 0, 0, 1920, 1920, 1079, 787, 1920, + 1078, 0, 1920, 1920, 1077, 0, 0, 0, 743, 765, + 1920, 791, 1920, 1069, 1920, 1075, 0, 1920, 794, 1074, + 795, 798, 1062, 0, 1920, 1071, 0, 1920, 789, 0, + 1085, 0, 801, 1070, 0, 804, 1920, 1920, 807, 1920, + 1069, 0, 804, 1920, 1920, 1068, 806, 1920, 0, 818, + 1920, 1920, 847, 843, 874, 799, 0, 905, 903, 800, + + 1920, 1920, 1920, 1920, 1920, 1920, 1066, 1026, 1920, 823, + 0, 1920, 1048, 0, 824, 1920, 1047, 816, 871, 0, + 1920, 1920, 1027, 0, 1920, 1006, 872, 876, 0, 1134, + 0, 969, 971, 948, 943, 906, 897, 880, 875, 871, + 864, 844, 835, 833, 799, 0, 884, 1920, 890, 907, + 845, 618, 863, 873, 914, 889, 910, 912, 799, 1183, + 795, 938, 942, 796, 786, 747, 702, 695, 614, 959, + 610, 598, 428, 932, 945, 946, 1920, 947, 952, 1920, + 406, 395, 975, 984, 985, 990, 993, 994, 385, 372, + 997, 365, 998, 247, 1920, 966, 991, 994, 241, 1023, + + 1024, 1029, 1032, 1033, 1036, 153, 1037, 1040, 74, 1920, + 22, 1041, 1044, 1045, 1054, 1055, 0, 1062, 1063, 1920, + 1232, 1249, 1266, 1283, 1300, 1317, 1334, 1351, 1368, 1385, + 1402, 1419, 1436, 1453, 1466, 1468, 1485, 1502, 1519, 1536, + 1553, 1570, 1587, 1604, 1615, 1632, 1649, 1655, 1672, 1689, + 1706, 1712, 1729, 1746, 1763, 1769, 1786, 1792, 1809, 1826, + 1834, 1851, 1868, 1885, 1056, 1902 + } ; + +static const flex_int16_t yy_def[467] = + { 0, + 420, 1, 420, 3, 421, 421, 420, 7, 422, 422, + 423, 423, 424, 424, 425, 425, 420, 17, 426, 426, + 420, 21, 420, 23, 427, 427, 428, 428, 420, 29, + 420, 31, 420, 33, 429, 429, 430, 430, 431, 431, + 420, 41, 432, 432, 433, 433, 420, 434, 420, 420, + 420, 420, 420, 435, 436, 435, 420, 420, 420, 420, + 420, 60, 420, 420, 60, 65, 65, 65, 65, 65, + 65, 65, 437, 420, 438, 420, 420, 420, 420, 420, + 420, 420, 436, 420, 439, 420, 420, 440, 441, 420, + 440, 442, 420, 443, 420, 444, 420, 420, 420, 420, + + 445, 420, 446, 420, 420, 420, 447, 420, 420, 420, + 420, 420, 420, 420, 420, 448, 420, 449, 420, 420, + 420, 420, 450, 451, 452, 420, 452, 420, 420, 420, + 420, 420, 453, 420, 420, 420, 420, 420, 420, 454, + 420, 434, 420, 420, 420, 420, 420, 435, 436, 455, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 436, 420, 436, 420, 420, 420, 420, + 420, 456, 420, 457, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 458, 459, 460, 420, + 420, 420, 420, 460, 420, 420, 420, 420, 461, 461, + + 434, 420, 435, 420, 462, 436, 420, 420, 420, 420, + 60, 65, 65, 65, 65, 65, 65, 65, 65, 420, + 420, 420, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 437, 463, 420, 420, 420, 420, 420, + 420, 439, 420, 420, 420, 441, 442, 443, 444, 444, + 420, 420, 420, 445, 420, 420, 446, 420, 420, 420, + 420, 420, 420, 448, 420, 420, 449, 420, 450, 464, + 451, 452, 420, 420, 127, 420, 420, 420, 420, 420, + 420, 453, 454, 420, 420, 420, 435, 420, 455, 420, + 420, 420, 420, 420, 420, 420, 465, 420, 420, 420, + + 420, 420, 420, 420, 420, 420, 420, 436, 420, 420, + 456, 420, 420, 457, 420, 420, 420, 420, 420, 458, + 420, 420, 420, 460, 420, 420, 460, 420, 461, 466, + 462, 65, 65, 65, 65, 65, 65, 420, 65, 65, + 65, 65, 65, 65, 65, 463, 420, 420, 420, 420, + 420, 420, 420, 420, 465, 420, 420, 420, 436, 466, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 420, 420, 420, 420, 420, 420, 420, + 436, 65, 420, 420, 65, 65, 65, 65, 65, 65, + 420, 65, 65, 65, 420, 420, 420, 420, 436, 65, + + 420, 420, 420, 420, 65, 65, 65, 420, 65, 420, + 436, 420, 420, 65, 420, 65, 436, 420, 420, 0, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420 + } ; + +static const flex_int16_t yy_nxt[1970] = + { 0, + 48, 49, 50, 49, 48, 51, 52, 48, 53, 48, + 48, 48, 48, 48, 54, 48, 48, 48, 48, 48, + 48, 55, 55, 55, 55, 55, 56, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 48, 57, + 202, 57, 202, 417, 58, 59, 60, 61, 62, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 63, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 64, 59, 65, 65, 65, 66, 67, 65, 65, + 65, 68, 69, 65, 65, 65, 70, 65, 65, 65, + + 71, 72, 65, 59, 74, 74, 95, 204, 416, 95, + 205, 207, 208, 221, 222, 96, 75, 75, 96, 209, + 420, 209, 204, 420, 210, 205, 237, 238, 76, 76, + 77, 78, 79, 78, 77, 80, 77, 77, 77, 77, + 77, 77, 77, 77, 81, 77, 77, 77, 82, 77, + 77, 83, 83, 83, 83, 83, 84, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 77, 86, + 86, 86, 87, 87, 86, 414, 236, 90, 86, 86, + 90, 224, 227, 225, 228, 204, 226, 239, 205, 239, + + 229, 240, 241, 88, 88, 91, 93, 93, 91, 252, + 236, 252, 91, 91, 97, 98, 99, 98, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 100, 97, + 97, 97, 97, 97, 97, 101, 101, 101, 101, 101, + 102, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 97, 104, 104, 204, 105, 105, 205, 106, + 106, 244, 245, 411, 250, 107, 107, 251, 204, 255, + 256, 205, 204, 259, 260, 205, 409, 108, 108, 109, + 110, 111, 110, 109, 109, 109, 109, 109, 109, 112, + + 109, 113, 114, 115, 109, 109, 109, 109, 109, 109, + 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, + 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, + 116, 116, 116, 116, 116, 116, 116, 109, 118, 118, + 119, 118, 118, 120, 121, 118, 122, 118, 118, 118, + 118, 118, 123, 124, 124, 124, 118, 118, 118, 125, + 125, 125, 125, 125, 126, 127, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 118, 129, 130, 129, + 129, 130, 129, 407, 261, 131, 261, 262, 131, 262, + + 177, 178, 177, 406, 177, 178, 177, 204, 265, 266, + 205, 204, 132, 179, 205, 132, 134, 179, 405, 135, + 273, 274, 136, 137, 138, 180, 139, 400, 140, 180, + 190, 276, 277, 276, 191, 280, 281, 285, 286, 278, + 141, 134, 192, 284, 135, 399, 205, 136, 137, 138, + 202, 139, 202, 140, 193, 420, 279, 290, 420, 290, + 204, 301, 302, 205, 394, 141, 142, 143, 144, 143, + 142, 145, 146, 142, 147, 142, 142, 142, 142, 142, + 148, 142, 142, 142, 142, 142, 142, 149, 149, 149, + 149, 149, 150, 149, 149, 149, 149, 149, 149, 149, + + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 142, 151, 152, 153, 152, 154, + 155, 151, 156, 157, 151, 151, 151, 151, 151, 158, + 159, 160, 160, 161, 162, 163, 164, 164, 164, 164, + 164, 165, 164, 164, 164, 164, 166, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 167, 168, 169, 170, 169, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 171, 168, + 168, 168, 168, 168, 168, 172, 172, 172, 172, 172, + 173, 172, 172, 172, 172, 172, 172, 172, 172, 172, + + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 168, 78, 79, 78, 310, 80, 310, 194, + 190, 194, 304, 305, 195, 306, 307, 181, 181, 181, + 204, 393, 192, 205, 312, 313, 316, 317, 84, 78, + 79, 78, 377, 80, 193, 315, 204, 315, 392, 205, + 318, 318, 318, 181, 181, 181, 319, 204, 319, 390, + 205, 322, 323, 377, 84, 182, 183, 184, 183, 182, + 182, 182, 182, 182, 185, 185, 182, 182, 182, 186, + 182, 182, 182, 182, 182, 182, 187, 187, 187, 187, + 187, 188, 187, 187, 187, 187, 187, 187, 187, 187, + + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 182, 52, 196, 197, 196, 52, 198, + 52, 52, 52, 52, 52, 52, 52, 389, 200, 298, + 298, 298, 52, 52, 52, 388, 204, 299, 300, 205, + 325, 326, 327, 328, 327, 328, 204, 210, 202, 330, + 202, 299, 420, 333, 420, 420, 209, 420, 209, 300, + 334, 210, 52, 52, 196, 197, 196, 52, 198, 52, + 52, 52, 52, 52, 52, 52, 250, 200, 338, 251, + 338, 52, 52, 52, 224, 227, 225, 228, 239, 226, + 239, 387, 252, 229, 252, 347, 261, 347, 261, 262, + + 420, 262, 349, 420, 349, 276, 277, 276, 339, 280, + 281, 52, 211, 278, 211, 420, 340, 420, 420, 290, + 420, 290, 354, 358, 310, 315, 310, 315, 386, 385, + 279, 318, 318, 318, 382, 381, 354, 358, 373, 212, + 212, 212, 213, 214, 212, 212, 212, 215, 216, 212, + 212, 212, 217, 212, 212, 212, 218, 219, 212, 420, + 294, 420, 293, 293, 294, 372, 350, 351, 376, 371, + 295, 296, 319, 327, 319, 327, 370, 328, 210, 328, + 350, 338, 376, 338, 295, 347, 377, 347, 351, 212, + 212, 349, 296, 349, 212, 212, 377, 352, 353, 212, + + 377, 369, 368, 212, 212, 270, 270, 367, 270, 270, + 377, 352, 270, 380, 270, 270, 270, 270, 270, 353, + 298, 298, 298, 270, 270, 270, 356, 357, 299, 300, + 374, 375, 270, 380, 380, 380, 366, 378, 379, 383, + 356, 383, 299, 384, 374, 384, 365, 380, 357, 380, + 300, 378, 375, 270, 267, 267, 395, 267, 267, 379, + 391, 267, 391, 267, 267, 267, 267, 267, 395, 395, + 396, 397, 267, 267, 267, 398, 383, 395, 383, 364, + 363, 275, 395, 395, 396, 384, 401, 384, 401, 398, + 410, 402, 397, 402, 403, 404, 403, 404, 391, 408, + + 391, 408, 267, 287, 362, 361, 289, 287, 325, 287, + 287, 410, 287, 287, 410, 287, 287, 410, 287, 287, + 287, 287, 287, 287, 412, 401, 412, 401, 410, 322, + 402, 410, 402, 403, 404, 403, 404, 413, 415, 413, + 415, 408, 412, 408, 412, 413, 418, 413, 418, 316, + 312, 287, 293, 293, 294, 415, 419, 415, 419, 359, + 295, 296, 297, 418, 419, 418, 419, 355, 306, 355, + 285, 280, 273, 265, 295, 348, 259, 255, 253, 244, + 240, 237, 296, 345, 297, 270, 270, 344, 270, 270, + 343, 342, 270, 341, 270, 270, 270, 270, 270, 337, + + 336, 335, 332, 270, 270, 270, 221, 233, 232, 231, + 230, 223, 270, 207, 309, 308, 303, 292, 291, 268, + 263, 253, 420, 233, 232, 231, 230, 223, 220, 420, + 175, 175, 420, 270, 331, 331, 420, 331, 331, 331, + 331, 331, 331, 331, 331, 331, 331, 420, 420, 420, + 420, 420, 331, 331, 331, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 331, 331, 331, 420, 331, 331, 331, 331, + 331, 331, 331, 331, 331, 331, 420, 420, 420, 420, + + 420, 331, 331, 331, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 331, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 89, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 103, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 103, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + + 176, 176, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 189, 189, 189, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 201, 420, 420, 420, 420, 420, 201, + 201, 201, 201, 420, 201, 201, 203, 420, 420, 420, + 203, 420, 203, 203, 203, 203, 203, 203, 203, 206, + 420, 206, 206, 420, 206, 234, 234, 420, 234, 234, + 234, 234, 234, 234, 234, 420, 234, 234, 234, 234, + + 420, 234, 235, 235, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, 235, 242, + 242, 420, 420, 242, 242, 242, 242, 242, 242, 242, + 242, 242, 242, 242, 420, 242, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 246, 246, 420, 246, 246, 420, 246, + 246, 246, 246, 246, 246, 246, 246, 246, 420, 246, + 247, 247, 420, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 420, 247, 247, 420, 247, 248, 248, 420, + 248, 248, 248, 248, 248, 420, 248, 248, 248, 248, + + 248, 248, 248, 248, 249, 249, 420, 249, 249, 249, + 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, + 249, 254, 420, 420, 420, 420, 254, 420, 254, 254, + 420, 254, 257, 257, 420, 420, 257, 420, 257, 257, + 257, 257, 420, 257, 257, 257, 257, 420, 257, 258, + 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, + 258, 258, 258, 258, 258, 258, 264, 420, 264, 264, + 420, 264, 267, 267, 420, 420, 420, 420, 267, 267, + 267, 267, 420, 420, 267, 420, 420, 420, 267, 269, + 269, 420, 420, 420, 420, 269, 269, 269, 269, 269, + + 269, 269, 269, 269, 420, 269, 271, 271, 420, 420, + 420, 420, 271, 271, 271, 271, 420, 271, 271, 271, + 271, 420, 271, 272, 420, 272, 272, 420, 272, 282, + 282, 420, 420, 282, 420, 420, 420, 282, 282, 420, + 282, 282, 282, 282, 420, 282, 283, 283, 420, 420, + 283, 420, 420, 420, 283, 283, 283, 283, 283, 283, + 283, 420, 283, 288, 288, 288, 288, 288, 288, 288, + 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, + 311, 420, 311, 311, 420, 311, 314, 314, 420, 314, + 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + + 314, 314, 314, 320, 420, 320, 320, 420, 320, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 324, 324, 420, 324, + 420, 324, 324, 324, 324, 324, 420, 324, 324, 324, + 324, 420, 324, 329, 329, 329, 420, 329, 329, 329, + 329, 331, 331, 420, 331, 331, 331, 331, 331, 331, + 331, 331, 331, 331, 331, 331, 331, 331, 346, 346, + 420, 346, 346, 346, 346, 346, 420, 346, 420, 346, + 346, 346, 346, 420, 346, 270, 270, 420, 420, 420, + 420, 270, 270, 270, 270, 420, 420, 270, 420, 420, + + 420, 270, 360, 360, 420, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 47, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420 + } ; + +static const flex_int16_t yy_chk[1970] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 49, 2, 49, 411, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + + 3, 3, 3, 3, 5, 6, 15, 54, 409, 16, + 54, 56, 56, 64, 64, 15, 5, 6, 16, 57, + 56, 57, 63, 56, 57, 63, 76, 76, 5, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, + 10, 11, 9, 10, 12, 406, 75, 11, 13, 14, + 12, 67, 68, 67, 68, 75, 67, 78, 75, 78, + + 68, 84, 84, 9, 10, 11, 13, 14, 12, 98, + 75, 98, 13, 14, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 19, 20, 81, 19, 20, 81, 19, + 20, 88, 88, 399, 96, 19, 20, 96, 100, 102, + 102, 100, 107, 108, 108, 107, 394, 19, 20, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 25, 25, 25, + 26, 26, 26, 392, 110, 25, 110, 112, 26, 112, + + 37, 37, 37, 390, 38, 38, 38, 115, 117, 117, + 115, 123, 25, 37, 123, 26, 27, 38, 389, 27, + 126, 126, 27, 27, 27, 37, 27, 382, 27, 38, + 43, 129, 129, 129, 43, 132, 132, 141, 141, 129, + 27, 28, 43, 140, 28, 381, 140, 28, 28, 28, + 143, 28, 143, 28, 43, 148, 129, 152, 148, 152, + 158, 161, 161, 158, 373, 28, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 39, 39, 39, 169, 39, 169, 44, + 44, 44, 163, 163, 44, 165, 165, 39, 39, 39, + 171, 372, 44, 171, 173, 173, 180, 180, 39, 40, + 40, 40, 352, 40, 44, 177, 179, 177, 371, 179, + 181, 181, 181, 40, 40, 40, 183, 186, 183, 369, + 186, 188, 188, 352, 40, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 368, 45, 160, + 160, 160, 45, 45, 45, 367, 192, 160, 160, 192, + 193, 193, 194, 196, 194, 196, 200, 194, 202, 200, + 202, 160, 203, 224, 249, 203, 209, 249, 209, 160, + 224, 209, 45, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 250, 46, 228, 250, + 228, 46, 46, 46, 214, 215, 214, 215, 239, 214, + 239, 366, 252, 215, 252, 259, 261, 259, 261, 262, + + 269, 262, 273, 269, 273, 276, 276, 276, 228, 279, + 279, 46, 60, 276, 60, 283, 228, 287, 283, 290, + 287, 290, 296, 300, 310, 315, 310, 315, 365, 364, + 276, 318, 318, 318, 361, 359, 296, 300, 345, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, + 294, 65, 293, 293, 293, 344, 294, 294, 351, 343, + 293, 293, 319, 327, 319, 327, 342, 328, 327, 328, + 294, 338, 351, 338, 293, 347, 353, 347, 294, 65, + 65, 349, 293, 349, 65, 65, 354, 295, 295, 65, + + 353, 341, 340, 65, 65, 124, 124, 339, 124, 124, + 354, 295, 124, 356, 124, 124, 124, 124, 124, 295, + 298, 298, 298, 124, 124, 124, 299, 299, 298, 298, + 350, 350, 124, 357, 356, 358, 337, 355, 355, 362, + 299, 362, 298, 363, 350, 363, 336, 357, 299, 358, + 298, 355, 350, 124, 127, 127, 374, 127, 127, 355, + 370, 127, 370, 127, 127, 127, 127, 127, 375, 376, + 378, 378, 127, 127, 127, 379, 383, 374, 383, 335, + 334, 127, 375, 376, 378, 384, 385, 384, 385, 379, + 396, 386, 378, 386, 387, 388, 387, 388, 391, 393, + + 391, 393, 127, 150, 333, 332, 150, 150, 326, 150, + 150, 396, 150, 150, 397, 150, 150, 398, 150, 150, + 150, 150, 150, 150, 400, 401, 400, 401, 397, 323, + 402, 398, 402, 403, 404, 403, 404, 405, 407, 405, + 407, 408, 412, 408, 412, 413, 414, 413, 414, 317, + 313, 150, 159, 159, 159, 415, 416, 415, 416, 308, + 159, 159, 159, 418, 419, 418, 419, 465, 307, 465, + 286, 281, 274, 266, 159, 263, 260, 256, 254, 245, + 241, 238, 159, 233, 159, 271, 271, 232, 271, 271, + 231, 230, 271, 229, 271, 271, 271, 271, 271, 227, + + 226, 225, 223, 271, 271, 271, 222, 219, 218, 217, + 216, 213, 271, 208, 167, 166, 162, 156, 154, 121, + 114, 101, 91, 72, 71, 70, 69, 66, 62, 47, + 36, 35, 0, 271, 330, 330, 0, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 0, 0, 0, + 0, 0, 330, 330, 330, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 330, 360, 360, 0, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 0, 0, 0, 0, + + 0, 360, 360, 360, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 360, 421, 421, 421, 421, 421, 421, 421, 421, + 421, 421, 421, 421, 421, 421, 421, 421, 421, 422, + 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, + 422, 422, 422, 422, 422, 422, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, + 423, 423, 423, 424, 424, 424, 424, 424, 424, 424, + 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, + + 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, + 425, 425, 425, 425, 425, 425, 425, 426, 426, 426, + 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, + 426, 426, 426, 426, 427, 427, 427, 427, 427, 427, + 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, + 427, 428, 428, 428, 428, 428, 428, 428, 428, 428, + 428, 428, 428, 428, 428, 428, 428, 428, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 430, 430, 430, 430, 430, + 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, + + 430, 430, 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 431, 431, 431, 431, 431, 431, 431, 432, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, + 432, 432, 432, 432, 432, 432, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 434, 0, 0, 0, 0, 0, 434, + 434, 434, 434, 0, 434, 434, 435, 0, 0, 0, + 435, 0, 435, 435, 435, 435, 435, 435, 435, 436, + 0, 436, 436, 0, 436, 437, 437, 0, 437, 437, + 437, 437, 437, 437, 437, 0, 437, 437, 437, 437, + + 0, 437, 438, 438, 438, 438, 438, 438, 438, 438, + 438, 438, 438, 438, 438, 438, 438, 438, 438, 439, + 439, 0, 0, 439, 439, 439, 439, 439, 439, 439, + 439, 439, 439, 439, 0, 439, 440, 440, 440, 440, + 440, 440, 440, 440, 440, 440, 440, 440, 440, 440, + 440, 440, 440, 441, 441, 0, 441, 441, 0, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 0, 441, + 442, 442, 0, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 0, 442, 442, 0, 442, 443, 443, 0, + 443, 443, 443, 443, 443, 0, 443, 443, 443, 443, + + 443, 443, 443, 443, 444, 444, 0, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 445, 0, 0, 0, 0, 445, 0, 445, 445, + 0, 445, 446, 446, 0, 0, 446, 0, 446, 446, + 446, 446, 0, 446, 446, 446, 446, 0, 446, 447, + 447, 447, 447, 447, 447, 447, 447, 447, 447, 447, + 447, 447, 447, 447, 447, 447, 448, 0, 448, 448, + 0, 448, 449, 449, 0, 0, 0, 0, 449, 449, + 449, 449, 0, 0, 449, 0, 0, 0, 449, 450, + 450, 0, 0, 0, 0, 450, 450, 450, 450, 450, + + 450, 450, 450, 450, 0, 450, 451, 451, 0, 0, + 0, 0, 451, 451, 451, 451, 0, 451, 451, 451, + 451, 0, 451, 452, 0, 452, 452, 0, 452, 453, + 453, 0, 0, 453, 0, 0, 0, 453, 453, 0, + 453, 453, 453, 453, 0, 453, 454, 454, 0, 0, + 454, 0, 0, 0, 454, 454, 454, 454, 454, 454, + 454, 0, 454, 455, 455, 455, 455, 455, 455, 455, + 455, 455, 455, 455, 455, 455, 455, 455, 455, 455, + 456, 0, 456, 456, 0, 456, 457, 457, 0, 457, + 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, + + 457, 457, 457, 458, 0, 458, 458, 0, 458, 459, + 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, + 459, 459, 459, 459, 459, 459, 460, 460, 0, 460, + 0, 460, 460, 460, 460, 460, 0, 460, 460, 460, + 460, 0, 460, 461, 461, 461, 0, 461, 461, 461, + 461, 462, 462, 0, 462, 462, 462, 462, 462, 462, + 462, 462, 462, 462, 462, 462, 462, 462, 463, 463, + 0, 463, 463, 463, 463, 463, 0, 463, 0, 463, + 463, 463, 463, 0, 463, 464, 464, 0, 0, 0, + 0, 464, 464, 464, 464, 0, 0, 464, 0, 0, + + 0, 464, 466, 466, 0, 466, 466, 466, 466, 466, + 466, 466, 466, 466, 466, 466, 466, 466, 466, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "ppl.l" +/* -*-C-*- + * Wrc preprocessor lexical analysis + * + * Copyright 1999-2000 Bertho A. Stultiens (BS) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + *------------------------------------------------------------------------- + * The preprocessor's lexographical grammar (approximately): + * + * pp := {ws} # {ws} if {ws} {expr} {ws} \n + * | {ws} # {ws} ifdef {ws} {id} {ws} \n + * | {ws} # {ws} ifndef {ws} {id} {ws} \n + * | {ws} # {ws} elif {ws} {expr} {ws} \n + * | {ws} # {ws} else {ws} \n + * | {ws} # {ws} endif {ws} \n + * | {ws} # {ws} include {ws} < {anytext} > \n + * | {ws} # {ws} include {ws} " {anytext} " \n + * | {ws} # {ws} define {ws} {anytext} \n + * | {ws} # {ws} define( {arglist} ) {ws} {expansion} \n + * | {ws} # {ws} pragma {ws} {anytext} \n + * | {ws} # {ws} ident {ws} {anytext} \n + * | {ws} # {ws} error {ws} {anytext} \n + * | {ws} # {ws} warning {ws} {anytext} \n + * | {ws} # {ws} line {ws} " {anytext} " {number} \n + * | {ws} # {ws} {number} " {anytext} " {number} [ {number} [{number}] ] \n + * | {ws} # {ws} \n + * + * ws := [ \t\r\f\v]* + * + * expr := {expr} [+-*%^/|&] {expr} + * | {expr} {logor|logand} {expr} + * | [!~+-] {expr} + * | {expr} ? {expr} : {expr} + * + * logor := || + * + * logand := && + * + * id := [a-zA-Z_][a-zA-Z0-9_]* + * + * anytext := [^\n]* (see note) + * + * arglist := + * | {id} + * | {arglist} , {id} + * | {arglist} , {id} ... + * + * expansion := {id} + * | # {id} + * | {anytext} + * | {anytext} ## {anytext} + * + * number := [0-9]+ + * + * Note: "anytext" is not always "[^\n]*". This is because the + * trailing context must be considered as well. + * + * The only certain assumption for the preprocessor to make is that + * directives start at the beginning of the line, followed by a '#' + * and end with a newline. + * Any directive may be suffixed with a line-continuation. Also + * classical comment / *...* / (note: no comments within comments, + * therefore spaces) is considered to be a line-continuation + * (according to gcc and egcs AFAIK, ANSI is a bit vague). + * Comments have not been added to the above grammar for simplicity + * reasons. However, it is allowed to enter comment anywhere within + * the directives as long as they do not interfere with the context. + * All comments are considered to be deletable whitespace (both + * classical form "/ *...* /" and C++ form "//...\n"). + * + * All recursive scans, except for macro-expansion, are done by the + * parser, whereas the simple state transitions of non-recursive + * directives are done in the scanner. This results in the many + * exclusive start-conditions of the scanner. + * + * Macro expansions are slightly more difficult because they have to + * prescan the arguments. Parameter substitution is literal if the + * substitution is # or ## (either side). This enables new identifiers + * to be created (see 'info cpp' node Macro|Pitfalls|Prescan for more + * information). + * + * FIXME: Variable macro parameters is recognized, but not yet + * expanded. I have to reread the ANSI standard on the subject (yes, + * ANSI defines it). + * + * The following special defines are supported: + * __FILE__ -> "thissource.c" + * __LINE__ -> 123 + * __DATE__ -> "May 1 2000" + * __TIME__ -> "23:59:59" + * These macros expand, as expected, into their ANSI defined values. + * + * The same include prevention is implemented as gcc and egcs does. + * This results in faster processing because we do not read the text + * at all. Some wine-sources attempt to include the same file 4 or 5 + * times. This strategy also saves a lot blank output-lines, which in + * its turn improves the real resource scanner/parser. + * + */ +/* + * Special flex options and exclusive scanner start-conditions + */ +#define YY_NO_INPUT 1 + + + + + + + + + + + + + + + + + + + + + + +#line 150 "ppl.l" +#include +#include +#include +#include +#include +#include +#include + +#define YY_NO_UNISTD_H + +#include "wpp_private.h" +#include "ppy.tab.h" + +/* + * Make sure that we are running an appropriate version of flex. + */ +#if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005) +#error Must use flex version 2.5.1 or higher (yy_scan_* routines are required). +#endif + +#define YY_READ_BUF_SIZE 65536 /* So we read most of a file at once */ + +#define yy_current_state() YY_START +#define yy_pp_state(x) yy_pop_state(); yy_push_state(x) + +/* + * Always update the current character position within a line + */ +#define YY_USER_ACTION pp_status.char_number+=ppy_leng; + +/* + * Buffer management for includes and expansions + */ +#define MAXBUFFERSTACK 128 /* Nesting more than 128 includes or macro expansion textss is insane */ + +typedef struct bufferstackentry { + YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */ + void *filehandle; /* Handle to be used with wpp_callbacks->read */ + pp_entry_t *define; /* Points to expanding define or NULL if handling includes */ + int line_number; /* Line that we were handling */ + int char_number; /* The current position on that line */ + char *filename; /* Filename that we were handling */ + int if_depth; /* How many #if:s deep to check matching #endif:s */ + int ncontinuations; /* Remember the continuation state */ + int should_pop; /* Set if we must pop the start-state on EOF */ + /* Include management */ + include_state_t incl; + char *include_filename; +} bufferstackentry_t; + +#define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */ + +/* + * Macro expansion nesting + * We need the stack to handle expansions while scanning + * a macro's arguments. The TOS must always be the macro + * that receives the current expansion from the scanner. + */ +#define MAXMACEXPSTACK 128 /* Nesting more than 128 macro expansions is insane */ + +typedef struct macexpstackentry { + pp_entry_t *ppp; /* This macro we are scanning */ + char **args; /* With these arguments */ + char **ppargs; /* Resulting in these preprocessed arguments */ + int *nnls; /* Number of newlines per argument */ + int nargs; /* And this many arguments scanned */ + int parentheses; /* Nesting level of () */ + int curargsize; /* Current scanning argument's size */ + int curargalloc; /* Current scanning argument's block allocated */ + char *curarg; /* Current scanning argument's content */ +} macexpstackentry_t; + +#define MACROPARENTHESES() (top_macro()->parentheses) + +/* + * Prototypes + */ +static void newline(int); +static int make_number(int radix, YYSTYPE *val, const char *str, int len); +static void put_buffer(const char *s, int len); +/* Buffer management */ +static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop); +static bufferstackentry_t *pop_buffer(void); +/* String functions */ +static void new_string(void); +static void add_string(const char *str, int len); +static char *get_string(void); +static void put_string(void); +static int string_start(void); +/* Macro functions */ +static void push_macro(pp_entry_t *ppp); +static macexpstackentry_t *top_macro(void); +static macexpstackentry_t *pop_macro(void); +static void free_macro(macexpstackentry_t *mep); +static void add_text_to_macro(const char *text, int len); +static void macro_add_arg(int last); +static void macro_add_expansion(void); +/* Expansion */ +static void expand_special(pp_entry_t *ppp); +static void expand_define(pp_entry_t *ppp); +static void expand_macro(macexpstackentry_t *mep); + +/* + * Local variables + */ +static int ncontinuations; + +static int strbuf_idx = 0; +static int strbuf_alloc = 0; +static char *strbuffer = NULL; +static int str_startline; + +static macexpstackentry_t *macexpstack[MAXMACEXPSTACK]; +static int macexpstackidx = 0; + +static bufferstackentry_t bufferstack[MAXBUFFERSTACK]; +static int bufferstackidx = 0; + +/* + * Global variables + */ +include_state_t pp_incl_state = +{ + -1, /* state */ + NULL, /* ppp */ + 0, /* ifdepth */ + 0 /* seen_junk */ +}; + +includelogicentry_t *pp_includelogiclist = NULL; + +#define YY_INPUT(buf,result,max_size) \ + { \ + result = wpp_read(pp_status.file, buf, max_size); \ + } + +#define BUFFERINITIALCAPACITY 256 + +void WINAPIV pp_writestring(const char *format, ...) +{ + __ms_va_list valist; + int len; + static char *buffer; + static int buffercapacity; + char *new_buffer; + + if(buffercapacity == 0) + { + buffer = pp_xmalloc(BUFFERINITIALCAPACITY); + if(buffer == NULL) + return; + buffercapacity = BUFFERINITIALCAPACITY; + } + + __ms_va_start(valist, format); + len = vsnprintf(buffer, buffercapacity, + format, valist); + __ms_va_end(valist); + /* If the string is longer than buffersize, vsnprintf returns + * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ + while(len > buffercapacity || len < 0) + { + do + { + buffercapacity *= 2; + } while(len > buffercapacity); + + new_buffer = pp_xrealloc(buffer, buffercapacity); + if(new_buffer == NULL) + return; + buffer = new_buffer; + __ms_va_start(valist, format); + len = vsnprintf(buffer, buffercapacity, + format, valist); + __ms_va_end(valist); + } + + wpp_write(buffer, len); +} + +#line 1598 "ppl.yy.c" +/* + ************************************************************************** + * The scanner starts here + ************************************************************************** + */ +#line 1604 "ppl.yy.c" + +#define INITIAL 0 +#define pp_pp 1 +#define pp_eol 2 +#define pp_inc 3 +#define pp_dqs 4 +#define pp_sqs 5 +#define pp_iqs 6 +#define pp_comment 7 +#define pp_def 8 +#define pp_define 9 +#define pp_macro 10 +#define pp_mbody 11 +#define pp_macign 12 +#define pp_macscan 13 +#define pp_macexp 14 +#define pp_if 15 +#define pp_ifd 16 +#define pp_ifignored 17 +#define pp_endif 18 +#define pp_line 19 +#define pp_defined 20 +#define pp_ignore 21 +#define RCINCL 22 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals ( void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif + +#endif + + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + + static void yy_push_state ( int _new_state ); + + static void yy_pop_state ( void ); + + static int yy_top_state ( void ); + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +#line 338 "ppl.l" + +#line 340 "ppl.l" + /* + * Catch line-continuations. + * Note: Gcc keeps the line-continuations in, for example, strings + * intact. However, I prefer to remove them all so that the next + * scanner will not need to reduce the continuation state. + * + * <*>\\\n newline(0); + */ + + /* + * Detect the leading # of a preprocessor directive. + */ +#line 1869 "ppl.yy.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 421 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 420 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 352 "ppl.l" +pp_incl_state.seen_junk++; yy_push_state(pp_pp); + YY_BREAK +/* + * Scan for the preprocessor directives + */ +case 2: +YY_RULE_SETUP +#line 357 "ppl.l" +if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 358 "ppl.l" +yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol); + YY_BREAK +case 4: +YY_RULE_SETUP +#line 359 "ppl.l" +yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 360 "ppl.l" +yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 361 "ppl.l" +yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 362 "ppl.l" +yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 363 "ppl.l" +if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 364 "ppl.l" +yy_pp_state(pp_ifd); return tIFDEF; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 365 "ppl.l" +pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 366 "ppl.l" +if(yy_top_state() != pp_ignore) {yy_pp_state(pp_if);} else {yy_pp_state(pp_ifignored);} return tIF; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 367 "ppl.l" +yy_pp_state(pp_if); return tELIF; + YY_BREAK +case 13: +YY_RULE_SETUP +#line 368 "ppl.l" +yy_pp_state(pp_endif); return tELSE; + YY_BREAK +case 14: +YY_RULE_SETUP +#line 369 "ppl.l" +yy_pp_state(pp_endif); return tENDIF; + YY_BREAK +case 15: +YY_RULE_SETUP +#line 370 "ppl.l" +if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 371 "ppl.l" +if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 372 "ppl.l" +ppy_error("Invalid preprocessor token '%s'", ppy_text); + YY_BREAK +case 18: +/* rule 18 can match eol */ +YY_RULE_SETUP +#line 373 "ppl.l" +newline(1); yy_pop_state(); return tNL; /* This could be the null-token */ + YY_BREAK +case 19: +/* rule 19 can match eol */ +YY_RULE_SETUP +#line 374 "ppl.l" +newline(0); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 375 "ppl.l" +ppy_error("Preprocessor junk '%s'", ppy_text); + YY_BREAK +case 21: +YY_RULE_SETUP +#line 376 "ppl.l" +return *ppy_text; + YY_BREAK +/* + * Handle #include and #line + */ +case 22: +YY_RULE_SETUP +#line 381 "ppl.l" +return make_number(10, &ppy_lval, ppy_text, ppy_leng); + YY_BREAK +case 23: +YY_RULE_SETUP +#line 382 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_iqs); + YY_BREAK +case 24: +YY_RULE_SETUP +#line 383 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + YY_BREAK +case 25: +YY_RULE_SETUP +#line 384 "ppl.l" +; + YY_BREAK +case 26: +/* rule 26 can match eol */ +YY_RULE_SETUP +#line 385 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +case 27: +/* rule 27 can match eol */ +YY_RULE_SETUP +#line 386 "ppl.l" +newline(0); + YY_BREAK +case 28: +YY_RULE_SETUP +#line 387 "ppl.l" +ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line"); + YY_BREAK +/* + * Ignore all input when a false clause is parsed + */ +case 29: +YY_RULE_SETUP +#line 392 "ppl.l" +; + YY_BREAK +case 30: +/* rule 30 can match eol */ +YY_RULE_SETUP +#line 393 "ppl.l" +newline(1); + YY_BREAK +case 31: +/* rule 31 can match eol */ +YY_RULE_SETUP +#line 394 "ppl.l" +newline(0); + YY_BREAK +case 32: +YY_RULE_SETUP +#line 395 "ppl.l" +; + YY_BREAK +/* + * Handle #if and #elif. + * These require conditionals to be evaluated, but we do not + * want to jam the scanner normally when we see these tokens. + * Note: tIDENT is handled below. + */ +case 33: +YY_RULE_SETUP +#line 404 "ppl.l" +return make_number(8, &ppy_lval, ppy_text, ppy_leng); + YY_BREAK +case 34: +YY_RULE_SETUP +#line 405 "ppl.l" +ppy_error("Invalid octal digit"); + YY_BREAK +case 35: +YY_RULE_SETUP +#line 406 "ppl.l" +return make_number(10, &ppy_lval, ppy_text, ppy_leng); + YY_BREAK +case 36: +YY_RULE_SETUP +#line 407 "ppl.l" +return make_number(16, &ppy_lval, ppy_text, ppy_leng); + YY_BREAK +case 37: +YY_RULE_SETUP +#line 408 "ppl.l" +ppy_error("Invalid hex number"); + YY_BREAK +case 38: +YY_RULE_SETUP +#line 409 "ppl.l" +yy_push_state(pp_defined); return tDEFINED; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 410 "ppl.l" +return tLSHIFT; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 411 "ppl.l" +return tRSHIFT; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 412 "ppl.l" +return tLOGAND; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 413 "ppl.l" +return tLOGOR; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 414 "ppl.l" +return tEQ; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 415 "ppl.l" +return tNE; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 416 "ppl.l" +return tLTE; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 417 "ppl.l" +return tGTE; + YY_BREAK +case 47: +/* rule 47 can match eol */ +YY_RULE_SETUP +#line 418 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +case 48: +/* rule 48 can match eol */ +YY_RULE_SETUP +#line 419 "ppl.l" +newline(0); + YY_BREAK +case 49: +YY_RULE_SETUP +#line 420 "ppl.l" +ppy_error("Junk in conditional expression"); + YY_BREAK +case 50: +YY_RULE_SETUP +#line 421 "ppl.l" +; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 422 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); + YY_BREAK +case 52: +YY_RULE_SETUP +#line 423 "ppl.l" +ppy_error("String constants not allowed in conditionals"); + YY_BREAK +case 53: +YY_RULE_SETUP +#line 424 "ppl.l" +return *ppy_text; + YY_BREAK +case 54: +YY_RULE_SETUP +#line 426 "ppl.l" +ppy_lval.sint = 0; return tSINT; + YY_BREAK +case 55: +/* rule 55 can match eol */ +YY_RULE_SETUP +#line 427 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +/* + * Handle #ifdef, #ifndef and #undef + * to get only an untranslated/unexpanded identifier + */ +case 56: +YY_RULE_SETUP +#line 433 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; + YY_BREAK +case 57: +YY_RULE_SETUP +#line 434 "ppl.l" +; + YY_BREAK +case 58: +/* rule 58 can match eol */ +YY_RULE_SETUP +#line 435 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +case 59: +/* rule 59 can match eol */ +YY_RULE_SETUP +#line 436 "ppl.l" +newline(0); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 437 "ppl.l" +ppy_error("Identifier expected"); + YY_BREAK +/* + * Handle #else and #endif. + */ +case 61: +YY_RULE_SETUP +#line 442 "ppl.l" +; + YY_BREAK +case 62: +/* rule 62 can match eol */ +YY_RULE_SETUP +#line 443 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +case 63: +/* rule 63 can match eol */ +YY_RULE_SETUP +#line 444 "ppl.l" +newline(0); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 445 "ppl.l" +ppy_error("Garbage after #else or #endif."); + YY_BREAK +/* + * Handle the special 'defined' keyword. + * This is necessary to get the identifier prior to any + * substitutions. + */ +case 65: +YY_RULE_SETUP +#line 452 "ppl.l" +yy_pop_state(); ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; + YY_BREAK +case 66: +YY_RULE_SETUP +#line 453 "ppl.l" +; + YY_BREAK +case 67: +YY_RULE_SETUP +#line 454 "ppl.l" +return *ppy_text; + YY_BREAK +case 68: +/* rule 68 can match eol */ +YY_RULE_SETUP +#line 455 "ppl.l" +newline(0); + YY_BREAK +case 69: +/* rule 69 can match eol */ +YY_RULE_SETUP +#line 456 "ppl.l" +ppy_error("Identifier expected"); + YY_BREAK +/* + * Handle #error, #warning, #pragma and #ident. + * Pass everything literally to the parser, which + * will act appropriately. + * Comments are stripped from the literal text. + */ +case 70: +YY_RULE_SETUP +#line 464 "ppl.l" +if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 465 "ppl.l" +if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } + YY_BREAK +case 72: +/* rule 72 can match eol */ +YY_RULE_SETUP +#line 466 "ppl.l" +if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } + YY_BREAK +case 73: +/* rule 73 can match eol */ +YY_RULE_SETUP +#line 467 "ppl.l" +newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; } + YY_BREAK +case 74: +/* rule 74 can match eol */ +YY_RULE_SETUP +#line 468 "ppl.l" +newline(0); + YY_BREAK +/* + * Handle left side of #define + */ +case 75: +YY_RULE_SETUP +#line 473 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; + YY_BREAK +case 76: +YY_RULE_SETUP +#line 474 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE; + YY_BREAK +case 77: +YY_RULE_SETUP +#line 475 "ppl.l" +; + YY_BREAK +case 78: +/* rule 78 can match eol */ +YY_RULE_SETUP +#line 476 "ppl.l" +newline(0); + YY_BREAK +case 79: +/* rule 79 can match eol */ +YY_RULE_SETUP +#line 477 "ppl.l" +perror("Identifier expected"); + YY_BREAK +/* + * Scan the substitution of a define + */ +case 80: +YY_RULE_SETUP +#line 482 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; + YY_BREAK +case 81: +/* rule 81 can match eol */ +YY_RULE_SETUP +#line 483 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; + YY_BREAK +case 82: +/* rule 82 can match eol */ +YY_RULE_SETUP +#line 484 "ppl.l" +newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; + YY_BREAK +case 83: +/* rule 83 can match eol */ +YY_RULE_SETUP +#line 485 "ppl.l" +newline(0); + YY_BREAK +case 84: +/* rule 84 can match eol */ +YY_RULE_SETUP +#line 486 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +case 85: +YY_RULE_SETUP +#line 487 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); + YY_BREAK +case 86: +YY_RULE_SETUP +#line 488 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + YY_BREAK +/* + * Scan the definition macro arguments + */ +case 87: +YY_RULE_SETUP +#line 493 "ppl.l" +yy_pp_state(pp_mbody); return tMACROEND; + YY_BREAK +case 88: +YY_RULE_SETUP +#line 494 "ppl.l" +; + YY_BREAK +case 89: +YY_RULE_SETUP +#line 495 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; + YY_BREAK +case 90: +YY_RULE_SETUP +#line 496 "ppl.l" +return ','; + YY_BREAK +case 91: +YY_RULE_SETUP +#line 497 "ppl.l" +return tELIPSIS; + YY_BREAK +case 92: +/* rule 92 can match eol */ +YY_RULE_SETUP +#line 498 "ppl.l" +ppy_error("Argument identifier expected"); + YY_BREAK +case 93: +/* rule 93 can match eol */ +YY_RULE_SETUP +#line 499 "ppl.l" +newline(0); + YY_BREAK +/* + * Scan the substitution of a macro + */ +case 94: +YY_RULE_SETUP +#line 504 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; + YY_BREAK +case 95: +YY_RULE_SETUP +#line 505 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; + YY_BREAK +case 96: +YY_RULE_SETUP +#line 506 "ppl.l" +return tCONCAT; + YY_BREAK +case 97: +YY_RULE_SETUP +#line 507 "ppl.l" +return tSTRINGIZE; + YY_BREAK +case 98: +YY_RULE_SETUP +#line 508 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; + YY_BREAK +case 99: +YY_RULE_SETUP +#line 509 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; + YY_BREAK +case 100: +/* rule 100 can match eol */ +YY_RULE_SETUP +#line 510 "ppl.l" +newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; + YY_BREAK +case 101: +/* rule 101 can match eol */ +YY_RULE_SETUP +#line 511 "ppl.l" +newline(0); + YY_BREAK +case 102: +/* rule 102 can match eol */ +YY_RULE_SETUP +#line 512 "ppl.l" +newline(1); yy_pop_state(); return tNL; + YY_BREAK +case 103: +YY_RULE_SETUP +#line 513 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); + YY_BREAK +case 104: +YY_RULE_SETUP +#line 514 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + YY_BREAK +/* + * Macro expansion text scanning. + * This state is active just after the identifier is scanned + * that triggers an expansion. We *must* delete the leading + * whitespace before we can start scanning for arguments. + * + * If we do not see a '(' as next trailing token, then we have + * a false alarm. We just continue with a nose-bleed... + */ +case 105: +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 525 "ppl.l" +yy_pp_state(pp_macscan); + YY_BREAK +case 106: +/* rule 106 can match eol */ +YY_RULE_SETUP +#line 526 "ppl.l" +{ + if(yy_top_state() != pp_macscan) + newline(0); + } + YY_BREAK +case 107: +/* rule 107 can match eol */ +YY_RULE_SETUP +#line 530 "ppl.l" +newline(0); + YY_BREAK +case 108: +YY_RULE_SETUP +#line 531 "ppl.l" +{ + macexpstackentry_t *mac = pop_macro(); + yy_pop_state(); + put_buffer(mac->ppp->ident, strlen(mac->ppp->ident)); + put_buffer(ppy_text, ppy_leng); + free_macro(mac); + } + YY_BREAK +/* + * Macro expansion argument text scanning. + * This state is active when a macro's arguments are being read for expansion. + */ +case 109: +YY_RULE_SETUP +#line 543 "ppl.l" +{ + if(++MACROPARENTHESES() > 1) + add_text_to_macro(ppy_text, ppy_leng); + } + YY_BREAK +case 110: +YY_RULE_SETUP +#line 547 "ppl.l" +{ + if(--MACROPARENTHESES() == 0) + { + yy_pop_state(); + macro_add_arg(1); + } + else + add_text_to_macro(ppy_text, ppy_leng); + } + YY_BREAK +case 111: +YY_RULE_SETUP +#line 556 "ppl.l" +{ + if(MACROPARENTHESES() > 1) + add_text_to_macro(ppy_text, ppy_leng); + else + macro_add_arg(0); + } + YY_BREAK +case 112: +YY_RULE_SETUP +#line 562 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + YY_BREAK +case 113: +YY_RULE_SETUP +#line 563 "ppl.l" +new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); + YY_BREAK +case 114: +YY_RULE_SETUP +#line 564 "ppl.l" +yy_push_state(pp_comment); add_text_to_macro(" ", 1); + YY_BREAK +case 115: +/* rule 115 can match eol */ +YY_RULE_SETUP +#line 565 "ppl.l" +pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(ppy_text, ppy_leng); + YY_BREAK +case 116: +YY_RULE_SETUP +#line 566 "ppl.l" +add_text_to_macro(ppy_text, ppy_leng); + YY_BREAK +case 117: +/* rule 117 can match eol */ +YY_RULE_SETUP +#line 567 "ppl.l" +newline(0); + YY_BREAK +/* + * Comment handling (almost all start-conditions) + */ +case 118: +YY_RULE_SETUP +#line 572 "ppl.l" +yy_push_state(pp_comment); + YY_BREAK +case 119: +YY_RULE_SETUP +#line 573 "ppl.l" +; + YY_BREAK +case 120: +/* rule 120 can match eol */ +YY_RULE_SETUP +#line 574 "ppl.l" +newline(0); + YY_BREAK +case 121: +YY_RULE_SETUP +#line 575 "ppl.l" +yy_pop_state(); + YY_BREAK +/* + * Remove C++ style comment (almost all start-conditions) + */ +case 122: +YY_RULE_SETUP +#line 580 "ppl.l" +{ + if(ppy_text[ppy_leng-1] == '\\') + ppy_warning("C++ style comment ends with an escaped newline (escape ignored)"); + } + YY_BREAK +/* + * Single, double and <> quoted constants + */ +case 123: +YY_RULE_SETUP +#line 588 "ppl.l" +pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); + YY_BREAK +case 124: +YY_RULE_SETUP +#line 589 "ppl.l" +pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); + YY_BREAK +case 125: +YY_RULE_SETUP +#line 590 "ppl.l" +add_string(ppy_text, ppy_leng); + YY_BREAK +case 126: +YY_RULE_SETUP +#line 591 "ppl.l" +{ + add_string(ppy_text, ppy_leng); + yy_pop_state(); + switch(yy_current_state()) + { + case pp_pp: + case pp_define: + case pp_mbody: + case pp_inc: + case RCINCL: + if (yy_current_state()==RCINCL) yy_pop_state(); + ppy_lval.cptr = get_string(); + return tDQSTRING; + case pp_line: + ppy_lval.cptr = get_string(); + return tDQSTRING; + default: + put_string(); + } + } + YY_BREAK +case 127: +YY_RULE_SETUP +#line 611 "ppl.l" +add_string(ppy_text, ppy_leng); + YY_BREAK +case 128: +YY_RULE_SETUP +#line 612 "ppl.l" +{ + add_string(ppy_text, ppy_leng); + yy_pop_state(); + switch(yy_current_state()) + { + case pp_if: + case pp_define: + case pp_mbody: + ppy_lval.cptr = get_string(); + return tSQSTRING; + default: + put_string(); + } + } + YY_BREAK +case 129: +YY_RULE_SETUP +#line 626 "ppl.l" +add_string(ppy_text, ppy_leng); + YY_BREAK +case 130: +YY_RULE_SETUP +#line 627 "ppl.l" +{ + add_string(ppy_text, ppy_leng); + yy_pop_state(); + ppy_lval.cptr = get_string(); + return tIQSTRING; + } + YY_BREAK +case 131: +/* rule 131 can match eol */ +YY_RULE_SETUP +#line 633 "ppl.l" +{ + /* + * This is tricky; we need to remove the line-continuation + * from preprocessor strings, but OTOH retain them in all + * other strings. This is because the resource grammar is + * even more braindead than initially analysed and line- + * continuations in strings introduce, sigh, newlines in + * the output. There goes the concept of non-breaking, non- + * spacing whitespace. + */ + switch(yy_top_state()) + { + case pp_pp: + case pp_define: + case pp_mbody: + case pp_inc: + case pp_line: + newline(0); + break; + default: + add_string(ppy_text, ppy_leng); + newline(-1); + } + } + YY_BREAK +case 132: +YY_RULE_SETUP +#line 657 "ppl.l" +add_string(ppy_text, ppy_leng); + YY_BREAK +case 133: +/* rule 133 can match eol */ +YY_RULE_SETUP +#line 658 "ppl.l" +{ + newline(1); + add_string(ppy_text, ppy_leng); + ppy_warning("Newline in string constant encountered (started line %d)", string_start()); + } + YY_BREAK +/* + * Identifier scanning + */ +case 134: +YY_RULE_SETUP +#line 667 "ppl.l" +{ + pp_entry_t *ppp; + pp_incl_state.seen_junk++; + if(!(ppp = pplookup(ppy_text))) + { + if(yy_current_state() == pp_inc) + ppy_error("Expected include filename"); + + else if(yy_current_state() == pp_if) + { + ppy_lval.cptr = pp_xstrdup(ppy_text); + return tIDENT; + } + else { + if((yy_current_state()==INITIAL) && (strcasecmp(ppy_text,"RCINCLUDE")==0)){ + yy_push_state(RCINCL); + return tRCINCLUDE; + } + else put_buffer(ppy_text, ppy_leng); + } + } + else if(!ppp->expanding) + { + switch(ppp->type) + { + case def_special: + expand_special(ppp); + break; + case def_define: + expand_define(ppp); + break; + case def_macro: + yy_push_state(pp_macign); + push_macro(ppp); + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type); + } + } + else put_buffer(ppy_text, ppy_leng); + } + YY_BREAK +/* + * Everything else that needs to be passed and + * newline and continuation handling + */ +case 135: +YY_RULE_SETUP +#line 713 "ppl.l" +pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); + YY_BREAK +case 136: +YY_RULE_SETUP +#line 714 "ppl.l" +put_buffer(ppy_text, ppy_leng); + YY_BREAK +case 137: +/* rule 137 can match eol */ +YY_RULE_SETUP +#line 715 "ppl.l" +newline(1); + YY_BREAK +case 138: +/* rule 138 can match eol */ +YY_RULE_SETUP +#line 716 "ppl.l" +newline(0); + YY_BREAK +case 139: +YY_RULE_SETUP +#line 717 "ppl.l" +pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); + YY_BREAK +/* + * Special catcher for macro argmument expansion to prevent + * newlines to propagate to the output or admin. + */ +case 140: +/* rule 140 can match eol */ +YY_RULE_SETUP +#line 723 "ppl.l" +put_buffer(ppy_text, ppy_leng); + YY_BREAK +case 141: +YY_RULE_SETUP +#line 725 "ppl.l" +{ + ppy_lval.cptr=pp_xstrdup(ppy_text); + yy_pop_state(); + return tRCINCLUDEPATH; + } + YY_BREAK +case 142: +YY_RULE_SETUP +#line 731 "ppl.l" +; + YY_BREAK +case 143: +YY_RULE_SETUP +#line 733 "ppl.l" +{ + new_string(); add_string(ppy_text,ppy_leng);yy_push_state(pp_dqs); + } + YY_BREAK +/* + * This is a 'catch-all' rule to discover errors in the scanner + * in an orderly manner. + */ +case 144: +YY_RULE_SETUP +#line 741 "ppl.l" +pp_incl_state.seen_junk++; ppy_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_text); + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(pp_pp): +case YY_STATE_EOF(pp_eol): +case YY_STATE_EOF(pp_inc): +case YY_STATE_EOF(pp_dqs): +case YY_STATE_EOF(pp_sqs): +case YY_STATE_EOF(pp_iqs): +case YY_STATE_EOF(pp_comment): +case YY_STATE_EOF(pp_def): +case YY_STATE_EOF(pp_define): +case YY_STATE_EOF(pp_macro): +case YY_STATE_EOF(pp_mbody): +case YY_STATE_EOF(pp_macign): +case YY_STATE_EOF(pp_macscan): +case YY_STATE_EOF(pp_macexp): +case YY_STATE_EOF(pp_if): +case YY_STATE_EOF(pp_ifd): +case YY_STATE_EOF(pp_ifignored): +case YY_STATE_EOF(pp_endif): +case YY_STATE_EOF(pp_line): +case YY_STATE_EOF(pp_defined): +case YY_STATE_EOF(pp_ignore): +case YY_STATE_EOF(RCINCL): +#line 743 "ppl.l" +{ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + bufferstackentry_t *bep = pop_buffer(); + + if((!bep && pp_get_if_depth()) || (bep && pp_get_if_depth() != bep->if_depth)) + ppy_warning("Unmatched #if/#endif at end of file"); + + if(!bep) + { + if(YY_START != INITIAL) + { + ppy_error("Unexpected end of file during preprocessing"); + BEGIN(INITIAL); + } + yyterminate(); + } + else if(bep->should_pop == 2) + { + macexpstackentry_t *mac; + mac = pop_macro(); + expand_macro(mac); + } + ppy__delete_buffer(b); + } + YY_BREAK +case 145: +YY_RULE_SETUP +#line 768 "ppl.l" +ECHO; + YY_BREAK +#line 2959 "ppl.yy.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 421 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 421 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 420); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int _new_state ) +{ + if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) + { + yy_size_t new_size; + + (yy_start_stack_depth) += YY_START_STACK_INCR; + new_size = (yy_size_t) (yy_start_stack_depth) * sizeof( int ); + + if ( ! (yy_start_stack) ) + (yy_start_stack) = (int *) yyalloc( new_size ); + + else + (yy_start_stack) = (int *) yyrealloc( + (void *) (yy_start_stack), new_size ); + + if ( ! (yy_start_stack) ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; + + BEGIN(_new_state); +} + + static void yy_pop_state (void) +{ + if ( --(yy_start_stack_ptr) < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); +} + + static int yy_top_state (void) +{ + return (yy_start_stack)[(yy_start_stack_ptr) - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + yyfree( (yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 768 "ppl.l" + +/* + ************************************************************************** + * Support functions + ************************************************************************** + */ + +#ifndef ppy_wrap +int ppy_wrap(void) +{ + return 1; +} +#endif + + +/* + *------------------------------------------------------------------------- + * Output newlines or set them as continuations + * + * Input: -1 - Don't count this one, but update local position (see pp_dqs) + * 0 - Line-continuation seen and cache output + * 1 - Newline seen and flush output + *------------------------------------------------------------------------- + */ +static void newline(int dowrite) +{ + pp_status.line_number++; + pp_status.char_number = 1; + + if(dowrite == -1) + return; + + ncontinuations++; + if(dowrite) + { + for(;ncontinuations; ncontinuations--) + put_buffer("\n", 1); + } +} + + +/* + *------------------------------------------------------------------------- + * Make a number out of an any-base and suffixed string + * + * Possible number extensions: + * - "" int + * - "L" long int + * - "LL" long long int + * - "U" unsigned int + * - "UL" unsigned long int + * - "ULL" unsigned long long int + * - "LU" unsigned long int + * - "LLU" unsigned long long int + * - "LUL" invalid + * + * FIXME: + * The sizes of resulting 'int' and 'long' are compiler specific. + * I depend on sizeof(int) > 2 here (although a relatively safe + * assumption). + * Long longs are not yet implemented because this is very compiler + * specific and I don't want to think too much about the problems. + * + *------------------------------------------------------------------------- + */ +static int make_number(int radix, YYSTYPE *val, const char *str, int len) +{ + int is_l = 0; + int is_ll = 0; + int is_u = 0; + char ext[4]; + long l; + + ext[3] = '\0'; + ext[2] = toupper(str[len-1]); + ext[1] = len > 1 ? toupper(str[len-2]) : ' '; + ext[0] = len > 2 ? toupper(str[len-3]) : ' '; + + if(!strcmp(ext, "LUL")) + { + ppy_error("Invalid constant suffix"); + return 0; + } + else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL")) + { + is_ll++; + is_u++; + } + else if(!strcmp(ext+1, "LU") || !strcmp(ext+1, "UL")) + { + is_l++; + is_u++; + } + else if(!strcmp(ext+1, "LL")) + { + is_ll++; + } + else if(!strcmp(ext+2, "L")) + { + is_l++; + } + else if(!strcmp(ext+2, "U")) + { + is_u++; + } + + if(is_u && is_ll) + { + errno = 0; + val->ull = _strtoui64(str, NULL, radix); + if (val->ull == ULLONG_MAX && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tULONGLONG; + } + else if(!is_u && is_ll) + { + errno = 0; + val->sll = _strtoi64(str, NULL, radix); + if ((val->sll == LLONG_MIN || val->sll == LLONG_MAX) && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tSLONGLONG; + } + else if(is_u && is_l) + { + errno = 0; + val->ulong = strtoul(str, NULL, radix); + if (val->ulong == ULONG_MAX && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tULONG; + } + else if(!is_u && is_l) + { + errno = 0; + val->slong = strtol(str, NULL, radix); + if ((val->slong == LONG_MIN || val->slong == LONG_MAX) && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tSLONG; + } + else if(is_u && !is_l) + { + unsigned long ul; + errno = 0; + ul = strtoul(str, NULL, radix); + if ((ul == ULONG_MAX && errno == ERANGE) || (ul > UINT_MAX)) + ppy_error("integer constant %s is too large\n", str); + val->uint = (unsigned int)ul; + return tUINT; + } + + /* Else it must be an int... */ + errno = 0; + l = strtol(str, NULL, radix); + if (((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE) || + (l > INT_MAX) || (l < INT_MIN)) + ppy_error("integer constant %s is too large\n", str); + val->sint = (int)l; + return tSINT; +} + + +/* + *------------------------------------------------------------------------- + * Macro and define expansion support + * + * FIXME: Variable macro arguments. + *------------------------------------------------------------------------- + */ +static void expand_special(pp_entry_t *ppp) +{ + static char *buf = NULL; + char *new_buf; + + assert(ppp->type == def_special); + + if(!strcmp(ppp->ident, "__LINE__")) + { + new_buf = pp_xrealloc(buf, 32); + if(!new_buf) + return; + buf = new_buf; + sprintf(buf, "%d", pp_status.line_number); + } + else if(!strcmp(ppp->ident, "__FILE__")) + { + new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + if(!new_buf) + return; + buf = new_buf; + sprintf(buf, "\"%s\"", pp_status.input); + } + else + pp_internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident); + + if(buf && buf[0]) + { + push_buffer(ppp, NULL, NULL, 0); + yy_scan_string(buf); + } +} + +static void expand_define(pp_entry_t *ppp) +{ + assert(ppp->type == def_define); + + if(ppp->subst.text && ppp->subst.text[0]) + { + push_buffer(ppp, NULL, NULL, 0); + yy_scan_string(ppp->subst.text); + } +} + +static int curdef_idx = 0; +static int curdef_alloc = 0; +static char *curdef_text = NULL; + +static void add_text(const char *str, int len) +{ + int new_alloc; + char *new_text; + + if(len == 0) + return; + if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len) + { + new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0])); + if(!new_text) + return; + curdef_text = new_text; + curdef_alloc = new_alloc; + if(curdef_alloc > 65536) + ppy_warning("Reallocating macro-expansion buffer larger than 64kB"); + } + memcpy(&curdef_text[curdef_idx], str, len); + curdef_idx += len; +} + +static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl) +{ + char *cptr; + char *exp; + int tag; + int n; + + if(mtp == NULL) + return NULL; + + switch(mtp->type) + { + case exp_text: + add_text(mtp->subst.text, strlen(mtp->subst.text)); + break; + + case exp_stringize: + cptr = mep->args[mtp->subst.argidx]; + add_text("\"", 1); + while(*cptr) + { + if(*cptr == '"' || *cptr == '\\') + add_text("\\", 1); + add_text(cptr, 1); + cptr++; + } + add_text("\"", 1); + break; + + case exp_concat: + /* Remove trailing whitespace from current expansion text */ + while(curdef_idx) + { + if(isspace(curdef_text[curdef_idx-1] & 0xff)) + curdef_idx--; + else + break; + } + /* tag current position and recursively expand the next part */ + tag = curdef_idx; + mtp = add_expand_text(mtp->next, mep, nnl); + + /* Now get rid of the leading space of the expansion */ + cptr = &curdef_text[tag]; + n = curdef_idx - tag; + while(n) + { + if(isspace(*cptr & 0xff)) + { + cptr++; + n--; + } + else + break; + } + if(cptr != &curdef_text[tag]) + { + memmove(&curdef_text[tag], cptr, n); + curdef_idx -= (curdef_idx - tag) - n; + } + break; + + case exp_subst: + if((mtp->next && mtp->next->type == exp_concat) || (mtp->prev && mtp->prev->type == exp_concat)) + exp = mep->args[mtp->subst.argidx]; + else + exp = mep->ppargs[mtp->subst.argidx]; + if(exp) + { + add_text(exp, strlen(exp)); + *nnl -= mep->nnls[mtp->subst.argidx]; + cptr = strchr(exp, '\n'); + while(cptr) + { + *cptr = ' '; + cptr = strchr(cptr+1, '\n'); + } + mep->nnls[mtp->subst.argidx] = 0; + } + break; + + default: + pp_internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type); + } + return mtp; +} + +static void expand_macro(macexpstackentry_t *mep) +{ + mtext_t *mtp; + int n, k; + char *cptr; + int nnl = 0; + pp_entry_t *ppp = mep->ppp; + int nargs = mep->nargs; + + assert(ppp->type == def_macro); + assert(ppp->expanding == 0); + + if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs)) + { + ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs); + return; + } + + for(n = 0; n < nargs; n++) + nnl += mep->nnls[n]; + + curdef_idx = 0; + + for(mtp = ppp->subst.mtext; mtp; mtp = mtp->next) + { + if(!(mtp = add_expand_text(mtp, mep, &nnl))) + break; + } + + for(n = 0; n < nnl; n++) + add_text("\n", 1); + + /* To make sure there is room and termination (see below) */ + add_text(" \0", 2); + + /* Strip trailing whitespace from expansion */ + for(k = curdef_idx, cptr = &curdef_text[curdef_idx-1]; k > 0; k--, cptr--) + { + if(!isspace(*cptr & 0xff)) + break; + } + + /* + * We must add *one* whitespace to make sure that there + * is a token-separation after the expansion. + */ + *(++cptr) = ' '; + *(++cptr) = '\0'; + k++; + + /* Strip leading whitespace from expansion */ + for(n = 0, cptr = curdef_text; n < k; n++, cptr++) + { + if(!isspace(*cptr & 0xff)) + break; + } + + if(k - n > 0) + { + push_buffer(ppp, NULL, NULL, 0); + /*yy_scan_bytes(curdef_text + n, k - n);*/ + yy_scan_string(curdef_text + n); + } +} + +/* + *------------------------------------------------------------------------- + * String collection routines + *------------------------------------------------------------------------- + */ +static void new_string(void) +{ +#ifdef DEBUG + if(strbuf_idx) + ppy_warning("new_string: strbuf_idx != 0"); +#endif + strbuf_idx = 0; + str_startline = pp_status.line_number; +} + +static void add_string(const char *str, int len) +{ + int new_alloc; + char *new_buffer; + + if(len == 0) + return; + if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len) + { + new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0])); + if(!new_buffer) + return; + strbuffer = new_buffer; + strbuf_alloc = new_alloc; + if(strbuf_alloc > 65536) + ppy_warning("Reallocating string buffer larger than 64kB"); + } + memcpy(&strbuffer[strbuf_idx], str, len); + strbuf_idx += len; +} + +static char *get_string(void) +{ + char *str = pp_xmalloc(strbuf_idx + 1); + if(!str) + return NULL; + memcpy(str, strbuffer, strbuf_idx); + str[strbuf_idx] = '\0'; +#ifdef DEBUG + strbuf_idx = 0; +#endif + return str; +} + +static void put_string(void) +{ + put_buffer(strbuffer, strbuf_idx); +#ifdef DEBUG + strbuf_idx = 0; +#endif +} + +static int string_start(void) +{ + return str_startline; +} + + +/* + *------------------------------------------------------------------------- + * Buffer management + *------------------------------------------------------------------------- + */ +static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop) +{ + if(bufferstackidx >= MAXBUFFERSTACK) + pp_internal_error(__FILE__, __LINE__, "Buffer stack overflow"); + + memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0])); + bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER; + bufferstack[bufferstackidx].filehandle = pp_status.file; + bufferstack[bufferstackidx].define = ppp; + bufferstack[bufferstackidx].line_number = pp_status.line_number; + bufferstack[bufferstackidx].char_number = pp_status.char_number; + bufferstack[bufferstackidx].if_depth = pp_get_if_depth(); + bufferstack[bufferstackidx].should_pop = pop; + bufferstack[bufferstackidx].filename = pp_status.input; + bufferstack[bufferstackidx].ncontinuations = ncontinuations; + bufferstack[bufferstackidx].incl = pp_incl_state; + bufferstack[bufferstackidx].include_filename = incname; + + if(ppp) + ppp->expanding = 1; + else if(filename) + { + /* These will track the ppy_error to the correct file and line */ + pp_status.line_number = 1; + pp_status.char_number = 1; + pp_status.input = filename; + ncontinuations = 0; + } + else if(!pop) + pp_internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to"); + bufferstackidx++; +} + +static bufferstackentry_t *pop_buffer(void) +{ + if(bufferstackidx < 0) + pp_internal_error(__FILE__, __LINE__, "Bufferstack underflow?"); + + if(bufferstackidx == 0) + return NULL; + + bufferstackidx--; + + if(bufferstack[bufferstackidx].define) + bufferstack[bufferstackidx].define->expanding = 0; + else + { + includelogicentry_t *iep = NULL; + + if(!bufferstack[bufferstackidx].should_pop) + { + wpp_close(pp_status.file); + pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename); + + /* We have EOF, check the include logic */ + if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp) + { + pp_entry_t *ppp = pplookup(pp_incl_state.ppp); + if(ppp) + { + iep = pp_xmalloc(sizeof(includelogicentry_t)); + if (iep) + { + iep->ppp = ppp; + ppp->iep = iep; + iep->filename = bufferstack[bufferstackidx].include_filename; + iep->prev = NULL; + iep->next = pp_includelogiclist; + if(iep->next) + iep->next->prev = iep; + pp_includelogiclist = iep; + } + } + } + free(pp_incl_state.ppp); + pp_incl_state = bufferstack[bufferstackidx].incl; + + } + if (bufferstack[bufferstackidx].include_filename) + { + free(pp_status.input); + pp_status.input = bufferstack[bufferstackidx].filename; + } + pp_status.line_number = bufferstack[bufferstackidx].line_number; + pp_status.char_number = bufferstack[bufferstackidx].char_number; + ncontinuations = bufferstack[bufferstackidx].ncontinuations; + if (!iep) + free(bufferstack[bufferstackidx].include_filename); + } + + pp_status.file = bufferstack[bufferstackidx].filehandle; + ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate); + + if(bufferstack[bufferstackidx].should_pop) + { + if(yy_current_state() == pp_macexp) + macro_add_expansion(); + else + pp_internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state"); + yy_pop_state(); + } + + return &bufferstack[bufferstackidx]; +} + + +/* + *------------------------------------------------------------------------- + * Macro nestng support + *------------------------------------------------------------------------- + */ +static void push_macro(pp_entry_t *ppp) +{ + if(macexpstackidx >= MAXMACEXPSTACK) + { + ppy_error("Too many nested macros"); + return; + } + + macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0])); + if(!macexpstack[macexpstackidx]) + return; + memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0])); + macexpstack[macexpstackidx]->ppp = ppp; + macexpstackidx++; +} + +static macexpstackentry_t *top_macro(void) +{ + return macexpstackidx > 0 ? macexpstack[macexpstackidx-1] : NULL; +} + +static macexpstackentry_t *pop_macro(void) +{ + if(macexpstackidx <= 0) + pp_internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n"); + return macexpstack[--macexpstackidx]; +} + +static void free_macro(macexpstackentry_t *mep) +{ + int i; + + for(i = 0; i < mep->nargs; i++) + free(mep->args[i]); + free(mep->args); + free(mep->nnls); + free(mep->curarg); + free(mep); +} + +static void add_text_to_macro(const char *text, int len) +{ + macexpstackentry_t *mep = top_macro(); + + assert(mep->ppp->expanding == 0); + + if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */ + { + char *new_curarg; + int new_alloc = mep->curargalloc + ((ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1); + new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0])); + if(!new_curarg) + return; + mep->curarg = new_curarg; + mep->curargalloc = new_alloc; + } + memcpy(mep->curarg + mep->curargsize, text, len); + mep->curargsize += len; + mep->curarg[mep->curargsize] = '\0'; +} + +static void macro_add_arg(int last) +{ + int nnl = 0; + char *cptr; + char **new_args, **new_ppargs; + int *new_nnls; + macexpstackentry_t *mep = top_macro(); + + assert(mep->ppp->expanding == 0); + + new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); + if(!new_args) + return; + mep->args = new_args; + + new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); + if(!new_ppargs) + return; + mep->ppargs = new_ppargs; + + new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + if(!new_nnls) + return; + mep->nnls = new_nnls; + + mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + if(!mep->args[mep->nargs]) + return; + cptr = mep->args[mep->nargs]-1; + while((cptr = strchr(cptr+1, '\n'))) + { + nnl++; + } + mep->nnls[mep->nargs] = nnl; + mep->nargs++; + free(mep->curarg); + mep->curargalloc = mep->curargsize = 0; + mep->curarg = NULL; + + /* Each macro argument must be expanded to cope with stingize */ + if(last || mep->args[mep->nargs-1][0]) + { + yy_push_state(pp_macexp); + push_buffer(NULL, NULL, NULL, last ? 2 : 1); + yy_scan_string(mep->args[mep->nargs-1]); + /*mep->bufferstackidx = bufferstackidx; But not nested! */ + } +} + +static void macro_add_expansion(void) +{ + macexpstackentry_t *mep = top_macro(); + + assert(mep->ppp->expanding == 0); + + mep->ppargs[mep->nargs-1] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + free(mep->curarg); + mep->curargalloc = mep->curargsize = 0; + mep->curarg = NULL; +} + + +/* + *------------------------------------------------------------------------- + * Output management + *------------------------------------------------------------------------- + */ +static void put_buffer(const char *s, int len) +{ + if(top_macro()) + add_text_to_macro(s, len); + else + wpp_write(s, len); +} + + +/* + *------------------------------------------------------------------------- + * Include management + *------------------------------------------------------------------------- + */ +void pp_do_include(char *fname, int type) +{ + char *newpath; + int n; + includelogicentry_t *iep; + void *fp; + + if(!fname) + return; + + for(iep = pp_includelogiclist; iep; iep = iep->next) + { + if(!strcmp(iep->filename, fname)) + { + /* + * We are done. The file was included before. + * If the define was deleted, then this entry would have + * been deleted too. + */ + free(fname); + return; + } + } + + n = strlen(fname); + + if(n <= 2) + { + ppy_error("Empty include filename"); + free(fname); + return; + } + + /* Undo the effect of the quotation */ + fname[n-1] = '\0'; + + if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL) + { + ppy_error("Unable to open include file %s", fname+1); + free(fname); + return; + } + + fname[n-1] = *fname; /* Redo the quotes */ + push_buffer(NULL, newpath, fname, 0); + pp_incl_state.seen_junk = 0; + pp_incl_state.state = 0; + pp_incl_state.ppp = NULL; + + pp_status.file = fp; + ppy__switch_to_buffer(ppy__create_buffer(NULL, YY_BUF_SIZE)); + + pp_writestring("# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); +} + +/* + *------------------------------------------------------------------------- + * Push/pop preprocessor ignore state when processing conditionals + * which are false. + *------------------------------------------------------------------------- + */ +void pp_push_ignore_state(void) +{ + yy_push_state(pp_ignore); +} + +void pp_pop_ignore_state(void) +{ + yy_pop_state(); +} + diff --git a/dll/directx/wine/d3dcompiler_43/ppl.yy.h b/dll/directx/wine/d3dcompiler_43/ppl.yy.h new file mode 100644 index 00000000000..2832331833f --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/ppl.yy.h @@ -0,0 +1,730 @@ +#ifndef ppy_HEADER_H +#define ppy_HEADER_H 1 +#define ppy_IN_HEADER 1 + +#line 5 "ppl.yy.h" + +#line 7 "ppl.yy.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define ppy__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer ppy__create_buffer +#endif + +#ifdef yy_delete_buffer +#define ppy__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer ppy__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define ppy__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer ppy__scan_buffer +#endif + +#ifdef yy_scan_string +#define ppy__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string ppy__scan_string +#endif + +#ifdef yy_scan_bytes +#define ppy__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes ppy__scan_bytes +#endif + +#ifdef yy_init_buffer +#define ppy__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer ppy__init_buffer +#endif + +#ifdef yy_flush_buffer +#define ppy__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer ppy__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define ppy__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state ppy__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define ppy__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer ppy__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define ppy_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state ppy_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define ppy_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state ppy_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define ppy_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack ppy_ensure_buffer_stack +#endif + +#ifdef yylex +#define ppy_lex_ALREADY_DEFINED +#else +#define yylex ppy_lex +#endif + +#ifdef yyrestart +#define ppy_restart_ALREADY_DEFINED +#else +#define yyrestart ppy_restart +#endif + +#ifdef yylex_init +#define ppy_lex_init_ALREADY_DEFINED +#else +#define yylex_init ppy_lex_init +#endif + +#ifdef yylex_init_extra +#define ppy_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra ppy_lex_init_extra +#endif + +#ifdef yylex_destroy +#define ppy_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy ppy_lex_destroy +#endif + +#ifdef yyget_debug +#define ppy_get_debug_ALREADY_DEFINED +#else +#define yyget_debug ppy_get_debug +#endif + +#ifdef yyset_debug +#define ppy_set_debug_ALREADY_DEFINED +#else +#define yyset_debug ppy_set_debug +#endif + +#ifdef yyget_extra +#define ppy_get_extra_ALREADY_DEFINED +#else +#define yyget_extra ppy_get_extra +#endif + +#ifdef yyset_extra +#define ppy_set_extra_ALREADY_DEFINED +#else +#define yyset_extra ppy_set_extra +#endif + +#ifdef yyget_in +#define ppy_get_in_ALREADY_DEFINED +#else +#define yyget_in ppy_get_in +#endif + +#ifdef yyset_in +#define ppy_set_in_ALREADY_DEFINED +#else +#define yyset_in ppy_set_in +#endif + +#ifdef yyget_out +#define ppy_get_out_ALREADY_DEFINED +#else +#define yyget_out ppy_get_out +#endif + +#ifdef yyset_out +#define ppy_set_out_ALREADY_DEFINED +#else +#define yyset_out ppy_set_out +#endif + +#ifdef yyget_leng +#define ppy_get_leng_ALREADY_DEFINED +#else +#define yyget_leng ppy_get_leng +#endif + +#ifdef yyget_text +#define ppy_get_text_ALREADY_DEFINED +#else +#define yyget_text ppy_get_text +#endif + +#ifdef yyget_lineno +#define ppy_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno ppy_get_lineno +#endif + +#ifdef yyset_lineno +#define ppy_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno ppy_set_lineno +#endif + +#ifdef yywrap +#define ppy_wrap_ALREADY_DEFINED +#else +#define yywrap ppy_wrap +#endif + +#ifdef yyalloc +#define ppy_alloc_ALREADY_DEFINED +#else +#define yyalloc ppy_alloc +#endif + +#ifdef yyrealloc +#define ppy_realloc_ALREADY_DEFINED +#else +#define yyrealloc ppy_realloc +#endif + +#ifdef yyfree +#define ppy_free_ALREADY_DEFINED +#else +#define yyfree ppy_free +#endif + +#ifdef yytext +#define ppy_text_ALREADY_DEFINED +#else +#define yytext ppy_text +#endif + +#ifdef yyleng +#define ppy_leng_ALREADY_DEFINED +#else +#define yyleng ppy_leng +#endif + +#ifdef yyin +#define ppy_in_ALREADY_DEFINED +#else +#define yyin ppy_in +#endif + +#ifdef yyout +#define ppy_out_ALREADY_DEFINED +#else +#define yyout ppy_out +#endif + +#ifdef yy_flex_debug +#define ppy__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug ppy__flex_debug +#endif + +#ifdef yylineno +#define ppy_lineno_ALREADY_DEFINED +#else +#define yylineno ppy_lineno +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +/* Begin user sect3 */ + +extern int yylineno; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define pp_pp 1 +#define pp_eol 2 +#define pp_inc 3 +#define pp_dqs 4 +#define pp_sqs 5 +#define pp_iqs 6 +#define pp_comment 7 +#define pp_def 8 +#define pp_define 9 +#define pp_macro 10 +#define pp_mbody 11 +#define pp_macign 12 +#define pp_macscan 13 +#define pp_macexp 14 +#define pp_if 15 +#define pp_ifd 16 +#define pp_ifignored 17 +#define pp_endif 18 +#define pp_line 19 +#define pp_defined 20 +#define pp_ignore 21 +#define RCINCL 22 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef ppy__create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef ppy__delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef ppy__scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef ppy__scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef ppy__scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef ppy__init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef ppy__flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef ppy__load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef ppy__switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef ppy_push_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef ppy_pop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef ppy_ensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef ppy_lex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef ppy_restart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef ppy_lex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef ppy_lex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef ppy_lex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef ppy_get_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef ppy_set_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef ppy_get_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef ppy_set_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef ppy_get_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef ppy_set_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef ppy_get_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef ppy_set_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef ppy_get_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef ppy_get_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef ppy_get_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef ppy_set_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef ppy_get_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef ppy_set_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef ppy_wrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef ppy_get_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef ppy_set_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef ppy_get_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef ppy_set_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef ppy_alloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef ppy_realloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef ppy_free_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef ppy_text_ALREADY_DEFINED +#undef yytext +#endif +#ifndef ppy_leng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef ppy_in_ALREADY_DEFINED +#undef yyin +#endif +#ifndef ppy_out_ALREADY_DEFINED +#undef yyout +#endif +#ifndef ppy__flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef ppy_lineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef ppy_tables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef ppy_tables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef ppy_TABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 768 "ppl.l" + + +#line 728 "ppl.yy.h" +#undef ppy_IN_HEADER +#endif /* ppy_HEADER_H */ diff --git a/dll/directx/wine/d3dcompiler_43/ppy.tab.c b/dll/directx/wine/d3dcompiler_43/ppy.tab.c new file mode 100644 index 00000000000..89f2e45a602 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/ppy.tab.c @@ -0,0 +1,2619 @@ +/* A Bison parser, made by GNU Bison 3.4.1. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + +/* Substitute the variable and function names. */ +#define yyparse ppy_parse +#define yylex ppy_lex +#define yyerror ppy_error +#define yydebug ppy_debug +#define yynerrs ppy_nerrs + +#define yylval ppy_lval +#define yychar ppy_char + +/* First part of user prologue. */ +#line 22 "ppy.y" + +#include +#include +#include +#include +#include +#include +#include "wpp_private.h" + + +#define UNARY_OP(r, v, OP) \ + switch(v.type) \ + { \ + case cv_sint: r.val.si = OP v.val.si; break; \ + case cv_uint: r.val.ui = OP v.val.ui; break; \ + case cv_slong: r.val.sl = OP v.val.sl; break; \ + case cv_ulong: r.val.ul = OP v.val.ul; break; \ + case cv_sll: r.val.sll = OP v.val.sll; break; \ + case cv_ull: r.val.ull = OP v.val.ull; break; \ + } + +#define cv_signed(v) ((v.type & FLAG_SIGNED) != 0) + +#define BIN_OP_INT(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.si = v1.val.si OP v2.val.si; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.si = v1.val.si OP (signed) v2.val.ui; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.si = (signed) v1.val.ui OP v2.val.si; \ + else \ + r.val.ui = v1.val.ui OP v2.val.ui; + +#define BIN_OP_LONG(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.sl = v1.val.sl OP v2.val.sl; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \ + else \ + r.val.ul = v1.val.ul OP v2.val.ul; + +#define BIN_OP_LONGLONG(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.sll = v1.val.sll OP v2.val.sll; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.sll = v1.val.sll OP (__int64) v2.val.ull; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.sll = (__int64) v1.val.ull OP v2.val.sll; \ + else \ + r.val.ull = v1.val.ull OP v2.val.ull; + +#define BIN_OP(r, v1, v2, OP) \ + switch(v1.type & SIZE_MASK) \ + { \ + case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \ + case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \ + case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \ + default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \ + } + + +/* + * Prototypes + */ +static int boolean(cval_t *v); +static void promote_equal_size(cval_t *v1, cval_t *v2); +static void cast_to_sint(cval_t *v); +static void cast_to_uint(cval_t *v); +static void cast_to_slong(cval_t *v); +static void cast_to_ulong(cval_t *v); +static void cast_to_sll(cval_t *v); +static void cast_to_ull(cval_t *v); +static marg_t *new_marg(char *str, def_arg_t type); +static marg_t *add_new_marg(char *str, def_arg_t type); +static int marg_index(char *id); +static mtext_t *new_mtext(char *str, int idx, def_exp_t type); +static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp); +static char *merge_text(char *s1, char *s2); + +/* + * Local variables + */ +static marg_t **macro_args; /* Macro parameters array while parsing */ +static int nmacro_args; + + +#line 170 "ppy.tab.c" + +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Use api.header.include to #include this header + instead of duplicating it here. */ +#ifndef YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED +# define YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int ppy_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + tRCINCLUDE = 258, + tIF = 259, + tIFDEF = 260, + tIFNDEF = 261, + tELSE = 262, + tELIF = 263, + tENDIF = 264, + tDEFINED = 265, + tNL = 266, + tINCLUDE = 267, + tLINE = 268, + tGCCLINE = 269, + tERROR = 270, + tWARNING = 271, + tPRAGMA = 272, + tPPIDENT = 273, + tUNDEF = 274, + tMACROEND = 275, + tCONCAT = 276, + tELIPSIS = 277, + tSTRINGIZE = 278, + tIDENT = 279, + tLITERAL = 280, + tMACRO = 281, + tDEFINE = 282, + tDQSTRING = 283, + tSQSTRING = 284, + tIQSTRING = 285, + tUINT = 286, + tSINT = 287, + tULONG = 288, + tSLONG = 289, + tULONGLONG = 290, + tSLONGLONG = 291, + tRCINCLUDEPATH = 292, + tLOGOR = 293, + tLOGAND = 294, + tEQ = 295, + tNE = 296, + tLTE = 297, + tGTE = 298, + tLSHIFT = 299, + tRSHIFT = 300 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +union YYSTYPE +{ +#line 114 "ppy.y" + + int sint; + unsigned int uint; + long slong; + unsigned long ulong; + __int64 sll; + unsigned __int64 ull; + int *iptr; + char *cptr; + cval_t cval; + marg_t *marg; + mtext_t *mtext; + +#line 273 "ppy.tab.c" + +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE ppy_lval; + +int ppy_parse (void); + +#endif /* !YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED */ + + + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 303 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 62 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 13 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 84 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 153 + +#define YYUNDEFTOK 2 +#define YYMAXUTOK 300 + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 58, 2, 2, 2, 2, 44, 2, + 60, 61, 55, 53, 59, 54, 2, 56, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 39, 2, + 47, 2, 49, 38, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 43, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 42, 2, 57, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 40, 41, 45, 46, 48, 50, 51, + 52 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 169, 169, 170, 174, 175, 176, 177, 178, 195, + 219, 245, 259, 260, 261, 264, 265, 266, 268, 270, + 272, 274, 275, 276, 277, 278, 279, 292, 298, 299, + 302, 303, 304, 305, 306, 307, 310, 313, 314, 317, + 318, 321, 322, 326, 327, 333, 334, 337, 338, 339, + 340, 341, 348, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, 385, 386, 387, 388 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "tRCINCLUDE", "tIF", "tIFDEF", "tIFNDEF", + "tELSE", "tELIF", "tENDIF", "tDEFINED", "tNL", "tINCLUDE", "tLINE", + "tGCCLINE", "tERROR", "tWARNING", "tPRAGMA", "tPPIDENT", "tUNDEF", + "tMACROEND", "tCONCAT", "tELIPSIS", "tSTRINGIZE", "tIDENT", "tLITERAL", + "tMACRO", "tDEFINE", "tDQSTRING", "tSQSTRING", "tIQSTRING", "tUINT", + "tSINT", "tULONG", "tSLONG", "tULONGLONG", "tSLONGLONG", + "tRCINCLUDEPATH", "'?'", "':'", "tLOGOR", "tLOGAND", "'|'", "'^'", "'&'", + "tEQ", "tNE", "'<'", "tLTE", "'>'", "tGTE", "tLSHIFT", "tRSHIFT", "'+'", + "'-'", "'*'", "'/'", "'~'", "'!'", "','", "'('", "')'", "$accept", + "pp_file", "preprocessor", "opt_text", "text", "res_arg", "allmargs", + "emargs", "margs", "opt_mtexts", "mtexts", "mtext", "pp_expr", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 63, 58, + 293, 294, 124, 94, 38, 295, 296, 60, 297, 62, + 298, 299, 300, 43, 45, 42, 47, 126, 33, 44, + 40, 41 +}; +# endif + +#define YYPACT_NINF -27 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-27))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + -27, 142, -27, -26, -3, -12, -2, 30, -3, 41, + 91, 21, 2, -19, -19, -19, -19, 32, -27, -19, + -27, -27, -27, -23, -27, -27, -27, -27, -27, -27, + -27, -3, -3, -3, -3, -3, 38, 66, 109, -27, + 85, -27, 113, 133, 115, -27, 124, -27, -27, -27, + 179, -9, 278, 280, 281, 282, 129, 283, -27, 271, + -10, -10, -27, -27, 57, -27, -3, -3, -3, -3, + -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, + -3, -3, -3, -3, -27, -27, -27, -27, -27, 285, + 3, -27, -27, -27, -27, -27, -27, -27, -27, -27, + 277, -27, 239, -27, 238, -27, 132, 167, 182, 196, + 209, 221, 231, 231, 111, 111, 111, 111, 61, 61, + -10, -10, -27, -27, -27, -27, 4, 19, 266, -27, + -3, -27, 6, -27, 276, -27, -27, -27, -27, 290, + 19, -27, -27, -27, 151, -27, 7, -27, -27, -27, + -27, 291, -27 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 28, 28, 28, 28, 0, 36, 28, + 3, 27, 26, 0, 61, 54, 53, 56, 55, 58, + 57, 0, 0, 0, 0, 0, 0, 0, 0, 10, + 0, 11, 0, 0, 0, 21, 0, 30, 31, 32, + 0, 29, 0, 0, 0, 0, 37, 0, 59, 0, + 79, 80, 81, 82, 0, 6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 8, 9, 4, 5, 0, + 0, 22, 33, 34, 35, 23, 24, 25, 12, 42, + 0, 38, 39, 13, 0, 83, 0, 62, 63, 74, + 72, 73, 64, 65, 66, 68, 67, 69, 77, 78, + 70, 71, 75, 76, 15, 16, 0, 43, 0, 60, + 0, 17, 0, 50, 0, 52, 47, 48, 49, 0, + 44, 45, 40, 41, 84, 18, 0, 51, 14, 46, + 19, 0, 20 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -27, -27, -27, -11, -27, -27, -27, -27, -27, -27, + -27, 163, -8 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 20, 50, 51, 56, 100, 101, 102, 139, + 140, 141, 36 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 40, 58, 21, 52, 53, 54, 47, 23, 57, 48, + 49, 22, 37, 45, 125, 131, 92, 145, 150, 93, + 94, 24, 38, 60, 61, 62, 63, 64, 25, 26, + 27, 28, 29, 30, 46, 126, 132, 59, 146, 151, + 133, 39, 134, 135, 136, 82, 83, 137, 138, 65, + 31, 32, 41, 44, 33, 34, 55, 35, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 66, 84, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 66, 86, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 80, 81, 82, 83, 105, 42, + 85, 43, 144, 66, 87, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 2, 89, 88, 3, 4, 5, 6, 7, + 8, 9, 90, 99, 10, 11, 12, 13, 14, 15, + 16, 17, 78, 79, 80, 81, 82, 83, 18, 19, + 66, 130, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 66, + 91, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 142, 95, + 143, 96, 97, 98, 103, 104, 124, 127, 128, 129, + 147, 148, 152, 149 +}; + +static const yytype_uint8 yycheck[] = +{ + 8, 24, 28, 14, 15, 16, 25, 10, 19, 28, + 29, 37, 24, 11, 11, 11, 25, 11, 11, 28, + 29, 24, 24, 31, 32, 33, 34, 35, 31, 32, + 33, 34, 35, 36, 32, 32, 32, 60, 32, 32, + 21, 11, 23, 24, 25, 55, 56, 28, 29, 11, + 53, 54, 11, 32, 57, 58, 24, 60, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 38, 11, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 38, 11, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 53, 54, 55, 56, 61, 28, + 11, 30, 130, 38, 11, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 0, 28, 11, 3, 4, 5, 6, 7, + 8, 9, 28, 24, 12, 13, 14, 15, 16, 17, + 18, 19, 51, 52, 53, 54, 55, 56, 26, 27, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 38, + 11, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 22, 11, + 24, 11, 11, 11, 11, 24, 11, 20, 59, 61, + 24, 11, 11, 140 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 63, 0, 3, 4, 5, 6, 7, 8, 9, + 12, 13, 14, 15, 16, 17, 18, 19, 26, 27, + 64, 28, 37, 10, 24, 31, 32, 33, 34, 35, + 36, 53, 54, 57, 58, 60, 74, 24, 24, 11, + 74, 11, 28, 30, 32, 11, 32, 25, 28, 29, + 65, 66, 65, 65, 65, 24, 67, 65, 24, 60, + 74, 74, 74, 74, 74, 11, 38, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 11, 11, 11, 11, 11, 28, + 28, 11, 25, 28, 29, 11, 11, 11, 11, 24, + 68, 69, 70, 11, 24, 61, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 11, 11, 32, 20, 59, 61, + 39, 11, 32, 21, 23, 24, 25, 28, 29, 71, + 72, 73, 22, 24, 74, 11, 32, 24, 11, 73, + 11, 32, 11 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 62, 63, 63, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, + 66, 66, 66, 66, 66, 66, 67, 68, 68, 69, + 69, 70, 70, 71, 71, 72, 72, 73, 73, 73, + 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 3, 3, 3, 3, 3, 3, + 2, 2, 3, 3, 6, 4, 4, 5, 6, 7, + 8, 2, 3, 3, 3, 3, 2, 2, 0, 1, + 1, 1, 1, 2, 2, 2, 0, 0, 1, 1, + 3, 3, 1, 0, 1, 1, 2, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, + 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, + 2, 2, 2, 3, 5 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyoutput = yyo; + YYUSE (yyoutput); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + +static void +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyo, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: /* Avoid compiler warnings. */ + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + + +/*------------------------------------------------------------. +| yynewstate -- push a new state, which is found in yystate. | +`------------------------------------------------------------*/ +yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; + + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); + +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 174 "ppy.y" + { pp_do_include((yyvsp[-1].cptr), 1); } +#line 1505 "ppy.tab.c" + break; + + case 5: +#line 175 "ppy.y" + { pp_do_include((yyvsp[-1].cptr), 0); } +#line 1511 "ppy.tab.c" + break; + + case 6: +#line 176 "ppy.y" + { pp_next_if_state(boolean(&(yyvsp[-1].cval))); } +#line 1517 "ppy.tab.c" + break; + + case 7: +#line 177 "ppy.y" + { pp_next_if_state(pplookup((yyvsp[-1].cptr)) != NULL); free((yyvsp[-1].cptr)); } +#line 1523 "ppy.tab.c" + break; + + case 8: +#line 178 "ppy.y" + { + int t = pplookup((yyvsp[-1].cptr)) == NULL; + if(pp_incl_state.state == 0 && t && !pp_incl_state.seen_junk) + { + pp_incl_state.state = 1; + pp_incl_state.ppp = (yyvsp[-1].cptr); + pp_incl_state.ifdepth = pp_get_if_depth(); + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + free((yyvsp[-1].cptr)); + } + else + free((yyvsp[-1].cptr)); + pp_next_if_state(t); + } +#line 1545 "ppy.tab.c" + break; + + case 9: +#line 195 "ppy.y" + { + pp_if_state_t s = pp_pop_if(); + switch(s) + { + case if_true: + case if_elif: + pp_push_if(if_elif); + break; + case if_false: + pp_push_if(boolean(&(yyvsp[-1].cval)) ? if_true : if_false); + break; + case if_ignore: + pp_push_if(if_ignore); + break; + case if_elsetrue: + case if_elsefalse: + ppy_error("#elif cannot follow #else"); + break; + case if_error: + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s); + } + } +#line 1574 "ppy.tab.c" + break; + + case 10: +#line 219 "ppy.y" + { + pp_if_state_t s = pp_pop_if(); + switch(s) + { + case if_true: + pp_push_if(if_elsefalse); + break; + case if_elif: + pp_push_if(if_elif); + break; + case if_false: + pp_push_if(if_elsetrue); + break; + case if_ignore: + pp_push_if(if_ignore); + break; + case if_elsetrue: + case if_elsefalse: + ppy_error("#else clause already defined"); + break; + case if_error: + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s); + } + } +#line 1605 "ppy.tab.c" + break; + + case 11: +#line 245 "ppy.y" + { + if(pp_pop_if() != if_error) + { + if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + { + pp_incl_state.state = 2; + pp_incl_state.seen_junk = 0; + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + } + } + } +#line 1624 "ppy.tab.c" + break; + + case 12: +#line 259 "ppy.y" + { pp_del_define((yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); } +#line 1630 "ppy.tab.c" + break; + + case 13: +#line 260 "ppy.y" + { pp_add_define((yyvsp[-2].cptr), (yyvsp[-1].cptr)); free((yyvsp[-2].cptr)); free((yyvsp[-1].cptr)); } +#line 1636 "ppy.tab.c" + break; + + case 14: +#line 261 "ppy.y" + { + pp_add_macro((yyvsp[-5].cptr), macro_args, nmacro_args, (yyvsp[-1].mtext)); + } +#line 1644 "ppy.tab.c" + break; + + case 15: +#line 264 "ppy.y" + { if((yyvsp[-1].cptr)) pp_writestring("# %d %s\n", (yyvsp[-2].sint) , (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); } +#line 1650 "ppy.tab.c" + break; + + case 16: +#line 265 "ppy.y" + { if((yyvsp[-1].cptr)) pp_writestring("# %d %s\n", (yyvsp[-2].sint) , (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); } +#line 1656 "ppy.tab.c" + break; + + case 17: +#line 267 "ppy.y" + { if((yyvsp[-2].cptr)) pp_writestring("# %d %s %d\n", (yyvsp[-3].sint), (yyvsp[-2].cptr), (yyvsp[-1].sint)); free((yyvsp[-2].cptr)); } +#line 1662 "ppy.tab.c" + break; + + case 18: +#line 269 "ppy.y" + { 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)); } +#line 1668 "ppy.tab.c" + break; + + case 19: +#line 271 "ppy.y" + { 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)); } +#line 1674 "ppy.tab.c" + break; + + case 20: +#line 273 "ppy.y" + { 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)); } +#line 1680 "ppy.tab.c" + break; + + case 22: +#line 275 "ppy.y" + { ppy_error("#error directive: '%s'", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); } +#line 1686 "ppy.tab.c" + break; + + case 23: +#line 276 "ppy.y" + { ppy_warning("#warning directive: '%s'", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); } +#line 1692 "ppy.tab.c" + break; + + case 24: +#line 277 "ppy.y" + { pp_writestring("#pragma %s\n", (yyvsp[-1].cptr) ? (yyvsp[-1].cptr) : ""); free((yyvsp[-1].cptr)); } +#line 1698 "ppy.tab.c" + break; + + case 25: +#line 278 "ppy.y" + { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); } +#line 1704 "ppy.tab.c" + break; + + case 26: +#line 279 "ppy.y" + { + if((yyvsp[0].cptr)) + { + int nl=strlen((yyvsp[0].cptr)) +3; + char *fn=pp_xmalloc(nl); + if(fn) + { + sprintf(fn,"\"%s\"",(yyvsp[0].cptr)); + pp_do_include(fn,1); + } + free((yyvsp[0].cptr)); + } + } +#line 1722 "ppy.tab.c" + break; + + case 27: +#line 292 "ppy.y" + { + pp_do_include((yyvsp[0].cptr),1); + } +#line 1730 "ppy.tab.c" + break; + + case 28: +#line 298 "ppy.y" + { (yyval.cptr) = NULL; } +#line 1736 "ppy.tab.c" + break; + + case 29: +#line 299 "ppy.y" + { (yyval.cptr) = (yyvsp[0].cptr); } +#line 1742 "ppy.tab.c" + break; + + case 30: +#line 302 "ppy.y" + { (yyval.cptr) = (yyvsp[0].cptr); } +#line 1748 "ppy.tab.c" + break; + + case 31: +#line 303 "ppy.y" + { (yyval.cptr) = (yyvsp[0].cptr); } +#line 1754 "ppy.tab.c" + break; + + case 32: +#line 304 "ppy.y" + { (yyval.cptr) = (yyvsp[0].cptr); } +#line 1760 "ppy.tab.c" + break; + + case 33: +#line 305 "ppy.y" + { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); } +#line 1766 "ppy.tab.c" + break; + + case 34: +#line 306 "ppy.y" + { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); } +#line 1772 "ppy.tab.c" + break; + + case 35: +#line 307 "ppy.y" + { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); } +#line 1778 "ppy.tab.c" + break; + + case 36: +#line 310 "ppy.y" + { macro_args = NULL; nmacro_args = 0; } +#line 1784 "ppy.tab.c" + break; + + case 37: +#line 313 "ppy.y" + { (yyval.sint) = 0; macro_args = NULL; nmacro_args = 0; } +#line 1790 "ppy.tab.c" + break; + + case 38: +#line 314 "ppy.y" + { (yyval.sint) = nmacro_args; } +#line 1796 "ppy.tab.c" + break; + + case 39: +#line 317 "ppy.y" + { (yyval.marg) = (yyvsp[0].marg); } +#line 1802 "ppy.tab.c" + break; + + case 40: +#line 318 "ppy.y" + { (yyval.marg) = add_new_marg(NULL, arg_list); nmacro_args *= -1; } +#line 1808 "ppy.tab.c" + break; + + case 41: +#line 321 "ppy.y" + { (yyval.marg) = add_new_marg((yyvsp[0].cptr), arg_single); } +#line 1814 "ppy.tab.c" + break; + + case 42: +#line 322 "ppy.y" + { (yyval.marg) = add_new_marg((yyvsp[0].cptr), arg_single); } +#line 1820 "ppy.tab.c" + break; + + case 43: +#line 326 "ppy.y" + { (yyval.mtext) = NULL; } +#line 1826 "ppy.tab.c" + break; + + case 44: +#line 327 "ppy.y" + { + for((yyval.mtext) = (yyvsp[0].mtext); (yyval.mtext) && (yyval.mtext)->prev; (yyval.mtext) = (yyval.mtext)->prev) + ; + } +#line 1835 "ppy.tab.c" + break; + + case 45: +#line 333 "ppy.y" + { (yyval.mtext) = (yyvsp[0].mtext); } +#line 1841 "ppy.tab.c" + break; + + case 46: +#line 334 "ppy.y" + { (yyval.mtext) = combine_mtext((yyvsp[-1].mtext), (yyvsp[0].mtext)); } +#line 1847 "ppy.tab.c" + break; + + case 47: +#line 337 "ppy.y" + { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); } +#line 1853 "ppy.tab.c" + break; + + case 48: +#line 338 "ppy.y" + { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); } +#line 1859 "ppy.tab.c" + break; + + case 49: +#line 339 "ppy.y" + { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); } +#line 1865 "ppy.tab.c" + break; + + case 50: +#line 340 "ppy.y" + { (yyval.mtext) = new_mtext(NULL, 0, exp_concat); } +#line 1871 "ppy.tab.c" + break; + + case 51: +#line 341 "ppy.y" + { + int mat = marg_index((yyvsp[0].cptr)); + if(mat < 0) + ppy_error("Stringification identifier must be an argument parameter"); + else + (yyval.mtext) = new_mtext(NULL, mat, exp_stringize); + } +#line 1883 "ppy.tab.c" + break; + + case 52: +#line 348 "ppy.y" + { + int mat = marg_index((yyvsp[0].cptr)); + if(mat >= 0) + (yyval.mtext) = new_mtext(NULL, mat, exp_subst); + else if((yyvsp[0].cptr)) + (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); + } +#line 1895 "ppy.tab.c" + break; + + case 53: +#line 357 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = (yyvsp[0].sint); } +#line 1901 "ppy.tab.c" + break; + + case 54: +#line 358 "ppy.y" + { (yyval.cval).type = cv_uint; (yyval.cval).val.ui = (yyvsp[0].uint); } +#line 1907 "ppy.tab.c" + break; + + case 55: +#line 359 "ppy.y" + { (yyval.cval).type = cv_slong; (yyval.cval).val.sl = (yyvsp[0].slong); } +#line 1913 "ppy.tab.c" + break; + + case 56: +#line 360 "ppy.y" + { (yyval.cval).type = cv_ulong; (yyval.cval).val.ul = (yyvsp[0].ulong); } +#line 1919 "ppy.tab.c" + break; + + case 57: +#line 361 "ppy.y" + { (yyval.cval).type = cv_sll; (yyval.cval).val.sll = (yyvsp[0].sll); } +#line 1925 "ppy.tab.c" + break; + + case 58: +#line 362 "ppy.y" + { (yyval.cval).type = cv_ull; (yyval.cval).val.ull = (yyvsp[0].ull); } +#line 1931 "ppy.tab.c" + break; + + case 59: +#line 363 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[0].cptr)) != NULL; } +#line 1937 "ppy.tab.c" + break; + + case 60: +#line 364 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[-1].cptr)) != NULL; } +#line 1943 "ppy.tab.c" + break; + + case 61: +#line 365 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = 0; } +#line 1949 "ppy.tab.c" + break; + + case 62: +#line 366 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[-2].cval)) || boolean(&(yyvsp[0].cval)); } +#line 1955 "ppy.tab.c" + break; + + case 63: +#line 367 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[-2].cval)) && boolean(&(yyvsp[0].cval)); } +#line 1961 "ppy.tab.c" + break; + + case 64: +#line 368 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), ==); } +#line 1967 "ppy.tab.c" + break; + + case 65: +#line 369 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), !=); } +#line 1973 "ppy.tab.c" + break; + + case 66: +#line 370 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <); } +#line 1979 "ppy.tab.c" + break; + + case 67: +#line 371 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >); } +#line 1985 "ppy.tab.c" + break; + + case 68: +#line 372 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <=); } +#line 1991 "ppy.tab.c" + break; + + case 69: +#line 373 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >=); } +#line 1997 "ppy.tab.c" + break; + + case 70: +#line 374 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), +); } +#line 2003 "ppy.tab.c" + break; + + case 71: +#line 375 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), -); } +#line 2009 "ppy.tab.c" + break; + + case 72: +#line 376 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), ^); } +#line 2015 "ppy.tab.c" + break; + + case 73: +#line 377 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), &); } +#line 2021 "ppy.tab.c" + break; + + case 74: +#line 378 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), |); } +#line 2027 "ppy.tab.c" + break; + + case 75: +#line 379 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), *); } +#line 2033 "ppy.tab.c" + break; + + case 76: +#line 380 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), /); } +#line 2039 "ppy.tab.c" + break; + + case 77: +#line 381 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <<); } +#line 2045 "ppy.tab.c" + break; + + case 78: +#line 382 "ppy.y" + { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >>); } +#line 2051 "ppy.tab.c" + break; + + case 79: +#line 383 "ppy.y" + { (yyval.cval) = (yyvsp[0].cval); } +#line 2057 "ppy.tab.c" + break; + + case 80: +#line 384 "ppy.y" + { UNARY_OP((yyval.cval), (yyvsp[0].cval), -); } +#line 2063 "ppy.tab.c" + break; + + case 81: +#line 385 "ppy.y" + { UNARY_OP((yyval.cval), (yyvsp[0].cval), ~); } +#line 2069 "ppy.tab.c" + break; + + case 82: +#line 386 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = !boolean(&(yyvsp[0].cval)); } +#line 2075 "ppy.tab.c" + break; + + case 83: +#line 387 "ppy.y" + { (yyval.cval) = (yyvsp[-1].cval); } +#line 2081 "ppy.tab.c" + break; + + case 84: +#line 388 "ppy.y" + { (yyval.cval) = boolean(&(yyvsp[-4].cval)) ? (yyvsp[-2].cval) : (yyvsp[0].cval); } +#line 2087 "ppy.tab.c" + break; + + +#line 2091 "ppy.tab.c" + + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 391 "ppy.y" + + +/* + ************************************************************************** + * Support functions + ************************************************************************** + */ + +static void cast_to_sint(cval_t *v) +{ + switch(v->type) + { + case cv_sint: break; + case cv_uint: break; + case cv_slong: v->val.si = v->val.sl; break; + case cv_ulong: v->val.si = v->val.ul; break; + case cv_sll: v->val.si = v->val.sll; break; + case cv_ull: v->val.si = v->val.ull; break; + } + v->type = cv_sint; +} + +static void cast_to_uint(cval_t *v) +{ + switch(v->type) + { + case cv_sint: break; + case cv_uint: break; + case cv_slong: v->val.ui = v->val.sl; break; + case cv_ulong: v->val.ui = v->val.ul; break; + case cv_sll: v->val.ui = v->val.sll; break; + case cv_ull: v->val.ui = v->val.ull; break; + } + v->type = cv_uint; +} + +static void cast_to_slong(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.sl = v->val.si; break; + case cv_uint: v->val.sl = v->val.ui; break; + case cv_slong: break; + case cv_ulong: break; + case cv_sll: v->val.sl = v->val.sll; break; + case cv_ull: v->val.sl = v->val.ull; break; + } + v->type = cv_slong; +} + +static void cast_to_ulong(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.ul = v->val.si; break; + case cv_uint: v->val.ul = v->val.ui; break; + case cv_slong: break; + case cv_ulong: break; + case cv_sll: v->val.ul = v->val.sll; break; + case cv_ull: v->val.ul = v->val.ull; break; + } + v->type = cv_ulong; +} + +static void cast_to_sll(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.sll = v->val.si; break; + case cv_uint: v->val.sll = v->val.ui; break; + case cv_slong: v->val.sll = v->val.sl; break; + case cv_ulong: v->val.sll = v->val.ul; break; + case cv_sll: break; + case cv_ull: break; + } + v->type = cv_sll; +} + +static void cast_to_ull(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.ull = v->val.si; break; + case cv_uint: v->val.ull = v->val.ui; break; + case cv_slong: v->val.ull = v->val.sl; break; + case cv_ulong: v->val.ull = v->val.ul; break; + case cv_sll: break; + case cv_ull: break; + } + v->type = cv_ull; +} + + +static void promote_equal_size(cval_t *v1, cval_t *v2) +{ +#define cv_sizeof(v) ((int)(v->type & SIZE_MASK)) + int s1 = cv_sizeof(v1); + int s2 = cv_sizeof(v2); +#undef cv_sizeof + + if(s1 == s2) + return; + else if(s1 > s2) + { + switch(v1->type) + { + case cv_sint: cast_to_sint(v2); break; + case cv_uint: cast_to_uint(v2); break; + case cv_slong: cast_to_slong(v2); break; + case cv_ulong: cast_to_ulong(v2); break; + case cv_sll: cast_to_sll(v2); break; + case cv_ull: cast_to_ull(v2); break; + } + } + else + { + switch(v2->type) + { + case cv_sint: cast_to_sint(v1); break; + case cv_uint: cast_to_uint(v1); break; + case cv_slong: cast_to_slong(v1); break; + case cv_ulong: cast_to_ulong(v1); break; + case cv_sll: cast_to_sll(v1); break; + case cv_ull: cast_to_ull(v1); break; + } + } +} + + +static int boolean(cval_t *v) +{ + switch(v->type) + { + case cv_sint: return v->val.si != 0; + case cv_uint: return v->val.ui != 0; + case cv_slong: return v->val.sl != 0; + case cv_ulong: return v->val.ul != 0; + case cv_sll: return v->val.sll != 0; + case cv_ull: return v->val.ull != 0; + } + return 0; +} + +static marg_t *new_marg(char *str, def_arg_t type) +{ + marg_t *ma = pp_xmalloc(sizeof(marg_t)); + if(!ma) + return NULL; + ma->arg = str; + ma->type = type; + ma->nnl = 0; + return ma; +} + +static marg_t *add_new_marg(char *str, def_arg_t type) +{ + marg_t **new_macro_args; + marg_t *ma; + if(!str) + return NULL; + new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0])); + if(!new_macro_args) + return NULL; + macro_args = new_macro_args; + ma = new_marg(str, type); + if(!ma) + return NULL; + macro_args[nmacro_args] = ma; + nmacro_args++; + return ma; +} + +static int marg_index(char *id) +{ + int t; + if(!id) + return -1; + for(t = 0; t < nmacro_args; t++) + { + if(!strcmp(id, macro_args[t]->arg)) + break; + } + return t < nmacro_args ? t : -1; +} + +static mtext_t *new_mtext(char *str, int idx, def_exp_t type) +{ + mtext_t *mt = pp_xmalloc(sizeof(mtext_t)); + if(!mt) + return NULL; + if(str == NULL) + mt->subst.argidx = idx; + else + mt->subst.text = str; + mt->type = type; + mt->next = mt->prev = NULL; + return mt; +} + +static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) +{ + if(!tail) + return mtp; + + if(!mtp) + return tail; + + if(tail->type == exp_text && mtp->type == exp_text) + { + char *new_text; + new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + if(!new_text) + return mtp; + tail->subst.text = new_text; + strcat(tail->subst.text, mtp->subst.text); + free(mtp->subst.text); + free(mtp); + return tail; + } + + if(tail->type == exp_concat && mtp->type == exp_concat) + { + free(mtp); + return tail; + } + + if(tail->type == exp_concat && mtp->type == exp_text) + { + int len = strlen(mtp->subst.text); + while(len) + { +/* FIXME: should delete space from head of string */ + if(isspace(mtp->subst.text[len-1] & 0xff)) + mtp->subst.text[--len] = '\0'; + else + break; + } + + if(!len) + { + free(mtp->subst.text); + free(mtp); + return tail; + } + } + + if(tail->type == exp_text && mtp->type == exp_concat) + { + int len = strlen(tail->subst.text); + while(len) + { + if(isspace(tail->subst.text[len-1] & 0xff)) + tail->subst.text[--len] = '\0'; + else + break; + } + + if(!len) + { + mtp->prev = tail->prev; + mtp->next = tail->next; + if(tail->prev) + tail->prev->next = mtp; + free(tail->subst.text); + free(tail); + return mtp; + } + } + + tail->next = mtp; + mtp->prev = tail; + + return mtp; +} + +static char *merge_text(char *s1, char *s2) +{ + int l1; + int l2; + char *snew; + if(!s1) + return s2; + if(!s2) + return s1; + l1 = strlen(s1); + l2 = strlen(s2); + snew = pp_xrealloc(s1, l1+l2+1); + if(!snew) + { + free(s2); + return s1; + } + s1 = snew; + memcpy(s1+l1, s2, l2+1); + free(s2); + return s1; +} diff --git a/dll/directx/wine/d3dcompiler_43/ppy.tab.h b/dll/directx/wine/d3dcompiler_43/ppy.tab.h new file mode 100644 index 00000000000..c8f60ea7d38 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/ppy.tab.h @@ -0,0 +1,129 @@ +/* A Bison parser, made by GNU Bison 3.4.1. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +#ifndef YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED +# define YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int ppy_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + tRCINCLUDE = 258, + tIF = 259, + tIFDEF = 260, + tIFNDEF = 261, + tELSE = 262, + tELIF = 263, + tENDIF = 264, + tDEFINED = 265, + tNL = 266, + tINCLUDE = 267, + tLINE = 268, + tGCCLINE = 269, + tERROR = 270, + tWARNING = 271, + tPRAGMA = 272, + tPPIDENT = 273, + tUNDEF = 274, + tMACROEND = 275, + tCONCAT = 276, + tELIPSIS = 277, + tSTRINGIZE = 278, + tIDENT = 279, + tLITERAL = 280, + tMACRO = 281, + tDEFINE = 282, + tDQSTRING = 283, + tSQSTRING = 284, + tIQSTRING = 285, + tUINT = 286, + tSINT = 287, + tULONG = 288, + tSLONG = 289, + tULONGLONG = 290, + tSLONGLONG = 291, + tRCINCLUDEPATH = 292, + tLOGOR = 293, + tLOGAND = 294, + tEQ = 295, + tNE = 296, + tLTE = 297, + tGTE = 298, + tLSHIFT = 299, + tRSHIFT = 300 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +union YYSTYPE +{ +#line 114 "ppy.y" + + int sint; + unsigned int uint; + long slong; + unsigned long ulong; + __int64 sll; + unsigned __int64 ull; + int *iptr; + char *cptr; + cval_t cval; + marg_t *marg; + mtext_t *mtext; + +#line 117 "ppy.tab.h" + +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE ppy_lval; + +int ppy_parse (void); + +#endif /* !YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED */ diff --git a/dll/directx/wine/d3dcompiler_43/ppy.y b/dll/directx/wine/d3dcompiler_43/ppy.y new file mode 100644 index 00000000000..d520883faab --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/ppy.y @@ -0,0 +1,687 @@ +/* + * Wrc preprocessor syntax analysis + * + * Copyright 1999-2000 Bertho A. Stultiens (BS) + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +%{ +#include +#include +#include +#include +#include +#include +#include "wpp_private.h" + + +#define UNARY_OP(r, v, OP) \ + switch(v.type) \ + { \ + case cv_sint: r.val.si = OP v.val.si; break; \ + case cv_uint: r.val.ui = OP v.val.ui; break; \ + case cv_slong: r.val.sl = OP v.val.sl; break; \ + case cv_ulong: r.val.ul = OP v.val.ul; break; \ + case cv_sll: r.val.sll = OP v.val.sll; break; \ + case cv_ull: r.val.ull = OP v.val.ull; break; \ + } + +#define cv_signed(v) ((v.type & FLAG_SIGNED) != 0) + +#define BIN_OP_INT(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.si = v1.val.si OP v2.val.si; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.si = v1.val.si OP (signed) v2.val.ui; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.si = (signed) v1.val.ui OP v2.val.si; \ + else \ + r.val.ui = v1.val.ui OP v2.val.ui; + +#define BIN_OP_LONG(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.sl = v1.val.sl OP v2.val.sl; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \ + else \ + r.val.ul = v1.val.ul OP v2.val.ul; + +#define BIN_OP_LONGLONG(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.sll = v1.val.sll OP v2.val.sll; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.sll = v1.val.sll OP (__int64) v2.val.ull; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.sll = (__int64) v1.val.ull OP v2.val.sll; \ + else \ + r.val.ull = v1.val.ull OP v2.val.ull; + +#define BIN_OP(r, v1, v2, OP) \ + switch(v1.type & SIZE_MASK) \ + { \ + case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \ + case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \ + case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \ + default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \ + } + + +/* + * Prototypes + */ +static int boolean(cval_t *v); +static void promote_equal_size(cval_t *v1, cval_t *v2); +static void cast_to_sint(cval_t *v); +static void cast_to_uint(cval_t *v); +static void cast_to_slong(cval_t *v); +static void cast_to_ulong(cval_t *v); +static void cast_to_sll(cval_t *v); +static void cast_to_ull(cval_t *v); +static marg_t *new_marg(char *str, def_arg_t type); +static marg_t *add_new_marg(char *str, def_arg_t type); +static int marg_index(char *id); +static mtext_t *new_mtext(char *str, int idx, def_exp_t type); +static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp); +static char *merge_text(char *s1, char *s2); + +/* + * Local variables + */ +static marg_t **macro_args; /* Macro parameters array while parsing */ +static int nmacro_args; + +%} + +%union{ + int sint; + unsigned int uint; + long slong; + unsigned long ulong; + __int64 sll; + unsigned __int64 ull; + int *iptr; + char *cptr; + cval_t cval; + marg_t *marg; + mtext_t *mtext; +} + +%token tRCINCLUDE +%token tIF tIFDEF tIFNDEF tELSE tELIF tENDIF tDEFINED tNL +%token tINCLUDE tLINE tGCCLINE tERROR tWARNING tPRAGMA tPPIDENT +%token tUNDEF tMACROEND tCONCAT tELIPSIS tSTRINGIZE +%token tIDENT tLITERAL tMACRO tDEFINE +%token tDQSTRING tSQSTRING tIQSTRING +%token tUINT +%token tSINT +%token tULONG +%token tSLONG +%token tULONGLONG +%token tSLONGLONG +%token tRCINCLUDEPATH + +%right '?' ':' +%left tLOGOR +%left tLOGAND +%left '|' +%left '^' +%left '&' +%left tEQ tNE +%left '<' tLTE '>' tGTE +%left tLSHIFT tRSHIFT +%left '+' '-' +%left '*' '/' +%right '~' '!' + +%type pp_expr +%type emargs margs +%type opt_mtexts mtexts mtext +%type allmargs +%type opt_text text + +/* + ************************************************************************** + * The parser starts here + ************************************************************************** + */ + +%% + +pp_file : /* Empty */ + | pp_file preprocessor + ; + +preprocessor + : tINCLUDE tDQSTRING tNL { pp_do_include($2, 1); } + | tINCLUDE tIQSTRING tNL { pp_do_include($2, 0); } + | tIF pp_expr tNL { pp_next_if_state(boolean(&$2)); } + | tIFDEF tIDENT tNL { pp_next_if_state(pplookup($2) != NULL); free($2); } + | tIFNDEF tIDENT tNL { + int t = pplookup($2) == NULL; + if(pp_incl_state.state == 0 && t && !pp_incl_state.seen_junk) + { + pp_incl_state.state = 1; + pp_incl_state.ppp = $2; + pp_incl_state.ifdepth = pp_get_if_depth(); + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + free($2); + } + else + free($2); + pp_next_if_state(t); + } + | tELIF pp_expr tNL { + pp_if_state_t s = pp_pop_if(); + switch(s) + { + case if_true: + case if_elif: + pp_push_if(if_elif); + break; + case if_false: + pp_push_if(boolean(&$2) ? if_true : if_false); + break; + case if_ignore: + pp_push_if(if_ignore); + break; + case if_elsetrue: + case if_elsefalse: + ppy_error("#elif cannot follow #else"); + break; + case if_error: + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s); + } + } + | tELSE tNL { + pp_if_state_t s = pp_pop_if(); + switch(s) + { + case if_true: + pp_push_if(if_elsefalse); + break; + case if_elif: + pp_push_if(if_elif); + break; + case if_false: + pp_push_if(if_elsetrue); + break; + case if_ignore: + pp_push_if(if_ignore); + break; + case if_elsetrue: + case if_elsefalse: + ppy_error("#else clause already defined"); + break; + case if_error: + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s); + } + } + | tENDIF tNL { + if(pp_pop_if() != if_error) + { + if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + { + pp_incl_state.state = 2; + pp_incl_state.seen_junk = 0; + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + } + } + } + | tUNDEF tIDENT tNL { pp_del_define($2); free($2); } + | tDEFINE opt_text tNL { pp_add_define($1, $2); free($1); free($2); } + | tMACRO res_arg allmargs tMACROEND opt_mtexts tNL { + pp_add_macro($1, macro_args, nmacro_args, $5); + } + | tLINE tSINT tDQSTRING tNL { if($3) pp_writestring("# %d %s\n", $2 , $3); free($3); } + | tGCCLINE tSINT tDQSTRING tNL { if($3) pp_writestring("# %d %s\n", $2 , $3); free($3); } + | tGCCLINE tSINT tDQSTRING tSINT tNL + { if($3) pp_writestring("# %d %s %d\n", $2, $3, $4); free($3); } + | tGCCLINE tSINT tDQSTRING tSINT tSINT tNL + { if($3) pp_writestring("# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); } + | tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tNL + { if($3) pp_writestring("# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); } + | tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tSINT tNL + { if($3) pp_writestring("# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); } + | tGCCLINE tNL /* The null-token */ + | tERROR opt_text tNL { ppy_error("#error directive: '%s'", $2); free($2); } + | tWARNING opt_text tNL { ppy_warning("#warning directive: '%s'", $2); free($2); } + | tPRAGMA opt_text tNL { pp_writestring("#pragma %s\n", $2 ? $2 : ""); free($2); } + | tPPIDENT opt_text tNL { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); free($2); } + | tRCINCLUDE tRCINCLUDEPATH { + if($2) + { + int nl=strlen($2) +3; + char *fn=pp_xmalloc(nl); + if(fn) + { + sprintf(fn,"\"%s\"",$2); + pp_do_include(fn,1); + } + free($2); + } + } + | tRCINCLUDE tDQSTRING { + pp_do_include($2,1); + } + /*| tNL*/ + ; + +opt_text: /* Empty */ { $$ = NULL; } + | text { $$ = $1; } + ; + +text : tLITERAL { $$ = $1; } + | tDQSTRING { $$ = $1; } + | tSQSTRING { $$ = $1; } + | text tLITERAL { $$ = merge_text($1, $2); } + | text tDQSTRING { $$ = merge_text($1, $2); } + | text tSQSTRING { $$ = merge_text($1, $2); } + ; + +res_arg : /* Empty */ { macro_args = NULL; nmacro_args = 0; } + ; + +allmargs: /* Empty */ { $$ = 0; macro_args = NULL; nmacro_args = 0; } + | emargs { $$ = nmacro_args; } + ; + +emargs : margs { $$ = $1; } + | margs ',' tELIPSIS { $$ = add_new_marg(NULL, arg_list); nmacro_args *= -1; } + ; + +margs : margs ',' tIDENT { $$ = add_new_marg($3, arg_single); } + | tIDENT { $$ = add_new_marg($1, arg_single); } + ; + +opt_mtexts + : /* Empty */ { $$ = NULL; } + | mtexts { + for($$ = $1; $$ && $$->prev; $$ = $$->prev) + ; + } + ; + +mtexts : mtext { $$ = $1; } + | mtexts mtext { $$ = combine_mtext($1, $2); } + ; + +mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); } + | tDQSTRING { $$ = new_mtext($1, 0, exp_text); } + | tSQSTRING { $$ = new_mtext($1, 0, exp_text); } + | tCONCAT { $$ = new_mtext(NULL, 0, exp_concat); } + | tSTRINGIZE tIDENT { + int mat = marg_index($2); + if(mat < 0) + ppy_error("Stringification identifier must be an argument parameter"); + else + $$ = new_mtext(NULL, mat, exp_stringize); + } + | tIDENT { + int mat = marg_index($1); + if(mat >= 0) + $$ = new_mtext(NULL, mat, exp_subst); + else if($1) + $$ = new_mtext($1, 0, exp_text); + } + ; + +pp_expr : tSINT { $$.type = cv_sint; $$.val.si = $1; } + | tUINT { $$.type = cv_uint; $$.val.ui = $1; } + | tSLONG { $$.type = cv_slong; $$.val.sl = $1; } + | tULONG { $$.type = cv_ulong; $$.val.ul = $1; } + | tSLONGLONG { $$.type = cv_sll; $$.val.sll = $1; } + | tULONGLONG { $$.type = cv_ull; $$.val.ull = $1; } + | tDEFINED tIDENT { $$.type = cv_sint; $$.val.si = pplookup($2) != NULL; } + | tDEFINED '(' tIDENT ')' { $$.type = cv_sint; $$.val.si = pplookup($3) != NULL; } + | tIDENT { $$.type = cv_sint; $$.val.si = 0; } + | pp_expr tLOGOR pp_expr { $$.type = cv_sint; $$.val.si = boolean(&$1) || boolean(&$3); } + | pp_expr tLOGAND pp_expr { $$.type = cv_sint; $$.val.si = boolean(&$1) && boolean(&$3); } + | pp_expr tEQ pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ==); } + | pp_expr tNE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, !=); } + | pp_expr '<' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <); } + | pp_expr '>' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >); } + | pp_expr tLTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <=); } + | pp_expr tGTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >=); } + | pp_expr '+' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, +); } + | pp_expr '-' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, -); } + | pp_expr '^' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ^); } + | pp_expr '&' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, &); } + | pp_expr '|' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, |); } + | pp_expr '*' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, *); } + | pp_expr '/' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, /); } + | pp_expr tLSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <<); } + | pp_expr tRSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >>); } + | '+' pp_expr { $$ = $2; } + | '-' pp_expr { UNARY_OP($$, $2, -); } + | '~' pp_expr { UNARY_OP($$, $2, ~); } + | '!' pp_expr { $$.type = cv_sint; $$.val.si = !boolean(&$2); } + | '(' pp_expr ')' { $$ = $2; } + | pp_expr '?' pp_expr ':' pp_expr { $$ = boolean(&$1) ? $3 : $5; } + ; + +%% + +/* + ************************************************************************** + * Support functions + ************************************************************************** + */ + +static void cast_to_sint(cval_t *v) +{ + switch(v->type) + { + case cv_sint: break; + case cv_uint: break; + case cv_slong: v->val.si = v->val.sl; break; + case cv_ulong: v->val.si = v->val.ul; break; + case cv_sll: v->val.si = v->val.sll; break; + case cv_ull: v->val.si = v->val.ull; break; + } + v->type = cv_sint; +} + +static void cast_to_uint(cval_t *v) +{ + switch(v->type) + { + case cv_sint: break; + case cv_uint: break; + case cv_slong: v->val.ui = v->val.sl; break; + case cv_ulong: v->val.ui = v->val.ul; break; + case cv_sll: v->val.ui = v->val.sll; break; + case cv_ull: v->val.ui = v->val.ull; break; + } + v->type = cv_uint; +} + +static void cast_to_slong(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.sl = v->val.si; break; + case cv_uint: v->val.sl = v->val.ui; break; + case cv_slong: break; + case cv_ulong: break; + case cv_sll: v->val.sl = v->val.sll; break; + case cv_ull: v->val.sl = v->val.ull; break; + } + v->type = cv_slong; +} + +static void cast_to_ulong(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.ul = v->val.si; break; + case cv_uint: v->val.ul = v->val.ui; break; + case cv_slong: break; + case cv_ulong: break; + case cv_sll: v->val.ul = v->val.sll; break; + case cv_ull: v->val.ul = v->val.ull; break; + } + v->type = cv_ulong; +} + +static void cast_to_sll(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.sll = v->val.si; break; + case cv_uint: v->val.sll = v->val.ui; break; + case cv_slong: v->val.sll = v->val.sl; break; + case cv_ulong: v->val.sll = v->val.ul; break; + case cv_sll: break; + case cv_ull: break; + } + v->type = cv_sll; +} + +static void cast_to_ull(cval_t *v) +{ + switch(v->type) + { + case cv_sint: v->val.ull = v->val.si; break; + case cv_uint: v->val.ull = v->val.ui; break; + case cv_slong: v->val.ull = v->val.sl; break; + case cv_ulong: v->val.ull = v->val.ul; break; + case cv_sll: break; + case cv_ull: break; + } + v->type = cv_ull; +} + + +static void promote_equal_size(cval_t *v1, cval_t *v2) +{ +#define cv_sizeof(v) ((int)(v->type & SIZE_MASK)) + int s1 = cv_sizeof(v1); + int s2 = cv_sizeof(v2); +#undef cv_sizeof + + if(s1 == s2) + return; + else if(s1 > s2) + { + switch(v1->type) + { + case cv_sint: cast_to_sint(v2); break; + case cv_uint: cast_to_uint(v2); break; + case cv_slong: cast_to_slong(v2); break; + case cv_ulong: cast_to_ulong(v2); break; + case cv_sll: cast_to_sll(v2); break; + case cv_ull: cast_to_ull(v2); break; + } + } + else + { + switch(v2->type) + { + case cv_sint: cast_to_sint(v1); break; + case cv_uint: cast_to_uint(v1); break; + case cv_slong: cast_to_slong(v1); break; + case cv_ulong: cast_to_ulong(v1); break; + case cv_sll: cast_to_sll(v1); break; + case cv_ull: cast_to_ull(v1); break; + } + } +} + + +static int boolean(cval_t *v) +{ + switch(v->type) + { + case cv_sint: return v->val.si != 0; + case cv_uint: return v->val.ui != 0; + case cv_slong: return v->val.sl != 0; + case cv_ulong: return v->val.ul != 0; + case cv_sll: return v->val.sll != 0; + case cv_ull: return v->val.ull != 0; + } + return 0; +} + +static marg_t *new_marg(char *str, def_arg_t type) +{ + marg_t *ma = pp_xmalloc(sizeof(marg_t)); + if(!ma) + return NULL; + ma->arg = str; + ma->type = type; + ma->nnl = 0; + return ma; +} + +static marg_t *add_new_marg(char *str, def_arg_t type) +{ + marg_t **new_macro_args; + marg_t *ma; + if(!str) + return NULL; + new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0])); + if(!new_macro_args) + return NULL; + macro_args = new_macro_args; + ma = new_marg(str, type); + if(!ma) + return NULL; + macro_args[nmacro_args] = ma; + nmacro_args++; + return ma; +} + +static int marg_index(char *id) +{ + int t; + if(!id) + return -1; + for(t = 0; t < nmacro_args; t++) + { + if(!strcmp(id, macro_args[t]->arg)) + break; + } + return t < nmacro_args ? t : -1; +} + +static mtext_t *new_mtext(char *str, int idx, def_exp_t type) +{ + mtext_t *mt = pp_xmalloc(sizeof(mtext_t)); + if(!mt) + return NULL; + if(str == NULL) + mt->subst.argidx = idx; + else + mt->subst.text = str; + mt->type = type; + mt->next = mt->prev = NULL; + return mt; +} + +static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) +{ + if(!tail) + return mtp; + + if(!mtp) + return tail; + + if(tail->type == exp_text && mtp->type == exp_text) + { + char *new_text; + new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + if(!new_text) + return mtp; + tail->subst.text = new_text; + strcat(tail->subst.text, mtp->subst.text); + free(mtp->subst.text); + free(mtp); + return tail; + } + + if(tail->type == exp_concat && mtp->type == exp_concat) + { + free(mtp); + return tail; + } + + if(tail->type == exp_concat && mtp->type == exp_text) + { + int len = strlen(mtp->subst.text); + while(len) + { +/* FIXME: should delete space from head of string */ + if(isspace(mtp->subst.text[len-1] & 0xff)) + mtp->subst.text[--len] = '\0'; + else + break; + } + + if(!len) + { + free(mtp->subst.text); + free(mtp); + return tail; + } + } + + if(tail->type == exp_text && mtp->type == exp_concat) + { + int len = strlen(tail->subst.text); + while(len) + { + if(isspace(tail->subst.text[len-1] & 0xff)) + tail->subst.text[--len] = '\0'; + else + break; + } + + if(!len) + { + mtp->prev = tail->prev; + mtp->next = tail->next; + if(tail->prev) + tail->prev->next = mtp; + free(tail->subst.text); + free(tail); + return mtp; + } + } + + tail->next = mtp; + mtp->prev = tail; + + return mtp; +} + +static char *merge_text(char *s1, char *s2) +{ + int l1; + int l2; + char *snew; + if(!s1) + return s2; + if(!s2) + return s1; + l1 = strlen(s1); + l2 = strlen(s2); + snew = pp_xrealloc(s1, l1+l2+1); + if(!snew) + { + free(s2); + return s1; + } + s1 = snew; + memcpy(s1+l1, s2, l2+1); + free(s2); + return s1; +} diff --git a/dll/directx/wine/d3dcompiler_43/preproc.c b/dll/directx/wine/d3dcompiler_43/preproc.c new file mode 100644 index 00000000000..be98e6f4194 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/preproc.c @@ -0,0 +1,447 @@ +/* + * Copyright 1998 Bertho A. Stultiens (BS) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "wpp_private.h" + +struct pp_status pp_status; + +#define HASHKEY 2039 + +typedef struct pp_def_state +{ + struct pp_def_state *next; + pp_entry_t *defines[HASHKEY]; +} pp_def_state_t; + +static pp_def_state_t *pp_def_state; + +#define MAXIFSTACK 64 +static pp_if_state_t if_stack[MAXIFSTACK]; +static int if_stack_idx = 0; + +void *pp_xmalloc(size_t size) +{ + void *res; + + assert(size > 0); + res = malloc(size); + if(res == NULL) + { + /* Set the error flag */ + pp_status.state = 1; + } + return res; +} + +void *pp_xrealloc(void *p, size_t size) +{ + void *res; + + assert(size > 0); + res = realloc(p, size); + if(res == NULL) + { + /* Set the error flag */ + pp_status.state = 1; + } + return res; +} + +char *pp_xstrdup(const char *str) +{ + char *s; + int len; + + assert(str != NULL); + len = strlen(str)+1; + s = pp_xmalloc(len); + if(!s) + return NULL; + return memcpy(s, str, len); +} + +/* Don't comment on the hash, it's primitive but functional... */ +static int pphash(const char *str) +{ + int sum = 0; + while(*str) + sum += *str++; + return sum % HASHKEY; +} + +pp_entry_t *pplookup(const char *ident) +{ + int idx; + pp_entry_t *ppp; + + if(!ident) + return NULL; + idx = pphash(ident); + for(ppp = pp_def_state->defines[idx]; ppp; ppp = ppp->next) + { + if(!strcmp(ident, ppp->ident)) + return ppp; + } + return NULL; +} + +static void free_pp_entry( pp_entry_t *ppp, int idx ) +{ + if(ppp->iep) + { + if(ppp->iep == pp_includelogiclist) + { + pp_includelogiclist = ppp->iep->next; + if(pp_includelogiclist) + pp_includelogiclist->prev = NULL; + } + else + { + ppp->iep->prev->next = ppp->iep->next; + if(ppp->iep->next) + ppp->iep->next->prev = ppp->iep->prev; + } + free(ppp->iep->filename); + free(ppp->iep); + } + + if(pp_def_state->defines[idx] == ppp) + { + pp_def_state->defines[idx] = ppp->next; + if(pp_def_state->defines[idx]) + pp_def_state->defines[idx]->prev = NULL; + } + else + { + ppp->prev->next = ppp->next; + if(ppp->next) + ppp->next->prev = ppp->prev; + } + + free(ppp); +} + +/* push a new (empty) define state */ +int pp_push_define_state(void) +{ + pp_def_state_t *state = pp_xmalloc( sizeof(*state) ); + if(!state) + return 1; + + memset( state->defines, 0, sizeof(state->defines) ); + state->next = pp_def_state; + pp_def_state = state; + return 0; +} + +/* pop the current define state */ +void pp_pop_define_state(void) +{ + int i; + pp_entry_t *ppp; + pp_def_state_t *state; + + for (i = 0; i < HASHKEY; i++) + { + while ((ppp = pp_def_state->defines[i]) != NULL) pp_del_define( ppp->ident ); + } + state = pp_def_state; + pp_def_state = state->next; + free( state ); +} + +void pp_del_define(const char *name) +{ + pp_entry_t *ppp; + int idx = pphash(name); + + if((ppp = pplookup(name)) == NULL) + { + if(pp_status.pedantic) + ppy_warning("%s was not defined", name); + return; + } + + free( ppp->ident ); + free( ppp->subst.text ); + free( ppp->filename ); + free_pp_entry( ppp, idx ); +} + +pp_entry_t *pp_add_define(const char *def, const char *text) +{ + int len; + char *cptr; + int idx; + pp_entry_t *ppp; + + if(!def) + return NULL; + idx = pphash(def); + if((ppp = pplookup(def)) != NULL) + { + if(pp_status.pedantic) + ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", def, ppp->filename, ppp->linenumber); + pp_del_define(def); + } + ppp = pp_xmalloc(sizeof(pp_entry_t)); + if(!ppp) + return NULL; + memset( ppp, 0, sizeof(*ppp) ); + ppp->ident = pp_xstrdup(def); + if(!ppp->ident) + goto error; + ppp->type = def_define; + ppp->subst.text = text ? pp_xstrdup(text) : NULL; + if(text && !ppp->subst.text) + goto error; + ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : ""); + if(!ppp->filename) + goto error; + ppp->linenumber = pp_status.input ? pp_status.line_number : 0; + ppp->next = pp_def_state->defines[idx]; + pp_def_state->defines[idx] = ppp; + if(ppp->next) + ppp->next->prev = ppp; + if(ppp->subst.text) + { + /* Strip trailing white space from subst text */ + len = strlen(ppp->subst.text); + while(len && strchr(" \t\r\n", ppp->subst.text[len-1])) + { + ppp->subst.text[--len] = '\0'; + } + /* Strip leading white space from subst text */ + for(cptr = ppp->subst.text; *cptr && strchr(" \t\r", *cptr); cptr++) + ; + if(ppp->subst.text != cptr) + memmove(ppp->subst.text, cptr, strlen(cptr)+1); + } + return ppp; + +error: + free(ppp->ident); + free(ppp->subst.text); + free(ppp); + return NULL; +} + +pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) +{ + int idx; + pp_entry_t *ppp; + + if(!id) + return NULL; + idx = pphash(id); + if((ppp = pplookup(id)) != NULL) + { + if(pp_status.pedantic) + ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", id, ppp->filename, ppp->linenumber); + pp_del_define(id); + } + ppp = pp_xmalloc(sizeof(pp_entry_t)); + if(!ppp) + return NULL; + memset( ppp, 0, sizeof(*ppp) ); + ppp->ident = id; + ppp->type = def_macro; + ppp->margs = args; + ppp->nargs = nargs; + ppp->subst.mtext= exp; + ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : ""); + if(!ppp->filename) + { + free(ppp); + return NULL; + } + ppp->linenumber = pp_status.input ? pp_status.line_number : 0; + ppp->next = pp_def_state->defines[idx]; + pp_def_state->defines[idx] = ppp; + if(ppp->next) + ppp->next->prev = ppp; + return ppp; +} + + +void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath) +{ + char *path; + void *fp; + + if (!(path = wpp_lookup(name, type, parent_name))) return NULL; + fp = wpp_open(path, type); + + if (fp) + { + if (newpath) *newpath = path; + else free( path ); + return fp; + } + free( path ); + return NULL; +} + +/* + *------------------------------------------------------------------------- + * #if, #ifdef, #ifndef, #else, #elif and #endif state management + * + * #if state transitions are made on basis of the current TOS and the next + * required state. The state transitions are required to housekeep because + * #if:s can be nested. The ignore case is activated to prevent output from + * within a false clause. + * Some special cases come from the fact that the #elif cases are not + * binary, but three-state. The problem is that all other elif-cases must + * be false when one true one has been found. A second problem is that the + * #else clause is a final clause. No extra #else:s may follow. + * + * The states mean: + * if_true Process input to output + * if_false Process input but no output + * if_ignore Process input but no output + * if_elif Process input but no output + * if_elsefalse Process input but no output + * if_elsettrue Process input to output + * + * The possible state-sequences are [state(stack depth)] (rest can be deduced): + * TOS #if 1 #else #endif + * if_true(n) if_true(n+1) if_elsefalse(n+1) + * if_false(n) if_ignore(n+1) if_ignore(n+1) + * if_elsetrue(n) if_true(n+1) if_elsefalse(n+1) + * if_elsefalse(n) if_ignore(n+1) if_ignore(n+1) + * if_elif(n) if_ignore(n+1) if_ignore(n+1) + * if_ignore(n) if_ignore(n+1) if_ignore(n+1) + * + * TOS #if 1 #elif 0 #else #endif + * if_true(n) if_true(n+1) if_elif(n+1) if_elif(n+1) + * if_false(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * if_elsetrue(n) if_true(n+1) if_elif(n+1) if_elif(n+1) + * if_elsefalse(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * if_elif(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * if_ignore(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * + * TOS #if 0 #elif 1 #else #endif + * if_true(n) if_false(n+1) if_true(n+1) if_elsefalse(n+1) + * if_false(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * if_elsetrue(n) if_false(n+1) if_true(n+1) if_elsefalse(n+1) + * if_elsefalse(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * if_elif(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * if_ignore(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1) + * + *------------------------------------------------------------------------- + */ + +void pp_push_if(pp_if_state_t s) +{ + if(if_stack_idx >= MAXIFSTACK) + pp_internal_error(__FILE__, __LINE__, "#if-stack overflow; #{if,ifdef,ifndef} nested too deeply (> %d)", MAXIFSTACK); + + if_stack[if_stack_idx++] = s; + + switch(s) + { + case if_true: + case if_elsetrue: + break; + case if_false: + case if_elsefalse: + case if_elif: + case if_ignore: + pp_push_ignore_state(); + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state()); + } +} + +pp_if_state_t pp_pop_if(void) +{ + if(if_stack_idx <= 0) + { + ppy_error("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)"); + return if_error; + } + + switch(pp_if_state()) + { + case if_true: + case if_elsetrue: + break; + case if_false: + case if_elsefalse: + case if_elif: + case if_ignore: + pp_pop_ignore_state(); + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state()); + } + return if_stack[--if_stack_idx]; +} + +pp_if_state_t pp_if_state(void) +{ + if(!if_stack_idx) + return if_true; + else + return if_stack[if_stack_idx-1]; +} + + +void pp_next_if_state(int i) +{ + switch(pp_if_state()) + { + case if_true: + case if_elsetrue: + pp_push_if(i ? if_true : if_false); + break; + case if_false: + case if_elsefalse: + case if_elif: + case if_ignore: + pp_push_if(if_ignore); + break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #{if,ifdef,ifndef} directive", (int)pp_if_state()); + } +} + +int pp_get_if_depth(void) +{ + return if_stack_idx; +} + +void WINAPIV pp_internal_error(const char *file, int line, const char *s, ...) +{ + __ms_va_list ap; + __ms_va_start(ap, s); + fprintf(stderr, "Internal error (please report) %s %d: ", file, line); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + __ms_va_end(ap); + exit(3); +} diff --git a/dll/directx/wine/d3dcompiler_43/reflection.c b/dll/directx/wine/d3dcompiler_43/reflection.c index e04c5c2dfb8..6f7d0370ce5 100644 --- a/dll/directx/wine/d3dcompiler_43/reflection.c +++ b/dll/directx/wine/d3dcompiler_43/reflection.c @@ -18,10 +18,9 @@ * */ -#include "config.h" -#include "wine/port.h" - +#include "initguid.h" #include "d3dcompiler_private.h" +#include "wine/winternl.h" WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler); @@ -52,6 +51,7 @@ struct d3dcompiler_shader_reflection_type D3D11_SHADER_TYPE_DESC desc; struct d3dcompiler_shader_reflection_type_member *members; + char *name; }; struct d3dcompiler_shader_reflection_type_member @@ -223,6 +223,7 @@ static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *ent HeapFree(GetProcessHeap(), 0, t->members); } + heap_free(t->name); HeapFree(GetProcessHeap(), 0, t); } @@ -665,6 +666,14 @@ static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetThreadGroupSize( return 0; } +static UINT64 STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetRequiresFlags( + ID3D11ShaderReflection *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl = { /* IUnknown methods */ @@ -690,6 +699,7 @@ static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtb d3dcompiler_shader_reflection_GetNumInterfaceSlots, d3dcompiler_shader_reflection_GetMinFeatureLevel, d3dcompiler_shader_reflection_GetThreadGroupSize, + d3dcompiler_shader_reflection_GetRequiresFlags, }; /* ID3D11ShaderReflectionConstantBuffer methods */ @@ -1124,7 +1134,12 @@ static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, c read_dword(&ptr, &r->gs_max_output_vertex_count); TRACE("GSMaxOutputVertexCount: %u\n", r->gs_max_output_vertex_count); - skip_dword_unknown(&ptr, 3); + skip_dword_unknown(&ptr, 2); + + /* old dx10 stat size */ + if (size == 28) return S_OK; + + skip_dword_unknown(&ptr, 1); /* dx10 stat size */ if (size == 29) return S_OK; @@ -1251,6 +1266,19 @@ static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type } } + if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500) + { + read_dword(&ptr, &offset); + if (!copy_name(data + offset, &type->name)) + { + ERR("Failed to copy name.\n"); + heap_free(members); + return E_OUTOFMEMORY; + } + desc->Name = type->name; + TRACE("Type name: %s.\n", debugstr_a(type->name)); + } + type->members = members; return S_OK; @@ -1658,10 +1686,14 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature * if (d[i].Register == 0xffffffff) { - if (!strcasecmp(d[i].SemanticName, "sv_depth")) d[i].SystemValueType = D3D_NAME_DEPTH; - if (!strcasecmp(d[i].SemanticName, "sv_coverage")) d[i].SystemValueType = D3D_NAME_COVERAGE; - if (!strcasecmp(d[i].SemanticName, "sv_depthgreaterequal")) d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL; - if (!strcasecmp(d[i].SemanticName, "sv_depthlessequal")) d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL; + if (!_strnicmp(d[i].SemanticName, "sv_depth", -1)) + d[i].SystemValueType = D3D_NAME_DEPTH; + else if (!_strnicmp(d[i].SemanticName, "sv_coverage", -1)) + d[i].SystemValueType = D3D_NAME_COVERAGE; + else if (!_strnicmp(d[i].SemanticName, "sv_depthgreaterequal", -1)) + d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL; + else if (!_strnicmp(d[i].SemanticName, "sv_depthlessequal", -1)) + d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL; } else { diff --git a/dll/directx/wine/d3dcompiler_43/utils.c b/dll/directx/wine/d3dcompiler_43/utils.c index 95a1dbd3d51..079bd1c6bc2 100644 --- a/dll/directx/wine/d3dcompiler_43/utils.c +++ b/dll/directx/wine/d3dcompiler_43/utils.c @@ -21,9 +21,6 @@ * */ -#include "config.h" -#include "wine/port.h" - #include #include "d3dcompiler_private.h" @@ -719,7 +716,7 @@ HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob) return S_OK; } -void compilation_message(struct compilation_messages *msg, const char *fmt, va_list args) +void compilation_message(struct compilation_messages *msg, const char *fmt, __ms_va_list args) { char* buffer; int rc, size; @@ -1280,19 +1277,10 @@ static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct hlsl_type static struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_type *type, struct source_location *loc) { - struct hlsl_ir_expr *cast; - struct hlsl_ir_node *operands[3]; - if (compare_hlsl_types(node->data_type, type)) return node; TRACE("Implicit conversion of expression to %s\n", debug_hlsl_type(type)); - operands[0] = node; - operands[1] = operands[2] = NULL; - cast = new_expr(HLSL_IR_UNOP_CAST, operands, loc); - if (!cast) - return NULL; - cast->node.data_type = type; - return &cast->node; + return &new_cast(node, type, loc)->node; } struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **operands, @@ -1355,158 +1343,12 @@ struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **ope struct hlsl_ir_expr *new_cast(struct hlsl_ir_node *node, struct hlsl_type *type, struct source_location *loc) { - struct hlsl_ir_expr *cast; - struct hlsl_ir_node *operands[3]; + struct hlsl_ir_node *cast; - operands[0] = node; - operands[1] = operands[2] = NULL; - cast = new_expr(HLSL_IR_UNOP_CAST, operands, loc); + cast = new_unary_expr(HLSL_IR_UNOP_CAST, node, *loc); if (cast) - cast->node.data_type = type; - return cast; -} - -struct hlsl_ir_expr *hlsl_mul(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_MUL, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_div(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_DIV, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_mod(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_MOD, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_ADD, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_SUB, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_lt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_LESS, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_gt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_GREATER, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_le(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_LEQUAL, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_ge(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_GEQUAL, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_eq(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_EQUAL, ops, loc); - return expr; -} - -struct hlsl_ir_expr *hlsl_ne(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, - struct source_location *loc) -{ - struct hlsl_ir_expr *expr; - struct hlsl_ir_node *ops[3]; - - ops[0] = op1; - ops[1] = op2; - ops[2] = NULL; - expr = new_expr(HLSL_IR_BINOP_NEQUAL, ops, loc); - return expr; + cast->data_type = type; + return expr_from_node(cast); } struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var) @@ -1519,7 +1361,7 @@ struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var) return NULL; } deref->node.type = HLSL_IR_DEREF; - deref->node.data_type = var->node.data_type; + deref->node.data_type = var->data_type; deref->type = HLSL_IR_DEREF_VAR; deref->v.var = var; return deref; @@ -1537,10 +1379,7 @@ struct hlsl_ir_deref *new_record_deref(struct hlsl_ir_node *record, struct hlsl_ deref->node.type = HLSL_IR_DEREF; deref->node.data_type = field->type; deref->type = HLSL_IR_DEREF_RECORD; - if (record->type == HLSL_IR_VAR) - deref->v.record.record = &new_var_deref(var_from_node(record))->node; - else - deref->v.record.record = record; + deref->v.record.record = record; deref->v.record.field = field; return deref; } @@ -1568,7 +1407,6 @@ static enum hlsl_ir_expr_op op_from_assignment(enum parse_assign_op op) struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assign_op assign_op, DWORD writemask, struct hlsl_ir_node *right) { - struct hlsl_ir_expr *expr; struct hlsl_ir_assignment *assign = d3dcompiler_alloc(sizeof(*assign)); struct hlsl_type *type; struct hlsl_ir_node *lhs, *rhs; @@ -1618,11 +1456,6 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig FIXME("Check for casts in the lhs.\n"); lhs = left; - if (lhs->type == HLSL_IR_VAR) - { - struct hlsl_ir_deref *lhs_deref = new_var_deref(var_from_node(lhs)); - lhs = &lhs_deref->node; - } /* FIXME: check for invalid writemasks on the lhs. */ if (!compare_hlsl_types(type, rhs->data_type)) @@ -1658,8 +1491,8 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig assign->lhs = lhs; if (assign_op != ASSIGN_OP_ASSIGN) { - struct hlsl_ir_node *operands[3]; enum hlsl_ir_expr_op op = op_from_assignment(assign_op); + struct hlsl_ir_node *expr; if (lhs->type != HLSL_IR_DEREF || deref_from_node(lhs)->type != HLSL_IR_DEREF_VAR) { @@ -1672,11 +1505,8 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig TRACE("Adding an expression for the compound assignment.\n"); new_deref = new_var_deref(lhs_deref->v.var); - operands[0] = &new_deref->node; - operands[1] = rhs; - operands[2] = NULL; - expr = new_expr(op, operands, &left->loc); - assign->rhs = &expr->node; + expr = new_binary_expr(op, &new_deref->node, rhs, left->loc); + assign->rhs = expr; } } else @@ -1739,8 +1569,7 @@ struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type, struc ERR("Out of memory.\n"); return NULL; } - decl->node.type = HLSL_IR_FUNCTION_DECL; - decl->node.data_type = return_type; + decl->return_type = return_type; decl->parameters = parameters; return decl; @@ -1812,9 +1641,9 @@ static int compare_function_decl_rb(const void *key, const struct wine_rb_entry while (p1cur && p2cur) { struct hlsl_ir_var *p1, *p2; - p1 = LIST_ENTRY(p1cur, struct hlsl_ir_var, node.entry); - p2 = LIST_ENTRY(p2cur, struct hlsl_ir_var, node.entry); - if ((r = compare_param_hlsl_types(p1->node.data_type, p2->node.data_type))) + p1 = LIST_ENTRY(p1cur, struct hlsl_ir_var, param_entry); + p2 = LIST_ENTRY(p2cur, struct hlsl_ir_var, param_entry); + if ((r = compare_param_hlsl_types(p1->data_type, p2->data_type))) return r; p1cur = list_next(params, p1cur); p2cur = list_next(decl->parameters, p2cur); @@ -1931,13 +1760,11 @@ static const char *debug_node_type(enum hlsl_ir_node_type type) { static const char * const names[] = { - "HLSL_IR_VAR", "HLSL_IR_ASSIGNMENT", "HLSL_IR_CONSTANT", "HLSL_IR_CONSTRUCTOR", "HLSL_IR_DEREF", "HLSL_IR_EXPR", - "HLSL_IR_FUNCTION_DECL", "HLSL_IR_IF", "HLSL_IR_JUMP", "HLSL_IR_SWIZZLE", @@ -1965,7 +1792,7 @@ static void debug_dump_ir_var(const struct hlsl_ir_var *var) { if (var->modifiers) TRACE("%s ", debug_modifiers(var->modifiers)); - TRACE("%s %s", debug_hlsl_type(var->node.data_type), var->name); + TRACE("%s %s", debug_hlsl_type(var->data_type), var->name); if (var->semantic) TRACE(" : %s", debugstr_a(var->semantic)); } @@ -2125,12 +1952,12 @@ static void debug_dump_ir_expr(const struct hlsl_ir_expr *expr) static void debug_dump_ir_constructor(const struct hlsl_ir_constructor *constructor) { - struct hlsl_ir_node *arg; + unsigned int i; TRACE("%s (", debug_hlsl_type(constructor->node.data_type)); - LIST_FOR_EACH_ENTRY(arg, constructor->arguments, struct hlsl_ir_node, entry) + for (i = 0; i < constructor->args_count; ++i) { - debug_dump_instr(arg); + debug_dump_instr(constructor->args[i]); TRACE(" "); } TRACE(")"); @@ -2262,7 +2089,7 @@ void debug_dump_ir_function_decl(const struct hlsl_ir_function_decl *func) TRACE("Dumping function %s.\n", debugstr_a(func->func->name)); TRACE("Function parameters:\n"); - LIST_FOR_EACH_ENTRY(param, func->parameters, struct hlsl_ir_var, node.entry) + LIST_FOR_EACH_ENTRY(param, func->parameters, struct hlsl_ir_var, param_entry) { debug_dump_ir_var(param); TRACE("\n"); @@ -2352,7 +2179,9 @@ static void free_ir_swizzle(struct hlsl_ir_swizzle *swizzle) static void free_ir_constructor(struct hlsl_ir_constructor *constructor) { - free_instr_list(constructor->arguments); + unsigned int i; + for (i = 0; i < constructor->args_count; ++i) + free_instr(constructor->args[i]); d3dcompiler_free(constructor); } @@ -2396,9 +2225,6 @@ void free_instr(struct hlsl_ir_node *node) { switch (node->type) { - case HLSL_IR_VAR: - /* These are freed later on from the scopes. */ - break; case HLSL_IR_CONSTANT: free_ir_constant(constant_from_node(node)); break; diff --git a/dll/directx/wine/d3dcompiler_43/wpp_private.h b/dll/directx/wine/d3dcompiler_43/wpp_private.h new file mode 100644 index 00000000000..325c7f1e510 --- /dev/null +++ b/dll/directx/wine/d3dcompiler_43/wpp_private.h @@ -0,0 +1,250 @@ +/* + * Copyright 1998 Bertho A. Stultiens (BS) + * Copyright 2002 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WPP_PRIVATE_H +#define __WPP_PRIVATE_H + +#include +#include +#include +#include "windef.h" + +/* Return value == 0 means successful execution */ +extern int wpp_add_define( const char *name, const char *value ); +extern void wpp_del_define( const char *name ); +extern char *wpp_lookup(const char *filename, int type, const char *parent_name); +extern void *wpp_open(const char *filename, int type); +extern void wpp_close(void *file); +extern int wpp_read(void *file, char *buffer, unsigned int len); +extern void wpp_write(const char *buffer, unsigned int len); +extern int wpp_parse( const char *input, FILE *output ); + +struct pp_entry; /* forward */ +/* + * Include logic + * A stack of files which are already included and + * are protected in the #ifndef/#endif way. + */ +typedef struct includelogicentry { + struct includelogicentry *next; + struct includelogicentry *prev; + struct pp_entry *ppp; /* The define which protects the file */ + char *filename; /* The filename of the include */ +} includelogicentry_t; + +/* + * The arguments of a macrodefinition + */ +typedef enum { + arg_single, + arg_list +} def_arg_t; + +typedef struct marg { + def_arg_t type; /* Normal or ... argument */ + char *arg; /* The textual argument */ + int nnl; /* Number of newlines in the text to subst */ +} marg_t; + +/* + * The expansiontext of a macro + */ +typedef enum { + exp_text, /* Simple text substitution */ + exp_concat, /* Concat (##) operator requested */ + exp_stringize, /* Stringize (#) operator requested */ + exp_subst /* Substitute argument */ +} def_exp_t; + +typedef struct mtext { + struct mtext *next; + struct mtext *prev; + def_exp_t type; + union { + char *text; + int argidx; /* For exp_subst and exp_stringize reference */ + } subst; +} mtext_t; + +/* + * The define descriptor + */ +typedef enum { + def_none, /* Not-a-define; used as return value */ + def_define, /* Simple defines */ + def_macro, /* Macro defines */ + def_special /* Special expansions like __LINE__ and __FILE__ */ +} def_type_t; + +typedef struct pp_entry { + struct pp_entry *next; + struct pp_entry *prev; + def_type_t type; /* Define or macro */ + char *ident; /* The key */ + marg_t **margs; /* Macro arguments array or NULL if none */ + int nargs; + union { + mtext_t *mtext; /* The substitution sequence or NULL if none */ + char *text; + } subst; + int expanding; /* Set when feeding substitution into the input */ + char *filename; /* Filename where it was defined */ + int linenumber; /* Linenumber where it was defined */ + includelogicentry_t *iep; /* Points to the include it protects */ +} pp_entry_t; + + +/* + * If logic + */ +#define MAXIFSTACK 64 /* If this isn't enough you should alter the source... */ + +typedef enum { + if_false, + if_true, + if_elif, + if_elsefalse, + if_elsetrue, + if_ignore, + if_error +} pp_if_state_t; + + +/* + * Trace the include files to prevent double reading. + * This save 20..30% of processing time for most stuff + * that uses complex includes. + * States: + * -1 Don't track or seen junk + * 0 New include, waiting for "#ifndef __xxx_h" + * 1 Seen #ifndef, waiting for "#define __xxx_h ..." + * 2 Seen #endif, waiting for EOF + */ +typedef struct +{ + int state; + char *ppp; /* The define to be set from the #ifndef */ + int ifdepth; /* The level of ifs at the #ifdef */ + int seen_junk; /* Set when junk is seen */ +} include_state_t; + +#define SIZE_CHAR 1 +#define SIZE_SHORT 2 +#define SIZE_INT 3 +#define SIZE_LONG 4 +#define SIZE_LONGLONG 5 +#define SIZE_MASK 0x00ff +#define FLAG_SIGNED 0x0100 + +typedef enum { +#if 0 + cv_schar = SIZE_CHAR + FLAG_SIGNED, + cv_uchar = SIZE_CHAR, + cv_sshort = SIZE_SHORT + FLAG_SIGNED, + cv_ushort = SIZE_SHORT, +#endif + cv_sint = SIZE_INT + FLAG_SIGNED, + cv_uint = SIZE_INT, + cv_slong = SIZE_LONG + FLAG_SIGNED, + cv_ulong = SIZE_LONG, + cv_sll = SIZE_LONGLONG + FLAG_SIGNED, + cv_ull = SIZE_LONGLONG +} ctype_t; + +typedef struct cval { + ctype_t type; + union { +#if 0 + signed char sc; /* Explicitly signed because compilers are stupid */ + unsigned char uc; + short ss; + unsigned short us; +#endif + int si; + unsigned int ui; + long sl; + unsigned long ul; + __int64 sll; + unsigned __int64 ull; + } val; +} cval_t; + + + +void *pp_xmalloc(size_t); +void *pp_xrealloc(void *, size_t); +char *pp_xstrdup(const char *str); +pp_entry_t *pplookup(const char *ident); +int pp_push_define_state(void); +void pp_pop_define_state(void); +pp_entry_t *pp_add_define(const char *def, const char *text); +pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp); +void pp_del_define(const char *name); +void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath); +void pp_push_if(pp_if_state_t s); +void pp_next_if_state(int); +pp_if_state_t pp_pop_if(void); +pp_if_state_t pp_if_state(void); +int pp_get_if_depth(void); + +#ifndef __GNUC__ +#define __attribute__(x) /*nothing*/ +#endif + +extern const struct wpp_callbacks *wpp_callbacks; + +int WINAPIV ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2))); +int WINAPIV ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2))); +void WINAPIV pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4))); + +/* current preprocessor state */ +/* everything is in this structure to avoid polluting the global symbol space */ +struct pp_status +{ + char *input; /* current input file name */ + void *file; /* current input file descriptor */ + int line_number; /* current line number */ + int char_number; /* current char number in line */ + int state; /* current error state */ + int pedantic; /* pedantic option */ +}; + +extern struct pp_status pp_status; +extern include_state_t pp_incl_state; +extern includelogicentry_t *pp_includelogiclist; + +/* + * From ppl.l + */ +extern FILE *ppy_out; +extern char *ppy_text; +int ppy_lex(void); + +void pp_do_include(char *fname, int type); +void pp_push_ignore_state(void); +void pp_pop_ignore_state(void); + +void WINAPIV pp_writestring(const char *format, ...) __attribute__((format (printf, 1, 2))); + +/* + * From ppy.y + */ +int ppy_parse(void); + +#endif /* __WPP_PRIVATE_H */ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 3d051727089..128045db4f3 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -24,7 +24,7 @@ The following libraries are shared with Wine. dll/directx/wine/amstream # Synced to WineStaging-3.9 dll/directx/wine/d3d8 # Synced to WineStaging-3.3 dll/directx/wine/d3d9 # Synced to WineStaging-3.3 -dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-3.3 +dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-4.18 dll/directx/wine/d3drm # Synced to WineStaging-4.0 dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-4.0 dll/directx/wine/d3dxof # Synced to WineStaging-3.17