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