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