Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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