Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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