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