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