2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
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. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 1
68 /* Copy the first part of user declarations. */
70 /* Line 189 of yacc.c */
71 #line 1 "program_parse.y"
74 * Copyright © 2009 Intel Corporation
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:
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
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.
99 #include "main/mtypes.h"
100 #include "main/imports.h"
102 #include "prog_parameter.h"
103 #include "prog_parameter_layout.h"
104 #include "prog_statevars.h"
105 #include "prog_instruction.h"
107 #include "symbol_table.h"
108 #include "program_parser.h"
110 extern void *yy_scan_string(char *);
111 extern void yy_delete_buffer(void *);
113 static struct asm_symbol
*declare_variable(struct asm_parser_state
*state
,
114 char *name
, enum asm_type t
, struct YYLTYPE
*locp
);
116 static int add_state_reference(struct gl_program_parameter_list
*param_list
,
117 const gl_state_index tokens
[STATE_LENGTH
]);
119 static int initialize_symbol_from_state(struct gl_program
*prog
,
120 struct asm_symbol
*param_var
, const gl_state_index tokens
[STATE_LENGTH
]);
122 static int initialize_symbol_from_param(struct gl_program
*prog
,
123 struct asm_symbol
*param_var
, const gl_state_index tokens
[STATE_LENGTH
]);
125 static int initialize_symbol_from_const(struct gl_program
*prog
,
126 struct asm_symbol
*param_var
, const struct asm_vector
*vec
);
128 static int yyparse(struct asm_parser_state
*state
);
130 static char *make_error_string(const char *fmt
, ...);
132 static void yyerror(struct YYLTYPE
*locp
, struct asm_parser_state
*state
,
135 static int validate_inputs(struct YYLTYPE
*locp
,
136 struct asm_parser_state
*state
);
138 static void init_dst_reg(struct prog_dst_register
*r
);
140 static void init_src_reg(struct asm_src_register
*r
);
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
);
148 #define TRUE (!FALSE)
151 #define YYLLOC_DEFAULT(Current, Rhs, 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; \
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; \
169 #define YYLEX_PARAM state->scanner
172 /* Line 189 of yacc.c */
173 #line 174 "program_parse.tab.c"
175 /* Enabling traces. */
180 /* Enabling verbose error messages. */
181 #ifdef YYERROR_VERBOSE
182 # undef YYERROR_VERBOSE
183 # define YYERROR_VERBOSE 1
185 # define YYERROR_VERBOSE 1
188 /* Enabling the token table. */
189 #ifndef YYTOKEN_TABLE
190 # define YYTOKEN_TABLE 0
197 /* Put the tokens into the symbol table, so that GDB and other debuggers
287 TEX_SHADOWRECT
= 345,
290 TEX_ARRAYSHADOW1D
= 348,
291 TEX_ARRAYSHADOW2D
= 349,
308 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
309 typedef union YYSTYPE
312 /* Line 214 of yacc.c */
313 #line 107 "program_parse.y"
315 struct asm_instruction
*inst
;
316 struct asm_symbol
*sym
;
317 struct asm_symbol temp_sym
;
318 struct asm_swizzle_mask swiz_mask
;
319 struct asm_src_register src_reg
;
320 struct prog_dst_register dst_reg
;
321 struct prog_instruction temp_inst
;
329 struct asm_vector vector
;
330 gl_inst_opcode opcode
;
334 /* Line 214 of yacc.c */
335 #line 336 "program_parse.tab.c"
337 # define YYSTYPE_IS_TRIVIAL 1
338 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
339 # define YYSTYPE_IS_DECLARED 1
342 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
343 typedef struct YYLTYPE
350 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
351 # define YYLTYPE_IS_DECLARED 1
352 # define YYLTYPE_IS_TRIVIAL 1
356 /* Copy the second part of user declarations. */
358 /* Line 264 of yacc.c */
359 #line 242 "program_parse.y"
361 extern int yylex(YYSTYPE
*yylval_param
, YYLTYPE
*yylloc_param
,
365 /* Line 264 of yacc.c */
366 #line 367 "program_parse.tab.c"
373 typedef YYTYPE_UINT8 yytype_uint8
;
375 typedef unsigned char yytype_uint8
;
379 typedef YYTYPE_INT8 yytype_int8
;
380 #elif (defined __STDC__ || defined __C99__FUNC__ \
381 || defined __cplusplus || defined _MSC_VER)
382 typedef signed char yytype_int8
;
384 typedef short int yytype_int8
;
388 typedef YYTYPE_UINT16 yytype_uint16
;
390 typedef unsigned short int yytype_uint16
;
394 typedef YYTYPE_INT16 yytype_int16
;
396 typedef short int yytype_int16
;
400 # ifdef __SIZE_TYPE__
401 # define YYSIZE_T __SIZE_TYPE__
402 # elif defined size_t
403 # define YYSIZE_T size_t
404 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
405 || defined __cplusplus || defined _MSC_VER)
406 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
407 # define YYSIZE_T size_t
409 # define YYSIZE_T unsigned int
413 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
418 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
419 # define YY_(msgid) dgettext ("bison-runtime", msgid)
423 # define YY_(msgid) msgid
427 /* Suppress unused-variable warnings by "using" E. */
428 #if ! defined lint || defined __GNUC__
429 # define YYUSE(e) ((void) (e))
431 # define YYUSE(e) /* empty */
434 /* Identity function, used to suppress warnings about constant conditions. */
438 #if (defined __STDC__ || defined __C99__FUNC__ \
439 || defined __cplusplus || defined _MSC_VER)
452 #if ! defined yyoverflow || YYERROR_VERBOSE
454 /* The parser invokes alloca or malloc; define the necessary symbols. */
456 # ifdef YYSTACK_USE_ALLOCA
457 # if YYSTACK_USE_ALLOCA
459 # define YYSTACK_ALLOC __builtin_alloca
460 # elif defined __BUILTIN_VA_ARG_INCR
461 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
463 # define YYSTACK_ALLOC __alloca
464 # elif defined _MSC_VER
465 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
466 # define alloca _alloca
468 # define YYSTACK_ALLOC alloca
469 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
470 || defined __cplusplus || defined _MSC_VER)
471 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
480 # ifdef YYSTACK_ALLOC
481 /* Pacify GCC's `empty if-body' warning. */
482 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
483 # ifndef YYSTACK_ALLOC_MAXIMUM
484 /* The OS might guarantee only one guard page at the bottom of the stack,
485 and a page size can be as small as 4096 bytes. So we cannot safely
486 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
487 to allow for a few compiler-allocated temporary stack slots. */
488 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
491 # define YYSTACK_ALLOC YYMALLOC
492 # define YYSTACK_FREE YYFREE
493 # ifndef YYSTACK_ALLOC_MAXIMUM
494 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
496 # if (defined __cplusplus && ! defined _STDLIB_H \
497 && ! ((defined YYMALLOC || defined malloc) \
498 && (defined YYFREE || defined free)))
499 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
505 # define YYMALLOC malloc
506 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
507 || defined __cplusplus || defined _MSC_VER)
508 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
513 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
514 || defined __cplusplus || defined _MSC_VER)
515 void free (void *); /* INFRINGES ON USER NAME SPACE */
519 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
522 #if (! defined yyoverflow \
523 && (! defined __cplusplus \
524 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
525 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
527 /* A type that is properly aligned for any stack member. */
530 yytype_int16 yyss_alloc
;
535 /* The size of the maximum gap between one aligned stack and the next. */
536 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
538 /* The size of an array large to enough to hold all stacks, each with
540 # define YYSTACK_BYTES(N) \
541 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
542 + 2 * YYSTACK_GAP_MAXIMUM)
544 /* Copy COUNT objects from FROM to TO. The source and destination do
547 # if defined __GNUC__ && 1 < __GNUC__
548 # define YYCOPY(To, From, Count) \
549 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
551 # define YYCOPY(To, From, Count) \
555 for (yyi = 0; yyi < (Count); yyi++) \
556 (To)[yyi] = (From)[yyi]; \
562 /* Relocate STACK from its old location to the new one. The
563 local variables YYSIZE and YYSTACKSIZE give the old and new number of
564 elements in the stack, and YYPTR gives the new location of the
565 stack. Advance YYPTR to a properly aligned location for the next
567 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
570 YYSIZE_T yynewbytes; \
571 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
572 Stack = &yyptr->Stack_alloc; \
573 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
574 yyptr += yynewbytes / sizeof (*yyptr); \
580 /* YYFINAL -- State number of the termination state. */
582 /* YYLAST -- Last index in YYTABLE. */
585 /* YYNTOKENS -- Number of terminals. */
586 #define YYNTOKENS 115
587 /* YYNNTS -- Number of nonterminals. */
589 /* YYNRULES -- Number of rules. */
591 /* YYNRULES -- Number of states. */
592 #define YYNSTATES 431
594 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
596 #define YYMAXUTOK 360
598 #define YYTRANSLATE(YYX) \
599 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
601 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
602 static const yytype_uint8 yytranslate
[] =
604 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 110, 107, 111, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 2, 106,
610 2, 112, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 108, 2, 109, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 113, 2, 114, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
630 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
631 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
632 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
633 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
634 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
635 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
636 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
637 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
638 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
639 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
644 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
646 static const yytype_uint16 yyprhs
[] =
648 0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
649 24, 27, 30, 32, 34, 36, 38, 40, 42, 44,
650 46, 48, 50, 52, 57, 62, 67, 74, 81, 90,
651 99, 102, 105, 107, 109, 111, 113, 115, 117, 119,
652 121, 123, 125, 127, 129, 136, 140, 144, 147, 150,
653 158, 161, 163, 165, 167, 169, 174, 176, 178, 180,
654 182, 184, 186, 188, 192, 193, 196, 199, 201, 203,
655 205, 207, 209, 211, 213, 215, 217, 218, 220, 222,
656 224, 226, 227, 229, 231, 233, 235, 237, 239, 244,
657 247, 250, 252, 255, 257, 260, 262, 265, 270, 275,
658 277, 278, 282, 284, 286, 289, 291, 294, 296, 298,
659 302, 309, 310, 312, 315, 320, 322, 326, 328, 330,
660 332, 334, 336, 338, 340, 342, 344, 346, 349, 352,
661 355, 358, 361, 364, 367, 370, 373, 376, 379, 383,
662 385, 387, 389, 395, 397, 399, 401, 404, 406, 408,
663 411, 413, 416, 423, 425, 429, 431, 433, 435, 437,
664 439, 444, 446, 448, 450, 452, 454, 456, 459, 461,
665 463, 469, 471, 474, 476, 478, 484, 487, 488, 495,
666 499, 500, 502, 504, 506, 508, 510, 513, 515, 517,
667 520, 525, 530, 531, 533, 535, 537, 539, 541, 543,
668 545, 547, 553, 555, 559, 565, 571, 573, 577, 583,
669 585, 587, 589, 591, 593, 595, 597, 599, 601, 605,
670 611, 619, 629, 632, 635, 637, 639, 640, 641, 645,
671 646, 650, 654, 656, 661, 664, 667, 670, 673, 677,
672 680, 684, 685, 687, 689, 690, 692, 694, 695, 697,
673 699, 700, 702, 704, 705, 709, 710, 714, 715, 719,
677 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
678 static const yytype_int16 yyrhs
[] =
680 116, 0, -1, 117, 118, 120, 12, -1, 3, -1,
681 4, -1, 118, 119, -1, -1, 8, 98, 106, -1,
682 120, 121, -1, -1, 122, 106, -1, 158, 106, -1,
683 123, -1, 124, -1, 125, -1, 126, -1, 127, -1,
684 128, -1, 129, -1, 130, -1, 135, -1, 131, -1,
685 132, -1, 19, 139, 107, 136, -1, 18, 138, 107,
686 137, -1, 16, 138, 107, 136, -1, 14, 138, 107,
687 136, 107, 136, -1, 13, 138, 107, 137, 107, 137,
688 -1, 17, 138, 107, 137, 107, 137, 107, 137, -1,
689 15, 138, 107, 137, 107, 133, 107, 134, -1, 20,
690 137, -1, 82, 242, -1, 83, -1, 84, -1, 85,
691 -1, 86, -1, 87, -1, 88, -1, 89, -1, 90,
692 -1, 91, -1, 92, -1, 93, -1, 94, -1, 21,
693 138, 107, 143, 107, 140, -1, 228, 143, 155, -1,
694 228, 143, 156, -1, 144, 157, -1, 152, 154, -1,
695 141, 107, 141, 107, 141, 107, 141, -1, 228, 142,
696 -1, 22, -1, 98, -1, 98, -1, 160, -1, 145,
697 108, 146, 109, -1, 174, -1, 235, -1, 98, -1,
698 98, -1, 147, -1, 148, -1, 22, -1, 152, 153,
699 149, -1, -1, 110, 150, -1, 111, 151, -1, 22,
700 -1, 22, -1, 98, -1, 102, -1, 102, -1, 102,
701 -1, 102, -1, 99, -1, 103, -1, -1, 99, -1,
702 100, -1, 101, -1, 102, -1, -1, 159, -1, 166,
703 -1, 229, -1, 231, -1, 234, -1, 247, -1, 7,
704 98, 112, 160, -1, 95, 161, -1, 37, 165, -1,
705 59, -1, 97, 163, -1, 52, -1, 28, 240, -1,
706 36, -1, 73, 241, -1, 49, 108, 164, 109, -1,
707 96, 108, 162, 109, -1, 22, -1, -1, 108, 164,
708 109, -1, 22, -1, 59, -1, 28, 240, -1, 36,
709 -1, 73, 241, -1, 167, -1, 168, -1, 10, 98,
710 170, -1, 10, 98, 108, 169, 109, 171, -1, -1,
711 22, -1, 112, 173, -1, 112, 113, 172, 114, -1,
712 175, -1, 172, 107, 175, -1, 177, -1, 212, -1,
713 222, -1, 177, -1, 212, -1, 223, -1, 176, -1,
714 213, -1, 222, -1, 177, -1, 72, 201, -1, 72,
715 178, -1, 72, 180, -1, 72, 183, -1, 72, 185,
716 -1, 72, 191, -1, 72, 187, -1, 72, 194, -1,
717 72, 196, -1, 72, 198, -1, 72, 200, -1, 46,
718 239, 179, -1, 189, -1, 32, -1, 68, -1, 42,
719 108, 190, 109, 181, -1, 189, -1, 59, -1, 25,
720 -1, 71, 182, -1, 39, -1, 31, -1, 43, 184,
721 -1, 24, -1, 239, 66, -1, 44, 108, 190, 109,
722 239, 186, -1, 189, -1, 74, 243, 188, -1, 28,
723 -1, 24, -1, 30, -1, 70, -1, 22, -1, 75,
724 241, 192, 193, -1, 34, -1, 53, -1, 78, -1,
725 79, -1, 77, -1, 76, -1, 35, 195, -1, 28,
726 -1, 55, -1, 27, 108, 197, 109, 56, -1, 22,
727 -1, 57, 199, -1, 69, -1, 25, -1, 203, 65,
728 108, 206, 109, -1, 203, 202, -1, -1, 65, 108,
729 206, 104, 206, 109, -1, 48, 207, 204, -1, -1,
730 205, -1, 40, -1, 81, -1, 41, -1, 22, -1,
731 50, 208, -1, 62, -1, 51, -1, 80, 241, -1,
732 54, 108, 210, 109, -1, 47, 108, 211, 109, -1,
733 -1, 209, -1, 22, -1, 22, -1, 22, -1, 216,
734 -1, 219, -1, 214, -1, 217, -1, 61, 33, 108,
735 215, 109, -1, 220, -1, 220, 104, 220, -1, 61,
736 33, 108, 220, 109, -1, 61, 45, 108, 218, 109,
737 -1, 221, -1, 221, 104, 221, -1, 61, 45, 108,
738 221, 109, -1, 22, -1, 22, -1, 224, -1, 226,
739 -1, 225, -1, 226, -1, 227, -1, 23, -1, 22,
740 -1, 113, 227, 114, -1, 113, 227, 107, 227, 114,
741 -1, 113, 227, 107, 227, 107, 227, 114, -1, 113,
742 227, 107, 227, 107, 227, 107, 227, 114, -1, 228,
743 23, -1, 228, 22, -1, 110, -1, 111, -1, -1,
744 -1, 11, 230, 233, -1, -1, 5, 232, 233, -1,
745 233, 107, 98, -1, 98, -1, 9, 98, 112, 235,
746 -1, 64, 59, -1, 64, 36, -1, 64, 236, -1,
747 64, 58, -1, 64, 73, 241, -1, 64, 29, -1,
748 28, 237, 238, -1, -1, 38, -1, 26, -1, -1,
749 60, -1, 67, -1, -1, 38, -1, 26, -1, -1,
750 60, -1, 67, -1, -1, 108, 244, 109, -1, -1,
751 108, 245, 109, -1, -1, 108, 246, 109, -1, 22,
752 -1, 22, -1, 22, -1, 6, 98, 112, 98, -1
755 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
756 static const yytype_uint16 yyrline
[] =
758 0, 249, 249, 252, 260, 272, 273, 276, 298, 299,
759 302, 317, 320, 325, 332, 333, 334, 335, 336, 337,
760 338, 341, 342, 345, 351, 358, 365, 373, 380, 388,
761 433, 440, 446, 447, 448, 449, 450, 451, 452, 453,
762 454, 455, 456, 457, 460, 473, 486, 499, 521, 530,
763 539, 546, 555, 583, 625, 636, 657, 667, 673, 704,
764 721, 721, 723, 730, 742, 743, 744, 747, 759, 771,
765 789, 800, 812, 814, 815, 816, 817, 820, 820, 820,
766 820, 821, 824, 825, 826, 827, 828, 829, 832, 850,
767 854, 860, 864, 868, 872, 881, 890, 894, 899, 905,
768 916, 916, 917, 919, 923, 927, 931, 937, 937, 939,
769 955, 978, 981, 992, 998, 1004, 1005, 1012, 1018, 1024,
770 1032, 1038, 1044, 1052, 1058, 1064, 1072, 1073, 1076, 1077,
771 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1088, 1097,
772 1101, 1105, 1111, 1120, 1124, 1128, 1137, 1141, 1147, 1153,
773 1160, 1165, 1173, 1183, 1185, 1193, 1199, 1203, 1207, 1213,
774 1224, 1233, 1237, 1242, 1246, 1250, 1254, 1260, 1267, 1271,
775 1277, 1285, 1296, 1303, 1307, 1313, 1323, 1334, 1338, 1356,
776 1365, 1368, 1374, 1378, 1382, 1388, 1399, 1404, 1409, 1414,
777 1419, 1424, 1432, 1435, 1440, 1453, 1461, 1474, 1474, 1476,
778 1476, 1478, 1488, 1493, 1500, 1510, 1519, 1524, 1531, 1541,
779 1551, 1563, 1563, 1564, 1564, 1566, 1573, 1578, 1585, 1593,
780 1601, 1610, 1621, 1625, 1631, 1632, 1633, 1636, 1636, 1639,
781 1639, 1642, 1648, 1656, 1669, 1678, 1687, 1691, 1700, 1709,
782 1720, 1727, 1732, 1741, 1753, 1756, 1765, 1776, 1777, 1778,
783 1781, 1782, 1783, 1786, 1787, 1790, 1791, 1794, 1795, 1798,
788 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
789 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
790 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
791 static const char *const yytname
[] =
793 "$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
794 "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
795 "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
796 "KIL", "SWZ", "INTEGER", "REAL", "AMBIENT", "ATTENUATION", "BACK",
797 "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION", "ENV",
798 "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
799 "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
800 "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
801 "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT", "POINTSIZE", "POSITION",
802 "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
803 "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE", "SPECULAR", "SPOT",
804 "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
805 "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
806 "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
807 "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
808 "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
809 "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE",
810 "DOT_DOT", "DOT", "';'", "','", "'['", "']'", "'+'", "'-'", "'='", "'{'",
811 "'}'", "$accept", "program", "language", "optionSequence", "option",
812 "statementSequence", "statement", "instruction", "ALU_instruction",
813 "TexInstruction", "ARL_instruction", "VECTORop_instruction",
814 "SCALARop_instruction", "BINSCop_instruction", "BINop_instruction",
815 "TRIop_instruction", "SAMPLE_instruction", "KIL_instruction",
816 "texImageUnit", "texTarget", "SWZ_instruction", "scalarSrcReg",
817 "swizzleSrcReg", "maskedDstReg", "maskedAddrReg", "extendedSwizzle",
818 "extSwizComp", "extSwizSel", "srcReg", "dstReg", "progParamArray",
819 "progParamArrayMem", "progParamArrayAbs", "progParamArrayRel",
820 "addrRegRelOffset", "addrRegPosOffset", "addrRegNegOffset", "addrReg",
821 "addrComponent", "addrWriteMask", "scalarSuffix", "swizzleSuffix",
822 "optionalMask", "namingStatement", "ATTRIB_statement", "attribBinding",
823 "vtxAttribItem", "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum",
824 "fragAttribItem", "PARAM_statement", "PARAM_singleStmt",
825 "PARAM_multipleStmt", "optArraySize", "paramSingleInit",
826 "paramMultipleInit", "paramMultInitList", "paramSingleItemDecl",
827 "paramSingleItemUse", "paramMultipleItem", "stateMultipleItem",
828 "stateSingleItem", "stateMaterialItem", "stateMatProperty",
829 "stateLightItem", "stateLightProperty", "stateSpotProperty",
830 "stateLightModelItem", "stateLModProperty", "stateLightProdItem",
831 "stateLProdProperty", "stateTexEnvItem", "stateTexEnvProperty",
832 "ambDiffSpecProperty", "stateLightNumber", "stateTexGenItem",
833 "stateTexGenType", "stateTexGenCoord", "stateFogItem",
834 "stateFogProperty", "stateClipPlaneItem", "stateClipPlaneNum",
835 "statePointItem", "statePointProperty", "stateMatrixRow",
836 "stateMatrixRows", "optMatrixRows", "stateMatrixItem",
837 "stateOptMatModifier", "stateMatModifier", "stateMatrixRowNum",
838 "stateMatrixName", "stateOptModMatNum", "stateModMatNum",
839 "statePaletteMatNum", "stateProgramMatNum", "programSingleItem",
840 "programMultipleItem", "progEnvParams", "progEnvParamNums",
841 "progEnvParam", "progLocalParams", "progLocalParamNums",
842 "progLocalParam", "progEnvParamNum", "progLocalParamNum",
843 "paramConstDecl", "paramConstUse", "paramConstScalarDecl",
844 "paramConstScalarUse", "paramConstVector", "signedFloatConstant",
845 "optionalSign", "TEMP_statement", "@1", "ADDRESS_statement", "@2",
846 "varNameList", "OUTPUT_statement", "resultBinding", "resultColBinding",
847 "optResultFaceType", "optResultColorType", "optFaceType", "optColorType",
848 "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
849 "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
855 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
857 static const yytype_uint16 yytoknum
[] =
859 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
860 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
861 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
862 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
863 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
864 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
865 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
866 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
867 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
868 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
869 355, 356, 357, 358, 359, 360, 59, 44, 91, 93,
874 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
875 static const yytype_uint8 yyr1
[] =
877 0, 115, 116, 117, 117, 118, 118, 119, 120, 120,
878 121, 121, 122, 122, 123, 123, 123, 123, 123, 123,
879 123, 124, 124, 125, 126, 127, 128, 129, 130, 131,
880 132, 133, 134, 134, 134, 134, 134, 134, 134, 134,
881 134, 134, 134, 134, 135, 136, 137, 138, 139, 140,
882 141, 142, 142, 143, 143, 143, 143, 144, 144, 145,
883 146, 146, 147, 148, 149, 149, 149, 150, 151, 152,
884 153, 154, 155, 156, 156, 156, 156, 157, 157, 157,
885 157, 157, 158, 158, 158, 158, 158, 158, 159, 160,
886 160, 161, 161, 161, 161, 161, 161, 161, 161, 162,
887 163, 163, 164, 165, 165, 165, 165, 166, 166, 167,
888 168, 169, 169, 170, 171, 172, 172, 173, 173, 173,
889 174, 174, 174, 175, 175, 175, 176, 176, 177, 177,
890 177, 177, 177, 177, 177, 177, 177, 177, 178, 179,
891 179, 179, 180, 181, 181, 181, 181, 181, 182, 183,
892 184, 184, 185, 186, 187, 188, 189, 189, 189, 190,
893 191, 192, 192, 193, 193, 193, 193, 194, 195, 195,
894 196, 197, 198, 199, 199, 200, 201, 202, 202, 203,
895 204, 204, 205, 205, 205, 206, 207, 207, 207, 207,
896 207, 207, 208, 208, 209, 210, 211, 212, 212, 213,
897 213, 214, 215, 215, 216, 217, 218, 218, 219, 220,
898 221, 222, 222, 223, 223, 224, 225, 225, 226, 226,
899 226, 226, 227, 227, 228, 228, 228, 230, 229, 232,
900 231, 233, 233, 234, 235, 235, 235, 235, 235, 235,
901 236, 237, 237, 237, 238, 238, 238, 239, 239, 239,
902 240, 240, 240, 241, 241, 242, 242, 243, 243, 244,
906 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
907 static const yytype_uint8 yyr2
[] =
909 0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
910 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
911 1, 1, 1, 4, 4, 4, 6, 6, 8, 8,
912 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
913 1, 1, 1, 1, 6, 3, 3, 2, 2, 7,
914 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
915 1, 1, 1, 3, 0, 2, 2, 1, 1, 1,
916 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
917 1, 0, 1, 1, 1, 1, 1, 1, 4, 2,
918 2, 1, 2, 1, 2, 1, 2, 4, 4, 1,
919 0, 3, 1, 1, 2, 1, 2, 1, 1, 3,
920 6, 0, 1, 2, 4, 1, 3, 1, 1, 1,
921 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
922 2, 2, 2, 2, 2, 2, 2, 2, 3, 1,
923 1, 1, 5, 1, 1, 1, 2, 1, 1, 2,
924 1, 2, 6, 1, 3, 1, 1, 1, 1, 1,
925 4, 1, 1, 1, 1, 1, 1, 2, 1, 1,
926 5, 1, 2, 1, 1, 5, 2, 0, 6, 3,
927 0, 1, 1, 1, 1, 1, 2, 1, 1, 2,
928 4, 4, 0, 1, 1, 1, 1, 1, 1, 1,
929 1, 5, 1, 3, 5, 5, 1, 3, 5, 1,
930 1, 1, 1, 1, 1, 1, 1, 1, 3, 5,
931 7, 9, 2, 2, 1, 1, 0, 0, 3, 0,
932 3, 3, 1, 4, 2, 2, 2, 2, 3, 2,
933 3, 0, 1, 1, 0, 1, 1, 0, 1, 1,
934 0, 1, 1, 0, 3, 0, 3, 0, 3, 1,
938 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
939 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
940 means the default is an error. */
941 static const yytype_uint16 yydefact
[] =
943 0, 3, 4, 0, 6, 1, 9, 0, 5, 0,
944 0, 229, 0, 0, 0, 0, 227, 2, 0, 0,
945 0, 0, 0, 0, 0, 226, 0, 8, 0, 12,
946 13, 14, 15, 16, 17, 18, 19, 21, 22, 20,
947 0, 82, 83, 107, 108, 84, 85, 86, 87, 7,
948 0, 0, 0, 0, 0, 0, 0, 58, 0, 81,
949 57, 0, 0, 0, 0, 0, 69, 0, 0, 224,
950 225, 30, 0, 0, 10, 11, 232, 230, 0, 0,
951 0, 111, 226, 109, 228, 241, 239, 235, 237, 234,
952 253, 236, 226, 77, 78, 79, 80, 47, 226, 226,
953 226, 226, 226, 226, 71, 48, 217, 216, 0, 0,
954 0, 0, 53, 226, 76, 0, 54, 56, 120, 121,
955 197, 198, 122, 213, 214, 0, 0, 262, 88, 233,
956 112, 0, 113, 117, 118, 119, 211, 212, 215, 0,
957 243, 242, 244, 0, 238, 0, 0, 0, 0, 25,
958 0, 24, 23, 250, 105, 103, 253, 90, 0, 0,
959 0, 0, 0, 247, 0, 247, 0, 0, 257, 253,
960 128, 129, 130, 131, 133, 132, 134, 135, 136, 137,
961 0, 250, 95, 0, 93, 91, 253, 0, 100, 89,
962 0, 74, 73, 75, 46, 0, 0, 231, 0, 223,
963 222, 245, 246, 240, 259, 0, 226, 226, 0, 0,
964 226, 251, 252, 104, 106, 0, 0, 0, 168, 169,
965 167, 0, 150, 249, 248, 149, 0, 0, 0, 0,
966 192, 188, 0, 187, 253, 180, 174, 173, 172, 0,
967 0, 0, 0, 94, 0, 96, 0, 0, 92, 226,
968 218, 62, 0, 60, 61, 0, 226, 0, 110, 254,
969 27, 26, 72, 45, 255, 0, 0, 209, 0, 210,
970 0, 171, 0, 159, 0, 151, 0, 156, 157, 140,
971 141, 158, 138, 139, 0, 194, 186, 193, 0, 189,
972 182, 184, 183, 179, 181, 261, 0, 155, 154, 161,
973 162, 0, 0, 102, 0, 99, 0, 0, 0, 55,
974 70, 64, 44, 0, 0, 226, 0, 31, 0, 226,
975 204, 208, 0, 0, 247, 196, 0, 195, 0, 258,
976 166, 165, 163, 164, 160, 185, 0, 97, 98, 101,
977 226, 219, 0, 0, 63, 226, 51, 52, 50, 0,
978 0, 0, 115, 123, 126, 124, 199, 200, 125, 260,
979 0, 32, 33, 34, 35, 36, 37, 38, 39, 40,
980 41, 42, 43, 29, 28, 170, 145, 147, 144, 0,
981 142, 143, 0, 191, 190, 175, 0, 67, 65, 68,
982 66, 0, 0, 0, 127, 177, 226, 114, 256, 148,
983 146, 152, 153, 226, 220, 226, 0, 0, 0, 176,
984 116, 0, 0, 0, 202, 0, 206, 0, 221, 226,
985 201, 0, 205, 0, 0, 49, 203, 207, 0, 0,
989 /* YYDEFGOTO[NTERM-NUM]. */
990 static const yytype_int16 yydefgoto
[] =
992 -1, 3, 4, 6, 8, 9, 27, 28, 29, 30,
993 31, 32, 33, 34, 35, 36, 37, 38, 265, 373,
994 39, 146, 71, 58, 67, 312, 313, 348, 114, 59,
995 115, 252, 253, 254, 344, 388, 390, 68, 311, 105,
996 263, 194, 97, 40, 41, 116, 189, 306, 248, 304,
997 157, 42, 43, 44, 131, 83, 258, 351, 132, 117,
998 352, 353, 118, 170, 282, 171, 380, 400, 172, 225,
999 173, 401, 174, 298, 283, 274, 175, 301, 334, 176,
1000 220, 177, 272, 178, 238, 179, 394, 409, 180, 293,
1001 294, 336, 235, 286, 287, 328, 326, 119, 355, 356,
1002 413, 120, 357, 415, 121, 268, 270, 358, 122, 136,
1003 123, 124, 138, 72, 45, 55, 46, 50, 77, 47,
1004 60, 91, 142, 203, 226, 213, 144, 317, 240, 205,
1008 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1010 #define YYPACT_NINF -377
1011 static const yytype_int16 yypact
[] =
1013 205, -377, -377, 34, -377, -377, 50, -17, -377, 166,
1014 -16, -377, 12, 26, 36, 65, -377, -377, -31, -31,
1015 -31, -31, -31, -31, 72, -67, -31, -377, 108, -377,
1016 -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1017 109, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1018 118, 28, 106, 107, 54, 118, 78, -377, 110, 101,
1019 -377, 113, 114, 115, 116, 117, -377, 119, 123, -377,
1020 -377, -377, -15, 120, -377, -377, -377, 121, 131, -13,
1021 168, 214, -34, -377, 121, 27, -377, -377, -377, -377,
1022 129, -377, -67, -377, -377, -377, -377, -377, -67, -67,
1023 -67, -67, -67, -67, -377, -377, -377, -377, 1, 88,
1024 84, 0, 130, -67, 66, 132, -377, -377, -377, -377,
1025 -377, -377, -377, -377, -377, -15, 141, -377, -377, -377,
1026 -377, 133, -377, -377, -377, -377, -377, -377, -377, 188,
1027 -377, -377, -25, 219, -377, 136, 137, -15, 138, -377,
1028 139, -377, -377, 4, -377, -377, 129, -377, 140, 142,
1029 143, 40, 144, 63, 145, 91, 58, 16, 146, 129,
1030 -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1031 182, 4, -377, 147, -377, -377, 129, 148, 149, -377,
1032 41, -377, -377, -377, -377, -7, 152, -377, 150, -377,
1033 -377, -377, -377, -377, -377, 151, -67, -67, 159, 167,
1034 -67, -377, -377, -377, -377, 242, 243, 244, -377, -377,
1035 -377, 245, -377, -377, -377, -377, 202, 245, 24, 161,
1036 248, -377, 163, -377, 129, 22, -377, -377, -377, 250,
1037 246, -2, 165, -377, 253, -377, 254, 253, -377, -67,
1038 -377, -377, 169, -377, -377, 175, -67, 170, -377, -377,
1039 -377, -377, -377, -377, 171, 173, 174, -377, 176, -377,
1040 177, -377, 178, -377, 179, -377, 180, -377, -377, -377,
1041 -377, -377, -377, -377, 260, -377, -377, -377, 262, -377,
1042 -377, -377, -377, -377, -377, -377, 181, -377, -377, -377,
1043 -377, 128, 269, -377, 183, -377, 185, 186, 42, -377,
1044 -377, 102, -377, 189, -5, -11, 275, -377, 105, -67,
1045 -377, -377, 247, 45, 91, -377, 190, -377, 191, -377,
1046 -377, -377, -377, -377, -377, -377, 192, -377, -377, -377,
1047 -67, -377, 276, 280, -377, -67, -377, -377, -377, 90,
1048 84, 46, -377, -377, -377, -377, -377, -377, -377, -377,
1049 195, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1050 -377, -377, -377, -377, -377, -377, -377, -377, -377, 274,
1051 -377, -377, -4, -377, -377, -377, 47, -377, -377, -377,
1052 -377, 199, 200, 201, -377, 252, -11, -377, -377, -377,
1053 -377, -377, -377, -67, -377, -67, 242, 243, 203, -377,
1054 -377, 193, 206, 209, 208, 210, 216, 269, -377, -67,
1055 -377, 242, -377, 243, 48, -377, -377, -377, 269, 213,
1059 /* YYPGOTO[NTERM-NUM]. */
1060 static const yytype_int16 yypgoto
[] =
1062 -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1063 -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1064 -377, -94, -88, 124, -377, -377, -333, -377, -100, -377,
1065 -377, -377, -377, -377, -377, -377, -377, 134, -377, -377,
1066 -377, -377, -377, -377, -377, 231, -377, -377, -377, 77,
1067 -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,
1068 -71, -377, -81, -377, -377, -377, -377, -377, -377, -377,
1069 -377, -377, -377, -377, -304, 99, -377, -377, -377, -377,
1070 -377, -377, -377, -377, -377, -377, -377, -377, -23, -377,
1071 -377, -286, -377, -377, -377, -377, -377, 249, -377, -377,
1072 -377, -377, -377, -377, -377, -376, -368, 251, -377, -377,
1073 -377, -80, -110, -82, -377, -377, -377, -377, 273, -377,
1074 255, -377, -377, -377, -160, 153, -146, -377, -377, -377,
1078 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1079 positive, shift that token. If negative, reduce the rule which
1080 number is the opposite. If zero, do what YYDEFACT says.
1081 If YYTABLE_NINF, syntax error. */
1082 #define YYTABLE_NINF -60
1083 static const yytype_int16 yytable
[] =
1085 139, 133, 137, 190, 145, 228, 149, 106, 107, 152,
1086 214, 148, 391, 150, 151, 251, 147, 346, 147, 381,
1087 277, 147, 108, 241, 108, 196, 278, 109, 181, 153,
1088 414, 139, 299, 56, 5, 201, 182, 154, 110, 416,
1089 245, 236, 202, 69, 70, 426, 109, 208, 277, 183,
1090 349, 300, 184, 140, 278, 427, 279, 110, 7, 185,
1091 155, 350, 290, 291, 211, 141, 281, 57, 218, 277,
1092 376, 212, 412, 186, 156, 278, 69, 70, 402, 113,
1093 111, 10, 111, 112, 377, 237, 425, 222, 289, 223,
1094 49, 66, 280, 347, 281, 219, 187, 188, 113, 69,
1095 70, 224, 113, 292, 378, 229, 85, 86, 230, 231,
1096 51, 160, 232, 261, 87, 281, 379, 223, 260, 161,
1097 233, 158, 266, 392, 52, 147, 162, 163, 164, 224,
1098 165, 424, 166, 159, 53, 393, 88, 89, 234, 308,
1099 78, 167, 429, 61, 62, 63, 64, 65, 249, 340,
1100 73, 90, 428, 396, 403, 250, 341, 385, 168, 169,
1101 397, 404, 81, 54, 382, 191, 82, 139, 192, 193,
1102 66, 11, 12, 13, 314, 14, 15, 16, 17, 18,
1103 19, 20, 21, 22, 23, 24, 25, 26, 361, 362,
1104 363, 364, 365, 366, 367, 368, 369, 370, 371, 372,
1105 93, 94, 95, 96, 330, 331, 332, 333, 1, 2,
1106 199, 200, 342, 343, 74, 75, 76, 92, 79, 80,
1107 98, 99, 100, 101, 102, 104, 103, 125, 126, 127,
1108 386, 374, 56, 139, 354, 137, 130, 143, -59, 197,
1109 195, 204, 198, 206, 207, 209, 210, 242, 215, 264,
1110 216, 217, 221, 227, 239, 244, 246, 247, 139, 256,
1111 259, 262, 257, 314, 267, 269, 271, 273, 275, 284,
1112 285, 288, 295, 302, 297, 303, 305, 310, 309, 316,
1113 318, 319, 325, 315, 327, 320, 321, 322, 323, 324,
1114 329, 335, 337, 411, 338, 339, 345, 359, 387, 383,
1115 384, 385, 389, 375, 398, 399, 405, 418, 406, 407,
1116 128, 417, 421, 419, 139, 354, 137, 408, 420, 422,
1117 423, 139, 430, 314, 307, 410, 276, 395, 84, 255,
1118 0, 134, 0, 135, 243, 129, 0, 314
1121 static const yytype_int16 yycheck
[] =
1123 82, 82, 82, 113, 92, 165, 100, 22, 23, 103,
1124 156, 99, 345, 101, 102, 22, 98, 22, 100, 323,
1125 24, 103, 37, 169, 37, 125, 30, 61, 28, 28,
1126 406, 113, 34, 64, 0, 60, 36, 36, 72, 407,
1127 186, 25, 67, 110, 111, 421, 61, 147, 24, 49,
1128 61, 53, 52, 26, 30, 423, 32, 72, 8, 59,
1129 59, 72, 40, 41, 60, 38, 70, 98, 28, 24,
1130 25, 67, 405, 73, 73, 30, 110, 111, 382, 113,
1131 95, 98, 95, 98, 39, 69, 419, 24, 234, 26,
1132 106, 98, 68, 98, 70, 55, 96, 97, 113, 110,
1133 111, 38, 113, 81, 59, 47, 28, 29, 50, 51,
1134 98, 27, 54, 207, 36, 70, 71, 26, 206, 35,
1135 62, 33, 210, 33, 98, 207, 42, 43, 44, 38,
1136 46, 417, 48, 45, 98, 45, 58, 59, 80, 249,
1137 112, 57, 428, 19, 20, 21, 22, 23, 107, 107,
1138 26, 73, 104, 107, 107, 114, 114, 109, 74, 75,
1139 114, 114, 108, 98, 324, 99, 112, 249, 102, 103,
1140 98, 5, 6, 7, 256, 9, 10, 11, 12, 13,
1141 14, 15, 16, 17, 18, 19, 20, 21, 83, 84,
1142 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1143 99, 100, 101, 102, 76, 77, 78, 79, 3, 4,
1144 22, 23, 110, 111, 106, 106, 98, 107, 112, 112,
1145 107, 107, 107, 107, 107, 102, 107, 107, 107, 98,
1146 340, 319, 64, 315, 315, 315, 22, 108, 108, 98,
1147 108, 22, 109, 107, 107, 107, 107, 65, 108, 82,
1148 108, 108, 108, 108, 108, 108, 108, 108, 340, 107,
1149 109, 102, 112, 345, 22, 22, 22, 22, 66, 108,
1150 22, 108, 22, 108, 28, 22, 22, 102, 109, 108,
1151 107, 107, 22, 113, 22, 109, 109, 109, 109, 109,
1152 109, 22, 109, 403, 109, 109, 107, 22, 22, 109,
1153 109, 109, 22, 56, 109, 31, 107, 114, 108, 108,
1154 79, 108, 104, 107, 396, 396, 396, 65, 109, 109,
1155 104, 403, 109, 405, 247, 396, 227, 350, 55, 195,
1156 -1, 82, -1, 82, 181, 80, -1, 419
1159 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1160 symbol of state STATE-NUM. */
1161 static const yytype_uint8 yystos
[] =
1163 0, 3, 4, 116, 117, 0, 118, 8, 119, 120,
1164 98, 5, 6, 7, 9, 10, 11, 12, 13, 14,
1165 15, 16, 17, 18, 19, 20, 21, 121, 122, 123,
1166 124, 125, 126, 127, 128, 129, 130, 131, 132, 135,
1167 158, 159, 166, 167, 168, 229, 231, 234, 247, 106,
1168 232, 98, 98, 98, 98, 230, 64, 98, 138, 144,
1169 235, 138, 138, 138, 138, 138, 98, 139, 152, 110,
1170 111, 137, 228, 138, 106, 106, 98, 233, 112, 112,
1171 112, 108, 112, 170, 233, 28, 29, 36, 58, 59,
1172 73, 236, 107, 99, 100, 101, 102, 157, 107, 107,
1173 107, 107, 107, 107, 102, 154, 22, 23, 37, 61,
1174 72, 95, 98, 113, 143, 145, 160, 174, 177, 212,
1175 216, 219, 223, 225, 226, 107, 107, 98, 160, 235,
1176 22, 169, 173, 177, 212, 222, 224, 226, 227, 228,
1177 26, 38, 237, 108, 241, 137, 136, 228, 137, 136,
1178 137, 137, 136, 28, 36, 59, 73, 165, 33, 45,
1179 27, 35, 42, 43, 44, 46, 48, 57, 74, 75,
1180 178, 180, 183, 185, 187, 191, 194, 196, 198, 200,
1181 203, 28, 36, 49, 52, 59, 73, 96, 97, 161,
1182 227, 99, 102, 103, 156, 108, 143, 98, 109, 22,
1183 23, 60, 67, 238, 22, 244, 107, 107, 143, 107,
1184 107, 60, 67, 240, 241, 108, 108, 108, 28, 55,
1185 195, 108, 24, 26, 38, 184, 239, 108, 239, 47,
1186 50, 51, 54, 62, 80, 207, 25, 69, 199, 108,
1187 243, 241, 65, 240, 108, 241, 108, 108, 163, 107,
1188 114, 22, 146, 147, 148, 152, 107, 112, 171, 109,
1189 137, 136, 102, 155, 82, 133, 137, 22, 220, 22,
1190 221, 22, 197, 22, 190, 66, 190, 24, 30, 32,
1191 68, 70, 179, 189, 108, 22, 208, 209, 108, 241,
1192 40, 41, 81, 204, 205, 22, 246, 28, 188, 34,
1193 53, 192, 108, 22, 164, 22, 162, 164, 227, 109,
1194 102, 153, 140, 141, 228, 113, 108, 242, 107, 107,
1195 109, 109, 109, 109, 109, 22, 211, 22, 210, 109,
1196 76, 77, 78, 79, 193, 22, 206, 109, 109, 109,
1197 107, 114, 110, 111, 149, 107, 22, 98, 142, 61,
1198 72, 172, 175, 176, 177, 213, 214, 217, 222, 22,
1199 245, 83, 84, 85, 86, 87, 88, 89, 90, 91,
1200 92, 93, 94, 134, 137, 56, 25, 39, 59, 71,
1201 181, 189, 239, 109, 109, 109, 227, 22, 150, 22,
1202 151, 141, 33, 45, 201, 203, 107, 114, 109, 31,
1203 182, 186, 189, 107, 114, 107, 108, 108, 65, 202,
1204 175, 227, 141, 215, 220, 218, 221, 108, 114, 107,
1205 109, 104, 109, 104, 206, 141, 220, 221, 104, 206,
1209 #define yyerrok (yyerrstatus = 0)
1210 #define yyclearin (yychar = YYEMPTY)
1211 #define YYEMPTY (-2)
1214 #define YYACCEPT goto yyacceptlab
1215 #define YYABORT goto yyabortlab
1216 #define YYERROR goto yyerrorlab
1219 /* Like YYERROR except do call yyerror. This remains here temporarily
1220 to ease the transition to the new meaning of YYERROR, for GCC.
1221 Once GCC version 2 has supplanted version 1, this can go. */
1223 #define YYFAIL goto yyerrlab
1225 #define YYRECOVERING() (!!yyerrstatus)
1227 #define YYBACKUP(Token, Value) \
1229 if (yychar == YYEMPTY && yylen == 1) \
1233 yytoken = YYTRANSLATE (yychar); \
1239 yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
1246 #define YYERRCODE 256
1249 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1250 If N is 0, then set CURRENT to the empty location which ends
1251 the previous symbol: RHS[0] (always defined). */
1253 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1254 #ifndef YYLLOC_DEFAULT
1255 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1259 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1260 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1261 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1262 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1266 (Current).first_line = (Current).last_line = \
1267 YYRHSLOC (Rhs, 0).last_line; \
1268 (Current).first_column = (Current).last_column = \
1269 YYRHSLOC (Rhs, 0).last_column; \
1275 /* YY_LOCATION_PRINT -- Print the location on the stream.
1276 This macro was not mandated originally: define only if we know
1277 we won't break user code: when these are the locations we know. */
1279 #ifndef YY_LOCATION_PRINT
1280 # if YYLTYPE_IS_TRIVIAL
1281 # define YY_LOCATION_PRINT(File, Loc) \
1282 fprintf (File, "%d.%d-%d.%d", \
1283 (Loc).first_line, (Loc).first_column, \
1284 (Loc).last_line, (Loc).last_column)
1286 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1291 /* YYLEX -- calling `yylex' with the right arguments. */
1294 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
1296 # define YYLEX yylex (&yylval, &yylloc, scanner)
1299 /* Enable debugging if requested. */
1303 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1304 # define YYFPRINTF fprintf
1307 # define YYDPRINTF(Args) \
1313 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1317 YYFPRINTF (stderr, "%s ", Title); \
1318 yy_symbol_print (stderr, \
1319 Type, Value, Location, state); \
1320 YYFPRINTF (stderr, "\n"); \
1325 /*--------------------------------.
1326 | Print this symbol on YYOUTPUT. |
1327 `--------------------------------*/
1330 #if (defined __STDC__ || defined __C99__FUNC__ \
1331 || defined __cplusplus || defined _MSC_VER)
1333 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
, struct asm_parser_state
*state
)
1336 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
)
1339 YYSTYPE
const * const yyvaluep
;
1340 YYLTYPE
const * const yylocationp
;
1341 struct asm_parser_state
*state
;
1346 YYUSE (yylocationp
);
1349 if (yytype
< YYNTOKENS
)
1350 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1362 /*--------------------------------.
1363 | Print this symbol on YYOUTPUT. |
1364 `--------------------------------*/
1366 #if (defined __STDC__ || defined __C99__FUNC__ \
1367 || defined __cplusplus || defined _MSC_VER)
1369 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
, struct asm_parser_state
*state
)
1372 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
)
1375 YYSTYPE
const * const yyvaluep
;
1376 YYLTYPE
const * const yylocationp
;
1377 struct asm_parser_state
*state
;
1380 if (yytype
< YYNTOKENS
)
1381 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1383 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1385 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1386 YYFPRINTF (yyoutput
, ": ");
1387 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
);
1388 YYFPRINTF (yyoutput
, ")");
1391 /*------------------------------------------------------------------.
1392 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1394 `------------------------------------------------------------------*/
1396 #if (defined __STDC__ || defined __C99__FUNC__ \
1397 || defined __cplusplus || defined _MSC_VER)
1399 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1402 yy_stack_print (yybottom
, yytop
)
1403 yytype_int16
*yybottom
;
1404 yytype_int16
*yytop
;
1407 YYFPRINTF (stderr
, "Stack now");
1408 for (; yybottom
<= yytop
; yybottom
++)
1410 int yybot
= *yybottom
;
1411 YYFPRINTF (stderr
, " %d", yybot
);
1413 YYFPRINTF (stderr
, "\n");
1416 # define YY_STACK_PRINT(Bottom, Top) \
1419 yy_stack_print ((Bottom), (Top)); \
1423 /*------------------------------------------------.
1424 | Report that the YYRULE is going to be reduced. |
1425 `------------------------------------------------*/
1427 #if (defined __STDC__ || defined __C99__FUNC__ \
1428 || defined __cplusplus || defined _MSC_VER)
1430 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
, struct asm_parser_state
*state
)
1433 yy_reduce_print (yyvsp
, yylsp
, yyrule
, state
)
1437 struct asm_parser_state
*state
;
1440 int yynrhs
= yyr2
[yyrule
];
1442 unsigned long int yylno
= yyrline
[yyrule
];
1443 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1445 /* The symbols being reduced. */
1446 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1448 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1449 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1450 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1451 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) , state
);
1452 YYFPRINTF (stderr
, "\n");
1456 # define YY_REDUCE_PRINT(Rule) \
1459 yy_reduce_print (yyvsp, yylsp, Rule, state); \
1462 /* Nonzero means print parse trace. It is left uninitialized so that
1463 multiple parsers can coexist. */
1465 #else /* !YYDEBUG */
1466 # define YYDPRINTF(Args)
1467 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1468 # define YY_STACK_PRINT(Bottom, Top)
1469 # define YY_REDUCE_PRINT(Rule)
1470 #endif /* !YYDEBUG */
1473 /* YYINITDEPTH -- initial size of the parser's stacks. */
1475 # define YYINITDEPTH 200
1478 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1479 if the built-in stack extension method is used).
1481 Do not make this value too large; the results are undefined if
1482 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1483 evaluated with infinite-precision integer arithmetic. */
1486 # define YYMAXDEPTH 10000
1494 # if defined __GLIBC__ && defined _STRING_H
1495 # define yystrlen strlen
1497 /* Return the length of YYSTR. */
1498 #if (defined __STDC__ || defined __C99__FUNC__ \
1499 || defined __cplusplus || defined _MSC_VER)
1501 yystrlen (const char *yystr
)
1509 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1517 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1518 # define yystpcpy stpcpy
1520 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1522 #if (defined __STDC__ || defined __C99__FUNC__ \
1523 || defined __cplusplus || defined _MSC_VER)
1525 yystpcpy (char *yydest
, const char *yysrc
)
1528 yystpcpy (yydest
, yysrc
)
1534 const char *yys
= yysrc
;
1536 while ((*yyd
++ = *yys
++) != '\0')
1545 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1546 quotes and backslashes, so that it's suitable for yyerror. The
1547 heuristic is that double-quoting is unnecessary unless the string
1548 contains an apostrophe, a comma, or backslash (other than
1549 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1550 null, do not copy; instead, return the length of what the result
1553 yytnamerr (char *yyres
, const char *yystr
)
1558 char const *yyp
= yystr
;
1565 goto do_not_strip_quotes
;
1569 goto do_not_strip_quotes
;
1582 do_not_strip_quotes
: ;
1586 return yystrlen (yystr
);
1588 return yystpcpy (yyres
, yystr
) - yyres
;
1592 /* Copy into YYRESULT an error message about the unexpected token
1593 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1594 including the terminating null byte. If YYRESULT is null, do not
1595 copy anything; just return the number of bytes that would be
1596 copied. As a special case, return 0 if an ordinary "syntax error"
1597 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1598 size calculation. */
1600 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1602 int yyn
= yypact
[yystate
];
1604 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1608 int yytype
= YYTRANSLATE (yychar
);
1609 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1610 YYSIZE_T yysize
= yysize0
;
1612 int yysize_overflow
= 0;
1613 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1614 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1618 /* This is so xgettext sees the translatable formats that are
1619 constructed on the fly. */
1620 YY_("syntax error, unexpected %s");
1621 YY_("syntax error, unexpected %s, expecting %s");
1622 YY_("syntax error, unexpected %s, expecting %s or %s");
1623 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1624 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1628 static char const yyunexpected
[] = "syntax error, unexpected %s";
1629 static char const yyexpecting
[] = ", expecting %s";
1630 static char const yyor
[] = " or %s";
1631 char yyformat
[sizeof yyunexpected
1632 + sizeof yyexpecting
- 1
1633 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1634 * (sizeof yyor
- 1))];
1635 char const *yyprefix
= yyexpecting
;
1637 /* Start YYX at -YYN if negative to avoid negative indexes in
1639 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1641 /* Stay within bounds of both yycheck and yytname. */
1642 int yychecklim
= YYLAST
- yyn
+ 1;
1643 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1646 yyarg
[0] = yytname
[yytype
];
1647 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1649 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1650 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1652 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1656 yyformat
[sizeof yyunexpected
- 1] = '\0';
1659 yyarg
[yycount
++] = yytname
[yyx
];
1660 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1661 yysize_overflow
|= (yysize1
< yysize
);
1663 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1667 yyf
= YY_(yyformat
);
1668 yysize1
= yysize
+ yystrlen (yyf
);
1669 yysize_overflow
|= (yysize1
< yysize
);
1672 if (yysize_overflow
)
1673 return YYSIZE_MAXIMUM
;
1677 /* Avoid sprintf, as that infringes on the user's name space.
1678 Don't have undefined behavior even if the translation
1679 produced a string with the wrong number of "%s"s. */
1680 char *yyp
= yyresult
;
1682 while ((*yyp
= *yyf
) != '\0')
1684 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1686 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1699 #endif /* YYERROR_VERBOSE */
1702 /*-----------------------------------------------.
1703 | Release the memory associated to this symbol. |
1704 `-----------------------------------------------*/
1707 #if (defined __STDC__ || defined __C99__FUNC__ \
1708 || defined __cplusplus || defined _MSC_VER)
1710 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
, struct asm_parser_state
*state
)
1713 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
, state
)
1717 YYLTYPE
*yylocationp
;
1718 struct asm_parser_state
*state
;
1722 YYUSE (yylocationp
);
1727 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1737 /* Prevent warnings from -Wmissing-prototypes. */
1738 #ifdef YYPARSE_PARAM
1739 #if defined __STDC__ || defined __cplusplus
1740 int yyparse (void *YYPARSE_PARAM
);
1744 #else /* ! YYPARSE_PARAM */
1745 #if defined __STDC__ || defined __cplusplus
1746 int yyparse (struct asm_parser_state
*state
);
1750 #endif /* ! YYPARSE_PARAM */
1756 /*-------------------------.
1757 | yyparse or yypush_parse. |
1758 `-------------------------*/
1760 #ifdef YYPARSE_PARAM
1761 #if (defined __STDC__ || defined __C99__FUNC__ \
1762 || defined __cplusplus || defined _MSC_VER)
1764 yyparse (void *YYPARSE_PARAM
)
1767 yyparse (YYPARSE_PARAM
)
1768 void *YYPARSE_PARAM
;
1770 #else /* ! YYPARSE_PARAM */
1771 #if (defined __STDC__ || defined __C99__FUNC__ \
1772 || defined __cplusplus || defined _MSC_VER)
1774 yyparse (struct asm_parser_state
*state
)
1778 struct asm_parser_state
*state
;
1782 /* The lookahead symbol. */
1785 /* The semantic value of the lookahead symbol. */
1788 /* Location data for the lookahead symbol. */
1791 /* Number of syntax errors so far. */
1795 /* Number of tokens to shift before error messages enabled. */
1798 /* The stacks and their tools:
1799 `yyss': related to states.
1800 `yyvs': related to semantic values.
1801 `yyls': related to locations.
1803 Refer to the stacks thru separate pointers, to allow yyoverflow
1804 to reallocate them elsewhere. */
1806 /* The state stack. */
1807 yytype_int16 yyssa
[YYINITDEPTH
];
1809 yytype_int16
*yyssp
;
1811 /* The semantic value stack. */
1812 YYSTYPE yyvsa
[YYINITDEPTH
];
1816 /* The location stack. */
1817 YYLTYPE yylsa
[YYINITDEPTH
];
1821 /* The locations where the error started and ended. */
1822 YYLTYPE yyerror_range
[2];
1824 YYSIZE_T yystacksize
;
1828 /* Lookahead token as an internal (translated) token number. */
1830 /* The variables used to return semantic value and location from the
1836 /* Buffer for error messages, and its allocated size. */
1838 char *yymsg
= yymsgbuf
;
1839 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1842 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1844 /* The number of symbols on the RHS of the reduced rule.
1845 Keep to zero when no symbol should be popped. */
1852 yystacksize
= YYINITDEPTH
;
1854 YYDPRINTF ((stderr
, "Starting parse\n"));
1859 yychar
= YYEMPTY
; /* Cause a token to be read. */
1861 /* Initialize stack pointers.
1862 Waste one element of value and location stack
1863 so that they stay on the same level as the state stack.
1864 The wasted elements are never initialized. */
1869 #if YYLTYPE_IS_TRIVIAL
1870 /* Initialize the default location before parsing starts. */
1871 yylloc
.first_line
= yylloc
.last_line
= 1;
1872 yylloc
.first_column
= yylloc
.last_column
= 1;
1877 /*------------------------------------------------------------.
1878 | yynewstate -- Push a new state, which is found in yystate. |
1879 `------------------------------------------------------------*/
1881 /* In all cases, when you get here, the value and location stacks
1882 have just been pushed. So pushing a state here evens the stacks. */
1888 if (yyss
+ yystacksize
- 1 <= yyssp
)
1890 /* Get the current used size of the three stacks, in elements. */
1891 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1895 /* Give user a chance to reallocate the stack. Use copies of
1896 these so that the &'s don't force the real ones into
1898 YYSTYPE
*yyvs1
= yyvs
;
1899 yytype_int16
*yyss1
= yyss
;
1900 YYLTYPE
*yyls1
= yyls
;
1902 /* Each stack pointer address is followed by the size of the
1903 data in use in that stack, in bytes. This used to be a
1904 conditional around just the two extra args, but that might
1905 be undefined if yyoverflow is a macro. */
1906 yyoverflow (YY_("memory exhausted"),
1907 &yyss1
, yysize
* sizeof (*yyssp
),
1908 &yyvs1
, yysize
* sizeof (*yyvsp
),
1909 &yyls1
, yysize
* sizeof (*yylsp
),
1916 #else /* no yyoverflow */
1917 # ifndef YYSTACK_RELOCATE
1918 goto yyexhaustedlab
;
1920 /* Extend the stack our own way. */
1921 if (YYMAXDEPTH
<= yystacksize
)
1922 goto yyexhaustedlab
;
1924 if (YYMAXDEPTH
< yystacksize
)
1925 yystacksize
= YYMAXDEPTH
;
1928 yytype_int16
*yyss1
= yyss
;
1929 union yyalloc
*yyptr
=
1930 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1932 goto yyexhaustedlab
;
1933 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1934 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1935 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1936 # undef YYSTACK_RELOCATE
1938 YYSTACK_FREE (yyss1
);
1941 #endif /* no yyoverflow */
1943 yyssp
= yyss
+ yysize
- 1;
1944 yyvsp
= yyvs
+ yysize
- 1;
1945 yylsp
= yyls
+ yysize
- 1;
1947 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1948 (unsigned long int) yystacksize
));
1950 if (yyss
+ yystacksize
- 1 <= yyssp
)
1954 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1956 if (yystate
== YYFINAL
)
1966 /* Do appropriate processing given the current state. Read a
1967 lookahead token if we need one and don't already have one. */
1969 /* First try to decide what to do without reference to lookahead token. */
1970 yyn
= yypact
[yystate
];
1971 if (yyn
== YYPACT_NINF
)
1974 /* Not known => get a lookahead token if don't already have one. */
1976 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1977 if (yychar
== YYEMPTY
)
1979 YYDPRINTF ((stderr
, "Reading a token: "));
1983 if (yychar
<= YYEOF
)
1985 yychar
= yytoken
= YYEOF
;
1986 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1990 yytoken
= YYTRANSLATE (yychar
);
1991 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1994 /* If the proper action on seeing token YYTOKEN is to reduce or to
1995 detect an error, take that action. */
1997 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
2002 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
2008 /* Count tokens shifted since error; after three, turn off error
2013 /* Shift the lookahead token. */
2014 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
2016 /* Discard the shifted token. */
2025 /*-----------------------------------------------------------.
2026 | yydefault -- do the default action for the current state. |
2027 `-----------------------------------------------------------*/
2029 yyn
= yydefact
[yystate
];
2035 /*-----------------------------.
2036 | yyreduce -- Do a reduction. |
2037 `-----------------------------*/
2039 /* yyn is the number of a rule to reduce with. */
2042 /* If YYLEN is nonzero, implement the default value of the action:
2045 Otherwise, the following line sets YYVAL to garbage.
2046 This behavior is undocumented and Bison
2047 users should not rely upon it. Assigning to YYVAL
2048 unconditionally makes the parser a bit smaller, and it avoids a
2049 GCC warning that YYVAL may be used uninitialized. */
2050 yyval
= yyvsp
[1-yylen
];
2052 /* Default location. */
2053 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2054 YY_REDUCE_PRINT (yyn
);
2059 /* Line 1455 of yacc.c */
2060 #line 253 "program_parse.y"
2062 if (state
->prog
->Target
!= GL_VERTEX_PROGRAM_ARB
) {
2063 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid fragment program header");
2066 state
->mode
= ARB_vertex
;
2072 /* Line 1455 of yacc.c */
2073 #line 261 "program_parse.y"
2075 if (state
->prog
->Target
!= GL_FRAGMENT_PROGRAM_ARB
) {
2076 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid vertex program header");
2078 state
->mode
= ARB_fragment
;
2080 state
->option
.TexRect
=
2081 (state
->ctx
->Extensions
.NV_texture_rectangle
!= GL_FALSE
);
2087 /* Line 1455 of yacc.c */
2088 #line 277 "program_parse.y"
2092 if (state
->mode
== ARB_vertex
) {
2093 valid
= _mesa_ARBvp_parse_option(state
, (yyvsp
[(2) - (3)].string
));
2094 } else if (state
->mode
== ARB_fragment
) {
2095 valid
= _mesa_ARBfp_parse_option(state
, (yyvsp
[(2) - (3)].string
));
2100 const char *const err_str
= (state
->mode
== ARB_vertex
)
2101 ? "invalid ARB vertex program option"
2102 : "invalid ARB fragment program option";
2104 yyerror(& (yylsp
[(2) - (3)]), state
, err_str
);
2112 /* Line 1455 of yacc.c */
2113 #line 303 "program_parse.y"
2115 if ((yyvsp
[(1) - (2)].inst
) != NULL
) {
2116 if (state
->inst_tail
== NULL
) {
2117 state
->inst_head
= (yyvsp
[(1) - (2)].inst
);
2119 state
->inst_tail
->next
= (yyvsp
[(1) - (2)].inst
);
2122 state
->inst_tail
= (yyvsp
[(1) - (2)].inst
);
2123 (yyvsp
[(1) - (2)].inst
)->next
= NULL
;
2125 state
->prog
->NumInstructions
++;
2132 /* Line 1455 of yacc.c */
2133 #line 321 "program_parse.y"
2135 (yyval
.inst
) = (yyvsp
[(1) - (1)].inst
);
2136 state
->prog
->NumAluInstructions
++;
2142 /* Line 1455 of yacc.c */
2143 #line 326 "program_parse.y"
2145 (yyval
.inst
) = (yyvsp
[(1) - (1)].inst
);
2146 state
->prog
->NumTexInstructions
++;
2152 /* Line 1455 of yacc.c */
2153 #line 346 "program_parse.y"
2155 (yyval
.inst
) = asm_instruction_ctor(OPCODE_ARL
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2161 /* Line 1455 of yacc.c */
2162 #line 352 "program_parse.y"
2164 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (4)].temp_inst
).Opcode
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2165 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (4)].temp_inst
).SaturateMode
;
2171 /* Line 1455 of yacc.c */
2172 #line 359 "program_parse.y"
2174 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (4)].temp_inst
).Opcode
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2175 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (4)].temp_inst
).SaturateMode
;
2181 /* Line 1455 of yacc.c */
2182 #line 366 "program_parse.y"
2184 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (6)].temp_inst
).Opcode
, & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), & (yyvsp
[(6) - (6)].src_reg
), NULL
);
2185 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (6)].temp_inst
).SaturateMode
;
2191 /* Line 1455 of yacc.c */
2192 #line 374 "program_parse.y"
2194 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (6)].temp_inst
).Opcode
, & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), & (yyvsp
[(6) - (6)].src_reg
), NULL
);
2195 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (6)].temp_inst
).SaturateMode
;
2201 /* Line 1455 of yacc.c */
2202 #line 382 "program_parse.y"
2204 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (8)].temp_inst
).Opcode
, & (yyvsp
[(2) - (8)].dst_reg
), & (yyvsp
[(4) - (8)].src_reg
), & (yyvsp
[(6) - (8)].src_reg
), & (yyvsp
[(8) - (8)].src_reg
));
2205 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (8)].temp_inst
).SaturateMode
;
2211 /* Line 1455 of yacc.c */
2212 #line 389 "program_parse.y"
2214 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (8)].temp_inst
).Opcode
, & (yyvsp
[(2) - (8)].dst_reg
), & (yyvsp
[(4) - (8)].src_reg
), NULL
, NULL
);
2215 if ((yyval
.inst
) != NULL
) {
2216 const GLbitfield tex_mask
= (1U << (yyvsp
[(6) - (8)].integer
));
2217 GLbitfield shadow_tex
= 0;
2218 GLbitfield target_mask
= 0;
2221 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (8)].temp_inst
).SaturateMode
;
2222 (yyval
.inst
)->Base
.TexSrcUnit
= (yyvsp
[(6) - (8)].integer
);
2224 if ((yyvsp
[(8) - (8)].integer
) < 0) {
2225 shadow_tex
= tex_mask
;
2227 (yyval
.inst
)->Base
.TexSrcTarget
= -(yyvsp
[(8) - (8)].integer
);
2228 (yyval
.inst
)->Base
.TexShadow
= 1;
2230 (yyval
.inst
)->Base
.TexSrcTarget
= (yyvsp
[(8) - (8)].integer
);
2233 target_mask
= (1U << (yyval
.inst
)->Base
.TexSrcTarget
);
2235 /* If this texture unit was previously accessed and that access
2236 * had a different texture target, generate an error.
2238 * If this texture unit was previously accessed and that access
2239 * had a different shadow mode, generate an error.
2241 if ((state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] != 0)
2242 && ((state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] != target_mask
)
2243 || ((state
->prog
->ShadowSamplers
& tex_mask
)
2245 yyerror(& (yylsp
[(8) - (8)]), state
,
2246 "multiple targets used on one texture image unit");
2251 state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] |= target_mask
;
2252 state
->prog
->ShadowSamplers
|= shadow_tex
;
2259 /* Line 1455 of yacc.c */
2260 #line 434 "program_parse.y"
2262 (yyval
.inst
) = asm_instruction_ctor(OPCODE_KIL
, NULL
, & (yyvsp
[(2) - (2)].src_reg
), NULL
, NULL
);
2263 state
->fragment
.UsesKill
= 1;
2269 /* Line 1455 of yacc.c */
2270 #line 441 "program_parse.y"
2272 (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
);
2278 /* Line 1455 of yacc.c */
2279 #line 446 "program_parse.y"
2280 { (yyval
.integer
) = TEXTURE_1D_INDEX
; ;}
2285 /* Line 1455 of yacc.c */
2286 #line 447 "program_parse.y"
2287 { (yyval
.integer
) = TEXTURE_2D_INDEX
; ;}
2292 /* Line 1455 of yacc.c */
2293 #line 448 "program_parse.y"
2294 { (yyval
.integer
) = TEXTURE_3D_INDEX
; ;}
2299 /* Line 1455 of yacc.c */
2300 #line 449 "program_parse.y"
2301 { (yyval
.integer
) = TEXTURE_CUBE_INDEX
; ;}
2306 /* Line 1455 of yacc.c */
2307 #line 450 "program_parse.y"
2308 { (yyval
.integer
) = TEXTURE_RECT_INDEX
; ;}
2313 /* Line 1455 of yacc.c */
2314 #line 451 "program_parse.y"
2315 { (yyval
.integer
) = -TEXTURE_1D_INDEX
; ;}
2320 /* Line 1455 of yacc.c */
2321 #line 452 "program_parse.y"
2322 { (yyval
.integer
) = -TEXTURE_2D_INDEX
; ;}
2327 /* Line 1455 of yacc.c */
2328 #line 453 "program_parse.y"
2329 { (yyval
.integer
) = -TEXTURE_RECT_INDEX
; ;}
2334 /* Line 1455 of yacc.c */
2335 #line 454 "program_parse.y"
2336 { (yyval
.integer
) = TEXTURE_1D_ARRAY_INDEX
; ;}
2341 /* Line 1455 of yacc.c */
2342 #line 455 "program_parse.y"
2343 { (yyval
.integer
) = TEXTURE_2D_ARRAY_INDEX
; ;}
2348 /* Line 1455 of yacc.c */
2349 #line 456 "program_parse.y"
2350 { (yyval
.integer
) = -TEXTURE_1D_ARRAY_INDEX
; ;}
2355 /* Line 1455 of yacc.c */
2356 #line 457 "program_parse.y"
2357 { (yyval
.integer
) = -TEXTURE_2D_ARRAY_INDEX
; ;}
2362 /* Line 1455 of yacc.c */
2363 #line 461 "program_parse.y"
2365 /* FIXME: Is this correct? Should the extenedSwizzle be applied
2366 * FIXME: to the existing swizzle?
2368 (yyvsp
[(4) - (6)].src_reg
).Base
.Swizzle
= (yyvsp
[(6) - (6)].swiz_mask
).swizzle
;
2369 (yyvsp
[(4) - (6)].src_reg
).Base
.Negate
= (yyvsp
[(6) - (6)].swiz_mask
).mask
;
2371 (yyval
.inst
) = asm_instruction_ctor(OPCODE_SWZ
, & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), NULL
, NULL
);
2372 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (6)].temp_inst
).SaturateMode
;
2378 /* Line 1455 of yacc.c */
2379 #line 474 "program_parse.y"
2381 (yyval
.src_reg
) = (yyvsp
[(2) - (3)].src_reg
);
2383 if ((yyvsp
[(1) - (3)].negate
)) {
2384 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2387 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2388 (yyvsp
[(3) - (3)].swiz_mask
).swizzle
);
2394 /* Line 1455 of yacc.c */
2395 #line 487 "program_parse.y"
2397 (yyval
.src_reg
) = (yyvsp
[(2) - (3)].src_reg
);
2399 if ((yyvsp
[(1) - (3)].negate
)) {
2400 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2403 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2404 (yyvsp
[(3) - (3)].swiz_mask
).swizzle
);
2410 /* Line 1455 of yacc.c */
2411 #line 500 "program_parse.y"
2413 (yyval
.dst_reg
) = (yyvsp
[(1) - (2)].dst_reg
);
2414 (yyval
.dst_reg
).WriteMask
= (yyvsp
[(2) - (2)].swiz_mask
).mask
;
2416 if ((yyval
.dst_reg
).File
== PROGRAM_OUTPUT
) {
2417 /* Technically speaking, this should check that it is in
2418 * vertex program mode. However, PositionInvariant can never be
2419 * set in fragment program mode, so it is somewhat irrelevant.
2421 if (state
->option
.PositionInvariant
2422 && ((yyval
.dst_reg
).Index
== VERT_RESULT_HPOS
)) {
2423 yyerror(& (yylsp
[(1) - (2)]), state
, "position-invariant programs cannot "
2428 state
->prog
->OutputsWritten
|= (1U << (yyval
.dst_reg
).Index
);
2435 /* Line 1455 of yacc.c */
2436 #line 522 "program_parse.y"
2438 init_dst_reg(& (yyval
.dst_reg
));
2439 (yyval
.dst_reg
).File
= PROGRAM_ADDRESS
;
2440 (yyval
.dst_reg
).Index
= 0;
2441 (yyval
.dst_reg
).WriteMask
= (yyvsp
[(2) - (2)].swiz_mask
).mask
;
2447 /* Line 1455 of yacc.c */
2448 #line 531 "program_parse.y"
2450 (yyval
.swiz_mask
).swizzle
= MAKE_SWIZZLE4((yyvsp
[(1) - (7)].swiz_mask
).swizzle
, (yyvsp
[(3) - (7)].swiz_mask
).swizzle
,
2451 (yyvsp
[(5) - (7)].swiz_mask
).swizzle
, (yyvsp
[(7) - (7)].swiz_mask
).swizzle
);
2452 (yyval
.swiz_mask
).mask
= ((yyvsp
[(1) - (7)].swiz_mask
).mask
) | ((yyvsp
[(3) - (7)].swiz_mask
).mask
<< 1) | ((yyvsp
[(5) - (7)].swiz_mask
).mask
<< 2)
2453 | ((yyvsp
[(7) - (7)].swiz_mask
).mask
<< 3);
2459 /* Line 1455 of yacc.c */
2460 #line 540 "program_parse.y"
2462 (yyval
.swiz_mask
).swizzle
= (yyvsp
[(2) - (2)].integer
);
2463 (yyval
.swiz_mask
).mask
= ((yyvsp
[(1) - (2)].negate
)) ? 1 : 0;
2469 /* Line 1455 of yacc.c */
2470 #line 547 "program_parse.y"
2472 if (((yyvsp
[(1) - (1)].integer
) != 0) && ((yyvsp
[(1) - (1)].integer
) != 1)) {
2473 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2477 (yyval
.integer
) = ((yyvsp
[(1) - (1)].integer
) == 0) ? SWIZZLE_ZERO
: SWIZZLE_ONE
;
2483 /* Line 1455 of yacc.c */
2484 #line 556 "program_parse.y"
2486 if (strlen((yyvsp
[(1) - (1)].string
)) > 1) {
2487 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2491 switch ((yyvsp
[(1) - (1)].string
)[0]) {
2493 (yyval
.integer
) = SWIZZLE_X
;
2496 (yyval
.integer
) = SWIZZLE_Y
;
2499 (yyval
.integer
) = SWIZZLE_Z
;
2502 (yyval
.integer
) = SWIZZLE_W
;
2505 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2514 /* Line 1455 of yacc.c */
2515 #line 584 "program_parse.y"
2517 struct asm_symbol
*const s
= (struct asm_symbol
*)
2518 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2521 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2523 } else if ((s
->type
!= at_param
) && (s
->type
!= at_temp
)
2524 && (s
->type
!= at_attrib
)) {
2525 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2527 } else if ((s
->type
== at_param
) && s
->param_is_array
) {
2528 yyerror(& (yylsp
[(1) - (1)]), state
, "non-array access to array PARAM");
2532 init_src_reg(& (yyval
.src_reg
));
2535 (yyval
.src_reg
).Base
.File
= PROGRAM_TEMPORARY
;
2536 (yyval
.src_reg
).Base
.Index
= s
->temp_binding
;
2539 (yyval
.src_reg
).Base
.File
= s
->param_binding_type
;
2540 (yyval
.src_reg
).Base
.Index
= s
->param_binding_begin
;
2543 (yyval
.src_reg
).Base
.File
= PROGRAM_INPUT
;
2544 (yyval
.src_reg
).Base
.Index
= s
->attrib_binding
;
2545 state
->prog
->InputsRead
|= (1U << (yyval
.src_reg
).Base
.Index
);
2547 if (!validate_inputs(& (yylsp
[(1) - (1)]), state
)) {
2561 /* Line 1455 of yacc.c */
2562 #line 626 "program_parse.y"
2564 init_src_reg(& (yyval
.src_reg
));
2565 (yyval
.src_reg
).Base
.File
= PROGRAM_INPUT
;
2566 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].attrib
);
2567 state
->prog
->InputsRead
|= (1U << (yyval
.src_reg
).Base
.Index
);
2569 if (!validate_inputs(& (yylsp
[(1) - (1)]), state
)) {
2577 /* Line 1455 of yacc.c */
2578 #line 637 "program_parse.y"
2580 if (! (yyvsp
[(3) - (4)].src_reg
).Base
.RelAddr
2581 && ((unsigned) (yyvsp
[(3) - (4)].src_reg
).Base
.Index
>= (yyvsp
[(1) - (4)].sym
)->param_binding_length
)) {
2582 yyerror(& (yylsp
[(3) - (4)]), state
, "out of bounds array access");
2586 init_src_reg(& (yyval
.src_reg
));
2587 (yyval
.src_reg
).Base
.File
= (yyvsp
[(1) - (4)].sym
)->param_binding_type
;
2589 if ((yyvsp
[(3) - (4)].src_reg
).Base
.RelAddr
) {
2590 (yyvsp
[(1) - (4)].sym
)->param_accessed_indirectly
= 1;
2592 (yyval
.src_reg
).Base
.RelAddr
= 1;
2593 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(3) - (4)].src_reg
).Base
.Index
;
2594 (yyval
.src_reg
).Symbol
= (yyvsp
[(1) - (4)].sym
);
2596 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (4)].sym
)->param_binding_begin
+ (yyvsp
[(3) - (4)].src_reg
).Base
.Index
;
2603 /* Line 1455 of yacc.c */
2604 #line 658 "program_parse.y"
2606 init_src_reg(& (yyval
.src_reg
));
2607 (yyval
.src_reg
).Base
.File
= ((yyvsp
[(1) - (1)].temp_sym
).name
!= NULL
)
2608 ? (yyvsp
[(1) - (1)].temp_sym
).param_binding_type
2610 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].temp_sym
).param_binding_begin
;
2616 /* Line 1455 of yacc.c */
2617 #line 668 "program_parse.y"
2619 init_dst_reg(& (yyval
.dst_reg
));
2620 (yyval
.dst_reg
).File
= PROGRAM_OUTPUT
;
2621 (yyval
.dst_reg
).Index
= (yyvsp
[(1) - (1)].result
);
2627 /* Line 1455 of yacc.c */
2628 #line 674 "program_parse.y"
2630 struct asm_symbol
*const s
= (struct asm_symbol
*)
2631 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2634 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2636 } else if ((s
->type
!= at_output
) && (s
->type
!= at_temp
)) {
2637 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2641 init_dst_reg(& (yyval
.dst_reg
));
2644 (yyval
.dst_reg
).File
= PROGRAM_TEMPORARY
;
2645 (yyval
.dst_reg
).Index
= s
->temp_binding
;
2648 (yyval
.dst_reg
).File
= PROGRAM_OUTPUT
;
2649 (yyval
.dst_reg
).Index
= s
->output_binding
;
2652 (yyval
.dst_reg
).File
= s
->param_binding_type
;
2653 (yyval
.dst_reg
).Index
= s
->param_binding_begin
;
2661 /* Line 1455 of yacc.c */
2662 #line 705 "program_parse.y"
2664 struct asm_symbol
*const s
= (struct asm_symbol
*)
2665 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2668 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2670 } else if ((s
->type
!= at_param
) || !s
->param_is_array
) {
2671 yyerror(& (yylsp
[(1) - (1)]), state
, "array access to non-PARAM variable");
2681 /* Line 1455 of yacc.c */
2682 #line 724 "program_parse.y"
2684 init_src_reg(& (yyval
.src_reg
));
2685 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].integer
);
2691 /* Line 1455 of yacc.c */
2692 #line 731 "program_parse.y"
2694 /* FINISHME: Add support for multiple address registers.
2696 /* FINISHME: Add support for 4-component address registers.
2698 init_src_reg(& (yyval
.src_reg
));
2699 (yyval
.src_reg
).Base
.RelAddr
= 1;
2700 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(3) - (3)].integer
);
2706 /* Line 1455 of yacc.c */
2707 #line 742 "program_parse.y"
2708 { (yyval
.integer
) = 0; ;}
2713 /* Line 1455 of yacc.c */
2714 #line 743 "program_parse.y"
2715 { (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
); ;}
2720 /* Line 1455 of yacc.c */
2721 #line 744 "program_parse.y"
2722 { (yyval
.integer
) = -(yyvsp
[(2) - (2)].integer
); ;}
2727 /* Line 1455 of yacc.c */
2728 #line 748 "program_parse.y"
2730 if (((yyvsp
[(1) - (1)].integer
) < 0) || ((yyvsp
[(1) - (1)].integer
) > 63)) {
2731 yyerror(& (yylsp
[(1) - (1)]), state
,
2732 "relative address offset too large (positive)");
2735 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2742 /* Line 1455 of yacc.c */
2743 #line 760 "program_parse.y"
2745 if (((yyvsp
[(1) - (1)].integer
) < 0) || ((yyvsp
[(1) - (1)].integer
) > 64)) {
2746 yyerror(& (yylsp
[(1) - (1)]), state
,
2747 "relative address offset too large (negative)");
2750 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2757 /* Line 1455 of yacc.c */
2758 #line 772 "program_parse.y"
2760 struct asm_symbol
*const s
= (struct asm_symbol
*)
2761 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2764 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid array member");
2766 } else if (s
->type
!= at_address
) {
2767 yyerror(& (yylsp
[(1) - (1)]), state
,
2768 "invalid variable for indexed array access");
2778 /* Line 1455 of yacc.c */
2779 #line 790 "program_parse.y"
2781 if ((yyvsp
[(1) - (1)].swiz_mask
).mask
!= WRITEMASK_X
) {
2782 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid address component selector");
2785 (yyval
.swiz_mask
) = (yyvsp
[(1) - (1)].swiz_mask
);
2792 /* Line 1455 of yacc.c */
2793 #line 801 "program_parse.y"
2795 if ((yyvsp
[(1) - (1)].swiz_mask
).mask
!= WRITEMASK_X
) {
2796 yyerror(& (yylsp
[(1) - (1)]), state
,
2797 "address register write mask must be \".x\"");
2800 (yyval
.swiz_mask
) = (yyvsp
[(1) - (1)].swiz_mask
);
2807 /* Line 1455 of yacc.c */
2808 #line 817 "program_parse.y"
2809 { (yyval
.swiz_mask
).swizzle
= SWIZZLE_NOOP
; (yyval
.swiz_mask
).mask
= WRITEMASK_XYZW
; ;}
2814 /* Line 1455 of yacc.c */
2815 #line 821 "program_parse.y"
2816 { (yyval
.swiz_mask
).swizzle
= SWIZZLE_NOOP
; (yyval
.swiz_mask
).mask
= WRITEMASK_XYZW
; ;}
2821 /* Line 1455 of yacc.c */
2822 #line 833 "program_parse.y"
2824 struct asm_symbol
*const s
=
2825 declare_variable(state
, (yyvsp
[(2) - (4)].string
), at_attrib
, & (yylsp
[(2) - (4)]));
2830 s
->attrib_binding
= (yyvsp
[(4) - (4)].attrib
);
2831 state
->InputsBound
|= (1U << s
->attrib_binding
);
2833 if (!validate_inputs(& (yylsp
[(4) - (4)]), state
)) {
2842 /* Line 1455 of yacc.c */
2843 #line 851 "program_parse.y"
2845 (yyval
.attrib
) = (yyvsp
[(2) - (2)].attrib
);
2851 /* Line 1455 of yacc.c */
2852 #line 855 "program_parse.y"
2854 (yyval
.attrib
) = (yyvsp
[(2) - (2)].attrib
);
2860 /* Line 1455 of yacc.c */
2861 #line 861 "program_parse.y"
2863 (yyval
.attrib
) = VERT_ATTRIB_POS
;
2869 /* Line 1455 of yacc.c */
2870 #line 865 "program_parse.y"
2872 (yyval
.attrib
) = VERT_ATTRIB_WEIGHT
;
2878 /* Line 1455 of yacc.c */
2879 #line 869 "program_parse.y"
2881 (yyval
.attrib
) = VERT_ATTRIB_NORMAL
;
2887 /* Line 1455 of yacc.c */
2888 #line 873 "program_parse.y"
2890 if (!state
->ctx
->Extensions
.EXT_secondary_color
) {
2891 yyerror(& (yylsp
[(2) - (2)]), state
, "GL_EXT_secondary_color not supported");
2895 (yyval
.attrib
) = VERT_ATTRIB_COLOR0
+ (yyvsp
[(2) - (2)].integer
);
2901 /* Line 1455 of yacc.c */
2902 #line 882 "program_parse.y"
2904 if (!state
->ctx
->Extensions
.EXT_fog_coord
) {
2905 yyerror(& (yylsp
[(1) - (1)]), state
, "GL_EXT_fog_coord not supported");
2909 (yyval
.attrib
) = VERT_ATTRIB_FOG
;
2915 /* Line 1455 of yacc.c */
2916 #line 891 "program_parse.y"
2918 (yyval
.attrib
) = VERT_ATTRIB_TEX0
+ (yyvsp
[(2) - (2)].integer
);
2924 /* Line 1455 of yacc.c */
2925 #line 895 "program_parse.y"
2927 yyerror(& (yylsp
[(1) - (4)]), state
, "GL_ARB_matrix_palette not supported");
2934 /* Line 1455 of yacc.c */
2935 #line 900 "program_parse.y"
2937 (yyval
.attrib
) = VERT_ATTRIB_GENERIC0
+ (yyvsp
[(3) - (4)].integer
);
2943 /* Line 1455 of yacc.c */
2944 #line 906 "program_parse.y"
2946 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxAttribs
) {
2947 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid vertex attribute reference");
2951 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2957 /* Line 1455 of yacc.c */
2958 #line 920 "program_parse.y"
2960 (yyval
.attrib
) = FRAG_ATTRIB_WPOS
;
2966 /* Line 1455 of yacc.c */
2967 #line 924 "program_parse.y"
2969 (yyval
.attrib
) = FRAG_ATTRIB_COL0
+ (yyvsp
[(2) - (2)].integer
);
2975 /* Line 1455 of yacc.c */
2976 #line 928 "program_parse.y"
2978 (yyval
.attrib
) = FRAG_ATTRIB_FOGC
;
2984 /* Line 1455 of yacc.c */
2985 #line 932 "program_parse.y"
2987 (yyval
.attrib
) = FRAG_ATTRIB_TEX0
+ (yyvsp
[(2) - (2)].integer
);
2993 /* Line 1455 of yacc.c */
2994 #line 940 "program_parse.y"
2996 struct asm_symbol
*const s
=
2997 declare_variable(state
, (yyvsp
[(2) - (3)].string
), at_param
, & (yylsp
[(2) - (3)]));
3002 s
->param_binding_type
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_type
;
3003 s
->param_binding_begin
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_begin
;
3004 s
->param_binding_length
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_length
;
3005 s
->param_is_array
= 0;
3012 /* Line 1455 of yacc.c */
3013 #line 956 "program_parse.y"
3015 if (((yyvsp
[(4) - (6)].integer
) != 0) && ((unsigned) (yyvsp
[(4) - (6)].integer
) != (yyvsp
[(6) - (6)].temp_sym
).param_binding_length
)) {
3016 yyerror(& (yylsp
[(4) - (6)]), state
,
3017 "parameter array size and number of bindings must match");
3020 struct asm_symbol
*const s
=
3021 declare_variable(state
, (yyvsp
[(2) - (6)].string
), (yyvsp
[(6) - (6)].temp_sym
).type
, & (yylsp
[(2) - (6)]));
3026 s
->param_binding_type
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_type
;
3027 s
->param_binding_begin
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_begin
;
3028 s
->param_binding_length
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_length
;
3029 s
->param_is_array
= 1;
3037 /* Line 1455 of yacc.c */
3038 #line 978 "program_parse.y"
3040 (yyval
.integer
) = 0;
3046 /* Line 1455 of yacc.c */
3047 #line 982 "program_parse.y"
3049 if (((yyvsp
[(1) - (1)].integer
) < 1) || ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxParameters
)) {
3050 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid parameter array size");
3053 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3060 /* Line 1455 of yacc.c */
3061 #line 993 "program_parse.y"
3063 (yyval
.temp_sym
) = (yyvsp
[(2) - (2)].temp_sym
);
3069 /* Line 1455 of yacc.c */
3070 #line 999 "program_parse.y"
3072 (yyval
.temp_sym
) = (yyvsp
[(3) - (4)].temp_sym
);
3078 /* Line 1455 of yacc.c */
3079 #line 1006 "program_parse.y"
3081 (yyvsp
[(1) - (3)].temp_sym
).param_binding_length
+= (yyvsp
[(3) - (3)].temp_sym
).param_binding_length
;
3082 (yyval
.temp_sym
) = (yyvsp
[(1) - (3)].temp_sym
);
3088 /* Line 1455 of yacc.c */
3089 #line 1013 "program_parse.y"
3091 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3092 (yyval
.temp_sym
).param_binding_begin
= ~0;
3093 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3099 /* Line 1455 of yacc.c */
3100 #line 1019 "program_parse.y"
3102 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3103 (yyval
.temp_sym
).param_binding_begin
= ~0;
3104 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3110 /* Line 1455 of yacc.c */
3111 #line 1025 "program_parse.y"
3113 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3114 (yyval
.temp_sym
).param_binding_begin
= ~0;
3115 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3121 /* Line 1455 of yacc.c */
3122 #line 1033 "program_parse.y"
3124 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3125 (yyval
.temp_sym
).param_binding_begin
= ~0;
3126 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3132 /* Line 1455 of yacc.c */
3133 #line 1039 "program_parse.y"
3135 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3136 (yyval
.temp_sym
).param_binding_begin
= ~0;
3137 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3143 /* Line 1455 of yacc.c */
3144 #line 1045 "program_parse.y"
3146 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3147 (yyval
.temp_sym
).param_binding_begin
= ~0;
3148 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3154 /* Line 1455 of yacc.c */
3155 #line 1053 "program_parse.y"
3157 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3158 (yyval
.temp_sym
).param_binding_begin
= ~0;
3159 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3165 /* Line 1455 of yacc.c */
3166 #line 1059 "program_parse.y"
3168 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3169 (yyval
.temp_sym
).param_binding_begin
= ~0;
3170 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3176 /* Line 1455 of yacc.c */
3177 #line 1065 "program_parse.y"
3179 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3180 (yyval
.temp_sym
).param_binding_begin
= ~0;
3181 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3187 /* Line 1455 of yacc.c */
3188 #line 1072 "program_parse.y"
3189 { memcpy((yyval
.state
), (yyvsp
[(1) - (1)].state
), sizeof((yyval
.state
))); ;}
3194 /* Line 1455 of yacc.c */
3195 #line 1073 "program_parse.y"
3196 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3201 /* Line 1455 of yacc.c */
3202 #line 1076 "program_parse.y"
3203 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3208 /* Line 1455 of yacc.c */
3209 #line 1077 "program_parse.y"
3210 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3215 /* Line 1455 of yacc.c */
3216 #line 1078 "program_parse.y"
3217 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3222 /* Line 1455 of yacc.c */
3223 #line 1079 "program_parse.y"
3224 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3229 /* Line 1455 of yacc.c */
3230 #line 1080 "program_parse.y"
3231 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3236 /* Line 1455 of yacc.c */
3237 #line 1081 "program_parse.y"
3238 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3243 /* Line 1455 of yacc.c */
3244 #line 1082 "program_parse.y"
3245 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3250 /* Line 1455 of yacc.c */
3251 #line 1083 "program_parse.y"
3252 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3257 /* Line 1455 of yacc.c */
3258 #line 1084 "program_parse.y"
3259 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3264 /* Line 1455 of yacc.c */
3265 #line 1085 "program_parse.y"
3266 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3271 /* Line 1455 of yacc.c */
3272 #line 1089 "program_parse.y"
3274 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3275 (yyval
.state
)[0] = STATE_MATERIAL
;
3276 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].integer
);
3277 (yyval
.state
)[2] = (yyvsp
[(3) - (3)].integer
);
3283 /* Line 1455 of yacc.c */
3284 #line 1098 "program_parse.y"
3286 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3292 /* Line 1455 of yacc.c */
3293 #line 1102 "program_parse.y"
3295 (yyval
.integer
) = STATE_EMISSION
;
3301 /* Line 1455 of yacc.c */
3302 #line 1106 "program_parse.y"
3304 (yyval
.integer
) = STATE_SHININESS
;
3310 /* Line 1455 of yacc.c */
3311 #line 1112 "program_parse.y"
3313 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3314 (yyval
.state
)[0] = STATE_LIGHT
;
3315 (yyval
.state
)[1] = (yyvsp
[(3) - (5)].integer
);
3316 (yyval
.state
)[2] = (yyvsp
[(5) - (5)].integer
);
3322 /* Line 1455 of yacc.c */
3323 #line 1121 "program_parse.y"
3325 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3331 /* Line 1455 of yacc.c */
3332 #line 1125 "program_parse.y"
3334 (yyval
.integer
) = STATE_POSITION
;
3340 /* Line 1455 of yacc.c */
3341 #line 1129 "program_parse.y"
3343 if (!state
->ctx
->Extensions
.EXT_point_parameters
) {
3344 yyerror(& (yylsp
[(1) - (1)]), state
, "GL_ARB_point_parameters not supported");
3348 (yyval
.integer
) = STATE_ATTENUATION
;
3354 /* Line 1455 of yacc.c */
3355 #line 1138 "program_parse.y"
3357 (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
);
3363 /* Line 1455 of yacc.c */
3364 #line 1142 "program_parse.y"
3366 (yyval
.integer
) = STATE_HALF_VECTOR
;
3372 /* Line 1455 of yacc.c */
3373 #line 1148 "program_parse.y"
3375 (yyval
.integer
) = STATE_SPOT_DIRECTION
;
3381 /* Line 1455 of yacc.c */
3382 #line 1154 "program_parse.y"
3384 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].state
)[0];
3385 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].state
)[1];
3391 /* Line 1455 of yacc.c */
3392 #line 1161 "program_parse.y"
3394 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3395 (yyval
.state
)[0] = STATE_LIGHTMODEL_AMBIENT
;
3401 /* Line 1455 of yacc.c */
3402 #line 1166 "program_parse.y"
3404 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3405 (yyval
.state
)[0] = STATE_LIGHTMODEL_SCENECOLOR
;
3406 (yyval
.state
)[1] = (yyvsp
[(1) - (2)].integer
);
3412 /* Line 1455 of yacc.c */
3413 #line 1174 "program_parse.y"
3415 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3416 (yyval
.state
)[0] = STATE_LIGHTPROD
;
3417 (yyval
.state
)[1] = (yyvsp
[(3) - (6)].integer
);
3418 (yyval
.state
)[2] = (yyvsp
[(5) - (6)].integer
);
3419 (yyval
.state
)[3] = (yyvsp
[(6) - (6)].integer
);
3425 /* Line 1455 of yacc.c */
3426 #line 1186 "program_parse.y"
3428 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3429 (yyval
.state
)[0] = (yyvsp
[(3) - (3)].integer
);
3430 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].integer
);
3436 /* Line 1455 of yacc.c */
3437 #line 1194 "program_parse.y"
3439 (yyval
.integer
) = STATE_TEXENV_COLOR
;
3445 /* Line 1455 of yacc.c */
3446 #line 1200 "program_parse.y"
3448 (yyval
.integer
) = STATE_AMBIENT
;
3454 /* Line 1455 of yacc.c */
3455 #line 1204 "program_parse.y"
3457 (yyval
.integer
) = STATE_DIFFUSE
;
3463 /* Line 1455 of yacc.c */
3464 #line 1208 "program_parse.y"
3466 (yyval
.integer
) = STATE_SPECULAR
;
3472 /* Line 1455 of yacc.c */
3473 #line 1214 "program_parse.y"
3475 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxLights
) {
3476 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid light selector");
3480 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3486 /* Line 1455 of yacc.c */
3487 #line 1225 "program_parse.y"
3489 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3490 (yyval
.state
)[0] = STATE_TEXGEN
;
3491 (yyval
.state
)[1] = (yyvsp
[(2) - (4)].integer
);
3492 (yyval
.state
)[2] = (yyvsp
[(3) - (4)].integer
) + (yyvsp
[(4) - (4)].integer
);
3498 /* Line 1455 of yacc.c */
3499 #line 1234 "program_parse.y"
3501 (yyval
.integer
) = STATE_TEXGEN_EYE_S
;
3507 /* Line 1455 of yacc.c */
3508 #line 1238 "program_parse.y"
3510 (yyval
.integer
) = STATE_TEXGEN_OBJECT_S
;
3516 /* Line 1455 of yacc.c */
3517 #line 1243 "program_parse.y"
3519 (yyval
.integer
) = STATE_TEXGEN_EYE_S
- STATE_TEXGEN_EYE_S
;
3525 /* Line 1455 of yacc.c */
3526 #line 1247 "program_parse.y"
3528 (yyval
.integer
) = STATE_TEXGEN_EYE_T
- STATE_TEXGEN_EYE_S
;
3534 /* Line 1455 of yacc.c */
3535 #line 1251 "program_parse.y"
3537 (yyval
.integer
) = STATE_TEXGEN_EYE_R
- STATE_TEXGEN_EYE_S
;
3543 /* Line 1455 of yacc.c */
3544 #line 1255 "program_parse.y"
3546 (yyval
.integer
) = STATE_TEXGEN_EYE_Q
- STATE_TEXGEN_EYE_S
;
3552 /* Line 1455 of yacc.c */
3553 #line 1261 "program_parse.y"
3555 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3556 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].integer
);
3562 /* Line 1455 of yacc.c */
3563 #line 1268 "program_parse.y"
3565 (yyval
.integer
) = STATE_FOG_COLOR
;
3571 /* Line 1455 of yacc.c */
3572 #line 1272 "program_parse.y"
3574 (yyval
.integer
) = STATE_FOG_PARAMS
;
3580 /* Line 1455 of yacc.c */
3581 #line 1278 "program_parse.y"
3583 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3584 (yyval
.state
)[0] = STATE_CLIPPLANE
;
3585 (yyval
.state
)[1] = (yyvsp
[(3) - (5)].integer
);
3591 /* Line 1455 of yacc.c */
3592 #line 1286 "program_parse.y"
3594 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxClipPlanes
) {
3595 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid clip plane selector");
3599 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3605 /* Line 1455 of yacc.c */
3606 #line 1297 "program_parse.y"
3608 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3609 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].integer
);
3615 /* Line 1455 of yacc.c */
3616 #line 1304 "program_parse.y"
3618 (yyval
.integer
) = STATE_POINT_SIZE
;
3624 /* Line 1455 of yacc.c */
3625 #line 1308 "program_parse.y"
3627 (yyval
.integer
) = STATE_POINT_ATTENUATION
;
3633 /* Line 1455 of yacc.c */
3634 #line 1314 "program_parse.y"
3636 (yyval
.state
)[0] = (yyvsp
[(1) - (5)].state
)[0];
3637 (yyval
.state
)[1] = (yyvsp
[(1) - (5)].state
)[1];
3638 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
3639 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
3640 (yyval
.state
)[4] = (yyvsp
[(1) - (5)].state
)[2];
3646 /* Line 1455 of yacc.c */
3647 #line 1324 "program_parse.y"
3649 (yyval
.state
)[0] = (yyvsp
[(1) - (2)].state
)[0];
3650 (yyval
.state
)[1] = (yyvsp
[(1) - (2)].state
)[1];
3651 (yyval
.state
)[2] = (yyvsp
[(2) - (2)].state
)[2];
3652 (yyval
.state
)[3] = (yyvsp
[(2) - (2)].state
)[3];
3653 (yyval
.state
)[4] = (yyvsp
[(1) - (2)].state
)[2];
3659 /* Line 1455 of yacc.c */
3660 #line 1334 "program_parse.y"
3662 (yyval
.state
)[2] = 0;
3663 (yyval
.state
)[3] = 3;
3669 /* Line 1455 of yacc.c */
3670 #line 1339 "program_parse.y"
3672 /* It seems logical that the matrix row range specifier would have
3673 * to specify a range or more than one row (i.e., $5 > $3).
3674 * However, the ARB_vertex_program spec says "a program will fail
3675 * to load if <a> is greater than <b>." This means that $3 == $5
3678 if ((yyvsp
[(3) - (6)].integer
) > (yyvsp
[(5) - (6)].integer
)) {
3679 yyerror(& (yylsp
[(3) - (6)]), state
, "invalid matrix row range");
3683 (yyval
.state
)[2] = (yyvsp
[(3) - (6)].integer
);
3684 (yyval
.state
)[3] = (yyvsp
[(5) - (6)].integer
);
3690 /* Line 1455 of yacc.c */
3691 #line 1357 "program_parse.y"
3693 (yyval
.state
)[0] = (yyvsp
[(2) - (3)].state
)[0];
3694 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].state
)[1];
3695 (yyval
.state
)[2] = (yyvsp
[(3) - (3)].integer
);
3701 /* Line 1455 of yacc.c */
3702 #line 1365 "program_parse.y"
3704 (yyval
.integer
) = 0;
3710 /* Line 1455 of yacc.c */
3711 #line 1369 "program_parse.y"
3713 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3719 /* Line 1455 of yacc.c */
3720 #line 1375 "program_parse.y"
3722 (yyval
.integer
) = STATE_MATRIX_INVERSE
;
3728 /* Line 1455 of yacc.c */
3729 #line 1379 "program_parse.y"
3731 (yyval
.integer
) = STATE_MATRIX_TRANSPOSE
;
3737 /* Line 1455 of yacc.c */
3738 #line 1383 "program_parse.y"
3740 (yyval
.integer
) = STATE_MATRIX_INVTRANS
;
3746 /* Line 1455 of yacc.c */
3747 #line 1389 "program_parse.y"
3749 if ((yyvsp
[(1) - (1)].integer
) > 3) {
3750 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid matrix row reference");
3754 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3760 /* Line 1455 of yacc.c */
3761 #line 1400 "program_parse.y"
3763 (yyval
.state
)[0] = STATE_MODELVIEW_MATRIX
;
3764 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].integer
);
3770 /* Line 1455 of yacc.c */
3771 #line 1405 "program_parse.y"
3773 (yyval
.state
)[0] = STATE_PROJECTION_MATRIX
;
3774 (yyval
.state
)[1] = 0;
3780 /* Line 1455 of yacc.c */
3781 #line 1410 "program_parse.y"
3783 (yyval
.state
)[0] = STATE_MVP_MATRIX
;
3784 (yyval
.state
)[1] = 0;
3790 /* Line 1455 of yacc.c */
3791 #line 1415 "program_parse.y"
3793 (yyval
.state
)[0] = STATE_TEXTURE_MATRIX
;
3794 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].integer
);
3800 /* Line 1455 of yacc.c */
3801 #line 1420 "program_parse.y"
3803 yyerror(& (yylsp
[(1) - (4)]), state
, "GL_ARB_matrix_palette not supported");
3810 /* Line 1455 of yacc.c */
3811 #line 1425 "program_parse.y"
3813 (yyval
.state
)[0] = STATE_PROGRAM_MATRIX
;
3814 (yyval
.state
)[1] = (yyvsp
[(3) - (4)].integer
);
3820 /* Line 1455 of yacc.c */
3821 #line 1432 "program_parse.y"
3823 (yyval
.integer
) = 0;
3829 /* Line 1455 of yacc.c */
3830 #line 1436 "program_parse.y"
3832 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3838 /* Line 1455 of yacc.c */
3839 #line 1441 "program_parse.y"
3841 /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
3844 if ((yyvsp
[(1) - (1)].integer
) != 0) {
3845 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid modelview matrix index");
3849 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3855 /* Line 1455 of yacc.c */
3856 #line 1454 "program_parse.y"
3858 /* Since GL_ARB_matrix_palette isn't supported, just let any value
3859 * through here. The error will be generated later.
3861 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3867 /* Line 1455 of yacc.c */
3868 #line 1462 "program_parse.y"
3870 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxProgramMatrices
) {
3871 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program matrix selector");
3875 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3881 /* Line 1455 of yacc.c */
3882 #line 1479 "program_parse.y"
3884 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3885 (yyval
.state
)[0] = state
->state_param_enum
;
3886 (yyval
.state
)[1] = STATE_ENV
;
3887 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].state
)[0];
3888 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].state
)[1];
3894 /* Line 1455 of yacc.c */
3895 #line 1489 "program_parse.y"
3897 (yyval
.state
)[0] = (yyvsp
[(1) - (1)].integer
);
3898 (yyval
.state
)[1] = (yyvsp
[(1) - (1)].integer
);
3904 /* Line 1455 of yacc.c */
3905 #line 1494 "program_parse.y"
3907 (yyval
.state
)[0] = (yyvsp
[(1) - (3)].integer
);
3908 (yyval
.state
)[1] = (yyvsp
[(3) - (3)].integer
);
3914 /* Line 1455 of yacc.c */
3915 #line 1501 "program_parse.y"
3917 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3918 (yyval
.state
)[0] = state
->state_param_enum
;
3919 (yyval
.state
)[1] = STATE_ENV
;
3920 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
3921 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
3927 /* Line 1455 of yacc.c */
3928 #line 1511 "program_parse.y"
3930 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3931 (yyval
.state
)[0] = state
->state_param_enum
;
3932 (yyval
.state
)[1] = STATE_LOCAL
;
3933 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].state
)[0];
3934 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].state
)[1];
3940 /* Line 1455 of yacc.c */
3941 #line 1520 "program_parse.y"
3943 (yyval
.state
)[0] = (yyvsp
[(1) - (1)].integer
);
3944 (yyval
.state
)[1] = (yyvsp
[(1) - (1)].integer
);
3950 /* Line 1455 of yacc.c */
3951 #line 1525 "program_parse.y"
3953 (yyval
.state
)[0] = (yyvsp
[(1) - (3)].integer
);
3954 (yyval
.state
)[1] = (yyvsp
[(3) - (3)].integer
);
3960 /* Line 1455 of yacc.c */
3961 #line 1532 "program_parse.y"
3963 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3964 (yyval
.state
)[0] = state
->state_param_enum
;
3965 (yyval
.state
)[1] = STATE_LOCAL
;
3966 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
3967 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
3973 /* Line 1455 of yacc.c */
3974 #line 1542 "program_parse.y"
3976 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxEnvParams
) {
3977 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid environment parameter reference");
3980 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3986 /* Line 1455 of yacc.c */
3987 #line 1552 "program_parse.y"
3989 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxLocalParams
) {
3990 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid local parameter reference");
3993 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3999 /* Line 1455 of yacc.c */
4000 #line 1567 "program_parse.y"
4002 (yyval
.vector
).count
= 1;
4003 (yyval
.vector
).data
[0] = (yyvsp
[(1) - (1)].real
);
4009 /* Line 1455 of yacc.c */
4010 #line 1574 "program_parse.y"
4012 (yyval
.vector
).count
= 1;
4013 (yyval
.vector
).data
[0] = (yyvsp
[(1) - (1)].real
);
4019 /* Line 1455 of yacc.c */
4020 #line 1579 "program_parse.y"
4022 (yyval
.vector
).count
= 1;
4023 (yyval
.vector
).data
[0] = (float) (yyvsp
[(1) - (1)].integer
);
4029 /* Line 1455 of yacc.c */
4030 #line 1586 "program_parse.y"
4032 (yyval
.vector
).count
= 1;
4033 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (3)].real
);
4034 (yyval
.vector
).data
[1] = 0.0f
;
4035 (yyval
.vector
).data
[2] = 0.0f
;
4036 (yyval
.vector
).data
[3] = 0.0f
;
4042 /* Line 1455 of yacc.c */
4043 #line 1594 "program_parse.y"
4045 (yyval
.vector
).count
= 2;
4046 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (5)].real
);
4047 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (5)].real
);
4048 (yyval
.vector
).data
[2] = 0.0f
;
4049 (yyval
.vector
).data
[3] = 0.0f
;
4055 /* Line 1455 of yacc.c */
4056 #line 1603 "program_parse.y"
4058 (yyval
.vector
).count
= 3;
4059 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (7)].real
);
4060 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (7)].real
);
4061 (yyval
.vector
).data
[2] = (yyvsp
[(6) - (7)].real
);
4062 (yyval
.vector
).data
[3] = 0.0f
;
4068 /* Line 1455 of yacc.c */
4069 #line 1612 "program_parse.y"
4071 (yyval
.vector
).count
= 4;
4072 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (9)].real
);
4073 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (9)].real
);
4074 (yyval
.vector
).data
[2] = (yyvsp
[(6) - (9)].real
);
4075 (yyval
.vector
).data
[3] = (yyvsp
[(8) - (9)].real
);
4081 /* Line 1455 of yacc.c */
4082 #line 1622 "program_parse.y"
4084 (yyval
.real
) = ((yyvsp
[(1) - (2)].negate
)) ? -(yyvsp
[(2) - (2)].real
) : (yyvsp
[(2) - (2)].real
);
4090 /* Line 1455 of yacc.c */
4091 #line 1626 "program_parse.y"
4093 (yyval
.real
) = (float)(((yyvsp
[(1) - (2)].negate
)) ? -(yyvsp
[(2) - (2)].integer
) : (yyvsp
[(2) - (2)].integer
));
4099 /* Line 1455 of yacc.c */
4100 #line 1631 "program_parse.y"
4101 { (yyval
.negate
) = FALSE
; ;}
4106 /* Line 1455 of yacc.c */
4107 #line 1632 "program_parse.y"
4108 { (yyval
.negate
) = TRUE
; ;}
4113 /* Line 1455 of yacc.c */
4114 #line 1633 "program_parse.y"
4115 { (yyval
.negate
) = FALSE
; ;}
4120 /* Line 1455 of yacc.c */
4121 #line 1636 "program_parse.y"
4122 { (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
); ;}
4127 /* Line 1455 of yacc.c */
4128 #line 1639 "program_parse.y"
4129 { (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
); ;}
4134 /* Line 1455 of yacc.c */
4135 #line 1643 "program_parse.y"
4137 if (!declare_variable(state
, (yyvsp
[(3) - (3)].string
), (yyvsp
[(0) - (3)].integer
), & (yylsp
[(3) - (3)]))) {
4145 /* Line 1455 of yacc.c */
4146 #line 1649 "program_parse.y"
4148 if (!declare_variable(state
, (yyvsp
[(1) - (1)].string
), (yyvsp
[(0) - (1)].integer
), & (yylsp
[(1) - (1)]))) {
4156 /* Line 1455 of yacc.c */
4157 #line 1657 "program_parse.y"
4159 struct asm_symbol
*const s
=
4160 declare_variable(state
, (yyvsp
[(2) - (4)].string
), at_output
, & (yylsp
[(2) - (4)]));
4165 s
->output_binding
= (yyvsp
[(4) - (4)].result
);
4172 /* Line 1455 of yacc.c */
4173 #line 1670 "program_parse.y"
4175 if (state
->mode
== ARB_vertex
) {
4176 (yyval
.result
) = VERT_RESULT_HPOS
;
4178 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4186 /* Line 1455 of yacc.c */
4187 #line 1679 "program_parse.y"
4189 if (state
->mode
== ARB_vertex
) {
4190 (yyval
.result
) = VERT_RESULT_FOGC
;
4192 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4200 /* Line 1455 of yacc.c */
4201 #line 1688 "program_parse.y"
4203 (yyval
.result
) = (yyvsp
[(2) - (2)].result
);
4209 /* Line 1455 of yacc.c */
4210 #line 1692 "program_parse.y"
4212 if (state
->mode
== ARB_vertex
) {
4213 (yyval
.result
) = VERT_RESULT_PSIZ
;
4215 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4223 /* Line 1455 of yacc.c */
4224 #line 1701 "program_parse.y"
4226 if (state
->mode
== ARB_vertex
) {
4227 (yyval
.result
) = VERT_RESULT_TEX0
+ (yyvsp
[(3) - (3)].integer
);
4229 yyerror(& (yylsp
[(2) - (3)]), state
, "invalid program result name");
4237 /* Line 1455 of yacc.c */
4238 #line 1710 "program_parse.y"
4240 if (state
->mode
== ARB_fragment
) {
4241 (yyval
.result
) = FRAG_RESULT_DEPTH
;
4243 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4251 /* Line 1455 of yacc.c */
4252 #line 1721 "program_parse.y"
4254 (yyval
.result
) = (yyvsp
[(2) - (3)].integer
) + (yyvsp
[(3) - (3)].integer
);
4260 /* Line 1455 of yacc.c */
4261 #line 1727 "program_parse.y"
4263 (yyval
.integer
) = (state
->mode
== ARB_vertex
)
4265 : FRAG_RESULT_COLOR
;
4271 /* Line 1455 of yacc.c */
4272 #line 1733 "program_parse.y"
4274 if (state
->mode
== ARB_vertex
) {
4275 (yyval
.integer
) = VERT_RESULT_COL0
;
4277 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4285 /* Line 1455 of yacc.c */
4286 #line 1742 "program_parse.y"
4288 if (state
->mode
== ARB_vertex
) {
4289 (yyval
.integer
) = VERT_RESULT_BFC0
;
4291 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4299 /* Line 1455 of yacc.c */
4300 #line 1753 "program_parse.y"
4302 (yyval
.integer
) = 0;
4308 /* Line 1455 of yacc.c */
4309 #line 1757 "program_parse.y"
4311 if (state
->mode
== ARB_vertex
) {
4312 (yyval
.integer
) = 0;
4314 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4322 /* Line 1455 of yacc.c */
4323 #line 1766 "program_parse.y"
4325 if (state
->mode
== ARB_vertex
) {
4326 (yyval
.integer
) = 1;
4328 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4336 /* Line 1455 of yacc.c */
4337 #line 1776 "program_parse.y"
4338 { (yyval
.integer
) = 0; ;}
4343 /* Line 1455 of yacc.c */
4344 #line 1777 "program_parse.y"
4345 { (yyval
.integer
) = 0; ;}
4350 /* Line 1455 of yacc.c */
4351 #line 1778 "program_parse.y"
4352 { (yyval
.integer
) = 1; ;}
4357 /* Line 1455 of yacc.c */
4358 #line 1781 "program_parse.y"
4359 { (yyval
.integer
) = 0; ;}
4364 /* Line 1455 of yacc.c */
4365 #line 1782 "program_parse.y"
4366 { (yyval
.integer
) = 0; ;}
4371 /* Line 1455 of yacc.c */
4372 #line 1783 "program_parse.y"
4373 { (yyval
.integer
) = 1; ;}
4378 /* Line 1455 of yacc.c */
4379 #line 1786 "program_parse.y"
4380 { (yyval
.integer
) = 0; ;}
4385 /* Line 1455 of yacc.c */
4386 #line 1787 "program_parse.y"
4387 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4392 /* Line 1455 of yacc.c */
4393 #line 1790 "program_parse.y"
4394 { (yyval
.integer
) = 0; ;}
4399 /* Line 1455 of yacc.c */
4400 #line 1791 "program_parse.y"
4401 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4406 /* Line 1455 of yacc.c */
4407 #line 1794 "program_parse.y"
4408 { (yyval
.integer
) = 0; ;}
4413 /* Line 1455 of yacc.c */
4414 #line 1795 "program_parse.y"
4415 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4420 /* Line 1455 of yacc.c */
4421 #line 1799 "program_parse.y"
4423 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureCoordUnits
) {
4424 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture coordinate unit selector");
4428 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4434 /* Line 1455 of yacc.c */
4435 #line 1810 "program_parse.y"
4437 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureImageUnits
) {
4438 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture image unit selector");
4442 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4448 /* Line 1455 of yacc.c */
4449 #line 1821 "program_parse.y"
4451 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureUnits
) {
4452 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture unit selector");
4456 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4462 /* Line 1455 of yacc.c */
4463 #line 1832 "program_parse.y"
4465 struct asm_symbol
*exist
= (struct asm_symbol
*)
4466 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(2) - (4)].string
));
4467 struct asm_symbol
*target
= (struct asm_symbol
*)
4468 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(4) - (4)].string
));
4471 if (exist
!= NULL
) {
4472 yyerror(& (yylsp
[(2) - (4)]), state
, "redeclared identifier");
4474 } else if (target
== NULL
) {
4475 yyerror(& (yylsp
[(4) - (4)]), state
,
4476 "undefined variable binding in ALIAS statement");
4479 _mesa_symbol_table_add_symbol(state
->st
, 0, (yyvsp
[(2) - (4)].string
), target
);
4486 /* Line 1455 of yacc.c */
4487 #line 4488 "program_parse.tab.c"
4490 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
4494 YY_STACK_PRINT (yyss
, yyssp
);
4499 /* Now `shift' the result of the reduction. Determine what state
4500 that goes to, based on the state we popped back to and the rule
4501 number reduced by. */
4505 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
4506 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4507 yystate
= yytable
[yystate
];
4509 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
4514 /*------------------------------------.
4515 | yyerrlab -- here on detecting error |
4516 `------------------------------------*/
4518 /* If not already recovering from an error, report this error. */
4522 #if ! YYERROR_VERBOSE
4523 yyerror (&yylloc
, state
, YY_("syntax error"));
4526 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
4527 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
4529 YYSIZE_T yyalloc
= 2 * yysize
;
4530 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
4531 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
4532 if (yymsg
!= yymsgbuf
)
4533 YYSTACK_FREE (yymsg
);
4534 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
4536 yymsg_alloc
= yyalloc
;
4540 yymsg_alloc
= sizeof yymsgbuf
;
4544 if (0 < yysize
&& yysize
<= yymsg_alloc
)
4546 (void) yysyntax_error (yymsg
, yystate
, yychar
);
4547 yyerror (&yylloc
, state
, yymsg
);
4551 yyerror (&yylloc
, state
, YY_("syntax error"));
4553 goto yyexhaustedlab
;
4559 yyerror_range
[0] = yylloc
;
4561 if (yyerrstatus
== 3)
4563 /* If just tried and failed to reuse lookahead token after an
4564 error, discard it. */
4566 if (yychar
<= YYEOF
)
4568 /* Return failure if at end of input. */
4569 if (yychar
== YYEOF
)
4574 yydestruct ("Error: discarding",
4575 yytoken
, &yylval
, &yylloc
, state
);
4580 /* Else will try to reuse lookahead token after shifting the error
4585 /*---------------------------------------------------.
4586 | yyerrorlab -- error raised explicitly by YYERROR. |
4587 `---------------------------------------------------*/
4590 /* Pacify compilers like GCC when the user code never invokes
4591 YYERROR and the label yyerrorlab therefore never appears in user
4593 if (/*CONSTCOND*/ 0)
4596 yyerror_range
[0] = yylsp
[1-yylen
];
4597 /* Do not reclaim the symbols of the rule which action triggered
4601 YY_STACK_PRINT (yyss
, yyssp
);
4606 /*-------------------------------------------------------------.
4607 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4608 `-------------------------------------------------------------*/
4610 yyerrstatus
= 3; /* Each real token shifted decrements this. */
4614 yyn
= yypact
[yystate
];
4615 if (yyn
!= YYPACT_NINF
)
4618 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
4626 /* Pop the current state because it cannot handle the error token. */
4630 yyerror_range
[0] = *yylsp
;
4631 yydestruct ("Error: popping",
4632 yystos
[yystate
], yyvsp
, yylsp
, state
);
4635 YY_STACK_PRINT (yyss
, yyssp
);
4640 yyerror_range
[1] = yylloc
;
4641 /* Using YYLLOC is tempting, but would change the location of
4642 the lookahead. YYLOC is available though. */
4643 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
4646 /* Shift the error token. */
4647 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
4653 /*-------------------------------------.
4654 | yyacceptlab -- YYACCEPT comes here. |
4655 `-------------------------------------*/
4660 /*-----------------------------------.
4661 | yyabortlab -- YYABORT comes here. |
4662 `-----------------------------------*/
4667 #if !defined(yyoverflow) || YYERROR_VERBOSE
4668 /*-------------------------------------------------.
4669 | yyexhaustedlab -- memory exhaustion comes here. |
4670 `-------------------------------------------------*/
4672 yyerror (&yylloc
, state
, YY_("memory exhausted"));
4678 if (yychar
!= YYEMPTY
)
4679 yydestruct ("Cleanup: discarding lookahead",
4680 yytoken
, &yylval
, &yylloc
, state
);
4681 /* Do not reclaim the symbols of the rule which action triggered
4682 this YYABORT or YYACCEPT. */
4684 YY_STACK_PRINT (yyss
, yyssp
);
4685 while (yyssp
!= yyss
)
4687 yydestruct ("Cleanup: popping",
4688 yystos
[*yyssp
], yyvsp
, yylsp
, state
);
4693 YYSTACK_FREE (yyss
);
4696 if (yymsg
!= yymsgbuf
)
4697 YYSTACK_FREE (yymsg
);
4699 /* Make sure YYID is used. */
4700 return YYID (yyresult
);
4705 /* Line 1675 of yacc.c */
4706 #line 1852 "program_parse.y"
4709 struct asm_instruction
*
4710 asm_instruction_ctor(gl_inst_opcode op
,
4711 const struct prog_dst_register
*dst
,
4712 const struct asm_src_register
*src0
,
4713 const struct asm_src_register
*src1
,
4714 const struct asm_src_register
*src2
)
4716 struct asm_instruction
*inst
= calloc(1, sizeof(struct asm_instruction
));
4719 _mesa_init_instructions(& inst
->Base
, 1);
4720 inst
->Base
.Opcode
= op
;
4721 inst
->Base
.DstReg
= *dst
;
4723 inst
->Base
.SrcReg
[0] = src0
->Base
;
4724 inst
->SrcReg
[0] = *src0
;
4727 inst
->Base
.SrcReg
[1] = src1
->Base
;
4728 inst
->SrcReg
[1] = *src1
;
4730 init_src_reg(& inst
->SrcReg
[1]);
4734 inst
->Base
.SrcReg
[2] = src2
->Base
;
4735 inst
->SrcReg
[2] = *src2
;
4737 init_src_reg(& inst
->SrcReg
[2]);
4746 init_dst_reg(struct prog_dst_register
*r
)
4748 memset(r
, 0, sizeof(*r
));
4749 r
->File
= PROGRAM_UNDEFINED
;
4750 r
->WriteMask
= WRITEMASK_XYZW
;
4751 r
->CondMask
= COND_TR
;
4752 r
->CondSwizzle
= SWIZZLE_NOOP
;
4757 init_src_reg(struct asm_src_register
*r
)
4759 memset(r
, 0, sizeof(*r
));
4760 r
->Base
.File
= PROGRAM_UNDEFINED
;
4761 r
->Base
.Swizzle
= SWIZZLE_NOOP
;
4767 * Validate the set of inputs used by a program
4769 * Validates that legal sets of inputs are used by the program. In this case
4770 * "used" included both reading the input or binding the input to a name using
4771 * the \c ATTRIB command.
4774 * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
4777 validate_inputs(struct YYLTYPE
*locp
, struct asm_parser_state
*state
)
4779 const int inputs
= state
->prog
->InputsRead
| state
->InputsBound
;
4781 if (((inputs
& 0x0ffff) & (inputs
>> 16)) != 0) {
4782 yyerror(locp
, state
, "illegal use of generic attribute and name attribute");
4791 declare_variable(struct asm_parser_state
*state
, char *name
, enum asm_type t
,
4792 struct YYLTYPE
*locp
)
4794 struct asm_symbol
*s
= NULL
;
4795 struct asm_symbol
*exist
= (struct asm_symbol
*)
4796 _mesa_symbol_table_find_symbol(state
->st
, 0, name
);
4799 if (exist
!= NULL
) {
4800 yyerror(locp
, state
, "redeclared identifier");
4802 s
= calloc(1, sizeof(struct asm_symbol
));
4808 if (state
->prog
->NumTemporaries
>= state
->limits
->MaxTemps
) {
4809 yyerror(locp
, state
, "too many temporaries declared");
4814 s
->temp_binding
= state
->prog
->NumTemporaries
;
4815 state
->prog
->NumTemporaries
++;
4819 if (state
->prog
->NumAddressRegs
>= state
->limits
->MaxAddressRegs
) {
4820 yyerror(locp
, state
, "too many address registers declared");
4825 /* FINISHME: Add support for multiple address registers.
4827 state
->prog
->NumAddressRegs
++;
4834 _mesa_symbol_table_add_symbol(state
->st
, 0, s
->name
, s
);
4835 s
->next
= state
->sym
;
4843 int add_state_reference(struct gl_program_parameter_list
*param_list
,
4844 const gl_state_index tokens
[STATE_LENGTH
])
4846 const GLuint size
= 4; /* XXX fix */
4850 name
= _mesa_program_state_string(tokens
);
4851 index
= _mesa_add_parameter(param_list
, PROGRAM_STATE_VAR
, name
,
4853 NULL
, (gl_state_index
*) tokens
, 0x0);
4854 param_list
->StateFlags
|= _mesa_program_state_flags(tokens
);
4856 /* free name string here since we duplicated it in add_parameter() */
4864 initialize_symbol_from_state(struct gl_program
*prog
,
4865 struct asm_symbol
*param_var
,
4866 const gl_state_index tokens
[STATE_LENGTH
])
4869 gl_state_index state_tokens
[STATE_LENGTH
];
4872 memcpy(state_tokens
, tokens
, sizeof(state_tokens
));
4874 param_var
->type
= at_param
;
4875 param_var
->param_binding_type
= PROGRAM_STATE_VAR
;
4877 /* If we are adding a STATE_MATRIX that has multiple rows, we need to
4878 * unroll it and call add_state_reference() for each row
4880 if ((state_tokens
[0] == STATE_MODELVIEW_MATRIX
||
4881 state_tokens
[0] == STATE_PROJECTION_MATRIX
||
4882 state_tokens
[0] == STATE_MVP_MATRIX
||
4883 state_tokens
[0] == STATE_TEXTURE_MATRIX
||
4884 state_tokens
[0] == STATE_PROGRAM_MATRIX
)
4885 && (state_tokens
[2] != state_tokens
[3])) {
4887 const int first_row
= state_tokens
[2];
4888 const int last_row
= state_tokens
[3];
4890 for (row
= first_row
; row
<= last_row
; row
++) {
4891 state_tokens
[2] = state_tokens
[3] = row
;
4893 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
4894 if (param_var
->param_binding_begin
== ~0U)
4895 param_var
->param_binding_begin
= idx
;
4896 param_var
->param_binding_length
++;
4900 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
4901 if (param_var
->param_binding_begin
== ~0U)
4902 param_var
->param_binding_begin
= idx
;
4903 param_var
->param_binding_length
++;
4911 initialize_symbol_from_param(struct gl_program
*prog
,
4912 struct asm_symbol
*param_var
,
4913 const gl_state_index tokens
[STATE_LENGTH
])
4916 gl_state_index state_tokens
[STATE_LENGTH
];
4919 memcpy(state_tokens
, tokens
, sizeof(state_tokens
));
4921 assert((state_tokens
[0] == STATE_VERTEX_PROGRAM
)
4922 || (state_tokens
[0] == STATE_FRAGMENT_PROGRAM
));
4923 assert((state_tokens
[1] == STATE_ENV
)
4924 || (state_tokens
[1] == STATE_LOCAL
));
4926 param_var
->type
= at_param
;
4927 param_var
->param_binding_type
= (state_tokens
[1] == STATE_ENV
)
4928 ? PROGRAM_ENV_PARAM
: PROGRAM_LOCAL_PARAM
;
4930 /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
4931 * we need to unroll it and call add_state_reference() for each row
4933 if (state_tokens
[2] != state_tokens
[3]) {
4935 const int first_row
= state_tokens
[2];
4936 const int last_row
= state_tokens
[3];
4938 for (row
= first_row
; row
<= last_row
; row
++) {
4939 state_tokens
[2] = state_tokens
[3] = row
;
4941 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
4942 if (param_var
->param_binding_begin
== ~0U)
4943 param_var
->param_binding_begin
= idx
;
4944 param_var
->param_binding_length
++;
4948 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
4949 if (param_var
->param_binding_begin
== ~0U)
4950 param_var
->param_binding_begin
= idx
;
4951 param_var
->param_binding_length
++;
4959 initialize_symbol_from_const(struct gl_program
*prog
,
4960 struct asm_symbol
*param_var
,
4961 const struct asm_vector
*vec
)
4963 const int idx
= _mesa_add_parameter(prog
->Parameters
, PROGRAM_CONSTANT
,
4964 NULL
, vec
->count
, GL_NONE
, vec
->data
,
4967 param_var
->type
= at_param
;
4968 param_var
->param_binding_type
= PROGRAM_CONSTANT
;
4970 if (param_var
->param_binding_begin
== ~0U)
4971 param_var
->param_binding_begin
= idx
;
4972 param_var
->param_binding_length
++;
4979 make_error_string(const char *fmt
, ...)
4985 va_start(args
, fmt
);
4987 /* Call vsnprintf once to determine how large the final string is. Call it
4988 * again to do the actual formatting. from the vsnprintf manual page:
4990 * Upon successful return, these functions return the number of
4991 * characters printed (not including the trailing '\0' used to end
4992 * output to strings).
4994 length
= 1 + vsnprintf(NULL
, 0, fmt
, args
);
4996 str
= _mesa_malloc(length
);
4998 vsnprintf(str
, length
, fmt
, args
);
5008 yyerror(YYLTYPE
*locp
, struct asm_parser_state
*state
, const char *s
)
5013 err_str
= make_error_string("glProgramStringARB(%s)\n", s
);
5015 _mesa_error(state
->ctx
, GL_INVALID_OPERATION
, err_str
);
5016 _mesa_free(err_str
);
5019 err_str
= make_error_string("line %u, char %u: error: %s\n",
5020 locp
->first_line
, locp
->first_column
, s
);
5021 _mesa_set_program_error(state
->ctx
, locp
->position
, err_str
);
5024 _mesa_free(err_str
);
5030 _mesa_parse_arb_program(GLcontext
*ctx
, GLenum target
, const GLubyte
*str
,
5031 GLsizei len
, struct asm_parser_state
*state
)
5033 struct gl_program_constants limits
;
5034 struct asm_instruction
*inst
;
5037 GLboolean result
= GL_FALSE
;
5039 struct asm_symbol
*sym
;
5042 state
->prog
->Target
= target
;
5043 state
->prog
->Parameters
= _mesa_new_parameter_list();
5045 /* Make a copy of the program string and force it to be NUL-terminated.
5047 strz
= (GLubyte
*) _mesa_malloc(len
+ 1);
5049 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5052 _mesa_memcpy (strz
, str
, len
);
5055 state
->prog
->String
= strz
;
5057 state
->st
= _mesa_symbol_table_ctor();
5059 /* All of these limits should come from ctx.
5061 limits
.MaxInstructions
= 128;
5062 limits
.MaxAluInstructions
= 128;
5063 limits
.MaxTexInstructions
= 128;
5064 limits
.MaxTexIndirections
= 128;
5065 limits
.MaxAttribs
= 16;
5066 limits
.MaxTemps
= 128;
5067 limits
.MaxAddressRegs
= 1;
5068 limits
.MaxParameters
= 128;
5069 limits
.MaxLocalParams
= 256;
5070 limits
.MaxEnvParams
= 128;
5071 limits
.MaxNativeInstructions
= 128;
5072 limits
.MaxNativeAluInstructions
= 128;
5073 limits
.MaxNativeTexInstructions
= 128;
5074 limits
.MaxNativeTexIndirections
= 128;
5075 limits
.MaxNativeAttribs
= 16;
5076 limits
.MaxNativeTemps
= 128;
5077 limits
.MaxNativeAddressRegs
= 1;
5078 limits
.MaxNativeParameters
= 128;
5079 limits
.MaxUniformComponents
= 0;
5081 state
->limits
= & limits
;
5083 state
->MaxTextureImageUnits
= 16;
5084 state
->MaxTextureCoordUnits
= 8;
5085 state
->MaxTextureUnits
= 8;
5086 state
->MaxClipPlanes
= 6;
5087 state
->MaxLights
= 8;
5088 state
->MaxProgramMatrices
= 8;
5090 state
->state_param_enum
= (target
== GL_VERTEX_PROGRAM_ARB
)
5091 ? STATE_VERTEX_PROGRAM
: STATE_FRAGMENT_PROGRAM
;
5093 _mesa_set_program_error(ctx
, -1, NULL
);
5095 _mesa_program_lexer_ctor(& state
->scanner
, state
, (const char *) str
, len
);
5097 _mesa_program_lexer_dtor(state
->scanner
);
5100 if (ctx
->Program
.ErrorPos
!= -1) {
5104 if (! _mesa_layout_parameters(state
)) {
5108 loc
.first_column
= 0;
5111 yyerror(& loc
, state
, "invalid PARAM usage");
5117 /* Add one instruction to store the "END" instruction.
5119 state
->prog
->Instructions
=
5120 _mesa_alloc_instructions(state
->prog
->NumInstructions
+ 1);
5121 inst
= state
->inst_head
;
5122 for (i
= 0; i
< state
->prog
->NumInstructions
; i
++) {
5123 struct asm_instruction
*const temp
= inst
->next
;
5125 state
->prog
->Instructions
[i
] = inst
->Base
;
5129 /* Finally, tag on an OPCODE_END instruction */
5131 const GLuint numInst
= state
->prog
->NumInstructions
;
5132 _mesa_init_instructions(state
->prog
->Instructions
+ numInst
, 1);
5133 state
->prog
->Instructions
[numInst
].Opcode
= OPCODE_END
;
5135 state
->prog
->NumInstructions
++;
5137 state
->prog
->NumParameters
= state
->prog
->Parameters
->NumParameters
;
5138 state
->prog
->NumAttributes
= _mesa_bitcount(state
->prog
->InputsRead
);
5141 * Initialize native counts to logical counts. The device driver may
5142 * change them if program is translated into a hardware program.
5144 state
->prog
->NumNativeInstructions
= state
->prog
->NumInstructions
;
5145 state
->prog
->NumNativeTemporaries
= state
->prog
->NumTemporaries
;
5146 state
->prog
->NumNativeParameters
= state
->prog
->NumParameters
;
5147 state
->prog
->NumNativeAttributes
= state
->prog
->NumAttributes
;
5148 state
->prog
->NumNativeAddressRegs
= state
->prog
->NumAddressRegs
;
5153 for (inst
= state
->inst_head
; inst
!= NULL
; inst
= temp
) {
5158 state
->inst_head
= NULL
;
5159 state
->inst_tail
= NULL
;
5161 for (sym
= state
->sym
; sym
!= NULL
; sym
= temp
) {
5164 _mesa_free((void *) sym
->name
);
5169 _mesa_symbol_table_dtor(state
->st
);