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