From 03727ab0859bbb9e9c3f29e18b3cb5d6eb641f3e Mon Sep 17 00:00:00 2001 From: cholleme <> Date: Mon, 3 Feb 2003 14:18:50 +0000 Subject: [PATCH] Nv parse (used to parse register combiner state out of file) --- nvparse/_rc1.0_lexer.cpp | 2450 +++++++++++++++++++++++++++++++++++ nvparse/_rc1.0_parser.cpp | 1872 ++++++++++++++++++++++++++ nvparse/_rc1.0_parser.h | 54 + nvparse/nvparse.cpp | 77 ++ nvparse/nvparse.h | 22 + nvparse/nvparse.lib | Bin 0 -> 15679 bytes nvparse/nvparse/nvparse.dsp | 148 +++ nvparse/nvparse/nvparse.plg | 16 + nvparse/nvparse_errors.cpp | 47 + nvparse/nvparse_errors.h | 25 + nvparse/nvparse_externs.h | 9 + nvparse/rc1.0_combiners.cpp | 91 ++ nvparse/rc1.0_combiners.h | 24 + nvparse/rc1.0_final.cpp | 160 +++ nvparse/rc1.0_final.h | 48 + nvparse/rc1.0_general.cpp | 300 +++++ nvparse/rc1.0_general.h | 107 ++ nvparse/rc1.0_grammar.y | 682 ++++++++++ nvparse/rc1.0_register.h | 207 +++ nvparse/rc1.0_tokens.l | 410 ++++++ 20 files changed, 6749 insertions(+) create mode 100644 nvparse/_rc1.0_lexer.cpp create mode 100644 nvparse/_rc1.0_parser.cpp create mode 100644 nvparse/_rc1.0_parser.h create mode 100644 nvparse/nvparse.cpp create mode 100644 nvparse/nvparse.h create mode 100644 nvparse/nvparse.lib create mode 100644 nvparse/nvparse/nvparse.dsp create mode 100644 nvparse/nvparse/nvparse.plg create mode 100644 nvparse/nvparse_errors.cpp create mode 100644 nvparse/nvparse_errors.h create mode 100644 nvparse/nvparse_externs.h create mode 100644 nvparse/rc1.0_combiners.cpp create mode 100644 nvparse/rc1.0_combiners.h create mode 100644 nvparse/rc1.0_final.cpp create mode 100644 nvparse/rc1.0_final.h create mode 100644 nvparse/rc1.0_general.cpp create mode 100644 nvparse/rc1.0_general.h create mode 100644 nvparse/rc1.0_grammar.y create mode 100644 nvparse/rc1.0_register.h create mode 100644 nvparse/rc1.0_tokens.l diff --git a/nvparse/_rc1.0_lexer.cpp b/nvparse/_rc1.0_lexer.cpp new file mode 100644 index 0000000..32d5058 --- /dev/null +++ b/nvparse/_rc1.0_lexer.cpp @@ -0,0 +1,2450 @@ +#define yy_create_buffer rc10__create_buffer +#define yy_delete_buffer rc10__delete_buffer +#define yy_scan_buffer rc10__scan_buffer +#define yy_scan_string rc10__scan_string +#define yy_scan_bytes rc10__scan_bytes +#define yy_flex_debug rc10__flex_debug +#define yy_init_buffer rc10__init_buffer +#define yy_flush_buffer rc10__flush_buffer +#define yy_load_buffer_state rc10__load_buffer_state +#define yy_switch_to_buffer rc10__switch_to_buffer +#define yyin rc10_in +#define yyleng rc10_leng +#define yylex rc10_lex +#define yyout rc10_out +#define yyrestart rc10_restart +#define yytext rc10_text +#define yywrap rc10_wrap + +#line 20 "_rc1.0_lexer.cpp" +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header$ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +//#include + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 94 +#define YY_END_OF_BUFFER 95 +static yyconst short int yy_accept[309] = + { 0, + 0, 0, 95, 94, 92, 91, 94, 94, 3, 82, + 83, 87, 89, 85, 88, 86, 94, 79, 84, 90, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 80, 81, 92, 91, + 0, 0, 0, 79, 78, 1, 2, 77, 79, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 0, 77, 93, 93, 93, 93, 93, 93, 93, 93, + 8, 93, 93, 66, 56, 93, 68, 93, 93, 67, + 93, 93, 93, 0, 93, 93, 93, 12, 16, 93, + + 93, 93, 93, 93, 0, 93, 71, 0, 0, 93, + 93, 28, 32, 36, 40, 93, 52, 0, 69, 93, + 93, 0, 0, 93, 93, 93, 93, 93, 6, 7, + 0, 93, 54, 55, 0, 59, 0, 93, 93, 0, + 0, 0, 0, 93, 0, 0, 93, 93, 10, 11, + 0, 14, 15, 0, 93, 44, 48, 93, 62, 93, + 0, 93, 0, 0, 93, 20, 24, 26, 27, 0, + 30, 31, 0, 34, 35, 0, 38, 39, 0, 93, + 50, 51, 0, 4, 93, 93, 0, 0, 93, 0, + 0, 57, 93, 5, 93, 53, 58, 93, 0, 0, + + 0, 0, 0, 0, 93, 0, 93, 93, 9, 13, + 93, 42, 43, 0, 46, 47, 0, 93, 93, 93, + 18, 19, 0, 22, 23, 0, 25, 29, 33, 37, + 64, 49, 93, 93, 61, 0, 0, 93, 63, 93, + 0, 0, 93, 93, 93, 41, 45, 93, 93, 93, + 93, 17, 21, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 75, 93, 93, 93, + 60, 76, 93, 93, 93, 93, 93, 93, 93, 70, + 93, 65, 93, 93, 93, 74, 93, 93, 93, 93, + 93, 93, 93, 73, 93, 93, 93, 93, 93, 93, + + 93, 93, 93, 93, 93, 93, 72, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 1, 6, 1, 1, 1, 1, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 19, 19, 19, 19, 19, 1, 20, 1, + 21, 1, 1, 1, 22, 22, 23, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 24, 22, 22, 22, 22, 22, 22, 22, 22, + 1, 1, 1, 1, 25, 1, 26, 27, 28, 29, + + 30, 31, 32, 33, 34, 22, 22, 35, 36, 37, + 38, 39, 22, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 1, 50, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[51] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1 + } ; + +static yyconst short int yy_base[310] = + { 0, + 0, 0, 543, 544, 540, 544, 48, 536, 544, 544, + 544, 544, 40, 544, 47, 52, 63, 63, 544, 544, + 527, 48, 41, 60, 71, 61, 72, 73, 74, 75, + 76, 77, 83, 78, 79, 84, 544, 544, 537, 544, + 90, 514, 112, 119, 124, 544, 544, 129, 136, 524, + 111, 89, 99, 143, 120, 144, 145, 88, 146, 147, + 149, 87, 150, 152, 151, 158, 153, 154, 155, 157, + 513, 157, 90, 172, 173, 178, 177, 175, 185, 186, + 522, 188, 189, 521, 520, 519, 518, 191, 192, 517, + 207, 193, 195, 513, 204, 216, 197, 515, 514, 194, + + 201, 218, 202, 222, 211, 227, 513, 219, 216, 234, + 235, 512, 511, 510, 509, 236, 508, 507, 506, 240, + 237, 234, 243, 241, 260, 242, 250, 259, 544, 544, + 486, 258, 544, 544, 485, 544, 484, 264, 265, 260, + 264, 266, 268, 275, 270, 500, 285, 286, 544, 544, + 482, 544, 544, 481, 288, 499, 498, 289, 497, 292, + 482, 290, 481, 480, 294, 493, 492, 544, 544, 472, + 544, 544, 471, 544, 544, 470, 544, 544, 469, 296, + 544, 544, 468, 544, 298, 300, 472, 471, 302, 290, + 293, 484, 309, 544, 314, 544, 544, 312, 308, 310, + + 469, 465, 464, 463, 315, 461, 326, 329, 544, 544, + 330, 544, 544, 455, 544, 544, 454, 333, 328, 340, + 544, 544, 453, 544, 544, 452, 544, 544, 544, 544, + 342, 544, 338, 334, 470, 455, 454, 341, 467, 343, + 452, 451, 339, 344, 347, 544, 544, 345, 348, 362, + 349, 544, 544, 364, 365, 367, 369, 366, 370, 376, + 371, 377, 380, 382, 383, 385, 464, 390, 391, 389, + 463, 460, 393, 394, 392, 395, 403, 398, 400, 457, + 404, 245, 420, 415, 399, 208, 405, 414, 422, 425, + 428, 430, 435, 436, 409, 439, 438, 440, 442, 443, + + 444, 446, 449, 447, 450, 456, 156, 544, 119 + } ; + +static yyconst short int yy_def[310] = + { 0, + 308, 1, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 309, 308, 308, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 308, 308, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 308, 309, 309, 309, 309, 309, 309, + + 309, 309, 309, 309, 308, 309, 309, 308, 308, 309, + 309, 309, 309, 309, 309, 309, 309, 308, 309, 309, + 309, 308, 308, 309, 309, 309, 309, 309, 308, 308, + 308, 309, 308, 308, 308, 308, 308, 309, 309, 308, + 308, 308, 308, 309, 308, 308, 309, 309, 308, 308, + 308, 308, 308, 308, 309, 309, 309, 309, 309, 309, + 308, 309, 308, 308, 309, 309, 309, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 309, + 308, 308, 308, 308, 309, 309, 308, 308, 309, 308, + 308, 309, 309, 308, 309, 308, 308, 309, 308, 308, + + 308, 308, 308, 308, 309, 308, 309, 309, 308, 308, + 309, 308, 308, 308, 308, 308, 308, 309, 309, 309, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 309, 308, 309, 309, 309, 308, 308, 309, 309, 309, + 308, 308, 309, 309, 309, 308, 308, 309, 309, 309, + 309, 308, 308, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, + + 309, 309, 309, 309, 309, 309, 309, 0, 308 + } ; + +static yyconst short int yy_nxt[595] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 18, 18, 18, 18, 19, + 20, 21, 21, 21, 21, 22, 23, 24, 25, 26, + 27, 21, 28, 21, 29, 30, 21, 31, 21, 32, + 33, 34, 35, 21, 21, 21, 21, 36, 37, 38, + 40, 41, 43, 308, 44, 44, 44, 44, 44, 43, + 308, 44, 44, 44, 44, 44, 45, 45, 45, 45, + 45, 46, 308, 308, 52, 48, 47, 49, 49, 49, + 49, 49, 51, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 40, 41, 53, 308, 308, 54, 59, 308, + + 308, 308, 308, 60, 55, 57, 56, 68, 64, 58, + 65, 308, 62, 70, 74, 69, 85, 61, 63, 81, + 50, 66, 95, 308, 75, 67, 45, 45, 45, 45, + 45, 48, 308, 44, 44, 44, 44, 44, 45, 45, + 45, 45, 45, 72, 72, 72, 72, 72, 48, 73, + 49, 49, 49, 49, 49, 308, 308, 308, 308, 308, + 78, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 72, 72, 72, 72, 72, 88, 76, 87, 77, + 82, 80, 79, 89, 308, 308, 83, 308, 90, 308, + 308, 86, 98, 99, 84, 92, 93, 308, 308, 91, + + 308, 308, 102, 308, 308, 308, 308, 308, 97, 308, + 103, 104, 96, 308, 308, 100, 308, 101, 106, 308, + 308, 112, 113, 114, 115, 110, 116, 107, 308, 119, + 308, 111, 117, 124, 308, 121, 129, 130, 127, 308, + 120, 136, 125, 126, 133, 134, 308, 308, 308, 308, + 131, 132, 308, 308, 308, 137, 128, 308, 135, 149, + 150, 148, 308, 138, 139, 155, 147, 144, 152, 153, + 308, 308, 308, 151, 156, 157, 308, 308, 159, 166, + 167, 158, 154, 160, 162, 168, 169, 308, 165, 171, + 172, 174, 175, 177, 178, 181, 182, 308, 308, 170, + + 308, 308, 308, 173, 308, 176, 308, 179, 308, 183, + 308, 180, 308, 186, 308, 212, 213, 192, 215, 216, + 198, 308, 207, 195, 308, 205, 308, 308, 189, 214, + 193, 185, 217, 221, 222, 224, 225, 208, 308, 219, + 308, 308, 308, 231, 211, 308, 308, 223, 218, 226, + 308, 308, 308, 308, 308, 308, 308, 308, 220, 308, + 308, 308, 233, 234, 240, 235, 243, 244, 239, 248, + 238, 245, 254, 249, 308, 255, 308, 308, 308, 308, + 250, 308, 308, 308, 251, 258, 256, 257, 308, 308, + 262, 263, 308, 260, 308, 308, 264, 308, 259, 266, + + 261, 308, 308, 308, 308, 308, 308, 308, 265, 273, + 308, 308, 308, 267, 268, 308, 308, 308, 269, 274, + 270, 308, 272, 271, 275, 277, 308, 308, 281, 283, + 280, 276, 308, 278, 308, 279, 287, 308, 284, 282, + 308, 288, 308, 289, 285, 286, 290, 308, 308, 296, + 308, 308, 308, 292, 308, 308, 308, 291, 308, 308, + 295, 308, 308, 298, 293, 294, 297, 301, 308, 308, + 302, 300, 308, 304, 299, 308, 308, 253, 252, 308, + 247, 246, 308, 242, 241, 237, 236, 232, 305, 230, + 229, 228, 303, 307, 306, 227, 308, 210, 209, 206, + + 204, 203, 202, 201, 200, 199, 197, 196, 194, 308, + 191, 190, 188, 187, 184, 164, 163, 161, 308, 146, + 145, 143, 142, 141, 140, 308, 123, 122, 118, 308, + 308, 109, 108, 308, 105, 94, 308, 71, 39, 308, + 42, 39, 308, 3, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308 + + } ; + +static yyconst short int yy_chk[595] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 7, 7, 13, 23, 13, 13, 13, 13, 13, 15, + 22, 15, 15, 15, 15, 15, 16, 16, 16, 16, + 16, 17, 24, 26, 23, 18, 17, 18, 18, 18, + 18, 18, 22, 25, 27, 28, 29, 30, 31, 32, + 34, 35, 41, 41, 24, 33, 36, 24, 28, 62, + + 58, 52, 73, 29, 25, 27, 26, 34, 32, 27, + 33, 53, 31, 36, 52, 35, 62, 30, 31, 58, + 309, 33, 73, 51, 53, 33, 43, 43, 43, 43, + 43, 44, 55, 44, 44, 44, 44, 44, 45, 45, + 45, 45, 45, 48, 48, 48, 48, 48, 49, 51, + 49, 49, 49, 49, 49, 54, 56, 57, 59, 60, + 55, 61, 63, 65, 64, 67, 68, 69, 307, 70, + 66, 72, 72, 72, 72, 72, 65, 54, 64, 54, + 59, 57, 56, 66, 74, 75, 60, 78, 67, 77, + 76, 63, 76, 76, 61, 69, 70, 79, 80, 68, + + 82, 83, 78, 88, 89, 92, 100, 93, 75, 97, + 79, 80, 74, 101, 103, 76, 95, 77, 82, 91, + 286, 91, 91, 91, 91, 88, 92, 83, 96, 95, + 102, 89, 93, 100, 104, 97, 105, 105, 103, 106, + 96, 109, 101, 102, 108, 108, 110, 111, 116, 121, + 105, 106, 120, 124, 126, 109, 104, 282, 108, 122, + 122, 121, 127, 110, 111, 124, 120, 116, 123, 123, + 132, 128, 125, 122, 125, 125, 138, 139, 127, 139, + 139, 126, 123, 128, 132, 140, 140, 144, 138, 141, + 141, 142, 142, 143, 143, 145, 145, 147, 148, 140, + + 155, 158, 162, 141, 160, 142, 165, 143, 180, 145, + 185, 144, 186, 148, 189, 190, 190, 158, 191, 191, + 165, 193, 185, 162, 198, 180, 195, 205, 155, 190, + 160, 147, 191, 199, 199, 200, 200, 186, 207, 195, + 219, 208, 211, 205, 189, 218, 234, 199, 193, 200, + 233, 243, 220, 238, 231, 240, 244, 248, 198, 245, + 249, 251, 207, 208, 220, 211, 231, 233, 219, 238, + 218, 234, 243, 240, 250, 244, 254, 255, 258, 256, + 240, 257, 259, 261, 240, 249, 245, 248, 260, 262, + 255, 256, 263, 251, 264, 265, 257, 266, 250, 259, + + 254, 270, 268, 269, 275, 273, 274, 276, 258, 266, + 278, 285, 279, 260, 261, 277, 281, 287, 262, 268, + 263, 295, 265, 264, 269, 273, 288, 284, 277, 279, + 276, 270, 283, 274, 289, 275, 285, 290, 281, 278, + 291, 287, 292, 288, 283, 284, 289, 293, 294, 295, + 297, 296, 298, 291, 299, 300, 301, 290, 302, 304, + 294, 303, 305, 297, 292, 293, 296, 300, 306, 280, + 301, 299, 272, 303, 298, 271, 267, 242, 241, 239, + 237, 236, 235, 226, 223, 217, 214, 206, 304, 204, + 203, 202, 302, 306, 305, 201, 192, 188, 187, 183, + + 179, 176, 173, 170, 167, 166, 164, 163, 161, 159, + 157, 156, 154, 151, 146, 137, 135, 131, 119, 118, + 117, 115, 114, 113, 112, 107, 99, 98, 94, 90, + 87, 86, 85, 84, 81, 71, 50, 42, 39, 21, + 8, 5, 3, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +char *yytext; +#line 1 "rc1.0_tokens.l" +#define INITIAL 0 +/* definitions */ +#line 7 "rc1.0_tokens.l" + +#include +#include +#include "rc1.0_combiners.h" +#include "_rc1.0_parser.h" + +#ifdef _WIN32 +# include +#endif + +#include +#include "../glNV.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + +#define YY_INPUT(buf,result,max_size) \ +{ \ + result = 0; \ + while (*myin && result < max_size) \ + buf[result++] = *myin++; \ +} + +#define YY_ALWAYS_INTERACTIVE 1 + +/* end of definitions */ +#line 640 "_rc1.0_lexer.cpp" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 33 "rc1.0_tokens.l" + + +#line 790 "_rc1.0_lexer.cpp" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 309 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 544 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 35 "rc1.0_tokens.l" +{ + A: + switch (yyinput()) { + case '*': goto B; + case 0: errors.set("end-of-file in comment", line_number); break; + case '\n': line_number++; + default: goto A; + } + B: + switch (yyinput()) { + case '*': goto B; + case '/': break; + case 0: errors.set("end-of-file in comment", line_number); break; + case '\n': line_number++; + default: goto A; + } + } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 53 "rc1.0_tokens.l" +{ + char ch; + while ((ch = yyinput()) != '\n'); + if (ch == '\n') line_number++; + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 59 "rc1.0_tokens.l" +{ + char ch; + while ((ch = yyinput()) != '\n'); + if (ch == '\n') line_number++; + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 65 "rc1.0_tokens.l" +{ /* eat header */ } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 67 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_FOG_RGB; + return(regVariable); + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 71 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_FOG_ALPHA; + return(regVariable); + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 75 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_FOG_BLUE; + return(regVariable); + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 79 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_FOG; + return(regVariable); + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 84 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR_RGB; + return(regVariable); + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 88 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR_ALPHA; + return(regVariable); + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 92 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR_BLUE; + return(regVariable); + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 96 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR; + return(regVariable); + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 101 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR_RGB; + return(regVariable); + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 105 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR_ALPHA; + return(regVariable); + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 109 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR_BLUE; + return(regVariable); + } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 113 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR; + return(regVariable); + } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 118 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE0_RGB; + return(regVariable); + } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 122 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE0_ALPHA; + return(regVariable); + } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 126 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE0_BLUE; + return(regVariable); + } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 130 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE0; + return(regVariable); + } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 135 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE1_RGB; + return(regVariable); + } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 139 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE1_ALPHA; + return(regVariable); + } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 143 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE1_BLUE; + return(regVariable); + } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 147 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_SPARE1; + return(regVariable); + } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 152 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE0_RGB; + return(regVariable); + } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 156 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE0_ALPHA; + return(regVariable); + } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 160 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE0_BLUE; + return(regVariable); + } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 164 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE0; + return(regVariable); + } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 169 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE1_RGB; + return(regVariable); + } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 173 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE1_ALPHA; + return(regVariable); + } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 177 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE1_BLUE; + return(regVariable); + } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 181 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE1; + return(regVariable); + } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 186 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE2_RGB; + return(regVariable); + } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 190 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE2_ALPHA; + return(regVariable); + } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 194 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE2_BLUE; + return(regVariable); + } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 198 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE2; + return(regVariable); + } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 203 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE3_RGB; + return(regVariable); + } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 207 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE3_ALPHA; + return(regVariable); + } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 211 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE3_BLUE; + return(regVariable); + } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 215 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_TEXTURE3; + return(regVariable); + } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 220 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR0_RGB; + return(regVariable); + } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 224 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR0_ALPHA; + return(regVariable); + } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 228 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR0_BLUE; + return(regVariable); + } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 232 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR0; + return(constVariable); + } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 237 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR1_RGB; + return(regVariable); + } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 241 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR1_ALPHA; + return(regVariable); + } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 245 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR1_BLUE; + return(regVariable); + } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 249 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_CONST_COLOR1; + return(constVariable); + } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 254 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ZERO_RGB; + return(regVariable); + } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 258 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ZERO_ALPHA; + return(regVariable); + } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 262 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ZERO_BLUE; + return(regVariable); + } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 266 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ZERO; + return(regVariable); + } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 271 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ONE_RGB; + return(regVariable); + } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 275 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ONE_ALPHA; + return(regVariable); + } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 279 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ONE_BLUE; + return(regVariable); + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 283 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_ONE; + return(regVariable); + } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 288 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_DISCARD; + return(regVariable); + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 293 "rc1.0_tokens.l" +return(fragment_rgb); + YY_BREAK +case 59: +YY_RULE_SETUP +#line 294 "rc1.0_tokens.l" +return(fragment_alpha); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 296 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_FINAL_PRODUCT; + return(final_product); + } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 301 "rc1.0_tokens.l" +{ + rc10_lval.registerEnum.word = RCP_COLOR_SUM; + return(color_sum); + } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 306 "rc1.0_tokens.l" +return(expandString); + YY_BREAK +case 63: +YY_RULE_SETUP +#line 307 "rc1.0_tokens.l" +return(halfBiasString); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 308 "rc1.0_tokens.l" +return(unsignedString); + YY_BREAK +case 65: +YY_RULE_SETUP +#line 309 "rc1.0_tokens.l" +return(unsignedInvertString); + YY_BREAK +case 66: +YY_RULE_SETUP +#line 310 "rc1.0_tokens.l" +{ + rc10_lval.ival = GL_TRUE; + return(muxString); + } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 315 "rc1.0_tokens.l" +{ + rc10_lval.ival = GL_FALSE; + return(sumString); + } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 320 "rc1.0_tokens.l" +{ + rc10_lval.ival = RCP_RGB; + return(rgb_portion); + } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 324 "rc1.0_tokens.l" +{ + rc10_lval.ival = RCP_ALPHA; + return(alpha_portion); + } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 329 "rc1.0_tokens.l" +{ + rc10_lval.ival = true; + return(clamp_color_sum); + } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 333 "rc1.0_tokens.l" +return(lerp); + YY_BREAK +case 72: +YY_RULE_SETUP +#line 336 "rc1.0_tokens.l" +{ + rc10_lval.biasScaleEnum.word = RCP_BIAS_BY_NEGATIVE_ONE_HALF_SCALE_BY_TWO; + return(bias_by_negative_one_half_scale_by_two); + } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 340 "rc1.0_tokens.l" +{ + rc10_lval.biasScaleEnum.word = RCP_BIAS_BY_NEGATIVE_ONE_HALF; + return(bias_by_negative_one_half); + } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 344 "rc1.0_tokens.l" +{ + rc10_lval.biasScaleEnum.word = RCP_SCALE_BY_ONE_HALF; + return(scale_by_one_half); + } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 348 "rc1.0_tokens.l" +{ + rc10_lval.biasScaleEnum.word = RCP_SCALE_BY_TWO; + return(scale_by_two); + } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 352 "rc1.0_tokens.l" +{ + rc10_lval.biasScaleEnum.word = RCP_SCALE_BY_FOUR; + return(scale_by_four); + } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 357 "rc1.0_tokens.l" +{ + rc10_lval.fval = (float)atof(yytext); + return(floatValue); + } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 362 "rc1.0_tokens.l" +{ + rc10_lval.fval = (float)atof(yytext); + return(floatValue); + } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 367 "rc1.0_tokens.l" +{ + rc10_lval.fval = (float)atof(yytext); + return(floatValue); + } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 372 "rc1.0_tokens.l" +return(openBracket); + YY_BREAK +case 81: +YY_RULE_SETUP +#line 373 "rc1.0_tokens.l" +return(closeBracket); + YY_BREAK +case 82: +YY_RULE_SETUP +#line 374 "rc1.0_tokens.l" +return(openParen); + YY_BREAK +case 83: +YY_RULE_SETUP +#line 375 "rc1.0_tokens.l" +return(closeParen); + YY_BREAK +case 84: +YY_RULE_SETUP +#line 376 "rc1.0_tokens.l" +return(semicolon); + YY_BREAK +case 85: +YY_RULE_SETUP +#line 377 "rc1.0_tokens.l" +return(comma); + YY_BREAK +case 86: +YY_RULE_SETUP +#line 378 "rc1.0_tokens.l" +return(dot); + YY_BREAK +case 87: +YY_RULE_SETUP +#line 379 "rc1.0_tokens.l" +return(times); + YY_BREAK +case 88: +YY_RULE_SETUP +#line 380 "rc1.0_tokens.l" +return(minus); + YY_BREAK +case 89: +YY_RULE_SETUP +#line 381 "rc1.0_tokens.l" +return(plus); + YY_BREAK +case 90: +YY_RULE_SETUP +#line 382 "rc1.0_tokens.l" +return(equals); + YY_BREAK +case 91: +YY_RULE_SETUP +#line 384 "rc1.0_tokens.l" +{ + line_number++; + } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 388 "rc1.0_tokens.l" +{} + YY_BREAK +case 93: +YY_RULE_SETUP +#line 390 "rc1.0_tokens.l" +{ + errors.set("unrecognized token", line_number); + } + YY_BREAK +case 94: +YY_RULE_SETUP +#line 395 "rc1.0_tokens.l" +ECHO; + YY_BREAK +#line 1575 "_rc1.0_lexer.cpp" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 309 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 309 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 308); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +yyconst char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 395 "rc1.0_tokens.l" + + +bool rc10_init_more(); + +bool rc10_init(char* inputString) +{ + myin = inputString; + return rc10_init_more(); +} + +#ifndef rc10_wrap +int rc10_wrap(void) +{ + return(1); +} +#endif diff --git a/nvparse/_rc1.0_parser.cpp b/nvparse/_rc1.0_parser.cpp new file mode 100644 index 0000000..cf287e4 --- /dev/null +++ b/nvparse/_rc1.0_parser.cpp @@ -0,0 +1,1872 @@ + +/* A Bison parser, made from rc1.0_grammar.y + by GNU Bison v1.28 for Win32 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define yyparse rc10_parse +#define yylex rc10_lex +#define yyerror rc10_error +#define yylval rc10_lval +#define yychar rc10_char +#define yydebug rc10_debug +#define yynerrs rc10_nerrs +#define regVariable 257 +#define constVariable 258 +#define color_sum 259 +#define final_product 260 +#define expandString 261 +#define halfBiasString 262 +#define unsignedString 263 +#define unsignedInvertString 264 +#define muxString 265 +#define sumString 266 +#define rgb_portion 267 +#define alpha_portion 268 +#define openParen 269 +#define closeParen 270 +#define openBracket 271 +#define closeBracket 272 +#define semicolon 273 +#define comma 274 +#define dot 275 +#define times 276 +#define minus 277 +#define equals 278 +#define plus 279 +#define bias_by_negative_one_half_scale_by_two 280 +#define bias_by_negative_one_half 281 +#define scale_by_one_half 282 +#define scale_by_two 283 +#define scale_by_four 284 +#define clamp_color_sum 285 +#define lerp 286 +#define fragment_rgb 287 +#define fragment_alpha 288 +#define floatValue 289 + +#line 2 "rc1.0_grammar.y" + +void yyerror(char* s); +int yylex ( void ); + +#ifdef _WIN32 +# include +#endif + +#include +#include + +#include "rc1.0_combiners.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + + + +#line 19 "rc1.0_grammar.y" +typedef union { + int ival; + float fval; + RegisterEnum registerEnum; + BiasScaleEnum biasScaleEnum; + MappedRegisterStruct mappedRegisterStruct; + ConstColorStruct constColorStruct; + GeneralPortionStruct generalPortionStruct; + GeneralFunctionStruct generalFunctionStruct; + OpStruct opStruct; + GeneralCombinerStruct generalCombinerStruct; + GeneralCombinersStruct generalCombinersStruct; + FinalProductStruct finalProductStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + FinalCombinerStruct finalCombinerStruct; + CombinersStruct combinersStruct; +} YYSTYPE; +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 220 +#define YYFLAG -32768 +#define YYNTBASE 36 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 57) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 6, 11, 14, 17, 21, 23, 36, 39, + 41, 46, 52, 59, 63, 68, 74, 80, 85, 87, + 89, 91, 94, 99, 105, 110, 116, 121, 126, 129, + 132, 135, 137, 140, 144, 148, 150, 157, 164, 169, + 176, 183, 188, 193, 198, 203, 208, 210, 215, 220, + 222, 227, 232, 234, 239, 244, 247, 251, 255, 260, + 265, 268, 272, 276, 281, 286, 288, 291, 294, 298, + 302, 304, 307, 310, 314, 318, 323, 330, 344, 358, + 370, 377, 386, 391, 398, 403, 405 +}; + +static const short yyrhs[] = { 37, + 0, 38, 39, 51, 0, 38, 38, 39, 51, 0, + 39, 51, 0, 38, 51, 0, 38, 38, 51, 0, + 51, 0, 4, 24, 15, 35, 20, 35, 20, 35, + 20, 35, 16, 19, 0, 39, 40, 0, 40, 0, + 17, 41, 41, 18, 0, 17, 38, 41, 41, 18, + 0, 17, 38, 38, 41, 41, 18, 0, 17, 41, + 18, 0, 17, 38, 41, 18, 0, 17, 38, 38, + 41, 18, 0, 42, 17, 44, 49, 18, 0, 42, + 17, 44, 18, 0, 13, 0, 14, 0, 56, 0, + 23, 56, 0, 7, 15, 56, 16, 0, 23, 7, + 15, 56, 16, 0, 8, 15, 56, 16, 0, 23, + 8, 15, 56, 16, 0, 9, 15, 56, 16, 0, + 10, 15, 56, 16, 0, 45, 45, 0, 45, 46, + 0, 46, 45, 0, 45, 0, 46, 46, 0, 46, + 46, 47, 0, 46, 46, 48, 0, 46, 0, 56, + 24, 43, 21, 43, 19, 0, 56, 24, 43, 22, + 43, 19, 0, 56, 24, 43, 19, 0, 56, 24, + 11, 15, 16, 19, 0, 56, 24, 12, 15, 16, + 19, 0, 26, 15, 16, 19, 0, 27, 15, 16, + 19, 0, 28, 15, 16, 19, 0, 29, 15, 16, + 19, 0, 30, 15, 16, 19, 0, 56, 0, 9, + 15, 56, 16, 0, 10, 15, 56, 16, 0, 5, + 0, 9, 15, 5, 16, 0, 10, 15, 5, 16, + 0, 6, 0, 9, 15, 6, 16, 0, 10, 15, + 6, 16, 0, 55, 54, 0, 52, 55, 54, 0, + 53, 55, 54, 0, 52, 53, 55, 54, 0, 53, + 52, 55, 54, 0, 54, 55, 0, 52, 54, 55, + 0, 53, 54, 55, 0, 52, 53, 54, 55, 0, + 53, 52, 54, 55, 0, 54, 0, 52, 54, 0, + 53, 54, 0, 52, 53, 54, 0, 53, 52, 54, + 0, 55, 0, 52, 55, 0, 53, 55, 0, 52, + 53, 55, 0, 53, 52, 55, 0, 31, 15, 16, + 19, 0, 6, 24, 50, 22, 50, 19, 0, 33, + 24, 32, 15, 50, 20, 50, 20, 50, 16, 25, + 50, 19, 0, 33, 24, 50, 25, 32, 15, 50, + 20, 50, 20, 50, 16, 19, 0, 33, 24, 32, + 15, 50, 20, 50, 20, 50, 16, 19, 0, 33, + 24, 50, 22, 50, 19, 0, 33, 24, 50, 22, + 50, 25, 50, 19, 0, 33, 24, 50, 19, 0, + 33, 24, 50, 25, 50, 19, 0, 34, 24, 50, + 19, 0, 4, 0, 3, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 72, 79, 85, 91, 97, 105, 113, 123, 132, 137, + 145, 151, 157, 163, 169, 175, 183, 189, 199, 203, + 209, 215, 221, 227, 233, 239, 245, 251, 259, 265, + 271, 277, 283, 289, 295, 301, 309, 317, 323, 335, + 343, 351, 355, 359, 363, 367, 373, 379, 385, 391, + 397, 403, 409, 415, 421, 429, 435, 441, 447, 453, + 460, 466, 472, 478, 484, 491, 499, 507, 515, 523, + 532, 540, 548, 556, 564, 574, 580, 588, 594, 600, + 610, 622, 632, 646, 660, 668, 672 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","regVariable", +"constVariable","color_sum","final_product","expandString","halfBiasString", +"unsignedString","unsignedInvertString","muxString","sumString","rgb_portion", +"alpha_portion","openParen","closeParen","openBracket","closeBracket","semicolon", +"comma","dot","times","minus","equals","plus","bias_by_negative_one_half_scale_by_two", +"bias_by_negative_one_half","scale_by_one_half","scale_by_two","scale_by_four", +"clamp_color_sum","lerp","fragment_rgb","fragment_alpha","floatValue","WholeEnchilada", +"Combiners","ConstColor","GeneralCombiners","GeneralCombiner","GeneralPortion", +"PortionDesignator","GeneralMappedRegister","GeneralFunction","Dot","Mul","Mux", +"Sum","BiasScale","FinalMappedRegister","FinalCombiner","ClampColorSum","FinalProduct", +"FinalRgbFunction","FinalAlphaFunction","Register", NULL +}; +#endif + +static const short yyr1[] = { 0, + 36, 37, 37, 37, 37, 37, 37, 38, 39, 39, + 40, 40, 40, 40, 40, 40, 41, 41, 42, 42, + 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, + 44, 44, 44, 44, 44, 44, 45, 46, 46, 47, + 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 52, 53, 54, 54, 54, + 54, 54, 54, 54, 55, 56, 56 +}; + +static const short yyr2[] = { 0, + 1, 3, 4, 2, 2, 3, 1, 12, 2, 1, + 4, 5, 6, 3, 4, 5, 5, 4, 1, 1, + 1, 2, 4, 5, 4, 5, 4, 4, 2, 2, + 2, 1, 2, 3, 3, 1, 6, 6, 4, 6, + 6, 4, 4, 4, 4, 4, 1, 4, 4, 1, + 4, 4, 1, 4, 4, 2, 3, 3, 4, 4, + 2, 3, 3, 4, 4, 1, 2, 2, 3, 3, + 1, 2, 2, 3, 3, 4, 6, 13, 13, 11, + 6, 8, 4, 6, 4, 1, 1 +}; + +static const short yydefact[] = { 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 10, + 7, 0, 0, 66, 71, 0, 0, 19, 20, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 9, 4, + 0, 67, 72, 0, 68, 73, 61, 56, 0, 87, + 86, 50, 53, 0, 0, 0, 47, 0, 0, 14, + 0, 0, 0, 0, 0, 0, 0, 6, 2, 69, + 74, 62, 57, 70, 75, 63, 58, 0, 0, 0, + 0, 0, 15, 0, 11, 0, 32, 36, 0, 76, + 0, 83, 0, 0, 85, 3, 64, 59, 65, 60, + 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, + 12, 18, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 33, 0, 0, 0, 0, 0, 0, 51, 54, + 48, 52, 55, 49, 77, 13, 0, 0, 0, 0, + 0, 17, 34, 35, 0, 0, 0, 0, 0, 0, + 0, 21, 0, 81, 0, 0, 84, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 22, 39, 0, 0, 0, 0, 0, 0, 42, 43, + 44, 45, 46, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 82, 0, 0, 0, 0, 23, + 25, 27, 28, 0, 0, 37, 38, 0, 0, 0, + 0, 0, 24, 26, 0, 0, 0, 40, 41, 80, + 0, 0, 8, 0, 0, 78, 79, 0, 0, 0 +}; + +static const short yydefgoto[] = { 218, + 7, 8, 9, 10, 21, 22, 141, 76, 77, 78, + 133, 134, 108, 46, 11, 12, 13, 14, 15, 47 +}; + +static const short yypact[] = { 4, + -17, -15, 26, 17, -6, 19,-32768, 4, 68,-32768, +-32768, 8, 113, 57, 67, 58, 133,-32768,-32768, 26, + 98, 93, 104, 66, 133, 68, 68,-32768,-32768,-32768, + 44, 57, 67, 44, 57, 67,-32768,-32768, 118,-32768, +-32768,-32768,-32768, 144, 146, 153,-32768, 81, 127,-32768, + 150, 100, 157, 162, 31, 159, 68,-32768,-32768, 57, + 67,-32768,-32768, 57, 67,-32768,-32768, 161, 152, 160, + 133, 136,-32768, 165,-32768, 97, 100, 100, 155,-32768, + 133,-32768, 133, 77,-32768,-32768,-32768,-32768,-32768,-32768, + 145, 168, 169, 170, 172, 173, 174, 175,-32768, 177, +-32768,-32768, 176, 178, 181, 182, 183, 184,-32768,-32768, +-32768, 100, 125, 179, 27, 185, 186, 187,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 188, 190, 192, 193, + 194,-32768,-32768,-32768, 189, 196, 197, 199, 200, 85, + 148,-32768, 133,-32768, 133, 133,-32768, 166, 198, 201, + 202, 203, 204, 106, 100, 100, 100, 100, 209, 210, +-32768,-32768, 125, 125, 206, 208, 211, 212,-32768,-32768, +-32768,-32768,-32768, 213, 214, 217, 218, 219, 220, 100, + 100, 221, 222, 133,-32768, 133, 195, 223, 226,-32768, +-32768,-32768,-32768, 227, 228,-32768,-32768, 229, 230, 231, + 232, 233,-32768,-32768, 39, 133, 234,-32768,-32768,-32768, + 133, 238,-32768, 236, 237,-32768,-32768, 216, 246,-32768 +}; + +static const short yypgoto[] = {-32768, +-32768, 76, 3, -3, -4,-32768, -12,-32768, 94, 96, +-32768,-32768,-32768, -24, 40, 205, 180, 0, -9, -50 +}; + + +#define YYLAST 256 + + +static const short yytable[] = { 55, + 56, 79, 33, 36, 37, 29, 16, 1, 17, 2, + 27, 32, 35, 2, 38, 49, 51, 24, 94, 97, + 3, 61, 62, 29, 65, 66, 79, 79, 57, 1, + 60, 23, 63, 64, 4, 67, 5, 6, 18, 19, + 5, 6, 25, 72, 74, 144, 98, 28, 30, 82, + 87, 145, 83, 29, 89, 84, 114, 210, 115, 117, + 88, 135, 142, 211, 90, 58, 59, 100, 40, 41, + 42, 43, 39, 2, 44, 45, 5, 6, 20, 40, + 41, 42, 43, 26, 3, 44, 45, 40, 41, 161, + 6, 159, 160, 18, 19, 48, 86, 54, 4, 5, + 5, 6, 40, 41, 176, 177, 178, 179, 116, 52, + 18, 19, 142, 142, 102, 50, 174, 175, 165, 53, + 166, 167, 103, 104, 105, 106, 107, 40, 41, 194, + 195, 136, 137, 138, 139, 40, 41, 42, 43, 18, + 19, 44, 45, 4, 73, 5, 6, 140, 18, 19, + 182, 183, 68, 99, 40, 41, 92, 93, 69, 198, + 70, 199, 40, 41, 95, 96, 162, 75, 163, 164, + 109, 111, 110, 112, 71, 80, 81, 85, 113, 118, + 91, 212, 101, 119, 120, 121, 214, 122, 123, 124, + 127, 31, 128, 125, 126, 129, 130, 131, 143, 146, + 168, 132, 0, 149, 147, 150, 148, 151, 152, 153, + 155, 156, 154, 157, 158, 219, 169, 34, 0, 170, + 171, 172, 173, 180, 181, 184, 185, 188, 189, 200, + 186, 187, 190, 191, 192, 193, 0, 0, 201, 196, + 197, 202, 203, 204, 205, 220, 207, 0, 0, 206, + 208, 209, 213, 215, 216, 217 +}; + +static const short yycheck[] = { 24, + 25, 52, 12, 13, 14, 9, 24, 4, 24, 6, + 8, 12, 13, 6, 15, 20, 21, 24, 69, 70, + 17, 31, 32, 27, 34, 35, 77, 78, 26, 4, + 31, 15, 33, 34, 31, 36, 33, 34, 13, 14, + 33, 34, 24, 48, 49, 19, 71, 8, 9, 19, + 60, 25, 22, 57, 64, 25, 81, 19, 83, 84, + 61, 112, 113, 25, 65, 26, 27, 72, 3, 4, + 5, 6, 15, 6, 9, 10, 33, 34, 3, 3, + 4, 5, 6, 8, 17, 9, 10, 3, 4, 140, + 34, 7, 8, 13, 14, 20, 57, 32, 31, 33, + 33, 34, 3, 4, 155, 156, 157, 158, 32, 17, + 13, 14, 163, 164, 18, 18, 11, 12, 143, 16, + 145, 146, 26, 27, 28, 29, 30, 3, 4, 180, + 181, 7, 8, 9, 10, 3, 4, 5, 6, 13, + 14, 9, 10, 31, 18, 33, 34, 23, 13, 14, + 163, 164, 35, 18, 3, 4, 5, 6, 15, 184, + 15, 186, 3, 4, 5, 6, 19, 18, 21, 22, + 77, 78, 77, 78, 22, 19, 15, 19, 24, 35, + 20, 206, 18, 16, 16, 16, 211, 16, 16, 16, + 15, 12, 15, 19, 18, 15, 15, 15, 20, 15, + 35, 18, -1, 16, 19, 16, 20, 16, 16, 16, + 15, 15, 24, 15, 15, 0, 19, 13, -1, 19, + 19, 19, 19, 15, 15, 20, 19, 15, 15, 35, + 20, 20, 16, 16, 16, 16, -1, -1, 16, 19, + 19, 16, 16, 16, 16, 0, 16, -1, -1, 20, + 19, 19, 19, 16, 19, 19 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "bison.simple" +/* This file comes from bison-@bison_version@. */ + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 217 "bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +#line 73 "rc1.0_grammar.y" +{ + yyvsp[0].combinersStruct.Validate(); + yyvsp[0].combinersStruct.Invoke(); + ; + break;} +case 2: +#line 80 "rc1.0_grammar.y" +{ + CombinersStruct combinersStruct; + combinersStruct.Init(yyvsp[-1].generalCombinersStruct, yyvsp[0].finalCombinerStruct, yyvsp[-2].constColorStruct); + yyval.combinersStruct = combinersStruct; + ; + break;} +case 3: +#line 86 "rc1.0_grammar.y" +{ + CombinersStruct combinersStruct; + combinersStruct.Init(yyvsp[-1].generalCombinersStruct, yyvsp[0].finalCombinerStruct, yyvsp[-3].constColorStruct, yyvsp[-2].constColorStruct); + yyval.combinersStruct = combinersStruct; + ; + break;} +case 4: +#line 92 "rc1.0_grammar.y" +{ + CombinersStruct combinersStruct; + combinersStruct.Init(yyvsp[-1].generalCombinersStruct, yyvsp[0].finalCombinerStruct); + yyval.combinersStruct = combinersStruct; + ; + break;} +case 5: +#line 98 "rc1.0_grammar.y" +{ + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(); + CombinersStruct combinersStruct; + combinersStruct.Init(generalCombinersStruct, yyvsp[0].finalCombinerStruct, yyvsp[-1].constColorStruct); + yyval.combinersStruct = combinersStruct; + ; + break;} +case 6: +#line 106 "rc1.0_grammar.y" +{ + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(); + CombinersStruct combinersStruct; + combinersStruct.Init(generalCombinersStruct, yyvsp[0].finalCombinerStruct, yyvsp[-2].constColorStruct, yyvsp[-1].constColorStruct); + yyval.combinersStruct = combinersStruct; + ; + break;} +case 7: +#line 114 "rc1.0_grammar.y" +{ + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(); + CombinersStruct combinersStruct; + combinersStruct.Init(generalCombinersStruct, yyvsp[0].finalCombinerStruct); + yyval.combinersStruct = combinersStruct; + ; + break;} +case 8: +#line 124 "rc1.0_grammar.y" +{ + ConstColorStruct constColorStruct; + constColorStruct.Init(yyvsp[-11].registerEnum, yyvsp[-8].fval, yyvsp[-6].fval, yyvsp[-4].fval, yyvsp[-2].fval); + yyval.constColorStruct = constColorStruct; + ; + break;} +case 9: +#line 133 "rc1.0_grammar.y" +{ + yyvsp[-1].generalCombinersStruct += yyvsp[0].generalCombinerStruct; + yyval.generalCombinersStruct = yyvsp[-1].generalCombinersStruct; + ; + break;} +case 10: +#line 138 "rc1.0_grammar.y" +{ + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(yyvsp[0].generalCombinerStruct); + yyval.generalCombinersStruct = generalCombinersStruct; + ; + break;} +case 11: +#line 146 "rc1.0_grammar.y" +{ + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init(yyvsp[-2].generalPortionStruct, yyvsp[-1].generalPortionStruct); + yyval.generalCombinerStruct = generalCombinerStruct; + ; + break;} +case 12: +#line 152 "rc1.0_grammar.y" +{ + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init(yyvsp[-2].generalPortionStruct, yyvsp[-1].generalPortionStruct, yyvsp[-3].constColorStruct); + yyval.generalCombinerStruct = generalCombinerStruct; + ; + break;} +case 13: +#line 158 "rc1.0_grammar.y" +{ + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init(yyvsp[-2].generalPortionStruct, yyvsp[-1].generalPortionStruct, yyvsp[-4].constColorStruct, yyvsp[-3].constColorStruct); + yyval.generalCombinerStruct = generalCombinerStruct; + ; + break;} +case 14: +#line 164 "rc1.0_grammar.y" +{ + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init(yyvsp[-1].generalPortionStruct); + yyval.generalCombinerStruct = generalCombinerStruct; + ; + break;} +case 15: +#line 170 "rc1.0_grammar.y" +{ + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init(yyvsp[-1].generalPortionStruct, yyvsp[-2].constColorStruct); + yyval.generalCombinerStruct = generalCombinerStruct; + ; + break;} +case 16: +#line 176 "rc1.0_grammar.y" +{ + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init(yyvsp[-1].generalPortionStruct, yyvsp[-3].constColorStruct, yyvsp[-2].constColorStruct); + yyval.generalCombinerStruct = generalCombinerStruct; + ; + break;} +case 17: +#line 184 "rc1.0_grammar.y" +{ + GeneralPortionStruct generalPortionStruct; + generalPortionStruct.Init(yyvsp[-4].ival, yyvsp[-2].generalFunctionStruct, yyvsp[-1].biasScaleEnum); + yyval.generalPortionStruct = generalPortionStruct; + ; + break;} +case 18: +#line 190 "rc1.0_grammar.y" +{ + BiasScaleEnum noScale; + noScale.word = RCP_SCALE_BY_ONE; + GeneralPortionStruct generalPortionStruct; + generalPortionStruct.Init(yyvsp[-3].ival, yyvsp[-1].generalFunctionStruct, noScale); + yyval.generalPortionStruct = generalPortionStruct; + ; + break;} +case 19: +#line 200 "rc1.0_grammar.y" +{ + yyval.ival = yyvsp[0].ival; + ; + break;} +case 20: +#line 204 "rc1.0_grammar.y" +{ + yyval.ival = yyvsp[0].ival; + ; + break;} +case 21: +#line 210 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[0].registerEnum, GL_SIGNED_IDENTITY_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 22: +#line 216 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[0].registerEnum, GL_SIGNED_NEGATE_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 23: +#line 222 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_EXPAND_NORMAL_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 24: +#line 228 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_EXPAND_NEGATE_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 25: +#line 234 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_HALF_BIAS_NORMAL_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 26: +#line 240 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_HALF_BIAS_NEGATE_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 27: +#line 246 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_IDENTITY_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 28: +#line 252 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_INVERT_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 29: +#line 260 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[-1].opStruct, yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 30: +#line 266 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[-1].opStruct, yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 31: +#line 272 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[-1].opStruct, yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 32: +#line 278 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 33: +#line 284 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[-1].opStruct, yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 34: +#line 290 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[-2].opStruct, yyvsp[-1].opStruct, yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 35: +#line 296 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[-2].opStruct, yyvsp[-1].opStruct, yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 36: +#line 302 "rc1.0_grammar.y" +{ + GeneralFunctionStruct generalFunction; + generalFunction.Init(yyvsp[0].opStruct); + yyval.generalFunctionStruct = generalFunction; + ; + break;} +case 37: +#line 310 "rc1.0_grammar.y" +{ + OpStruct dotFunction; + dotFunction.Init(RCP_DOT, yyvsp[-5].registerEnum, yyvsp[-3].mappedRegisterStruct, yyvsp[-1].mappedRegisterStruct); + yyval.opStruct = dotFunction; + ; + break;} +case 38: +#line 318 "rc1.0_grammar.y" +{ + OpStruct mulFunction; + mulFunction.Init(RCP_MUL, yyvsp[-5].registerEnum, yyvsp[-3].mappedRegisterStruct, yyvsp[-1].mappedRegisterStruct); + yyval.opStruct = mulFunction; + ; + break;} +case 39: +#line 324 "rc1.0_grammar.y" +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct one; + one.Init(zero, GL_UNSIGNED_INVERT_NV); + OpStruct mulFunction; + mulFunction.Init(RCP_MUL, yyvsp[-3].registerEnum, yyvsp[-1].mappedRegisterStruct, one); + yyval.opStruct = mulFunction; + ; + break;} +case 40: +#line 336 "rc1.0_grammar.y" +{ + OpStruct muxFunction; + muxFunction.Init(RCP_MUX, yyvsp[-5].registerEnum); + yyval.opStruct = muxFunction; + ; + break;} +case 41: +#line 344 "rc1.0_grammar.y" +{ + OpStruct sumFunction; + sumFunction.Init(RCP_SUM, yyvsp[-5].registerEnum); + yyval.opStruct = sumFunction; + ; + break;} +case 42: +#line 352 "rc1.0_grammar.y" +{ + yyval.biasScaleEnum = yyvsp[-3].biasScaleEnum; + ; + break;} +case 43: +#line 356 "rc1.0_grammar.y" +{ + yyval.biasScaleEnum = yyvsp[-3].biasScaleEnum; + ; + break;} +case 44: +#line 360 "rc1.0_grammar.y" +{ + yyval.biasScaleEnum = yyvsp[-3].biasScaleEnum; + ; + break;} +case 45: +#line 364 "rc1.0_grammar.y" +{ + yyval.biasScaleEnum = yyvsp[-3].biasScaleEnum; + ; + break;} +case 46: +#line 368 "rc1.0_grammar.y" +{ + yyval.biasScaleEnum = yyvsp[-3].biasScaleEnum; + ; + break;} +case 47: +#line 374 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[0].registerEnum, GL_UNSIGNED_IDENTITY_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 48: +#line 380 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_IDENTITY_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 49: +#line 386 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_INVERT_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 50: +#line 392 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[0].registerEnum); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 51: +#line 398 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_IDENTITY_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 52: +#line 404 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_INVERT_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 53: +#line 410 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[0].registerEnum); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 54: +#line 416 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_IDENTITY_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 55: +#line 422 "rc1.0_grammar.y" +{ + MappedRegisterStruct reg; + reg.Init(yyvsp[-1].registerEnum, GL_UNSIGNED_INVERT_NV); + yyval.mappedRegisterStruct = reg; + ; + break;} +case 56: +#line 430 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, yyvsp[-1].finalAlphaFunctionStruct, false); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 57: +#line 436 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, yyvsp[-1].finalAlphaFunctionStruct, true); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 58: +#line 442 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, yyvsp[-1].finalAlphaFunctionStruct, false, yyvsp[-2].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 59: +#line 448 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, yyvsp[-1].finalAlphaFunctionStruct, true, yyvsp[-2].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 60: +#line 454 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, yyvsp[-1].finalAlphaFunctionStruct, true, yyvsp[-3].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 61: +#line 461 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[-1].finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, false); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 62: +#line 467 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[-1].finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, true); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 63: +#line 473 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[-1].finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, false, yyvsp[-2].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 64: +#line 479 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[-1].finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, true, yyvsp[-2].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 65: +#line 485 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init(yyvsp[-1].finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, true, yyvsp[-3].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 66: +#line 492 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, finalAlphaFunctionStruct, false); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 67: +#line 500 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, finalAlphaFunctionStruct, true); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 68: +#line 508 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, finalAlphaFunctionStruct, false, yyvsp[-1].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 69: +#line 516 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, finalAlphaFunctionStruct, true, yyvsp[-1].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 70: +#line 524 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(yyvsp[0].finalRgbFunctionStruct, finalAlphaFunctionStruct, true, yyvsp[-2].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 71: +#line 533 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, false); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 72: +#line 541 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, true); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 73: +#line 549 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, false, yyvsp[-1].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 74: +#line 557 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, true, yyvsp[-1].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 75: +#line 565 "rc1.0_grammar.y" +{ + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, yyvsp[0].finalAlphaFunctionStruct, true, yyvsp[-2].finalProductStruct); + yyval.finalCombinerStruct = finalCombinerStruct; + ; + break;} +case 76: +#line 575 "rc1.0_grammar.y" +{ + yyval.ival = yyvsp[-3].ival; + ; + break;} +case 77: +#line 581 "rc1.0_grammar.y" +{ + FinalProductStruct finalProductStruct; + finalProductStruct.Init(yyvsp[-3].mappedRegisterStruct, yyvsp[-1].mappedRegisterStruct); + yyval.finalProductStruct = finalProductStruct; + ; + break;} +case 78: +#line 589 "rc1.0_grammar.y" +{ + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(yyvsp[-8].mappedRegisterStruct, yyvsp[-6].mappedRegisterStruct, yyvsp[-4].mappedRegisterStruct, yyvsp[-1].mappedRegisterStruct); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 79: +#line 595 "rc1.0_grammar.y" +{ + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(yyvsp[-6].mappedRegisterStruct, yyvsp[-4].mappedRegisterStruct, yyvsp[-2].mappedRegisterStruct, yyvsp[-10].mappedRegisterStruct); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 80: +#line 601 "rc1.0_grammar.y" +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg; + reg.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(yyvsp[-6].mappedRegisterStruct, yyvsp[-4].mappedRegisterStruct, yyvsp[-2].mappedRegisterStruct, reg); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 81: +#line 611 "rc1.0_grammar.y" +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg1; + reg1.Init(zero, GL_UNSIGNED_IDENTITY_NV); + MappedRegisterStruct reg2; + reg2.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(yyvsp[-3].mappedRegisterStruct, yyvsp[-1].mappedRegisterStruct, reg1, reg2); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 82: +#line 623 "rc1.0_grammar.y" +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg1; + reg1.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(yyvsp[-5].mappedRegisterStruct, yyvsp[-3].mappedRegisterStruct, reg1, yyvsp[-1].mappedRegisterStruct); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 83: +#line 633 "rc1.0_grammar.y" +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg1; + reg1.Init(zero, GL_UNSIGNED_IDENTITY_NV); + MappedRegisterStruct reg2; + reg2.Init(zero, GL_UNSIGNED_IDENTITY_NV); + MappedRegisterStruct reg3; + reg3.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(reg1, reg2, reg3, yyvsp[-1].mappedRegisterStruct); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 84: +#line 647 "rc1.0_grammar.y" +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg2; + reg2.Init(zero, GL_UNSIGNED_INVERT_NV); + MappedRegisterStruct reg3; + reg3.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(yyvsp[-3].mappedRegisterStruct, reg2, reg3, yyvsp[-1].mappedRegisterStruct); + yyval.finalRgbFunctionStruct = finalRgbFunctionStruct; + ; + break;} +case 85: +#line 661 "rc1.0_grammar.y" +{ + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.Init(yyvsp[-1].mappedRegisterStruct); + yyval.finalAlphaFunctionStruct = finalAlphaFunctionStruct; + ; + break;} +case 86: +#line 669 "rc1.0_grammar.y" +{ + yyval.registerEnum = yyvsp[0].registerEnum; + ; + break;} +case 87: +#line 673 "rc1.0_grammar.y" +{ + yyval.registerEnum = yyvsp[0].registerEnum; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} +#line 678 "rc1.0_grammar.y" + +void yyerror(char* s) +{ + errors.set("unrecognized token"); +} diff --git a/nvparse/_rc1.0_parser.h b/nvparse/_rc1.0_parser.h new file mode 100644 index 0000000..d7b50e4 --- /dev/null +++ b/nvparse/_rc1.0_parser.h @@ -0,0 +1,54 @@ +typedef union { + int ival; + float fval; + RegisterEnum registerEnum; + BiasScaleEnum biasScaleEnum; + MappedRegisterStruct mappedRegisterStruct; + ConstColorStruct constColorStruct; + GeneralPortionStruct generalPortionStruct; + GeneralFunctionStruct generalFunctionStruct; + OpStruct opStruct; + GeneralCombinerStruct generalCombinerStruct; + GeneralCombinersStruct generalCombinersStruct; + FinalProductStruct finalProductStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + FinalCombinerStruct finalCombinerStruct; + CombinersStruct combinersStruct; +} YYSTYPE; +#define regVariable 257 +#define constVariable 258 +#define color_sum 259 +#define final_product 260 +#define expandString 261 +#define halfBiasString 262 +#define unsignedString 263 +#define unsignedInvertString 264 +#define muxString 265 +#define sumString 266 +#define rgb_portion 267 +#define alpha_portion 268 +#define openParen 269 +#define closeParen 270 +#define openBracket 271 +#define closeBracket 272 +#define semicolon 273 +#define comma 274 +#define dot 275 +#define times 276 +#define minus 277 +#define equals 278 +#define plus 279 +#define bias_by_negative_one_half_scale_by_two 280 +#define bias_by_negative_one_half 281 +#define scale_by_one_half 282 +#define scale_by_two 283 +#define scale_by_four 284 +#define clamp_color_sum 285 +#define lerp 286 +#define fragment_rgb 287 +#define fragment_alpha 288 +#define floatValue 289 + + +extern YYSTYPE rc10_lval; diff --git a/nvparse/nvparse.cpp b/nvparse/nvparse.cpp new file mode 100644 index 0000000..fd96b9d --- /dev/null +++ b/nvparse/nvparse.cpp @@ -0,0 +1,77 @@ +#ifdef _WIN32 +# include +#else +#include +#define strnicmp strncasecmp +#endif + +#include +#include + +#include +#include + +#include "nvparse_errors.h" +#include "nvparse.h" + + +//void yyinit(char*); +//int yyparse(void); + + +// RC1.0 -- register combiners 1.0 configuration +bool rc10_init(char *); +int rc10_parse(); +bool is_rc10(const char *); + +nvparse_errors errors; +int line_number; +char * myin = 0; + +void nvparse(const char * input_string, int argc /* = 0 */,...) +{ + if (NULL == input_string) + { + errors.set("NULL string passed to nvparse"); + return; + } + + char * instring = strdup(input_string); + + + // register combiners (1 and 2) + if(is_rc10(instring)) + { + if(rc10_init(instring)) + { + rc10_parse(); + } + } + else + { + errors.set("invalid string.\n \ + first characters must be: !!VP1.0 or !!VSP1.0 or !!RC1.0 or !!TS1.0\n \ + or it must be a valid DirectX 8.0 Vertex Shader"); + } + free(instring); +} + +char * const * const nvparse_get_errors() +{ + return errors.get_errors(); +} + +char * const * const nvparse_print_errors(FILE * errfp) +{ + for (char * const * ep = nvparse_get_errors(); *ep; ep++) + { + const char * errstr = *ep; + fprintf(errfp, "%s\n", errstr); + } + return nvparse_get_errors(); +} + +const int* nvparse_get_info(const char* input_string, int* pcount) +{ + return 0; +} diff --git a/nvparse/nvparse.h b/nvparse/nvparse.h new file mode 100644 index 0000000..3c0f4ea --- /dev/null +++ b/nvparse/nvparse.h @@ -0,0 +1,22 @@ +#ifndef NVPARSE_H +#define NVPARSE_H + +#define NVPARSE 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + + +void nvparse(const char * input_string, int argc,...); +char * const * const nvparse_get_errors(); +char * const * const nvparse_print_errors(FILE *fp); +const int* nvparse_get_info(const char* input_string, int* pcount); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/nvparse/nvparse.lib b/nvparse/nvparse.lib new file mode 100644 index 0000000000000000000000000000000000000000..18483c159eac6fd07c497559966b6c9de7ff09f9 GIT binary patch literal 15679 zcmeGjOKcm*bx6swV>^jbD@K7d4dXg((?l{QnX;uc*&%nAABjJGZMjMrewNZE)&(4cr2CRJSOQ=F(e`qKBgBrH2Gff+h{%OD-+aLk{hsK!E`Etv>i5)O~Mum&;u( zNs&&{An*#aoSk{^&3kX&yqS43di1+_t+?^b;Zp(UGafuW89IAre0tJZ9yC9vf)nFL z_PN7^kQWI#^+x*?T_NOiOupkEkOkmBB+HNXEGwD>cdt*gS$~UnDfkv`I(rT<+kuEyg(Iri> zxUi8DG#1N5_KTzy$Ah^XHmgfHqo*ic4QIp4&{f8FuC7BRrBIfWRVbsB*_MG?k}8q| z^}H7@+M)qpt~BZ!EiH8cmlav>2HnD#-A+Z#ms|p@hS`uZ_%O_nnPz)|g@jGew%fMw z5ursf48E>wva;R*p@sgI34AsR^BNaGBu3_QKE6L}qT5mQ<*2)R8E^5IlZNXyonw{?vuV1e$vR_PSAlrG z3Vu(M*5x`3Kd*N9FwG=Vf)fo|K>5LUDiv@?P5jp8cpgUXoJb3mhNB6aS8csuaoQa3 z;4d?=M3}O=Cfzmy+E@viNboUQmYE0f!dsWXoiWWeu>_tbQ=-Ub5>THFp;ikp4{CML z4>)bPEQ5A~T*yY8qcI`6r>nsK<0LTaLMt%Woi0m34L@o!P@~kM33*g z9dDI*anw!+O@=ZxOCaprIP0bhlBQ4725@rRq$)9K^qAibBxdShy)Hgo7p##IcTEjk-SDO_D<7W zIzm|n!GOZ(-@DlagUlM;+-irdcEey6)(h=u8J2S<9*(EcK}Ikw@Z;R+prflJbCl1< zX6brGEp(Z;OpRE|a12t1HrhhSbv7THiveTHz$R$6tb(O6EbDNcU|4>H8|OGqE&=;R zeY*zkgx2*Er6&bSr)g-sIXW^ll8Q!YdO4YdLBN(cFfZlnY*NKp(%j8B1cx1nkdCw% zo{4xGwj`m>e_)5!R&8>{y;Fkqj2FwEr6S>Q!o}^1EXuq0QV2!cfoWGm1^JxbTpd^z?gS@qsF`N>cdOeNG&2>|- z70(fg!hCAPJSM-1&$@vY`Y=5^CSI>aND7`NN@w@8;=QzSVq1M+83(p$XxhUO85N%X z&Rq4tg37a-`X*~M>2jP-5nPq5DR0q(PDBq0J0S;c^fn`lVViZX+5e7kJ?wJ4DM}x_ zc+k58a(960!N{Em=0UC+Gp;;urFks*_a11JHl)BUa=RSd#$J&f}4vj@NRII zA)>r-%gMS)wb^UHsI~=Q1l)V0W}{u;+V~{a>1^3h+{jzACi`ZyGA$VbP0Wa5gC zy#BF|2*>^8UB!>#ed2?^gJg*K$pJ_{G5}u#kQ;z+%wx>}8H7K48#VZ4eEXpm|F9h2 zLx8dWKcs&U+Cf^@pYzLV32TRdyCL{Hz}{BN_Ak=HFOtSg@2=o}r`^Tgs5vf^-K*rgn|C-`X>Ju*py2N29go1= z8_(8FscZih>|}<$#{!zY(L1UKBX>9Ntmo`a@Sd=bd&lj9cXx-Y^AWm_&AWFr42iit zlpV&iWnhiE0h^3=f$Oy4?{@mIpYs|Mri1lvj&1qXHZ!c^;F|9+);k<5oDAidsYK9$;P`!2`_06ChN_Q!D#q$?NuC^L}72 zhg)9feVq@y%v)J^FMxU7T7#hG7y1I&{=%`nT@&*-8D^p0uGhyZ`;Pjyy=dkL2OE~z z%iXij^eXMAax&a5?ISZLr{nnTHdw3Y&P)#Qnt(u`h zLOyiC#mR7F46iU+K=2EP2;^@=gnSi_6`q9Thq!%UIQyKN-ZsDqQ2!1dKfr^eVFFfpLX1e+d7> z0iJgBDo}R{V15nh50Ki)`vZWx2KD?Aq}HC^t5A0iV6HqCcw)UD^=06-MruA8v!H0A6S>qa~@FZ&dV(T$o8FBD@f2Ey*N>bT}n021ccl40lpXa5oihkT#?M@|_{j zAxKAB$NB%?V;;Ifj{3ga^e6IZ%6GG`i3u z&!!Rqv(_J`M$v8Rz%c$XA91z@U&o z9OiD|$9(Q5L&LkbZ{PLNN>~6cSETnCxed1sw&Gx(Ozw1B~x^{JLd* z$(D5?=Z4NP*Uh@b-OF#HdIOh&JE=qSmS#bDJFj3lWUdUp0{YweDSlpl&xa+f%59PF z4-&LQ4$=rIz}wIyYR}T-hfR9ssI7 z$6&&Tl|5x%#VJ0I_Uw7*u3w za`Ng`tm;*nFMoio+jjZ>A@U@&gFFne1$_!~BLvs(hK|v=4IR%xj*xFaf(tJ29w1mU zNM3^X0m6bV0aXcL!7s}^p^O4c2+;3Bt}1BuDd;hS?<7W@GJmZW*2~*AJ}#Jd|Vqp3<+!RwI%)^ DW!2xl literal 0 HcmV?d00001 diff --git a/nvparse/nvparse/nvparse.dsp b/nvparse/nvparse/nvparse.dsp new file mode 100644 index 0000000..92e545d --- /dev/null +++ b/nvparse/nvparse/nvparse.dsp @@ -0,0 +1,148 @@ +# Microsoft Developer Studio Project File - Name="nvparse" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=nvparse - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "nvparse.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "nvparse.mak" CFG="nvparse - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "nvparse - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "nvparse - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "nvparse - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x813 /d "NDEBUG" +# ADD RSC /l 0x813 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "nvparse - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x813 /d "_DEBUG" +# ADD RSC /l 0x813 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "nvparse - Win32 Release" +# Name "nvparse - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\_rc1.0_lexer.cpp +# End Source File +# Begin Source File + +SOURCE=..\_rc1.0_parser.cpp +# End Source File +# Begin Source File + +SOURCE=..\nvparse.cpp +# End Source File +# Begin Source File + +SOURCE=..\nvparse_errors.cpp +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_combiners.cpp +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_final.cpp +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_general.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\_rc1.0_parser.h +# End Source File +# Begin Source File + +SOURCE=..\nvparse_errors.h +# End Source File +# Begin Source File + +SOURCE=..\nvparse_externs.h +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_combiners.h +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_final.h +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_general.h +# End Source File +# Begin Source File + +SOURCE=..\rc1.0_register.h +# End Source File +# End Group +# End Target +# End Project diff --git a/nvparse/nvparse/nvparse.plg b/nvparse/nvparse/nvparse.plg new file mode 100644 index 0000000..267fade --- /dev/null +++ b/nvparse/nvparse/nvparse.plg @@ -0,0 +1,16 @@ + + +
+

Build Log

+

+--------------------Configuration: nvparse - Win32 Debug-------------------- +

+

Command Lines

+ + + +

Results

+nvparse.lib - 0 error(s), 0 warning(s) +
+ + diff --git a/nvparse/nvparse_errors.cpp b/nvparse/nvparse_errors.cpp new file mode 100644 index 0000000..01ea340 --- /dev/null +++ b/nvparse/nvparse_errors.cpp @@ -0,0 +1,47 @@ +#include +#include +#include + +#include "nvparse_errors.h" + + + +nvparse_errors::nvparse_errors() +{ + num_errors = 0; + reset(); +} + +nvparse_errors::~nvparse_errors() +{ + reset(); +} + + +void nvparse_errors::reset() +{ + for(int i=0; i < num_errors; i++) + free(elist[i]);//FIXME detail_nmap something is writing 0x2 to elist[1] blah! + for(int j=0; j <= NVPARSE_MAX_ERRORS; j++) + elist[j] = 0; + num_errors = 0; +} + +void nvparse_errors::set(const char * e) +{ + if(num_errors < NVPARSE_MAX_ERRORS) + elist[num_errors++] = strdup(e); +} + +void nvparse_errors::set(const char * e, int line_number) +{ + char buff[256]; + sprintf(buff, "error on line %d: %s", line_number, e); + if(num_errors < NVPARSE_MAX_ERRORS) + elist[num_errors++] = strdup(buff); +} + +char * const * const nvparse_errors::get_errors() +{ + return elist; +} diff --git a/nvparse/nvparse_errors.h b/nvparse/nvparse_errors.h new file mode 100644 index 0000000..1c346c9 --- /dev/null +++ b/nvparse/nvparse_errors.h @@ -0,0 +1,25 @@ +#ifndef _NVPARSE_ERRORS_H_ +#define _NVPARSE_ERRORS_H_ + +#ifdef _WIN32 + #pragma warning(disable:4786) // stupid symbol size limitation +#endif + +#define NVPARSE_MAX_ERRORS 32 +class nvparse_errors +{ +public: + nvparse_errors(); + ~nvparse_errors(); + + void reset(); + void set(const char * e); + void set(const char * e, int line_number); + char * const * const get_errors(); + inline int get_num_errors() { return num_errors; } +private: + char* elist [NVPARSE_MAX_ERRORS+1]; + int num_errors; +}; + +#endif diff --git a/nvparse/nvparse_externs.h b/nvparse/nvparse_externs.h new file mode 100644 index 0000000..79e3cf2 --- /dev/null +++ b/nvparse/nvparse_externs.h @@ -0,0 +1,9 @@ +#ifndef NVPARSE_EXTERNS_H +#define NVPARSE_EXTERNS_H + +extern nvparse_errors errors; +extern int line_number; +extern char * myin; + + +#endif diff --git a/nvparse/rc1.0_combiners.cpp b/nvparse/rc1.0_combiners.cpp new file mode 100644 index 0000000..a5b89fb --- /dev/null +++ b/nvparse/rc1.0_combiners.cpp @@ -0,0 +1,91 @@ +#include "../glNV.h" + +#include "rc1.0_combiners.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + +void CombinersStruct::Validate() +{ + if (2 == numConsts && + cc[0].reg.bits.name == cc[1].reg.bits.name) + errors.set("global constant set twice"); + + generals.Validate(numConsts, &cc[0]); + + final.Validate(); +} + +void CombinersStruct::Invoke() +{ + for (int i = 0; i < numConsts; i++) + qglCombinerParameterfvNV(cc[i].reg.bits.name, &(cc[i].v[0])); + + generals.Invoke(); + + final.Invoke(); +} + +bool is_rc10(const char * s) +{ + return ! strncmp(s, "!!RC1.0", 7); +} + + +bool rc10_init_more() +{ + bool rcinit = false; + if(rcinit == false) + { + //FIXME; check extension availabe + rcinit = true; + /* + if(! glh_init_extensions("GL_NV_register_combiners")) + { + errors.set("unable to initialize GL_NV_register_combiners\n"); + return false; + } + else + { + rcinit = true; + } + */ + } + + bool rc2init = false; + if(rc2init == false) + { + //glh_init_extensions("GL_NV_register_combiners2"); + // Don't fail if this doesn't initialize. + // We will run even if it doesn't exist. + rc2init = true; + } + + errors.reset(); + line_number = 1; + + return true; +} +/* + else if(!strncmp(instring, "!!RC1.0", 7)) + { + if(glCombinerParameterfvNV == 0) + { + if(! glh_init_extensions("GL_NV_register_combiners")) + { + errors.set("unable to initialize GL_NV_register_combiners\n"); + free(instring); + return; + } + } + if(glCombinerStageParameterfvNV == 0) + { + glh_init_extensions("GL_NV_register_combiners2"); + // Don't fail if this doesn't initialize. + // We will run even if it doesn't exist. + } + errors.reset(); + line_number = 1; + rc10_init(instring+7); + rc10_parse(); + } +*/ diff --git a/nvparse/rc1.0_combiners.h b/nvparse/rc1.0_combiners.h new file mode 100644 index 0000000..907dba7 --- /dev/null +++ b/nvparse/rc1.0_combiners.h @@ -0,0 +1,24 @@ +#ifndef _RC10_COMBINERS_H +#define _RC10_COMBINERS_H + +#include "rc1.0_general.h" +#include "rc1.0_final.h" + +class CombinersStruct { +public: + void Init(GeneralCombinersStruct _gcs, FinalCombinerStruct _fc, ConstColorStruct _cc0, ConstColorStruct _cc1) + { generals = _gcs; final = _fc; cc[0] = _cc0; cc[1] = _cc1; numConsts = 2;} + void Init(GeneralCombinersStruct _gcs, FinalCombinerStruct _fc, ConstColorStruct _cc0) + { generals = _gcs; final = _fc; cc[0] = _cc0; numConsts = 1;} + void Init(GeneralCombinersStruct _gcs, FinalCombinerStruct _fc) + { generals = _gcs; final = _fc; numConsts = 0;} + void Validate(); + void Invoke(); +private: + GeneralCombinersStruct generals; + FinalCombinerStruct final; + ConstColorStruct cc[2]; + int numConsts; +}; + +#endif diff --git a/nvparse/rc1.0_final.cpp b/nvparse/rc1.0_final.cpp new file mode 100644 index 0000000..12b78be --- /dev/null +++ b/nvparse/rc1.0_final.cpp @@ -0,0 +1,160 @@ +//#include +#include "../glNV.h" + +#include "rc1.0_final.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + +void FinalRgbFunctionStruct::ZeroOut() +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + a.Init(zero, GL_UNSIGNED_IDENTITY_NV); + b.Init(zero, GL_UNSIGNED_IDENTITY_NV); + c.Init(zero, GL_UNSIGNED_IDENTITY_NV); + d.Init(zero, GL_UNSIGNED_IDENTITY_NV); +} + +void FinalAlphaFunctionStruct::ZeroOut() +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + g.Init(zero, GL_UNSIGNED_IDENTITY_NV); +} + +void FinalProductStruct::ZeroOut() +{ + RegisterEnum zero; + zero.word = RCP_ZERO; + e.Init(zero, GL_UNSIGNED_IDENTITY_NV); + f.Init(zero, GL_UNSIGNED_IDENTITY_NV); +} +void FinalCombinerStruct::Validate() +{ + if (hasProduct && + (GL_E_TIMES_F_NV == product.e.reg.bits.name || + GL_SPARE0_PLUS_SECONDARY_COLOR_NV == product.e.reg.bits.name || + GL_DISCARD_NV == product.e.reg.bits.name || + GL_E_TIMES_F_NV == product.f.reg.bits.name || + GL_SPARE0_PLUS_SECONDARY_COLOR_NV == product.f.reg.bits.name || + GL_DISCARD_NV == product.f.reg.bits.name)) + errors.set("invalid input register for final_product"); + + if (hasProduct && + (RCP_BLUE == product.e.reg.bits.channel || + RCP_BLUE == product.f.reg.bits.channel)) + errors.set("blue register used in final_product"); + + if (GL_E_TIMES_F_NV == alpha.g.reg.bits.name || + GL_SPARE0_PLUS_SECONDARY_COLOR_NV == alpha.g.reg.bits.name || + GL_DISCARD_NV == alpha.g.reg.bits.name) + errors.set("invalid input register for final alpha"); + + if (RCP_RGB == alpha.g.reg.bits.channel) + errors.set("rgb register used in final alpha"); + + if (GL_SPARE0_PLUS_SECONDARY_COLOR_NV == rgb.a.reg.bits.name && + GL_SPARE0_PLUS_SECONDARY_COLOR_NV != rgb.b.reg.bits.name && + GL_ZERO == rgb.c.reg.bits.name && GL_UNSIGNED_IDENTITY_NV == rgb.c.map) + { + MappedRegisterStruct temp; + temp = rgb.a; + rgb.a = rgb.b; + rgb.b = temp; + } + + if (GL_SPARE0_PLUS_SECONDARY_COLOR_NV == rgb.a.reg.bits.name && + GL_ZERO == rgb.b.reg.bits.name && GL_UNSIGNED_INVERT_NV == rgb.b.map && + GL_ZERO == rgb.c.reg.bits.name && GL_UNSIGNED_IDENTITY_NV == rgb.c.map && + GL_SPARE0_PLUS_SECONDARY_COLOR_NV != rgb.d.reg.bits.name) + { + MappedRegisterStruct temp; + temp = rgb.a; + rgb.a = rgb.d; + rgb.d = temp; + } + + if (GL_SPARE0_PLUS_SECONDARY_COLOR_NV == rgb.a.reg.bits.name || + GL_DISCARD_NV == rgb.a.reg.bits.name || + GL_DISCARD_NV == rgb.b.reg.bits.name || + GL_DISCARD_NV == rgb.c.reg.bits.name || + GL_DISCARD_NV == rgb.d.reg.bits.name) + errors.set("invalid input register for final rgb"); + + if (RCP_BLUE == rgb.a.reg.bits.channel || + RCP_BLUE == rgb.b.reg.bits.channel || + RCP_BLUE == rgb.c.reg.bits.channel || + RCP_BLUE == rgb.d.reg.bits.channel) + errors.set("blue register used in final rgb"); + + if ((GL_E_TIMES_F_NV == rgb.a.reg.bits.name || + GL_E_TIMES_F_NV == rgb.b.reg.bits.name || + GL_E_TIMES_F_NV == rgb.c.reg.bits.name || + GL_E_TIMES_F_NV == rgb.d.reg.bits.name) && !hasProduct) + errors.set("final_product used but not set"); + + if (RCP_NONE == rgb.a.reg.bits.channel) + rgb.a.reg.bits.channel = RCP_RGB; + if (RCP_NONE == rgb.b.reg.bits.channel) + rgb.b.reg.bits.channel = RCP_RGB; + if (RCP_NONE == rgb.c.reg.bits.channel) + rgb.c.reg.bits.channel = RCP_RGB; + if (RCP_NONE == rgb.d.reg.bits.channel) + rgb.d.reg.bits.channel = RCP_RGB; + if (RCP_NONE == product.e.reg.bits.channel) + product.e.reg.bits.channel = RCP_RGB; + if (RCP_NONE == product.f.reg.bits.channel) + product.f.reg.bits.channel = RCP_RGB; + if (RCP_NONE == alpha.g.reg.bits.channel) + alpha.g.reg.bits.channel = RCP_ALPHA; +} + +void FinalCombinerStruct::Invoke() +{ + if(clamp) + qglCombinerParameteriNV(GL_COLOR_SUM_CLAMP_NV, GL_TRUE); + else + qglCombinerParameteriNV(GL_COLOR_SUM_CLAMP_NV, GL_FALSE); + + qglFinalCombinerInputNV( + GL_VARIABLE_A_NV, + rgb.a.reg.bits.name, + rgb.a.map, + MAP_CHANNEL(rgb.a.reg.bits.channel)); + + qglFinalCombinerInputNV( + GL_VARIABLE_B_NV, + rgb.b.reg.bits.name, + rgb.b.map, + MAP_CHANNEL(rgb.b.reg.bits.channel)); + + qglFinalCombinerInputNV( + GL_VARIABLE_C_NV, + rgb.c.reg.bits.name, + rgb.c.map, + MAP_CHANNEL(rgb.c.reg.bits.channel)); + + qglFinalCombinerInputNV( + GL_VARIABLE_D_NV, + rgb.d.reg.bits.name, + rgb.d.map, + MAP_CHANNEL(rgb.d.reg.bits.channel)); + + qglFinalCombinerInputNV( + GL_VARIABLE_E_NV, + product.e.reg.bits.name, + product.e.map, + MAP_CHANNEL(product.e.reg.bits.channel)); + + qglFinalCombinerInputNV( + GL_VARIABLE_F_NV, + product.f.reg.bits.name, + product.f.map, + MAP_CHANNEL(product.f.reg.bits.channel)); + + qglFinalCombinerInputNV( + GL_VARIABLE_G_NV, + alpha.g.reg.bits.name, + alpha.g.map, + MAP_CHANNEL(alpha.g.reg.bits.channel)); +} diff --git a/nvparse/rc1.0_final.h b/nvparse/rc1.0_final.h new file mode 100644 index 0000000..f0d9844 --- /dev/null +++ b/nvparse/rc1.0_final.h @@ -0,0 +1,48 @@ +#ifndef _RC10_FINAL_H +#define _RC10_FINAL_H + +#include "rc1.0_register.h" + +class FinalAlphaFunctionStruct { +public: + void Init(MappedRegisterStruct _g) { g = _g; } + void ZeroOut(); + MappedRegisterStruct g; +}; + +class FinalRgbFunctionStruct { +public: + void Init(MappedRegisterStruct _a, MappedRegisterStruct _b, MappedRegisterStruct _c, MappedRegisterStruct _d) + { a = _a; b = _b; c = _c; d = _d; } + void ZeroOut(); + MappedRegisterStruct a; + MappedRegisterStruct b; + MappedRegisterStruct c; + MappedRegisterStruct d; +}; + +class FinalProductStruct { +public: + void Init(MappedRegisterStruct _e, MappedRegisterStruct _f) { e = _e; f = _f; } + void ZeroOut(); + MappedRegisterStruct e; + MappedRegisterStruct f; +}; + +class FinalCombinerStruct { +public: + void Init(FinalRgbFunctionStruct _rgb, FinalAlphaFunctionStruct _alpha, int _clamp, FinalProductStruct _product) + { rgb = _rgb; alpha = _alpha; clamp = _clamp; product = _product; hasProduct = true;} + void Init(FinalRgbFunctionStruct _rgb, FinalAlphaFunctionStruct _alpha, int _clamp) + { rgb = _rgb; alpha = _alpha; clamp = _clamp; hasProduct = false; product.ZeroOut();} + + int hasProduct; + FinalProductStruct product; + int clamp; + FinalRgbFunctionStruct rgb; + FinalAlphaFunctionStruct alpha; + void Validate(); + void Invoke(); +}; + +#endif diff --git a/nvparse/rc1.0_general.cpp b/nvparse/rc1.0_general.cpp new file mode 100644 index 0000000..493cec5 --- /dev/null +++ b/nvparse/rc1.0_general.cpp @@ -0,0 +1,300 @@ +#include "../glNV.h" +#include + +#include "rc1.0_general.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + +void GeneralCombinersStruct::Validate(int numConsts, ConstColorStruct *pcc) +{ + GLint maxGCs; + glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &maxGCs); + if (num > maxGCs) { + char buffer[256]; + sprintf(buffer, "%d general combiners specified, only %d supported", num, maxGCs); + errors.set(buffer); + num = maxGCs; + } + + if (0 == num) { + // Setup a "fake" general combiner 0 + general[0].ZeroOut(); + num = 1; + } + + localConsts = 0; + int i; + for (i = 0; i < num; i++) + localConsts += general[i].numConsts; + + if (localConsts > 0) + if (NULL == qglCombinerStageParameterfvNV) + errors.set("local constant(s) specified, but not supported -- ignored"); + else + for (i = 0; i < num; i++) + general[i].SetUnusedLocalConsts(numConsts, pcc); + + for (i = 0; i < num; i++) + general[i].Validate(i); + + + for (; i < maxGCs; i++) + general[i].ZeroOut(); +} + +void GeneralCombinersStruct::Invoke() +{ + qglCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, num); + int i; + for (i = 0; i < num; i++) + general[i].Invoke(i); + + if (NULL != qglCombinerStageParameterfvNV) { + if (localConsts > 0) + glEnable(GL_PER_STAGE_CONSTANTS_NV); + else + glDisable(GL_PER_STAGE_CONSTANTS_NV); + } + +} + +void GeneralCombinerStruct::ZeroOut() +{ + numPortions = 2; + numConsts = 0; + + portion[0].ZeroOut(); + portion[0].designator = RCP_RGB; + portion[1].ZeroOut(); + portion[1].designator = RCP_ALPHA; +} + + +void GeneralCombinerStruct::SetUnusedLocalConsts(int numGlobalConsts, ConstColorStruct *globalCCs) +{ + int i; + for (i = 0; i < numGlobalConsts; i++) { + bool constUsed = false; + int j; + for (j = 0; j < numConsts; j++) + constUsed |= (cc[j].reg.bits.name == globalCCs[i].reg.bits.name); + if (!constUsed) + cc[numConsts++] = globalCCs[i]; + } +} + + +void GeneralCombinerStruct::Validate(int stage) +{ + if (2 == numConsts && + cc[0].reg.bits.name == cc[1].reg.bits.name) + errors.set("local constant set twice"); + + switch (numPortions) + { + case 0: + portion[0].designator = RCP_RGB; + // Fallthru + case 1: + portion[1].designator = ((RCP_RGB == portion[0].designator) ? RCP_ALPHA : RCP_RGB); + // Fallthru + case 2: + if (portion[0].designator == portion[1].designator) + errors.set("portion declared twice"); + break; + } + int i; + for (i = 0; i < numPortions; i++) + portion[i].Validate(stage); + + for (; i < 2; i++) + portion[i].ZeroOut(); + +} + +void GeneralCombinerStruct::Invoke(int stage) +{ + int i; + + if (NULL != qglCombinerStageParameterfvNV) + for (i = 0; i < numConsts; i++) + qglCombinerStageParameterfvNV(GL_COMBINER0_NV + stage, cc[i].reg.bits.name, &(cc[i].v[0])); + + for (i = 0; i < 2; i++) + portion[i].Invoke(stage); +} + +void GeneralPortionStruct::Validate(int stage) +{ + gf.Validate(stage, designator); +} + +void GeneralPortionStruct::Invoke(int stage) +{ + gf.Invoke(stage, designator, bs); +} + +void GeneralPortionStruct::ZeroOut() +{ + gf.ZeroOut(); + bs.word = RCP_SCALE_BY_ONE; +} + +void GeneralFunctionStruct::ZeroOut() +{ + // Create mapped registers for zero and discard + MappedRegisterStruct unsignedZero; + RegisterEnum zero; + zero.word = RCP_ZERO; + unsignedZero.Init(zero); + + MappedRegisterStruct unsignedDiscard; + RegisterEnum discard; + discard.word = RCP_DISCARD; + unsignedDiscard.Init(discard); + + numOps = 3; + + op[0].op = RCP_MUL; + op[0].reg[0] = unsignedDiscard; + op[0].reg[1] = unsignedZero; + op[0].reg[2] = unsignedZero; + + op[1].op = RCP_MUL; + op[1].reg[0] = unsignedDiscard; + op[1].reg[1] = unsignedZero; + op[1].reg[2] = unsignedZero; + + op[2].op = RCP_SUM; + op[2].reg[0] = unsignedDiscard; + +} + +void GeneralFunctionStruct::Validate(int stage, int portion) +{ + int i; + for (i = 0; i < numOps; i++) + op[i].Validate(stage, portion); + // Check if multiple ops are writing to same register (and it's not DISCARD) + if (numOps > 1 && + op[0].reg[0].reg.bits.name == op[1].reg[0].reg.bits.name && + GL_DISCARD_NV != op[0].reg[0].reg.bits.name) + errors.set("writing to same register twice"); + if (numOps > 2 && + (op[0].reg[0].reg.bits.name == op[2].reg[0].reg.bits.name || + op[1].reg[0].reg.bits.name == op[2].reg[0].reg.bits.name) && + GL_DISCARD_NV != op[2].reg[0].reg.bits.name) + errors.set("writing to same register twice"); + + // Set unused outputs to discard, unused inputs to zero/unsigned_identity + if (numOps < 2) { + // Set C input to zero + op[1].reg[1].reg.bits.name = GL_ZERO; + op[1].reg[1].map = GL_UNSIGNED_IDENTITY_NV; + op[1].reg[1].reg.bits.channel = portion; + + // Set D input to zero + op[1].reg[2].reg.bits.name = GL_ZERO; + op[1].reg[2].map = GL_UNSIGNED_IDENTITY_NV; + op[1].reg[2].reg.bits.channel = portion; + + // Discard CD output + op[1].op = false; + op[1].reg[0].reg.bits.name = GL_DISCARD_NV; + } + + if (numOps < 3) { + // Discard muxSum output + op[2].reg[0].reg.bits.name = GL_DISCARD_NV; + op[2].op = RCP_SUM; + } +} + + +void GeneralFunctionStruct::Invoke(int stage, int portion, BiasScaleEnum bs) +{ + GLenum portionEnum = (RCP_RGB == portion) ? GL_RGB : GL_ALPHA; + + qglCombinerInputNV(GL_COMBINER0_NV + stage, + portionEnum, + GL_VARIABLE_A_NV, + op[0].reg[1].reg.bits.name, + op[0].reg[1].map, + MAP_CHANNEL(op[0].reg[1].reg.bits.channel)); + + qglCombinerInputNV(GL_COMBINER0_NV + stage, + portionEnum, + GL_VARIABLE_B_NV, + op[0].reg[2].reg.bits.name, + op[0].reg[2].map, + MAP_CHANNEL(op[0].reg[2].reg.bits.channel)); + + qglCombinerInputNV(GL_COMBINER0_NV + stage, + portionEnum, + GL_VARIABLE_C_NV, + op[1].reg[1].reg.bits.name, + op[1].reg[1].map, + MAP_CHANNEL(op[1].reg[1].reg.bits.channel)); + + qglCombinerInputNV(GL_COMBINER0_NV + stage, + portionEnum, + GL_VARIABLE_D_NV, + op[1].reg[2].reg.bits.name, + op[1].reg[2].map, + MAP_CHANNEL(op[1].reg[2].reg.bits.channel)); + + qglCombinerOutputNV(GL_COMBINER0_NV + stage, + portionEnum, + op[0].reg[0].reg.bits.name, + op[1].reg[0].reg.bits.name, + op[2].reg[0].reg.bits.name, + bs.bits.scale, + bs.bits.bias, + op[0].op, + op[1].op, + (op[2].op == RCP_MUX) ? true : false); +} + +// This helper function assigns a channel to an undesignated input register +static void ConvertRegister(RegisterEnum& reg, int portion) +{ + if (RCP_NONE == reg.bits.channel) { + reg.bits.channel = portion; + if (GL_FOG == reg.bits.name && RCP_ALPHA == portion) + // Special case where fog alpha is final only, but RGB is not + reg.bits.finalOnly = true; + } +} + + +void OpStruct::Validate(int stage, int portion) +{ + int args = 1; + + if (RCP_DOT == op || RCP_MUL == op) + args = 3; + else + args = 1; + + if (reg[0].reg.bits.readOnly) + errors.set("writing to a read-only register"); + + if (RCP_ALPHA == portion && + RCP_DOT == op) + errors.set("dot used in alpha portion"); + int i; + for (i = 0; i < args; i++) { + ConvertRegister(reg[i].reg, portion); + if (reg[i].reg.bits.finalOnly) + errors.set("final register used in general combiner"); + if (RCP_RGB == portion && + RCP_BLUE == reg[i].reg.bits.channel) + errors.set("blue register used in rgb portion"); + if (RCP_ALPHA == portion && + RCP_RGB == reg[i].reg.bits.channel) + errors.set("rgb register used in alpha portion"); + if (i > 0 && + GL_DISCARD_NV == reg[i].reg.bits.name) + errors.set("reading from discard"); + } +} diff --git a/nvparse/rc1.0_general.h b/nvparse/rc1.0_general.h new file mode 100644 index 0000000..3fd560a --- /dev/null +++ b/nvparse/rc1.0_general.h @@ -0,0 +1,107 @@ +#ifndef _RC10_GENERAL_H +#define _RC10_GENERAL_H + +#include "rc1.0_register.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + +enum { + RCP_MUL = 0, + RCP_DOT, + RCP_MUX, + RCP_SUM +}; + +class ConstColorStruct { +public: + void Init(RegisterEnum _reg, float _v0, float _v1, float _v2, float _v3) + { reg = _reg; v[0] = _v0; v[1] = _v1; v[2] = _v2; v[3] = _v3; } + RegisterEnum reg; + float v[4]; +}; + +class OpStruct { +public: + void Init(int _op, RegisterEnum _reg0, MappedRegisterStruct _reg1, MappedRegisterStruct _reg2) + { op = _op; reg[0].reg = _reg0; reg[1] = _reg1; reg[2] = _reg2; } + void Init(int _op, RegisterEnum _reg0) + { op = _op; reg[0].reg = _reg0; } + int op; + MappedRegisterStruct reg[3]; + void Validate(int stage, int portion); +}; + +class GeneralFunctionStruct { +public: + void Init(OpStruct _op0, OpStruct _op1, OpStruct _op2) { op[0] = _op0; op[1] = _op1; op[2] = _op2; numOps = 3; } + void Init(OpStruct _op0, OpStruct _op1) { op[0] = _op0; op[1] = _op1; numOps = 2; } + void Init(OpStruct _op0) { op[0] = _op0; numOps = 1; } + void Validate(int stage, int portion); + void Invoke(int stage, int portion, BiasScaleEnum bs); + void ZeroOut(); + int numOps; + OpStruct op[3]; +}; + + +class GeneralPortionStruct { +public: + void Init(int _designator, GeneralFunctionStruct _gf, BiasScaleEnum _bs) + { designator = _designator; gf = _gf; bs = _bs; } + + void Validate(int stage); + void Invoke(int stage); + void ZeroOut(); + int designator; + GeneralFunctionStruct gf; + BiasScaleEnum bs; +}; + +class GeneralCombinerStruct { +public: + void Init(GeneralPortionStruct _portion0, GeneralPortionStruct _portion1, ConstColorStruct _cc0, ConstColorStruct _cc1) + { portion[0] = _portion0; portion[1] = _portion1; numPortions = 2; cc[0] = _cc0; cc[1] = _cc1; numConsts = 2; } + void Init(GeneralPortionStruct _portion0, GeneralPortionStruct _portion1, ConstColorStruct _cc0) + { portion[0] = _portion0; portion[1] = _portion1; numPortions = 2; cc[0] = _cc0; numConsts = 1; } + void Init(GeneralPortionStruct _portion0, GeneralPortionStruct _portion1) + { portion[0] = _portion0; portion[1] = _portion1; numPortions = 2; numConsts = 0; } + + void Init(GeneralPortionStruct _portion0, ConstColorStruct _cc0, ConstColorStruct _cc1) + { portion[0] = _portion0; numPortions = 1; cc[0] = _cc0; cc[1] = _cc1; numConsts = 2; } + void Init(GeneralPortionStruct _portion0, ConstColorStruct _cc0) + { portion[0] = _portion0; numPortions = 1; cc[0] = _cc0; numConsts = 1; } + void Init(GeneralPortionStruct _portion0) + { portion[0] = _portion0; numPortions = 1; numConsts = 0; } + + void Validate(int stage); + void SetUnusedLocalConsts(int numGlobalConsts, ConstColorStruct *globalCCs); + void Invoke(int stage); + void ZeroOut(); + GeneralPortionStruct portion[2]; + int numPortions; + ConstColorStruct cc[2]; + int numConsts; +}; + +class GeneralCombinersStruct { +public: + void Init() {num = 0;} + void Init(GeneralCombinerStruct _gc) { num = 1; general[0] = _gc; } + GeneralCombinersStruct& operator+=(GeneralCombinerStruct& _gc) + { + if (num < RCP_NUM_GENERAL_COMBINERS) + general[num++] = _gc; + else + errors.set("Too many general combiners."); + return *this; + } + void Validate(int numConsts, ConstColorStruct *cc); + void Invoke(); + GeneralCombinerStruct general[RCP_NUM_GENERAL_COMBINERS]; + int num; +private: + int localConsts; +}; + + +#endif diff --git a/nvparse/rc1.0_grammar.y b/nvparse/rc1.0_grammar.y new file mode 100644 index 0000000..afa58b5 --- /dev/null +++ b/nvparse/rc1.0_grammar.y @@ -0,0 +1,682 @@ +%start WholeEnchilada +%{ +void yyerror(char* s); +int yylex ( void ); + +#ifdef _WIN32 +# include +#endif + +#include +#include + +#include "rc1.0_combiners.h" +#include "nvparse_errors.h" +#include "nvparse_externs.h" + + +%} +%union { + int ival; + float fval; + RegisterEnum registerEnum; + BiasScaleEnum biasScaleEnum; + MappedRegisterStruct mappedRegisterStruct; + ConstColorStruct constColorStruct; + GeneralPortionStruct generalPortionStruct; + GeneralFunctionStruct generalFunctionStruct; + OpStruct opStruct; + GeneralCombinerStruct generalCombinerStruct; + GeneralCombinersStruct generalCombinersStruct; + FinalProductStruct finalProductStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + FinalCombinerStruct finalCombinerStruct; + CombinersStruct combinersStruct; +} + +%token regVariable constVariable color_sum final_product +%token expandString halfBiasString unsignedString unsignedInvertString muxString sumString +%token rgb_portion alpha_portion +%token openParen closeParen openBracket closeBracket semicolon comma +%token dot times minus equals plus +%token bias_by_negative_one_half_scale_by_two bias_by_negative_one_half +%token scale_by_one_half scale_by_two scale_by_four + +%token clamp_color_sum lerp +%token fragment_rgb fragment_alpha + +%token floatValue + +%type WholeEnchilada Combiners + +%type ConstColor +%type GeneralCombiner +%type GeneralCombiners +%type PortionDesignator +%type Mux Sum Dot Mul +%type GeneralPortion +%type GeneralFunction +%type BiasScale + +%type Register +%type GeneralMappedRegister FinalMappedRegister +%type FinalProduct +%type ClampColorSum +%type FinalRgbFunction +%type FinalAlphaFunction +%type FinalCombiner + +%% + +WholeEnchilada : Combiners + { + $1.Validate(); + $1.Invoke(); + } + ; + +Combiners : ConstColor GeneralCombiners FinalCombiner + { + CombinersStruct combinersStruct; + combinersStruct.Init($2, $3, $1); + $$ = combinersStruct; + } + | ConstColor ConstColor GeneralCombiners FinalCombiner + { + CombinersStruct combinersStruct; + combinersStruct.Init($3, $4, $1, $2); + $$ = combinersStruct; + } + | GeneralCombiners FinalCombiner + { + CombinersStruct combinersStruct; + combinersStruct.Init($1, $2); + $$ = combinersStruct; + } + | ConstColor FinalCombiner + { + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(); + CombinersStruct combinersStruct; + combinersStruct.Init(generalCombinersStruct, $2, $1); + $$ = combinersStruct; + } + | ConstColor ConstColor FinalCombiner + { + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(); + CombinersStruct combinersStruct; + combinersStruct.Init(generalCombinersStruct, $3, $1, $2); + $$ = combinersStruct; + } + | FinalCombiner + { + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init(); + CombinersStruct combinersStruct; + combinersStruct.Init(generalCombinersStruct, $1); + $$ = combinersStruct; + } + ; + +ConstColor : constVariable equals openParen floatValue comma floatValue comma floatValue comma floatValue closeParen semicolon + { + ConstColorStruct constColorStruct; + constColorStruct.Init($1, $4, $6, $8, $10); + $$ = constColorStruct; + } + ; + + +GeneralCombiners : GeneralCombiners GeneralCombiner + { + $1 += $2; + $$ = $1; + } + | GeneralCombiner + { + GeneralCombinersStruct generalCombinersStruct; + generalCombinersStruct.Init($1); + $$ = generalCombinersStruct; + } + ; + +GeneralCombiner : openBracket GeneralPortion GeneralPortion closeBracket + { + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init($2, $3); + $$ = generalCombinerStruct; + } + | openBracket ConstColor GeneralPortion GeneralPortion closeBracket + { + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init($3, $4, $2); + $$ = generalCombinerStruct; + } + | openBracket ConstColor ConstColor GeneralPortion GeneralPortion closeBracket + { + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init($4, $5, $2, $3); + $$ = generalCombinerStruct; + } + | openBracket GeneralPortion closeBracket + { + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init($2); + $$ = generalCombinerStruct; + } + | openBracket ConstColor GeneralPortion closeBracket + { + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init($3, $2); + $$ = generalCombinerStruct; + } + | openBracket ConstColor ConstColor GeneralPortion closeBracket + { + GeneralCombinerStruct generalCombinerStruct; + generalCombinerStruct.Init($4, $2, $3); + $$ = generalCombinerStruct; + } + ; + +GeneralPortion : PortionDesignator openBracket GeneralFunction BiasScale closeBracket + { + GeneralPortionStruct generalPortionStruct; + generalPortionStruct.Init($1, $3, $4); + $$ = generalPortionStruct; + } + | PortionDesignator openBracket GeneralFunction closeBracket + { + BiasScaleEnum noScale; + noScale.word = RCP_SCALE_BY_ONE; + GeneralPortionStruct generalPortionStruct; + generalPortionStruct.Init($1, $3, noScale); + $$ = generalPortionStruct; + } + ; + +PortionDesignator : rgb_portion + { + $$ = $1; + } + | alpha_portion + { + $$ = $1; + } + ; + +GeneralMappedRegister : Register + { + MappedRegisterStruct reg; + reg.Init($1, GL_SIGNED_IDENTITY_NV); + $$ = reg; + } + | minus Register + { + MappedRegisterStruct reg; + reg.Init($2, GL_SIGNED_NEGATE_NV); + $$ = reg; + } + | expandString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_EXPAND_NORMAL_NV); + $$ = reg; + } + | minus expandString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($4, GL_EXPAND_NEGATE_NV); + $$ = reg; + } + | halfBiasString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_HALF_BIAS_NORMAL_NV); + $$ = reg; + } + | minus halfBiasString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($4, GL_HALF_BIAS_NEGATE_NV); + $$ = reg; + } + | unsignedString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_IDENTITY_NV); + $$ = reg; + } + | unsignedInvertString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_INVERT_NV); + $$ = reg; + } + ; + +GeneralFunction : Dot Dot + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1, $2); + $$ = generalFunction; + } + | Dot Mul + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1, $2); + $$ = generalFunction; + } + | Mul Dot + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1, $2); + $$ = generalFunction; + } + | Dot + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1); + $$ = generalFunction; + } + | Mul Mul + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1, $2); + $$ = generalFunction; + } + | Mul Mul Mux + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1, $2, $3); + $$ = generalFunction; + } + | Mul Mul Sum + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1, $2, $3); + $$ = generalFunction; + } + | Mul + { + GeneralFunctionStruct generalFunction; + generalFunction.Init($1); + $$ = generalFunction; + } + ; + +Dot : Register equals GeneralMappedRegister dot GeneralMappedRegister semicolon + { + OpStruct dotFunction; + dotFunction.Init(RCP_DOT, $1, $3, $5); + $$ = dotFunction; + } + ; + +Mul : Register equals GeneralMappedRegister times GeneralMappedRegister semicolon + { + OpStruct mulFunction; + mulFunction.Init(RCP_MUL, $1, $3, $5); + $$ = mulFunction; + } + | Register equals GeneralMappedRegister semicolon + { + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct one; + one.Init(zero, GL_UNSIGNED_INVERT_NV); + OpStruct mulFunction; + mulFunction.Init(RCP_MUL, $1, $3, one); + $$ = mulFunction; + } + ; + +Mux : Register equals muxString openParen closeParen semicolon + { + OpStruct muxFunction; + muxFunction.Init(RCP_MUX, $1); + $$ = muxFunction; + } + ; + +Sum : Register equals sumString openParen closeParen semicolon + { + OpStruct sumFunction; + sumFunction.Init(RCP_SUM, $1); + $$ = sumFunction; + } + ; + +BiasScale : bias_by_negative_one_half_scale_by_two openParen closeParen semicolon + { + $$ = $1; + } + | bias_by_negative_one_half openParen closeParen semicolon + { + $$ = $1; + } + | scale_by_one_half openParen closeParen semicolon + { + $$ = $1; + } + | scale_by_two openParen closeParen semicolon + { + $$ = $1; + } + | scale_by_four openParen closeParen semicolon + { + $$ = $1; + } + ; + +FinalMappedRegister : Register + { + MappedRegisterStruct reg; + reg.Init($1, GL_UNSIGNED_IDENTITY_NV); + $$ = reg; + } + | unsignedString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_IDENTITY_NV); + $$ = reg; + } + | unsignedInvertString openParen Register closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_INVERT_NV); + $$ = reg; + } + | color_sum + { + MappedRegisterStruct reg; + reg.Init($1); + $$ = reg; + } + | unsignedString openParen color_sum closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_IDENTITY_NV); + $$ = reg; + } + | unsignedInvertString openParen color_sum closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_INVERT_NV); + $$ = reg; + } + | final_product + { + MappedRegisterStruct reg; + reg.Init($1); + $$ = reg; + } + | unsignedString openParen final_product closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_IDENTITY_NV); + $$ = reg; + } + | unsignedInvertString openParen final_product closeParen + { + MappedRegisterStruct reg; + reg.Init($3, GL_UNSIGNED_INVERT_NV); + $$ = reg; + } + ; + +FinalCombiner : FinalAlphaFunction FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($2, $1, false); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalAlphaFunction FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($3, $2, true); + $$ = finalCombinerStruct; + } + | FinalProduct FinalAlphaFunction FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($3, $2, false, $1); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalProduct FinalAlphaFunction FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($4, $3, true, $2); + $$ = finalCombinerStruct; + } + | FinalProduct ClampColorSum FinalAlphaFunction FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($4, $3, true, $1); + $$ = finalCombinerStruct; + } + + | FinalRgbFunction FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($1, $2, false); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalRgbFunction FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($2, $3, true); + $$ = finalCombinerStruct; + } + | FinalProduct FinalRgbFunction FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($2, $3, false, $1); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalProduct FinalRgbFunction FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($3, $4, true, $2); + $$ = finalCombinerStruct; + } + | FinalProduct ClampColorSum FinalRgbFunction FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + finalCombinerStruct.Init($3, $4, true, $1); + $$ = finalCombinerStruct; + } + + | FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init($1, finalAlphaFunctionStruct, false); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init($2, finalAlphaFunctionStruct, true); + $$ = finalCombinerStruct; + } + | FinalProduct FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init($2, finalAlphaFunctionStruct, false, $1); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalProduct FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init($3, finalAlphaFunctionStruct, true, $2); + $$ = finalCombinerStruct; + } + | FinalProduct ClampColorSum FinalRgbFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.ZeroOut(); + finalCombinerStruct.Init($3, finalAlphaFunctionStruct, true, $1); + $$ = finalCombinerStruct; + } + + | FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, $1, false); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, $2, true); + $$ = finalCombinerStruct; + } + | FinalProduct FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, $2, false, $1); + $$ = finalCombinerStruct; + } + | ClampColorSum FinalProduct FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, $3, true, $2); + $$ = finalCombinerStruct; + } + | FinalProduct ClampColorSum FinalAlphaFunction + { + FinalCombinerStruct finalCombinerStruct; + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.ZeroOut(); + finalCombinerStruct.Init(finalRgbFunctionStruct, $3, true, $1); + $$ = finalCombinerStruct; + } + ; + +ClampColorSum : clamp_color_sum openParen closeParen semicolon + { + $$ = $1; + } + ; + +FinalProduct : final_product equals FinalMappedRegister times FinalMappedRegister semicolon + { + FinalProductStruct finalProductStruct; + finalProductStruct.Init($3, $5); + $$ = finalProductStruct; + } + ; + +FinalRgbFunction : fragment_rgb equals lerp openParen FinalMappedRegister comma FinalMappedRegister comma FinalMappedRegister closeParen plus FinalMappedRegister semicolon + { + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init($5, $7, $9, $12); + $$ = finalRgbFunctionStruct; + } + | fragment_rgb equals FinalMappedRegister plus lerp openParen FinalMappedRegister comma FinalMappedRegister comma FinalMappedRegister closeParen semicolon + { + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init($7, $9, $11, $3); + $$ = finalRgbFunctionStruct; + } + | fragment_rgb equals lerp openParen FinalMappedRegister comma FinalMappedRegister comma FinalMappedRegister closeParen semicolon + { + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg; + reg.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init($5, $7, $9, reg); + $$ = finalRgbFunctionStruct; + } + | fragment_rgb equals FinalMappedRegister times FinalMappedRegister semicolon + { + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg1; + reg1.Init(zero, GL_UNSIGNED_IDENTITY_NV); + MappedRegisterStruct reg2; + reg2.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init($3, $5, reg1, reg2); + $$ = finalRgbFunctionStruct; + } + | fragment_rgb equals FinalMappedRegister times FinalMappedRegister plus FinalMappedRegister semicolon + { + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg1; + reg1.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init($3, $5, reg1, $7); + $$ = finalRgbFunctionStruct; + } + | fragment_rgb equals FinalMappedRegister semicolon + { + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg1; + reg1.Init(zero, GL_UNSIGNED_IDENTITY_NV); + MappedRegisterStruct reg2; + reg2.Init(zero, GL_UNSIGNED_IDENTITY_NV); + MappedRegisterStruct reg3; + reg3.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init(reg1, reg2, reg3, $3); + $$ = finalRgbFunctionStruct; + } + | fragment_rgb equals FinalMappedRegister plus FinalMappedRegister semicolon + { + RegisterEnum zero; + zero.word = RCP_ZERO; + MappedRegisterStruct reg2; + reg2.Init(zero, GL_UNSIGNED_INVERT_NV); + MappedRegisterStruct reg3; + reg3.Init(zero, GL_UNSIGNED_IDENTITY_NV); + FinalRgbFunctionStruct finalRgbFunctionStruct; + finalRgbFunctionStruct.Init($3, reg2, reg3, $5); + $$ = finalRgbFunctionStruct; + } + ; + +FinalAlphaFunction : fragment_alpha equals FinalMappedRegister semicolon + { + FinalAlphaFunctionStruct finalAlphaFunctionStruct; + finalAlphaFunctionStruct.Init($3); + $$ = finalAlphaFunctionStruct; + } + ; + +Register : constVariable + { + $$ = $1; + } + | regVariable + { + $$ = $1; + } + ; + +%% +void yyerror(char* s) +{ + errors.set("unrecognized token"); +} diff --git a/nvparse/rc1.0_register.h b/nvparse/rc1.0_register.h new file mode 100644 index 0000000..47f9337 --- /dev/null +++ b/nvparse/rc1.0_register.h @@ -0,0 +1,207 @@ +#ifndef _RC10_REGISTER_H +#define _RC10_REGISTER_H + +#ifdef _WIN32 +# include +# define BYTE_ORDER !BIG_ENDIAN +#endif + +#include +#include +#include "../glNV.h" + +#define RCP_NUM_GENERAL_COMBINERS 8 + +#define RCP_RGB 0 +#define RCP_ALPHA 1 +#define RCP_BLUE 2 +#define RCP_NONE 3 + +typedef union _RegisterEnum { + struct { +#if BYTE_ORDER != BIG_ENDIAN + unsigned int name :16; // OpenGL enum for register + unsigned int channel : 2; // RCP_RGB, RCP_ALPHA, etc + unsigned int readOnly : 1; // true or false + unsigned int finalOnly : 1; // true or false + unsigned int unused :12; +#else + unsigned int unused :12; + unsigned int finalOnly : 1; // true or false + unsigned int readOnly : 1; // true or false + unsigned int channel : 2; // RCP_RGB, RCP_ALPHA, RCP_BLUE, RCP_NONE + unsigned int name :16; // OpenGL enum for register +#endif + } bits; + unsigned int word; +} RegisterEnum; +// No need for writeOnly flag, since DISCARD is the only register in that category + +// WARNING: Don't monkey with the above structure or this macro +// unless you're absolutely sure of what you're doing! +// This constant allocation makes validation *much* cleaner. +#define RCP_SET_REGISTER_ENUM(name, channel, readonly, finalonly) \ + ((finalonly << 19) | (readonly << 18) | (channel << 16) | name) + +#define RCP_FOG_RGB RCP_SET_REGISTER_ENUM(GL_FOG, RCP_RGB, 1, 0) +#define RCP_FOG_ALPHA RCP_SET_REGISTER_ENUM(GL_FOG, RCP_ALPHA, 1, 1) +#define RCP_FOG_BLUE RCP_SET_REGISTER_ENUM(GL_FOG, RCP_BLUE, 1, 0) +#define RCP_FOG RCP_SET_REGISTER_ENUM(GL_FOG, RCP_NONE, 1, 0) +#define RCP_PRIMARY_COLOR_RGB RCP_SET_REGISTER_ENUM(GL_PRIMARY_COLOR_NV, RCP_RGB, 0, 0) +#define RCP_PRIMARY_COLOR_ALPHA RCP_SET_REGISTER_ENUM(GL_PRIMARY_COLOR_NV, RCP_ALPHA, 0, 0) +#define RCP_PRIMARY_COLOR_BLUE RCP_SET_REGISTER_ENUM(GL_PRIMARY_COLOR_NV, RCP_BLUE, 0, 0) +#define RCP_PRIMARY_COLOR RCP_SET_REGISTER_ENUM(GL_PRIMARY_COLOR_NV, RCP_NONE, 0, 0) +#define RCP_SECONDARY_COLOR_RGB RCP_SET_REGISTER_ENUM(GL_SECONDARY_COLOR_NV, RCP_RGB, 0, 0) +#define RCP_SECONDARY_COLOR_ALPHA RCP_SET_REGISTER_ENUM(GL_SECONDARY_COLOR_NV, RCP_ALPHA, 0, 0) +#define RCP_SECONDARY_COLOR_BLUE RCP_SET_REGISTER_ENUM(GL_SECONDARY_COLOR_NV, RCP_BLUE, 0, 0) +#define RCP_SECONDARY_COLOR RCP_SET_REGISTER_ENUM(GL_SECONDARY_COLOR_NV, RCP_NONE, 0, 0) +#define RCP_SPARE0_RGB RCP_SET_REGISTER_ENUM(GL_SPARE0_NV, RCP_RGB, 0, 0) +#define RCP_SPARE0_ALPHA RCP_SET_REGISTER_ENUM(GL_SPARE0_NV, RCP_ALPHA, 0, 0) +#define RCP_SPARE0_BLUE RCP_SET_REGISTER_ENUM(GL_SPARE0_NV, RCP_BLUE, 0, 0) +#define RCP_SPARE0 RCP_SET_REGISTER_ENUM(GL_SPARE0_NV, RCP_NONE, 0, 0) +#define RCP_SPARE1_RGB RCP_SET_REGISTER_ENUM(GL_SPARE1_NV, RCP_RGB, 0, 0) +#define RCP_SPARE1_ALPHA RCP_SET_REGISTER_ENUM(GL_SPARE1_NV, RCP_ALPHA, 0, 0) +#define RCP_SPARE1_BLUE RCP_SET_REGISTER_ENUM(GL_SPARE1_NV, RCP_BLUE, 0, 0) +#define RCP_SPARE1 RCP_SET_REGISTER_ENUM(GL_SPARE1_NV, RCP_NONE, 0, 0) +#define RCP_TEXTURE0_RGB RCP_SET_REGISTER_ENUM(GL_TEXTURE0_ARB, RCP_RGB, 0, 0) +#define RCP_TEXTURE0_ALPHA RCP_SET_REGISTER_ENUM(GL_TEXTURE0_ARB, RCP_ALPHA, 0, 0) +#define RCP_TEXTURE0_BLUE RCP_SET_REGISTER_ENUM(GL_TEXTURE0_ARB, RCP_BLUE, 0, 0) +#define RCP_TEXTURE0 RCP_SET_REGISTER_ENUM(GL_TEXTURE0_ARB, RCP_NONE, 0, 0) +#define RCP_TEXTURE1_RGB RCP_SET_REGISTER_ENUM(GL_TEXTURE1_ARB, RCP_RGB, 0, 0) +#define RCP_TEXTURE1_ALPHA RCP_SET_REGISTER_ENUM(GL_TEXTURE1_ARB, RCP_ALPHA, 0, 0) +#define RCP_TEXTURE1_BLUE RCP_SET_REGISTER_ENUM(GL_TEXTURE1_ARB, RCP_BLUE, 0, 0) +#define RCP_TEXTURE1 RCP_SET_REGISTER_ENUM(GL_TEXTURE1_ARB, RCP_NONE, 0, 0) +#define RCP_TEXTURE2_RGB RCP_SET_REGISTER_ENUM(GL_TEXTURE2_ARB, RCP_RGB, 0, 0) +#define RCP_TEXTURE2_ALPHA RCP_SET_REGISTER_ENUM(GL_TEXTURE2_ARB, RCP_ALPHA, 0, 0) +#define RCP_TEXTURE2_BLUE RCP_SET_REGISTER_ENUM(GL_TEXTURE2_ARB, RCP_BLUE, 0, 0) +#define RCP_TEXTURE2 RCP_SET_REGISTER_ENUM(GL_TEXTURE2_ARB, RCP_NONE, 0, 0) +#define RCP_TEXTURE3_RGB RCP_SET_REGISTER_ENUM(GL_TEXTURE3_ARB, RCP_RGB, 0, 0) +#define RCP_TEXTURE3_ALPHA RCP_SET_REGISTER_ENUM(GL_TEXTURE3_ARB, RCP_ALPHA, 0, 0) +#define RCP_TEXTURE3_BLUE RCP_SET_REGISTER_ENUM(GL_TEXTURE3_ARB, RCP_BLUE, 0, 0) +#define RCP_TEXTURE3 RCP_SET_REGISTER_ENUM(GL_TEXTURE3_ARB, RCP_NONE, 0, 0) +#define RCP_CONST_COLOR0_RGB RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR0_NV, RCP_RGB, 1, 0) +#define RCP_CONST_COLOR0_ALPHA RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR0_NV, RCP_ALPHA, 1, 0) +#define RCP_CONST_COLOR0_BLUE RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR0_NV, RCP_BLUE, 1, 0) +#define RCP_CONST_COLOR0 RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR0_NV, RCP_NONE, 1, 0) +#define RCP_CONST_COLOR1_RGB RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR1_NV, RCP_RGB, 1, 0) +#define RCP_CONST_COLOR1_ALPHA RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR1_NV, RCP_ALPHA, 1, 0) +#define RCP_CONST_COLOR1_BLUE RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR1_NV, RCP_BLUE, 1, 0) +#define RCP_CONST_COLOR1 RCP_SET_REGISTER_ENUM(GL_CONSTANT_COLOR1_NV, RCP_NONE, 1, 0) +#define RCP_ZERO_RGB RCP_SET_REGISTER_ENUM(GL_ZERO, RCP_RGB, 1, 0) +#define RCP_ZERO_ALPHA RCP_SET_REGISTER_ENUM(GL_ZERO, RCP_ALPHA, 1, 0) +#define RCP_ZERO_BLUE RCP_SET_REGISTER_ENUM(GL_ZERO, RCP_BLUE, 1, 0) +#define RCP_ZERO RCP_SET_REGISTER_ENUM(GL_ZERO, RCP_NONE, 1, 0) +#define RCP_ONE_RGB RCP_SET_REGISTER_ENUM(GL_ONE, RCP_RGB, 1, 0) +#define RCP_ONE_ALPHA RCP_SET_REGISTER_ENUM(GL_ONE, RCP_ALPHA, 1, 0) +#define RCP_ONE_BLUE RCP_SET_REGISTER_ENUM(GL_ONE, RCP_BLUE, 1, 0) +#define RCP_ONE RCP_SET_REGISTER_ENUM(GL_ONE, RCP_NONE, 1, 0) +#define RCP_DISCARD RCP_SET_REGISTER_ENUM(GL_DISCARD_NV, RCP_NONE, 0, 0) +#define RCP_FINAL_PRODUCT RCP_SET_REGISTER_ENUM(GL_E_TIMES_F_NV, RCP_NONE, 1, 1) +#define RCP_COLOR_SUM RCP_SET_REGISTER_ENUM(GL_SPARE0_PLUS_SECONDARY_COLOR_NV, RCP_NONE, 1, 1) + +#define MAP_CHANNEL(channel) ((RCP_RGB == (channel)) ? GL_RGB : (RCP_ALPHA == (channel) ? GL_ALPHA : GL_BLUE)) + +typedef union _BiasScaleEnum { + struct { +#if BYTE_ORDER != BIG_ENDIAN + unsigned int bias :16; // OpenGL enum for bias + unsigned int scale :16; // OpenGL enum for scale +#else + unsigned int scale :16; // OpenGL enum for scale + unsigned int bias :16; // OpenGL enum for bias +#endif + } bits; + unsigned int word; +} BiasScaleEnum; + +// WARNING: Don't monkey with the above structure or this macro +// unless you're absolutely sure of what you're doing! +// This constant allocation makes validation *much* cleaner. +#define RCP_SET_BIAS_SCALE_ENUM(bias, scale) ((scale << 16) | bias) + +#define RCP_BIAS_BY_NEGATIVE_ONE_HALF_SCALE_BY_TWO RCP_SET_BIAS_SCALE_ENUM(GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_SCALE_BY_TWO_NV) +#define RCP_BIAS_BY_NEGATIVE_ONE_HALF RCP_SET_BIAS_SCALE_ENUM(GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_NONE) +#define RCP_SCALE_BY_ONE_HALF RCP_SET_BIAS_SCALE_ENUM(GL_NONE, GL_SCALE_BY_ONE_HALF_NV) +#define RCP_SCALE_BY_ONE RCP_SET_BIAS_SCALE_ENUM(GL_NONE, GL_NONE) +#define RCP_SCALE_BY_TWO RCP_SET_BIAS_SCALE_ENUM(GL_NONE, GL_SCALE_BY_TWO_NV) +#define RCP_SCALE_BY_FOUR RCP_SET_BIAS_SCALE_ENUM(GL_NONE, GL_SCALE_BY_FOUR_NV) + +class MappedRegisterStruct { +public: + void Init(RegisterEnum _reg, int _map = GL_UNSIGNED_IDENTITY_NV) + { + if (RCP_ONE == _reg.bits.name) { + _reg.bits.name = RCP_ZERO; + switch (_map) { + case GL_UNSIGNED_IDENTITY_NV: + _map = GL_UNSIGNED_INVERT_NV; + break; + case GL_UNSIGNED_INVERT_NV: + _map = GL_UNSIGNED_IDENTITY_NV; + break; + case GL_EXPAND_NORMAL_NV: + _map = GL_UNSIGNED_INVERT_NV; + break; + case GL_EXPAND_NEGATE_NV: + _map = GL_EXPAND_NORMAL_NV; + break; + case GL_HALF_BIAS_NORMAL_NV: + _map = GL_HALF_BIAS_NEGATE_NV; + break; + case GL_HALF_BIAS_NEGATE_NV: + _map = GL_HALF_BIAS_NORMAL_NV; + break; + case GL_SIGNED_IDENTITY_NV: + _map = GL_UNSIGNED_INVERT_NV; + break; + case GL_SIGNED_NEGATE_NV: + _map = GL_EXPAND_NORMAL_NV; + break; + } + } + map = _map; + reg = _reg; + } + int map; + RegisterEnum reg; +}; + +#ifdef TEST_BIT_FIELDS + +class RegisterEnumTest { + public: + RegisterEnumTest() + { + RegisterEnum reg; + bool error = false; + + if (sizeof(reg.bits) != sizeof(reg.word)) + error = true; + + reg.word = 0; reg.bits.name = 0xFFFF; + if (RCP_SET_REGISTER_ENUM(0xFFFF, 0, 0, 0) != reg.word) + error = true; + + reg.word = 0; reg.bits.channel = 3; + if (RCP_SET_REGISTER_ENUM(0, 3, 0, 0) != reg.word) + error = true; + + reg.word = 0; reg.bits.readOnly = true; + if (RCP_SET_REGISTER_ENUM(0, 0, 1, 0) != reg.word) + error = true; + + reg.word = 0; reg.bits.finalOnly = true; + if (RCP_SET_REGISTER_ENUM(0, 0, 0, 1) != reg.word) + error = true; + + if (error) { + fprintf(stderr, "ERROR: Bit Fields were not compiled correctly in " __FILE__ "!\n"); + exit(1); + } + } +}; + +static RegisterEnumTest registerEnumTest; +#endif + +#endif diff --git a/nvparse/rc1.0_tokens.l b/nvparse/rc1.0_tokens.l new file mode 100644 index 0000000..aeaa5c5 --- /dev/null +++ b/nvparse/rc1.0_tokens.l @@ -0,0 +1,410 @@ +/* definitions */ +digit [0-9] +char [a-zA-Z_.] +alphanum [0-9a-zA-Z_] + +%{ /* code to be included */ + +#include +#include +#include "rc1.0_combiners.h" +#include "_rc1.0_parser.h" + +#ifdef _WIN32 +# include +#endif + +#include +#include +#include "nvparse_errors.h" +#include "nvparse_externs.h" + +#define YY_INPUT(buf,result,max_size) \ +{ \ + result = 0; \ + while (*myin && result < max_size) \ + buf[result++] = *myin++; \ +} + +#define YY_ALWAYS_INTERACTIVE 1 + +%} +/* end of definitions */ +%% + +\/\* { + A: + switch (yyinput()) { + case '*': goto B; + case 0: errors.set("end-of-file in comment", line_number); break; + case '\n': line_number++; + default: goto A; + } + B: + switch (yyinput()) { + case '*': goto B; + case '/': break; + case 0: errors.set("end-of-file in comment", line_number); break; + case '\n': line_number++; + default: goto A; + } + } + +\/\/ { + char ch; + while ((ch = yyinput()) != '\n'); + if (ch == '\n') line_number++; + } + +\# { + char ch; + while ((ch = yyinput()) != '\n'); + if (ch == '\n') line_number++; + } + +!!RC1\.0 { /* eat header */ } + +fog\.rgb { + rc10_lval.registerEnum.word = RCP_FOG_RGB; + return(regVariable); + } +fog\.a { + rc10_lval.registerEnum.word = RCP_FOG_ALPHA; + return(regVariable); + } +fog\.b { + rc10_lval.registerEnum.word = RCP_FOG_BLUE; + return(regVariable); + } +fog { + rc10_lval.registerEnum.word = RCP_FOG; + return(regVariable); + } + +col0\.rgb { + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR_RGB; + return(regVariable); + } +col0\.a { + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR_ALPHA; + return(regVariable); + } +col0\.b { + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR_BLUE; + return(regVariable); + } +col0 { + rc10_lval.registerEnum.word = RCP_PRIMARY_COLOR; + return(regVariable); + } + +col1\.rgb { + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR_RGB; + return(regVariable); + } +col1\.a { + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR_ALPHA; + return(regVariable); + } +col1\.b { + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR_BLUE; + return(regVariable); + } +col1 { + rc10_lval.registerEnum.word = RCP_SECONDARY_COLOR; + return(regVariable); + } + +spare0\.rgb { + rc10_lval.registerEnum.word = RCP_SPARE0_RGB; + return(regVariable); + } +spare0\.a { + rc10_lval.registerEnum.word = RCP_SPARE0_ALPHA; + return(regVariable); + } +spare0\.b { + rc10_lval.registerEnum.word = RCP_SPARE0_BLUE; + return(regVariable); + } +spare0 { + rc10_lval.registerEnum.word = RCP_SPARE0; + return(regVariable); + } + +spare1\.rgb { + rc10_lval.registerEnum.word = RCP_SPARE1_RGB; + return(regVariable); + } +spare1\.a { + rc10_lval.registerEnum.word = RCP_SPARE1_ALPHA; + return(regVariable); + } +spare1\.b { + rc10_lval.registerEnum.word = RCP_SPARE1_BLUE; + return(regVariable); + } +spare1 { + rc10_lval.registerEnum.word = RCP_SPARE1; + return(regVariable); + } + +tex0\.rgb { + rc10_lval.registerEnum.word = RCP_TEXTURE0_RGB; + return(regVariable); + } +tex0\.a { + rc10_lval.registerEnum.word = RCP_TEXTURE0_ALPHA; + return(regVariable); + } +tex0\.b { + rc10_lval.registerEnum.word = RCP_TEXTURE0_BLUE; + return(regVariable); + } +tex0 { + rc10_lval.registerEnum.word = RCP_TEXTURE0; + return(regVariable); + } + +tex1\.rgb { + rc10_lval.registerEnum.word = RCP_TEXTURE1_RGB; + return(regVariable); + } +tex1\.a { + rc10_lval.registerEnum.word = RCP_TEXTURE1_ALPHA; + return(regVariable); + } +tex1\.b { + rc10_lval.registerEnum.word = RCP_TEXTURE1_BLUE; + return(regVariable); + } +tex1 { + rc10_lval.registerEnum.word = RCP_TEXTURE1; + return(regVariable); + } + +tex2\.rgb { + rc10_lval.registerEnum.word = RCP_TEXTURE2_RGB; + return(regVariable); + } +tex2\.a { + rc10_lval.registerEnum.word = RCP_TEXTURE2_ALPHA; + return(regVariable); + } +tex2\.b { + rc10_lval.registerEnum.word = RCP_TEXTURE2_BLUE; + return(regVariable); + } +tex2 { + rc10_lval.registerEnum.word = RCP_TEXTURE2; + return(regVariable); + } + +tex3\.rgb { + rc10_lval.registerEnum.word = RCP_TEXTURE3_RGB; + return(regVariable); + } +tex3\.a { + rc10_lval.registerEnum.word = RCP_TEXTURE3_ALPHA; + return(regVariable); + } +tex3\.b { + rc10_lval.registerEnum.word = RCP_TEXTURE3_BLUE; + return(regVariable); + } +tex3 { + rc10_lval.registerEnum.word = RCP_TEXTURE3; + return(regVariable); + } + +const0\.rgb { + rc10_lval.registerEnum.word = RCP_CONST_COLOR0_RGB; + return(regVariable); + } +const0\.a { + rc10_lval.registerEnum.word = RCP_CONST_COLOR0_ALPHA; + return(regVariable); + } +const0\.b { + rc10_lval.registerEnum.word = RCP_CONST_COLOR0_BLUE; + return(regVariable); + } +const0 { + rc10_lval.registerEnum.word = RCP_CONST_COLOR0; + return(constVariable); + } + +const1\.rgb { + rc10_lval.registerEnum.word = RCP_CONST_COLOR1_RGB; + return(regVariable); + } +const1\.a { + rc10_lval.registerEnum.word = RCP_CONST_COLOR1_ALPHA; + return(regVariable); + } +const1\.b { + rc10_lval.registerEnum.word = RCP_CONST_COLOR1_BLUE; + return(regVariable); + } +const1 { + rc10_lval.registerEnum.word = RCP_CONST_COLOR1; + return(constVariable); + } + +zero\.rgb { + rc10_lval.registerEnum.word = RCP_ZERO_RGB; + return(regVariable); + } +zero\.a { + rc10_lval.registerEnum.word = RCP_ZERO_ALPHA; + return(regVariable); + } +zero\.b { + rc10_lval.registerEnum.word = RCP_ZERO_BLUE; + return(regVariable); + } +zero { + rc10_lval.registerEnum.word = RCP_ZERO; + return(regVariable); + } + +one\.rgb { + rc10_lval.registerEnum.word = RCP_ONE_RGB; + return(regVariable); + } +one\.a { + rc10_lval.registerEnum.word = RCP_ONE_ALPHA; + return(regVariable); + } +one\.b { + rc10_lval.registerEnum.word = RCP_ONE_BLUE; + return(regVariable); + } +one { + rc10_lval.registerEnum.word = RCP_ONE; + return(regVariable); + } + +discard { + rc10_lval.registerEnum.word = RCP_DISCARD; + return(regVariable); + } + +out\.rgb return(fragment_rgb); +out\.a return(fragment_alpha); + +final_product { + rc10_lval.registerEnum.word = RCP_FINAL_PRODUCT; + return(final_product); + } + +color_sum { + rc10_lval.registerEnum.word = RCP_COLOR_SUM; + return(color_sum); + } + +expand return(expandString); +half_bias return(halfBiasString); +unsigned return(unsignedString); +unsigned_invert return(unsignedInvertString); +mux { + rc10_lval.ival = GL_TRUE; + return(muxString); + } + +sum { + rc10_lval.ival = GL_FALSE; + return(sumString); + } + +rgb { + rc10_lval.ival = RCP_RGB; + return(rgb_portion); + } +alpha { + rc10_lval.ival = RCP_ALPHA; + return(alpha_portion); + } + +clamp_color_sum { + rc10_lval.ival = true; + return(clamp_color_sum); + } +lerp return(lerp); + + +bias_by_negative_one_half_scale_by_two { + rc10_lval.biasScaleEnum.word = RCP_BIAS_BY_NEGATIVE_ONE_HALF_SCALE_BY_TWO; + return(bias_by_negative_one_half_scale_by_two); + } +bias_by_negative_one_half { + rc10_lval.biasScaleEnum.word = RCP_BIAS_BY_NEGATIVE_ONE_HALF; + return(bias_by_negative_one_half); + } +scale_by_one_half { + rc10_lval.biasScaleEnum.word = RCP_SCALE_BY_ONE_HALF; + return(scale_by_one_half); + } +scale_by_two { + rc10_lval.biasScaleEnum.word = RCP_SCALE_BY_TWO; + return(scale_by_two); + } +scale_by_four { + rc10_lval.biasScaleEnum.word = RCP_SCALE_BY_FOUR; + return(scale_by_four); + } + +[+-]?[0-9]+\.[0-9]* { + rc10_lval.fval = (float)atof(yytext); + return(floatValue); + } + +[+-]?[0-9]*\.[0-9]+ { + rc10_lval.fval = (float)atof(yytext); + return(floatValue); + } + +[+-]?[0-9]+ { + rc10_lval.fval = (float)atof(yytext); + return(floatValue); + } + +\{ return(openBracket); +\} return(closeBracket); +\( return(openParen); +\) return(closeParen); +; return(semicolon); +, return(comma); +\. return(dot); +\* return(times); +- return(minus); +\+ return(plus); += return(equals); + +\r*\n { + line_number++; + } + +[ \t]+ {} + +{alphanum}+ { + errors.set("unrecognized token", line_number); + } + + +%% + +bool rc10_init_more(); + +bool rc10_init(char* inputString) +{ + myin = inputString; + return rc10_init_more(); +} + +#ifndef rc10_wrap +int rc10_wrap(void) +{ + return(1); +} +#endif