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