Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* A Bison parser, made by GNU Bison 3.0.4.  */
  2.  
  3. /* Bison implementation for Yacc-like parsers in C
  4.  
  5.    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
  6.  
  7.    This program is free software: you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation, either version 3 of the License, or
  10.    (at your option) any later version.
  11.  
  12.    This program is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
  19.  
  20. /* As a special exception, you may create a larger work that contains
  21.    part or all of the Bison parser skeleton and distribute that work
  22.    under terms of your choice, so long as that work isn't itself a
  23.    parser generator using the skeleton or a modified version thereof
  24.    as a parser skeleton.  Alternatively, if you modify or redistribute
  25.    the parser skeleton itself, you may (at your option) remove this
  26.    special exception, which will cause the skeleton and the resulting
  27.    Bison output files to be licensed under the GNU General Public
  28.    License without this special exception.
  29.  
  30.    This special exception was added by the Free Software Foundation in
  31.    version 2.2 of Bison.  */
  32.  
  33. /* C LALR(1) parser skeleton written by Richard Stallman, by
  34.    simplifying the original so-called "semantic" parser.  */
  35.  
  36. /* All symbols defined below should begin with yy or YY, to avoid
  37.    infringing on user name space.  This should be done even for local
  38.    variables, as they might otherwise be expanded by user macros.
  39.    There are some unavoidable exceptions within include files to
  40.    define necessary library symbols; they are noted "INFRINGES ON
  41.    USER NAME SPACE" below.  */
  42.  
  43. /* Identify Bison output.  */
  44. #define YYBISON 1
  45.  
  46. /* Bison version.  */
  47. #define YYBISON_VERSION "3.0.4"
  48.  
  49. /* Skeleton name.  */
  50. #define YYSKELETON_NAME "yacc.c"
  51.  
  52. /* Pure parsers.  */
  53. #define YYPURE 1
  54.  
  55. /* Push parsers.  */
  56. #define YYPUSH 0
  57.  
  58. /* Pull parsers.  */
  59. #define YYPULL 1
  60.  
  61.  
  62. /* Substitute the variable and function names.  */
  63. #define yyparse         _mesa_program_parse
  64. #define yylex           _mesa_program_lex
  65. #define yyerror         _mesa_program_error
  66. #define yydebug         _mesa_program_debug
  67. #define yynerrs         _mesa_program_nerrs
  68.  
  69.  
  70. /* Copy the first part of user declarations.  */
  71. #line 1 "../../../src/mesa/program/program_parse.y" /* yacc.c:339  */
  72.  
  73. /*
  74.  * Copyright © 2009 Intel Corporation
  75.  *
  76.  * Permission is hereby granted, free of charge, to any person obtaining a
  77.  * copy of this software and associated documentation files (the "Software"),
  78.  * to deal in the Software without restriction, including without limitation
  79.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  80.  * and/or sell copies of the Software, and to permit persons to whom the
  81.  * Software is furnished to do so, subject to the following conditions:
  82.  *
  83.  * The above copyright notice and this permission notice (including the next
  84.  * paragraph) shall be included in all copies or substantial portions of the
  85.  * Software.
  86.  *
  87.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  88.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  89.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  90.  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  91.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  92.  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  93.  * DEALINGS IN THE SOFTWARE.
  94.  */
  95.  
  96. #include <stdarg.h>
  97. #include <stdio.h>
  98. #include <stdlib.h>
  99. #include <string.h>
  100.  
  101. #include "main/mtypes.h"
  102. #include "main/imports.h"
  103. #include "program/program.h"
  104. #include "program/prog_parameter.h"
  105. #include "program/prog_parameter_layout.h"
  106. #include "program/prog_statevars.h"
  107. #include "program/prog_instruction.h"
  108.  
  109. #include "program/symbol_table.h"
  110. #include "program/program_parser.h"
  111.  
  112. extern void *yy_scan_string(char *);
  113. extern void yy_delete_buffer(void *);
  114.  
  115. static struct asm_symbol *declare_variable(struct asm_parser_state *state,
  116.     char *name, enum asm_type t, struct YYLTYPE *locp);
  117.  
  118. static int add_state_reference(struct gl_program_parameter_list *param_list,
  119.     const gl_state_index tokens[STATE_LENGTH]);
  120.  
  121. static int initialize_symbol_from_state(struct gl_program *prog,
  122.     struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
  123.  
  124. static int initialize_symbol_from_param(struct gl_program *prog,
  125.     struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
  126.  
  127. static int initialize_symbol_from_const(struct gl_program *prog,
  128.     struct asm_symbol *param_var, const struct asm_vector *vec,
  129.     GLboolean allowSwizzle);
  130.  
  131. static int yyparse(struct asm_parser_state *state);
  132.  
  133. static char *make_error_string(const char *fmt, ...);
  134.  
  135. static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
  136.     const char *s);
  137.  
  138. static int validate_inputs(struct YYLTYPE *locp,
  139.     struct asm_parser_state *state);
  140.  
  141. static void init_dst_reg(struct prog_dst_register *r);
  142.  
  143. static void set_dst_reg(struct prog_dst_register *r,
  144.                         gl_register_file file, GLint index);
  145.  
  146. static void init_src_reg(struct asm_src_register *r);
  147.  
  148. static void set_src_reg(struct asm_src_register *r,
  149.                         gl_register_file file, GLint index);
  150.  
  151. static void set_src_reg_swz(struct asm_src_register *r,
  152.                             gl_register_file file, GLint index, GLuint swizzle);
  153.  
  154. static void asm_instruction_set_operands(struct asm_instruction *inst,
  155.     const struct prog_dst_register *dst, const struct asm_src_register *src0,
  156.     const struct asm_src_register *src1, const struct asm_src_register *src2);
  157.  
  158. static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
  159.     const struct prog_dst_register *dst, const struct asm_src_register *src0,
  160.     const struct asm_src_register *src1, const struct asm_src_register *src2);
  161.  
  162. static struct asm_instruction *asm_instruction_copy_ctor(
  163.     const struct prog_instruction *base, const struct prog_dst_register *dst,
  164.     const struct asm_src_register *src0, const struct asm_src_register *src1,
  165.     const struct asm_src_register *src2);
  166.  
  167. #ifndef FALSE
  168. #define FALSE 0
  169. #define TRUE (!FALSE)
  170. #endif
  171.  
  172. #define YYLLOC_DEFAULT(Current, Rhs, N)                                 \
  173.    do {                                                                 \
  174.       if (N) {                                                  \
  175.          (Current).first_line = YYRHSLOC(Rhs, 1).first_line;            \
  176.          (Current).first_column = YYRHSLOC(Rhs, 1).first_column;        \
  177.          (Current).position = YYRHSLOC(Rhs, 1).position;                \
  178.          (Current).last_line = YYRHSLOC(Rhs, N).last_line;              \
  179.          (Current).last_column = YYRHSLOC(Rhs, N).last_column;          \
  180.       } else {                                                          \
  181.          (Current).first_line = YYRHSLOC(Rhs, 0).last_line;             \
  182.          (Current).last_line = (Current).first_line;                    \
  183.          (Current).first_column = YYRHSLOC(Rhs, 0).last_column;         \
  184.          (Current).last_column = (Current).first_column;                \
  185.          (Current).position = YYRHSLOC(Rhs, 0).position                 \
  186.             + (Current).first_column;                                   \
  187.       }                                                                 \
  188.    } while(0)
  189.  
  190. #line 191 "program/program_parse.tab.c" /* yacc.c:339  */
  191.  
  192. # ifndef YY_NULLPTR
  193. #  if defined __cplusplus && 201103L <= __cplusplus
  194. #   define YY_NULLPTR nullptr
  195. #  else
  196. #   define YY_NULLPTR 0
  197. #  endif
  198. # endif
  199.  
  200. /* Enabling verbose error messages.  */
  201. #ifdef YYERROR_VERBOSE
  202. # undef YYERROR_VERBOSE
  203. # define YYERROR_VERBOSE 1
  204. #else
  205. # define YYERROR_VERBOSE 1
  206. #endif
  207.  
  208. /* In a future release of Bison, this section will be replaced
  209.    by #include "program_parse.tab.h".  */
  210. #ifndef YY__MESA_PROGRAM_PROGRAM_PROGRAM_PARSE_TAB_H_INCLUDED
  211. # define YY__MESA_PROGRAM_PROGRAM_PROGRAM_PARSE_TAB_H_INCLUDED
  212. /* Debug traces.  */
  213. #ifndef YYDEBUG
  214. # define YYDEBUG 0
  215. #endif
  216. #if YYDEBUG
  217. extern int _mesa_program_debug;
  218. #endif
  219.  
  220. /* Token type.  */
  221. #ifndef YYTOKENTYPE
  222. # define YYTOKENTYPE
  223.   enum yytokentype
  224.   {
  225.     ARBvp_10 = 258,
  226.     ARBfp_10 = 259,
  227.     ADDRESS = 260,
  228.     ALIAS = 261,
  229.     ATTRIB = 262,
  230.     OPTION = 263,
  231.     OUTPUT = 264,
  232.     PARAM = 265,
  233.     TEMP = 266,
  234.     END = 267,
  235.     BIN_OP = 268,
  236.     BINSC_OP = 269,
  237.     SAMPLE_OP = 270,
  238.     SCALAR_OP = 271,
  239.     TRI_OP = 272,
  240.     VECTOR_OP = 273,
  241.     ARL = 274,
  242.     KIL = 275,
  243.     SWZ = 276,
  244.     TXD_OP = 277,
  245.     INTEGER = 278,
  246.     REAL = 279,
  247.     AMBIENT = 280,
  248.     ATTENUATION = 281,
  249.     BACK = 282,
  250.     CLIP = 283,
  251.     COLOR = 284,
  252.     DEPTH = 285,
  253.     DIFFUSE = 286,
  254.     DIRECTION = 287,
  255.     EMISSION = 288,
  256.     ENV = 289,
  257.     EYE = 290,
  258.     FOG = 291,
  259.     FOGCOORD = 292,
  260.     FRAGMENT = 293,
  261.     FRONT = 294,
  262.     HALF = 295,
  263.     INVERSE = 296,
  264.     INVTRANS = 297,
  265.     LIGHT = 298,
  266.     LIGHTMODEL = 299,
  267.     LIGHTPROD = 300,
  268.     LOCAL = 301,
  269.     MATERIAL = 302,
  270.     MAT_PROGRAM = 303,
  271.     MATRIX = 304,
  272.     MATRIXINDEX = 305,
  273.     MODELVIEW = 306,
  274.     MVP = 307,
  275.     NORMAL = 308,
  276.     OBJECT = 309,
  277.     PALETTE = 310,
  278.     PARAMS = 311,
  279.     PLANE = 312,
  280.     POINT_TOK = 313,
  281.     POINTSIZE = 314,
  282.     POSITION = 315,
  283.     PRIMARY = 316,
  284.     PROGRAM = 317,
  285.     PROJECTION = 318,
  286.     RANGE = 319,
  287.     RESULT = 320,
  288.     ROW = 321,
  289.     SCENECOLOR = 322,
  290.     SECONDARY = 323,
  291.     SHININESS = 324,
  292.     SIZE_TOK = 325,
  293.     SPECULAR = 326,
  294.     SPOT = 327,
  295.     STATE = 328,
  296.     TEXCOORD = 329,
  297.     TEXENV = 330,
  298.     TEXGEN = 331,
  299.     TEXGEN_Q = 332,
  300.     TEXGEN_R = 333,
  301.     TEXGEN_S = 334,
  302.     TEXGEN_T = 335,
  303.     TEXTURE = 336,
  304.     TRANSPOSE = 337,
  305.     TEXTURE_UNIT = 338,
  306.     TEX_1D = 339,
  307.     TEX_2D = 340,
  308.     TEX_3D = 341,
  309.     TEX_CUBE = 342,
  310.     TEX_RECT = 343,
  311.     TEX_SHADOW1D = 344,
  312.     TEX_SHADOW2D = 345,
  313.     TEX_SHADOWRECT = 346,
  314.     TEX_ARRAY1D = 347,
  315.     TEX_ARRAY2D = 348,
  316.     TEX_ARRAYSHADOW1D = 349,
  317.     TEX_ARRAYSHADOW2D = 350,
  318.     VERTEX = 351,
  319.     VTXATTRIB = 352,
  320.     WEIGHT = 353,
  321.     IDENTIFIER = 354,
  322.     USED_IDENTIFIER = 355,
  323.     MASK4 = 356,
  324.     MASK3 = 357,
  325.     MASK2 = 358,
  326.     MASK1 = 359,
  327.     SWIZZLE = 360,
  328.     DOT_DOT = 361,
  329.     DOT = 362
  330.   };
  331. #endif
  332.  
  333. /* Value type.  */
  334. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  335.  
  336. union YYSTYPE
  337. {
  338. #line 126 "../../../src/mesa/program/program_parse.y" /* yacc.c:355  */
  339.  
  340.    struct asm_instruction *inst;
  341.    struct asm_symbol *sym;
  342.    struct asm_symbol temp_sym;
  343.    struct asm_swizzle_mask swiz_mask;
  344.    struct asm_src_register src_reg;
  345.    struct prog_dst_register dst_reg;
  346.    struct prog_instruction temp_inst;
  347.    char *string;
  348.    unsigned result;
  349.    unsigned attrib;
  350.    int integer;
  351.    float real;
  352.    gl_state_index state[STATE_LENGTH];
  353.    int negate;
  354.    struct asm_vector vector;
  355.    gl_inst_opcode opcode;
  356.  
  357.    struct {
  358.       unsigned swz;
  359.       unsigned rgba_valid:1;
  360.       unsigned xyzw_valid:1;
  361.       unsigned negate:1;
  362.    } ext_swizzle;
  363.  
  364. #line 365 "program/program_parse.tab.c" /* yacc.c:355  */
  365. };
  366.  
  367. typedef union YYSTYPE YYSTYPE;
  368. # define YYSTYPE_IS_TRIVIAL 1
  369. # define YYSTYPE_IS_DECLARED 1
  370. #endif
  371.  
  372. /* Location type.  */
  373. #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  374. typedef struct YYLTYPE YYLTYPE;
  375. struct YYLTYPE
  376. {
  377.   int first_line;
  378.   int first_column;
  379.   int last_line;
  380.   int last_column;
  381. };
  382. # define YYLTYPE_IS_DECLARED 1
  383. # define YYLTYPE_IS_TRIVIAL 1
  384. #endif
  385.  
  386.  
  387.  
  388. int _mesa_program_parse (struct asm_parser_state *state);
  389.  
  390. #endif /* !YY__MESA_PROGRAM_PROGRAM_PROGRAM_PARSE_TAB_H_INCLUDED  */
  391.  
  392. /* Copy the second part of user declarations.  */
  393. #line 271 "../../../src/mesa/program/program_parse.y" /* yacc.c:358  */
  394.  
  395. extern int
  396. _mesa_program_lexer_lex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
  397.                         void *yyscanner);
  398.  
  399. static int
  400. yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
  401.       struct asm_parser_state *state)
  402. {
  403.    return _mesa_program_lexer_lex(yylval_param, yylloc_param, state->scanner);
  404. }
  405.  
  406. #line 407 "program/program_parse.tab.c" /* yacc.c:358  */
  407.  
  408. #ifdef short
  409. # undef short
  410. #endif
  411.  
  412. #ifdef YYTYPE_UINT8
  413. typedef YYTYPE_UINT8 yytype_uint8;
  414. #else
  415. typedef unsigned char yytype_uint8;
  416. #endif
  417.  
  418. #ifdef YYTYPE_INT8
  419. typedef YYTYPE_INT8 yytype_int8;
  420. #else
  421. typedef signed char yytype_int8;
  422. #endif
  423.  
  424. #ifdef YYTYPE_UINT16
  425. typedef YYTYPE_UINT16 yytype_uint16;
  426. #else
  427. typedef unsigned short int yytype_uint16;
  428. #endif
  429.  
  430. #ifdef YYTYPE_INT16
  431. typedef YYTYPE_INT16 yytype_int16;
  432. #else
  433. typedef short int yytype_int16;
  434. #endif
  435.  
  436. #ifndef YYSIZE_T
  437. # ifdef __SIZE_TYPE__
  438. #  define YYSIZE_T __SIZE_TYPE__
  439. # elif defined size_t
  440. #  define YYSIZE_T size_t
  441. # elif ! defined YYSIZE_T
  442. #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  443. #  define YYSIZE_T size_t
  444. # else
  445. #  define YYSIZE_T unsigned int
  446. # endif
  447. #endif
  448.  
  449. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  450.  
  451. #ifndef YY_
  452. # if defined YYENABLE_NLS && YYENABLE_NLS
  453. #  if ENABLE_NLS
  454. #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  455. #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  456. #  endif
  457. # endif
  458. # ifndef YY_
  459. #  define YY_(Msgid) Msgid
  460. # endif
  461. #endif
  462.  
  463. #ifndef YY_ATTRIBUTE
  464. # if (defined __GNUC__                                               \
  465.       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
  466.      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  467. #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  468. # else
  469. #  define YY_ATTRIBUTE(Spec) /* empty */
  470. # endif
  471. #endif
  472.  
  473. #ifndef YY_ATTRIBUTE_PURE
  474. # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
  475. #endif
  476.  
  477. #ifndef YY_ATTRIBUTE_UNUSED
  478. # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  479. #endif
  480.  
  481. #if !defined _Noreturn \
  482.      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  483. # if defined _MSC_VER && 1200 <= _MSC_VER
  484. #  define _Noreturn __declspec (noreturn)
  485. # else
  486. #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  487. # endif
  488. #endif
  489.  
  490. /* Suppress unused-variable warnings by "using" E.  */
  491. #if ! defined lint || defined __GNUC__
  492. # define YYUSE(E) ((void) (E))
  493. #else
  494. # define YYUSE(E) /* empty */
  495. #endif
  496.  
  497. #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  498. /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
  499. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  500.     _Pragma ("GCC diagnostic push") \
  501.     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  502.     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  503. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  504.     _Pragma ("GCC diagnostic pop")
  505. #else
  506. # define YY_INITIAL_VALUE(Value) Value
  507. #endif
  508. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  509. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  510. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  511. #endif
  512. #ifndef YY_INITIAL_VALUE
  513. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  514. #endif
  515.  
  516.  
  517. #if ! defined yyoverflow || YYERROR_VERBOSE
  518.  
  519. /* The parser invokes alloca or malloc; define the necessary symbols.  */
  520.  
  521. # ifdef YYSTACK_USE_ALLOCA
  522. #  if YYSTACK_USE_ALLOCA
  523. #   ifdef __GNUC__
  524. #    define YYSTACK_ALLOC __builtin_alloca
  525. #   elif defined __BUILTIN_VA_ARG_INCR
  526. #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  527. #   elif defined _AIX
  528. #    define YYSTACK_ALLOC __alloca
  529. #   elif defined _MSC_VER
  530. #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  531. #    define alloca _alloca
  532. #   else
  533. #    define YYSTACK_ALLOC alloca
  534. #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  535. #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  536.       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
  537. #     ifndef EXIT_SUCCESS
  538. #      define EXIT_SUCCESS 0
  539. #     endif
  540. #    endif
  541. #   endif
  542. #  endif
  543. # endif
  544.  
  545. # ifdef YYSTACK_ALLOC
  546.    /* Pacify GCC's 'empty if-body' warning.  */
  547. #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  548. #  ifndef YYSTACK_ALLOC_MAXIMUM
  549.     /* The OS might guarantee only one guard page at the bottom of the stack,
  550.        and a page size can be as small as 4096 bytes.  So we cannot safely
  551.        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
  552.        to allow for a few compiler-allocated temporary stack slots.  */
  553. #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  554. #  endif
  555. # else
  556. #  define YYSTACK_ALLOC YYMALLOC
  557. #  define YYSTACK_FREE YYFREE
  558. #  ifndef YYSTACK_ALLOC_MAXIMUM
  559. #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  560. #  endif
  561. #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
  562.        && ! ((defined YYMALLOC || defined malloc) \
  563.              && (defined YYFREE || defined free)))
  564. #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  565. #   ifndef EXIT_SUCCESS
  566. #    define EXIT_SUCCESS 0
  567. #   endif
  568. #  endif
  569. #  ifndef YYMALLOC
  570. #   define YYMALLOC malloc
  571. #   if ! defined malloc && ! defined EXIT_SUCCESS
  572. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  573. #   endif
  574. #  endif
  575. #  ifndef YYFREE
  576. #   define YYFREE free
  577. #   if ! defined free && ! defined EXIT_SUCCESS
  578. void free (void *); /* INFRINGES ON USER NAME SPACE */
  579. #   endif
  580. #  endif
  581. # endif
  582. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  583.  
  584.  
  585. #if (! defined yyoverflow \
  586.      && (! defined __cplusplus \
  587.          || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
  588.              && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  589.  
  590. /* A type that is properly aligned for any stack member.  */
  591. union yyalloc
  592. {
  593.   yytype_int16 yyss_alloc;
  594.   YYSTYPE yyvs_alloc;
  595.   YYLTYPE yyls_alloc;
  596. };
  597.  
  598. /* The size of the maximum gap between one aligned stack and the next.  */
  599. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  600.  
  601. /* The size of an array large to enough to hold all stacks, each with
  602.    N elements.  */
  603. # define YYSTACK_BYTES(N) \
  604.      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  605.       + 2 * YYSTACK_GAP_MAXIMUM)
  606.  
  607. # define YYCOPY_NEEDED 1
  608.  
  609. /* Relocate STACK from its old location to the new one.  The
  610.    local variables YYSIZE and YYSTACKSIZE give the old and new number of
  611.    elements in the stack, and YYPTR gives the new location of the
  612.    stack.  Advance YYPTR to a properly aligned location for the next
  613.    stack.  */
  614. # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
  615.     do                                                                  \
  616.       {                                                                 \
  617.         YYSIZE_T yynewbytes;                                            \
  618.         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
  619.         Stack = &yyptr->Stack_alloc;                                    \
  620.         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  621.         yyptr += yynewbytes / sizeof (*yyptr);                          \
  622.       }                                                                 \
  623.     while (0)
  624.  
  625. #endif
  626.  
  627. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  628. /* Copy COUNT objects from SRC to DST.  The source and destination do
  629.    not overlap.  */
  630. # ifndef YYCOPY
  631. #  if defined __GNUC__ && 1 < __GNUC__
  632. #   define YYCOPY(Dst, Src, Count) \
  633.       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  634. #  else
  635. #   define YYCOPY(Dst, Src, Count)              \
  636.       do                                        \
  637.         {                                       \
  638.           YYSIZE_T yyi;                         \
  639.           for (yyi = 0; yyi < (Count); yyi++)   \
  640.             (Dst)[yyi] = (Src)[yyi];            \
  641.         }                                       \
  642.       while (0)
  643. #  endif
  644. # endif
  645. #endif /* !YYCOPY_NEEDED */
  646.  
  647. /* YYFINAL -- State number of the termination state.  */
  648. #define YYFINAL  5
  649. /* YYLAST -- Last index in YYTABLE.  */
  650. #define YYLAST   402
  651.  
  652. /* YYNTOKENS -- Number of terminals.  */
  653. #define YYNTOKENS  120
  654. /* YYNNTS -- Number of nonterminals.  */
  655. #define YYNNTS  143
  656. /* YYNRULES -- Number of rules.  */
  657. #define YYNRULES  283
  658. /* YYNSTATES -- Number of states.  */
  659. #define YYNSTATES  478
  660.  
  661. /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
  662.    by yylex, with out-of-bounds checking.  */
  663. #define YYUNDEFTOK  2
  664. #define YYMAXUTOK   362
  665.  
  666. #define YYTRANSLATE(YYX)                                                \
  667.   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  668.  
  669. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  670.    as returned by yylex, without out-of-bounds checking.  */
  671. static const yytype_uint8 yytranslate[] =
  672. {
  673.        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  674.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  675.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  676.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  677.      115,   116,     2,   113,   109,   114,     2,     2,     2,     2,
  678.        2,     2,     2,     2,     2,     2,     2,     2,     2,   108,
  679.        2,   117,     2,     2,     2,     2,     2,     2,     2,     2,
  680.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  681.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  682.        2,   111,     2,   112,     2,     2,     2,     2,     2,     2,
  683.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  684.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  685.        2,     2,     2,   118,   110,   119,     2,     2,     2,     2,
  686.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  687.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  688.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  689.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  690.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  691.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  692.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  693.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  694.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  695.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  696.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  697.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  698.        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
  699.        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  700.       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
  701.       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
  702.       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
  703.       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
  704.       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
  705.       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
  706.       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
  707.       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
  708.       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
  709.      105,   106,   107
  710. };
  711.  
  712. #if YYDEBUG
  713.   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
  714. static const yytype_uint16 yyrline[] =
  715. {
  716.        0,   286,   286,   289,   297,   309,   310,   313,   337,   338,
  717.      341,   356,   359,   364,   371,   372,   373,   374,   375,   376,
  718.      377,   380,   381,   382,   385,   391,   399,   405,   412,   418,
  719.      425,   469,   474,   483,   527,   533,   534,   535,   536,   537,
  720.      538,   539,   540,   541,   542,   543,   544,   547,   559,   567,
  721.      584,   591,   610,   621,   641,   665,   672,   705,   712,   728,
  722.      787,   830,   839,   861,   871,   875,   904,   923,   923,   925,
  723.      932,   944,   945,   946,   949,   963,   977,   997,  1008,  1020,
  724.     1022,  1023,  1024,  1025,  1028,  1028,  1028,  1028,  1029,  1032,
  725.     1036,  1041,  1047,  1054,  1061,  1083,  1105,  1106,  1107,  1108,
  726.     1109,  1110,  1113,  1132,  1136,  1142,  1146,  1150,  1154,  1158,
  727.     1162,  1166,  1171,  1177,  1188,  1188,  1189,  1191,  1195,  1199,
  728.     1203,  1209,  1209,  1211,  1229,  1255,  1258,  1273,  1279,  1285,
  729.     1286,  1293,  1299,  1305,  1313,  1319,  1325,  1333,  1339,  1345,
  730.     1353,  1354,  1357,  1358,  1359,  1360,  1361,  1362,  1363,  1364,
  731.     1365,  1366,  1367,  1370,  1379,  1383,  1387,  1393,  1402,  1406,
  732.     1410,  1419,  1423,  1429,  1435,  1442,  1447,  1455,  1465,  1467,
  733.     1475,  1481,  1485,  1489,  1495,  1506,  1515,  1519,  1524,  1528,
  734.     1532,  1536,  1542,  1549,  1553,  1559,  1567,  1578,  1585,  1589,
  735.     1595,  1605,  1616,  1620,  1638,  1647,  1650,  1656,  1660,  1664,
  736.     1670,  1681,  1686,  1691,  1696,  1701,  1706,  1714,  1717,  1722,
  737.     1735,  1743,  1754,  1762,  1762,  1764,  1764,  1766,  1776,  1781,
  738.     1788,  1798,  1807,  1812,  1819,  1829,  1839,  1851,  1851,  1852,
  739.     1852,  1854,  1864,  1872,  1882,  1890,  1898,  1907,  1918,  1922,
  740.     1928,  1929,  1930,  1933,  1933,  1936,  1971,  1975,  1975,  1978,
  741.     1985,  1994,  2008,  2017,  2026,  2030,  2039,  2048,  2059,  2066,
  742.     2076,  2104,  2113,  2125,  2128,  2137,  2148,  2149,  2150,  2153,
  743.     2154,  2155,  2158,  2159,  2162,  2163,  2166,  2167,  2170,  2181,
  744.     2192,  2203,  2229,  2230
  745. };
  746. #endif
  747.  
  748. #if YYDEBUG || YYERROR_VERBOSE || 1
  749. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  750.    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
  751. static const char *const yytname[] =
  752. {
  753.   "$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
  754.   "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
  755.   "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
  756.   "KIL", "SWZ", "TXD_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION",
  757.   "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION",
  758.   "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
  759.   "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
  760.   "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
  761.   "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT_TOK", "POINTSIZE",
  762.   "POSITION", "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
  763.   "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE_TOK", "SPECULAR", "SPOT",
  764.   "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
  765.   "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
  766.   "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
  767.   "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
  768.   "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
  769.   "WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3", "MASK2",
  770.   "MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'",
  771.   "'+'", "'-'", "'('", "')'", "'='", "'{'", "'}'", "$accept", "program",
  772.   "language", "optionSequence", "option", "statementSequence", "statement",
  773.   "instruction", "ALU_instruction", "TexInstruction", "ARL_instruction",
  774.   "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction",
  775.   "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction",
  776.   "KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget",
  777.   "SWZ_instruction", "scalarSrcReg", "scalarUse", "swizzleSrcReg",
  778.   "maskedDstReg", "maskedAddrReg", "extendedSwizzle", "extSwizComp",
  779.   "extSwizSel", "srcReg", "dstReg", "progParamArray", "progParamArrayMem",
  780.   "progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset",
  781.   "addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent",
  782.   "addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask",
  783.   "optionalCcMask", "ccTest", "ccTest2", "ccMaskRule", "ccMaskRule2",
  784.   "namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem",
  785.   "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem",
  786.   "PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt",
  787.   "optArraySize", "paramSingleInit", "paramMultipleInit",
  788.   "paramMultInitList", "paramSingleItemDecl", "paramSingleItemUse",
  789.   "paramMultipleItem", "stateMultipleItem", "stateSingleItem",
  790.   "stateMaterialItem", "stateMatProperty", "stateLightItem",
  791.   "stateLightProperty", "stateSpotProperty", "stateLightModelItem",
  792.   "stateLModProperty", "stateLightProdItem", "stateLProdProperty",
  793.   "stateTexEnvItem", "stateTexEnvProperty", "ambDiffSpecProperty",
  794.   "stateLightNumber", "stateTexGenItem", "stateTexGenType",
  795.   "stateTexGenCoord", "stateFogItem", "stateFogProperty",
  796.   "stateClipPlaneItem", "stateClipPlaneNum", "statePointItem",
  797.   "statePointProperty", "stateMatrixRow", "stateMatrixRows",
  798.   "optMatrixRows", "stateMatrixItem", "stateOptMatModifier",
  799.   "stateMatModifier", "stateMatrixRowNum", "stateMatrixName",
  800.   "stateOptModMatNum", "stateModMatNum", "statePaletteMatNum",
  801.   "stateProgramMatNum", "stateDepthItem", "programSingleItem",
  802.   "programMultipleItem", "progEnvParams", "progEnvParamNums",
  803.   "progEnvParam", "progLocalParams", "progLocalParamNums",
  804.   "progLocalParam", "progEnvParamNum", "progLocalParamNum",
  805.   "paramConstDecl", "paramConstUse", "paramConstScalarDecl",
  806.   "paramConstScalarUse", "paramConstVector", "signedFloatConstant",
  807.   "optionalSign", "TEMP_statement", "@1", "optVarSize",
  808.   "ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement",
  809.   "resultBinding", "resultColBinding", "optResultFaceType",
  810.   "optResultColorType", "optFaceType", "optColorType",
  811.   "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
  812.   "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
  813.   "ALIAS_statement", "string", YY_NULLPTR
  814. };
  815. #endif
  816.  
  817. # ifdef YYPRINT
  818. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  819.    (internal) symbol number NUM (which must be that of a token).  */
  820. static const yytype_uint16 yytoknum[] =
  821. {
  822.        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
  823.      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
  824.      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
  825.      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
  826.      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
  827.      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
  828.      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
  829.      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
  830.      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
  831.      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
  832.      355,   356,   357,   358,   359,   360,   361,   362,    59,    44,
  833.      124,    91,    93,    43,    45,    40,    41,    61,   123,   125
  834. };
  835. # endif
  836.  
  837. #define YYPACT_NINF -398
  838.  
  839. #define yypact_value_is_default(Yystate) \
  840.   (!!((Yystate) == (-398)))
  841.  
  842. #define YYTABLE_NINF -230
  843.  
  844. #define yytable_value_is_error(Yytable_value) \
  845.   0
  846.  
  847.   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  848.      STATE-NUM.  */
  849. static const yytype_int16 yypact[] =
  850. {
  851.       52,  -398,  -398,    14,  -398,  -398,    67,   152,  -398,    24,
  852.     -398,  -398,     5,  -398,    47,    81,    99,  -398,    -1,    -1,
  853.       -1,    -1,    -1,    -1,    43,    56,    -1,    -1,  -398,    97,
  854.     -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  855.     -398,  -398,   112,  -398,  -398,  -398,  -398,  -398,   156,  -398,
  856.     -398,  -398,  -398,  -398,   111,    98,   141,    95,   127,  -398,
  857.       84,   142,  -398,   146,   150,   153,   157,   158,  -398,   159,
  858.      165,  -398,  -398,  -398,  -398,  -398,   113,   -13,   161,   163,
  859.     -398,  -398,   162,  -398,  -398,   164,   174,    10,   252,    -3,
  860.     -398,   -11,  -398,  -398,  -398,  -398,   166,  -398,   -20,  -398,
  861.     -398,  -398,  -398,   167,   -20,   -20,   -20,   -20,   -20,   -20,
  862.     -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,   137,    70,
  863.      132,    85,   168,    34,   -20,   113,   169,  -398,  -398,  -398,
  864.     -398,  -398,  -398,  -398,  -398,  -398,    34,   -20,   171,   111,
  865.      179,  -398,  -398,  -398,   172,  -398,  -398,  -398,  -398,  -398,
  866.     -398,  -398,   216,  -398,  -398,   253,    76,   258,  -398,   176,
  867.      154,  -398,   178,    29,   180,  -398,   181,  -398,  -398,   110,
  868.     -398,  -398,   166,  -398,   175,   182,   183,   219,    32,   184,
  869.      177,   186,    94,   140,     7,   187,   166,  -398,  -398,  -398,
  870.     -398,  -398,  -398,  -398,  -398,  -398,  -398,   226,  -398,   110,
  871.     -398,   188,  -398,  -398,   166,   189,   190,  -398,   113,     9,
  872.     -398,     1,   193,   195,   240,   164,  -398,   191,  -398,  -398,
  873.      194,  -398,  -398,  -398,  -398,   197,   -20,  -398,   196,   198,
  874.      113,   -20,    34,  -398,   203,   206,   228,   -20,  -398,  -398,
  875.     -398,  -398,   290,   292,   293,  -398,  -398,  -398,  -398,   294,
  876.     -398,  -398,  -398,  -398,   251,   294,    48,   208,   209,  -398,
  877.      210,  -398,   166,    21,  -398,  -398,  -398,   299,   295,    12,
  878.      212,  -398,   302,  -398,   304,   302,  -398,   218,   -20,  -398,
  879.     -398,   217,  -398,  -398,   227,   -20,   -20,  -398,   214,  -398,
  880.     -398,  -398,  -398,  -398,  -398,  -398,  -398,   220,  -398,  -398,
  881.      222,   225,   229,  -398,   223,  -398,   224,  -398,   230,  -398,
  882.      231,  -398,   233,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  883.      314,   316,  -398,   317,  -398,  -398,  -398,  -398,  -398,  -398,
  884.     -398,   234,  -398,  -398,  -398,  -398,   170,   318,  -398,   235,
  885.     -398,   236,   237,  -398,    44,  -398,  -398,   143,  -398,   244,
  886.      -15,   245,    36,  -398,   332,  -398,   138,   -20,  -398,  -398,
  887.      301,   101,    94,  -398,   248,  -398,   249,  -398,   250,  -398,
  888.     -398,  -398,  -398,  -398,  -398,  -398,   254,  -398,  -398,  -398,
  889.      -20,  -398,   333,   340,  -398,   -20,  -398,  -398,  -398,   -20,
  890.      102,   132,    75,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  891.     -398,   255,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  892.     -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  893.      336,  -398,  -398,    49,  -398,  -398,  -398,  -398,    90,  -398,
  894.     -398,  -398,  -398,   256,   260,   259,   261,  -398,   298,    36,
  895.     -398,  -398,  -398,  -398,  -398,  -398,   -20,  -398,   -20,   228,
  896.      290,   292,   262,  -398,  -398,   257,   265,   268,   266,   273,
  897.      269,   274,   318,  -398,   -20,   138,  -398,   290,  -398,   292,
  898.      107,  -398,  -398,  -398,  -398,   318,   270,  -398
  899. };
  900.  
  901.   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  902.      Performed when YYTABLE does not specify something else to do.  Zero
  903.      means the default is an error.  */
  904. static const yytype_uint16 yydefact[] =
  905. {
  906.        0,     3,     4,     0,     6,     1,     9,     0,     5,   246,
  907.      282,   283,     0,   247,     0,     0,     0,     2,     0,     0,
  908.        0,     0,     0,     0,     0,   242,     0,     0,     8,     0,
  909.       12,    13,    14,    15,    16,    17,    18,    19,    21,    22,
  910.       23,    20,     0,    96,    97,   121,   122,    98,     0,    99,
  911.      100,   101,   245,     7,     0,     0,     0,     0,     0,    65,
  912.        0,    88,    64,     0,     0,     0,     0,     0,    76,     0,
  913.        0,    94,   240,   241,    31,    32,    83,     0,     0,     0,
  914.       10,    11,     0,   243,   250,   248,     0,     0,   125,   242,
  915.      123,   259,   257,   253,   255,   252,   272,   254,   242,    84,
  916.       85,    86,    87,    91,   242,   242,   242,   242,   242,   242,
  917.       78,    55,    81,    80,    82,    92,   233,   232,     0,     0,
  918.        0,     0,    60,     0,   242,    83,     0,    61,    63,   134,
  919.      135,   213,   214,   136,   229,   230,     0,   242,     0,     0,
  920.        0,   281,   102,   126,     0,   127,   131,   132,   133,   227,
  921.      228,   231,     0,   262,   261,     0,   263,     0,   256,     0,
  922.        0,    54,     0,     0,     0,    26,     0,    25,    24,   269,
  923.      119,   117,   272,   104,     0,     0,     0,     0,     0,     0,
  924.      266,     0,   266,     0,     0,   276,   272,   142,   143,   144,
  925.      145,   147,   146,   148,   149,   150,   151,     0,   152,   269,
  926.      109,     0,   107,   105,   272,     0,   114,   103,    83,     0,
  927.       52,     0,     0,     0,     0,   244,   249,     0,   239,   238,
  928.        0,   264,   265,   258,   278,     0,   242,    95,     0,     0,
  929.       83,   242,     0,    48,     0,    51,     0,   242,   270,   271,
  930.      118,   120,     0,     0,     0,   212,   183,   184,   182,     0,
  931.      165,   268,   267,   164,     0,     0,     0,     0,   207,   203,
  932.        0,   202,   272,   195,   189,   188,   187,     0,     0,     0,
  933.        0,   108,     0,   110,     0,     0,   106,     0,   242,   234,
  934.       69,     0,    67,    68,     0,   242,   242,   251,     0,   124,
  935.      260,   273,    28,    89,    90,    93,    27,     0,    79,    50,
  936.      274,     0,     0,   225,     0,   226,     0,   186,     0,   174,
  937.        0,   166,     0,   171,   172,   155,   156,   173,   153,   154,
  938.        0,     0,   201,     0,   204,   197,   199,   198,   194,   196,
  939.      280,     0,   170,   169,   176,   177,     0,     0,   116,     0,
  940.      113,     0,     0,    53,     0,    62,    77,    71,    47,     0,
  941.        0,     0,   242,    49,     0,    34,     0,   242,   220,   224,
  942.        0,     0,   266,   211,     0,   209,     0,   210,     0,   277,
  943.      181,   180,   178,   179,   175,   200,     0,   111,   112,   115,
  944.      242,   235,     0,     0,    70,   242,    58,    57,    59,   242,
  945.        0,     0,     0,   129,   137,   140,   138,   215,   216,   139,
  946.      279,     0,    35,    36,    37,    38,    39,    40,    41,    42,
  947.       43,    44,    45,    46,    30,    29,   185,   160,   162,   159,
  948.        0,   157,   158,     0,   206,   208,   205,   190,     0,    74,
  949.       72,    75,    73,     0,     0,     0,     0,   141,   192,   242,
  950.      128,   275,   163,   161,   167,   168,   242,   236,   242,     0,
  951.        0,     0,     0,   191,   130,     0,     0,     0,     0,   218,
  952.        0,   222,     0,   237,   242,     0,   217,     0,   221,     0,
  953.        0,    56,    33,   219,   223,     0,     0,   193
  954. };
  955.  
  956.   /* YYPGOTO[NTERM-NUM].  */
  957. static const yytype_int16 yypgoto[] =
  958. {
  959.     -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  960.     -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,   -78,
  961.      -82,  -398,  -100,   155,   -86,   215,  -398,  -398,  -372,  -398,
  962.      -54,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,   173,
  963.     -398,  -398,  -398,  -118,  -398,  -398,   232,  -398,  -398,  -398,
  964.     -398,  -398,   303,  -398,  -398,  -398,   114,  -398,  -398,  -398,
  965.     -398,  -398,  -398,  -398,  -398,  -398,  -398,   -53,  -398,   -88,
  966.     -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  967.     -398,  -334,   130,  -398,  -398,  -398,  -398,  -398,  -398,  -398,
  968.     -398,  -398,  -398,  -398,  -398,     0,  -398,  -398,  -397,  -398,
  969.     -398,  -398,  -398,  -398,  -398,   305,  -398,  -398,  -398,  -398,
  970.     -398,  -398,  -398,  -396,  -383,   306,  -398,  -398,  -137,   -87,
  971.     -120,   -89,  -398,  -398,  -398,  -398,  -398,   263,  -398,   185,
  972.     -398,  -398,  -398,  -177,   199,  -154,  -398,  -398,  -398,  -398,
  973.     -398,  -398,    -6
  974. };
  975.  
  976.   /* YYDEFGOTO[NTERM-NUM].  */
  977. static const yytype_int16 yydefgoto[] =
  978. {
  979.       -1,     3,     4,     6,     8,     9,    28,    29,    30,    31,
  980.       32,    33,    34,    35,    36,    37,    38,    39,    40,   301,
  981.      414,    41,   162,   233,    74,    60,    69,   348,   349,   387,
  982.      234,    61,   126,   281,   282,   283,   384,   430,   432,    70,
  983.      347,   111,   299,   115,   103,   161,    75,   229,    76,   230,
  984.       42,    43,   127,   207,   341,   276,   339,   173,    44,    45,
  985.       46,   144,    90,   289,   392,   145,   128,   393,   394,   129,
  986.      187,   318,   188,   421,   443,   189,   253,   190,   444,   191,
  987.      333,   319,   310,   192,   336,   374,   193,   248,   194,   308,
  988.      195,   266,   196,   437,   453,   197,   328,   329,   376,   263,
  989.      322,   366,   368,   364,   198,   130,   396,   397,   458,   131,
  990.      398,   460,   132,   304,   306,   399,   133,   149,   134,   135,
  991.      151,    77,    47,   139,    48,    49,    54,    85,    50,    62,
  992.       97,   156,   223,   254,   240,   158,   355,   268,   225,   401,
  993.      331,    51,    12
  994. };
  995.  
  996.   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
  997.      positive, shift that token.  If negative, reduce the rule whose
  998.      number is the opposite.  If YYTABLE_NINF, syntax error.  */
  999. static const yytype_int16 yytable[] =
  1000. {
  1001.      152,   146,   150,    52,   209,   256,   165,   210,   386,   168,
  1002.      116,   117,   159,   433,     5,   163,   153,   163,   241,   164,
  1003.      163,   166,   167,   125,   280,   118,   235,   422,   154,    13,
  1004.       14,    15,   269,   264,    16,   152,    17,    18,    19,    20,
  1005.       21,    22,    23,    24,    25,    26,    27,   334,   118,   119,
  1006.      273,   213,   116,   117,   459,     1,     2,   116,   117,   119,
  1007.      120,   246,   325,   326,    58,   470,   335,   118,   461,   208,
  1008.      120,   473,   118,   313,   313,     7,   456,   265,   476,   314,
  1009.      314,   315,   212,   121,    10,    11,   474,   122,   247,   445,
  1010.      277,   119,   471,    72,    73,   235,   119,   123,   390,    59,
  1011.      155,    68,   120,   327,   174,   124,   121,   120,   324,   391,
  1012.       72,    73,   295,    53,   199,   124,   175,   316,   278,   317,
  1013.      317,   251,   200,    10,    11,   121,   313,   417,   279,   122,
  1014.      121,   296,   314,   252,   122,   201,   435,   221,   202,   232,
  1015.      292,   418,   163,    68,   222,   203,    55,   124,   436,    72,
  1016.       73,   302,   124,   380,   124,    71,    91,    92,   344,   204,
  1017.      176,   419,   177,   381,    93,    82,   169,    83,   178,    72,
  1018.       73,   238,   317,   420,   170,   179,   180,   181,   239,   182,
  1019.       56,   183,   205,   206,   439,   423,    94,    95,   257,   152,
  1020.      184,   258,   259,    98,   440,   260,   350,   171,    57,   446,
  1021.      351,    96,   250,   261,   251,    80,    88,   185,   186,   447,
  1022.       84,   172,    89,   475,   112,    86,   252,   113,   114,   427,
  1023.       81,   262,   402,   403,   404,   405,   406,   407,   408,   409,
  1024.      410,   411,   412,   413,    63,    64,    65,    66,    67,   218,
  1025.      219,    78,    79,    99,   100,   101,   102,   370,   371,   372,
  1026.      373,    10,    11,    71,   227,   104,   382,   383,    87,   105,
  1027.      428,   138,   106,   152,   395,   150,   107,   108,   109,   110,
  1028.      136,   415,   137,   140,   141,   143,   220,   157,   216,   -66,
  1029.      211,   224,   160,   245,   217,   226,   242,   231,   214,   236,
  1030.      237,   152,   270,   243,   244,   249,   350,   255,   267,   272,
  1031.      274,   275,   285,   434,   286,    58,   290,   298,   288,   291,
  1032.     -229,   300,   293,   303,   294,   305,   307,   309,   311,   320,
  1033.      321,   323,   330,   337,   332,   338,   455,   340,   343,   345,
  1034.      353,   346,   352,   354,   356,   358,   359,   363,   357,   365,
  1035.      367,   375,   360,   361,   388,   362,   369,   377,   378,   379,
  1036.      152,   395,   150,   385,   389,   400,   429,   152,   416,   350,
  1037.      424,   425,   426,   431,   452,   448,   427,   441,   442,   449,
  1038.      450,   457,   451,   462,   464,   350,   463,   465,   466,   467,
  1039.      469,   468,   477,   472,   284,   312,   454,   297,     0,   342,
  1040.      142,   438,   228,     0,   147,   148,     0,     0,   271,   287,
  1041.        0,     0,   215
  1042. };
  1043.  
  1044. static const yytype_int16 yycheck[] =
  1045. {
  1046.       89,    89,    89,     9,   124,   182,   106,   125,    23,   109,
  1047.       23,    24,    98,   385,     0,   104,    27,   106,   172,   105,
  1048.      109,   107,   108,    77,    23,    38,   163,   361,    39,     5,
  1049.        6,     7,   186,    26,    10,   124,    12,    13,    14,    15,
  1050.       16,    17,    18,    19,    20,    21,    22,    35,    38,    62,
  1051.      204,   137,    23,    24,   450,     3,     4,    23,    24,    62,
  1052.       73,    29,    41,    42,    65,   462,    54,    38,   451,   123,
  1053.       73,   467,    38,    25,    25,     8,   448,    70,   475,    31,
  1054.       31,    33,   136,    96,    99,   100,   469,   100,    56,   423,
  1055.      208,    62,   464,   113,   114,   232,    62,   110,    62,   100,
  1056.      111,   100,    73,    82,    34,   118,    96,    73,   262,    73,
  1057.      113,   114,   230,   108,    29,   118,    46,    69,   109,    71,
  1058.       71,    27,    37,    99,   100,    96,    25,    26,   119,   100,
  1059.       96,   231,    31,    39,   100,    50,    34,    61,    53,   110,
  1060.      226,    40,   231,   100,    68,    60,    99,   118,    46,   113,
  1061.      114,   237,   118,   109,   118,    99,    29,    30,   278,    74,
  1062.       28,    60,    30,   119,    37,     9,    29,    11,    36,   113,
  1063.      114,    61,    71,    72,    37,    43,    44,    45,    68,    47,
  1064.       99,    49,    97,    98,   109,   362,    59,    60,    48,   278,
  1065.       58,    51,    52,   109,   119,    55,   285,    60,    99,   109,
  1066.      286,    74,    25,    63,    27,   108,   111,    75,    76,   119,
  1067.       99,    74,   117,   106,   101,   117,    39,   104,   105,   112,
  1068.      108,    81,    84,    85,    86,    87,    88,    89,    90,    91,
  1069.       92,    93,    94,    95,    19,    20,    21,    22,    23,    23,
  1070.       24,    26,    27,   101,   102,   103,   104,    77,    78,    79,
  1071.       80,    99,   100,    99,   100,   109,   113,   114,   117,   109,
  1072.      380,    99,   109,   352,   352,   352,   109,   109,   109,   104,
  1073.      109,   357,   109,   109,   100,    23,    23,   111,    99,   111,
  1074.      111,    23,   115,    64,   112,   109,   111,   109,   117,   109,
  1075.      109,   380,    66,   111,   111,   111,   385,   111,   111,   111,
  1076.      111,   111,   109,   389,   109,    65,   112,   104,   117,   112,
  1077.      104,    83,   116,    23,   116,    23,    23,    23,    67,   111,
  1078.      111,   111,    23,   111,    29,    23,   446,    23,   110,   112,
  1079.      110,   104,   118,   111,   109,   112,   112,    23,   109,    23,
  1080.       23,    23,   112,   112,   350,   112,   112,   112,   112,   112,
  1081.      439,   439,   439,   109,   109,    23,    23,   446,    57,   448,
  1082.      112,   112,   112,    23,    66,   109,   112,   112,    32,   109,
  1083.      111,   449,   111,   111,   109,   464,   119,   109,   112,   106,
  1084.      106,   112,   112,   465,   211,   255,   439,   232,    -1,   275,
  1085.       87,   391,   160,    -1,    89,    89,    -1,    -1,   199,   214,
  1086.       -1,    -1,   139
  1087. };
  1088.  
  1089.   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  1090.      symbol of state STATE-NUM.  */
  1091. static const yytype_uint16 yystos[] =
  1092. {
  1093.        0,     3,     4,   121,   122,     0,   123,     8,   124,   125,
  1094.       99,   100,   262,     5,     6,     7,    10,    12,    13,    14,
  1095.       15,    16,    17,    18,    19,    20,    21,    22,   126,   127,
  1096.      128,   129,   130,   131,   132,   133,   134,   135,   136,   137,
  1097.      138,   141,   170,   171,   178,   179,   180,   242,   244,   245,
  1098.      248,   261,   262,   108,   246,    99,    99,    99,    65,   100,
  1099.      145,   151,   249,   145,   145,   145,   145,   145,   100,   146,
  1100.      159,    99,   113,   114,   144,   166,   168,   241,   145,   145,
  1101.      108,   108,     9,    11,    99,   247,   117,   117,   111,   117,
  1102.      182,    29,    30,    37,    59,    60,    74,   250,   109,   101,
  1103.      102,   103,   104,   164,   109,   109,   109,   109,   109,   109,
  1104.      104,   161,   101,   104,   105,   163,    23,    24,    38,    62,
  1105.       73,    96,   100,   110,   118,   150,   152,   172,   186,   189,
  1106.      225,   229,   232,   236,   238,   239,   109,   109,    99,   243,
  1107.      109,   100,   172,    23,   181,   185,   189,   225,   235,   237,
  1108.      239,   240,   241,    27,    39,   111,   251,   111,   255,   144,
  1109.      115,   165,   142,   241,   144,   142,   144,   144,   142,    29,
  1110.       37,    60,    74,   177,    34,    46,    28,    30,    36,    43,
  1111.       44,    45,    47,    49,    58,    75,    76,   190,   192,   195,
  1112.      197,   199,   203,   206,   208,   210,   212,   215,   224,    29,
  1113.       37,    50,    53,    60,    74,    97,    98,   173,   150,   240,
  1114.      163,   111,   150,   144,   117,   247,    99,   112,    23,    24,
  1115.       23,    61,    68,   252,    23,   258,   109,   100,   166,   167,
  1116.      169,   109,   110,   143,   150,   238,   109,   109,    61,    68,
  1117.      254,   255,   111,   111,   111,    64,    29,    56,   207,   111,
  1118.       25,    27,    39,   196,   253,   111,   253,    48,    51,    52,
  1119.       55,    63,    81,   219,    26,    70,   211,   111,   257,   255,
  1120.       66,   254,   111,   255,   111,   111,   175,   163,   109,   119,
  1121.       23,   153,   154,   155,   159,   109,   109,   249,   117,   183,
  1122.      112,   112,   144,   116,   116,   163,   142,   143,   104,   162,
  1123.       83,   139,   144,    23,   233,    23,   234,    23,   209,    23,
  1124.      202,    67,   202,    25,    31,    33,    69,    71,   191,   201,
  1125.      111,   111,   220,   111,   255,    41,    42,    82,   216,   217,
  1126.       23,   260,    29,   200,    35,    54,   204,   111,    23,   176,
  1127.       23,   174,   176,   110,   240,   112,   104,   160,   147,   148,
  1128.      241,   144,   118,   110,   111,   256,   109,   109,   112,   112,
  1129.      112,   112,   112,    23,   223,    23,   221,    23,   222,   112,
  1130.       77,    78,    79,    80,   205,    23,   218,   112,   112,   112,
  1131.      109,   119,   113,   114,   156,   109,    23,   149,   262,   109,
  1132.       62,    73,   184,   187,   188,   189,   226,   227,   230,   235,
  1133.       23,   259,    84,    85,    86,    87,    88,    89,    90,    91,
  1134.       92,    93,    94,    95,   140,   144,    57,    26,    40,    60,
  1135.       72,   193,   201,   253,   112,   112,   112,   112,   240,    23,
  1136.      157,    23,   158,   148,   144,    34,    46,   213,   215,   109,
  1137.      119,   112,    32,   194,   198,   201,   109,   119,   109,   109,
  1138.      111,   111,    66,   214,   187,   240,   148,   139,   228,   233,
  1139.      231,   234,   111,   119,   109,   109,   112,   106,   112,   106,
  1140.      218,   148,   140,   233,   234,   106,   218,   112
  1141. };
  1142.  
  1143.   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  1144. static const yytype_uint16 yyr1[] =
  1145. {
  1146.        0,   120,   121,   122,   122,   123,   123,   124,   125,   125,
  1147.      126,   126,   127,   127,   128,   128,   128,   128,   128,   128,
  1148.      128,   129,   129,   129,   130,   131,   132,   133,   134,   135,
  1149.      136,   137,   137,   138,   139,   140,   140,   140,   140,   140,
  1150.      140,   140,   140,   140,   140,   140,   140,   141,   142,   142,
  1151.      143,   143,   144,   144,   145,   146,   147,   148,   149,   149,
  1152.      150,   150,   150,   150,   151,   151,   152,   153,   153,   154,
  1153.      155,   156,   156,   156,   157,   158,   159,   160,   161,   162,
  1154.      163,   163,   163,   163,   164,   164,   164,   164,   164,   165,
  1155.      165,   165,   166,   167,   168,   169,   170,   170,   170,   170,
  1156.      170,   170,   171,   172,   172,   173,   173,   173,   173,   173,
  1157.      173,   173,   173,   174,   175,   175,   176,   177,   177,   177,
  1158.      177,   178,   178,   179,   180,   181,   181,   182,   183,   184,
  1159.      184,   185,   185,   185,   186,   186,   186,   187,   187,   187,
  1160.      188,   188,   189,   189,   189,   189,   189,   189,   189,   189,
  1161.      189,   189,   189,   190,   191,   191,   191,   192,   193,   193,
  1162.      193,   193,   193,   194,   195,   196,   196,   197,   198,   199,
  1163.      200,   201,   201,   201,   202,   203,   204,   204,   205,   205,
  1164.      205,   205,   206,   207,   207,   208,   209,   210,   211,   211,
  1165.      212,   213,   214,   214,   215,   216,   216,   217,   217,   217,
  1166.      218,   219,   219,   219,   219,   219,   219,   220,   220,   221,
  1167.      222,   223,   224,   225,   225,   226,   226,   227,   228,   228,
  1168.      229,   230,   231,   231,   232,   233,   234,   235,   235,   236,
  1169.      236,   237,   238,   238,   239,   239,   239,   239,   240,   240,
  1170.      241,   241,   241,   243,   242,   244,   244,   246,   245,   247,
  1171.      247,   248,   249,   249,   249,   249,   249,   249,   250,   251,
  1172.      251,   251,   251,   252,   252,   252,   253,   253,   253,   254,
  1173.      254,   254,   255,   255,   256,   256,   257,   257,   258,   259,
  1174.      260,   261,   262,   262
  1175. };
  1176.  
  1177.   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
  1178. static const yytype_uint8 yyr2[] =
  1179. {
  1180.        0,     2,     4,     1,     1,     2,     0,     3,     2,     0,
  1181.        2,     2,     1,     1,     1,     1,     1,     1,     1,     1,
  1182.        1,     1,     1,     1,     4,     4,     4,     6,     6,     8,
  1183.        8,     2,     2,    12,     2,     1,     1,     1,     1,     1,
  1184.        1,     1,     1,     1,     1,     1,     1,     6,     2,     4,
  1185.        2,     1,     3,     5,     3,     2,     7,     2,     1,     1,
  1186.        1,     1,     4,     1,     1,     1,     1,     1,     1,     1,
  1187.        3,     0,     2,     2,     1,     1,     1,     1,     1,     1,
  1188.        1,     1,     1,     0,     1,     1,     1,     1,     0,     3,
  1189.        3,     0,     2,     2,     1,     1,     1,     1,     1,     1,
  1190.        1,     1,     4,     2,     2,     1,     2,     1,     2,     1,
  1191.        2,     4,     4,     1,     0,     3,     1,     1,     2,     1,
  1192.        2,     1,     1,     3,     6,     0,     1,     2,     4,     1,
  1193.        3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  1194.        1,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  1195.        2,     2,     2,     3,     1,     1,     1,     5,     1,     1,
  1196.        1,     2,     1,     1,     2,     1,     2,     6,     1,     3,
  1197.        1,     1,     1,     1,     1,     4,     1,     1,     1,     1,
  1198.        1,     1,     2,     1,     1,     5,     1,     2,     1,     1,
  1199.        5,     2,     0,     6,     3,     0,     1,     1,     1,     1,
  1200.        1,     2,     1,     1,     2,     4,     4,     0,     3,     1,
  1201.        1,     1,     2,     1,     1,     1,     1,     5,     1,     3,
  1202.        5,     5,     1,     3,     5,     1,     1,     1,     1,     1,
  1203.        1,     1,     1,     1,     3,     5,     7,     9,     2,     2,
  1204.        1,     1,     0,     0,     4,     1,     0,     0,     3,     3,
  1205.        1,     5,     2,     2,     2,     2,     3,     2,     3,     0,
  1206.        3,     1,     1,     0,     1,     1,     0,     1,     1,     0,
  1207.        1,     1,     0,     3,     0,     3,     0,     3,     1,     1,
  1208.        1,     4,     1,     1
  1209. };
  1210.  
  1211.  
  1212. #define yyerrok         (yyerrstatus = 0)
  1213. #define yyclearin       (yychar = YYEMPTY)
  1214. #define YYEMPTY         (-2)
  1215. #define YYEOF           0
  1216.  
  1217. #define YYACCEPT        goto yyacceptlab
  1218. #define YYABORT         goto yyabortlab
  1219. #define YYERROR         goto yyerrorlab
  1220.  
  1221.  
  1222. #define YYRECOVERING()  (!!yyerrstatus)
  1223.  
  1224. #define YYBACKUP(Token, Value)                                  \
  1225. do                                                              \
  1226.   if (yychar == YYEMPTY)                                        \
  1227.     {                                                           \
  1228.       yychar = (Token);                                         \
  1229.       yylval = (Value);                                         \
  1230.       YYPOPSTACK (yylen);                                       \
  1231.       yystate = *yyssp;                                         \
  1232.       goto yybackup;                                            \
  1233.     }                                                           \
  1234.   else                                                          \
  1235.     {                                                           \
  1236.       yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
  1237.       YYERROR;                                                  \
  1238.     }                                                           \
  1239. while (0)
  1240.  
  1241. /* Error token number */
  1242. #define YYTERROR        1
  1243. #define YYERRCODE       256
  1244.  
  1245.  
  1246. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  1247.    If N is 0, then set CURRENT to the empty location which ends
  1248.    the previous symbol: RHS[0] (always defined).  */
  1249.  
  1250. #ifndef YYLLOC_DEFAULT
  1251. # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
  1252.     do                                                                  \
  1253.       if (N)                                                            \
  1254.         {                                                               \
  1255.           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
  1256.           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
  1257.           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
  1258.           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
  1259.         }                                                               \
  1260.       else                                                              \
  1261.         {                                                               \
  1262.           (Current).first_line   = (Current).last_line   =              \
  1263.             YYRHSLOC (Rhs, 0).last_line;                                \
  1264.           (Current).first_column = (Current).last_column =              \
  1265.             YYRHSLOC (Rhs, 0).last_column;                              \
  1266.         }                                                               \
  1267.     while (0)
  1268. #endif
  1269.  
  1270. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  1271.  
  1272.  
  1273. /* Enable debugging if requested.  */
  1274. #if YYDEBUG
  1275.  
  1276. # ifndef YYFPRINTF
  1277. #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  1278. #  define YYFPRINTF fprintf
  1279. # endif
  1280.  
  1281. # define YYDPRINTF(Args)                        \
  1282. do {                                            \
  1283.   if (yydebug)                                  \
  1284.     YYFPRINTF Args;                             \
  1285. } while (0)
  1286.  
  1287.  
  1288. /* YY_LOCATION_PRINT -- Print the location on the stream.
  1289.    This macro was not mandated originally: define only if we know
  1290.    we won't break user code: when these are the locations we know.  */
  1291.  
  1292. #ifndef YY_LOCATION_PRINT
  1293. # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  1294.  
  1295. /* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
  1296.  
  1297. YY_ATTRIBUTE_UNUSED
  1298. static unsigned
  1299. yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
  1300. {
  1301.   unsigned res = 0;
  1302.   int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
  1303.   if (0 <= yylocp->first_line)
  1304.     {
  1305.       res += YYFPRINTF (yyo, "%d", yylocp->first_line);
  1306.       if (0 <= yylocp->first_column)
  1307.         res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
  1308.     }
  1309.   if (0 <= yylocp->last_line)
  1310.     {
  1311.       if (yylocp->first_line < yylocp->last_line)
  1312.         {
  1313.           res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
  1314.           if (0 <= end_col)
  1315.             res += YYFPRINTF (yyo, ".%d", end_col);
  1316.         }
  1317.       else if (0 <= end_col && yylocp->first_column < end_col)
  1318.         res += YYFPRINTF (yyo, "-%d", end_col);
  1319.     }
  1320.   return res;
  1321.  }
  1322.  
  1323. #  define YY_LOCATION_PRINT(File, Loc)          \
  1324.   yy_location_print_ (File, &(Loc))
  1325.  
  1326. # else
  1327. #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  1328. # endif
  1329. #endif
  1330.  
  1331.  
  1332. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
  1333. do {                                                                      \
  1334.   if (yydebug)                                                            \
  1335.     {                                                                     \
  1336.       YYFPRINTF (stderr, "%s ", Title);                                   \
  1337.       yy_symbol_print (stderr,                                            \
  1338.                   Type, Value, Location, state); \
  1339.       YYFPRINTF (stderr, "\n");                                           \
  1340.     }                                                                     \
  1341. } while (0)
  1342.  
  1343.  
  1344. /*----------------------------------------.
  1345. | Print this symbol's value on YYOUTPUT.  |
  1346. `----------------------------------------*/
  1347.  
  1348. static void
  1349. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct asm_parser_state *state)
  1350. {
  1351.   FILE *yyo = yyoutput;
  1352.   YYUSE (yyo);
  1353.   YYUSE (yylocationp);
  1354.   YYUSE (state);
  1355.   if (!yyvaluep)
  1356.     return;
  1357. # ifdef YYPRINT
  1358.   if (yytype < YYNTOKENS)
  1359.     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  1360. # endif
  1361.   YYUSE (yytype);
  1362. }
  1363.  
  1364.  
  1365. /*--------------------------------.
  1366. | Print this symbol on YYOUTPUT.  |
  1367. `--------------------------------*/
  1368.  
  1369. static void
  1370. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct asm_parser_state *state)
  1371. {
  1372.   YYFPRINTF (yyoutput, "%s %s (",
  1373.              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  1374.  
  1375.   YY_LOCATION_PRINT (yyoutput, *yylocationp);
  1376.   YYFPRINTF (yyoutput, ": ");
  1377.   yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state);
  1378.   YYFPRINTF (yyoutput, ")");
  1379. }
  1380.  
  1381. /*------------------------------------------------------------------.
  1382. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  1383. | TOP (included).                                                   |
  1384. `------------------------------------------------------------------*/
  1385.  
  1386. static void
  1387. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  1388. {
  1389.   YYFPRINTF (stderr, "Stack now");
  1390.   for (; yybottom <= yytop; yybottom++)
  1391.     {
  1392.       int yybot = *yybottom;
  1393.       YYFPRINTF (stderr, " %d", yybot);
  1394.     }
  1395.   YYFPRINTF (stderr, "\n");
  1396. }
  1397.  
  1398. # define YY_STACK_PRINT(Bottom, Top)                            \
  1399. do {                                                            \
  1400.   if (yydebug)                                                  \
  1401.     yy_stack_print ((Bottom), (Top));                           \
  1402. } while (0)
  1403.  
  1404.  
  1405. /*------------------------------------------------.
  1406. | Report that the YYRULE is going to be reduced.  |
  1407. `------------------------------------------------*/
  1408.  
  1409. static void
  1410. yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct asm_parser_state *state)
  1411. {
  1412.   unsigned long int yylno = yyrline[yyrule];
  1413.   int yynrhs = yyr2[yyrule];
  1414.   int yyi;
  1415.   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  1416.              yyrule - 1, yylno);
  1417.   /* The symbols being reduced.  */
  1418.   for (yyi = 0; yyi < yynrhs; yyi++)
  1419.     {
  1420.       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
  1421.       yy_symbol_print (stderr,
  1422.                        yystos[yyssp[yyi + 1 - yynrhs]],
  1423.                        &(yyvsp[(yyi + 1) - (yynrhs)])
  1424.                        , &(yylsp[(yyi + 1) - (yynrhs)])                       , state);
  1425.       YYFPRINTF (stderr, "\n");
  1426.     }
  1427. }
  1428.  
  1429. # define YY_REDUCE_PRINT(Rule)          \
  1430. do {                                    \
  1431.   if (yydebug)                          \
  1432.     yy_reduce_print (yyssp, yyvsp, yylsp, Rule, state); \
  1433. } while (0)
  1434.  
  1435. /* Nonzero means print parse trace.  It is left uninitialized so that
  1436.    multiple parsers can coexist.  */
  1437. int yydebug;
  1438. #else /* !YYDEBUG */
  1439. # define YYDPRINTF(Args)
  1440. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1441. # define YY_STACK_PRINT(Bottom, Top)
  1442. # define YY_REDUCE_PRINT(Rule)
  1443. #endif /* !YYDEBUG */
  1444.  
  1445.  
  1446. /* YYINITDEPTH -- initial size of the parser's stacks.  */
  1447. #ifndef YYINITDEPTH
  1448. # define YYINITDEPTH 200
  1449. #endif
  1450.  
  1451. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1452.    if the built-in stack extension method is used).
  1453.  
  1454.    Do not make this value too large; the results are undefined if
  1455.    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1456.    evaluated with infinite-precision integer arithmetic.  */
  1457.  
  1458. #ifndef YYMAXDEPTH
  1459. # define YYMAXDEPTH 10000
  1460. #endif
  1461.  
  1462.  
  1463. #if YYERROR_VERBOSE
  1464.  
  1465. # ifndef yystrlen
  1466. #  if defined __GLIBC__ && defined _STRING_H
  1467. #   define yystrlen strlen
  1468. #  else
  1469. /* Return the length of YYSTR.  */
  1470. static YYSIZE_T
  1471. yystrlen (const char *yystr)
  1472. {
  1473.   YYSIZE_T yylen;
  1474.   for (yylen = 0; yystr[yylen]; yylen++)
  1475.     continue;
  1476.   return yylen;
  1477. }
  1478. #  endif
  1479. # endif
  1480.  
  1481. # ifndef yystpcpy
  1482. #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1483. #   define yystpcpy stpcpy
  1484. #  else
  1485. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1486.    YYDEST.  */
  1487. static char *
  1488. yystpcpy (char *yydest, const char *yysrc)
  1489. {
  1490.   char *yyd = yydest;
  1491.   const char *yys = yysrc;
  1492.  
  1493.   while ((*yyd++ = *yys++) != '\0')
  1494.     continue;
  1495.  
  1496.   return yyd - 1;
  1497. }
  1498. #  endif
  1499. # endif
  1500.  
  1501. # ifndef yytnamerr
  1502. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1503.    quotes and backslashes, so that it's suitable for yyerror.  The
  1504.    heuristic is that double-quoting is unnecessary unless the string
  1505.    contains an apostrophe, a comma, or backslash (other than
  1506.    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
  1507.    null, do not copy; instead, return the length of what the result
  1508.    would have been.  */
  1509. static YYSIZE_T
  1510. yytnamerr (char *yyres, const char *yystr)
  1511. {
  1512.   if (*yystr == '"')
  1513.     {
  1514.       YYSIZE_T yyn = 0;
  1515.       char const *yyp = yystr;
  1516.  
  1517.       for (;;)
  1518.         switch (*++yyp)
  1519.           {
  1520.           case '\'':
  1521.           case ',':
  1522.             goto do_not_strip_quotes;
  1523.  
  1524.           case '\\':
  1525.             if (*++yyp != '\\')
  1526.               goto do_not_strip_quotes;
  1527.             /* Fall through.  */
  1528.           default:
  1529.             if (yyres)
  1530.               yyres[yyn] = *yyp;
  1531.             yyn++;
  1532.             break;
  1533.  
  1534.           case '"':
  1535.             if (yyres)
  1536.               yyres[yyn] = '\0';
  1537.             return yyn;
  1538.           }
  1539.     do_not_strip_quotes: ;
  1540.     }
  1541.  
  1542.   if (! yyres)
  1543.     return yystrlen (yystr);
  1544.  
  1545.   return yystpcpy (yyres, yystr) - yyres;
  1546. }
  1547. # endif
  1548.  
  1549. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  1550.    about the unexpected token YYTOKEN for the state stack whose top is
  1551.    YYSSP.
  1552.  
  1553.    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
  1554.    not large enough to hold the message.  In that case, also set
  1555.    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
  1556.    required number of bytes is too large to store.  */
  1557. static int
  1558. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  1559.                 yytype_int16 *yyssp, int yytoken)
  1560. {
  1561.   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  1562.   YYSIZE_T yysize = yysize0;
  1563.   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1564.   /* Internationalized format string. */
  1565.   const char *yyformat = YY_NULLPTR;
  1566.   /* Arguments of yyformat. */
  1567.   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1568.   /* Number of reported tokens (one for the "unexpected", one per
  1569.      "expected"). */
  1570.   int yycount = 0;
  1571.  
  1572.   /* There are many possibilities here to consider:
  1573.      - If this state is a consistent state with a default action, then
  1574.        the only way this function was invoked is if the default action
  1575.        is an error action.  In that case, don't check for expected
  1576.        tokens because there are none.
  1577.      - The only way there can be no lookahead present (in yychar) is if
  1578.        this state is a consistent state with a default action.  Thus,
  1579.        detecting the absence of a lookahead is sufficient to determine
  1580.        that there is no unexpected or expected token to report.  In that
  1581.        case, just report a simple "syntax error".
  1582.      - Don't assume there isn't a lookahead just because this state is a
  1583.        consistent state with a default action.  There might have been a
  1584.        previous inconsistent state, consistent state with a non-default
  1585.        action, or user semantic action that manipulated yychar.
  1586.      - Of course, the expected token list depends on states to have
  1587.        correct lookahead information, and it depends on the parser not
  1588.        to perform extra reductions after fetching a lookahead from the
  1589.        scanner and before detecting a syntax error.  Thus, state merging
  1590.        (from LALR or IELR) and default reductions corrupt the expected
  1591.        token list.  However, the list is correct for canonical LR with
  1592.        one exception: it will still contain any token that will not be
  1593.        accepted due to an error action in a later state.
  1594.   */
  1595.   if (yytoken != YYEMPTY)
  1596.     {
  1597.       int yyn = yypact[*yyssp];
  1598.       yyarg[yycount++] = yytname[yytoken];
  1599.       if (!yypact_value_is_default (yyn))
  1600.         {
  1601.           /* Start YYX at -YYN if negative to avoid negative indexes in
  1602.              YYCHECK.  In other words, skip the first -YYN actions for
  1603.              this state because they are default actions.  */
  1604.           int yyxbegin = yyn < 0 ? -yyn : 0;
  1605.           /* Stay within bounds of both yycheck and yytname.  */
  1606.           int yychecklim = YYLAST - yyn + 1;
  1607.           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1608.           int yyx;
  1609.  
  1610.           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1611.             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  1612.                 && !yytable_value_is_error (yytable[yyx + yyn]))
  1613.               {
  1614.                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1615.                   {
  1616.                     yycount = 1;
  1617.                     yysize = yysize0;
  1618.                     break;
  1619.                   }
  1620.                 yyarg[yycount++] = yytname[yyx];
  1621.                 {
  1622.                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  1623.                   if (! (yysize <= yysize1
  1624.                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1625.                     return 2;
  1626.                   yysize = yysize1;
  1627.                 }
  1628.               }
  1629.         }
  1630.     }
  1631.  
  1632.   switch (yycount)
  1633.     {
  1634. # define YYCASE_(N, S)                      \
  1635.       case N:                               \
  1636.         yyformat = S;                       \
  1637.       break
  1638.       YYCASE_(0, YY_("syntax error"));
  1639.       YYCASE_(1, YY_("syntax error, unexpected %s"));
  1640.       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1641.       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  1642.       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  1643.       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  1644. # undef YYCASE_
  1645.     }
  1646.  
  1647.   {
  1648.     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
  1649.     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1650.       return 2;
  1651.     yysize = yysize1;
  1652.   }
  1653.  
  1654.   if (*yymsg_alloc < yysize)
  1655.     {
  1656.       *yymsg_alloc = 2 * yysize;
  1657.       if (! (yysize <= *yymsg_alloc
  1658.              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  1659.         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  1660.       return 1;
  1661.     }
  1662.  
  1663.   /* Avoid sprintf, as that infringes on the user's name space.
  1664.      Don't have undefined behavior even if the translation
  1665.      produced a string with the wrong number of "%s"s.  */
  1666.   {
  1667.     char *yyp = *yymsg;
  1668.     int yyi = 0;
  1669.     while ((*yyp = *yyformat) != '\0')
  1670.       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  1671.         {
  1672.           yyp += yytnamerr (yyp, yyarg[yyi++]);
  1673.           yyformat += 2;
  1674.         }
  1675.       else
  1676.         {
  1677.           yyp++;
  1678.           yyformat++;
  1679.         }
  1680.   }
  1681.   return 0;
  1682. }
  1683. #endif /* YYERROR_VERBOSE */
  1684.  
  1685. /*-----------------------------------------------.
  1686. | Release the memory associated to this symbol.  |
  1687. `-----------------------------------------------*/
  1688.  
  1689. static void
  1690. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct asm_parser_state *state)
  1691. {
  1692.   YYUSE (yyvaluep);
  1693.   YYUSE (yylocationp);
  1694.   YYUSE (state);
  1695.   if (!yymsg)
  1696.     yymsg = "Deleting";
  1697.   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1698.  
  1699.   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1700.   YYUSE (yytype);
  1701.   YY_IGNORE_MAYBE_UNINITIALIZED_END
  1702. }
  1703.  
  1704.  
  1705.  
  1706.  
  1707. /*----------.
  1708. | yyparse.  |
  1709. `----------*/
  1710.  
  1711. int
  1712. yyparse (struct asm_parser_state *state)
  1713. {
  1714. /* The lookahead symbol.  */
  1715. int yychar;
  1716.  
  1717.  
  1718. /* The semantic value of the lookahead symbol.  */
  1719. /* Default value used for initialization, for pacifying older GCCs
  1720.    or non-GCC compilers.  */
  1721. YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
  1722. YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
  1723.  
  1724. /* Location data for the lookahead symbol.  */
  1725. static YYLTYPE yyloc_default
  1726. # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  1727.   = { 1, 1, 1, 1 }
  1728. # endif
  1729. ;
  1730. YYLTYPE yylloc = yyloc_default;
  1731.  
  1732.     /* Number of syntax errors so far.  */
  1733.     int yynerrs;
  1734.  
  1735.     int yystate;
  1736.     /* Number of tokens to shift before error messages enabled.  */
  1737.     int yyerrstatus;
  1738.  
  1739.     /* The stacks and their tools:
  1740.        'yyss': related to states.
  1741.        'yyvs': related to semantic values.
  1742.        'yyls': related to locations.
  1743.  
  1744.        Refer to the stacks through separate pointers, to allow yyoverflow
  1745.        to reallocate them elsewhere.  */
  1746.  
  1747.     /* The state stack.  */
  1748.     yytype_int16 yyssa[YYINITDEPTH];
  1749.     yytype_int16 *yyss;
  1750.     yytype_int16 *yyssp;
  1751.  
  1752.     /* The semantic value stack.  */
  1753.     YYSTYPE yyvsa[YYINITDEPTH];
  1754.     YYSTYPE *yyvs;
  1755.     YYSTYPE *yyvsp;
  1756.  
  1757.     /* The location stack.  */
  1758.     YYLTYPE yylsa[YYINITDEPTH];
  1759.     YYLTYPE *yyls;
  1760.     YYLTYPE *yylsp;
  1761.  
  1762.     /* The locations where the error started and ended.  */
  1763.     YYLTYPE yyerror_range[3];
  1764.  
  1765.     YYSIZE_T yystacksize;
  1766.  
  1767.   int yyn;
  1768.   int yyresult;
  1769.   /* Lookahead token as an internal (translated) token number.  */
  1770.   int yytoken = 0;
  1771.   /* The variables used to return semantic value and location from the
  1772.      action routines.  */
  1773.   YYSTYPE yyval;
  1774.   YYLTYPE yyloc;
  1775.  
  1776. #if YYERROR_VERBOSE
  1777.   /* Buffer for error messages, and its allocated size.  */
  1778.   char yymsgbuf[128];
  1779.   char *yymsg = yymsgbuf;
  1780.   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1781. #endif
  1782.  
  1783. #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  1784.  
  1785.   /* The number of symbols on the RHS of the reduced rule.
  1786.      Keep to zero when no symbol should be popped.  */
  1787.   int yylen = 0;
  1788.  
  1789.   yyssp = yyss = yyssa;
  1790.   yyvsp = yyvs = yyvsa;
  1791.   yylsp = yyls = yylsa;
  1792.   yystacksize = YYINITDEPTH;
  1793.  
  1794.   YYDPRINTF ((stderr, "Starting parse\n"));
  1795.  
  1796.   yystate = 0;
  1797.   yyerrstatus = 0;
  1798.   yynerrs = 0;
  1799.   yychar = YYEMPTY; /* Cause a token to be read.  */
  1800.   yylsp[0] = yylloc;
  1801.   goto yysetstate;
  1802.  
  1803. /*------------------------------------------------------------.
  1804. | yynewstate -- Push a new state, which is found in yystate.  |
  1805. `------------------------------------------------------------*/
  1806.  yynewstate:
  1807.   /* In all cases, when you get here, the value and location stacks
  1808.      have just been pushed.  So pushing a state here evens the stacks.  */
  1809.   yyssp++;
  1810.  
  1811.  yysetstate:
  1812.   *yyssp = yystate;
  1813.  
  1814.   if (yyss + yystacksize - 1 <= yyssp)
  1815.     {
  1816.       /* Get the current used size of the three stacks, in elements.  */
  1817.       YYSIZE_T yysize = yyssp - yyss + 1;
  1818.  
  1819. #ifdef yyoverflow
  1820.       {
  1821.         /* Give user a chance to reallocate the stack.  Use copies of
  1822.            these so that the &'s don't force the real ones into
  1823.            memory.  */
  1824.         YYSTYPE *yyvs1 = yyvs;
  1825.         yytype_int16 *yyss1 = yyss;
  1826.         YYLTYPE *yyls1 = yyls;
  1827.  
  1828.         /* Each stack pointer address is followed by the size of the
  1829.            data in use in that stack, in bytes.  This used to be a
  1830.            conditional around just the two extra args, but that might
  1831.            be undefined if yyoverflow is a macro.  */
  1832.         yyoverflow (YY_("memory exhausted"),
  1833.                     &yyss1, yysize * sizeof (*yyssp),
  1834.                     &yyvs1, yysize * sizeof (*yyvsp),
  1835.                     &yyls1, yysize * sizeof (*yylsp),
  1836.                     &yystacksize);
  1837.  
  1838.         yyls = yyls1;
  1839.         yyss = yyss1;
  1840.         yyvs = yyvs1;
  1841.       }
  1842. #else /* no yyoverflow */
  1843. # ifndef YYSTACK_RELOCATE
  1844.       goto yyexhaustedlab;
  1845. # else
  1846.       /* Extend the stack our own way.  */
  1847.       if (YYMAXDEPTH <= yystacksize)
  1848.         goto yyexhaustedlab;
  1849.       yystacksize *= 2;
  1850.       if (YYMAXDEPTH < yystacksize)
  1851.         yystacksize = YYMAXDEPTH;
  1852.  
  1853.       {
  1854.         yytype_int16 *yyss1 = yyss;
  1855.         union yyalloc *yyptr =
  1856.           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1857.         if (! yyptr)
  1858.           goto yyexhaustedlab;
  1859.         YYSTACK_RELOCATE (yyss_alloc, yyss);
  1860.         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1861.         YYSTACK_RELOCATE (yyls_alloc, yyls);
  1862. #  undef YYSTACK_RELOCATE
  1863.         if (yyss1 != yyssa)
  1864.           YYSTACK_FREE (yyss1);
  1865.       }
  1866. # endif
  1867. #endif /* no yyoverflow */
  1868.  
  1869.       yyssp = yyss + yysize - 1;
  1870.       yyvsp = yyvs + yysize - 1;
  1871.       yylsp = yyls + yysize - 1;
  1872.  
  1873.       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1874.                   (unsigned long int) yystacksize));
  1875.  
  1876.       if (yyss + yystacksize - 1 <= yyssp)
  1877.         YYABORT;
  1878.     }
  1879.  
  1880.   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1881.  
  1882.   if (yystate == YYFINAL)
  1883.     YYACCEPT;
  1884.  
  1885.   goto yybackup;
  1886.  
  1887. /*-----------.
  1888. | yybackup.  |
  1889. `-----------*/
  1890. yybackup:
  1891.  
  1892.   /* Do appropriate processing given the current state.  Read a
  1893.      lookahead token if we need one and don't already have one.  */
  1894.  
  1895.   /* First try to decide what to do without reference to lookahead token.  */
  1896.   yyn = yypact[yystate];
  1897.   if (yypact_value_is_default (yyn))
  1898.     goto yydefault;
  1899.  
  1900.   /* Not known => get a lookahead token if don't already have one.  */
  1901.  
  1902.   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  1903.   if (yychar == YYEMPTY)
  1904.     {
  1905.       YYDPRINTF ((stderr, "Reading a token: "));
  1906.       yychar = yylex (&yylval, &yylloc, state);
  1907.     }
  1908.  
  1909.   if (yychar <= YYEOF)
  1910.     {
  1911.       yychar = yytoken = YYEOF;
  1912.       YYDPRINTF ((stderr, "Now at end of input.\n"));
  1913.     }
  1914.   else
  1915.     {
  1916.       yytoken = YYTRANSLATE (yychar);
  1917.       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1918.     }
  1919.  
  1920.   /* If the proper action on seeing token YYTOKEN is to reduce or to
  1921.      detect an error, take that action.  */
  1922.   yyn += yytoken;
  1923.   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1924.     goto yydefault;
  1925.   yyn = yytable[yyn];
  1926.   if (yyn <= 0)
  1927.     {
  1928.       if (yytable_value_is_error (yyn))
  1929.         goto yyerrlab;
  1930.       yyn = -yyn;
  1931.       goto yyreduce;
  1932.     }
  1933.  
  1934.   /* Count tokens shifted since error; after three, turn off error
  1935.      status.  */
  1936.   if (yyerrstatus)
  1937.     yyerrstatus--;
  1938.  
  1939.   /* Shift the lookahead token.  */
  1940.   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1941.  
  1942.   /* Discard the shifted token.  */
  1943.   yychar = YYEMPTY;
  1944.  
  1945.   yystate = yyn;
  1946.   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1947.   *++yyvsp = yylval;
  1948.   YY_IGNORE_MAYBE_UNINITIALIZED_END
  1949.   *++yylsp = yylloc;
  1950.   goto yynewstate;
  1951.  
  1952.  
  1953. /*-----------------------------------------------------------.
  1954. | yydefault -- do the default action for the current state.  |
  1955. `-----------------------------------------------------------*/
  1956. yydefault:
  1957.   yyn = yydefact[yystate];
  1958.   if (yyn == 0)
  1959.     goto yyerrlab;
  1960.   goto yyreduce;
  1961.  
  1962.  
  1963. /*-----------------------------.
  1964. | yyreduce -- Do a reduction.  |
  1965. `-----------------------------*/
  1966. yyreduce:
  1967.   /* yyn is the number of a rule to reduce with.  */
  1968.   yylen = yyr2[yyn];
  1969.  
  1970.   /* If YYLEN is nonzero, implement the default value of the action:
  1971.      '$$ = $1'.
  1972.  
  1973.      Otherwise, the following line sets YYVAL to garbage.
  1974.      This behavior is undocumented and Bison
  1975.      users should not rely upon it.  Assigning to YYVAL
  1976.      unconditionally makes the parser a bit smaller, and it avoids a
  1977.      GCC warning that YYVAL may be used uninitialized.  */
  1978.   yyval = yyvsp[1-yylen];
  1979.  
  1980.   /* Default location.  */
  1981.   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  1982.   YY_REDUCE_PRINT (yyn);
  1983.   switch (yyn)
  1984.     {
  1985.         case 3:
  1986. #line 290 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  1987.     {
  1988.            if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
  1989.               yyerror(& (yylsp[0]), state, "invalid fragment program header");
  1990.  
  1991.            }
  1992.            state->mode = ARB_vertex;
  1993.         }
  1994. #line 1995 "program/program_parse.tab.c" /* yacc.c:1646  */
  1995.     break;
  1996.  
  1997.   case 4:
  1998. #line 298 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  1999.     {
  2000.            if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
  2001.               yyerror(& (yylsp[0]), state, "invalid vertex program header");
  2002.            }
  2003.            state->mode = ARB_fragment;
  2004.  
  2005.            state->option.TexRect =
  2006.               (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
  2007.         }
  2008. #line 2009 "program/program_parse.tab.c" /* yacc.c:1646  */
  2009.     break;
  2010.  
  2011.   case 7:
  2012. #line 314 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2013.     {
  2014.            int valid = 0;
  2015.  
  2016.            if (state->mode == ARB_vertex) {
  2017.               valid = _mesa_ARBvp_parse_option(state, (yyvsp[-1].string));
  2018.            } else if (state->mode == ARB_fragment) {
  2019.               valid = _mesa_ARBfp_parse_option(state, (yyvsp[-1].string));
  2020.            }
  2021.  
  2022.  
  2023.            free((yyvsp[-1].string));
  2024.  
  2025.            if (!valid) {
  2026.               const char *const err_str = (state->mode == ARB_vertex)
  2027.                  ? "invalid ARB vertex program option"
  2028.                  : "invalid ARB fragment program option";
  2029.  
  2030.               yyerror(& (yylsp[-1]), state, err_str);
  2031.               YYERROR;
  2032.            }
  2033.         }
  2034. #line 2035 "program/program_parse.tab.c" /* yacc.c:1646  */
  2035.     break;
  2036.  
  2037.   case 10:
  2038. #line 342 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2039.     {
  2040.            if ((yyvsp[-1].inst) != NULL) {
  2041.               if (state->inst_tail == NULL) {
  2042.                  state->inst_head = (yyvsp[-1].inst);
  2043.               } else {
  2044.                  state->inst_tail->next = (yyvsp[-1].inst);
  2045.               }
  2046.  
  2047.               state->inst_tail = (yyvsp[-1].inst);
  2048.               (yyvsp[-1].inst)->next = NULL;
  2049.  
  2050.               state->prog->NumInstructions++;
  2051.            }
  2052.         }
  2053. #line 2054 "program/program_parse.tab.c" /* yacc.c:1646  */
  2054.     break;
  2055.  
  2056.   case 12:
  2057. #line 360 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2058.     {
  2059.            (yyval.inst) = (yyvsp[0].inst);
  2060.            state->prog->NumAluInstructions++;
  2061.         }
  2062. #line 2063 "program/program_parse.tab.c" /* yacc.c:1646  */
  2063.     break;
  2064.  
  2065.   case 13:
  2066. #line 365 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2067.     {
  2068.            (yyval.inst) = (yyvsp[0].inst);
  2069.            state->prog->NumTexInstructions++;
  2070.         }
  2071. #line 2072 "program/program_parse.tab.c" /* yacc.c:1646  */
  2072.     break;
  2073.  
  2074.   case 24:
  2075. #line 386 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2076.     {
  2077.            (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[-2].dst_reg), & (yyvsp[0].src_reg), NULL, NULL);
  2078.         }
  2079. #line 2080 "program/program_parse.tab.c" /* yacc.c:1646  */
  2080.     break;
  2081.  
  2082.   case 25:
  2083. #line 392 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2084.     {
  2085.            if ((yyvsp[-3].temp_inst).Opcode == OPCODE_DDY)
  2086.               state->fragment.UsesDFdy = 1;
  2087.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-3].temp_inst), & (yyvsp[-2].dst_reg), & (yyvsp[0].src_reg), NULL, NULL);
  2088.         }
  2089. #line 2090 "program/program_parse.tab.c" /* yacc.c:1646  */
  2090.     break;
  2091.  
  2092.   case 26:
  2093. #line 400 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2094.     {
  2095.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-3].temp_inst), & (yyvsp[-2].dst_reg), & (yyvsp[0].src_reg), NULL, NULL);
  2096.         }
  2097. #line 2098 "program/program_parse.tab.c" /* yacc.c:1646  */
  2098.     break;
  2099.  
  2100.   case 27:
  2101. #line 406 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2102.     {
  2103.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-5].temp_inst), & (yyvsp[-4].dst_reg), & (yyvsp[-2].src_reg), & (yyvsp[0].src_reg), NULL);
  2104.         }
  2105. #line 2106 "program/program_parse.tab.c" /* yacc.c:1646  */
  2106.     break;
  2107.  
  2108.   case 28:
  2109. #line 413 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2110.     {
  2111.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-5].temp_inst), & (yyvsp[-4].dst_reg), & (yyvsp[-2].src_reg), & (yyvsp[0].src_reg), NULL);
  2112.         }
  2113. #line 2114 "program/program_parse.tab.c" /* yacc.c:1646  */
  2114.     break;
  2115.  
  2116.   case 29:
  2117. #line 420 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2118.     {
  2119.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-7].temp_inst), & (yyvsp[-6].dst_reg), & (yyvsp[-4].src_reg), & (yyvsp[-2].src_reg), & (yyvsp[0].src_reg));
  2120.         }
  2121. #line 2122 "program/program_parse.tab.c" /* yacc.c:1646  */
  2122.     break;
  2123.  
  2124.   case 30:
  2125. #line 426 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2126.     {
  2127.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-7].temp_inst), & (yyvsp[-6].dst_reg), & (yyvsp[-4].src_reg), NULL, NULL);
  2128.            if ((yyval.inst) != NULL) {
  2129.               const GLbitfield tex_mask = (1U << (yyvsp[-2].integer));
  2130.               GLbitfield shadow_tex = 0;
  2131.               GLbitfield target_mask = 0;
  2132.  
  2133.  
  2134.               (yyval.inst)->Base.TexSrcUnit = (yyvsp[-2].integer);
  2135.  
  2136.               if ((yyvsp[0].integer) < 0) {
  2137.                  shadow_tex = tex_mask;
  2138.  
  2139.                  (yyval.inst)->Base.TexSrcTarget = -(yyvsp[0].integer);
  2140.                  (yyval.inst)->Base.TexShadow = 1;
  2141.               } else {
  2142.                  (yyval.inst)->Base.TexSrcTarget = (yyvsp[0].integer);
  2143.               }
  2144.  
  2145.               target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
  2146.  
  2147.               /* If this texture unit was previously accessed and that access
  2148.                * had a different texture target, generate an error.
  2149.                *
  2150.                * If this texture unit was previously accessed and that access
  2151.                * had a different shadow mode, generate an error.
  2152.                */
  2153.               if ((state->prog->TexturesUsed[(yyvsp[-2].integer)] != 0)
  2154.                   && ((state->prog->TexturesUsed[(yyvsp[-2].integer)] != target_mask)
  2155.                       || ((state->prog->ShadowSamplers & tex_mask)
  2156.                           != shadow_tex))) {
  2157.                  yyerror(& (yylsp[0]), state,
  2158.                          "multiple targets used on one texture image unit");
  2159.                  YYERROR;
  2160.               }
  2161.  
  2162.  
  2163.               state->prog->TexturesUsed[(yyvsp[-2].integer)] |= target_mask;
  2164.               state->prog->ShadowSamplers |= shadow_tex;
  2165.            }
  2166.         }
  2167. #line 2168 "program/program_parse.tab.c" /* yacc.c:1646  */
  2168.     break;
  2169.  
  2170.   case 31:
  2171. #line 470 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2172.     {
  2173.            (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[0].src_reg), NULL, NULL);
  2174.            state->fragment.UsesKill = 1;
  2175.         }
  2176. #line 2177 "program/program_parse.tab.c" /* yacc.c:1646  */
  2177.     break;
  2178.  
  2179.   case 32:
  2180. #line 475 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2181.     {
  2182.            (yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
  2183.            (yyval.inst)->Base.DstReg.CondMask = (yyvsp[0].dst_reg).CondMask;
  2184.            (yyval.inst)->Base.DstReg.CondSwizzle = (yyvsp[0].dst_reg).CondSwizzle;
  2185.            state->fragment.UsesKill = 1;
  2186.         }
  2187. #line 2188 "program/program_parse.tab.c" /* yacc.c:1646  */
  2188.     break;
  2189.  
  2190.   case 33:
  2191. #line 484 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2192.     {
  2193.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-11].temp_inst), & (yyvsp[-10].dst_reg), & (yyvsp[-8].src_reg), & (yyvsp[-6].src_reg), & (yyvsp[-4].src_reg));
  2194.            if ((yyval.inst) != NULL) {
  2195.               const GLbitfield tex_mask = (1U << (yyvsp[-2].integer));
  2196.               GLbitfield shadow_tex = 0;
  2197.               GLbitfield target_mask = 0;
  2198.  
  2199.  
  2200.               (yyval.inst)->Base.TexSrcUnit = (yyvsp[-2].integer);
  2201.  
  2202.               if ((yyvsp[0].integer) < 0) {
  2203.                  shadow_tex = tex_mask;
  2204.  
  2205.                  (yyval.inst)->Base.TexSrcTarget = -(yyvsp[0].integer);
  2206.                  (yyval.inst)->Base.TexShadow = 1;
  2207.               } else {
  2208.                  (yyval.inst)->Base.TexSrcTarget = (yyvsp[0].integer);
  2209.               }
  2210.  
  2211.               target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
  2212.  
  2213.               /* If this texture unit was previously accessed and that access
  2214.                * had a different texture target, generate an error.
  2215.                *
  2216.                * If this texture unit was previously accessed and that access
  2217.                * had a different shadow mode, generate an error.
  2218.                */
  2219.               if ((state->prog->TexturesUsed[(yyvsp[-2].integer)] != 0)
  2220.                   && ((state->prog->TexturesUsed[(yyvsp[-2].integer)] != target_mask)
  2221.                       || ((state->prog->ShadowSamplers & tex_mask)
  2222.                           != shadow_tex))) {
  2223.                  yyerror(& (yylsp[0]), state,
  2224.                          "multiple targets used on one texture image unit");
  2225.                  YYERROR;
  2226.               }
  2227.  
  2228.  
  2229.               state->prog->TexturesUsed[(yyvsp[-2].integer)] |= target_mask;
  2230.               state->prog->ShadowSamplers |= shadow_tex;
  2231.            }
  2232.         }
  2233. #line 2234 "program/program_parse.tab.c" /* yacc.c:1646  */
  2234.     break;
  2235.  
  2236.   case 34:
  2237. #line 528 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2238.     {
  2239.            (yyval.integer) = (yyvsp[0].integer);
  2240.         }
  2241. #line 2242 "program/program_parse.tab.c" /* yacc.c:1646  */
  2242.     break;
  2243.  
  2244.   case 35:
  2245. #line 533 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2246.     { (yyval.integer) = TEXTURE_1D_INDEX; }
  2247. #line 2248 "program/program_parse.tab.c" /* yacc.c:1646  */
  2248.     break;
  2249.  
  2250.   case 36:
  2251. #line 534 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2252.     { (yyval.integer) = TEXTURE_2D_INDEX; }
  2253. #line 2254 "program/program_parse.tab.c" /* yacc.c:1646  */
  2254.     break;
  2255.  
  2256.   case 37:
  2257. #line 535 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2258.     { (yyval.integer) = TEXTURE_3D_INDEX; }
  2259. #line 2260 "program/program_parse.tab.c" /* yacc.c:1646  */
  2260.     break;
  2261.  
  2262.   case 38:
  2263. #line 536 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2264.     { (yyval.integer) = TEXTURE_CUBE_INDEX; }
  2265. #line 2266 "program/program_parse.tab.c" /* yacc.c:1646  */
  2266.     break;
  2267.  
  2268.   case 39:
  2269. #line 537 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2270.     { (yyval.integer) = TEXTURE_RECT_INDEX; }
  2271. #line 2272 "program/program_parse.tab.c" /* yacc.c:1646  */
  2272.     break;
  2273.  
  2274.   case 40:
  2275. #line 538 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2276.     { (yyval.integer) = -TEXTURE_1D_INDEX; }
  2277. #line 2278 "program/program_parse.tab.c" /* yacc.c:1646  */
  2278.     break;
  2279.  
  2280.   case 41:
  2281. #line 539 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2282.     { (yyval.integer) = -TEXTURE_2D_INDEX; }
  2283. #line 2284 "program/program_parse.tab.c" /* yacc.c:1646  */
  2284.     break;
  2285.  
  2286.   case 42:
  2287. #line 540 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2288.     { (yyval.integer) = -TEXTURE_RECT_INDEX; }
  2289. #line 2290 "program/program_parse.tab.c" /* yacc.c:1646  */
  2290.     break;
  2291.  
  2292.   case 43:
  2293. #line 541 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2294.     { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; }
  2295. #line 2296 "program/program_parse.tab.c" /* yacc.c:1646  */
  2296.     break;
  2297.  
  2298.   case 44:
  2299. #line 542 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2300.     { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; }
  2301. #line 2302 "program/program_parse.tab.c" /* yacc.c:1646  */
  2302.     break;
  2303.  
  2304.   case 45:
  2305. #line 543 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2306.     { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; }
  2307. #line 2308 "program/program_parse.tab.c" /* yacc.c:1646  */
  2308.     break;
  2309.  
  2310.   case 46:
  2311. #line 544 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2312.     { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; }
  2313. #line 2314 "program/program_parse.tab.c" /* yacc.c:1646  */
  2314.     break;
  2315.  
  2316.   case 47:
  2317. #line 548 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2318.     {
  2319.            /* FIXME: Is this correct?  Should the extenedSwizzle be applied
  2320.             * FIXME: to the existing swizzle?
  2321.             */
  2322.            (yyvsp[-2].src_reg).Base.Swizzle = (yyvsp[0].swiz_mask).swizzle;
  2323.            (yyvsp[-2].src_reg).Base.Negate = (yyvsp[0].swiz_mask).mask;
  2324.  
  2325.            (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[-5].temp_inst), & (yyvsp[-4].dst_reg), & (yyvsp[-2].src_reg), NULL, NULL);
  2326.         }
  2327. #line 2328 "program/program_parse.tab.c" /* yacc.c:1646  */
  2328.     break;
  2329.  
  2330.   case 48:
  2331. #line 560 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2332.     {
  2333.            (yyval.src_reg) = (yyvsp[0].src_reg);
  2334.  
  2335.            if ((yyvsp[-1].negate)) {
  2336.               (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
  2337.            }
  2338.         }
  2339. #line 2340 "program/program_parse.tab.c" /* yacc.c:1646  */
  2340.     break;
  2341.  
  2342.   case 49:
  2343. #line 568 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2344.     {
  2345.            (yyval.src_reg) = (yyvsp[-1].src_reg);
  2346.  
  2347.            if (!state->option.NV_fragment) {
  2348.               yyerror(& (yylsp[-2]), state, "unexpected character '|'");
  2349.               YYERROR;
  2350.            }
  2351.  
  2352.            if ((yyvsp[-3].negate)) {
  2353.               (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
  2354.            }
  2355.  
  2356.            (yyval.src_reg).Base.Abs = 1;
  2357.         }
  2358. #line 2359 "program/program_parse.tab.c" /* yacc.c:1646  */
  2359.     break;
  2360.  
  2361.   case 50:
  2362. #line 585 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2363.     {
  2364.            (yyval.src_reg) = (yyvsp[-1].src_reg);
  2365.  
  2366.            (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
  2367.                                                     (yyvsp[0].swiz_mask).swizzle);
  2368.         }
  2369. #line 2370 "program/program_parse.tab.c" /* yacc.c:1646  */
  2370.     break;
  2371.  
  2372.   case 51:
  2373. #line 592 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2374.     {
  2375.            struct asm_symbol temp_sym;
  2376.  
  2377.            if (!state->option.NV_fragment) {
  2378.               yyerror(& (yylsp[0]), state, "expected scalar suffix");
  2379.               YYERROR;
  2380.            }
  2381.  
  2382.            memset(& temp_sym, 0, sizeof(temp_sym));
  2383.            temp_sym.param_binding_begin = ~0;
  2384.            initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[0].vector), GL_TRUE);
  2385.  
  2386.            set_src_reg_swz(& (yyval.src_reg), PROGRAM_CONSTANT,
  2387.                            temp_sym.param_binding_begin,
  2388.                            temp_sym.param_binding_swizzle);
  2389.         }
  2390. #line 2391 "program/program_parse.tab.c" /* yacc.c:1646  */
  2391.     break;
  2392.  
  2393.   case 52:
  2394. #line 611 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2395.     {
  2396.            (yyval.src_reg) = (yyvsp[-1].src_reg);
  2397.  
  2398.            if ((yyvsp[-2].negate)) {
  2399.               (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
  2400.            }
  2401.  
  2402.            (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
  2403.                                                     (yyvsp[0].swiz_mask).swizzle);
  2404.         }
  2405. #line 2406 "program/program_parse.tab.c" /* yacc.c:1646  */
  2406.     break;
  2407.  
  2408.   case 53:
  2409. #line 622 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2410.     {
  2411.            (yyval.src_reg) = (yyvsp[-2].src_reg);
  2412.  
  2413.            if (!state->option.NV_fragment) {
  2414.               yyerror(& (yylsp[-3]), state, "unexpected character '|'");
  2415.               YYERROR;
  2416.            }
  2417.  
  2418.            if ((yyvsp[-4].negate)) {
  2419.               (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
  2420.            }
  2421.  
  2422.            (yyval.src_reg).Base.Abs = 1;
  2423.            (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
  2424.                                                     (yyvsp[-1].swiz_mask).swizzle);
  2425.         }
  2426. #line 2427 "program/program_parse.tab.c" /* yacc.c:1646  */
  2427.     break;
  2428.  
  2429.   case 54:
  2430. #line 642 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2431.     {
  2432.            (yyval.dst_reg) = (yyvsp[-2].dst_reg);
  2433.            (yyval.dst_reg).WriteMask = (yyvsp[-1].swiz_mask).mask;
  2434.            (yyval.dst_reg).CondMask = (yyvsp[0].dst_reg).CondMask;
  2435.            (yyval.dst_reg).CondSwizzle = (yyvsp[0].dst_reg).CondSwizzle;
  2436.  
  2437.            if ((yyval.dst_reg).File == PROGRAM_OUTPUT) {
  2438.               /* Technically speaking, this should check that it is in
  2439.                * vertex program mode.  However, PositionInvariant can never be
  2440.                * set in fragment program mode, so it is somewhat irrelevant.
  2441.                */
  2442.               if (state->option.PositionInvariant
  2443.                && ((yyval.dst_reg).Index == VARYING_SLOT_POS)) {
  2444.                  yyerror(& (yylsp[-2]), state, "position-invariant programs cannot "
  2445.                          "write position");
  2446.                  YYERROR;
  2447.               }
  2448.  
  2449.               state->prog->OutputsWritten |= BITFIELD64_BIT((yyval.dst_reg).Index);
  2450.            }
  2451.         }
  2452. #line 2453 "program/program_parse.tab.c" /* yacc.c:1646  */
  2453.     break;
  2454.  
  2455.   case 55:
  2456. #line 666 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2457.     {
  2458.            set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0);
  2459.            (yyval.dst_reg).WriteMask = (yyvsp[0].swiz_mask).mask;
  2460.         }
  2461. #line 2462 "program/program_parse.tab.c" /* yacc.c:1646  */
  2462.     break;
  2463.  
  2464.   case 56:
  2465. #line 673 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2466.     {
  2467.            const unsigned xyzw_valid =
  2468.               ((yyvsp[-6].ext_swizzle).xyzw_valid << 0)
  2469.               | ((yyvsp[-4].ext_swizzle).xyzw_valid << 1)
  2470.               | ((yyvsp[-2].ext_swizzle).xyzw_valid << 2)
  2471.               | ((yyvsp[0].ext_swizzle).xyzw_valid << 3);
  2472.            const unsigned rgba_valid =
  2473.               ((yyvsp[-6].ext_swizzle).rgba_valid << 0)
  2474.               | ((yyvsp[-4].ext_swizzle).rgba_valid << 1)
  2475.               | ((yyvsp[-2].ext_swizzle).rgba_valid << 2)
  2476.               | ((yyvsp[0].ext_swizzle).rgba_valid << 3);
  2477.  
  2478.            /* All of the swizzle components have to be valid in either RGBA
  2479.             * or XYZW.  Note that 0 and 1 are valid in both, so both masks
  2480.             * can have some bits set.
  2481.             *
  2482.             * We somewhat deviate from the spec here.  It would be really hard
  2483.             * to figure out which component is the error, and there probably
  2484.             * isn't a lot of benefit.
  2485.             */
  2486.            if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
  2487.               yyerror(& (yylsp[-6]), state, "cannot combine RGBA and XYZW swizzle "
  2488.                       "components");
  2489.               YYERROR;
  2490.            }
  2491.  
  2492.            (yyval.swiz_mask).swizzle = MAKE_SWIZZLE4((yyvsp[-6].ext_swizzle).swz, (yyvsp[-4].ext_swizzle).swz, (yyvsp[-2].ext_swizzle).swz, (yyvsp[0].ext_swizzle).swz);
  2493.            (yyval.swiz_mask).mask = ((yyvsp[-6].ext_swizzle).negate) | ((yyvsp[-4].ext_swizzle).negate << 1) | ((yyvsp[-2].ext_swizzle).negate << 2)
  2494.               | ((yyvsp[0].ext_swizzle).negate << 3);
  2495.         }
  2496. #line 2497 "program/program_parse.tab.c" /* yacc.c:1646  */
  2497.     break;
  2498.  
  2499.   case 57:
  2500. #line 706 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2501.     {
  2502.            (yyval.ext_swizzle) = (yyvsp[0].ext_swizzle);
  2503.            (yyval.ext_swizzle).negate = ((yyvsp[-1].negate)) ? 1 : 0;
  2504.         }
  2505. #line 2506 "program/program_parse.tab.c" /* yacc.c:1646  */
  2506.     break;
  2507.  
  2508.   case 58:
  2509. #line 713 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2510.     {
  2511.            if (((yyvsp[0].integer) != 0) && ((yyvsp[0].integer) != 1)) {
  2512.               yyerror(& (yylsp[0]), state, "invalid extended swizzle selector");
  2513.               YYERROR;
  2514.            }
  2515.  
  2516.            (yyval.ext_swizzle).swz = ((yyvsp[0].integer) == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
  2517.            (yyval.ext_swizzle).negate = 0;
  2518.  
  2519.            /* 0 and 1 are valid for both RGBA swizzle names and XYZW
  2520.             * swizzle names.
  2521.             */
  2522.            (yyval.ext_swizzle).xyzw_valid = 1;
  2523.            (yyval.ext_swizzle).rgba_valid = 1;
  2524.         }
  2525. #line 2526 "program/program_parse.tab.c" /* yacc.c:1646  */
  2526.     break;
  2527.  
  2528.   case 59:
  2529. #line 729 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2530.     {
  2531.            char s;
  2532.  
  2533.            if (strlen((yyvsp[0].string)) > 1) {
  2534.               yyerror(& (yylsp[0]), state, "invalid extended swizzle selector");
  2535.               YYERROR;
  2536.            }
  2537.  
  2538.            s = (yyvsp[0].string)[0];
  2539.            free((yyvsp[0].string));
  2540.  
  2541.            (yyval.ext_swizzle).rgba_valid = 0;
  2542.            (yyval.ext_swizzle).xyzw_valid = 0;
  2543.            (yyval.ext_swizzle).negate = 0;
  2544.  
  2545.            switch (s) {
  2546.            case 'x':
  2547.               (yyval.ext_swizzle).swz = SWIZZLE_X;
  2548.               (yyval.ext_swizzle).xyzw_valid = 1;
  2549.               break;
  2550.            case 'y':
  2551.               (yyval.ext_swizzle).swz = SWIZZLE_Y;
  2552.               (yyval.ext_swizzle).xyzw_valid = 1;
  2553.               break;
  2554.            case 'z':
  2555.               (yyval.ext_swizzle).swz = SWIZZLE_Z;
  2556.               (yyval.ext_swizzle).xyzw_valid = 1;
  2557.               break;
  2558.            case 'w':
  2559.               (yyval.ext_swizzle).swz = SWIZZLE_W;
  2560.               (yyval.ext_swizzle).xyzw_valid = 1;
  2561.               break;
  2562.  
  2563.            case 'r':
  2564.               (yyval.ext_swizzle).swz = SWIZZLE_X;
  2565.               (yyval.ext_swizzle).rgba_valid = 1;
  2566.               break;
  2567.            case 'g':
  2568.               (yyval.ext_swizzle).swz = SWIZZLE_Y;
  2569.               (yyval.ext_swizzle).rgba_valid = 1;
  2570.               break;
  2571.            case 'b':
  2572.               (yyval.ext_swizzle).swz = SWIZZLE_Z;
  2573.               (yyval.ext_swizzle).rgba_valid = 1;
  2574.               break;
  2575.            case 'a':
  2576.               (yyval.ext_swizzle).swz = SWIZZLE_W;
  2577.               (yyval.ext_swizzle).rgba_valid = 1;
  2578.               break;
  2579.  
  2580.            default:
  2581.               yyerror(& (yylsp[0]), state, "invalid extended swizzle selector");
  2582.               YYERROR;
  2583.               break;
  2584.            }
  2585.         }
  2586. #line 2587 "program/program_parse.tab.c" /* yacc.c:1646  */
  2587.     break;
  2588.  
  2589.   case 60:
  2590. #line 788 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2591.     {
  2592.            struct asm_symbol *const s = (struct asm_symbol *)
  2593.               _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[0].string));
  2594.  
  2595.            free((yyvsp[0].string));
  2596.  
  2597.            if (s == NULL) {
  2598.               yyerror(& (yylsp[0]), state, "invalid operand variable");
  2599.               YYERROR;
  2600.            } else if ((s->type != at_param) && (s->type != at_temp)
  2601.                       && (s->type != at_attrib)) {
  2602.               yyerror(& (yylsp[0]), state, "invalid operand variable");
  2603.               YYERROR;
  2604.            } else if ((s->type == at_param) && s->param_is_array) {
  2605.               yyerror(& (yylsp[0]), state, "non-array access to array PARAM");
  2606.               YYERROR;
  2607.            }
  2608.  
  2609.            init_src_reg(& (yyval.src_reg));
  2610.            switch (s->type) {
  2611.            case at_temp:
  2612.               set_src_reg(& (yyval.src_reg), PROGRAM_TEMPORARY, s->temp_binding);
  2613.               break;
  2614.            case at_param:
  2615.               set_src_reg_swz(& (yyval.src_reg), s->param_binding_type,
  2616.                               s->param_binding_begin,
  2617.                               s->param_binding_swizzle);
  2618.               break;
  2619.            case at_attrib:
  2620.               set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, s->attrib_binding);
  2621.               state->prog->InputsRead |= BITFIELD64_BIT((yyval.src_reg).Base.Index);
  2622.  
  2623.               if (!validate_inputs(& (yylsp[0]), state)) {
  2624.                  YYERROR;
  2625.               }
  2626.               break;
  2627.  
  2628.            default:
  2629.               YYERROR;
  2630.               break;
  2631.            }
  2632.         }
  2633. #line 2634 "program/program_parse.tab.c" /* yacc.c:1646  */
  2634.     break;
  2635.  
  2636.   case 61:
  2637. #line 831 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2638.     {
  2639.            set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[0].attrib));
  2640.            state->prog->InputsRead |= BITFIELD64_BIT((yyval.src_reg).Base.Index);
  2641.  
  2642.            if (!validate_inputs(& (yylsp[0]), state)) {
  2643.               YYERROR;
  2644.            }
  2645.         }
  2646. #line 2647 "program/program_parse.tab.c" /* yacc.c:1646  */
  2647.     break;
  2648.  
  2649.   case 62:
  2650. #line 840 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2651.     {
  2652.            if (! (yyvsp[-1].src_reg).Base.RelAddr
  2653.                && ((unsigned) (yyvsp[-1].src_reg).Base.Index >= (yyvsp[-3].sym)->param_binding_length)) {
  2654.               yyerror(& (yylsp[-1]), state, "out of bounds array access");
  2655.               YYERROR;
  2656.            }
  2657.  
  2658.            init_src_reg(& (yyval.src_reg));
  2659.            (yyval.src_reg).Base.File = (yyvsp[-3].sym)->param_binding_type;
  2660.  
  2661.            if ((yyvsp[-1].src_reg).Base.RelAddr) {
  2662.               state->prog->IndirectRegisterFiles |= (1 << (yyval.src_reg).Base.File);
  2663.               (yyvsp[-3].sym)->param_accessed_indirectly = 1;
  2664.  
  2665.               (yyval.src_reg).Base.RelAddr = 1;
  2666.               (yyval.src_reg).Base.Index = (yyvsp[-1].src_reg).Base.Index;
  2667.               (yyval.src_reg).Symbol = (yyvsp[-3].sym);
  2668.            } else {
  2669.               (yyval.src_reg).Base.Index = (yyvsp[-3].sym)->param_binding_begin + (yyvsp[-1].src_reg).Base.Index;
  2670.            }
  2671.         }
  2672. #line 2673 "program/program_parse.tab.c" /* yacc.c:1646  */
  2673.     break;
  2674.  
  2675.   case 63:
  2676. #line 862 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2677.     {
  2678.            gl_register_file file = ((yyvsp[0].temp_sym).name != NULL)
  2679.               ? (yyvsp[0].temp_sym).param_binding_type
  2680.               : PROGRAM_CONSTANT;
  2681.            set_src_reg_swz(& (yyval.src_reg), file, (yyvsp[0].temp_sym).param_binding_begin,
  2682.                            (yyvsp[0].temp_sym).param_binding_swizzle);
  2683.         }
  2684. #line 2685 "program/program_parse.tab.c" /* yacc.c:1646  */
  2685.     break;
  2686.  
  2687.   case 64:
  2688. #line 872 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2689.     {
  2690.            set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[0].result));
  2691.         }
  2692. #line 2693 "program/program_parse.tab.c" /* yacc.c:1646  */
  2693.     break;
  2694.  
  2695.   case 65:
  2696. #line 876 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2697.     {
  2698.            struct asm_symbol *const s = (struct asm_symbol *)
  2699.               _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[0].string));
  2700.  
  2701.            free((yyvsp[0].string));
  2702.  
  2703.            if (s == NULL) {
  2704.               yyerror(& (yylsp[0]), state, "invalid operand variable");
  2705.               YYERROR;
  2706.            } else if ((s->type != at_output) && (s->type != at_temp)) {
  2707.               yyerror(& (yylsp[0]), state, "invalid operand variable");
  2708.               YYERROR;
  2709.            }
  2710.  
  2711.            switch (s->type) {
  2712.            case at_temp:
  2713.               set_dst_reg(& (yyval.dst_reg), PROGRAM_TEMPORARY, s->temp_binding);
  2714.               break;
  2715.            case at_output:
  2716.               set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, s->output_binding);
  2717.               break;
  2718.            default:
  2719.               set_dst_reg(& (yyval.dst_reg), s->param_binding_type, s->param_binding_begin);
  2720.               break;
  2721.            }
  2722.         }
  2723. #line 2724 "program/program_parse.tab.c" /* yacc.c:1646  */
  2724.     break;
  2725.  
  2726.   case 66:
  2727. #line 905 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2728.     {
  2729.            struct asm_symbol *const s = (struct asm_symbol *)
  2730.               _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[0].string));
  2731.  
  2732.            free((yyvsp[0].string));
  2733.  
  2734.            if (s == NULL) {
  2735.               yyerror(& (yylsp[0]), state, "invalid operand variable");
  2736.               YYERROR;
  2737.            } else if ((s->type != at_param) || !s->param_is_array) {
  2738.               yyerror(& (yylsp[0]), state, "array access to non-PARAM variable");
  2739.               YYERROR;
  2740.            } else {
  2741.               (yyval.sym) = s;
  2742.            }
  2743.         }
  2744. #line 2745 "program/program_parse.tab.c" /* yacc.c:1646  */
  2745.     break;
  2746.  
  2747.   case 69:
  2748. #line 926 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2749.     {
  2750.            init_src_reg(& (yyval.src_reg));
  2751.            (yyval.src_reg).Base.Index = (yyvsp[0].integer);
  2752.         }
  2753. #line 2754 "program/program_parse.tab.c" /* yacc.c:1646  */
  2754.     break;
  2755.  
  2756.   case 70:
  2757. #line 933 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2758.     {
  2759.            /* FINISHME: Add support for multiple address registers.
  2760.             */
  2761.            /* FINISHME: Add support for 4-component address registers.
  2762.             */
  2763.            init_src_reg(& (yyval.src_reg));
  2764.            (yyval.src_reg).Base.RelAddr = 1;
  2765.            (yyval.src_reg).Base.Index = (yyvsp[0].integer);
  2766.         }
  2767. #line 2768 "program/program_parse.tab.c" /* yacc.c:1646  */
  2768.     break;
  2769.  
  2770.   case 71:
  2771. #line 944 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2772.     { (yyval.integer) = 0; }
  2773. #line 2774 "program/program_parse.tab.c" /* yacc.c:1646  */
  2774.     break;
  2775.  
  2776.   case 72:
  2777. #line 945 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2778.     { (yyval.integer) = (yyvsp[0].integer); }
  2779. #line 2780 "program/program_parse.tab.c" /* yacc.c:1646  */
  2780.     break;
  2781.  
  2782.   case 73:
  2783. #line 946 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2784.     { (yyval.integer) = -(yyvsp[0].integer); }
  2785. #line 2786 "program/program_parse.tab.c" /* yacc.c:1646  */
  2786.     break;
  2787.  
  2788.   case 74:
  2789. #line 950 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2790.     {
  2791.            if (((yyvsp[0].integer) < 0) || ((yyvsp[0].integer) > (state->limits->MaxAddressOffset - 1))) {
  2792.               char s[100];
  2793.               _mesa_snprintf(s, sizeof(s),
  2794.                              "relative address offset too large (%d)", (yyvsp[0].integer));
  2795.               yyerror(& (yylsp[0]), state, s);
  2796.               YYERROR;
  2797.            } else {
  2798.               (yyval.integer) = (yyvsp[0].integer);
  2799.            }
  2800.         }
  2801. #line 2802 "program/program_parse.tab.c" /* yacc.c:1646  */
  2802.     break;
  2803.  
  2804.   case 75:
  2805. #line 964 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2806.     {
  2807.            if (((yyvsp[0].integer) < 0) || ((yyvsp[0].integer) > state->limits->MaxAddressOffset)) {
  2808.               char s[100];
  2809.               _mesa_snprintf(s, sizeof(s),
  2810.                              "relative address offset too large (%d)", (yyvsp[0].integer));
  2811.               yyerror(& (yylsp[0]), state, s);
  2812.               YYERROR;
  2813.            } else {
  2814.               (yyval.integer) = (yyvsp[0].integer);
  2815.            }
  2816.         }
  2817. #line 2818 "program/program_parse.tab.c" /* yacc.c:1646  */
  2818.     break;
  2819.  
  2820.   case 76:
  2821. #line 978 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2822.     {
  2823.            struct asm_symbol *const s = (struct asm_symbol *)
  2824.               _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[0].string));
  2825.  
  2826.            free((yyvsp[0].string));
  2827.  
  2828.            if (s == NULL) {
  2829.               yyerror(& (yylsp[0]), state, "invalid array member");
  2830.               YYERROR;
  2831.            } else if (s->type != at_address) {
  2832.               yyerror(& (yylsp[0]), state,
  2833.                       "invalid variable for indexed array access");
  2834.               YYERROR;
  2835.            } else {
  2836.               (yyval.sym) = s;
  2837.            }
  2838.         }
  2839. #line 2840 "program/program_parse.tab.c" /* yacc.c:1646  */
  2840.     break;
  2841.  
  2842.   case 77:
  2843. #line 998 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2844.     {
  2845.            if ((yyvsp[0].swiz_mask).mask != WRITEMASK_X) {
  2846.               yyerror(& (yylsp[0]), state, "invalid address component selector");
  2847.               YYERROR;
  2848.            } else {
  2849.               (yyval.swiz_mask) = (yyvsp[0].swiz_mask);
  2850.            }
  2851.         }
  2852. #line 2853 "program/program_parse.tab.c" /* yacc.c:1646  */
  2853.     break;
  2854.  
  2855.   case 78:
  2856. #line 1009 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2857.     {
  2858.            if ((yyvsp[0].swiz_mask).mask != WRITEMASK_X) {
  2859.               yyerror(& (yylsp[0]), state,
  2860.                       "address register write mask must be \".x\"");
  2861.               YYERROR;
  2862.            } else {
  2863.               (yyval.swiz_mask) = (yyvsp[0].swiz_mask);
  2864.            }
  2865.         }
  2866. #line 2867 "program/program_parse.tab.c" /* yacc.c:1646  */
  2867.     break;
  2868.  
  2869.   case 83:
  2870. #line 1025 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2871.     { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; }
  2872. #line 2873 "program/program_parse.tab.c" /* yacc.c:1646  */
  2873.     break;
  2874.  
  2875.   case 88:
  2876. #line 1029 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2877.     { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; }
  2878. #line 2879 "program/program_parse.tab.c" /* yacc.c:1646  */
  2879.     break;
  2880.  
  2881.   case 89:
  2882. #line 1033 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2883.     {
  2884.            (yyval.dst_reg) = (yyvsp[-1].dst_reg);
  2885.         }
  2886. #line 2887 "program/program_parse.tab.c" /* yacc.c:1646  */
  2887.     break;
  2888.  
  2889.   case 90:
  2890. #line 1037 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2891.     {
  2892.            (yyval.dst_reg) = (yyvsp[-1].dst_reg);
  2893.         }
  2894. #line 2895 "program/program_parse.tab.c" /* yacc.c:1646  */
  2895.     break;
  2896.  
  2897.   case 91:
  2898. #line 1041 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2899.     {
  2900.            (yyval.dst_reg).CondMask = COND_TR;
  2901.            (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
  2902.         }
  2903. #line 2904 "program/program_parse.tab.c" /* yacc.c:1646  */
  2904.     break;
  2905.  
  2906.   case 92:
  2907. #line 1048 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2908.     {
  2909.            (yyval.dst_reg) = (yyvsp[-1].dst_reg);
  2910.            (yyval.dst_reg).CondSwizzle = (yyvsp[0].swiz_mask).swizzle;
  2911.         }
  2912. #line 2913 "program/program_parse.tab.c" /* yacc.c:1646  */
  2913.     break;
  2914.  
  2915.   case 93:
  2916. #line 1055 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2917.     {
  2918.            (yyval.dst_reg) = (yyvsp[-1].dst_reg);
  2919.            (yyval.dst_reg).CondSwizzle = (yyvsp[0].swiz_mask).swizzle;
  2920.         }
  2921. #line 2922 "program/program_parse.tab.c" /* yacc.c:1646  */
  2922.     break;
  2923.  
  2924.   case 94:
  2925. #line 1062 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2926.     {
  2927.            const int cond = _mesa_parse_cc((yyvsp[0].string));
  2928.            if ((cond == 0) || ((yyvsp[0].string)[2] != '\0')) {
  2929.               char *const err_str =
  2930.                  make_error_string("invalid condition code \"%s\"", (yyvsp[0].string));
  2931.  
  2932.               yyerror(& (yylsp[0]), state, (err_str != NULL)
  2933.                       ? err_str : "invalid condition code");
  2934.  
  2935.               if (err_str != NULL) {
  2936.                  free(err_str);
  2937.               }
  2938.  
  2939.               YYERROR;
  2940.            }
  2941.  
  2942.            (yyval.dst_reg).CondMask = cond;
  2943.            (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
  2944.         }
  2945. #line 2946 "program/program_parse.tab.c" /* yacc.c:1646  */
  2946.     break;
  2947.  
  2948.   case 95:
  2949. #line 1084 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2950.     {
  2951.            const int cond = _mesa_parse_cc((yyvsp[0].string));
  2952.            if ((cond == 0) || ((yyvsp[0].string)[2] != '\0')) {
  2953.               char *const err_str =
  2954.                  make_error_string("invalid condition code \"%s\"", (yyvsp[0].string));
  2955.  
  2956.               yyerror(& (yylsp[0]), state, (err_str != NULL)
  2957.                       ? err_str : "invalid condition code");
  2958.  
  2959.               if (err_str != NULL) {
  2960.                  free(err_str);
  2961.               }
  2962.  
  2963.               YYERROR;
  2964.            }
  2965.  
  2966.            (yyval.dst_reg).CondMask = cond;
  2967.            (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
  2968.         }
  2969. #line 2970 "program/program_parse.tab.c" /* yacc.c:1646  */
  2970.     break;
  2971.  
  2972.   case 102:
  2973. #line 1114 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2974.     {
  2975.            struct asm_symbol *const s =
  2976.               declare_variable(state, (yyvsp[-2].string), at_attrib, & (yylsp[-2]));
  2977.  
  2978.            if (s == NULL) {
  2979.               free((yyvsp[-2].string));
  2980.               YYERROR;
  2981.            } else {
  2982.               s->attrib_binding = (yyvsp[0].attrib);
  2983.               state->InputsBound |= BITFIELD64_BIT(s->attrib_binding);
  2984.  
  2985.               if (!validate_inputs(& (yylsp[0]), state)) {
  2986.                  YYERROR;
  2987.               }
  2988.            }
  2989.         }
  2990. #line 2991 "program/program_parse.tab.c" /* yacc.c:1646  */
  2991.     break;
  2992.  
  2993.   case 103:
  2994. #line 1133 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  2995.     {
  2996.            (yyval.attrib) = (yyvsp[0].attrib);
  2997.         }
  2998. #line 2999 "program/program_parse.tab.c" /* yacc.c:1646  */
  2999.     break;
  3000.  
  3001.   case 104:
  3002. #line 1137 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3003.     {
  3004.            (yyval.attrib) = (yyvsp[0].attrib);
  3005.         }
  3006. #line 3007 "program/program_parse.tab.c" /* yacc.c:1646  */
  3007.     break;
  3008.  
  3009.   case 105:
  3010. #line 1143 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3011.     {
  3012.            (yyval.attrib) = VERT_ATTRIB_POS;
  3013.         }
  3014. #line 3015 "program/program_parse.tab.c" /* yacc.c:1646  */
  3015.     break;
  3016.  
  3017.   case 106:
  3018. #line 1147 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3019.     {
  3020.            (yyval.attrib) = VERT_ATTRIB_WEIGHT;
  3021.         }
  3022. #line 3023 "program/program_parse.tab.c" /* yacc.c:1646  */
  3023.     break;
  3024.  
  3025.   case 107:
  3026. #line 1151 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3027.     {
  3028.            (yyval.attrib) = VERT_ATTRIB_NORMAL;
  3029.         }
  3030. #line 3031 "program/program_parse.tab.c" /* yacc.c:1646  */
  3031.     break;
  3032.  
  3033.   case 108:
  3034. #line 1155 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3035.     {
  3036.            (yyval.attrib) = VERT_ATTRIB_COLOR0 + (yyvsp[0].integer);
  3037.         }
  3038. #line 3039 "program/program_parse.tab.c" /* yacc.c:1646  */
  3039.     break;
  3040.  
  3041.   case 109:
  3042. #line 1159 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3043.     {
  3044.            (yyval.attrib) = VERT_ATTRIB_FOG;
  3045.         }
  3046. #line 3047 "program/program_parse.tab.c" /* yacc.c:1646  */
  3047.     break;
  3048.  
  3049.   case 110:
  3050. #line 1163 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3051.     {
  3052.            (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[0].integer);
  3053.         }
  3054. #line 3055 "program/program_parse.tab.c" /* yacc.c:1646  */
  3055.     break;
  3056.  
  3057.   case 111:
  3058. #line 1167 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3059.     {
  3060.            yyerror(& (yylsp[-3]), state, "GL_ARB_matrix_palette not supported");
  3061.            YYERROR;
  3062.         }
  3063. #line 3064 "program/program_parse.tab.c" /* yacc.c:1646  */
  3064.     break;
  3065.  
  3066.   case 112:
  3067. #line 1172 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3068.     {
  3069.            (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[-1].integer);
  3070.         }
  3071. #line 3072 "program/program_parse.tab.c" /* yacc.c:1646  */
  3072.     break;
  3073.  
  3074.   case 113:
  3075. #line 1178 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3076.     {
  3077.            if ((unsigned) (yyvsp[0].integer) >= state->limits->MaxAttribs) {
  3078.               yyerror(& (yylsp[0]), state, "invalid vertex attribute reference");
  3079.               YYERROR;
  3080.            }
  3081.  
  3082.            (yyval.integer) = (yyvsp[0].integer);
  3083.         }
  3084. #line 3085 "program/program_parse.tab.c" /* yacc.c:1646  */
  3085.     break;
  3086.  
  3087.   case 117:
  3088. #line 1192 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3089.     {
  3090.            (yyval.attrib) = VARYING_SLOT_POS;
  3091.         }
  3092. #line 3093 "program/program_parse.tab.c" /* yacc.c:1646  */
  3093.     break;
  3094.  
  3095.   case 118:
  3096. #line 1196 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3097.     {
  3098.            (yyval.attrib) = VARYING_SLOT_COL0 + (yyvsp[0].integer);
  3099.         }
  3100. #line 3101 "program/program_parse.tab.c" /* yacc.c:1646  */
  3101.     break;
  3102.  
  3103.   case 119:
  3104. #line 1200 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3105.     {
  3106.            (yyval.attrib) = VARYING_SLOT_FOGC;
  3107.         }
  3108. #line 3109 "program/program_parse.tab.c" /* yacc.c:1646  */
  3109.     break;
  3110.  
  3111.   case 120:
  3112. #line 1204 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3113.     {
  3114.            (yyval.attrib) = VARYING_SLOT_TEX0 + (yyvsp[0].integer);
  3115.         }
  3116. #line 3117 "program/program_parse.tab.c" /* yacc.c:1646  */
  3117.     break;
  3118.  
  3119.   case 123:
  3120. #line 1212 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3121.     {
  3122.            struct asm_symbol *const s =
  3123.               declare_variable(state, (yyvsp[-1].string), at_param, & (yylsp[-1]));
  3124.  
  3125.            if (s == NULL) {
  3126.               free((yyvsp[-1].string));
  3127.               YYERROR;
  3128.            } else {
  3129.               s->param_binding_type = (yyvsp[0].temp_sym).param_binding_type;
  3130.               s->param_binding_begin = (yyvsp[0].temp_sym).param_binding_begin;
  3131.               s->param_binding_length = (yyvsp[0].temp_sym).param_binding_length;
  3132.               s->param_binding_swizzle = (yyvsp[0].temp_sym).param_binding_swizzle;
  3133.               s->param_is_array = 0;
  3134.            }
  3135.         }
  3136. #line 3137 "program/program_parse.tab.c" /* yacc.c:1646  */
  3137.     break;
  3138.  
  3139.   case 124:
  3140. #line 1230 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3141.     {
  3142.            if (((yyvsp[-2].integer) != 0) && ((unsigned) (yyvsp[-2].integer) != (yyvsp[0].temp_sym).param_binding_length)) {
  3143.               free((yyvsp[-4].string));
  3144.               yyerror(& (yylsp[-2]), state,
  3145.                       "parameter array size and number of bindings must match");
  3146.               YYERROR;
  3147.            } else {
  3148.               struct asm_symbol *const s =
  3149.                  declare_variable(state, (yyvsp[-4].string), (yyvsp[0].temp_sym).type, & (yylsp[-4]));
  3150.  
  3151.               if (s == NULL) {
  3152.                  free((yyvsp[-4].string));
  3153.                  YYERROR;
  3154.               } else {
  3155.                  s->param_binding_type = (yyvsp[0].temp_sym).param_binding_type;
  3156.                  s->param_binding_begin = (yyvsp[0].temp_sym).param_binding_begin;
  3157.                  s->param_binding_length = (yyvsp[0].temp_sym).param_binding_length;
  3158.                  s->param_binding_swizzle = SWIZZLE_XYZW;
  3159.                  s->param_is_array = 1;
  3160.               }
  3161.            }
  3162.         }
  3163. #line 3164 "program/program_parse.tab.c" /* yacc.c:1646  */
  3164.     break;
  3165.  
  3166.   case 125:
  3167. #line 1255 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3168.     {
  3169.            (yyval.integer) = 0;
  3170.         }
  3171. #line 3172 "program/program_parse.tab.c" /* yacc.c:1646  */
  3172.     break;
  3173.  
  3174.   case 126:
  3175. #line 1259 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3176.     {
  3177.            if (((yyvsp[0].integer) < 1) || ((unsigned) (yyvsp[0].integer) > state->limits->MaxParameters)) {
  3178.               char msg[100];
  3179.               _mesa_snprintf(msg, sizeof(msg),
  3180.                              "invalid parameter array size (size=%d max=%u)",
  3181.                              (yyvsp[0].integer), state->limits->MaxParameters);
  3182.               yyerror(& (yylsp[0]), state, msg);
  3183.               YYERROR;
  3184.            } else {
  3185.               (yyval.integer) = (yyvsp[0].integer);
  3186.            }
  3187.         }
  3188. #line 3189 "program/program_parse.tab.c" /* yacc.c:1646  */
  3189.     break;
  3190.  
  3191.   case 127:
  3192. #line 1274 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3193.     {
  3194.            (yyval.temp_sym) = (yyvsp[0].temp_sym);
  3195.         }
  3196. #line 3197 "program/program_parse.tab.c" /* yacc.c:1646  */
  3197.     break;
  3198.  
  3199.   case 128:
  3200. #line 1280 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3201.     {
  3202.            (yyval.temp_sym) = (yyvsp[-1].temp_sym);
  3203.         }
  3204. #line 3205 "program/program_parse.tab.c" /* yacc.c:1646  */
  3205.     break;
  3206.  
  3207.   case 130:
  3208. #line 1287 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3209.     {
  3210.            (yyvsp[-2].temp_sym).param_binding_length += (yyvsp[0].temp_sym).param_binding_length;
  3211.            (yyval.temp_sym) = (yyvsp[-2].temp_sym);
  3212.         }
  3213. #line 3214 "program/program_parse.tab.c" /* yacc.c:1646  */
  3214.     break;
  3215.  
  3216.   case 131:
  3217. #line 1294 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3218.     {
  3219.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3220.            (yyval.temp_sym).param_binding_begin = ~0;
  3221.            initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[0].state));
  3222.         }
  3223. #line 3224 "program/program_parse.tab.c" /* yacc.c:1646  */
  3224.     break;
  3225.  
  3226.   case 132:
  3227. #line 1300 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3228.     {
  3229.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3230.            (yyval.temp_sym).param_binding_begin = ~0;
  3231.            initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[0].state));
  3232.         }
  3233. #line 3234 "program/program_parse.tab.c" /* yacc.c:1646  */
  3234.     break;
  3235.  
  3236.   case 133:
  3237. #line 1306 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3238.     {
  3239.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3240.            (yyval.temp_sym).param_binding_begin = ~0;
  3241.            initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[0].vector), GL_TRUE);
  3242.         }
  3243. #line 3244 "program/program_parse.tab.c" /* yacc.c:1646  */
  3244.     break;
  3245.  
  3246.   case 134:
  3247. #line 1314 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3248.     {
  3249.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3250.            (yyval.temp_sym).param_binding_begin = ~0;
  3251.            initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[0].state));
  3252.         }
  3253. #line 3254 "program/program_parse.tab.c" /* yacc.c:1646  */
  3254.     break;
  3255.  
  3256.   case 135:
  3257. #line 1320 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3258.     {
  3259.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3260.            (yyval.temp_sym).param_binding_begin = ~0;
  3261.            initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[0].state));
  3262.         }
  3263. #line 3264 "program/program_parse.tab.c" /* yacc.c:1646  */
  3264.     break;
  3265.  
  3266.   case 136:
  3267. #line 1326 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3268.     {
  3269.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3270.            (yyval.temp_sym).param_binding_begin = ~0;
  3271.            initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[0].vector), GL_TRUE);
  3272.         }
  3273. #line 3274 "program/program_parse.tab.c" /* yacc.c:1646  */
  3274.     break;
  3275.  
  3276.   case 137:
  3277. #line 1334 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3278.     {
  3279.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3280.            (yyval.temp_sym).param_binding_begin = ~0;
  3281.            initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[0].state));
  3282.         }
  3283. #line 3284 "program/program_parse.tab.c" /* yacc.c:1646  */
  3284.     break;
  3285.  
  3286.   case 138:
  3287. #line 1340 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3288.     {
  3289.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3290.            (yyval.temp_sym).param_binding_begin = ~0;
  3291.            initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[0].state));
  3292.         }
  3293. #line 3294 "program/program_parse.tab.c" /* yacc.c:1646  */
  3294.     break;
  3295.  
  3296.   case 139:
  3297. #line 1346 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3298.     {
  3299.            memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
  3300.            (yyval.temp_sym).param_binding_begin = ~0;
  3301.            initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[0].vector), GL_FALSE);
  3302.         }
  3303. #line 3304 "program/program_parse.tab.c" /* yacc.c:1646  */
  3304.     break;
  3305.  
  3306.   case 140:
  3307. #line 1353 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3308.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3309. #line 3310 "program/program_parse.tab.c" /* yacc.c:1646  */
  3310.     break;
  3311.  
  3312.   case 141:
  3313. #line 1354 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3314.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3315. #line 3316 "program/program_parse.tab.c" /* yacc.c:1646  */
  3316.     break;
  3317.  
  3318.   case 142:
  3319. #line 1357 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3320.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3321. #line 3322 "program/program_parse.tab.c" /* yacc.c:1646  */
  3322.     break;
  3323.  
  3324.   case 143:
  3325. #line 1358 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3326.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3327. #line 3328 "program/program_parse.tab.c" /* yacc.c:1646  */
  3328.     break;
  3329.  
  3330.   case 144:
  3331. #line 1359 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3332.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3333. #line 3334 "program/program_parse.tab.c" /* yacc.c:1646  */
  3334.     break;
  3335.  
  3336.   case 145:
  3337. #line 1360 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3338.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3339. #line 3340 "program/program_parse.tab.c" /* yacc.c:1646  */
  3340.     break;
  3341.  
  3342.   case 146:
  3343. #line 1361 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3344.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3345. #line 3346 "program/program_parse.tab.c" /* yacc.c:1646  */
  3346.     break;
  3347.  
  3348.   case 147:
  3349. #line 1362 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3350.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3351. #line 3352 "program/program_parse.tab.c" /* yacc.c:1646  */
  3352.     break;
  3353.  
  3354.   case 148:
  3355. #line 1363 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3356.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3357. #line 3358 "program/program_parse.tab.c" /* yacc.c:1646  */
  3358.     break;
  3359.  
  3360.   case 149:
  3361. #line 1364 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3362.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3363. #line 3364 "program/program_parse.tab.c" /* yacc.c:1646  */
  3364.     break;
  3365.  
  3366.   case 150:
  3367. #line 1365 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3368.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3369. #line 3370 "program/program_parse.tab.c" /* yacc.c:1646  */
  3370.     break;
  3371.  
  3372.   case 151:
  3373. #line 1366 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3374.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3375. #line 3376 "program/program_parse.tab.c" /* yacc.c:1646  */
  3376.     break;
  3377.  
  3378.   case 152:
  3379. #line 1367 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3380.     { memcpy((yyval.state), (yyvsp[0].state), sizeof((yyval.state))); }
  3381. #line 3382 "program/program_parse.tab.c" /* yacc.c:1646  */
  3382.     break;
  3383.  
  3384.   case 153:
  3385. #line 1371 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3386.     {
  3387.            memset((yyval.state), 0, sizeof((yyval.state)));
  3388.            (yyval.state)[0] = STATE_MATERIAL;
  3389.            (yyval.state)[1] = (yyvsp[-1].integer);
  3390.            (yyval.state)[2] = (yyvsp[0].integer);
  3391.         }
  3392. #line 3393 "program/program_parse.tab.c" /* yacc.c:1646  */
  3393.     break;
  3394.  
  3395.   case 154:
  3396. #line 1380 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3397.     {
  3398.            (yyval.integer) = (yyvsp[0].integer);
  3399.         }
  3400. #line 3401 "program/program_parse.tab.c" /* yacc.c:1646  */
  3401.     break;
  3402.  
  3403.   case 155:
  3404. #line 1384 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3405.     {
  3406.            (yyval.integer) = STATE_EMISSION;
  3407.         }
  3408. #line 3409 "program/program_parse.tab.c" /* yacc.c:1646  */
  3409.     break;
  3410.  
  3411.   case 156:
  3412. #line 1388 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3413.     {
  3414.            (yyval.integer) = STATE_SHININESS;
  3415.         }
  3416. #line 3417 "program/program_parse.tab.c" /* yacc.c:1646  */
  3417.     break;
  3418.  
  3419.   case 157:
  3420. #line 1394 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3421.     {
  3422.            memset((yyval.state), 0, sizeof((yyval.state)));
  3423.            (yyval.state)[0] = STATE_LIGHT;
  3424.            (yyval.state)[1] = (yyvsp[-2].integer);
  3425.            (yyval.state)[2] = (yyvsp[0].integer);
  3426.         }
  3427. #line 3428 "program/program_parse.tab.c" /* yacc.c:1646  */
  3428.     break;
  3429.  
  3430.   case 158:
  3431. #line 1403 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3432.     {
  3433.            (yyval.integer) = (yyvsp[0].integer);
  3434.         }
  3435. #line 3436 "program/program_parse.tab.c" /* yacc.c:1646  */
  3436.     break;
  3437.  
  3438.   case 159:
  3439. #line 1407 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3440.     {
  3441.            (yyval.integer) = STATE_POSITION;
  3442.         }
  3443. #line 3444 "program/program_parse.tab.c" /* yacc.c:1646  */
  3444.     break;
  3445.  
  3446.   case 160:
  3447. #line 1411 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3448.     {
  3449.            if (!state->ctx->Extensions.EXT_point_parameters) {
  3450.               yyerror(& (yylsp[0]), state, "GL_ARB_point_parameters not supported");
  3451.               YYERROR;
  3452.            }
  3453.  
  3454.            (yyval.integer) = STATE_ATTENUATION;
  3455.         }
  3456. #line 3457 "program/program_parse.tab.c" /* yacc.c:1646  */
  3457.     break;
  3458.  
  3459.   case 161:
  3460. #line 1420 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3461.     {
  3462.            (yyval.integer) = (yyvsp[0].integer);
  3463.         }
  3464. #line 3465 "program/program_parse.tab.c" /* yacc.c:1646  */
  3465.     break;
  3466.  
  3467.   case 162:
  3468. #line 1424 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3469.     {
  3470.            (yyval.integer) = STATE_HALF_VECTOR;
  3471.         }
  3472. #line 3473 "program/program_parse.tab.c" /* yacc.c:1646  */
  3473.     break;
  3474.  
  3475.   case 163:
  3476. #line 1430 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3477.     {
  3478.            (yyval.integer) = STATE_SPOT_DIRECTION;
  3479.         }
  3480. #line 3481 "program/program_parse.tab.c" /* yacc.c:1646  */
  3481.     break;
  3482.  
  3483.   case 164:
  3484. #line 1436 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3485.     {
  3486.            (yyval.state)[0] = (yyvsp[0].state)[0];
  3487.            (yyval.state)[1] = (yyvsp[0].state)[1];
  3488.         }
  3489. #line 3490 "program/program_parse.tab.c" /* yacc.c:1646  */
  3490.     break;
  3491.  
  3492.   case 165:
  3493. #line 1443 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3494.     {
  3495.            memset((yyval.state), 0, sizeof((yyval.state)));
  3496.            (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT;
  3497.         }
  3498. #line 3499 "program/program_parse.tab.c" /* yacc.c:1646  */
  3499.     break;
  3500.  
  3501.   case 166:
  3502. #line 1448 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3503.     {
  3504.            memset((yyval.state), 0, sizeof((yyval.state)));
  3505.            (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR;
  3506.            (yyval.state)[1] = (yyvsp[-1].integer);
  3507.         }
  3508. #line 3509 "program/program_parse.tab.c" /* yacc.c:1646  */
  3509.     break;
  3510.  
  3511.   case 167:
  3512. #line 1456 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3513.     {
  3514.            memset((yyval.state), 0, sizeof((yyval.state)));
  3515.            (yyval.state)[0] = STATE_LIGHTPROD;
  3516.            (yyval.state)[1] = (yyvsp[-3].integer);
  3517.            (yyval.state)[2] = (yyvsp[-1].integer);
  3518.            (yyval.state)[3] = (yyvsp[0].integer);
  3519.         }
  3520. #line 3521 "program/program_parse.tab.c" /* yacc.c:1646  */
  3521.     break;
  3522.  
  3523.   case 169:
  3524. #line 1468 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3525.     {
  3526.            memset((yyval.state), 0, sizeof((yyval.state)));
  3527.            (yyval.state)[0] = (yyvsp[0].integer);
  3528.            (yyval.state)[1] = (yyvsp[-1].integer);
  3529.         }
  3530. #line 3531 "program/program_parse.tab.c" /* yacc.c:1646  */
  3531.     break;
  3532.  
  3533.   case 170:
  3534. #line 1476 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3535.     {
  3536.            (yyval.integer) = STATE_TEXENV_COLOR;
  3537.         }
  3538. #line 3539 "program/program_parse.tab.c" /* yacc.c:1646  */
  3539.     break;
  3540.  
  3541.   case 171:
  3542. #line 1482 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3543.     {
  3544.            (yyval.integer) = STATE_AMBIENT;
  3545.         }
  3546. #line 3547 "program/program_parse.tab.c" /* yacc.c:1646  */
  3547.     break;
  3548.  
  3549.   case 172:
  3550. #line 1486 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3551.     {
  3552.            (yyval.integer) = STATE_DIFFUSE;
  3553.         }
  3554. #line 3555 "program/program_parse.tab.c" /* yacc.c:1646  */
  3555.     break;
  3556.  
  3557.   case 173:
  3558. #line 1490 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3559.     {
  3560.            (yyval.integer) = STATE_SPECULAR;
  3561.         }
  3562. #line 3563 "program/program_parse.tab.c" /* yacc.c:1646  */
  3563.     break;
  3564.  
  3565.   case 174:
  3566. #line 1496 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3567.     {
  3568.            if ((unsigned) (yyvsp[0].integer) >= state->MaxLights) {
  3569.               yyerror(& (yylsp[0]), state, "invalid light selector");
  3570.               YYERROR;
  3571.            }
  3572.  
  3573.            (yyval.integer) = (yyvsp[0].integer);
  3574.         }
  3575. #line 3576 "program/program_parse.tab.c" /* yacc.c:1646  */
  3576.     break;
  3577.  
  3578.   case 175:
  3579. #line 1507 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3580.     {
  3581.            memset((yyval.state), 0, sizeof((yyval.state)));
  3582.            (yyval.state)[0] = STATE_TEXGEN;
  3583.            (yyval.state)[1] = (yyvsp[-2].integer);
  3584.            (yyval.state)[2] = (yyvsp[-1].integer) + (yyvsp[0].integer);
  3585.         }
  3586. #line 3587 "program/program_parse.tab.c" /* yacc.c:1646  */
  3587.     break;
  3588.  
  3589.   case 176:
  3590. #line 1516 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3591.     {
  3592.            (yyval.integer) = STATE_TEXGEN_EYE_S;
  3593.         }
  3594. #line 3595 "program/program_parse.tab.c" /* yacc.c:1646  */
  3595.     break;
  3596.  
  3597.   case 177:
  3598. #line 1520 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3599.     {
  3600.            (yyval.integer) = STATE_TEXGEN_OBJECT_S;
  3601.         }
  3602. #line 3603 "program/program_parse.tab.c" /* yacc.c:1646  */
  3603.     break;
  3604.  
  3605.   case 178:
  3606. #line 1525 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3607.     {
  3608.            (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
  3609.         }
  3610. #line 3611 "program/program_parse.tab.c" /* yacc.c:1646  */
  3611.     break;
  3612.  
  3613.   case 179:
  3614. #line 1529 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3615.     {
  3616.            (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
  3617.         }
  3618. #line 3619 "program/program_parse.tab.c" /* yacc.c:1646  */
  3619.     break;
  3620.  
  3621.   case 180:
  3622. #line 1533 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3623.     {
  3624.            (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
  3625.         }
  3626. #line 3627 "program/program_parse.tab.c" /* yacc.c:1646  */
  3627.     break;
  3628.  
  3629.   case 181:
  3630. #line 1537 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3631.     {
  3632.            (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
  3633.         }
  3634. #line 3635 "program/program_parse.tab.c" /* yacc.c:1646  */
  3635.     break;
  3636.  
  3637.   case 182:
  3638. #line 1543 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3639.     {
  3640.            memset((yyval.state), 0, sizeof((yyval.state)));
  3641.            (yyval.state)[0] = (yyvsp[0].integer);
  3642.         }
  3643. #line 3644 "program/program_parse.tab.c" /* yacc.c:1646  */
  3644.     break;
  3645.  
  3646.   case 183:
  3647. #line 1550 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3648.     {
  3649.            (yyval.integer) = STATE_FOG_COLOR;
  3650.         }
  3651. #line 3652 "program/program_parse.tab.c" /* yacc.c:1646  */
  3652.     break;
  3653.  
  3654.   case 184:
  3655. #line 1554 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3656.     {
  3657.            (yyval.integer) = STATE_FOG_PARAMS;
  3658.         }
  3659. #line 3660 "program/program_parse.tab.c" /* yacc.c:1646  */
  3660.     break;
  3661.  
  3662.   case 185:
  3663. #line 1560 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3664.     {
  3665.            memset((yyval.state), 0, sizeof((yyval.state)));
  3666.            (yyval.state)[0] = STATE_CLIPPLANE;
  3667.            (yyval.state)[1] = (yyvsp[-2].integer);
  3668.         }
  3669. #line 3670 "program/program_parse.tab.c" /* yacc.c:1646  */
  3670.     break;
  3671.  
  3672.   case 186:
  3673. #line 1568 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3674.     {
  3675.            if ((unsigned) (yyvsp[0].integer) >= state->MaxClipPlanes) {
  3676.               yyerror(& (yylsp[0]), state, "invalid clip plane selector");
  3677.               YYERROR;
  3678.            }
  3679.  
  3680.            (yyval.integer) = (yyvsp[0].integer);
  3681.         }
  3682. #line 3683 "program/program_parse.tab.c" /* yacc.c:1646  */
  3683.     break;
  3684.  
  3685.   case 187:
  3686. #line 1579 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3687.     {
  3688.            memset((yyval.state), 0, sizeof((yyval.state)));
  3689.            (yyval.state)[0] = (yyvsp[0].integer);
  3690.         }
  3691. #line 3692 "program/program_parse.tab.c" /* yacc.c:1646  */
  3692.     break;
  3693.  
  3694.   case 188:
  3695. #line 1586 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3696.     {
  3697.            (yyval.integer) = STATE_POINT_SIZE;
  3698.         }
  3699. #line 3700 "program/program_parse.tab.c" /* yacc.c:1646  */
  3700.     break;
  3701.  
  3702.   case 189:
  3703. #line 1590 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3704.     {
  3705.            (yyval.integer) = STATE_POINT_ATTENUATION;
  3706.         }
  3707. #line 3708 "program/program_parse.tab.c" /* yacc.c:1646  */
  3708.     break;
  3709.  
  3710.   case 190:
  3711. #line 1596 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3712.     {
  3713.            (yyval.state)[0] = (yyvsp[-4].state)[0];
  3714.            (yyval.state)[1] = (yyvsp[-4].state)[1];
  3715.            (yyval.state)[2] = (yyvsp[-1].integer);
  3716.            (yyval.state)[3] = (yyvsp[-1].integer);
  3717.            (yyval.state)[4] = (yyvsp[-4].state)[2];
  3718.         }
  3719. #line 3720 "program/program_parse.tab.c" /* yacc.c:1646  */
  3720.     break;
  3721.  
  3722.   case 191:
  3723. #line 1606 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3724.     {
  3725.            (yyval.state)[0] = (yyvsp[-1].state)[0];
  3726.            (yyval.state)[1] = (yyvsp[-1].state)[1];
  3727.            (yyval.state)[2] = (yyvsp[0].state)[2];
  3728.            (yyval.state)[3] = (yyvsp[0].state)[3];
  3729.            (yyval.state)[4] = (yyvsp[-1].state)[2];
  3730.         }
  3731. #line 3732 "program/program_parse.tab.c" /* yacc.c:1646  */
  3732.     break;
  3733.  
  3734.   case 192:
  3735. #line 1616 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3736.     {
  3737.            (yyval.state)[2] = 0;
  3738.            (yyval.state)[3] = 3;
  3739.         }
  3740. #line 3741 "program/program_parse.tab.c" /* yacc.c:1646  */
  3741.     break;
  3742.  
  3743.   case 193:
  3744. #line 1621 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3745.     {
  3746.            /* It seems logical that the matrix row range specifier would have
  3747.             * to specify a range or more than one row (i.e., $5 > $3).
  3748.             * However, the ARB_vertex_program spec says "a program will fail
  3749.             * to load if <a> is greater than <b>."  This means that $3 == $5
  3750.             * is valid.
  3751.             */
  3752.            if ((yyvsp[-3].integer) > (yyvsp[-1].integer)) {
  3753.               yyerror(& (yylsp[-3]), state, "invalid matrix row range");
  3754.               YYERROR;
  3755.            }
  3756.  
  3757.            (yyval.state)[2] = (yyvsp[-3].integer);
  3758.            (yyval.state)[3] = (yyvsp[-1].integer);
  3759.         }
  3760. #line 3761 "program/program_parse.tab.c" /* yacc.c:1646  */
  3761.     break;
  3762.  
  3763.   case 194:
  3764. #line 1639 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3765.     {
  3766.            (yyval.state)[0] = (yyvsp[-1].state)[0];
  3767.            (yyval.state)[1] = (yyvsp[-1].state)[1];
  3768.            (yyval.state)[2] = (yyvsp[0].integer);
  3769.         }
  3770. #line 3771 "program/program_parse.tab.c" /* yacc.c:1646  */
  3771.     break;
  3772.  
  3773.   case 195:
  3774. #line 1647 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3775.     {
  3776.            (yyval.integer) = 0;
  3777.         }
  3778. #line 3779 "program/program_parse.tab.c" /* yacc.c:1646  */
  3779.     break;
  3780.  
  3781.   case 196:
  3782. #line 1651 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3783.     {
  3784.            (yyval.integer) = (yyvsp[0].integer);
  3785.         }
  3786. #line 3787 "program/program_parse.tab.c" /* yacc.c:1646  */
  3787.     break;
  3788.  
  3789.   case 197:
  3790. #line 1657 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3791.     {
  3792.            (yyval.integer) = STATE_MATRIX_INVERSE;
  3793.         }
  3794. #line 3795 "program/program_parse.tab.c" /* yacc.c:1646  */
  3795.     break;
  3796.  
  3797.   case 198:
  3798. #line 1661 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3799.     {
  3800.            (yyval.integer) = STATE_MATRIX_TRANSPOSE;
  3801.         }
  3802. #line 3803 "program/program_parse.tab.c" /* yacc.c:1646  */
  3803.     break;
  3804.  
  3805.   case 199:
  3806. #line 1665 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3807.     {
  3808.            (yyval.integer) = STATE_MATRIX_INVTRANS;
  3809.         }
  3810. #line 3811 "program/program_parse.tab.c" /* yacc.c:1646  */
  3811.     break;
  3812.  
  3813.   case 200:
  3814. #line 1671 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3815.     {
  3816.            if ((yyvsp[0].integer) > 3) {
  3817.               yyerror(& (yylsp[0]), state, "invalid matrix row reference");
  3818.               YYERROR;
  3819.            }
  3820.  
  3821.            (yyval.integer) = (yyvsp[0].integer);
  3822.         }
  3823. #line 3824 "program/program_parse.tab.c" /* yacc.c:1646  */
  3824.     break;
  3825.  
  3826.   case 201:
  3827. #line 1682 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3828.     {
  3829.            (yyval.state)[0] = STATE_MODELVIEW_MATRIX;
  3830.            (yyval.state)[1] = (yyvsp[0].integer);
  3831.         }
  3832. #line 3833 "program/program_parse.tab.c" /* yacc.c:1646  */
  3833.     break;
  3834.  
  3835.   case 202:
  3836. #line 1687 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3837.     {
  3838.            (yyval.state)[0] = STATE_PROJECTION_MATRIX;
  3839.            (yyval.state)[1] = 0;
  3840.         }
  3841. #line 3842 "program/program_parse.tab.c" /* yacc.c:1646  */
  3842.     break;
  3843.  
  3844.   case 203:
  3845. #line 1692 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3846.     {
  3847.            (yyval.state)[0] = STATE_MVP_MATRIX;
  3848.            (yyval.state)[1] = 0;
  3849.         }
  3850. #line 3851 "program/program_parse.tab.c" /* yacc.c:1646  */
  3851.     break;
  3852.  
  3853.   case 204:
  3854. #line 1697 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3855.     {
  3856.            (yyval.state)[0] = STATE_TEXTURE_MATRIX;
  3857.            (yyval.state)[1] = (yyvsp[0].integer);
  3858.         }
  3859. #line 3860 "program/program_parse.tab.c" /* yacc.c:1646  */
  3860.     break;
  3861.  
  3862.   case 205:
  3863. #line 1702 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3864.     {
  3865.            yyerror(& (yylsp[-3]), state, "GL_ARB_matrix_palette not supported");
  3866.            YYERROR;
  3867.         }
  3868. #line 3869 "program/program_parse.tab.c" /* yacc.c:1646  */
  3869.     break;
  3870.  
  3871.   case 206:
  3872. #line 1707 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3873.     {
  3874.            (yyval.state)[0] = STATE_PROGRAM_MATRIX;
  3875.            (yyval.state)[1] = (yyvsp[-1].integer);
  3876.         }
  3877. #line 3878 "program/program_parse.tab.c" /* yacc.c:1646  */
  3878.     break;
  3879.  
  3880.   case 207:
  3881. #line 1714 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3882.     {
  3883.            (yyval.integer) = 0;
  3884.         }
  3885. #line 3886 "program/program_parse.tab.c" /* yacc.c:1646  */
  3886.     break;
  3887.  
  3888.   case 208:
  3889. #line 1718 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3890.     {
  3891.            (yyval.integer) = (yyvsp[-1].integer);
  3892.         }
  3893. #line 3894 "program/program_parse.tab.c" /* yacc.c:1646  */
  3894.     break;
  3895.  
  3896.   case 209:
  3897. #line 1723 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3898.     {
  3899.            /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
  3900.             * zero is valid.
  3901.             */
  3902.            if ((yyvsp[0].integer) != 0) {
  3903.               yyerror(& (yylsp[0]), state, "invalid modelview matrix index");
  3904.               YYERROR;
  3905.            }
  3906.  
  3907.            (yyval.integer) = (yyvsp[0].integer);
  3908.         }
  3909. #line 3910 "program/program_parse.tab.c" /* yacc.c:1646  */
  3910.     break;
  3911.  
  3912.   case 210:
  3913. #line 1736 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3914.     {
  3915.            /* Since GL_ARB_matrix_palette isn't supported, just let any value
  3916.             * through here.  The error will be generated later.
  3917.             */
  3918.            (yyval.integer) = (yyvsp[0].integer);
  3919.         }
  3920. #line 3921 "program/program_parse.tab.c" /* yacc.c:1646  */
  3921.     break;
  3922.  
  3923.   case 211:
  3924. #line 1744 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3925.     {
  3926.            if ((unsigned) (yyvsp[0].integer) >= state->MaxProgramMatrices) {
  3927.               yyerror(& (yylsp[0]), state, "invalid program matrix selector");
  3928.               YYERROR;
  3929.            }
  3930.  
  3931.            (yyval.integer) = (yyvsp[0].integer);
  3932.         }
  3933. #line 3934 "program/program_parse.tab.c" /* yacc.c:1646  */
  3934.     break;
  3935.  
  3936.   case 212:
  3937. #line 1755 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3938.     {
  3939.            memset((yyval.state), 0, sizeof((yyval.state)));
  3940.            (yyval.state)[0] = STATE_DEPTH_RANGE;
  3941.         }
  3942. #line 3943 "program/program_parse.tab.c" /* yacc.c:1646  */
  3943.     break;
  3944.  
  3945.   case 217:
  3946. #line 1767 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3947.     {
  3948.            memset((yyval.state), 0, sizeof((yyval.state)));
  3949.            (yyval.state)[0] = state->state_param_enum;
  3950.            (yyval.state)[1] = STATE_ENV;
  3951.            (yyval.state)[2] = (yyvsp[-1].state)[0];
  3952.            (yyval.state)[3] = (yyvsp[-1].state)[1];
  3953.         }
  3954. #line 3955 "program/program_parse.tab.c" /* yacc.c:1646  */
  3955.     break;
  3956.  
  3957.   case 218:
  3958. #line 1777 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3959.     {
  3960.            (yyval.state)[0] = (yyvsp[0].integer);
  3961.            (yyval.state)[1] = (yyvsp[0].integer);
  3962.         }
  3963. #line 3964 "program/program_parse.tab.c" /* yacc.c:1646  */
  3964.     break;
  3965.  
  3966.   case 219:
  3967. #line 1782 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3968.     {
  3969.            (yyval.state)[0] = (yyvsp[-2].integer);
  3970.            (yyval.state)[1] = (yyvsp[0].integer);
  3971.         }
  3972. #line 3973 "program/program_parse.tab.c" /* yacc.c:1646  */
  3973.     break;
  3974.  
  3975.   case 220:
  3976. #line 1789 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3977.     {
  3978.            memset((yyval.state), 0, sizeof((yyval.state)));
  3979.            (yyval.state)[0] = state->state_param_enum;
  3980.            (yyval.state)[1] = STATE_ENV;
  3981.            (yyval.state)[2] = (yyvsp[-1].integer);
  3982.            (yyval.state)[3] = (yyvsp[-1].integer);
  3983.         }
  3984. #line 3985 "program/program_parse.tab.c" /* yacc.c:1646  */
  3985.     break;
  3986.  
  3987.   case 221:
  3988. #line 1799 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  3989.     {
  3990.            memset((yyval.state), 0, sizeof((yyval.state)));
  3991.            (yyval.state)[0] = state->state_param_enum;
  3992.            (yyval.state)[1] = STATE_LOCAL;
  3993.            (yyval.state)[2] = (yyvsp[-1].state)[0];
  3994.            (yyval.state)[3] = (yyvsp[-1].state)[1];
  3995.         }
  3996. #line 3997 "program/program_parse.tab.c" /* yacc.c:1646  */
  3997.     break;
  3998.  
  3999.   case 222:
  4000. #line 1808 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4001.     {
  4002.            (yyval.state)[0] = (yyvsp[0].integer);
  4003.            (yyval.state)[1] = (yyvsp[0].integer);
  4004.         }
  4005. #line 4006 "program/program_parse.tab.c" /* yacc.c:1646  */
  4006.     break;
  4007.  
  4008.   case 223:
  4009. #line 1813 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4010.     {
  4011.            (yyval.state)[0] = (yyvsp[-2].integer);
  4012.            (yyval.state)[1] = (yyvsp[0].integer);
  4013.         }
  4014. #line 4015 "program/program_parse.tab.c" /* yacc.c:1646  */
  4015.     break;
  4016.  
  4017.   case 224:
  4018. #line 1820 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4019.     {
  4020.            memset((yyval.state), 0, sizeof((yyval.state)));
  4021.            (yyval.state)[0] = state->state_param_enum;
  4022.            (yyval.state)[1] = STATE_LOCAL;
  4023.            (yyval.state)[2] = (yyvsp[-1].integer);
  4024.            (yyval.state)[3] = (yyvsp[-1].integer);
  4025.         }
  4026. #line 4027 "program/program_parse.tab.c" /* yacc.c:1646  */
  4027.     break;
  4028.  
  4029.   case 225:
  4030. #line 1830 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4031.     {
  4032.            if ((unsigned) (yyvsp[0].integer) >= state->limits->MaxEnvParams) {
  4033.               yyerror(& (yylsp[0]), state, "invalid environment parameter reference");
  4034.               YYERROR;
  4035.            }
  4036.            (yyval.integer) = (yyvsp[0].integer);
  4037.         }
  4038. #line 4039 "program/program_parse.tab.c" /* yacc.c:1646  */
  4039.     break;
  4040.  
  4041.   case 226:
  4042. #line 1840 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4043.     {
  4044.            if ((unsigned) (yyvsp[0].integer) >= state->limits->MaxLocalParams) {
  4045.               yyerror(& (yylsp[0]), state, "invalid local parameter reference");
  4046.               YYERROR;
  4047.            }
  4048.            (yyval.integer) = (yyvsp[0].integer);
  4049.         }
  4050. #line 4051 "program/program_parse.tab.c" /* yacc.c:1646  */
  4051.     break;
  4052.  
  4053.   case 231:
  4054. #line 1855 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4055.     {
  4056.            (yyval.vector).count = 4;
  4057.            (yyval.vector).data[0].f = (yyvsp[0].real);
  4058.            (yyval.vector).data[1].f = (yyvsp[0].real);
  4059.            (yyval.vector).data[2].f = (yyvsp[0].real);
  4060.            (yyval.vector).data[3].f = (yyvsp[0].real);
  4061.         }
  4062. #line 4063 "program/program_parse.tab.c" /* yacc.c:1646  */
  4063.     break;
  4064.  
  4065.   case 232:
  4066. #line 1865 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4067.     {
  4068.            (yyval.vector).count = 1;
  4069.            (yyval.vector).data[0].f = (yyvsp[0].real);
  4070.            (yyval.vector).data[1].f = (yyvsp[0].real);
  4071.            (yyval.vector).data[2].f = (yyvsp[0].real);
  4072.            (yyval.vector).data[3].f = (yyvsp[0].real);
  4073.         }
  4074. #line 4075 "program/program_parse.tab.c" /* yacc.c:1646  */
  4075.     break;
  4076.  
  4077.   case 233:
  4078. #line 1873 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4079.     {
  4080.            (yyval.vector).count = 1;
  4081.            (yyval.vector).data[0].f = (float) (yyvsp[0].integer);
  4082.            (yyval.vector).data[1].f = (float) (yyvsp[0].integer);
  4083.            (yyval.vector).data[2].f = (float) (yyvsp[0].integer);
  4084.            (yyval.vector).data[3].f = (float) (yyvsp[0].integer);
  4085.         }
  4086. #line 4087 "program/program_parse.tab.c" /* yacc.c:1646  */
  4087.     break;
  4088.  
  4089.   case 234:
  4090. #line 1883 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4091.     {
  4092.            (yyval.vector).count = 4;
  4093.            (yyval.vector).data[0].f = (yyvsp[-1].real);
  4094.            (yyval.vector).data[1].f = 0.0f;
  4095.            (yyval.vector).data[2].f = 0.0f;
  4096.            (yyval.vector).data[3].f = 1.0f;
  4097.         }
  4098. #line 4099 "program/program_parse.tab.c" /* yacc.c:1646  */
  4099.     break;
  4100.  
  4101.   case 235:
  4102. #line 1891 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4103.     {
  4104.            (yyval.vector).count = 4;
  4105.            (yyval.vector).data[0].f = (yyvsp[-3].real);
  4106.            (yyval.vector).data[1].f = (yyvsp[-1].real);
  4107.            (yyval.vector).data[2].f = 0.0f;
  4108.            (yyval.vector).data[3].f = 1.0f;
  4109.         }
  4110. #line 4111 "program/program_parse.tab.c" /* yacc.c:1646  */
  4111.     break;
  4112.  
  4113.   case 236:
  4114. #line 1900 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4115.     {
  4116.            (yyval.vector).count = 4;
  4117.            (yyval.vector).data[0].f = (yyvsp[-5].real);
  4118.            (yyval.vector).data[1].f = (yyvsp[-3].real);
  4119.            (yyval.vector).data[2].f = (yyvsp[-1].real);
  4120.            (yyval.vector).data[3].f = 1.0f;
  4121.         }
  4122. #line 4123 "program/program_parse.tab.c" /* yacc.c:1646  */
  4123.     break;
  4124.  
  4125.   case 237:
  4126. #line 1909 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4127.     {
  4128.            (yyval.vector).count = 4;
  4129.            (yyval.vector).data[0].f = (yyvsp[-7].real);
  4130.            (yyval.vector).data[1].f = (yyvsp[-5].real);
  4131.            (yyval.vector).data[2].f = (yyvsp[-3].real);
  4132.            (yyval.vector).data[3].f = (yyvsp[-1].real);
  4133.         }
  4134. #line 4135 "program/program_parse.tab.c" /* yacc.c:1646  */
  4135.     break;
  4136.  
  4137.   case 238:
  4138. #line 1919 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4139.     {
  4140.            (yyval.real) = ((yyvsp[-1].negate)) ? -(yyvsp[0].real) : (yyvsp[0].real);
  4141.         }
  4142. #line 4143 "program/program_parse.tab.c" /* yacc.c:1646  */
  4143.     break;
  4144.  
  4145.   case 239:
  4146. #line 1923 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4147.     {
  4148.            (yyval.real) = (float)(((yyvsp[-1].negate)) ? -(yyvsp[0].integer) : (yyvsp[0].integer));
  4149.         }
  4150. #line 4151 "program/program_parse.tab.c" /* yacc.c:1646  */
  4151.     break;
  4152.  
  4153.   case 240:
  4154. #line 1928 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4155.     { (yyval.negate) = FALSE; }
  4156. #line 4157 "program/program_parse.tab.c" /* yacc.c:1646  */
  4157.     break;
  4158.  
  4159.   case 241:
  4160. #line 1929 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4161.     { (yyval.negate) = TRUE;  }
  4162. #line 4163 "program/program_parse.tab.c" /* yacc.c:1646  */
  4163.     break;
  4164.  
  4165.   case 242:
  4166. #line 1930 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4167.     { (yyval.negate) = FALSE; }
  4168. #line 4169 "program/program_parse.tab.c" /* yacc.c:1646  */
  4169.     break;
  4170.  
  4171.   case 243:
  4172. #line 1933 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4173.     { (yyval.integer) = (yyvsp[0].integer); }
  4174. #line 4175 "program/program_parse.tab.c" /* yacc.c:1646  */
  4175.     break;
  4176.  
  4177.   case 245:
  4178. #line 1937 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4179.     {
  4180.            /* NV_fragment_program_option defines the size qualifiers in a
  4181.             * fairly broken way.  "SHORT" or "LONG" can optionally be used
  4182.             * before TEMP or OUTPUT.  However, neither is a reserved word!
  4183.             * This means that we have to parse it as an identifier, then check
  4184.             * to make sure it's one of the valid values.  *sigh*
  4185.             *
  4186.             * In addition, the grammar in the extension spec does *not* allow
  4187.             * the size specifier to be optional, but all known implementations
  4188.             * do.
  4189.             */
  4190.            if (!state->option.NV_fragment) {
  4191.               yyerror(& (yylsp[0]), state, "unexpected IDENTIFIER");
  4192.               YYERROR;
  4193.            }
  4194.  
  4195.            if (strcmp("SHORT", (yyvsp[0].string)) == 0) {
  4196.            } else if (strcmp("LONG", (yyvsp[0].string)) == 0) {
  4197.            } else {
  4198.               char *const err_str =
  4199.                  make_error_string("invalid storage size specifier \"%s\"",
  4200.                                    (yyvsp[0].string));
  4201.  
  4202.               yyerror(& (yylsp[0]), state, (err_str != NULL)
  4203.                       ? err_str : "invalid storage size specifier");
  4204.  
  4205.               if (err_str != NULL) {
  4206.                  free(err_str);
  4207.               }
  4208.  
  4209.               YYERROR;
  4210.            }
  4211.         }
  4212. #line 4213 "program/program_parse.tab.c" /* yacc.c:1646  */
  4213.     break;
  4214.  
  4215.   case 246:
  4216. #line 1971 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4217.     {
  4218.         }
  4219. #line 4220 "program/program_parse.tab.c" /* yacc.c:1646  */
  4220.     break;
  4221.  
  4222.   case 247:
  4223. #line 1975 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4224.     { (yyval.integer) = (yyvsp[0].integer); }
  4225. #line 4226 "program/program_parse.tab.c" /* yacc.c:1646  */
  4226.     break;
  4227.  
  4228.   case 249:
  4229. #line 1979 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4230.     {
  4231.            if (!declare_variable(state, (yyvsp[0].string), (yyvsp[-3].integer), & (yylsp[0]))) {
  4232.               free((yyvsp[0].string));
  4233.               YYERROR;
  4234.            }
  4235.         }
  4236. #line 4237 "program/program_parse.tab.c" /* yacc.c:1646  */
  4237.     break;
  4238.  
  4239.   case 250:
  4240. #line 1986 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4241.     {
  4242.            if (!declare_variable(state, (yyvsp[0].string), (yyvsp[-1].integer), & (yylsp[0]))) {
  4243.               free((yyvsp[0].string));
  4244.               YYERROR;
  4245.            }
  4246.         }
  4247. #line 4248 "program/program_parse.tab.c" /* yacc.c:1646  */
  4248.     break;
  4249.  
  4250.   case 251:
  4251. #line 1995 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4252.     {
  4253.            struct asm_symbol *const s =
  4254.               declare_variable(state, (yyvsp[-2].string), at_output, & (yylsp[-2]));
  4255.  
  4256.            if (s == NULL) {
  4257.               free((yyvsp[-2].string));
  4258.               YYERROR;
  4259.            } else {
  4260.               s->output_binding = (yyvsp[0].result);
  4261.            }
  4262.         }
  4263. #line 4264 "program/program_parse.tab.c" /* yacc.c:1646  */
  4264.     break;
  4265.  
  4266.   case 252:
  4267. #line 2009 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4268.     {
  4269.            if (state->mode == ARB_vertex) {
  4270.               (yyval.result) = VARYING_SLOT_POS;
  4271.            } else {
  4272.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4273.               YYERROR;
  4274.            }
  4275.         }
  4276. #line 4277 "program/program_parse.tab.c" /* yacc.c:1646  */
  4277.     break;
  4278.  
  4279.   case 253:
  4280. #line 2018 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4281.     {
  4282.            if (state->mode == ARB_vertex) {
  4283.               (yyval.result) = VARYING_SLOT_FOGC;
  4284.            } else {
  4285.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4286.               YYERROR;
  4287.            }
  4288.         }
  4289. #line 4290 "program/program_parse.tab.c" /* yacc.c:1646  */
  4290.     break;
  4291.  
  4292.   case 254:
  4293. #line 2027 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4294.     {
  4295.            (yyval.result) = (yyvsp[0].result);
  4296.         }
  4297. #line 4298 "program/program_parse.tab.c" /* yacc.c:1646  */
  4298.     break;
  4299.  
  4300.   case 255:
  4301. #line 2031 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4302.     {
  4303.            if (state->mode == ARB_vertex) {
  4304.               (yyval.result) = VARYING_SLOT_PSIZ;
  4305.            } else {
  4306.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4307.               YYERROR;
  4308.            }
  4309.         }
  4310. #line 4311 "program/program_parse.tab.c" /* yacc.c:1646  */
  4311.     break;
  4312.  
  4313.   case 256:
  4314. #line 2040 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4315.     {
  4316.            if (state->mode == ARB_vertex) {
  4317.               (yyval.result) = VARYING_SLOT_TEX0 + (yyvsp[0].integer);
  4318.            } else {
  4319.               yyerror(& (yylsp[-1]), state, "invalid program result name");
  4320.               YYERROR;
  4321.            }
  4322.         }
  4323. #line 4324 "program/program_parse.tab.c" /* yacc.c:1646  */
  4324.     break;
  4325.  
  4326.   case 257:
  4327. #line 2049 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4328.     {
  4329.            if (state->mode == ARB_fragment) {
  4330.               (yyval.result) = FRAG_RESULT_DEPTH;
  4331.            } else {
  4332.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4333.               YYERROR;
  4334.            }
  4335.         }
  4336. #line 4337 "program/program_parse.tab.c" /* yacc.c:1646  */
  4337.     break;
  4338.  
  4339.   case 258:
  4340. #line 2060 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4341.     {
  4342.            (yyval.result) = (yyvsp[-1].integer) + (yyvsp[0].integer);
  4343.         }
  4344. #line 4345 "program/program_parse.tab.c" /* yacc.c:1646  */
  4345.     break;
  4346.  
  4347.   case 259:
  4348. #line 2066 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4349.     {
  4350.            if (state->mode == ARB_vertex) {
  4351.               (yyval.integer) = VARYING_SLOT_COL0;
  4352.            } else {
  4353.               if (state->option.DrawBuffers)
  4354.                  (yyval.integer) = FRAG_RESULT_DATA0;
  4355.               else
  4356.                  (yyval.integer) = FRAG_RESULT_COLOR;
  4357.            }
  4358.         }
  4359. #line 4360 "program/program_parse.tab.c" /* yacc.c:1646  */
  4360.     break;
  4361.  
  4362.   case 260:
  4363. #line 2077 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4364.     {
  4365.            if (state->mode == ARB_vertex) {
  4366.               yyerror(& (yylsp[-2]), state, "invalid program result name");
  4367.               YYERROR;
  4368.            } else {
  4369.               if (!state->option.DrawBuffers) {
  4370.                  /* From the ARB_draw_buffers spec (same text exists
  4371.                   * for ATI_draw_buffers):
  4372.                   *
  4373.                   *     If this option is not specified, a fragment
  4374.                   *     program that attempts to bind
  4375.                   *     "result.color[n]" will fail to load, and only
  4376.                   *     "result.color" will be allowed.
  4377.                   */
  4378.                  yyerror(& (yylsp[-2]), state,
  4379.                          "result.color[] used without "
  4380.                          "`OPTION ARB_draw_buffers' or "
  4381.                          "`OPTION ATI_draw_buffers'");
  4382.                  YYERROR;
  4383.               } else if ((yyvsp[-1].integer) >= state->MaxDrawBuffers) {
  4384.                  yyerror(& (yylsp[-2]), state,
  4385.                          "result.color[] exceeds MAX_DRAW_BUFFERS_ARB");
  4386.                  YYERROR;
  4387.               }
  4388.               (yyval.integer) = FRAG_RESULT_DATA0 + (yyvsp[-1].integer);
  4389.            }
  4390.         }
  4391. #line 4392 "program/program_parse.tab.c" /* yacc.c:1646  */
  4392.     break;
  4393.  
  4394.   case 261:
  4395. #line 2105 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4396.     {
  4397.            if (state->mode == ARB_vertex) {
  4398.               (yyval.integer) = VARYING_SLOT_COL0;
  4399.            } else {
  4400.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4401.               YYERROR;
  4402.            }
  4403.         }
  4404. #line 4405 "program/program_parse.tab.c" /* yacc.c:1646  */
  4405.     break;
  4406.  
  4407.   case 262:
  4408. #line 2114 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4409.     {
  4410.            if (state->mode == ARB_vertex) {
  4411.               (yyval.integer) = VARYING_SLOT_BFC0;
  4412.            } else {
  4413.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4414.               YYERROR;
  4415.            }
  4416.         }
  4417. #line 4418 "program/program_parse.tab.c" /* yacc.c:1646  */
  4418.     break;
  4419.  
  4420.   case 263:
  4421. #line 2125 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4422.     {
  4423.            (yyval.integer) = 0;
  4424.         }
  4425. #line 4426 "program/program_parse.tab.c" /* yacc.c:1646  */
  4426.     break;
  4427.  
  4428.   case 264:
  4429. #line 2129 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4430.     {
  4431.            if (state->mode == ARB_vertex) {
  4432.               (yyval.integer) = 0;
  4433.            } else {
  4434.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4435.               YYERROR;
  4436.            }
  4437.         }
  4438. #line 4439 "program/program_parse.tab.c" /* yacc.c:1646  */
  4439.     break;
  4440.  
  4441.   case 265:
  4442. #line 2138 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4443.     {
  4444.            if (state->mode == ARB_vertex) {
  4445.               (yyval.integer) = 1;
  4446.            } else {
  4447.               yyerror(& (yylsp[0]), state, "invalid program result name");
  4448.               YYERROR;
  4449.            }
  4450.         }
  4451. #line 4452 "program/program_parse.tab.c" /* yacc.c:1646  */
  4452.     break;
  4453.  
  4454.   case 266:
  4455. #line 2148 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4456.     { (yyval.integer) = 0; }
  4457. #line 4458 "program/program_parse.tab.c" /* yacc.c:1646  */
  4458.     break;
  4459.  
  4460.   case 267:
  4461. #line 2149 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4462.     { (yyval.integer) = 0; }
  4463. #line 4464 "program/program_parse.tab.c" /* yacc.c:1646  */
  4464.     break;
  4465.  
  4466.   case 268:
  4467. #line 2150 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4468.     { (yyval.integer) = 1; }
  4469. #line 4470 "program/program_parse.tab.c" /* yacc.c:1646  */
  4470.     break;
  4471.  
  4472.   case 269:
  4473. #line 2153 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4474.     { (yyval.integer) = 0; }
  4475. #line 4476 "program/program_parse.tab.c" /* yacc.c:1646  */
  4476.     break;
  4477.  
  4478.   case 270:
  4479. #line 2154 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4480.     { (yyval.integer) = 0; }
  4481. #line 4482 "program/program_parse.tab.c" /* yacc.c:1646  */
  4482.     break;
  4483.  
  4484.   case 271:
  4485. #line 2155 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4486.     { (yyval.integer) = 1; }
  4487. #line 4488 "program/program_parse.tab.c" /* yacc.c:1646  */
  4488.     break;
  4489.  
  4490.   case 272:
  4491. #line 2158 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4492.     { (yyval.integer) = 0; }
  4493. #line 4494 "program/program_parse.tab.c" /* yacc.c:1646  */
  4494.     break;
  4495.  
  4496.   case 273:
  4497. #line 2159 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4498.     { (yyval.integer) = (yyvsp[-1].integer); }
  4499. #line 4500 "program/program_parse.tab.c" /* yacc.c:1646  */
  4500.     break;
  4501.  
  4502.   case 274:
  4503. #line 2162 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4504.     { (yyval.integer) = 0; }
  4505. #line 4506 "program/program_parse.tab.c" /* yacc.c:1646  */
  4506.     break;
  4507.  
  4508.   case 275:
  4509. #line 2163 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4510.     { (yyval.integer) = (yyvsp[-1].integer); }
  4511. #line 4512 "program/program_parse.tab.c" /* yacc.c:1646  */
  4512.     break;
  4513.  
  4514.   case 276:
  4515. #line 2166 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4516.     { (yyval.integer) = 0; }
  4517. #line 4518 "program/program_parse.tab.c" /* yacc.c:1646  */
  4518.     break;
  4519.  
  4520.   case 277:
  4521. #line 2167 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4522.     { (yyval.integer) = (yyvsp[-1].integer); }
  4523. #line 4524 "program/program_parse.tab.c" /* yacc.c:1646  */
  4524.     break;
  4525.  
  4526.   case 278:
  4527. #line 2171 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4528.     {
  4529.            if ((unsigned) (yyvsp[0].integer) >= state->MaxTextureCoordUnits) {
  4530.               yyerror(& (yylsp[0]), state, "invalid texture coordinate unit selector");
  4531.               YYERROR;
  4532.            }
  4533.  
  4534.            (yyval.integer) = (yyvsp[0].integer);
  4535.         }
  4536. #line 4537 "program/program_parse.tab.c" /* yacc.c:1646  */
  4537.     break;
  4538.  
  4539.   case 279:
  4540. #line 2182 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4541.     {
  4542.            if ((unsigned) (yyvsp[0].integer) >= state->MaxTextureImageUnits) {
  4543.               yyerror(& (yylsp[0]), state, "invalid texture image unit selector");
  4544.               YYERROR;
  4545.            }
  4546.  
  4547.            (yyval.integer) = (yyvsp[0].integer);
  4548.         }
  4549. #line 4550 "program/program_parse.tab.c" /* yacc.c:1646  */
  4550.     break;
  4551.  
  4552.   case 280:
  4553. #line 2193 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4554.     {
  4555.            if ((unsigned) (yyvsp[0].integer) >= state->MaxTextureUnits) {
  4556.               yyerror(& (yylsp[0]), state, "invalid texture unit selector");
  4557.               YYERROR;
  4558.            }
  4559.  
  4560.            (yyval.integer) = (yyvsp[0].integer);
  4561.         }
  4562. #line 4563 "program/program_parse.tab.c" /* yacc.c:1646  */
  4563.     break;
  4564.  
  4565.   case 281:
  4566. #line 2204 "../../../src/mesa/program/program_parse.y" /* yacc.c:1646  */
  4567.     {
  4568.            struct asm_symbol *exist = (struct asm_symbol *)
  4569.               _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[-2].string));
  4570.            struct asm_symbol *target = (struct asm_symbol *)
  4571.               _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[0].string));
  4572.  
  4573.            free((yyvsp[0].string));
  4574.  
  4575.            if (exist != NULL) {
  4576.               char m[1000];
  4577.               _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[-2].string));
  4578.               free((yyvsp[-2].string));
  4579.               yyerror(& (yylsp[-2]), state, m);
  4580.               YYERROR;
  4581.            } else if (target == NULL) {
  4582.               free((yyvsp[-2].string));
  4583.               yyerror(& (yylsp[0]), state,
  4584.                       "undefined variable binding in ALIAS statement");
  4585.               YYERROR;
  4586.            } else {
  4587.               _mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[-2].string), target);
  4588.            }
  4589.         }
  4590. #line 4591 "program/program_parse.tab.c" /* yacc.c:1646  */
  4591.     break;
  4592.  
  4593.  
  4594. #line 4595 "program/program_parse.tab.c" /* yacc.c:1646  */
  4595.       default: break;
  4596.     }
  4597.   /* User semantic actions sometimes alter yychar, and that requires
  4598.      that yytoken be updated with the new translation.  We take the
  4599.      approach of translating immediately before every use of yytoken.
  4600.      One alternative is translating here after every semantic action,
  4601.      but that translation would be missed if the semantic action invokes
  4602.      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  4603.      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
  4604.      incorrect destructor might then be invoked immediately.  In the
  4605.      case of YYERROR or YYBACKUP, subsequent parser actions might lead
  4606.      to an incorrect destructor call or verbose syntax error message
  4607.      before the lookahead is translated.  */
  4608.   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  4609.  
  4610.   YYPOPSTACK (yylen);
  4611.   yylen = 0;
  4612.   YY_STACK_PRINT (yyss, yyssp);
  4613.  
  4614.   *++yyvsp = yyval;
  4615.   *++yylsp = yyloc;
  4616.  
  4617.   /* Now 'shift' the result of the reduction.  Determine what state
  4618.      that goes to, based on the state we popped back to and the rule
  4619.      number reduced by.  */
  4620.  
  4621.   yyn = yyr1[yyn];
  4622.  
  4623.   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  4624.   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  4625.     yystate = yytable[yystate];
  4626.   else
  4627.     yystate = yydefgoto[yyn - YYNTOKENS];
  4628.  
  4629.   goto yynewstate;
  4630.  
  4631.  
  4632. /*--------------------------------------.
  4633. | yyerrlab -- here on detecting error.  |
  4634. `--------------------------------------*/
  4635. yyerrlab:
  4636.   /* Make sure we have latest lookahead translation.  See comments at
  4637.      user semantic actions for why this is necessary.  */
  4638.   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  4639.  
  4640.   /* If not already recovering from an error, report this error.  */
  4641.   if (!yyerrstatus)
  4642.     {
  4643.       ++yynerrs;
  4644. #if ! YYERROR_VERBOSE
  4645.       yyerror (&yylloc, state, YY_("syntax error"));
  4646. #else
  4647. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  4648.                                         yyssp, yytoken)
  4649.       {
  4650.         char const *yymsgp = YY_("syntax error");
  4651.         int yysyntax_error_status;
  4652.         yysyntax_error_status = YYSYNTAX_ERROR;
  4653.         if (yysyntax_error_status == 0)
  4654.           yymsgp = yymsg;
  4655.         else if (yysyntax_error_status == 1)
  4656.           {
  4657.             if (yymsg != yymsgbuf)
  4658.               YYSTACK_FREE (yymsg);
  4659.             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
  4660.             if (!yymsg)
  4661.               {
  4662.                 yymsg = yymsgbuf;
  4663.                 yymsg_alloc = sizeof yymsgbuf;
  4664.                 yysyntax_error_status = 2;
  4665.               }
  4666.             else
  4667.               {
  4668.                 yysyntax_error_status = YYSYNTAX_ERROR;
  4669.                 yymsgp = yymsg;
  4670.               }
  4671.           }
  4672.         yyerror (&yylloc, state, yymsgp);
  4673.         if (yysyntax_error_status == 2)
  4674.           goto yyexhaustedlab;
  4675.       }
  4676. # undef YYSYNTAX_ERROR
  4677. #endif
  4678.     }
  4679.  
  4680.   yyerror_range[1] = yylloc;
  4681.  
  4682.   if (yyerrstatus == 3)
  4683.     {
  4684.       /* If just tried and failed to reuse lookahead token after an
  4685.          error, discard it.  */
  4686.  
  4687.       if (yychar <= YYEOF)
  4688.         {
  4689.           /* Return failure if at end of input.  */
  4690.           if (yychar == YYEOF)
  4691.             YYABORT;
  4692.         }
  4693.       else
  4694.         {
  4695.           yydestruct ("Error: discarding",
  4696.                       yytoken, &yylval, &yylloc, state);
  4697.           yychar = YYEMPTY;
  4698.         }
  4699.     }
  4700.  
  4701.   /* Else will try to reuse lookahead token after shifting the error
  4702.      token.  */
  4703.   goto yyerrlab1;
  4704.  
  4705.  
  4706. /*---------------------------------------------------.
  4707. | yyerrorlab -- error raised explicitly by YYERROR.  |
  4708. `---------------------------------------------------*/
  4709. yyerrorlab:
  4710.  
  4711.   /* Pacify compilers like GCC when the user code never invokes
  4712.      YYERROR and the label yyerrorlab therefore never appears in user
  4713.      code.  */
  4714.   if (/*CONSTCOND*/ 0)
  4715.      goto yyerrorlab;
  4716.  
  4717.   yyerror_range[1] = yylsp[1-yylen];
  4718.   /* Do not reclaim the symbols of the rule whose action triggered
  4719.      this YYERROR.  */
  4720.   YYPOPSTACK (yylen);
  4721.   yylen = 0;
  4722.   YY_STACK_PRINT (yyss, yyssp);
  4723.   yystate = *yyssp;
  4724.   goto yyerrlab1;
  4725.  
  4726.  
  4727. /*-------------------------------------------------------------.
  4728. | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  4729. `-------------------------------------------------------------*/
  4730. yyerrlab1:
  4731.   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
  4732.  
  4733.   for (;;)
  4734.     {
  4735.       yyn = yypact[yystate];
  4736.       if (!yypact_value_is_default (yyn))
  4737.         {
  4738.           yyn += YYTERROR;
  4739.           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  4740.             {
  4741.               yyn = yytable[yyn];
  4742.               if (0 < yyn)
  4743.                 break;
  4744.             }
  4745.         }
  4746.  
  4747.       /* Pop the current state because it cannot handle the error token.  */
  4748.       if (yyssp == yyss)
  4749.         YYABORT;
  4750.  
  4751.       yyerror_range[1] = *yylsp;
  4752.       yydestruct ("Error: popping",
  4753.                   yystos[yystate], yyvsp, yylsp, state);
  4754.       YYPOPSTACK (1);
  4755.       yystate = *yyssp;
  4756.       YY_STACK_PRINT (yyss, yyssp);
  4757.     }
  4758.  
  4759.   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  4760.   *++yyvsp = yylval;
  4761.   YY_IGNORE_MAYBE_UNINITIALIZED_END
  4762.  
  4763.   yyerror_range[2] = yylloc;
  4764.   /* Using YYLLOC is tempting, but would change the location of
  4765.      the lookahead.  YYLOC is available though.  */
  4766.   YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  4767.   *++yylsp = yyloc;
  4768.  
  4769.   /* Shift the error token.  */
  4770.   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  4771.  
  4772.   yystate = yyn;
  4773.   goto yynewstate;
  4774.  
  4775.  
  4776. /*-------------------------------------.
  4777. | yyacceptlab -- YYACCEPT comes here.  |
  4778. `-------------------------------------*/
  4779. yyacceptlab:
  4780.   yyresult = 0;
  4781.   goto yyreturn;
  4782.  
  4783. /*-----------------------------------.
  4784. | yyabortlab -- YYABORT comes here.  |
  4785. `-----------------------------------*/
  4786. yyabortlab:
  4787.   yyresult = 1;
  4788.   goto yyreturn;
  4789.  
  4790. #if !defined yyoverflow || YYERROR_VERBOSE
  4791. /*-------------------------------------------------.
  4792. | yyexhaustedlab -- memory exhaustion comes here.  |
  4793. `-------------------------------------------------*/
  4794. yyexhaustedlab:
  4795.   yyerror (&yylloc, state, YY_("memory exhausted"));
  4796.   yyresult = 2;
  4797.   /* Fall through.  */
  4798. #endif
  4799.  
  4800. yyreturn:
  4801.   if (yychar != YYEMPTY)
  4802.     {
  4803.       /* Make sure we have latest lookahead translation.  See comments at
  4804.          user semantic actions for why this is necessary.  */
  4805.       yytoken = YYTRANSLATE (yychar);
  4806.       yydestruct ("Cleanup: discarding lookahead",
  4807.                   yytoken, &yylval, &yylloc, state);
  4808.     }
  4809.   /* Do not reclaim the symbols of the rule whose action triggered
  4810.      this YYABORT or YYACCEPT.  */
  4811.   YYPOPSTACK (yylen);
  4812.   YY_STACK_PRINT (yyss, yyssp);
  4813.   while (yyssp != yyss)
  4814.     {
  4815.       yydestruct ("Cleanup: popping",
  4816.                   yystos[*yyssp], yyvsp, yylsp, state);
  4817.       YYPOPSTACK (1);
  4818.     }
  4819. #ifndef yyoverflow
  4820.   if (yyss != yyssa)
  4821.     YYSTACK_FREE (yyss);
  4822. #endif
  4823. #if YYERROR_VERBOSE
  4824.   if (yymsg != yymsgbuf)
  4825.     YYSTACK_FREE (yymsg);
  4826. #endif
  4827.   return yyresult;
  4828. }
  4829. #line 2233 "../../../src/mesa/program/program_parse.y" /* yacc.c:1906  */
  4830.  
  4831.  
  4832. void
  4833. asm_instruction_set_operands(struct asm_instruction *inst,
  4834.                              const struct prog_dst_register *dst,
  4835.                              const struct asm_src_register *src0,
  4836.                              const struct asm_src_register *src1,
  4837.                              const struct asm_src_register *src2)
  4838. {
  4839.    /* In the core ARB extensions only the KIL instruction doesn't have a
  4840.     * destination register.
  4841.     */
  4842.    if (dst == NULL) {
  4843.       init_dst_reg(& inst->Base.DstReg);
  4844.    } else {
  4845.       inst->Base.DstReg = *dst;
  4846.    }
  4847.  
  4848.    /* The only instruction that doesn't have any source registers is the
  4849.     * condition-code based KIL instruction added by NV_fragment_program_option.
  4850.     */
  4851.    if (src0 != NULL) {
  4852.       inst->Base.SrcReg[0] = src0->Base;
  4853.       inst->SrcReg[0] = *src0;
  4854.    } else {
  4855.       init_src_reg(& inst->SrcReg[0]);
  4856.    }
  4857.  
  4858.    if (src1 != NULL) {
  4859.       inst->Base.SrcReg[1] = src1->Base;
  4860.       inst->SrcReg[1] = *src1;
  4861.    } else {
  4862.       init_src_reg(& inst->SrcReg[1]);
  4863.    }
  4864.  
  4865.    if (src2 != NULL) {
  4866.       inst->Base.SrcReg[2] = src2->Base;
  4867.       inst->SrcReg[2] = *src2;
  4868.    } else {
  4869.       init_src_reg(& inst->SrcReg[2]);
  4870.    }
  4871. }
  4872.  
  4873.  
  4874. struct asm_instruction *
  4875. asm_instruction_ctor(gl_inst_opcode op,
  4876.                      const struct prog_dst_register *dst,
  4877.                      const struct asm_src_register *src0,
  4878.                      const struct asm_src_register *src1,
  4879.                      const struct asm_src_register *src2)
  4880. {
  4881.    struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
  4882.  
  4883.    if (inst) {
  4884.       _mesa_init_instructions(& inst->Base, 1);
  4885.       inst->Base.Opcode = op;
  4886.  
  4887.       asm_instruction_set_operands(inst, dst, src0, src1, src2);
  4888.    }
  4889.  
  4890.    return inst;
  4891. }
  4892.  
  4893.  
  4894. struct asm_instruction *
  4895. asm_instruction_copy_ctor(const struct prog_instruction *base,
  4896.                           const struct prog_dst_register *dst,
  4897.                           const struct asm_src_register *src0,
  4898.                           const struct asm_src_register *src1,
  4899.                           const struct asm_src_register *src2)
  4900. {
  4901.    struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
  4902.  
  4903.    if (inst) {
  4904.       _mesa_init_instructions(& inst->Base, 1);
  4905.       inst->Base.Opcode = base->Opcode;
  4906.       inst->Base.CondUpdate = base->CondUpdate;
  4907.       inst->Base.CondDst = base->CondDst;
  4908.       inst->Base.SaturateMode = base->SaturateMode;
  4909.       inst->Base.Precision = base->Precision;
  4910.  
  4911.       asm_instruction_set_operands(inst, dst, src0, src1, src2);
  4912.    }
  4913.  
  4914.    return inst;
  4915. }
  4916.  
  4917.  
  4918. void
  4919. init_dst_reg(struct prog_dst_register *r)
  4920. {
  4921.    memset(r, 0, sizeof(*r));
  4922.    r->File = PROGRAM_UNDEFINED;
  4923.    r->WriteMask = WRITEMASK_XYZW;
  4924.    r->CondMask = COND_TR;
  4925.    r->CondSwizzle = SWIZZLE_NOOP;
  4926. }
  4927.  
  4928.  
  4929. /** Like init_dst_reg() but set the File and Index fields. */
  4930. void
  4931. set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index)
  4932. {
  4933.    const GLint maxIndex = 1 << INST_INDEX_BITS;
  4934.    const GLint minIndex = 0;
  4935.    assert(index >= minIndex);
  4936.    (void) minIndex;
  4937.    assert(index <= maxIndex);
  4938.    (void) maxIndex;
  4939.    assert(file == PROGRAM_TEMPORARY ||
  4940.           file == PROGRAM_ADDRESS ||
  4941.           file == PROGRAM_OUTPUT);
  4942.    memset(r, 0, sizeof(*r));
  4943.    r->File = file;
  4944.    r->Index = index;
  4945.    r->WriteMask = WRITEMASK_XYZW;
  4946.    r->CondMask = COND_TR;
  4947.    r->CondSwizzle = SWIZZLE_NOOP;
  4948. }
  4949.  
  4950.  
  4951. void
  4952. init_src_reg(struct asm_src_register *r)
  4953. {
  4954.    memset(r, 0, sizeof(*r));
  4955.    r->Base.File = PROGRAM_UNDEFINED;
  4956.    r->Base.Swizzle = SWIZZLE_NOOP;
  4957.    r->Symbol = NULL;
  4958. }
  4959.  
  4960.  
  4961. /** Like init_src_reg() but set the File and Index fields.
  4962.  * \return GL_TRUE if a valid src register, GL_FALSE otherwise
  4963.  */
  4964. void
  4965. set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index)
  4966. {
  4967.    set_src_reg_swz(r, file, index, SWIZZLE_XYZW);
  4968. }
  4969.  
  4970.  
  4971. void
  4972. set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
  4973.                 GLuint swizzle)
  4974. {
  4975.    const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
  4976.    const GLint minIndex = -(1 << INST_INDEX_BITS);
  4977.    assert(file < PROGRAM_FILE_MAX);
  4978.    assert(index >= minIndex);
  4979.    (void) minIndex;
  4980.    assert(index <= maxIndex);
  4981.    (void) maxIndex;
  4982.    memset(r, 0, sizeof(*r));
  4983.    r->Base.File = file;
  4984.    r->Base.Index = index;
  4985.    r->Base.Swizzle = swizzle;
  4986.    r->Symbol = NULL;
  4987. }
  4988.  
  4989.  
  4990. /**
  4991.  * Validate the set of inputs used by a program
  4992.  *
  4993.  * Validates that legal sets of inputs are used by the program.  In this case
  4994.  * "used" included both reading the input or binding the input to a name using
  4995.  * the \c ATTRIB command.
  4996.  *
  4997.  * \return
  4998.  * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
  4999.  */
  5000. int
  5001. validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
  5002. {
  5003.    const GLbitfield64 inputs = state->prog->InputsRead | state->InputsBound;
  5004.  
  5005.    if (((inputs & VERT_BIT_FF_ALL) & (inputs >> VERT_ATTRIB_GENERIC0)) != 0) {
  5006.       yyerror(locp, state, "illegal use of generic attribute and name attribute");
  5007.       return 0;
  5008.    }
  5009.  
  5010.    return 1;
  5011. }
  5012.  
  5013.  
  5014. struct asm_symbol *
  5015. declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
  5016.                  struct YYLTYPE *locp)
  5017. {
  5018.    struct asm_symbol *s = NULL;
  5019.    struct asm_symbol *exist = (struct asm_symbol *)
  5020.       _mesa_symbol_table_find_symbol(state->st, 0, name);
  5021.  
  5022.  
  5023.    if (exist != NULL) {
  5024.       yyerror(locp, state, "redeclared identifier");
  5025.    } else {
  5026.       s = calloc(1, sizeof(struct asm_symbol));
  5027.       s->name = name;
  5028.       s->type = t;
  5029.  
  5030.       switch (t) {
  5031.       case at_temp:
  5032.          if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
  5033.             yyerror(locp, state, "too many temporaries declared");
  5034.             free(s);
  5035.             return NULL;
  5036.          }
  5037.  
  5038.          s->temp_binding = state->prog->NumTemporaries;
  5039.          state->prog->NumTemporaries++;
  5040.          break;
  5041.  
  5042.       case at_address:
  5043.          if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
  5044.             yyerror(locp, state, "too many address registers declared");
  5045.             free(s);
  5046.             return NULL;
  5047.          }
  5048.  
  5049.          /* FINISHME: Add support for multiple address registers.
  5050.           */
  5051.          state->prog->NumAddressRegs++;
  5052.          break;
  5053.  
  5054.       default:
  5055.          break;
  5056.       }
  5057.  
  5058.       _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
  5059.       s->next = state->sym;
  5060.       state->sym = s;
  5061.    }
  5062.  
  5063.    return s;
  5064. }
  5065.  
  5066.  
  5067. int add_state_reference(struct gl_program_parameter_list *param_list,
  5068.                         const gl_state_index tokens[STATE_LENGTH])
  5069. {
  5070.    const GLuint size = 4; /* XXX fix */
  5071.    char *name;
  5072.    GLint index;
  5073.  
  5074.    name = _mesa_program_state_string(tokens);
  5075.    index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
  5076.                                size, GL_NONE, NULL, tokens);
  5077.    param_list->StateFlags |= _mesa_program_state_flags(tokens);
  5078.  
  5079.    /* free name string here since we duplicated it in add_parameter() */
  5080.    free(name);
  5081.  
  5082.    return index;
  5083. }
  5084.  
  5085.  
  5086. int
  5087. initialize_symbol_from_state(struct gl_program *prog,
  5088.                              struct asm_symbol *param_var,
  5089.                              const gl_state_index tokens[STATE_LENGTH])
  5090. {
  5091.    int idx = -1;
  5092.    gl_state_index state_tokens[STATE_LENGTH];
  5093.  
  5094.  
  5095.    memcpy(state_tokens, tokens, sizeof(state_tokens));
  5096.  
  5097.    param_var->type = at_param;
  5098.    param_var->param_binding_type = PROGRAM_STATE_VAR;
  5099.  
  5100.    /* If we are adding a STATE_MATRIX that has multiple rows, we need to
  5101.     * unroll it and call add_state_reference() for each row
  5102.     */
  5103.    if ((state_tokens[0] == STATE_MODELVIEW_MATRIX ||
  5104.         state_tokens[0] == STATE_PROJECTION_MATRIX ||
  5105.         state_tokens[0] == STATE_MVP_MATRIX ||
  5106.         state_tokens[0] == STATE_TEXTURE_MATRIX ||
  5107.         state_tokens[0] == STATE_PROGRAM_MATRIX)
  5108.        && (state_tokens[2] != state_tokens[3])) {
  5109.       int row;
  5110.       const int first_row = state_tokens[2];
  5111.       const int last_row = state_tokens[3];
  5112.  
  5113.       for (row = first_row; row <= last_row; row++) {
  5114.          state_tokens[2] = state_tokens[3] = row;
  5115.  
  5116.          idx = add_state_reference(prog->Parameters, state_tokens);
  5117.          if (param_var->param_binding_begin == ~0U) {
  5118.             param_var->param_binding_begin = idx;
  5119.             param_var->param_binding_swizzle = SWIZZLE_XYZW;
  5120.          }
  5121.  
  5122.          param_var->param_binding_length++;
  5123.       }
  5124.    }
  5125.    else {
  5126.       idx = add_state_reference(prog->Parameters, state_tokens);
  5127.       if (param_var->param_binding_begin == ~0U) {
  5128.          param_var->param_binding_begin = idx;
  5129.          param_var->param_binding_swizzle = SWIZZLE_XYZW;
  5130.       }
  5131.       param_var->param_binding_length++;
  5132.    }
  5133.  
  5134.    return idx;
  5135. }
  5136.  
  5137.  
  5138. int
  5139. initialize_symbol_from_param(struct gl_program *prog,
  5140.                              struct asm_symbol *param_var,
  5141.                              const gl_state_index tokens[STATE_LENGTH])
  5142. {
  5143.    int idx = -1;
  5144.    gl_state_index state_tokens[STATE_LENGTH];
  5145.  
  5146.  
  5147.    memcpy(state_tokens, tokens, sizeof(state_tokens));
  5148.  
  5149.    assert((state_tokens[0] == STATE_VERTEX_PROGRAM)
  5150.           || (state_tokens[0] == STATE_FRAGMENT_PROGRAM));
  5151.    assert((state_tokens[1] == STATE_ENV)
  5152.           || (state_tokens[1] == STATE_LOCAL));
  5153.  
  5154.    /*
  5155.     * The param type is STATE_VAR.  The program parameter entry will
  5156.     * effectively be a pointer into the LOCAL or ENV parameter array.
  5157.     */
  5158.    param_var->type = at_param;
  5159.    param_var->param_binding_type = PROGRAM_STATE_VAR;
  5160.  
  5161.    /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
  5162.     * we need to unroll it and call add_state_reference() for each row
  5163.     */
  5164.    if (state_tokens[2] != state_tokens[3]) {
  5165.       int row;
  5166.       const int first_row = state_tokens[2];
  5167.       const int last_row = state_tokens[3];
  5168.  
  5169.       for (row = first_row; row <= last_row; row++) {
  5170.          state_tokens[2] = state_tokens[3] = row;
  5171.  
  5172.          idx = add_state_reference(prog->Parameters, state_tokens);
  5173.          if (param_var->param_binding_begin == ~0U) {
  5174.             param_var->param_binding_begin = idx;
  5175.             param_var->param_binding_swizzle = SWIZZLE_XYZW;
  5176.          }
  5177.          param_var->param_binding_length++;
  5178.       }
  5179.    }
  5180.    else {
  5181.       idx = add_state_reference(prog->Parameters, state_tokens);
  5182.       if (param_var->param_binding_begin == ~0U) {
  5183.          param_var->param_binding_begin = idx;
  5184.          param_var->param_binding_swizzle = SWIZZLE_XYZW;
  5185.       }
  5186.       param_var->param_binding_length++;
  5187.    }
  5188.  
  5189.    return idx;
  5190. }
  5191.  
  5192.  
  5193. /**
  5194.  * Put a float/vector constant/literal into the parameter list.
  5195.  * \param param_var  returns info about the parameter/constant's location,
  5196.  *                   binding, type, etc.
  5197.  * \param vec  the vector/constant to add
  5198.  * \param allowSwizzle  if true, try to consolidate constants which only differ
  5199.  *                      by a swizzle.  We don't want to do this when building
  5200.  *                      arrays of constants that may be indexed indirectly.
  5201.  * \return index of the constant in the parameter list.
  5202.  */
  5203. int
  5204. initialize_symbol_from_const(struct gl_program *prog,
  5205.                              struct asm_symbol *param_var,
  5206.                              const struct asm_vector *vec,
  5207.                              GLboolean allowSwizzle)
  5208. {
  5209.    unsigned swizzle;
  5210.    const int idx = _mesa_add_unnamed_constant(prog->Parameters,
  5211.                                               vec->data, vec->count,
  5212.                                               allowSwizzle ? &swizzle : NULL);
  5213.  
  5214.    param_var->type = at_param;
  5215.    param_var->param_binding_type = PROGRAM_CONSTANT;
  5216.  
  5217.    if (param_var->param_binding_begin == ~0U) {
  5218.       param_var->param_binding_begin = idx;
  5219.       param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
  5220.    }
  5221.    param_var->param_binding_length++;
  5222.  
  5223.    return idx;
  5224. }
  5225.  
  5226.  
  5227. char *
  5228. make_error_string(const char *fmt, ...)
  5229. {
  5230.    int length;
  5231.    char *str;
  5232.    va_list args;
  5233.  
  5234.  
  5235.    /* Call vsnprintf once to determine how large the final string is.  Call it
  5236.     * again to do the actual formatting.  from the vsnprintf manual page:
  5237.     *
  5238.     *    Upon successful return, these functions return the number of
  5239.     *    characters printed  (not including the trailing '\0' used to end
  5240.     *    output to strings).
  5241.     */
  5242.    va_start(args, fmt);
  5243.    length = 1 + vsnprintf(NULL, 0, fmt, args);
  5244.    va_end(args);
  5245.  
  5246.    str = malloc(length);
  5247.    if (str) {
  5248.       va_start(args, fmt);
  5249.       vsnprintf(str, length, fmt, args);
  5250.       va_end(args);
  5251.    }
  5252.  
  5253.    return str;
  5254. }
  5255.  
  5256.  
  5257. void
  5258. yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
  5259. {
  5260.    char *err_str;
  5261.  
  5262.  
  5263.    err_str = make_error_string("glProgramStringARB(%s)\n", s);
  5264.    if (err_str) {
  5265.       _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
  5266.       free(err_str);
  5267.    }
  5268.  
  5269.    err_str = make_error_string("line %u, char %u: error: %s\n",
  5270.                                locp->first_line, locp->first_column, s);
  5271.    _mesa_set_program_error(state->ctx, locp->position, err_str);
  5272.  
  5273.    if (err_str) {
  5274.       free(err_str);
  5275.    }
  5276. }
  5277.  
  5278.  
  5279. GLboolean
  5280. _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str,
  5281.                         GLsizei len, struct asm_parser_state *state)
  5282. {
  5283.    struct asm_instruction *inst;
  5284.    unsigned i;
  5285.    GLubyte *strz;
  5286.    GLboolean result = GL_FALSE;
  5287.    void *temp;
  5288.    struct asm_symbol *sym;
  5289.  
  5290.    state->ctx = ctx;
  5291.    state->prog->Target = target;
  5292.    state->prog->Parameters = _mesa_new_parameter_list();
  5293.  
  5294.    /* Make a copy of the program string and force it to be NUL-terminated.
  5295.     */
  5296.    strz = (GLubyte *) malloc(len + 1);
  5297.    if (strz == NULL) {
  5298.       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
  5299.       return GL_FALSE;
  5300.    }
  5301.    memcpy (strz, str, len);
  5302.    strz[len] = '\0';
  5303.  
  5304.    state->prog->String = strz;
  5305.  
  5306.    state->st = _mesa_symbol_table_ctor();
  5307.  
  5308.    state->limits = (target == GL_VERTEX_PROGRAM_ARB)
  5309.       ? & ctx->Const.Program[MESA_SHADER_VERTEX]
  5310.       : & ctx->Const.Program[MESA_SHADER_FRAGMENT];
  5311.  
  5312.    state->MaxTextureImageUnits = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
  5313.    state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
  5314.    state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
  5315.    state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
  5316.    state->MaxLights = ctx->Const.MaxLights;
  5317.    state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
  5318.    state->MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
  5319.  
  5320.    state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
  5321.       ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
  5322.  
  5323.    _mesa_set_program_error(ctx, -1, NULL);
  5324.  
  5325.    _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
  5326.    yyparse(state);
  5327.    _mesa_program_lexer_dtor(state->scanner);
  5328.  
  5329.  
  5330.    if (ctx->Program.ErrorPos != -1) {
  5331.       goto error;
  5332.    }
  5333.  
  5334.    if (! _mesa_layout_parameters(state)) {
  5335.       struct YYLTYPE loc;
  5336.  
  5337.       loc.first_line = 0;
  5338.       loc.first_column = 0;
  5339.       loc.position = len;
  5340.  
  5341.       yyerror(& loc, state, "invalid PARAM usage");
  5342.       goto error;
  5343.    }
  5344.  
  5345.  
  5346.    
  5347.    /* Add one instruction to store the "END" instruction.
  5348.     */
  5349.    state->prog->Instructions =
  5350.       _mesa_alloc_instructions(state->prog->NumInstructions + 1);
  5351.  
  5352.    if (state->prog->Instructions == NULL) {
  5353.       goto error;
  5354.    }
  5355.  
  5356.    inst = state->inst_head;
  5357.    for (i = 0; i < state->prog->NumInstructions; i++) {
  5358.       struct asm_instruction *const temp = inst->next;
  5359.  
  5360.       state->prog->Instructions[i] = inst->Base;
  5361.       inst = temp;
  5362.    }
  5363.  
  5364.    /* Finally, tag on an OPCODE_END instruction */
  5365.    {
  5366.       const GLuint numInst = state->prog->NumInstructions;
  5367.       _mesa_init_instructions(state->prog->Instructions + numInst, 1);
  5368.       state->prog->Instructions[numInst].Opcode = OPCODE_END;
  5369.    }
  5370.    state->prog->NumInstructions++;
  5371.  
  5372.    state->prog->NumParameters = state->prog->Parameters->NumParameters;
  5373.    state->prog->NumAttributes = _mesa_bitcount_64(state->prog->InputsRead);
  5374.  
  5375.    /*
  5376.     * Initialize native counts to logical counts.  The device driver may
  5377.     * change them if program is translated into a hardware program.
  5378.     */
  5379.    state->prog->NumNativeInstructions = state->prog->NumInstructions;
  5380.    state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
  5381.    state->prog->NumNativeParameters = state->prog->NumParameters;
  5382.    state->prog->NumNativeAttributes = state->prog->NumAttributes;
  5383.    state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
  5384.  
  5385.    result = GL_TRUE;
  5386.  
  5387. error:
  5388.    for (inst = state->inst_head; inst != NULL; inst = temp) {
  5389.       temp = inst->next;
  5390.       free(inst);
  5391.    }
  5392.  
  5393.    state->inst_head = NULL;
  5394.    state->inst_tail = NULL;
  5395.  
  5396.    for (sym = state->sym; sym != NULL; sym = temp) {
  5397.       temp = sym->next;
  5398.  
  5399.       free((void *) sym->name);
  5400.       free(sym);
  5401.    }
  5402.    state->sym = NULL;
  5403.  
  5404.    _mesa_symbol_table_dtor(state->st);
  5405.    state->st = NULL;
  5406.  
  5407.    return result;
  5408. }
  5409.