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