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