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