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