Subversion Repositories Kolibri OS

Rev

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

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