From: bruneton Date: Mon, 21 Oct 2013 09:57:37 +0000 (+0000) Subject: CMake: porting module to the new CMake procedure. X-Git-Tag: V7_3_0a1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7757c27cd83572b1032fda8315136097b15cc25e;p=modules%2Fparavis.git CMake: porting module to the new CMake procedure. Isolated as much as possible IDL wrapping logic. Introduced flag SALOME_PARAVIS_MINIMAL_CORBA to turn the wrapping off. --- diff --git a/src/ParaView/lex.yy.c b/src/ParaView/lex.yy.c deleted file mode 100644 index a6c44384..00000000 --- a/src/ParaView/lex.yy.c +++ /dev/null @@ -1,4722 +0,0 @@ -#line 2 "lex.yy.c" - -#line 4 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#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. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - yy_size_t yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -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. - */ - yy_size_t 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; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* 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 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* 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". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* 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 (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (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 = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 173 -#define YY_END_OF_BUFFER 174 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[1116] = - { 0, - 0, 0, 174, 172, 142, 143, 143, 171, 172, 171, - 171, 172, 171, 171, 171, 171, 171, 171, 171, 140, - 139, 171, 171, 171, 171, 133, 133, 133, 133, 133, - 133, 169, 172, 170, 171, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 171, 142, 11, 11, 14, 171, - 172, 142, 164, 0, 15, 0, 157, 161, 158, 0, - 0, 0, 116, 117, 0, 0, 0, 0, 155, 151, - 153, 152, 154, 149, 147, 0, 134, 1, 13, 156, - 135, 138, 0, 0, 139, 139, 139, 168, 146, 165, - - 163, 166, 150, 133, 133, 133, 133, 133, 133, 133, - 133, 141, 0, 160, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 70, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 159, 162, 142, 11, 14, - 0, 0, 14, 14, 12, 0, 15, 16, 16, 0, - 0, 0, 0, 0, 148, 167, 134, 134, 13, 135, - 135, 138, 138, 0, 136, 137, 144, 145, 133, 133, - 133, 133, 0, 133, 133, 133, 133, 133, 133, 133, - - 133, 133, 68, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 25, - 133, 133, 133, 133, 58, 72, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 74, 12, 14, 12, 12, 12, 12, 0, 0, - 0, 0, 0, 0, 0, 134, 0, 135, 136, 137, - 133, 133, 133, 133, 0, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 66, 133, 133, 29, - 24, 133, 133, 133, 133, 133, 133, 42, 133, 133, - - 133, 133, 133, 133, 23, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 0, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 28, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 12, 12, 12, 12, - 12, 12, 12, 12, 0, 0, 0, 0, 0, 133, - 133, 133, 133, 128, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 77, 37, - 78, 45, 133, 133, 133, 133, 133, 20, 133, 133, - 133, 133, 133, 133, 133, 71, 133, 133, 133, 133, - - 133, 133, 22, 133, 133, 133, 133, 133, 0, 133, - 133, 133, 61, 133, 133, 43, 133, 57, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 12, 12, 12, 12, 12, 12, - 12, 2, 3, 0, 0, 0, 0, 0, 133, 133, - 133, 133, 128, 133, 133, 133, 121, 133, 133, 133, - 133, 133, 133, 133, 133, 69, 76, 133, 59, 19, - 133, 133, 52, 49, 50, 133, 133, 133, 73, 133, - 133, 133, 133, 39, 133, 133, 133, 27, 30, 133, - 51, 0, 0, 0, 133, 38, 133, 133, 133, 133, - - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 75, 12, 12, 12, 2, - 3, 12, 12, 12, 2, 3, 0, 0, 0, 0, - 0, 133, 133, 133, 133, 133, 133, 133, 120, 133, - 131, 133, 133, 133, 21, 133, 133, 133, 133, 133, - 133, 47, 133, 133, 133, 40, 133, 0, 133, 133, - 133, 31, 133, 0, 0, 0, 124, 124, 133, 55, - 133, 133, 44, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 0, 12, 12, 12, 2, 3, 12, - - 12, 12, 0, 0, 0, 0, 0, 118, 119, 121, - 17, 121, 32, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 60, 123, 123, 133, 48, 122, - 122, 0, 133, 0, 67, 133, 0, 36, 133, 0, - 0, 0, 53, 54, 26, 46, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 12, - 12, 12, 5, 12, 12, 0, 0, 0, 0, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 56, 0, - 41, 0, 133, 133, 0, 0, 0, 133, 133, 133, - - 133, 133, 133, 133, 79, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 5, 12, 12, 5, 12, 12, 0, 0, 133, 132, - 133, 133, 130, 64, 133, 0, 0, 0, 133, 133, - 0, 0, 0, 133, 133, 133, 133, 133, 133, 133, - 18, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 5, 12, 12, 12, 12, - 0, 4, 133, 133, 133, 133, 0, 0, 0, 133, - 62, 0, 0, 0, 133, 133, 133, 81, 133, 133, - 133, 133, 80, 133, 133, 133, 133, 133, 133, 133, - - 133, 106, 133, 133, 133, 133, 133, 133, 12, 12, - 12, 12, 0, 133, 133, 133, 63, 0, 0, 0, - 133, 0, 0, 133, 127, 133, 133, 133, 133, 133, - 133, 133, 133, 125, 133, 108, 110, 112, 102, 133, - 133, 133, 133, 107, 133, 133, 133, 12, 12, 12, - 12, 0, 133, 133, 129, 0, 0, 0, 33, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 109, 111, 113, 133, 133, 133, 12, 12, 12, 12, - 12, 12, 12, 0, 133, 133, 0, 34, 0, 133, - - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 114, 115, 133, - 133, 133, 133, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 0, 133, 104, 0, 133, 87, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 6, 133, - 0, 35, 65, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 84, 133, 133, 133, 133, 133, 133, 133, - 133, 126, 133, 133, 12, 12, 12, 12, 6, 12, - - 12, 12, 12, 6, 133, 133, 133, 86, 83, 133, - 133, 133, 133, 97, 85, 82, 133, 133, 133, 133, - 96, 133, 133, 133, 12, 12, 12, 12, 6, 12, - 12, 12, 12, 105, 133, 133, 92, 93, 94, 95, - 88, 89, 90, 91, 133, 133, 133, 12, 12, 12, - 12, 12, 12, 12, 12, 133, 133, 133, 133, 133, - 12, 12, 12, 12, 10, 12, 12, 12, 100, 133, - 103, 133, 133, 10, 12, 12, 12, 10, 12, 8, - 9, 133, 133, 133, 10, 12, 8, 9, 12, 8, - 9, 133, 133, 133, 12, 8, 9, 12, 133, 133, - - 99, 12, 7, 133, 133, 7, 7, 133, 133, 7, - 133, 98, 133, 101, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 6, 7, 8, 9, 1, 10, 11, 12, 13, - 14, 15, 16, 14, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 25, 27, 25, 28, 14, 29, - 30, 31, 1, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 40, - 58, 59, 60, 61, 62, 1, 63, 64, 65, 66, - - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 14, 89, 14, 14, 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 flex_int32_t yy_meta[90] = - { 0, - 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, - 2, 4, 1, 1, 2, 1, 1, 5, 1, 6, - 6, 6, 6, 6, 6, 6, 6, 7, 1, 1, - 1, 1, 8, 8, 8, 8, 8, 8, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, - 1, 9, 8, 8, 8, 8, 8, 8, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 1 - } ; - -static yyconst flex_int16_t yy_base[1153] = - { 0, - 0, 88, 2594, 2595, 90, 2595, 2595, 2563, 87, 2562, - 87, 2532, 97, 2595, 2560, 85, 88, 113, 91, 133, - 151, 2561, 84, 2558, 92, 63, 2525, 83, 42, 128, - 85, 2595, 124, 2595, 2556, 2523, 103, 120, 122, 136, - 119, 87, 125, 86, 79, 145, 147, 131, 148, 159, - 164, 162, 171, 106, 113, 252, 2595, 2595, 2525, 217, - 2512, 214, 2595, 158, 2595, 186, 2595, 2595, 2595, 223, - 227, 257, 2595, 2595, 116, 2554, 216, 209, 2595, 2595, - 2595, 2595, 2595, 2566, 2595, 2562, 254, 2595, 0, 2595, - 273, 293, 311, 0, 321, 341, 353, 2595, 2549, 2595, - - 2595, 2595, 2548, 2515, 205, 227, 208, 335, 241, 142, - 239, 2595, 2573, 2595, 344, 221, 226, 240, 247, 203, - 242, 323, 321, 267, 324, 322, 339, 325, 332, 334, - 244, 328, 329, 352, 351, 356, 287, 2513, 357, 358, - 261, 361, 360, 362, 371, 378, 372, 366, 381, 383, - 386, 387, 389, 393, 390, 2595, 2595, 466, 2595, 2515, - 2554, 2501, 2512, 471, 447, 276, 248, 2595, 444, 2542, - 2541, 437, 433, 434, 2595, 2595, 466, 484, 0, 492, - 511, 521, 533, 541, 549, 557, 2595, 2595, 458, 417, - 478, 462, 2540, 2505, 461, 420, 523, 459, 293, 421, - - 524, 80, 2504, 525, 536, 526, 534, 545, 539, 546, - 542, 541, 330, 553, 556, 549, 569, 567, 548, 2503, - 571, 573, 574, 576, 2502, 2501, 577, 603, 579, 582, - 585, 584, 583, 586, 588, 587, 593, 437, 590, 625, - 602, 599, 594, 607, 613, 617, 616, 614, 291, 618, - 661, 2500, 683, 679, 0, 665, 2509, 2508, 2481, 2476, - 716, 656, 666, 658, 723, 731, 739, 747, 755, 763, - 662, 663, 670, 664, 0, 758, 743, 647, 666, 731, - 672, 741, 732, 637, 668, 770, 2495, 742, 744, 2494, - 2493, 753, 747, 754, 757, 761, 750, 2492, 746, 771, - - 776, 778, 779, 673, 2491, 780, 781, 808, 784, 786, - 674, 787, 790, 797, 791, 794, 798, 804, 2490, 802, - 811, 2523, 801, 816, 812, 467, 817, 822, 823, 825, - 826, 2488, 828, 827, 833, 829, 835, 837, 839, 838, - 844, 845, 846, 849, 850, 876, 0, 900, 2497, 2496, - 868, 2480, 2490, 2489, 2470, 2476, 894, 895, 896, 873, - 880, 895, 893, 0, 877, 896, 887, 900, 883, 885, - 886, 890, 884, 927, 894, 892, 898, 899, 2480, 2479, - 2478, 2477, 905, 907, 908, 906, 914, 2476, 916, 913, - 921, 919, 923, 924, 925, 2475, 929, 926, 932, 933, - - 934, 937, 2474, 938, 940, 968, 2473, 948, 938, 949, - 952, 958, 2472, 955, 961, 2471, 963, 2470, 964, 966, - 967, 969, 970, 971, 983, 974, 976, 980, 979, 978, - 985, 981, 993, 992, 1014, 2464, 2474, 2473, 2495, 2490, - 2445, 0, 0, 2458, 2444, 1034, 1035, 1036, 1016, 1017, - 1034, 1035, 0, 1020, 1036, 1040, 1026, 1014, 1018, 1021, - 1019, 1025, 1065, 1031, 1039, 2461, 2460, 1054, 2459, 2458, - 1041, 1037, 2457, 2456, 2455, 1043, 1045, 1047, 2454, 1049, - 1053, 1055, 1051, 1118, 1063, 1052, 1067, 2453, 2452, 1094, - 2451, 2431, 2430, 2428, 1180, 2447, 1072, 1073, 1074, 1075, - - 1076, 1077, 1078, 1081, 1083, 1108, 1084, 1104, 1181, 1096, - 1101, 1099, 1151, 1103, 1186, 2446, 2474, 2469, 2424, 0, - 0, 2459, 2468, 2437, 0, 0, 2426, 2432, 1187, 1139, - 1216, 1116, 1117, 1184, 1168, 1187, 1190, 1185, 2437, 1189, - 2436, 1155, 1172, 1192, 2435, 1183, 1196, 1198, 2434, 1194, - 1276, 2433, 1110, 1247, 1365, 1260, 1205, 1268, 1248, 1251, - 1336, 2432, 1278, 2411, 2410, 2411, 2595, 2428, 1249, 2427, - 1250, 1252, 2426, 1257, 1258, 1288, 1264, 1268, 1283, 1270, - 1284, 1337, 1338, 1286, 1291, 1293, 1339, 1294, 1340, 1367, - 1341, 1349, 1296, 2459, 2441, 2450, 2419, 0, 0, 2446, - - 2430, 2401, 2413, 2416, 1376, 1385, 1429, 2595, 2450, 1368, - 2415, 1388, 2414, 2413, 1375, 2412, 1376, 1377, 1347, 1378, - 1379, 1381, 1380, 1408, 2411, 2595, 2410, 1395, 2409, 2595, - 2408, 1461, 1297, 2395, 2406, 1385, 1466, 2595, 1344, 2387, - 2386, 2394, 2402, 2401, 2400, 2399, 1386, 1394, 1396, 1414, - 1261, 1413, 1415, 1419, 1420, 1421, 1423, 1427, 1428, 1430, - 1429, 1436, 1384, 1434, 1438, 1460, 1440, 1441, 1469, 2423, - 2407, 2378, 0, 2416, 2385, 2379, 2389, 1509, 1523, 1470, - 1473, 1479, 1451, 1455, 1465, 1472, 1461, 1482, 2391, 2378, - 1547, 2374, 1492, 1474, 2383, 2382, 2372, 1485, 1478, 1498, - - 1486, 1500, 1501, 1494, 2385, 1502, 1507, 1508, 1511, 1512, - 1513, 1515, 1517, 1518, 1519, 1523, 1525, 1529, 1528, 1527, - 0, 2405, 2374, 0, 2397, 2365, 2360, 2374, 1213, 2378, - 1536, 1535, 2377, 2376, 1531, 2360, 1608, 2354, 1537, 1541, - 2372, 2371, 2364, 1560, 1553, 1555, 1556, 1562, 1544, 1563, - 2370, 1564, 1566, 1567, 1568, 1569, 1572, 1573, 1624, 1575, - 1587, 1577, 1590, 1591, 1592, 0, 2384, 2352, 2383, 2346, - 2364, 2595, 1605, 1608, 2364, 1595, 2343, 2350, 2342, 2360, - 2359, 2345, 2344, 0, 1599, 1601, 1612, 2356, 1603, 1606, - 1604, 1631, 2355, 1609, 1610, 1616, 1618, 1619, 1656, 1661, - - 1666, 2354, 1630, 1632, 1676, 1633, 1663, 1642, 2369, 2332, - 2407, 2341, 2329, 1652, 1668, 1669, 2348, 2328, 2331, 1706, - 1679, 0, 0, 1655, 2345, 1648, 1674, 1681, 1723, 1670, - 1692, 1694, 1729, 2344, 1698, 2343, 2342, 2341, 2340, 1686, - 1701, 1707, 1716, 2339, 1696, 1688, 1700, 2394, 2328, 1735, - 2321, 2326, 2334, 1711, 1705, 1777, 2313, 1787, 2595, 1725, - 1697, 1719, 1732, 1736, 1739, 1751, 1755, 1757, 1741, 1710, - 1744, 1746, 1765, 1766, 1767, 1769, 1758, 1796, 1798, 1761, - 2332, 2331, 2330, 1762, 1763, 1764, 1801, 2314, 2327, 2322, - 2321, 2320, 2310, 2308, 1805, 1784, 1842, 2595, 2303, 1770, - - 1772, 1788, 1791, 1792, 1799, 1801, 1803, 1806, 1809, 1797, - 1810, 1811, 1816, 1818, 1821, 1823, 1825, 2321, 2320, 1826, - 1827, 1829, 1830, 2318, 2313, 2312, 2311, 2301, 2292, 2294, - 2307, 2306, 2344, 2295, 1856, 2308, 1892, 1834, 2307, 1855, - 1839, 1842, 1845, 1846, 1850, 1859, 1851, 1837, 1861, 1863, - 1864, 1865, 1870, 1871, 1866, 1889, 1875, 1777, 1876, 2284, - 2286, 2299, 2298, 2336, 2296, 2297, 2355, 2354, 0, 1905, - 1947, 2595, 2297, 1885, 1892, 1880, 1883, 1893, 1894, 1896, - 1899, 1900, 2296, 1901, 1903, 1902, 1904, 1906, 1907, 1908, - 1909, 2295, 1919, 1921, 2289, 2290, 2348, 2341, 0, 2275, - - 2249, 2287, 2248, 0, 1944, 1927, 1929, 2240, 2231, 1931, - 1932, 1933, 1934, 2222, 2213, 2204, 1935, 1937, 1938, 1939, - 2174, 1940, 1942, 1955, 2164, 2138, 2176, 2137, 0, 2109, - 2115, 2102, 2097, 2105, 1945, 1957, 2097, 2093, 2089, 2084, - 2076, 2071, 2059, 2054, 1958, 1961, 1981, 2030, 2036, 2032, - 2031, 2023, 2018, 2000, 1999, 1959, 1965, 1967, 1968, 1969, - 1998, 2000, 1996, 1995, 0, 1992, 1995, 1994, 2007, 1971, - 2005, 1972, 1975, 0, 1916, 1687, 1442, 0, 1154, 0, - 0, 1979, 1990, 1983, 0, 1024, 0, 0, 784, 0, - 0, 1985, 1986, 1989, 733, 0, 0, 629, 2008, 1992, - - 550, 313, 0, 1996, 1993, 0, 0, 2000, 1998, 0, - 2002, 211, 2006, 47, 2595, 2083, 2092, 2100, 2105, 2109, - 2118, 2122, 2126, 2135, 2139, 2144, 2148, 2156, 2160, 2164, - 2173, 2175, 2179, 2188, 2197, 2206, 2215, 2224, 2233, 2242, - 2249, 2256, 2263, 2272, 2281, 2290, 2299, 2308, 2317, 2326, - 2335, 2344 - } ; - -static yyconst flex_int16_t yy_def[1153] = - { 0, - 1115, 1, 1115, 1115, 1115, 1115, 1115, 1115, 1116, 1115, - 1115, 1117, 1118, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1119, 1115, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, - 1120, 1115, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1121, 1115, - 1115, 1115, 1115, 1116, 1115, 1116, 1115, 1115, 1115, 1117, - 1117, 1118, 1115, 1115, 1122, 1122, 1122, 1122, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1123, 1115, 1124, 1115, - 1125, 1126, 1115, 1127, 1119, 1119, 1119, 1115, 1115, 1115, - - 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1121, - 1115, 1115, 1121, 1121, 1128, 1115, 1116, 1115, 1117, 1122, - 1115, 1122, 1122, 1122, 1115, 1115, 1123, 1123, 1124, 1125, - 1125, 1126, 1126, 1115, 1129, 1130, 1115, 1115, 1120, 1120, - 1120, 1120, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1131, 1121, 1128, 1128, 1128, 1128, 1115, 1115, - 1118, 1122, 1122, 1122, 1115, 1123, 1115, 1125, 1129, 1130, - 1120, 1120, 1120, 1120, 1132, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, - 1128, 1128, 1128, 1128, 1115, 1115, 1122, 1122, 1122, 1120, - 1120, 1120, 1120, 1133, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1115, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1128, 1128, - 1128, 1134, 1135, 1115, 1115, 1122, 1122, 1122, 1120, 1120, - 1120, 1120, 1133, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1136, - 1137, 1128, 1128, 1128, 1134, 1135, 1115, 1115, 1122, 1122, - 1122, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 495, 1120, 1120, 1120, 495, 1120, 1120, 1115, 1120, 1120, - 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1115, 1131, 1131, 1131, 1136, 1137, 1128, - - 1128, 1128, 1115, 1115, 1122, 1122, 1115, 1115, 1122, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1115, 1120, 1120, 1120, 1115, - 1120, 1115, 1120, 1115, 1120, 1120, 1115, 1115, 1120, 1115, - 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, - 1131, 1131, 1138, 1128, 1128, 1115, 1115, 1122, 1122, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1115, - 1120, 1115, 1120, 1120, 1115, 1115, 1115, 1120, 1120, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1139, 1131, 1131, 1138, 1128, 1128, 1115, 1115, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1120, 1120, - 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1139, 1131, 1131, 1128, 1128, - 1115, 1115, 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1120, - 1120, 1115, 1115, 1140, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, - 1128, 1128, 1115, 1120, 1120, 1120, 1120, 1115, 1115, 1115, - 1120, 1141, 1142, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1128, - 1128, 1115, 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1128, 1128, - 1128, 1128, 1128, 1115, 1120, 1120, 1115, 1115, 1115, 1120, - - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1131, 1128, 1128, - 1128, 1128, 1128, 1115, 1120, 1120, 1115, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, - 1131, 1131, 1131, 1131, 1128, 1128, 1128, 1128, 1143, 1120, - 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1144, 1128, - - 1128, 1128, 1128, 1143, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1144, 1128, - 1128, 1128, 1128, 1120, 1120, 1120, 1120, 1120, 1120, 1120, - 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1131, - 1131, 1128, 1128, 1128, 1128, 1120, 1120, 1120, 1120, 1120, - 1131, 1131, 1131, 1131, 1145, 1128, 1128, 1128, 1120, 1120, - 1120, 1120, 1120, 1146, 1131, 1131, 1131, 1145, 1128, 1147, - 1148, 1120, 1120, 1120, 1146, 1131, 1149, 1150, 1128, 1147, - 1148, 1120, 1120, 1120, 1131, 1149, 1150, 1128, 1120, 1120, - - 1120, 1131, 1151, 1120, 1120, 1152, 1151, 1120, 1120, 1152, - 1120, 1120, 1120, 1120, 0, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115 - } ; - -static yyconst flex_int16_t yy_nxt[2685] = - { 0, - 4, 5, 6, 7, 7, 5, 8, 9, 4, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, - 25, 4, 26, 27, 28, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 29, 27, - 27, 27, 27, 30, 31, 27, 27, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 27, 27, - 43, 27, 27, 44, 45, 46, 47, 48, 27, 49, - 50, 51, 52, 53, 27, 54, 27, 27, 55, 56, - 57, 62, 58, 56, 65, 62, 59, 68, 72, 72, - - 80, 72, 72, 108, 82, 88, 60, 73, 106, 89, - 105, 74, 99, 100, 81, 107, 69, 83, 84, 61, - 90, 102, 103, 109, 106, 111, 112, 85, 113, 75, - 86, 77, 87, 87, 87, 87, 87, 87, 87, 87, - 106, 106, 156, 171, 106, 66, 106, 106, 106, 285, - 91, 78, 92, 92, 92, 92, 92, 92, 92, 92, - 128, 133, 132, 172, 106, 65, 129, 106, 91, 93, - 95, 95, 95, 95, 95, 95, 95, 95, 116, 110, - 106, 106, 155, 106, 194, 117, 106, 97, 94, 106, - 118, 120, 106, 167, 126, 121, 119, 106, 122, 93, - - 130, 157, 123, 106, 127, 131, 106, 134, 106, 106, - 140, 135, 124, 141, 142, 62, 66, 97, 94, 62, - 106, 136, 125, 106, 137, 106, 138, 139, 143, 144, - 147, 88, 106, 148, 168, 165, 171, 150, 169, 145, - 146, 152, 151, 171, 66, 189, 90, 153, 173, 174, - 149, 191, 154, 158, 159, 65, 159, 158, 72, 72, - 160, 72, 72, 190, 106, 207, 106, 73, 193, 106, - 161, 74, 106, 87, 87, 87, 87, 87, 87, 87, - 87, 71, 106, 162, 195, 71, 203, 106, 106, 75, - 178, 77, 87, 87, 87, 87, 87, 87, 87, 87, - - 106, 106, 106, 106, 208, 106, 66, 204, 106, 181, - 91, 78, 92, 92, 92, 92, 92, 92, 92, 92, - 178, 205, 106, 206, 232, 221, 184, 184, 106, 183, - 185, 185, 185, 185, 185, 185, 185, 185, 91, 181, - 95, 95, 95, 95, 95, 95, 95, 95, 106, 212, - 259, 260, 106, 227, 106, 282, 332, 97, 1115, 183, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 184, 184, - 1115, 190, 185, 185, 185, 185, 185, 185, 185, 185, - 190, 192, 106, 106, 106, 106, 106, 97, 1106, 106, - 106, 106, 297, 106, 211, 106, 106, 209, 210, 213, - - 106, 217, 218, 222, 214, 106, 196, 219, 197, 198, - 223, 199, 106, 106, 200, 220, 215, 106, 106, 106, - 216, 106, 106, 106, 201, 202, 224, 106, 230, 233, - 236, 234, 106, 106, 231, 225, 235, 226, 229, 106, - 239, 238, 106, 240, 106, 243, 242, 106, 106, 237, - 106, 106, 256, 245, 106, 168, 247, 241, 244, 249, - 171, 171, 250, 246, 171, 251, 248, 158, 159, 252, - 159, 158, 272, 163, 160, 254, 263, 262, 106, 264, - 257, 106, 106, 258, 161, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 277, 271, 274, 283, 162, 106, 265, - - 265, 278, 71, 266, 266, 266, 266, 266, 266, 266, - 266, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 106, - 106, 273, 106, 106, 320, 281, 267, 267, 106, 164, - 268, 268, 268, 268, 268, 268, 268, 268, 1115, 106, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 184, 184, - 1115, 413, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, - 186, 186, 186, 186, 106, 106, 106, 106, 279, 186, - 186, 186, 186, 186, 186, 106, 280, 106, 288, 290, - - 106, 287, 106, 106, 296, 284, 106, 106, 295, 106, - 106, 106, 289, 291, 106, 300, 293, 106, 303, 186, - 186, 186, 186, 186, 186, 292, 294, 298, 106, 299, - 106, 301, 106, 302, 106, 106, 306, 106, 106, 190, - 106, 305, 307, 106, 106, 106, 106, 106, 106, 106, - 304, 106, 322, 315, 106, 106, 309, 314, 311, 319, - 106, 316, 318, 106, 106, 312, 313, 317, 106, 310, - 326, 321, 323, 327, 106, 106, 325, 106, 106, 106, - 333, 163, 351, 171, 324, 171, 106, 329, 348, 328, - 359, 330, 357, 171, 334, 331, 335, 336, 106, 337, - - 352, 338, 375, 362, 1103, 363, 339, 360, 106, 358, - 361, 340, 341, 342, 343, 344, 349, 1115, 1115, 350, - 1115, 1115, 106, 106, 106, 106, 73, 106, 369, 106, - 74, 106, 370, 106, 106, 106, 372, 164, 376, 391, - 397, 345, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 368, 365, 106, 106, 190, 1115, 1115, 1115, 1115, 1115, - - 1115, 366, 106, 106, 106, 106, 190, 106, 106, 1102, - 371, 106, 367, 374, 106, 106, 386, 378, 106, 106, - 381, 373, 106, 379, 385, 1115, 1115, 1115, 1115, 1115, - 1115, 106, 106, 380, 384, 382, 377, 106, 383, 106, - 106, 106, 106, 392, 190, 106, 395, 106, 106, 398, - 387, 106, 106, 389, 390, 106, 399, 388, 106, 106, - 1098, 393, 106, 106, 396, 106, 404, 400, 407, 106, - 405, 401, 106, 106, 394, 402, 410, 106, 106, 403, - 411, 408, 414, 106, 106, 412, 106, 106, 106, 106, - 106, 417, 415, 418, 106, 422, 106, 416, 106, 106, - - 106, 424, 425, 421, 427, 106, 106, 106, 419, 420, - 106, 106, 190, 439, 423, 426, 431, 435, 440, 428, - 430, 171, 171, 171, 449, 432, 450, 451, 447, 452, - 429, 433, 455, 454, 106, 436, 456, 106, 106, 446, - 457, 106, 434, 448, 106, 106, 106, 106, 106, 459, - 460, 106, 463, 106, 106, 106, 106, 106, 464, 106, - 106, 106, 458, 461, 467, 462, 106, 106, 106, 106, - 472, 469, 465, 470, 106, 106, 466, 106, 471, 475, - 106, 474, 106, 476, 106, 106, 106, 106, 106, 473, - 106, 481, 477, 106, 106, 106, 483, 484, 106, 106, - - 478, 106, 479, 486, 190, 488, 480, 482, 492, 106, - 106, 487, 491, 106, 493, 485, 106, 495, 494, 106, - 497, 498, 106, 499, 106, 106, 501, 106, 106, 106, - 106, 106, 106, 496, 507, 106, 502, 106, 500, 106, - 106, 106, 106, 503, 106, 510, 106, 505, 512, 489, - 504, 513, 506, 106, 106, 508, 511, 509, 515, 517, - 514, 171, 171, 171, 518, 532, 533, 530, 534, 535, - 516, 536, 538, 539, 537, 106, 531, 106, 106, 106, - 106, 106, 106, 542, 540, 529, 106, 106, 545, 544, - 190, 541, 106, 546, 1095, 106, 106, 106, 106, 543, - - 106, 106, 106, 547, 106, 549, 106, 550, 106, 553, - 106, 552, 106, 106, 106, 106, 106, 551, 548, 558, - 558, 556, 558, 558, 106, 554, 106, 555, 106, 559, - 190, 560, 557, 106, 106, 106, 106, 106, 106, 106, - 570, 572, 106, 576, 106, 106, 589, 561, 571, 573, - 574, 575, 578, 569, 579, 106, 583, 106, 580, 577, - 106, 581, 106, 591, 106, 106, 171, 590, 611, 106, - 582, 106, 610, 606, 628, 562, 593, 106, 106, 106, - 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - 567, 567, 567, 567, 567, 567, 567, 567, 567, 568, - - 568, 568, 568, 568, 568, 568, 568, 567, 567, 567, - 567, 567, 106, 594, 171, 584, 106, 607, 607, 613, - 607, 607, 615, 614, 1089, 585, 612, 586, 618, 106, - 608, 587, 616, 106, 588, 592, 605, 567, 567, 567, - 567, 106, 106, 171, 106, 106, 106, 106, 106, 619, - 106, 106, 617, 106, 620, 106, 621, 106, 622, 106, - 623, 632, 632, 609, 632, 632, 106, 773, 567, 558, - 558, 633, 558, 558, 106, 625, 626, 626, 626, 626, - 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, - 626, 626, 626, 626, 626, 627, 627, 627, 627, 627, - - 627, 627, 627, 626, 626, 626, 626, 626, 106, 106, - 106, 106, 106, 106, 190, 643, 644, 645, 106, 106, - 648, 106, 106, 646, 647, 106, 629, 635, 636, 106, - 650, 106, 702, 626, 626, 626, 626, 637, 637, 106, - 637, 637, 639, 649, 106, 106, 651, 106, 634, 106, - 653, 652, 106, 657, 106, 106, 658, 106, 106, 656, - 660, 669, 691, 638, 626, 630, 630, 630, 630, 630, - 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, - 630, 630, 630, 630, 631, 631, 631, 631, 631, 631, - 631, 631, 630, 630, 630, 630, 630, 106, 106, 106, - - 106, 106, 106, 171, 662, 106, 694, 663, 106, 681, - 106, 664, 171, 684, 654, 539, 665, 667, 655, 666, - 659, 661, 630, 630, 630, 630, 668, 679, 106, 106, - 607, 607, 678, 607, 607, 539, 106, 106, 106, 106, - 106, 106, 106, 608, 190, 106, 106, 106, 698, 106, - 541, 685, 541, 630, 686, 106, 106, 106, 683, 714, - 687, 689, 632, 632, 693, 632, 632, 637, 637, 106, - 637, 637, 688, 699, 106, 106, 106, 700, 701, 704, - 106, 106, 106, 707, 106, 705, 706, 708, 106, 106, - 106, 106, 703, 638, 711, 106, 715, 106, 709, 106, - - 717, 106, 106, 720, 716, 718, 190, 710, 712, 713, - 607, 607, 106, 607, 607, 731, 106, 719, 1088, 733, - 729, 106, 106, 608, 607, 607, 106, 607, 607, 730, - 106, 106, 732, 106, 106, 106, 171, 608, 541, 106, - 106, 690, 734, 106, 735, 541, 106, 106, 737, 737, - 171, 737, 737, 106, 740, 106, 609, 745, 739, 106, - 744, 106, 106, 106, 746, 747, 748, 751, 106, 106, - 609, 749, 106, 106, 106, 750, 106, 754, 106, 106, - 106, 752, 755, 760, 106, 757, 106, 753, 106, 106, - 106, 774, 106, 758, 756, 763, 106, 106, 106, 759, - - 762, 775, 106, 765, 785, 106, 761, 764, 106, 737, - 737, 776, 737, 737, 106, 786, 106, 106, 780, 790, - 787, 106, 781, 106, 106, 106, 789, 106, 106, 106, - 106, 794, 788, 106, 106, 798, 106, 814, 106, 791, - 806, 792, 793, 795, 799, 796, 800, 797, 106, 801, - 802, 106, 106, 106, 803, 361, 106, 804, 805, 815, - 106, 824, 106, 826, 106, 106, 106, 106, 808, 106, - 106, 106, 807, 106, 828, 830, 817, 106, 832, 106, - 106, 836, 837, 829, 827, 106, 834, 825, 778, 838, - 831, 106, 106, 106, 106, 833, 841, 846, 842, 853, - - 835, 843, 844, 106, 854, 190, 839, 858, 858, 106, - 858, 858, 840, 106, 845, 190, 106, 106, 863, 861, - 878, 847, 106, 879, 106, 864, 881, 106, 882, 106, - 855, 106, 870, 859, 862, 106, 871, 106, 872, 883, - 106, 190, 106, 860, 865, 866, 867, 106, 868, 106, - 873, 874, 875, 106, 876, 106, 880, 106, 106, 106, - 896, 106, 106, 1087, 885, 886, 106, 869, 106, 889, - 890, 106, 106, 877, 910, 884, 901, 106, 897, 897, - 106, 897, 897, 905, 106, 891, 106, 900, 858, 858, - 106, 858, 858, 106, 903, 906, 902, 106, 904, 907, - - 106, 908, 106, 909, 898, 106, 911, 106, 912, 913, - 914, 915, 106, 916, 859, 892, 106, 918, 106, 106, - 917, 919, 106, 106, 106, 106, 106, 106, 106, 936, - 106, 106, 921, 106, 923, 924, 925, 920, 106, 922, - 935, 190, 993, 897, 897, 106, 897, 897, 939, 106, - 938, 926, 106, 106, 940, 941, 942, 106, 106, 106, - 106, 943, 106, 944, 106, 945, 106, 106, 946, 898, - 106, 106, 106, 947, 949, 950, 948, 106, 951, 106, - 952, 927, 106, 953, 106, 954, 106, 106, 106, 955, - 106, 106, 970, 971, 971, 106, 971, 971, 106, 974, - - 106, 956, 957, 106, 975, 959, 106, 106, 958, 978, - 979, 106, 106, 983, 980, 973, 106, 106, 976, 972, - 106, 977, 106, 981, 106, 106, 106, 106, 986, 987, - 982, 106, 106, 991, 988, 989, 106, 106, 994, 1005, - 984, 106, 985, 992, 106, 990, 106, 1006, 971, 971, - 106, 971, 971, 106, 106, 106, 1008, 106, 1007, 1009, - 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - 106, 1022, 1010, 1011, 972, 1012, 1014, 1015, 1013, 1016, - 106, 1017, 106, 1018, 1021, 1019, 1020, 1034, 106, 1023, - 106, 1035, 106, 106, 106, 106, 106, 1086, 106, 106, - - 106, 106, 1024, 106, 1045, 106, 106, 1037, 1038, 1039, - 1040, 1041, 1036, 1042, 1043, 1044, 106, 1046, 106, 106, - 106, 1047, 106, 1059, 1056, 1060, 106, 1057, 106, 106, - 106, 1073, 106, 106, 1093, 1069, 106, 1058, 1083, 1084, - 106, 1082, 106, 1071, 106, 1070, 106, 106, 1100, 1072, - 106, 106, 1104, 106, 106, 1092, 1105, 106, 1108, 106, - 1099, 106, 1094, 106, 1111, 1101, 106, 106, 106, 106, - 1081, 1080, 1109, 1079, 1112, 1077, 1076, 1075, 1074, 1068, - 1067, 1113, 1114, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 70, 70, 70, 1066, 70, 70, 70, 70, - - 70, 76, 76, 1065, 1064, 1063, 1062, 76, 76, 96, - 96, 1061, 96, 96, 104, 106, 104, 104, 163, 163, - 106, 163, 163, 163, 163, 163, 163, 170, 170, 170, - 170, 177, 106, 177, 177, 179, 179, 106, 179, 179, - 179, 179, 179, 179, 180, 106, 180, 180, 182, 182, - 106, 182, 182, 186, 106, 186, 255, 255, 106, 255, - 255, 255, 255, 255, 255, 269, 106, 269, 269, 270, - 1055, 270, 270, 347, 347, 1054, 347, 347, 347, 347, - 347, 347, 364, 364, 453, 1053, 453, 453, 525, 525, - 1052, 525, 525, 525, 525, 525, 525, 526, 526, 1051, - - 526, 526, 526, 526, 526, 526, 598, 598, 1050, 598, - 598, 598, 598, 598, 598, 599, 599, 1049, 599, 599, - 599, 599, 599, 599, 724, 724, 1048, 724, 724, 724, - 724, 724, 724, 766, 766, 106, 766, 766, 766, 766, - 766, 766, 567, 567, 567, 567, 567, 567, 567, 626, - 626, 626, 626, 626, 626, 626, 630, 630, 630, 630, - 630, 630, 630, 1004, 1004, 106, 1004, 1004, 1004, 1004, - 1004, 1004, 1029, 1029, 106, 1029, 1029, 1029, 1029, 1029, - 1029, 1078, 1078, 106, 1078, 1078, 1078, 1078, 1078, 1078, - 1085, 1085, 106, 1085, 1085, 1085, 1085, 1085, 1085, 1090, - - 1090, 106, 1090, 1090, 1090, 1090, 1090, 1090, 1091, 1091, - 1033, 1091, 1091, 1091, 1091, 1091, 1091, 1096, 1096, 1032, - 1096, 1096, 1096, 1096, 1096, 1096, 1097, 1097, 1031, 1097, - 1097, 1097, 1097, 1097, 1097, 1107, 1107, 1030, 1107, 1107, - 1107, 1107, 1107, 1107, 1110, 1110, 1028, 1110, 1110, 1110, - 1110, 1110, 1110, 1027, 1026, 1025, 106, 106, 106, 1003, - 1002, 1001, 1000, 999, 998, 997, 996, 995, 106, 106, - 772, 969, 968, 967, 966, 965, 964, 963, 962, 961, - 960, 106, 106, 937, 934, 933, 932, 931, 930, 929, - 928, 106, 106, 106, 899, 895, 894, 893, 888, 887, - - 106, 106, 106, 106, 106, 106, 106, 857, 856, 106, - 852, 851, 850, 849, 848, 106, 106, 106, 823, 822, - 106, 821, 820, 819, 818, 816, 813, 812, 811, 810, - 809, 106, 784, 783, 782, 779, 777, 106, 106, 106, - 772, 771, 770, 769, 768, 767, 106, 743, 742, 741, - 738, 736, 106, 728, 727, 726, 725, 723, 722, 721, - 106, 106, 106, 106, 697, 696, 695, 106, 692, 106, - 106, 106, 106, 682, 680, 106, 106, 171, 677, 676, - 675, 674, 673, 672, 671, 670, 409, 106, 106, 106, - 642, 641, 640, 106, 106, 624, 106, 106, 106, 604, - - 603, 602, 601, 600, 597, 596, 595, 106, 106, 566, - 565, 564, 563, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 528, 527, 524, 523, 522, 521, 520, - 519, 106, 106, 106, 490, 106, 106, 106, 468, 106, - 106, 106, 445, 444, 443, 442, 441, 438, 437, 106, - 409, 406, 106, 106, 106, 106, 106, 356, 355, 354, - 353, 346, 308, 106, 106, 286, 276, 275, 261, 171, - 164, 166, 253, 164, 228, 112, 106, 188, 187, 176, - 175, 171, 166, 164, 115, 114, 106, 101, 98, 79, - 71, 67, 63, 1115, 3, 1115, 1115, 1115, 1115, 1115, - - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115 - } ; - -static yyconst flex_int16_t yy_chk[2685] = - { 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, - 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, 2, - 2, 5, 2, 2, 9, 5, 2, 11, 13, 13, - - 16, 13, 13, 29, 17, 19, 2, 13, 1114, 19, - 26, 13, 23, 23, 16, 28, 11, 17, 17, 2, - 19, 25, 25, 29, 26, 31, 33, 18, 33, 13, - 18, 13, 18, 18, 18, 18, 18, 18, 18, 18, - 45, 202, 55, 75, 28, 9, 31, 44, 42, 202, - 20, 13, 20, 20, 20, 20, 20, 20, 20, 20, - 42, 45, 44, 75, 37, 64, 42, 54, 21, 20, - 21, 21, 21, 21, 21, 21, 21, 21, 37, 30, - 41, 38, 54, 39, 110, 37, 43, 21, 20, 30, - 38, 39, 48, 66, 41, 39, 38, 40, 39, 20, - - 43, 55, 40, 110, 41, 43, 46, 46, 47, 49, - 48, 46, 40, 48, 49, 62, 64, 21, 20, 62, - 50, 46, 40, 52, 47, 51, 47, 47, 50, 50, - 51, 60, 53, 51, 70, 60, 78, 52, 71, 50, - 50, 53, 52, 77, 66, 105, 60, 53, 77, 78, - 51, 107, 53, 56, 56, 167, 56, 56, 72, 72, - 56, 72, 72, 106, 120, 120, 105, 72, 109, 107, - 56, 72, 1112, 87, 87, 87, 87, 87, 87, 87, - 87, 70, 116, 56, 111, 71, 116, 117, 106, 72, - 87, 72, 91, 91, 91, 91, 91, 91, 91, 91, - - 111, 118, 109, 121, 121, 131, 167, 117, 119, 91, - 92, 72, 92, 92, 92, 92, 92, 92, 92, 92, - 87, 118, 141, 119, 141, 131, 93, 93, 124, 92, - 93, 93, 93, 93, 93, 93, 93, 93, 95, 91, - 95, 95, 95, 95, 95, 95, 95, 95, 137, 124, - 166, 166, 249, 137, 199, 199, 249, 95, 96, 92, - 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, - 97, 108, 97, 97, 97, 97, 97, 97, 97, 97, - 115, 108, 123, 126, 122, 125, 128, 95, 1102, 132, - 133, 213, 213, 129, 123, 130, 108, 122, 122, 125, - - 127, 128, 129, 132, 126, 115, 115, 130, 115, 115, - 133, 115, 135, 134, 115, 130, 127, 136, 139, 140, - 127, 143, 142, 144, 115, 115, 134, 148, 140, 142, - 144, 142, 145, 147, 140, 135, 143, 136, 139, 146, - 146, 145, 149, 146, 150, 148, 147, 151, 152, 144, - 153, 155, 165, 150, 154, 169, 151, 146, 149, 153, - 173, 174, 153, 150, 172, 154, 152, 158, 158, 155, - 158, 158, 190, 164, 158, 164, 173, 172, 190, 174, - 165, 196, 200, 165, 158, 177, 177, 177, 177, 177, - 177, 177, 177, 195, 189, 192, 200, 158, 238, 178, - - 178, 196, 169, 178, 178, 178, 178, 178, 178, 178, - 178, 180, 180, 180, 180, 180, 180, 180, 180, 189, - 198, 191, 195, 192, 238, 198, 181, 181, 326, 164, - 181, 181, 181, 181, 181, 181, 181, 181, 182, 191, - 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, - 183, 326, 183, 183, 183, 183, 183, 183, 183, 183, - 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, - 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, - 186, 186, 186, 186, 197, 201, 204, 206, 197, 186, - 186, 186, 186, 186, 186, 207, 197, 205, 205, 206, - - 209, 204, 212, 211, 212, 201, 208, 210, 211, 219, - 216, 1101, 205, 207, 214, 216, 209, 215, 219, 186, - 186, 186, 186, 186, 186, 208, 210, 214, 218, 215, - 217, 217, 221, 218, 222, 223, 223, 224, 227, 228, - 229, 222, 224, 230, 233, 232, 231, 234, 236, 235, - 221, 239, 240, 233, 237, 243, 227, 232, 229, 237, - 242, 234, 236, 241, 228, 230, 231, 235, 244, 228, - 243, 239, 241, 244, 245, 248, 242, 247, 246, 250, - 250, 254, 256, 262, 241, 264, 240, 246, 253, 245, - 264, 247, 262, 263, 251, 248, 251, 251, 284, 251, - - 256, 251, 284, 273, 1098, 274, 251, 271, 278, 263, - 272, 251, 251, 251, 251, 251, 253, 261, 261, 253, - 261, 261, 251, 271, 272, 274, 261, 279, 278, 285, - 261, 273, 279, 281, 304, 311, 281, 254, 285, 304, - 311, 251, 265, 265, 265, 265, 265, 265, 265, 265, - 266, 266, 266, 266, 266, 266, 266, 266, 267, 267, - 267, 267, 267, 267, 267, 267, 268, 268, 268, 268, - 268, 268, 268, 268, 269, 269, 269, 269, 269, 269, - 269, 269, 270, 270, 270, 270, 270, 270, 270, 270, - 277, 276, 280, 283, 276, 270, 270, 270, 270, 270, - - 270, 276, 282, 288, 277, 289, 286, 299, 293, 1095, - 280, 297, 276, 283, 292, 294, 299, 288, 295, 276, - 293, 282, 296, 289, 297, 270, 270, 270, 270, 270, - 270, 286, 300, 292, 296, 294, 286, 301, 295, 302, - 303, 306, 307, 306, 308, 309, 309, 310, 312, 312, - 300, 313, 315, 302, 303, 316, 313, 301, 314, 317, - 1089, 307, 323, 320, 310, 318, 318, 314, 320, 308, - 318, 315, 321, 325, 308, 316, 323, 324, 327, 317, - 324, 321, 327, 328, 329, 325, 330, 331, 334, 333, - 336, 329, 327, 330, 335, 335, 337, 328, 338, 340, - - 339, 337, 338, 334, 340, 341, 342, 343, 331, 333, - 344, 345, 346, 351, 336, 339, 343, 348, 351, 340, - 342, 357, 358, 359, 360, 344, 361, 362, 358, 363, - 341, 345, 366, 365, 360, 348, 367, 346, 365, 357, - 368, 361, 346, 359, 369, 373, 370, 371, 367, 370, - 371, 372, 374, 376, 363, 375, 362, 366, 375, 377, - 378, 368, 369, 372, 378, 373, 383, 386, 384, 385, - 386, 383, 376, 384, 390, 387, 377, 389, 385, 390, - 392, 389, 391, 391, 393, 394, 395, 398, 374, 387, - 397, 397, 392, 399, 400, 401, 399, 400, 402, 404, - - 393, 405, 394, 402, 406, 405, 395, 398, 409, 408, - 410, 404, 408, 411, 409, 401, 414, 410, 409, 412, - 412, 414, 415, 415, 417, 419, 419, 420, 421, 406, - 422, 423, 424, 411, 425, 426, 420, 427, 417, 430, - 429, 428, 432, 421, 425, 428, 431, 423, 430, 406, - 422, 431, 424, 434, 433, 426, 429, 427, 433, 435, - 432, 446, 447, 448, 435, 449, 450, 447, 451, 452, - 434, 454, 456, 457, 455, 458, 448, 449, 450, 459, - 461, 454, 460, 460, 458, 446, 462, 457, 463, 462, - 468, 459, 464, 464, 1086, 451, 452, 455, 472, 461, - - 465, 456, 471, 465, 476, 471, 477, 472, 478, 478, - 480, 477, 483, 486, 481, 468, 482, 476, 468, 484, - 484, 482, 484, 484, 485, 480, 463, 481, 487, 485, - 490, 486, 483, 497, 498, 499, 500, 501, 502, 503, - 498, 500, 504, 504, 505, 507, 510, 487, 499, 501, - 502, 503, 506, 497, 506, 490, 508, 510, 506, 505, - 512, 506, 511, 512, 514, 508, 530, 511, 533, 506, - 507, 553, 532, 530, 553, 490, 514, 532, 533, 484, - 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, - 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, - - 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, - 495, 495, 513, 515, 529, 509, 542, 531, 531, 535, - 531, 531, 537, 536, 1079, 509, 534, 509, 542, 535, - 531, 509, 538, 543, 509, 513, 529, 495, 495, 495, - 495, 495, 509, 531, 546, 534, 538, 515, 536, 543, - 540, 537, 540, 544, 544, 550, 546, 547, 547, 548, - 548, 556, 556, 531, 556, 556, 557, 729, 495, 558, - 558, 557, 558, 558, 729, 550, 551, 551, 551, 551, - 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - - 551, 551, 551, 551, 551, 551, 551, 551, 554, 559, - 569, 571, 560, 572, 563, 569, 571, 572, 574, 575, - 576, 556, 651, 574, 575, 577, 554, 559, 560, 578, - 578, 580, 651, 551, 551, 551, 551, 561, 561, 563, - 561, 561, 563, 577, 579, 581, 579, 584, 558, 576, - 581, 580, 585, 585, 586, 588, 586, 593, 633, 584, - 588, 593, 633, 561, 551, 555, 555, 555, 555, 555, - 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, - 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, - 555, 555, 555, 555, 555, 555, 555, 561, 582, 583, - - 587, 589, 591, 605, 590, 639, 639, 590, 619, 615, - 592, 590, 606, 619, 582, 610, 590, 591, 583, 590, - 587, 589, 555, 555, 555, 555, 592, 606, 590, 610, - 607, 607, 605, 607, 607, 612, 615, 617, 618, 620, - 621, 623, 622, 607, 624, 663, 636, 647, 647, 612, - 618, 620, 621, 555, 622, 648, 628, 649, 617, 663, - 623, 628, 632, 632, 636, 632, 632, 637, 637, 624, - 637, 637, 624, 648, 652, 650, 653, 649, 650, 653, - 654, 655, 656, 656, 657, 654, 655, 657, 658, 659, - 661, 660, 652, 637, 660, 664, 664, 662, 658, 665, - - 666, 667, 668, 669, 665, 667, 680, 659, 661, 662, - 678, 678, 683, 678, 678, 682, 684, 668, 1077, 684, - 680, 666, 687, 678, 679, 679, 685, 679, 679, 681, - 669, 680, 683, 686, 681, 694, 678, 679, 685, 699, - 682, 632, 687, 688, 688, 686, 698, 701, 691, 691, - 679, 691, 691, 693, 694, 704, 678, 699, 693, 700, - 698, 702, 703, 706, 700, 701, 702, 706, 707, 708, - 679, 703, 709, 710, 711, 704, 712, 709, 713, 714, - 715, 707, 710, 715, 716, 712, 717, 708, 720, 719, - 718, 731, 735, 713, 711, 718, 732, 731, 739, 714, - - 717, 732, 740, 720, 744, 749, 716, 719, 691, 737, - 737, 735, 737, 737, 745, 745, 746, 747, 739, 749, - 746, 744, 740, 748, 750, 752, 748, 753, 754, 755, - 756, 754, 747, 757, 758, 758, 760, 773, 762, 750, - 763, 752, 753, 755, 759, 756, 759, 757, 761, 759, - 759, 763, 764, 765, 760, 774, 776, 761, 762, 774, - 785, 785, 786, 787, 789, 791, 773, 790, 765, 774, - 794, 795, 764, 787, 790, 792, 776, 796, 795, 797, - 798, 799, 800, 791, 789, 759, 797, 786, 737, 801, - 794, 803, 792, 804, 806, 796, 805, 807, 805, 814, - - 798, 805, 805, 808, 815, 816, 803, 820, 820, 826, - 820, 820, 804, 814, 806, 821, 824, 799, 827, 824, - 835, 808, 800, 835, 807, 828, 841, 801, 842, 815, - 816, 830, 830, 820, 826, 827, 831, 805, 832, 843, - 821, 855, 828, 821, 829, 829, 829, 840, 829, 846, - 833, 833, 833, 831, 833, 832, 840, 845, 861, 835, - 854, 847, 841, 1076, 846, 847, 855, 829, 842, 850, - 850, 870, 854, 833, 870, 845, 861, 843, 856, 856, - 862, 856, 856, 865, 829, 850, 860, 860, 858, 858, - 833, 858, 858, 863, 863, 866, 862, 864, 864, 867, - - 865, 868, 869, 869, 856, 871, 871, 872, 872, 873, - 874, 875, 866, 876, 858, 850, 867, 878, 868, 877, - 877, 879, 880, 884, 885, 886, 873, 874, 875, 896, - 876, 900, 884, 901, 886, 887, 887, 880, 958, 885, - 895, 895, 958, 897, 897, 896, 897, 897, 901, 902, - 900, 887, 903, 904, 902, 903, 904, 878, 910, 879, - 905, 905, 906, 906, 907, 907, 895, 908, 908, 897, - 909, 911, 912, 909, 911, 912, 910, 913, 913, 914, - 914, 887, 915, 915, 916, 916, 917, 920, 921, 917, - 922, 923, 935, 937, 937, 938, 937, 937, 948, 940, - - 941, 920, 921, 942, 940, 923, 943, 944, 922, 943, - 944, 945, 947, 948, 945, 938, 940, 935, 941, 937, - 946, 942, 949, 946, 950, 951, 952, 955, 951, 952, - 947, 953, 954, 956, 953, 954, 957, 959, 959, 970, - 949, 976, 950, 957, 977, 955, 974, 974, 971, 971, - 956, 971, 971, 975, 978, 979, 976, 980, 975, 977, - 981, 982, 984, 986, 985, 987, 970, 988, 989, 990, - 991, 991, 978, 979, 971, 980, 982, 984, 981, 985, - 993, 986, 994, 987, 990, 988, 989, 1005, 1006, 993, - 1007, 1006, 1010, 1011, 1012, 1013, 1017, 1075, 1018, 1019, - - 1020, 1022, 994, 1023, 1022, 1005, 1035, 1010, 1011, 1012, - 1013, 1017, 1007, 1018, 1019, 1020, 1024, 1023, 1036, 1045, - 1056, 1024, 1046, 1046, 1035, 1047, 1057, 1036, 1058, 1059, - 1060, 1060, 1070, 1072, 1083, 1056, 1073, 1045, 1072, 1073, - 1082, 1070, 1047, 1058, 1084, 1057, 1092, 1093, 1093, 1059, - 1094, 1083, 1099, 1100, 1105, 1082, 1100, 1104, 1104, 1109, - 1092, 1108, 1084, 1111, 1108, 1094, 1071, 1113, 1069, 1099, - 1068, 1067, 1105, 1066, 1109, 1064, 1063, 1062, 1061, 1055, - 1054, 1111, 1113, 1116, 1116, 1116, 1116, 1116, 1116, 1116, - 1116, 1116, 1117, 1117, 1117, 1053, 1117, 1117, 1117, 1117, - - 1117, 1118, 1118, 1052, 1051, 1050, 1049, 1118, 1118, 1119, - 1119, 1048, 1119, 1119, 1120, 1044, 1120, 1120, 1121, 1121, - 1043, 1121, 1121, 1121, 1121, 1121, 1121, 1122, 1122, 1122, - 1122, 1123, 1042, 1123, 1123, 1124, 1124, 1041, 1124, 1124, - 1124, 1124, 1124, 1124, 1125, 1040, 1125, 1125, 1126, 1126, - 1039, 1126, 1126, 1127, 1038, 1127, 1128, 1128, 1037, 1128, - 1128, 1128, 1128, 1128, 1128, 1129, 1034, 1129, 1129, 1130, - 1033, 1130, 1130, 1131, 1131, 1032, 1131, 1131, 1131, 1131, - 1131, 1131, 1132, 1132, 1133, 1031, 1133, 1133, 1134, 1134, - 1030, 1134, 1134, 1134, 1134, 1134, 1134, 1135, 1135, 1028, - - 1135, 1135, 1135, 1135, 1135, 1135, 1136, 1136, 1027, 1136, - 1136, 1136, 1136, 1136, 1136, 1137, 1137, 1026, 1137, 1137, - 1137, 1137, 1137, 1137, 1138, 1138, 1025, 1138, 1138, 1138, - 1138, 1138, 1138, 1139, 1139, 1021, 1139, 1139, 1139, 1139, - 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1141, - 1141, 1141, 1141, 1141, 1141, 1141, 1142, 1142, 1142, 1142, - 1142, 1142, 1142, 1143, 1143, 1016, 1143, 1143, 1143, 1143, - 1143, 1143, 1144, 1144, 1015, 1144, 1144, 1144, 1144, 1144, - 1144, 1145, 1145, 1014, 1145, 1145, 1145, 1145, 1145, 1145, - 1146, 1146, 1009, 1146, 1146, 1146, 1146, 1146, 1146, 1147, - - 1147, 1008, 1147, 1147, 1147, 1147, 1147, 1147, 1148, 1148, - 1003, 1148, 1148, 1148, 1148, 1148, 1148, 1149, 1149, 1002, - 1149, 1149, 1149, 1149, 1149, 1149, 1150, 1150, 1001, 1150, - 1150, 1150, 1150, 1150, 1150, 1151, 1151, 1000, 1151, 1151, - 1151, 1151, 1151, 1151, 1152, 1152, 998, 1152, 1152, 1152, - 1152, 1152, 1152, 997, 996, 995, 992, 983, 973, 968, - 967, 966, 965, 964, 963, 962, 961, 960, 939, 936, - 934, 933, 932, 931, 930, 929, 928, 927, 926, 925, - 924, 919, 918, 899, 894, 893, 892, 891, 890, 889, - 888, 883, 882, 881, 857, 853, 852, 851, 849, 848, - - 844, 839, 838, 837, 836, 834, 825, 819, 818, 817, - 813, 812, 811, 810, 809, 802, 793, 788, 783, 782, - 781, 780, 779, 778, 777, 775, 771, 770, 769, 768, - 767, 751, 743, 742, 741, 738, 736, 734, 733, 730, - 728, 727, 726, 725, 723, 722, 705, 697, 696, 695, - 692, 690, 689, 677, 676, 675, 674, 672, 671, 670, - 646, 645, 644, 643, 642, 641, 640, 635, 634, 631, - 629, 627, 625, 616, 614, 613, 611, 609, 604, 603, - 602, 601, 600, 597, 596, 595, 594, 573, 570, 568, - 566, 565, 564, 562, 552, 549, 545, 541, 539, 528, - - 527, 524, 523, 522, 519, 518, 517, 516, 496, 494, - 493, 492, 491, 489, 488, 479, 475, 474, 473, 470, - 469, 467, 466, 445, 444, 441, 440, 439, 438, 437, - 436, 418, 416, 413, 407, 403, 396, 388, 382, 381, - 380, 379, 356, 355, 354, 353, 352, 350, 349, 332, - 322, 319, 305, 298, 291, 290, 287, 260, 259, 258, - 257, 252, 226, 225, 220, 203, 194, 193, 171, 170, - 163, 162, 161, 160, 138, 113, 104, 103, 99, 86, - 84, 76, 61, 59, 36, 35, 27, 24, 22, 15, - 12, 10, 8, 3, 1115, 1115, 1115, 1115, 1115, 1115, - - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, - 1115, 1115, 1115, 1115 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[174] = - { 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* 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 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "vtkParse.l" -#line 3 "vtkParse.l" - -/* - -This file must be translated to C and modified to build everywhere. - -Run flex like this: - - flex --nodefault -olex.yy.c vtkParse.l - -Modify lex.yy.c: - - convert tabs to spaces (8 spaces per tab) - - remove extra space from end of lines - - remove blank lines from end of file - - replace "int yyl" with "yy_size_t yyl" - - compile with gcc and "-Wsign-compare", there should be no warnings - -*/ - -/* We do not care of interactive mode */ -#define YY_NEVER_INTERACTIVE 1 - -/* Do not include unistd.h in generated source. */ -#define YY_NO_UNISTD_H - -/* Skip declaring this function. It is a macro. */ -#define YY_SKIP_YYWRAP - -#ifdef _WIN32 -#pragma warning ( disable : 4018 ) -#pragma warning ( disable : 4127 ) -#pragma warning ( disable : 4131 ) -#pragma warning ( disable : 4244 ) -#pragma warning ( disable : 4251 ) -#pragma warning ( disable : 4267 ) -#pragma warning ( disable : 4305 ) -#pragma warning ( disable : 4309 ) -#pragma warning ( disable : 4706 ) -#pragma warning ( disable : 4786 ) -#endif - -#define SKIP_MATCH_MAXLEN 15 - -/* - * Skip ahead until one of the strings is found, - * then skip to the end of the line. - * Return 0 if no match found. - */ -static int skip_comment(); -static int skip_trailing_comment(const char *text, size_t l); -static int skip_ahead_multi(const char *strings[]); -static int skip_ahead_until(const char *text); -static int skip_to_next_directive(); -static int skip_conditional_block(); - -static void preprocessor_directive(const char *text, size_t l); -static void print_preprocessor_error(int result, const char *cp, size_t n); -static const char *get_macro_arguments(); - -static void push_buffer(); -static int pop_buffer(); - -static void push_include(const char *filename); -static void pop_include(); - -static void push_macro(MacroInfo *macro); -static void pop_macro(); -static int in_macro(); - -#line 1515 "lex.yy.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -yy_size_t yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#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 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_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - yy_size_t 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 \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#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 - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* 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 \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 77 "vtkParse.l" - - -#line 1703 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#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 ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - 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_current_state += YY_AT_BOL(); -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 >= 1116 ) - 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] != 2595 ); - -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; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - yy_size_t yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - yylineno++; -; - } - -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 79 "vtkParse.l" -{ skip_comment(); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 81 "vtkParse.l" -{ - if (!IgnoreBTX) { - skip_ahead_until("//ETX"); - } - } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 87 "vtkParse.l" -/* eat mismatched ETX */ - YY_BREAK -case 4: -YY_RULE_SETUP -#line 89 "vtkParse.l" -{ - skip_ahead_until("@end"); - } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 93 "vtkParse.l" -{ - size_t pos = 1; - while (yytext[pos-1] != 'M' || yytext[pos] != 'E') - { - pos++; - } - data->NameComment = vtkstrndup(&yytext[pos + 1], yyleng - pos - 1); - } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 102 "vtkParse.l" -{ setCommentState(1); } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 103 "vtkParse.l" -{ setCommentState(2); } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 104 "vtkParse.l" -{ setCommentState(3); } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 105 "vtkParse.l" -{ setCommentState(3); } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 106 "vtkParse.l" -{ setCommentState(4); } - YY_BREAK -case 11: -/* rule 11 can match eol */ -YY_RULE_SETUP -#line 107 "vtkParse.l" -{ closeOrClearComment(); } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 108 "vtkParse.l" -{ - size_t pos = 2; - while (yytext[pos-2] != '/' || yytext[pos-1] != '/') pos++; - addCommentLine(&yytext[pos], yyleng - pos); - } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 114 "vtkParse.l" -/* eat C++ comments */ - YY_BREAK -case 14: -/* rule 14 can match eol */ -YY_RULE_SETUP -#line 116 "vtkParse.l" -{ - skip_trailing_comment(yytext, yyleng); - preprocessor_directive(yytext, yyleng); - } - YY_BREAK -case 15: -/* rule 15 can match eol */ -YY_RULE_SETUP -#line 121 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(STRING_LITERAL); - } - YY_BREAK -case 16: -/* rule 16 can match eol */ -YY_RULE_SETUP -#line 126 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(CHAR_LITERAL); - } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 131 "vtkParse.l" -/* ignore EXPORT macros */ - YY_BREAK -case 18: -YY_RULE_SETUP -#line 133 "vtkParse.l" -{ /* let the wrappers see the parameter */ - const char *args = NULL; - const char *cp; - size_t l = 0; - args = get_macro_arguments(); - if (args) - { - cp = args; - if (*cp == '(') { cp++; } - while (*cp == ' ' || *cp == '\t') { cp++; } - l = vtkidlen(cp); - if (l) - { - yylval.str = vtkstrndup(cp, l); - free((char *)args); - return(ID); - } - free((char *)args); - } - } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 154 "vtkParse.l" -return(DOUBLE); - YY_BREAK -case 20: -YY_RULE_SETUP -#line 155 "vtkParse.l" -return(FLOAT); - YY_BREAK -case 21: -YY_RULE_SETUP -#line 156 "vtkParse.l" -return(INT64__); - YY_BREAK -case 22: -YY_RULE_SETUP -#line 157 "vtkParse.l" -return(SHORT); - YY_BREAK -case 23: -YY_RULE_SETUP -#line 158 "vtkParse.l" -return(LONG); - YY_BREAK -case 24: -YY_RULE_SETUP -#line 159 "vtkParse.l" -return(CHAR); - YY_BREAK -case 25: -YY_RULE_SETUP -#line 160 "vtkParse.l" -return(INT); - YY_BREAK -case 26: -YY_RULE_SETUP -#line 162 "vtkParse.l" -return(UNSIGNED); - YY_BREAK -case 27: -YY_RULE_SETUP -#line 163 "vtkParse.l" -return(SIGNED); - YY_BREAK -case 28: -YY_RULE_SETUP -#line 165 "vtkParse.l" -return(VOID); - YY_BREAK -case 29: -YY_RULE_SETUP -#line 166 "vtkParse.l" -return(BOOL); - YY_BREAK -case 30: -YY_RULE_SETUP -#line 168 "vtkParse.l" -return(SIZE_T); - YY_BREAK -case 31: -YY_RULE_SETUP -#line 169 "vtkParse.l" -return(SSIZE_T); - YY_BREAK -case 32: -YY_RULE_SETUP -#line 171 "vtkParse.l" -/* ignore the Q_OBJECT macro from Qt */ - YY_BREAK -case 33: -/* rule 33 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 172 "vtkParse.l" -return(PUBLIC); - YY_BREAK -case 34: -/* rule 34 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 173 "vtkParse.l" -return(PRIVATE); - YY_BREAK -case 35: -/* rule 35 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 174 "vtkParse.l" -return(PROTECTED); - YY_BREAK -case 36: -/* rule 36 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 175 "vtkParse.l" -return(PROTECTED); - YY_BREAK -case 37: -YY_RULE_SETUP -#line 177 "vtkParse.l" -return(CLASS); - YY_BREAK -case 38: -YY_RULE_SETUP -#line 178 "vtkParse.l" -return(STRUCT); - YY_BREAK -case 39: -YY_RULE_SETUP -#line 179 "vtkParse.l" -return(PUBLIC); - YY_BREAK -case 40: -YY_RULE_SETUP -#line 180 "vtkParse.l" -return(PRIVATE); - YY_BREAK -case 41: -YY_RULE_SETUP -#line 181 "vtkParse.l" -return(PROTECTED); - YY_BREAK -case 42: -YY_RULE_SETUP -#line 182 "vtkParse.l" -return(ENUM); - YY_BREAK -case 43: -YY_RULE_SETUP -#line 183 "vtkParse.l" -return(UNION); - YY_BREAK -case 44: -YY_RULE_SETUP -#line 184 "vtkParse.l" -return(VIRTUAL); - YY_BREAK -case 45: -YY_RULE_SETUP -#line 185 "vtkParse.l" -return(CONST); - YY_BREAK -case 46: -YY_RULE_SETUP -#line 186 "vtkParse.l" -return(VOLATILE); - YY_BREAK -case 47: -YY_RULE_SETUP -#line 187 "vtkParse.l" -return(MUTABLE); - YY_BREAK -case 48: -YY_RULE_SETUP -#line 188 "vtkParse.l" -return(OPERATOR); - YY_BREAK -case 49: -YY_RULE_SETUP -#line 189 "vtkParse.l" -return(FRIEND); - YY_BREAK -case 50: -YY_RULE_SETUP -#line 190 "vtkParse.l" -return(INLINE); - YY_BREAK -case 51: -YY_RULE_SETUP -#line 191 "vtkParse.l" -return(STATIC); - YY_BREAK -case 52: -YY_RULE_SETUP -#line 192 "vtkParse.l" -return(EXTERN); - YY_BREAK -case 53: -YY_RULE_SETUP -#line 193 "vtkParse.l" -return(TEMPLATE); - YY_BREAK -case 54: -YY_RULE_SETUP -#line 194 "vtkParse.l" -return(TYPENAME); - YY_BREAK -case 55: -YY_RULE_SETUP -#line 195 "vtkParse.l" -return(TYPEDEF); - YY_BREAK -case 56: -YY_RULE_SETUP -#line 196 "vtkParse.l" -return(NAMESPACE); - YY_BREAK -case 57: -YY_RULE_SETUP -#line 197 "vtkParse.l" -return(USING); - YY_BREAK -case 58: -YY_RULE_SETUP -#line 198 "vtkParse.l" -return(NEW); - YY_BREAK -case 59: -YY_RULE_SETUP -#line 199 "vtkParse.l" -return(DELETE); - YY_BREAK -case 60: -YY_RULE_SETUP -#line 200 "vtkParse.l" -return(EXPLICIT); - YY_BREAK -case 61: -YY_RULE_SETUP -#line 201 "vtkParse.l" -return(THROW); - YY_BREAK -case 62: -YY_RULE_SETUP -#line 203 "vtkParse.l" -return(STATIC_CAST); - YY_BREAK -case 63: -YY_RULE_SETUP -#line 204 "vtkParse.l" -return(DYNAMIC_CAST); - YY_BREAK -case 64: -YY_RULE_SETUP -#line 205 "vtkParse.l" -return(CONST_CAST); - YY_BREAK -case 65: -YY_RULE_SETUP -#line 206 "vtkParse.l" -return(REINTERPRET_CAST); - YY_BREAK -case 66: -YY_RULE_SETUP -#line 208 "vtkParse.l" -/* irrelevant to wrappers */ - YY_BREAK -case 67: -YY_RULE_SETUP -#line 209 "vtkParse.l" -/* irrelevant to wrappers */ - YY_BREAK -case 68: -YY_RULE_SETUP -#line 211 "vtkParse.l" -return(OP_LOGIC_AND); - YY_BREAK -case 69: -YY_RULE_SETUP -#line 212 "vtkParse.l" -return(OP_AND_EQ); - YY_BREAK -case 70: -YY_RULE_SETUP -#line 213 "vtkParse.l" -return(OP_LOGIC_OR); - YY_BREAK -case 71: -YY_RULE_SETUP -#line 214 "vtkParse.l" -return(OP_OR_EQ); - YY_BREAK -case 72: -YY_RULE_SETUP -#line 215 "vtkParse.l" -return('!'); - YY_BREAK -case 73: -YY_RULE_SETUP -#line 216 "vtkParse.l" -return(OP_LOGIC_NEQ); - YY_BREAK -case 74: -YY_RULE_SETUP -#line 217 "vtkParse.l" -return('^'); - YY_BREAK -case 75: -YY_RULE_SETUP -#line 218 "vtkParse.l" -return(OP_XOR_EQ); - YY_BREAK -case 76: -YY_RULE_SETUP -#line 219 "vtkParse.l" -return('&'); - YY_BREAK -case 77: -YY_RULE_SETUP -#line 220 "vtkParse.l" -return('|'); - YY_BREAK -case 78: -YY_RULE_SETUP -#line 221 "vtkParse.l" -return('~'); - YY_BREAK -case 79: -YY_RULE_SETUP -#line 223 "vtkParse.l" -return(IdType); - YY_BREAK -case 80: -YY_RULE_SETUP -#line 224 "vtkParse.l" -return(SetMacro); - YY_BREAK -case 81: -YY_RULE_SETUP -#line 225 "vtkParse.l" -return(GetMacro); - YY_BREAK -case 82: -YY_RULE_SETUP -#line 226 "vtkParse.l" -return(SetStringMacro); - YY_BREAK -case 83: -YY_RULE_SETUP -#line 227 "vtkParse.l" -return(GetStringMacro); - YY_BREAK -case 84: -YY_RULE_SETUP -#line 228 "vtkParse.l" -return(SetClampMacro); - YY_BREAK -case 85: -YY_RULE_SETUP -#line 229 "vtkParse.l" -return(SetObjectMacro); - YY_BREAK -case 86: -YY_RULE_SETUP -#line 230 "vtkParse.l" -return(GetObjectMacro); - YY_BREAK -case 87: -YY_RULE_SETUP -#line 231 "vtkParse.l" -return(BooleanMacro); - YY_BREAK -case 88: -YY_RULE_SETUP -#line 232 "vtkParse.l" -return(SetVector2Macro); - YY_BREAK -case 89: -YY_RULE_SETUP -#line 233 "vtkParse.l" -return(SetVector3Macro); - YY_BREAK -case 90: -YY_RULE_SETUP -#line 234 "vtkParse.l" -return(SetVector4Macro); - YY_BREAK -case 91: -YY_RULE_SETUP -#line 235 "vtkParse.l" -return(SetVector6Macro); - YY_BREAK -case 92: -YY_RULE_SETUP -#line 236 "vtkParse.l" -return(GetVector2Macro); - YY_BREAK -case 93: -YY_RULE_SETUP -#line 237 "vtkParse.l" -return(GetVector3Macro); - YY_BREAK -case 94: -YY_RULE_SETUP -#line 238 "vtkParse.l" -return(GetVector4Macro); - YY_BREAK -case 95: -YY_RULE_SETUP -#line 239 "vtkParse.l" -return(GetVector6Macro); - YY_BREAK -case 96: -YY_RULE_SETUP -#line 240 "vtkParse.l" -return(SetVectorMacro); - YY_BREAK -case 97: -YY_RULE_SETUP -#line 241 "vtkParse.l" -return(GetVectorMacro); - YY_BREAK -case 98: -YY_RULE_SETUP -#line 242 "vtkParse.l" -return(ViewportCoordinateMacro); - YY_BREAK -case 99: -YY_RULE_SETUP -#line 243 "vtkParse.l" -return(WorldCoordinateMacro); - YY_BREAK -case 100: -YY_RULE_SETUP -#line 244 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 101: -YY_RULE_SETUP -#line 245 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 102: -YY_RULE_SETUP -#line 246 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 103: -YY_RULE_SETUP -#line 247 "vtkParse.l" -return(TypeMacro); - YY_BREAK -case 104: -YY_RULE_SETUP -#line 248 "vtkParse.l" -; - YY_BREAK -case 105: -YY_RULE_SETUP -#line 249 "vtkParse.l" -return(VTK_BYTE_SWAP_DECL); - YY_BREAK -case 106: -YY_RULE_SETUP -#line 250 "vtkParse.l" -return(TypeInt8); - YY_BREAK -case 107: -YY_RULE_SETUP -#line 251 "vtkParse.l" -return(TypeUInt8); - YY_BREAK -case 108: -YY_RULE_SETUP -#line 252 "vtkParse.l" -return(TypeInt16); - YY_BREAK -case 109: -YY_RULE_SETUP -#line 253 "vtkParse.l" -return(TypeUInt16); - YY_BREAK -case 110: -YY_RULE_SETUP -#line 254 "vtkParse.l" -return(TypeInt32); - YY_BREAK -case 111: -YY_RULE_SETUP -#line 255 "vtkParse.l" -return(TypeUInt32); - YY_BREAK -case 112: -YY_RULE_SETUP -#line 256 "vtkParse.l" -return(TypeInt64); - YY_BREAK -case 113: -YY_RULE_SETUP -#line 257 "vtkParse.l" -return(TypeUInt64); - YY_BREAK -case 114: -YY_RULE_SETUP -#line 258 "vtkParse.l" -return(TypeFloat32); - YY_BREAK -case 115: -YY_RULE_SETUP -#line 259 "vtkParse.l" -return(TypeFloat64); - YY_BREAK -case 116: -/* rule 116 can match eol */ -YY_RULE_SETUP -#line 261 "vtkParse.l" -{ - size_t i = 1; - size_t j; - while (yytext[i]==' ' || yytext[i]=='\t' || - yytext[i]=='\r' || yytext[i]=='\n') { i++; } - j = i; - while (yytext[j]!='&') { j++; } - yylval.str = vtkstrndup(&yytext[i], j-i); - return(LA); - } - YY_BREAK -case 117: -/* rule 117 can match eol */ -YY_RULE_SETUP -#line 272 "vtkParse.l" -{ - size_t i = 1; - size_t j; - while (yytext[i]==' ' || yytext[i]=='\t' || - yytext[i]=='\r' || yytext[i]=='\n') { i++; } - j = i; - while (yytext[j]!='*') { j++; } - yylval.str = vtkstrndup(&yytext[i], j-i); - return(LP); - } - YY_BREAK -case 118: -/* rule 118 can match eol */ -YY_RULE_SETUP -#line 283 "vtkParse.l" -{ - yylval.str = ""; - return(LP); - } - YY_BREAK -case 119: -/* rule 119 can match eol */ -YY_RULE_SETUP -#line 288 "vtkParse.l" -{ - yylval.str = ""; - return(LP); - } - YY_BREAK -case 120: -YY_RULE_SETUP -#line 293 "vtkParse.l" -return('*'); - YY_BREAK -case 121: -YY_RULE_SETUP -#line 295 "vtkParse.l" -/* misc unused win32 macros */ - YY_BREAK -case 122: -/* rule 122 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 297 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(OSTREAM); - } - YY_BREAK -case 123: -/* rule 123 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 302 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(ISTREAM); - } - YY_BREAK -case 124: -/* rule 124 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 307 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(StdString); - } - YY_BREAK -case 125: -YY_RULE_SETUP -#line 312 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(StdString); - } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 317 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(UnicodeString); - } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 322 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(VTK_ID); - } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 327 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(QT_ID); - } - YY_BREAK -case 129: -YY_RULE_SETUP -#line 332 "vtkParse.l" -get_macro_arguments(); /* gcc attributes */ - YY_BREAK -case 130: -YY_RULE_SETUP -#line 334 "vtkParse.l" -get_macro_arguments(); /* Windows linkage */ - YY_BREAK -case 131: -YY_RULE_SETUP -#line 336 "vtkParse.l" -/* Windows */ - YY_BREAK -case 132: -YY_RULE_SETUP -#line 338 "vtkParse.l" -{ - const char *args = get_macro_arguments(); - if (args && args[0] != '\0' && args[1] != '\0') - { - size_t l = strlen(args); - push_macro(NULL); - push_buffer(); - macroName = "VTK_LEGACY"; - macroUsed = 0; - macroEnded = 0; - yy_switch_to_buffer(yy_scan_bytes(&args[1],l-2)); - } - free((char *)args); - } - YY_BREAK -case 133: -YY_RULE_SETUP -#line 353 "vtkParse.l" -{ - const char *name = vtkstrndup(yytext, yyleng); - MacroInfo *macro = vtkParsePreprocess_GetMacro(preprocessor, name); - int expanded = 0; - if (macro) - { - const char *args = NULL; - const char *emacro = NULL; - - /* make sure that vtkNotUsed is never expanded */ - MacroInfo *ex; - ex = vtkParsePreprocess_GetMacro(preprocessor, "vtkNotUsed"); - if (ex) - { - ex->IsExcluded = 1; - } - - if (macro->IsFunction) - { - args = get_macro_arguments(); - if (args) - { - emacro = vtkParsePreprocess_ExpandMacro(preprocessor, macro, args); - if (!emacro) - { - print_preprocessor_error(VTK_PARSE_MACRO_NUMARGS, NULL, 0); - } - free((char *)args); - } - } - else if (macro->Definition && macro->Definition[0]) - { - /* first see if macro evaluates to a constant value */ - preproc_int_t val; - int is_unsigned; - int r; - macro->IsExcluded = 1; - r = vtkParsePreprocess_EvaluateExpression( - preprocessor, macro->Definition, &val, &is_unsigned); - macro->IsExcluded = 0; - /* if it isn't a constant expression, then expand it */ - if (r >= VTK_PARSE_MACRO_UNDEFINED) - { - emacro = vtkParsePreprocess_ExpandMacro(preprocessor, macro, NULL); - if (!emacro) - { - print_preprocessor_error(r, NULL, 0); - } - } - } - else - { - /* macros with no definition expand to nothing */ - expanded = 1; - } - if (emacro) - { - /* invoke the parser on any expanded macros */ - push_macro(macro); - push_buffer(); - yy_switch_to_buffer(yy_scan_string(emacro)); - vtkParsePreprocess_FreeMacroExpansion(preprocessor, macro, emacro); - expanded = 1; - } - } - if (!expanded) - { - /* if no macro expansion occurred, return the ID */ - yylval.str = name; - if (yyleng > 3 && name[0] == 'v' && name[1] == 't' && name[2] == 'k') - { - return(VTK_ID); - } - else if (name[0] == 'Q') - { - return(QT_ID); - } - else - { - return(ID); - } - } - } - YY_BREAK -case 134: -YY_RULE_SETUP -#line 437 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(FLOAT_LITERAL); - } - YY_BREAK -case 135: -YY_RULE_SETUP -#line 442 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(FLOAT_LITERAL); - } - YY_BREAK -case 136: -YY_RULE_SETUP -#line 447 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(FLOAT_LITERAL); - } - YY_BREAK -case 137: -YY_RULE_SETUP -#line 452 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(HEX_LITERAL); - } - YY_BREAK -case 138: -YY_RULE_SETUP -#line 457 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(OCT_LITERAL); - } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 462 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(INT_LITERAL); - } - YY_BREAK -case 140: -YY_RULE_SETUP -#line 467 "vtkParse.l" -{ - yylval.str = vtkstrndup(yytext, yyleng); - return(ZERO); - } - YY_BREAK -case 141: -/* rule 141 can match eol */ -YY_RULE_SETUP -#line 472 "vtkParse.l" -/* escaped newlines */ - YY_BREAK -case 142: -YY_RULE_SETUP -#line 473 "vtkParse.l" -/* whitespace */ - YY_BREAK -case 143: -/* rule 143 can match eol */ -YY_RULE_SETUP -#line 474 "vtkParse.l" -/* whitespace */ - YY_BREAK -case 144: -YY_RULE_SETUP -#line 476 "vtkParse.l" -return(OP_LSHIFT_EQ); - YY_BREAK -case 145: -YY_RULE_SETUP -#line 477 "vtkParse.l" -return(OP_RSHIFT_EQ); - YY_BREAK -case 146: -YY_RULE_SETUP -#line 478 "vtkParse.l" -return(OP_LSHIFT); - YY_BREAK -case 147: -YY_RULE_SETUP -#line 479 "vtkParse.l" -return(OP_DOT_POINTER); - YY_BREAK -case 148: -YY_RULE_SETUP -#line 480 "vtkParse.l" -return(OP_ARROW_POINTER); - YY_BREAK -case 149: -YY_RULE_SETUP -#line 481 "vtkParse.l" -return(OP_ARROW); - YY_BREAK -case 150: -YY_RULE_SETUP -#line 482 "vtkParse.l" -return(OP_RSHIFT); - YY_BREAK -case 151: -YY_RULE_SETUP -#line 483 "vtkParse.l" -return(OP_INCR); - YY_BREAK -case 152: -YY_RULE_SETUP -#line 484 "vtkParse.l" -return(OP_DECR); - YY_BREAK -case 153: -YY_RULE_SETUP -#line 485 "vtkParse.l" -return(OP_PLUS_EQ); - YY_BREAK -case 154: -YY_RULE_SETUP -#line 486 "vtkParse.l" -return(OP_MINUS_EQ); - YY_BREAK -case 155: -YY_RULE_SETUP -#line 487 "vtkParse.l" -return(OP_TIMES_EQ); - YY_BREAK -case 156: -YY_RULE_SETUP -#line 488 "vtkParse.l" -return(OP_DIVIDE_EQ); - YY_BREAK -case 157: -YY_RULE_SETUP -#line 489 "vtkParse.l" -return(OP_REMAINDER_EQ); - YY_BREAK -case 158: -YY_RULE_SETUP -#line 490 "vtkParse.l" -return(OP_AND_EQ); - YY_BREAK -case 159: -YY_RULE_SETUP -#line 491 "vtkParse.l" -return(OP_OR_EQ); - YY_BREAK -case 160: -YY_RULE_SETUP -#line 492 "vtkParse.l" -return(OP_XOR_EQ); - YY_BREAK -case 161: -YY_RULE_SETUP -#line 493 "vtkParse.l" -return(OP_LOGIC_AND); - YY_BREAK -case 162: -YY_RULE_SETUP -#line 494 "vtkParse.l" -return(OP_LOGIC_OR); - YY_BREAK -case 163: -YY_RULE_SETUP -#line 495 "vtkParse.l" -return(OP_LOGIC_EQ); - YY_BREAK -case 164: -YY_RULE_SETUP -#line 496 "vtkParse.l" -return(OP_LOGIC_NEQ); - YY_BREAK -case 165: -YY_RULE_SETUP -#line 497 "vtkParse.l" -return(OP_LOGIC_LEQ); - YY_BREAK -case 166: -YY_RULE_SETUP -#line 498 "vtkParse.l" -return(OP_LOGIC_GEQ); - YY_BREAK -case 167: -YY_RULE_SETUP -#line 499 "vtkParse.l" -return(ELLIPSIS); - YY_BREAK -case 168: -YY_RULE_SETUP -#line 500 "vtkParse.l" -return(DOUBLE_COLON); - YY_BREAK -case 169: -YY_RULE_SETUP -#line 502 "vtkParse.l" -return('['); - YY_BREAK -case 170: -YY_RULE_SETUP -#line 503 "vtkParse.l" -return(']'); - YY_BREAK -case 171: -YY_RULE_SETUP -#line 505 "vtkParse.l" -return(yytext[0]); - YY_BREAK -case YY_STATE_EOF(INITIAL): -#line 507 "vtkParse.l" -{ if (!pop_buffer()) { yyterminate(); } } - YY_BREAK -case 172: -YY_RULE_SETUP -#line 509 "vtkParse.l" -{ return(OTHER); } - YY_BREAK -case 173: -YY_RULE_SETUP -#line 511 "vtkParse.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 2910 "lex.yy.c" - - 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); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->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_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->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_LVALUE->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_LVALUE->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 (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->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_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->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 single character, 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_LVALUE->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_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* 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 ) - { - yy_size_t 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. */ - yyrealloc((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_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - 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_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->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 (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - 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 >= 1116 ) - 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 ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - 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 >= 1116 ) - 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 == 1115); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#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_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return 0; - - 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) + offset; - break; - } - } - } - - 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); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) - - yylineno++; -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - 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_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = 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; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(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 *) yyalloc(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; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - 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( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - 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) yyalloc(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; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n, i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_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; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (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. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - /* We do not touch yylineno unless the option is enabled. */ - yylineno = 1; - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* 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 ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 511 "vtkParse.l" - - - -/* - * Return a parenthetical macro arg list as a new string. - */ -const char *get_macro_arguments() -{ - char *cp = NULL; - size_t i = 0; - int depth; - int ws = 0; - int sl = 0; - int c1 = input(); - - if (c1 == '\0') - { - if (pop_buffer() == 0) - { - return NULL; - } - } - - while (c1 == ' ' || c1 == '\t' || c1 == '\r' || c1 == '\n') - { - c1 = input(); - } - - cp = (char *)malloc(4); - - if (c1 != '(') - { - unput(c1); - return NULL; - } - - cp[i++] = '('; - depth = 1; - c1 = input(); - - for (;;) - { - ws = 0; - sl = 0; - /* skip all whitespace */ - while (c1 == ' ' || c1 == '\t' || c1 == '\r' || c1 == '\n') - { - ws = 1; - c1 = input(); - } - if (c1 == '/') - { - c1 = input(); - if (c1 == '*') - { - /* skip a C style comment */ - ws = 1; - if (skip_comment() == 0) - { - return NULL; - } - c1 = input(); - } - else if (c1 == '/') - { - /* skip a C++ style comment */ - ws = 1; - do { c1 = input(); } - while (c1 != '\n' && c1 != '\0'); - if (c1 == '\0') - { - return NULL; - } - c1 = input(); - } - else - { - sl = 1; - } - } - if (ws) - { - /* add a single space to replace any whitespace */ - cp[i++] = ' '; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - } - if (sl) - { - /* add a single space to replace any whitespace */ - cp[i++] = '/'; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - } - if (c1 == '\"' || c1 == '\'') - { - int c2 = c1; - int escaped = 2; - int firstloop = 1; - do - { - if (escaped) - { - --escaped; - } - if (!firstloop) - { - c1 = input(); - } - firstloop = 0; - if (c1 == '\0') - { - break; - } - if (escaped == 0 && c1 == '\\') - { - escaped = 2; - } - cp[i++] = (char)c1; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - } - while (c1 != c2 || escaped); - } - else if (c1 != '\0') - { - cp[i++] = (char)c1; - if (i >= 4 && (i & (i-1)) == 0) - { - cp = (char *)realloc(cp, 2*i); - } - cp[i] = '\0'; - if (c1 == '(') - { - depth++; - } - if (c1 == ')') - { - if (--depth == 0) - { - break; - } - } - } - else - { - return NULL; - } - c1 = input(); - } - - return cp; -} - -/* - * Skip a C-style comment, return 0 if unterminated. - */ -int skip_comment() -{ - int c1 = 0, c2 = input(); - for (;;) - { - if (c2 == 0) - { - print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, - "Cannot find end of comment.", 27); - return 0; - } - if (c1 == '*' && c2 == '/') break; - c1 = c2; c2 = input(); - } - return 1; -} - -/* - * If token contains a comment, make sure whole comment is skipped. - */ -int skip_trailing_comment(const char *text, size_t l) -{ - const char *cp = text; - const char *ep = text + l; - int incomment = 0; - - while (cp < ep) - { - while (cp < ep && *cp != '/' && *cp != '\"') { cp++; }; - if (cp >= ep) - { - break; - } - else if (cp[0] == '/' && cp[1] == '*') - { - incomment = 1; - cp += 2; - while (cp < ep && *cp != '*') { cp++; }; - if (cp[0] == '*' && cp[1] == '/') - { - incomment = 0; - cp += 2; - } - else - { - cp++; - } - } - else if (cp[0] == '\"') - { - cp++; - while (cp < ep) - { - while (cp < ep && *cp != '\\' && *cp != '\"') { cp++; }; - if (cp >= ep) - { - break; - } - else if (*cp == '\"') - { - cp++; - break; - } - else /* if (*cp == '\\') */ - { - cp += 2; - } - } - } - else - { - cp++; - } - } - - if (incomment) - { - return skip_comment(); - } - - return 1; -} - -/* - * Skip ahead until the next preprocessor directive. - * This will eat the '#' that starts the directive. - * Return 0 if none found. - */ -int skip_to_next_directive() -{ - /* state == 0 at the start of a line */ - int state = 0; - int c; - - c = input(); - - while (c != 0) - { - /* whitespace */ - if (c == ' ' || c == '\t') - { - c = input(); - } - /* newline renews the start-of-line state */ - else if (c == '\n') - { - state = 0; - c = input(); - } - /* skip comments */ - else if (c == '/') - { - state = 1; - if ( (c = input()) == '*') - { - if (skip_comment() == 0) - { - return 0; - } - c = input(); - } - } - /* skip escaped characters */ - else if (c == '\\') - { - state = 1; - if ( (c = input()) == '\r') - { - if ( (c = input()) == '\n') - { - c = input(); - } - } - else if (c != 0) - { - c = input(); - } - } - /* any other chars except '#' at start of line */ - else if (c != '#' || state != 0) - { - state = 1; - c = input(); - } - else - { - break; - } - } - - return c; -} - -/* - * Skip to the next #else or #elif or #endif - */ -int skip_conditional_block() -{ - static char *linebuf = NULL; - static size_t linemaxlen = 80; - size_t i; - int c; - int result; - - if (linebuf == 0) - { - linebuf = (char *)malloc(linemaxlen); - } - - for (;;) - { - if (skip_to_next_directive() == 0) - { - return 0; - } - c = input(); - while (c == ' ' || c == '\t') - { - c = input(); - } - if (c == 0) - { - return 0; - } - - /* eat the whole line */ - i = 0; - linebuf[i++] = '#'; - while (c != 0 && c != '\n') - { - if (i >= linemaxlen-5) - { - linemaxlen += i+5; - linebuf = (char *)realloc(linebuf, linemaxlen); - } - linebuf[i++] = c; - /* be sure to skip escaped newlines */ - if (c == '\\') - { - c = input(); - linebuf[i++] = c; - if (c == '\r') - { - c = input(); - linebuf[i++] = c; - } - } - c = input(); - } - linebuf[i++] = c; - - result = vtkParsePreprocess_HandleDirective(preprocessor, linebuf); - if (result != VTK_PARSE_SKIP && result != VTK_PARSE_OK) - { - print_preprocessor_error(result, linebuf, i); - } - else if (result != VTK_PARSE_SKIP) - { - break; - } - } - - return 1; -} - -/* - * Skip ahead until one of the strings is found, - * then skip to the end of the line. - */ -int skip_ahead_multi(const char *strings[]) -{ - char textbuf[SKIP_MATCH_MAXLEN+1]; - char c = 0; - size_t i; - - for (i = 0; i < (SKIP_MATCH_MAXLEN+1); i++) - { - textbuf[i] = '\0'; - } - - for (;;) - { - for (i = 0; i < SKIP_MATCH_MAXLEN; i++) - { - textbuf[i] = textbuf[i+1]; - } - - if ((c = (char)input()) == '\0') - { - print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, NULL, 0); - return 0; - } - - textbuf[SKIP_MATCH_MAXLEN-1] = c; - - for (i = 0; strings[i]; i++) - { - if (strcmp(&textbuf[SKIP_MATCH_MAXLEN-strlen(strings[i])], - strings[i]) == 0) - { - break; - } - } - if (strings[i]) - { - break; - } - } - - while (c != '\0' && c != '\n') - { - c = (char)input(); - } - - return 1; -} - -/* - * Skip ahead until the string is found. - */ -int skip_ahead_until(const char *text) -{ - const char *strings[2]; - strings[0] = text; - strings[1] = NULL; - - return skip_ahead_multi(strings); -} - -/* - * buffer stack, used for macro expansion and include files - */ -static size_t buffer_stack_size = 0; -static YY_BUFFER_STATE *buffer_stack = NULL; - -/* - * push the current buffer onto the buffer stack. - */ -void push_buffer() -{ - size_t n = buffer_stack_size; - if (buffer_stack == NULL) - { - buffer_stack = (YY_BUFFER_STATE *)malloc(4*sizeof(YY_BUFFER_STATE)); - } - /* grow the stack whenever size reaches a power of two */ - else if (n >= 4 && (n & (n-1)) == 0) - { - buffer_stack = (YY_BUFFER_STATE *)realloc( - buffer_stack, 2*n*sizeof(YY_BUFFER_STATE)); - } - buffer_stack[buffer_stack_size++] = YY_CURRENT_BUFFER; -} - -/* - * pop the buffer stack and restore the previous buffer - */ -int pop_buffer() -{ - if (in_macro()) - { - pop_macro(); - } - else - { - pop_include(); - } - if (buffer_stack_size == 0) - { - return 0; - } - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(buffer_stack[--buffer_stack_size]); - return 1; -} - -/* - * include stack, to tell what include is being evaluated - */ -static size_t include_stack_size = 0; -static FileInfo **include_stack = NULL; -static int *lineno_stack = NULL; - -/* - * push the current include onto the include stack. - */ -void push_include(const char *filename) -{ - FileInfo *file_info = NULL; - int same_file = 0; - size_t n = include_stack_size; - - if (include_stack == NULL) - { - include_stack = (FileInfo **)malloc(4*sizeof(FileInfo *)); - lineno_stack = (int *)malloc(4*sizeof(int)); - } - - /* grow the stack whenever size reaches a power of two */ - else if (n >= 4 && (n & (n-1)) == 0) - { - include_stack = (FileInfo **)realloc( - include_stack, 2*n*sizeof(FileInfo *)); - lineno_stack = (int *)realloc( - lineno_stack, 2*n*sizeof(int)); - } - - lineno_stack[include_stack_size] = yyget_lineno(); - yyset_lineno(0); - include_stack[include_stack_size++] = data; - - /* if the file is including itself */ - if (filename == data->FileName || - (filename != 0 && data->FileName != 0 && - strcmp(filename, data->FileName) == 0)) - { - same_file = 1; - } - - /* make a new fileinfo, but only if we are in the base namespace - * and only if the only items added so far are constants */ - if (!same_file && currentNamespace == data->Contents && - data->Contents->NumberOfItems == data->Contents->NumberOfConstants) - { - file_info = (FileInfo *)malloc(sizeof(FileInfo)); - vtkParse_InitFile(file_info); - file_info->FileName = vtkstrdup(filename); - file_info->Contents = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_InitNamespace(file_info->Contents); - vtkParse_AddIncludeToFile(data, file_info); - file_info->Strings = data->Strings; - data = file_info; - currentNamespace = file_info->Contents; - } -} - -/* - * pop the include stack - */ -void pop_include() -{ - if (include_stack_size > 0) - { - --include_stack_size; - fclose(yyin); - yyset_lineno(lineno_stack[include_stack_size]); - if (data != include_stack[include_stack_size]) - { - data = include_stack[include_stack_size]; - currentNamespace = data->Contents; - } - } -} - - -/* - * macro stack, to tell what macro is being evaluated - */ -static size_t macro_stack_size = 0; -static MacroInfo **macro_stack = NULL; - -/* - * push the current macro onto the macro stack. - */ -void push_macro(MacroInfo *macro) -{ - size_t n = macro_stack_size; - if (macro_stack == NULL) - { - macro_stack = (MacroInfo **)malloc(4*sizeof(MacroInfo *)); - } - /* grow the stack whenever size reaches a power of two */ - else if (n >= 4 && (n & (n-1)) == 0) - { - macro_stack = (MacroInfo **)realloc( - macro_stack, 2*n*sizeof(MacroInfo *)); - } - macro_stack[macro_stack_size++] = macro; - if (macro) - { - macro->IsExcluded = 1; - if (macro_stack_size == 1) - { - macroName = macro->Name; - macroUsed = 0; - macroEnded = 0; - } - } -} - -/* - * pop the macro stack - */ -void pop_macro() -{ - MacroInfo *macro; - - if (macro_stack_size > 0) - { - macro = macro_stack[--macro_stack_size]; - if (macro) - { - macro->IsExcluded = 0; - } - } - macroEnded = 1; -} - -/* - * are we currently processing a macro? - */ -int in_macro() -{ - return (macro_stack_size > 0); -} - -/* - * print a preprocessor error code with filename and line number. - */ -void print_preprocessor_error(int result, const char *cp, size_t n) -{ - const char *text = ""; - - switch (result) - { - case VTK_PARSE_OK: - case VTK_PARSE_SKIP: - return; - case VTK_PARSE_PREPROC_DOUBLE: - text = "double in preprocessor conditional"; - break; - case VTK_PARSE_PREPROC_FLOAT: - text = "float in preprocessor conditional"; - break; - case VTK_PARSE_PREPROC_STRING: - text = "string in preprocessor conditional"; - break; - case VTK_PARSE_MACRO_UNDEFINED: - text = "undefined macro"; - break; - case VTK_PARSE_MACRO_REDEFINED: - text = "redefined macro"; - break; - case VTK_PARSE_FILE_NOT_FOUND: - text = "file not found"; - break; - case VTK_PARSE_FILE_OPEN_ERROR: - text = "can\'t open file"; - break; - case VTK_PARSE_FILE_READ_ERROR: - text = "input/output error"; - break; - case VTK_PARSE_MACRO_NUMARGS: - text = "wrong number of macro args"; - break; - case VTK_PARSE_SYNTAX_ERROR: - text = "syntax error"; - break; - } - - /* be silent about missing include files */ - if (result == VTK_PARSE_FILE_NOT_FOUND) - { - return; - } - - print_parser_error(text, cp, n); -} - -/* - * print an error with filename and line number. - */ -void print_parser_error(const char *text, const char *cp, size_t n) -{ - size_t j = 0; - const char *fn = "(none)"; - - if (data->FileName) - { - fn = data->FileName; - } - fprintf(yyout, "In %s:", fn); - for (j = 0; j < include_stack_size; j++) - { - fprintf(yyout, "%i:\nIn %s:", - lineno_stack[j], include_stack[j]->FileName); - } - fprintf(yyout, "%i:\n", yylineno); - - if (cp) - { - fprintf(yyout, "%s: %*.*s\n", text, (int)n, (int)n, cp); - } - else if (text) - { - fprintf(yyout, "%s.\n", text); - } -} - -/* - * Execute a preprocessor directive. - */ -void preprocessor_directive(const char *text, size_t l) -{ - int result = 0; - size_t n = 0; - const char *cp = text; - const char *ep = text + l; - const char *directive = NULL; - - /* find the directive, store its length in "n" */ - while (*cp == ' ' || *cp == '\t') { cp++; } - if (*cp == '#') { cp++; } - while ((*cp == ' ' || *cp == '\t') && cp < ep) { cp++; } - directive = cp; - while (*cp >= 'a' && *cp <= 'z' && cp < ep) { cp++; } - n = cp - directive; - while ((*cp == ' ' || *cp == '\t') && cp < ep) { cp++; } - - if (n == 7 && strncmp(directive, "include", n) == 0) - { - /* include files */ - int already_loaded = 0; - if (*cp == '<' || *cp == '\"') - { - /* if asked to recurse into header files */ - if (Recursive && ep - cp > 3) - { - const char *dp; - dp = vtkParsePreprocess_FindIncludeFile(preprocessor, - &cp[1], (*cp != '\"'), &already_loaded); - if (dp) - { - yyin = fopen(dp, "r"); - if (yyin) - { - push_include(dp); - push_buffer(); - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); - return; - } - } - } - } - } - - /* let the preprocessor handle the directive */ - result = vtkParsePreprocess_HandleDirective(preprocessor, text); - - if (result == VTK_PARSE_SKIP) - { - skip_conditional_block(); - } - else if (result != VTK_PARSE_OK) - { - print_preprocessor_error(result, text, l); - } - else if (n == 6 && strncmp(directive, "define", n) == 0 && - ep - cp > 4 && strncmp(cp, "VTK", 3) == 0) - { - /* macros that start with "VTK" */ - MacroInfo *macro; - - macro = vtkParsePreprocess_GetMacro(preprocessor, cp); - if (macro && macro->Definition && !macro->IsFunction) - { - /* if macro evaluates to a constant, add it as a constant */ - macro->IsExcluded = 1; - if (guess_constant_type(macro->Definition) == 0) - { - result = VTK_PARSE_MACRO_UNDEFINED; - } - macro->IsExcluded = 0; - if (result < VTK_PARSE_MACRO_UNDEFINED) - { - add_constant( - vtkstrdup(macro->Name), vtkstrdup(macro->Definition), 0, NULL, 1); - } - } - } -} diff --git a/src/ParaView/readme.txt b/src/ParaView/readme.txt deleted file mode 100644 index 40939f71..00000000 --- a/src/ParaView/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -These files are pure copy from Paraview sources. -They need for extractor building. -Them has to be updated if the corresponded files in paraview will be changed \ No newline at end of file diff --git a/src/ParaView/vtkParse.tab.c b/src/ParaView/vtkParse.tab.c deleted file mode 100644 index 59894246..00000000 --- a/src/ParaView/vtkParse.tab.c +++ /dev/null @@ -1,9505 +0,0 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - 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 3 of the License, 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.4.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 15 "vtkParse.y" - - -/* - -This file must be translated to C and modified to build everywhere. - -Run yacc like this: - - yacc -b vtkParse vtkParse.y - -Modify vtkParse.tab.c: - - convert TABs to spaces (eight per tab) - - remove spaces from ends of lines, s/ *$//g - - remove the "goto yyerrlab1;" that appears right before yyerrlab1: - - remove the #defined constants that appear right after the anonymous_enums - -*/ - -/* -The purpose of this parser is to read C++ header files in order to -generate data structures that describe the C++ interface of a library, -one header file at a time. As such, it is not a complete C++ parser. -It only parses what is relevant to the interface and skips the rest. - -While the parser reads method definitions, type definitions, and -template definitions it generates a "signature" which is a string -that matches (apart from whitespace) the text that was parsed. - -While parsing types, the parser creates an unsigned int that describes -the type as well as creating other data structures for arrays, function -pointers, etc. The parser also creates a typeId string, which is either -a simple id that gives the class name or type name, or is "function" for -function pointer types, or "method" for method pointer types. -*/ - -/* -Conformance Notes: - -This parser was designed empirically and incrementally. It has been -refactored to make it more similar to the ANSI C++ 1996 BNF grammar, -but there are still many very significant differences. - -The most significant difference between this parser and a "standard" -parser is that it only parses declarations in detail. All other -statements and expressions are parsed as arbitrary sequences of symbols, -without any syntactic analysis. - -The "unqualified_id" does not directly include "operator_function_id" or -"conversion_function_id" (e.g. ids like "operator=" or "operator int*"). -Instead, these two id types are used to allow operator functions to be -handled by their own rules, rather than by the generic function rules. -These ids can only be used in function declarations and using declarations. - -Types are handled quite differently from the ANSI BNF. These differences -represent a prolonged (and ultimately successful) attempt to empirically -create a yacc parser without any shift/reduce conflicts. The rules for -types are organized according to the way that types are usually defined -in working code, rather than strictly according to C++ grammar. - -The declaration specifiers "friend" and "typedef" can only appear at the -beginning of a declaration sequence. There are also restrictions on -where class and enum specifiers can be used: you can declare a new struct -within a variable declaration, but not within a parameter declaration. - -The lexer returns each of "(scope::*", "(*", "(a::b::*", etc. as single -tokens. The ANSI BNF, in contrast, would consider these to be a "(" -followed by a "ptr_operator". The lexer concatenates these tokens in -order to eliminate shift/reduce conflicts in the parser. However, this -means that this parser will only recognize "scope::*" as valid if it is -preceded by "(", e.g. as part of a member function pointer specification. - -An odd bit of C++ ambiguity is that y(x); can be interpreted variously -as declaration of variable "x" of type "y", as a function call if "y" -is the name of a function, or as a constructor if "y" is the name of -a class. This parser always interprets this pattern as a constructor -declaration, because function calls are ignored by the parser, and -variable declarations of the form y(x); are exceedingly rare compared -to the more usual form y x; without parentheses. -*/ - -#include -#include -#include -#define yyerror(a) fprintf(stderr,"%s\n",a) -#define yywrap() 1 - -/* Make sure yacc-generated code knows we have included stdlib.h. */ -#ifndef _STDLIB_H -# define _STDLIB_H -#endif -#define YYINCLUDED_STDLIB_H - -/* Borland and MSVC do not define __STDC__ properly. */ -#if !defined(__STDC__) -# if (defined(_MSC_VER) && _MSC_VER >= 1200) || defined(__BORLANDC__) -# define __STDC__ 1 -# endif -#endif - -/* Disable warnings in generated code. */ -#if defined(_MSC_VER) -# pragma warning (disable: 4127) /* conditional expression is constant */ -# pragma warning (disable: 4244) /* conversion to smaller integer type */ -#endif -#if defined(__BORLANDC__) -# pragma warn -8004 /* assigned a value that is never used */ -# pragma warn -8008 /* conditional is always true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Map from the type anonymous_enumeration in vtkType.h to the - VTK wrapping type system number for the type. */ - -#include "vtkParse.h" -#include "vtkParsePreprocess.h" -#include "vtkParseData.h" -#include "vtkType.h" - -static unsigned int vtkParseTypeMap[] = - { - VTK_PARSE_VOID, /* VTK_VOID 0 */ - 0, /* VTK_BIT 1 */ - VTK_PARSE_CHAR, /* VTK_CHAR 2 */ - VTK_PARSE_UNSIGNED_CHAR, /* VTK_UNSIGNED_CHAR 3 */ - VTK_PARSE_SHORT, /* VTK_SHORT 4 */ - VTK_PARSE_UNSIGNED_SHORT, /* VTK_UNSIGNED_SHORT 5 */ - VTK_PARSE_INT, /* VTK_INT 6 */ - VTK_PARSE_UNSIGNED_INT, /* VTK_UNSIGNED_INT 7 */ - VTK_PARSE_LONG, /* VTK_LONG 8 */ - VTK_PARSE_UNSIGNED_LONG, /* VTK_UNSIGNED_LONG 9 */ - VTK_PARSE_FLOAT, /* VTK_FLOAT 10 */ - VTK_PARSE_DOUBLE, /* VTK_DOUBLE 11 */ - VTK_PARSE_ID_TYPE, /* VTK_ID_TYPE 12 */ - VTK_PARSE_STRING, /* VTK_STRING 13 */ - 0, /* VTK_OPAQUE 14 */ - VTK_PARSE_SIGNED_CHAR, /* VTK_SIGNED_CHAR 15 */ - VTK_PARSE_LONG_LONG, /* VTK_LONG_LONG 16 */ - VTK_PARSE_UNSIGNED_LONG_LONG, /* VTK_UNSIGNED_LONG_LONG 17 */ - VTK_PARSE___INT64, /* VTK___INT64 18 */ - VTK_PARSE_UNSIGNED___INT64, /* VTK_UNSIGNED___INT64 19 */ - 0, /* VTK_VARIANT 20 */ - 0, /* VTK_OBJECT 21 */ - VTK_PARSE_UNICODE_STRING /* VTK_UNICODE_STRING 22 */ - }; - -/* Define some constants to simplify references to the table lookup in - the primitive_type production rule code. */ -#define VTK_PARSE_INT8 vtkParseTypeMap[VTK_TYPE_INT8] -#define VTK_PARSE_UINT8 vtkParseTypeMap[VTK_TYPE_UINT8] -#define VTK_PARSE_INT16 vtkParseTypeMap[VTK_TYPE_INT16] -#define VTK_PARSE_UINT16 vtkParseTypeMap[VTK_TYPE_UINT16] -#define VTK_PARSE_INT32 vtkParseTypeMap[VTK_TYPE_INT32] -#define VTK_PARSE_UINT32 vtkParseTypeMap[VTK_TYPE_UINT32] -#define VTK_PARSE_INT64 vtkParseTypeMap[VTK_TYPE_INT64] -#define VTK_PARSE_UINT64 vtkParseTypeMap[VTK_TYPE_UINT64] -#define VTK_PARSE_FLOAT32 vtkParseTypeMap[VTK_TYPE_FLOAT32] -#define VTK_PARSE_FLOAT64 vtkParseTypeMap[VTK_TYPE_FLOAT64] - -#define vtkParseDebug(s1, s2) \ - if ( parseDebug ) { fprintf(stderr, " %s %s\n", s1, s2); } - -/* the tokenizer */ -int yylex(void); - -/* global variables */ -FileInfo *data = NULL; -int parseDebug; - -/* the "preprocessor" */ -PreprocessInfo *preprocessor = NULL; - -/* include dirs specified on the command line */ -int NumberOfIncludeDirectories= 0; -const char **IncludeDirectories; - -/* macros specified on the command line */ -int NumberOfDefinitions = 0; -const char **Definitions; - -/* options that can be set by the programs that use the parser */ -int IgnoreBTX = 0; -int Recursive = 0; - -/* various state variables */ -NamespaceInfo *currentNamespace = NULL; -ClassInfo *currentClass = NULL; -FunctionInfo *currentFunction = NULL; -TemplateInfo *currentTemplate = NULL; -const char *currentEnumName = NULL; -const char *currentEnumValue = NULL; -parse_access_t access_level = VTK_ACCESS_PUBLIC; - -/* functions from vtkParse.l */ -void print_parser_error(const char *text, const char *cp, size_t n); - -/* helper functions */ -const char *type_class(unsigned int type, const char *classname); -void start_class(const char *classname, int is_struct_or_union); -void reject_class(const char *classname, int is_struct_or_union); -void end_class(); -void add_base_class(ClassInfo *cls, const char *name, int access_lev, - int is_virtual); -void output_friend_function(void); -void output_function(void); -void reject_function(void); -void set_return(FunctionInfo *func, unsigned int type, - const char *typeclass, int count); -void add_parameter(FunctionInfo *func, unsigned int type, - const char *classname, int count); -void add_template_parameter(unsigned int datatype, - unsigned int extra, const char *funcSig); -void add_using(const char *name, int is_namespace); -void start_enum(const char *enumname); -void add_enum(const char *name, const char *value); -void end_enum(); -unsigned int guess_constant_type(const char *value); -void add_constant(const char *name, const char *value, - unsigned int type, const char *typeclass, int global); -const char *add_const_scope(const char *name); -void prepend_scope(char *cp, const char *arg); -unsigned int guess_id_type(const char *cp); -unsigned int add_indirection(unsigned int tval, unsigned int ptr); -unsigned int add_indirection_to_array(unsigned int ptr); -void handle_complex_type(ValueInfo *val, unsigned int datatype, - unsigned int extra, const char *funcSig); -void handle_function_type(ValueInfo *param, const char *name, - const char *funcSig); -void add_legacy_parameter(FunctionInfo *func, ValueInfo *param); - -void outputSetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n); -void outputGetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n); - -/*---------------------------------------------------------------- - * String utility methods - * - * Strings are centrally allocated and are const, and they are not - * freed until the program exits. If they need to be freed before - * then, vtkParse_FreeStringCache() can be called. - */ - -/* duplicate the first n bytes of a string and terminate */ -static const char *vtkstrndup(const char *in, size_t n) -{ - return vtkParse_CacheString(data->Strings, in, n); -} - -/* duplicate a string */ -static const char *vtkstrdup(const char *in) -{ - if (in) - { - in = vtkParse_CacheString(data->Strings, in, strlen(in)); - } - - return in; -} - -/* helper function for concatenating strings */ -static const char *vtkstrncat(size_t n, const char **str) -{ - char *cp; - size_t i; - size_t j[8]; - size_t m = 0; - - for (i = 0; i < n; i++) - { - j[i] = 0; - if (str[i]) - { - j[i] = strlen(str[i]); - m += j[i]; - } - } - cp = vtkParse_NewString(data->Strings, m); - m = 0; - for (i = 0; i < n; i++) - { - if (j[i]) - { - strncpy(&cp[m], str[i], j[i]); - m += j[i]; - } - } - cp[m] = '\0'; - - return cp; -} - -/* concatenate strings */ -static const char *vtkstrcat(const char *str1, const char *str2) -{ - const char *cp[2]; - - cp[0] = str1; - cp[1] = str2; - return vtkstrncat(2, cp); -} - -static const char *vtkstrcat3(const char *str1, const char *str2, - const char *str3) -{ - const char *cp[3]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - return vtkstrncat(3, cp); -} - -static const char *vtkstrcat4(const char *str1, const char *str2, - const char *str3, const char *str4) -{ - const char *cp[4]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - cp[3] = str4; - return vtkstrncat(4, cp); -} - -static const char *vtkstrcat5(const char *str1, const char *str2, - const char *str3, const char *str4, - const char *str5) -{ - const char *cp[5]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - cp[3] = str4; - cp[4] = str5; - return vtkstrncat(5, cp); -} - -static const char *vtkstrcat7(const char *str1, const char *str2, - const char *str3, const char *str4, - const char *str5, const char *str6, - const char *str7) -{ - const char *cp[7]; - - cp[0] = str1; - cp[1] = str2; - cp[2] = str3; - cp[3] = str4; - cp[4] = str5; - cp[5] = str6; - cp[6] = str7; - return vtkstrncat(7, cp); -} - -static size_t vtkidlen(const char *text) -{ - size_t i = 0; - char c = text[0]; - - if ((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - c == '_') - { - do - { - c = text[++i]; - } - while ((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - c == '_'); - } - - return i; -} - -/*---------------------------------------------------------------- - * Comments - */ - -/* "private" variables */ -char *commentText = NULL; -size_t commentLength = 0; -size_t commentAllocatedLength = 0; -int commentState = 0; - -const char *getComment() -{ - if (commentState != 0) - { - return commentText; - } - return NULL; -} - -void clearComment() -{ - commentLength = 0; - if (commentText) - { - commentText[commentLength] = '\0'; - } - commentState = 0; -} - -void addCommentLine(const char *line, size_t n) -{ - if (commentState <= 0) - { - clearComment(); - return; - } - - if (commentText == NULL) - { - commentAllocatedLength = n+80; - commentText = (char *)malloc(commentAllocatedLength); - commentLength = 0; - commentText[0] = '\0'; - } - else if (commentLength + n + 2 > commentAllocatedLength) - { - commentAllocatedLength = commentAllocatedLength + commentLength + n + 2; - commentText = (char *)realloc(commentText, commentAllocatedLength); - } - - if (n > 0) - { - memcpy(&commentText[commentLength], line, n); - } - commentLength += n; - commentText[commentLength++] = '\n'; - commentText[commentLength] = '\0'; -} - -void closeComment() -{ - switch (commentState) - { - case 1: - /* Make comment persist until a new comment starts */ - commentState = -1; - break; - case 2: - data->Description = vtkstrdup(getComment()); - clearComment(); - break; - case 3: - data->SeeAlso = vtkstrdup(getComment()); - clearComment(); - break; - case 4: - data->Caveats = vtkstrdup(getComment()); - clearComment(); - break; - } -} - -void closeOrClearComment() -{ - if (commentState < 0) - { - clearComment(); - } - else - { - closeComment(); - } -} - -void setCommentState(int state) -{ - switch (state) - { - case 0: - closeComment(); - break; - default: - closeComment(); - clearComment(); - break; - } - - commentState = state; -} - - -/*---------------------------------------------------------------- - * Macros - */ - -/* "private" variables */ -const char *macroName = NULL; -int macroUsed = 0; -int macroEnded = 0; - -const char *getMacro() -{ - if (macroUsed == 0) - { - macroUsed = macroEnded; - return macroName; - } - return NULL; -} - - -/*---------------------------------------------------------------- - * Namespaces - * - * operates on: currentNamespace - */ - -/* "private" variables */ -NamespaceInfo *namespaceStack[10]; -int namespaceDepth = 0; - -/* enter a namespace */ -void pushNamespace(const char *name) -{ - int i; - NamespaceInfo *oldNamespace = currentNamespace; - - for (i = 0; i < oldNamespace->NumberOfNamespaces; i++) - { - /* see if the namespace already exists */ - if (strcmp(name, oldNamespace->Namespaces[i]->Name) == 0) - { - currentNamespace = oldNamespace->Namespaces[i]; - } - } - - /* create a new namespace */ - if (i == oldNamespace->NumberOfNamespaces) - { - currentNamespace = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_InitNamespace(currentNamespace); - currentNamespace->Name = name; - vtkParse_AddNamespaceToNamespace(oldNamespace, currentNamespace); - } - - namespaceStack[namespaceDepth++] = oldNamespace; -} - -/* leave the namespace */ -void popNamespace() -{ - currentNamespace = namespaceStack[--namespaceDepth]; -} - - -/*---------------------------------------------------------------- - * Classes - * - * operates on: currentClass, access_level - */ - -/* "private" variables */ -ClassInfo *classStack[10]; -parse_access_t classAccessStack[10]; -int classDepth = 0; - -/* start an internal class definition */ -void pushClass() -{ - classAccessStack[classDepth] = access_level; - classStack[classDepth++] = currentClass; -} - -/* leave the internal class */ -void popClass() -{ - currentClass = classStack[--classDepth]; - access_level = classAccessStack[classDepth]; -} - - -/*---------------------------------------------------------------- - * Templates - * - * operates on: currentTemplate - */ - -/* "private" variables */ -TemplateInfo *templateStack[10]; -int templateDepth = 0; - -/* begin a template */ -void startTemplate() -{ - currentTemplate = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_InitTemplate(currentTemplate); -} - -/* clear a template, if set */ -void clearTemplate() -{ - if (currentTemplate) - { - free(currentTemplate); - } - currentTemplate = NULL; -} - -/* push the template onto the stack, and start a new one */ -void pushTemplate() -{ - templateStack[templateDepth++] = currentTemplate; - startTemplate(); -} - -/* pop a template off the stack */ -void popTemplate() -{ - currentTemplate = templateStack[--templateDepth]; -} - -/*---------------------------------------------------------------- - * Function signatures - * - * operates on: currentFunction - */ - -/* "private" variables */ -int sigClosed = 0; -size_t sigMark[10]; -size_t sigLength = 0; -size_t sigAllocatedLength = 0; -int sigMarkDepth = 0; -char *signature = NULL; - -/* start a new signature */ -void startSig() -{ - signature = NULL; - sigLength = 0; - sigAllocatedLength = 0; - sigClosed = 0; - sigMarkDepth = 0; - sigMark[0] = 0; -} - -/* get the signature */ -const char *getSig() -{ - return signature; -} - -/* get the signature length */ -size_t getSigLength() -{ - return sigLength; -} - -/* reset the sig to the specified length */ -void resetSig(size_t n) -{ - if (n < sigLength) - { - sigLength = n; - } -} - -/* reallocate Signature if n chars cannot be appended */ -void checkSigSize(size_t n) -{ - const char *ccp; - - if (sigAllocatedLength == 0) - { - sigLength = 0; - sigAllocatedLength = 80 + n; - signature = vtkParse_NewString(data->Strings, sigAllocatedLength); - signature[0] = '\0'; - } - else if (sigLength + n > sigAllocatedLength) - { - sigAllocatedLength += sigLength + n; - ccp = signature; - signature = vtkParse_NewString(data->Strings, sigAllocatedLength); - strncpy(signature, ccp, sigLength); - signature[sigLength] = '\0'; - } -} - -/* close the signature, i.e. allow no more additions to it */ -void closeSig() -{ - sigClosed = 1; -} - -/* re-open the signature */ -void openSig() -{ - sigClosed = 0; -} - -/* insert text at the beginning of the signature */ -void preSig(const char *arg) -{ - if (!sigClosed) - { - size_t n = strlen(arg); - checkSigSize(n); - if (n > 0) - { - memmove(&signature[n], signature, sigLength); - strncpy(signature, arg, n); - sigLength += n; - } - signature[sigLength] = '\0'; - } -} - -/* append text to the end of the signature */ -void postSig(const char *arg) -{ - if (!sigClosed) - { - size_t n = strlen(arg); - checkSigSize(n); - if (n > 0) - { - strncpy(&signature[sigLength], arg, n); - sigLength += n; - } - signature[sigLength] = '\0'; - } -} - -/* set a mark in the signature for later operations */ -void markSig() -{ - sigMark[sigMarkDepth] = 0; - if (signature) - { - sigMark[sigMarkDepth] = sigLength; - } - sigMarkDepth++; -} - -/* get the contents of the sig from the mark, and clear the mark */ -const char *copySig() -{ - const char *cp = NULL; - if (sigMarkDepth > 0) - { - sigMarkDepth--; - } - if (signature) - { - cp = &signature[sigMark[sigMarkDepth]]; - } - return vtkstrdup(cp); -} - -/* swap the signature text using the mark as the radix */ -void swapSig() -{ - if (sigMarkDepth > 0) - { - sigMarkDepth--; - } - if (signature && sigMark[sigMarkDepth] > 0) - { - size_t i, m, n, nn; - char c; - char *cp; - cp = signature; - n = sigLength; - m = sigMark[sigMarkDepth]; - nn = m/2; - for (i = 0; i < nn; i++) - { - c = cp[i]; cp[i] = cp[m-i-1]; cp[m-i-1] = c; - } - nn = (n-m)/2; - for (i = 0; i < nn; i++) - { - c = cp[i+m]; cp[i+m] = cp[n-i-1]; cp[n-i-1] = c; - } - nn = n/2; - for (i = 0; i < nn; i++) - { - c = cp[i]; cp[i] = cp[n-i-1]; cp[n-i-1] = c; - } - } -} - -/* chop the last space from the signature */ -void chopSig(void) -{ - if (signature) - { - size_t n = sigLength; - if (n > 0 && signature[n-1] == ' ') - { - signature[n-1] = '\0'; - sigLength--; - } - } -} - -/*---------------------------------------------------------------- - * Subroutines for building a type - */ - -/* "private" variables */ -unsigned int storedType; -unsigned int typeStack[10]; -int typeDepth = 0; - -/* save the type on the stack */ -void pushType() -{ - typeStack[typeDepth++] = storedType; -} - -/* pop the type stack */ -void popType() -{ - storedType = typeStack[--typeDepth]; -} - -/* clear the storage type */ -void clearType() -{ - storedType = 0; -} - -/* save the type */ -void setTypeBase(unsigned int base) -{ - storedType &= ~(unsigned int)(VTK_PARSE_BASE_TYPE); - storedType |= base; -} - -/* set a type modifier bit */ -void setTypeMod(unsigned int mod) -{ - storedType |= mod; -} - -/* modify the indirection (pointers, refs) in the storage type */ -void setTypePtr(unsigned int ind) -{ - storedType &= ~(unsigned int)(VTK_PARSE_INDIRECT); - ind &= VTK_PARSE_INDIRECT; - storedType |= ind; -} - -/* retrieve the storage type */ -unsigned int getType() -{ - return storedType; -} - -/* combine two primitive type parts, e.g. "long int" */ -unsigned int buildTypeBase(unsigned int a, unsigned int b) -{ - unsigned int base = (a & VTK_PARSE_BASE_TYPE); - unsigned int basemod = (b & VTK_PARSE_BASE_TYPE); - - switch (base) - { - case 0: - base = basemod; - break; - case VTK_PARSE_UNSIGNED_INT: - base = (basemod | VTK_PARSE_UNSIGNED); - break; - case VTK_PARSE_INT: - base = basemod; - if (base == VTK_PARSE_CHAR) - { - base = VTK_PARSE_SIGNED_CHAR; - } - break; - case VTK_PARSE_CHAR: - if (basemod == VTK_PARSE_INT) - { - base = VTK_PARSE_SIGNED_CHAR; - } - else if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_CHAR; - } - break; - case VTK_PARSE_SHORT: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_SHORT; - } - break; - case VTK_PARSE_LONG: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_LONG; - } - else if (basemod == VTK_PARSE_LONG) - { - base = VTK_PARSE_LONG_LONG; - } - else if (basemod == VTK_PARSE_DOUBLE) - { - base = VTK_PARSE_LONG_DOUBLE; - } - break; - case VTK_PARSE_UNSIGNED_LONG: - if (basemod == VTK_PARSE_LONG) - { - base = VTK_PARSE_UNSIGNED_LONG_LONG; - } - break; - case VTK_PARSE_LONG_LONG: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED_LONG_LONG; - } - break; - case VTK_PARSE___INT64: - if (basemod == VTK_PARSE_UNSIGNED_INT) - { - base = VTK_PARSE_UNSIGNED___INT64; - } - break; - case VTK_PARSE_DOUBLE: - if (basemod == VTK_PARSE_LONG) - { - base = VTK_PARSE_LONG_DOUBLE; - } - break; - } - - return ((a & ~(unsigned int)(VTK_PARSE_BASE_TYPE)) | base); -} - - -/*---------------------------------------------------------------- - * Array information - */ - -/* "private" variables */ -int numberOfDimensions = 0; -const char **arrayDimensions = NULL; - -/* clear the array counter */ -void clearArray(void) -{ - numberOfDimensions = 0; - arrayDimensions = NULL; -} - -/* add another dimension */ -void pushArraySize(const char *size) -{ - vtkParse_AddStringToArray(&arrayDimensions, &numberOfDimensions, - size); -} - -/* add another dimension to the front */ -void pushArrayFront(const char *size) -{ - int i; - - vtkParse_AddStringToArray(&arrayDimensions, &numberOfDimensions, 0); - - for (i = numberOfDimensions-1; i > 0; i--) - { - arrayDimensions[i] = arrayDimensions[i-1]; - } - - arrayDimensions[0] = size; -} - -/* get the number of dimensions */ -int getArrayNDims() -{ - return numberOfDimensions; -} - -/* get the whole array */ -const char **getArray() -{ - if (numberOfDimensions > 0) - { - return arrayDimensions; - } - return NULL; -} - -/*---------------------------------------------------------------- - * Variables and Parameters - */ - -/* "private" variables */ -const char *currentVarName = 0; -const char *currentVarValue = 0; -const char *currentId = 0; - -/* clear the var Id */ -void clearVarName(void) -{ - currentVarName = NULL; -} - -/* set the var Id */ -void setVarName(const char *text) -{ - currentVarName = text; -} - -/* return the var id */ -const char *getVarName() -{ - return currentVarName; -} - -/* variable value -------------- */ - -/* clear the var value */ -void clearVarValue(void) -{ - currentVarValue = NULL; -} - -/* set the var value */ -void setVarValue(const char *text) -{ - currentVarValue = text; -} - -/* return the var value */ -const char *getVarValue() -{ - return currentVarValue; -} - -/* variable type -------------- */ - -/* clear the current Id */ -void clearTypeId(void) -{ - currentId = NULL; -} - -/* set the current Id, it is sticky until cleared */ -void setTypeId(const char *text) -{ - if (currentId == NULL) - { - currentId = text; - } -} - -/* set the signature and type together */ -void typeSig(const char *text) -{ - postSig(text); - postSig(" "); - - if (currentId == 0) - { - setTypeId(text); - } -} - -/* return the current Id */ -const char *getTypeId() -{ - return currentId; -} - -/*---------------------------------------------------------------- - * Specifically for function pointers, the scope (i.e. class) that - * the function is a method of. - */ - -const char *pointerScopeStack[10]; -int pointerScopeDepth = 0; - -/* save the scope for scoped method pointers */ -void scopeSig(const char *scope) -{ - if (scope && scope[0] != '\0') - { - postSig(scope); - } - else - { - scope = NULL; - } - pointerScopeStack[pointerScopeDepth++] = vtkstrdup(scope); -} - -/* get the scope back */ -const char *getScope() -{ - return pointerScopeStack[--pointerScopeDepth]; -} - -/*---------------------------------------------------------------- - * Function stack - * - * operates on: currentFunction - */ - -/* "private" variables */ -FunctionInfo *functionStack[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const char *functionVarNameStack[10]; -const char *functionTypeIdStack[10]; -int functionDepth = 0; - -void pushFunction() -{ - functionStack[functionDepth] = currentFunction; - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(currentFunction); - if (!functionStack[functionDepth]) - { - startSig(); - } - functionVarNameStack[functionDepth] = getVarName(); - functionTypeIdStack[functionDepth] = getTypeId(); - pushType(); - clearType(); - clearVarName(); - clearTypeId(); - functionDepth++; - functionStack[functionDepth] = 0; -} - -void popFunction() -{ - FunctionInfo *newFunction = currentFunction; - - --functionDepth; - currentFunction = functionStack[functionDepth]; - clearVarName(); - if (functionVarNameStack[functionDepth]) - { - setVarName(functionVarNameStack[functionDepth]); - } - clearTypeId(); - if (functionTypeIdStack[functionDepth]) - { - setTypeId(functionTypeIdStack[functionDepth]); - } - popType(); - - functionStack[functionDepth+1] = newFunction; -} - -FunctionInfo *getFunction() -{ - return functionStack[functionDepth+1]; -} - -/*---------------------------------------------------------------- - * Utility methods - */ - -/* prepend a scope:: to a name */ -void prepend_scope(char *cp, const char *arg) -{ - size_t i, j, m, n; - int depth; - - m = strlen(cp); - n = strlen(arg); - i = m; - while (i > 0 && - ((cp[i-1] >= 'a' && cp[i-1] <= 'z') || - (cp[i-1] >= 'A' && cp[i-1] <= 'Z') || - (cp[i-1] >= '0' && cp[i-1] <= '9') || - cp[i-1] == '_' || cp[i-1] == ':' || - cp[i-1] == '>')) - { - i--; - if (cp[i] == '>') - { - depth = 1; - while (i > 0) - { - i--; - if (cp[i] == '<') - { - if (--depth == 0) - { - break; - } - } - if (cp[i] == '>') - { - depth++; - } - } - } - } - - for (j = m; j > i; j--) - { - cp[j+n+1] = cp[j-1]; - } - for (j = 0; j < n; j++) - { - cp[j+i] = arg[j]; - } - cp[n+i] = ':'; cp[n+i+1] = ':'; - cp[m+n+2] = '\0'; -} - -/* expand a type by including pointers from another */ -unsigned int add_indirection(unsigned int type1, unsigned int type2) -{ - unsigned int ptr1 = (type1 & VTK_PARSE_POINTER_MASK); - unsigned int ptr2 = (type2 & VTK_PARSE_POINTER_MASK); - unsigned int reverse = 0; - unsigned int result; - - /* one of type1 or type2 will only have VTK_PARSE_INDIRECT, but - * we don't know which one. */ - result = ((type1 & ~VTK_PARSE_POINTER_MASK) | - (type2 & ~VTK_PARSE_POINTER_MASK)); - - while (ptr2) - { - reverse = ((reverse << 2) | (ptr2 & VTK_PARSE_POINTER_LOWMASK)); - ptr2 = ((ptr2 >> 2) & VTK_PARSE_POINTER_MASK); - } - - while (reverse) - { - ptr1 = ((ptr1 << 2) | (reverse & VTK_PARSE_POINTER_LOWMASK)); - reverse = ((reverse >> 2) & VTK_PARSE_POINTER_MASK); - - /* make sure we don't exceed the VTK_PARSE_POINTER bitfield */ - if ((ptr1 & VTK_PARSE_POINTER_MASK) != ptr1) - { - ptr1 = VTK_PARSE_BAD_INDIRECT; - break; - } - } - - return (ptr1 | result); -} - -/* There is only one array, so add any parenthetical indirection to it */ -unsigned int add_indirection_to_array(unsigned int type) -{ - unsigned int ptrs = (type & VTK_PARSE_POINTER_MASK); - unsigned int result = (type & ~VTK_PARSE_POINTER_MASK); - unsigned int reverse = 0; - - if ((type & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) - { - return (result | VTK_PARSE_BAD_INDIRECT); - } - - while (ptrs) - { - reverse = ((reverse << 2) | (ptrs & VTK_PARSE_POINTER_LOWMASK)); - ptrs = ((ptrs >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* I know the reversal makes no difference, but it is still - * nice to add the pointers in the correct order, just in - * case const pointers are thrown into the mix. */ - while (reverse) - { - pushArrayFront(""); - reverse = ((reverse >> 2) & VTK_PARSE_POINTER_MASK); - } - - return result; -} - - - -/* Line 189 of yacc.c */ -#line 1354 "vtkParse.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ID = 258, - VTK_ID = 259, - QT_ID = 260, - StdString = 261, - UnicodeString = 262, - OSTREAM = 263, - ISTREAM = 264, - LP = 265, - LA = 266, - STRING_LITERAL = 267, - INT_LITERAL = 268, - HEX_LITERAL = 269, - OCT_LITERAL = 270, - FLOAT_LITERAL = 271, - CHAR_LITERAL = 272, - ZERO = 273, - STRUCT = 274, - CLASS = 275, - UNION = 276, - ENUM = 277, - PUBLIC = 278, - PRIVATE = 279, - PROTECTED = 280, - CONST = 281, - VOLATILE = 282, - MUTABLE = 283, - STATIC = 284, - VIRTUAL = 285, - EXPLICIT = 286, - INLINE = 287, - FRIEND = 288, - EXTERN = 289, - OPERATOR = 290, - TEMPLATE = 291, - THROW = 292, - TYPENAME = 293, - TYPEDEF = 294, - NAMESPACE = 295, - USING = 296, - NEW = 297, - DELETE = 298, - STATIC_CAST = 299, - DYNAMIC_CAST = 300, - CONST_CAST = 301, - REINTERPRET_CAST = 302, - OP_LSHIFT_EQ = 303, - OP_RSHIFT_EQ = 304, - OP_LSHIFT = 305, - OP_RSHIFT = 306, - OP_DOT_POINTER = 307, - OP_ARROW_POINTER = 308, - OP_ARROW = 309, - OP_INCR = 310, - OP_DECR = 311, - OP_PLUS_EQ = 312, - OP_MINUS_EQ = 313, - OP_TIMES_EQ = 314, - OP_DIVIDE_EQ = 315, - OP_REMAINDER_EQ = 316, - OP_AND_EQ = 317, - OP_OR_EQ = 318, - OP_XOR_EQ = 319, - OP_LOGIC_AND = 320, - OP_LOGIC_OR = 321, - OP_LOGIC_EQ = 322, - OP_LOGIC_NEQ = 323, - OP_LOGIC_LEQ = 324, - OP_LOGIC_GEQ = 325, - ELLIPSIS = 326, - DOUBLE_COLON = 327, - OTHER = 328, - VOID = 329, - BOOL = 330, - FLOAT = 331, - DOUBLE = 332, - INT = 333, - SHORT = 334, - LONG = 335, - INT64__ = 336, - CHAR = 337, - SIGNED = 338, - UNSIGNED = 339, - SSIZE_T = 340, - SIZE_T = 341, - IdType = 342, - TypeInt8 = 343, - TypeUInt8 = 344, - TypeInt16 = 345, - TypeUInt16 = 346, - TypeInt32 = 347, - TypeUInt32 = 348, - TypeInt64 = 349, - TypeUInt64 = 350, - TypeFloat32 = 351, - TypeFloat64 = 352, - SetMacro = 353, - GetMacro = 354, - SetStringMacro = 355, - GetStringMacro = 356, - SetClampMacro = 357, - SetObjectMacro = 358, - GetObjectMacro = 359, - BooleanMacro = 360, - SetVector2Macro = 361, - SetVector3Macro = 362, - SetVector4Macro = 363, - SetVector6Macro = 364, - GetVector2Macro = 365, - GetVector3Macro = 366, - GetVector4Macro = 367, - GetVector6Macro = 368, - SetVectorMacro = 369, - GetVectorMacro = 370, - ViewportCoordinateMacro = 371, - WorldCoordinateMacro = 372, - TypeMacro = 373, - VTK_BYTE_SWAP_DECL = 374 - }; -#endif - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 222 of yacc.c */ -#line 1302 "vtkParse.y" - - const char *str; - unsigned int integer; - - - -/* Line 222 of yacc.c */ -#line 1635 "vtkParse.tab.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - -/* Copy the second part of user declarations. */ - - -/* Line 264 of yacc.c */ -#line 1647 "vtkParse.tab.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 5657 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 143 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 240 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 603 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 968 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 374 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 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, 139, 2, 2, 2, 135, 133, 2, - 126, 127, 134, 138, 125, 137, 142, 136, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 124, 120, - 128, 123, 129, 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, 130, 2, 131, 141, 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, 121, 140, 122, 132, 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, 2, 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, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 6, 7, 11, 13, 15, 17, - 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, - 40, 42, 45, 48, 51, 54, 60, 65, 66, 73, - 79, 81, 84, 88, 93, 98, 104, 105, 111, 112, - 117, 118, 122, 124, 126, 128, 129, 130, 134, 138, - 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, - 160, 162, 164, 167, 170, 172, 175, 178, 181, 185, - 188, 192, 193, 195, 198, 200, 204, 206, 210, 214, - 215, 217, 218, 220, 222, 224, 226, 231, 237, 238, - 244, 247, 249, 250, 252, 254, 257, 261, 263, 264, - 269, 276, 280, 285, 288, 292, 298, 302, 304, 307, - 313, 319, 326, 332, 339, 342, 343, 347, 350, 352, - 354, 355, 356, 364, 366, 370, 372, 375, 378, 381, - 385, 389, 394, 398, 399, 405, 407, 408, 413, 414, - 415, 421, 422, 423, 429, 430, 431, 432, 440, 442, - 444, 445, 447, 448, 452, 454, 457, 460, 463, 466, - 469, 472, 476, 479, 483, 486, 490, 494, 497, 501, - 506, 509, 511, 513, 516, 518, 521, 524, 525, 526, - 534, 537, 538, 542, 543, 549, 552, 554, 557, 558, - 561, 562, 566, 568, 571, 575, 577, 578, 584, 586, - 588, 589, 590, 596, 597, 603, 604, 607, 609, 613, - 616, 617, 618, 621, 623, 624, 629, 633, 634, 635, - 641, 642, 644, 645, 649, 654, 657, 658, 661, 662, - 663, 668, 671, 672, 674, 677, 678, 684, 687, 688, - 694, 696, 698, 700, 702, 704, 705, 706, 707, 714, - 716, 717, 720, 723, 727, 729, 732, 734, 737, 738, - 740, 742, 746, 748, 750, 752, 753, 755, 756, 759, - 761, 764, 765, 770, 771, 772, 775, 777, 779, 781, - 783, 786, 789, 792, 795, 798, 802, 806, 807, 813, - 815, 817, 818, 824, 826, 828, 830, 832, 834, 836, - 838, 841, 844, 847, 850, 853, 856, 859, 861, 863, - 865, 867, 869, 871, 873, 875, 877, 879, 881, 883, - 885, 887, 889, 891, 893, 895, 897, 899, 900, 903, - 905, 907, 909, 911, 913, 916, 918, 920, 922, 924, - 926, 929, 931, 933, 935, 937, 939, 941, 943, 946, - 949, 950, 954, 955, 960, 962, 963, 967, 969, 971, - 974, 977, 980, 981, 985, 986, 991, 993, 995, 997, - 1000, 1003, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, - 1022, 1024, 1026, 1028, 1030, 1032, 1034, 1036, 1038, 1040, - 1042, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1058, 1060, - 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1079, 1081, - 1083, 1084, 1088, 1090, 1093, 1094, 1102, 1103, 1104, 1105, - 1115, 1116, 1122, 1123, 1129, 1130, 1131, 1142, 1143, 1151, - 1152, 1153, 1154, 1164, 1171, 1172, 1180, 1181, 1189, 1190, - 1198, 1199, 1207, 1208, 1216, 1217, 1225, 1226, 1234, 1235, - 1243, 1244, 1254, 1255, 1265, 1270, 1275, 1283, 1284, 1286, - 1289, 1292, 1296, 1300, 1302, 1304, 1306, 1308, 1310, 1312, - 1314, 1316, 1318, 1320, 1322, 1324, 1326, 1328, 1330, 1332, - 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, - 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, - 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, - 1394, 1396, 1398, 1400, 1402, 1404, 1406, 1408, 1410, 1412, - 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, - 1434, 1436, 1438, 1440, 1443, 1445, 1447, 1449, 1451, 1453, - 1455, 1457, 1459, 1461, 1463, 1465, 1466, 1469, 1471, 1473, - 1475, 1477, 1479, 1481, 1483, 1485, 1486, 1489, 1490, 1493, - 1495, 1497, 1499, 1501, 1503, 1504, 1509, 1510, 1515, 1516, - 1521, 1522, 1527, 1528, 1533, 1534, 1539, 1540, 1543, 1544, - 1547, 1549, 1551, 1553, 1555, 1557, 1559, 1561, 1563, 1565, - 1567, 1569, 1571, 1573, 1575, 1577, 1579, 1581, 1583, 1587, - 1591, 1595, 1597, 1599 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 144, 0, -1, 145, -1, -1, -1, 145, 146, 147, - -1, 198, -1, 196, -1, 153, -1, 150, -1, 152, - -1, 149, -1, 186, -1, 259, -1, 175, -1, 155, - -1, 216, -1, 148, -1, 327, -1, 289, 120, -1, - 120, -1, 199, 155, -1, 199, 216, -1, 199, 183, - -1, 199, 148, -1, 34, 12, 121, 145, 122, -1, - 40, 121, 375, 122, -1, -1, 40, 299, 151, 121, - 145, 122, -1, 40, 299, 123, 291, 120, -1, 154, - -1, 199, 154, -1, 161, 289, 120, -1, 302, 161, - 289, 120, -1, 156, 300, 261, 120, -1, 302, 156, - 300, 261, 120, -1, -1, 158, 157, 121, 162, 122, - -1, -1, 161, 289, 159, 168, -1, -1, 161, 160, - 168, -1, 20, -1, 19, -1, 21, -1, -1, -1, - 162, 163, 165, -1, 162, 164, 124, -1, 23, -1, - 24, -1, 25, -1, 196, -1, 153, -1, 167, -1, - 186, -1, 259, -1, 175, -1, 155, -1, 220, -1, - 166, -1, 327, -1, 119, 381, -1, 289, 120, -1, - 120, -1, 199, 155, -1, 199, 220, -1, 33, 184, - -1, 33, 199, 184, -1, 33, 153, -1, 33, 221, - 237, -1, -1, 169, -1, 124, 170, -1, 171, -1, - 170, 125, 171, -1, 289, -1, 30, 173, 289, -1, - 174, 172, 289, -1, -1, 30, -1, -1, 174, -1, - 23, -1, 24, -1, 25, -1, 176, 300, 261, 120, - -1, 302, 176, 300, 261, 120, -1, -1, 178, 121, - 177, 179, 122, -1, 22, 289, -1, 22, -1, -1, - 180, -1, 181, -1, 180, 125, -1, 180, 125, 181, - -1, 298, -1, -1, 298, 123, 182, 355, -1, 308, - 292, 298, 123, 376, 120, -1, 161, 289, 185, -1, - 302, 161, 289, 185, -1, 161, 185, -1, 302, 161, - 185, -1, 121, 375, 122, 376, 120, -1, 124, 376, - 120, -1, 187, -1, 302, 187, -1, 39, 308, 195, - 189, 120, -1, 39, 156, 300, 188, 120, -1, 39, - 302, 156, 300, 188, 120, -1, 39, 176, 300, 188, - 120, -1, 39, 302, 176, 300, 188, 120, -1, 190, - 189, -1, -1, 189, 125, 190, -1, 265, 195, -1, - 268, -1, 192, -1, -1, -1, 279, 126, 193, 249, - 127, 194, 275, -1, 191, -1, 41, 197, 120, -1, - 289, -1, 38, 289, -1, 292, 231, -1, 292, 226, - -1, 295, 292, 231, -1, 295, 292, 226, -1, 41, - 40, 289, 120, -1, 36, 128, 129, -1, -1, 36, - 128, 200, 201, 129, -1, 203, -1, -1, 201, 125, - 202, 203, -1, -1, -1, 204, 314, 266, 205, 212, - -1, -1, -1, 206, 211, 266, 207, 212, -1, -1, - -1, -1, 208, 199, 20, 209, 266, 210, 212, -1, - 20, -1, 38, -1, -1, 213, -1, -1, 123, 214, - 215, -1, 363, -1, 215, 363, -1, 217, 237, -1, - 222, 237, -1, 218, 237, -1, 219, 237, -1, 308, - 233, -1, 308, 292, 233, -1, 292, 241, -1, 302, - 292, 241, -1, 292, 223, -1, 302, 292, 223, -1, - 308, 292, 227, -1, 221, 237, -1, 292, 231, 120, - -1, 302, 292, 231, 120, -1, 308, 233, -1, 222, - -1, 241, -1, 302, 241, -1, 223, -1, 302, 223, - -1, 308, 227, -1, -1, -1, 226, 126, 224, 249, - 127, 225, 234, -1, 232, 308, -1, -1, 229, 228, - 234, -1, -1, 231, 126, 230, 249, 127, -1, 232, - 351, -1, 35, -1, 238, 234, -1, -1, 234, 235, - -1, -1, 37, 236, 369, -1, 26, -1, 123, 18, - -1, 121, 375, 122, -1, 120, -1, -1, 240, 126, - 239, 249, 127, -1, 298, -1, 296, -1, -1, -1, - 244, 242, 246, 243, 234, -1, -1, 240, 126, 245, - 249, 127, -1, -1, 124, 247, -1, 248, -1, 247, - 125, 248, -1, 289, 381, -1, -1, -1, 250, 251, - -1, 253, -1, -1, 251, 125, 252, 253, -1, 251, - 125, 71, -1, -1, -1, 254, 308, 266, 255, 256, - -1, -1, 257, -1, -1, 123, 258, 355, -1, 308, - 260, 262, 120, -1, 268, 256, -1, -1, 264, 262, - -1, -1, -1, 262, 125, 263, 264, -1, 265, 260, - -1, -1, 322, -1, 278, 281, -1, -1, 270, 276, - 127, 267, 272, -1, 279, 281, -1, -1, 271, 277, - 127, 269, 272, -1, 126, -1, 10, -1, 11, -1, - 10, -1, 11, -1, -1, -1, -1, 126, 273, 249, - 127, 274, 275, -1, 282, -1, -1, 275, 28, -1, - 275, 26, -1, 275, 37, 381, -1, 266, -1, 322, - 266, -1, 268, -1, 322, 268, -1, -1, 279, -1, - 298, -1, 298, 124, 280, -1, 15, -1, 13, -1, - 14, -1, -1, 282, -1, -1, 283, 284, -1, 285, - -1, 284, 285, -1, -1, 130, 286, 287, 131, -1, - -1, -1, 288, 355, -1, 290, -1, 291, -1, 298, - -1, 296, -1, 292, 290, -1, 295, 290, -1, 295, - 291, -1, 294, 295, -1, 296, 295, -1, 292, 294, - 295, -1, 292, 296, 295, -1, -1, 292, 36, 293, - 296, 295, -1, 299, -1, 72, -1, -1, 299, 128, - 297, 361, 129, -1, 4, -1, 5, -1, 3, -1, - 9, -1, 8, -1, 6, -1, 7, -1, 132, 4, - -1, 132, 5, -1, 132, 3, -1, 132, 9, -1, - 132, 8, -1, 132, 6, -1, 132, 7, -1, 86, - -1, 85, -1, 88, -1, 89, -1, 90, -1, 91, - -1, 92, -1, 93, -1, 94, -1, 95, -1, 96, - -1, 97, -1, 87, -1, 3, -1, 5, -1, 4, - -1, 9, -1, 8, -1, 6, -1, 7, -1, -1, - 300, 301, -1, 303, -1, 321, -1, 39, -1, 33, - -1, 303, -1, 302, 303, -1, 304, -1, 305, -1, - 306, -1, 28, -1, 34, -1, 34, 12, -1, 29, - -1, 32, -1, 30, -1, 31, -1, 26, -1, 27, - -1, 306, -1, 307, 306, -1, 309, 265, -1, -1, - 312, 310, 300, -1, -1, 302, 312, 311, 300, -1, - 319, -1, -1, 38, 313, 289, -1, 296, -1, 291, - -1, 161, 289, -1, 22, 289, -1, 315, 265, -1, - -1, 318, 316, 300, -1, -1, 302, 312, 317, 300, - -1, 319, -1, 296, -1, 291, -1, 19, 289, -1, - 21, 289, -1, 22, 289, -1, 321, -1, 320, -1, - 6, -1, 7, -1, 8, -1, 9, -1, 3, -1, - 4, -1, 5, -1, 85, -1, 86, -1, 88, -1, - 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, - 94, -1, 95, -1, 96, -1, 97, -1, 87, -1, - 74, -1, 75, -1, 76, -1, 77, -1, 82, -1, - 78, -1, 79, -1, 80, -1, 81, -1, 83, -1, - 84, -1, 323, -1, 326, -1, 326, 323, -1, 133, - -1, 134, -1, -1, 134, 325, 307, -1, 324, -1, - 326, 324, -1, -1, 98, 126, 298, 125, 328, 308, - 127, -1, -1, -1, -1, 99, 126, 329, 298, 125, - 330, 308, 331, 127, -1, -1, 100, 126, 332, 298, - 127, -1, -1, 101, 126, 333, 298, 127, -1, -1, - -1, 102, 126, 298, 125, 334, 308, 335, 125, 376, - 127, -1, -1, 103, 126, 298, 125, 336, 308, 127, - -1, -1, -1, -1, 104, 126, 337, 298, 125, 338, - 308, 339, 127, -1, 105, 126, 298, 125, 308, 127, - -1, -1, 106, 126, 298, 125, 340, 308, 127, -1, - -1, 110, 126, 298, 125, 341, 308, 127, -1, -1, - 107, 126, 298, 125, 342, 308, 127, -1, -1, 111, - 126, 298, 125, 343, 308, 127, -1, -1, 108, 126, - 298, 125, 344, 308, 127, -1, -1, 112, 126, 298, - 125, 345, 308, 127, -1, -1, 109, 126, 298, 125, - 346, 308, 127, -1, -1, 113, 126, 298, 125, 347, - 308, 127, -1, -1, 114, 126, 298, 125, 348, 308, - 125, 13, 127, -1, -1, 115, 126, 298, 125, 349, - 308, 125, 13, 127, -1, 116, 126, 298, 127, -1, - 117, 126, 298, 127, -1, 118, 126, 298, 125, 298, - 350, 127, -1, -1, 125, -1, 126, 127, -1, 130, - 131, -1, 42, 130, 131, -1, 43, 130, 131, -1, - 128, -1, 129, -1, 125, -1, 123, -1, 352, -1, - 135, -1, 134, -1, 136, -1, 137, -1, 138, -1, - 139, -1, 132, -1, 133, -1, 140, -1, 141, -1, - 42, -1, 43, -1, 48, -1, 49, -1, 50, -1, - 51, -1, 52, -1, 53, -1, 54, -1, 57, -1, - 58, -1, 59, -1, 60, -1, 61, -1, 55, -1, - 56, -1, 62, -1, 63, -1, 64, -1, 65, -1, - 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, - 39, -1, 38, -1, 20, -1, 19, -1, 21, -1, - 36, -1, 23, -1, 25, -1, 24, -1, 26, -1, - 29, -1, 32, -1, 30, -1, 34, -1, 40, -1, - 35, -1, 22, -1, 37, -1, 46, -1, 45, -1, - 44, -1, 47, -1, 15, -1, 13, -1, 14, -1, - 16, -1, 17, -1, 12, -1, 18, -1, 358, -1, - 355, 358, -1, 367, -1, 369, -1, 373, -1, 352, - -1, 124, -1, 142, -1, 72, -1, 353, -1, 354, - -1, 321, -1, 320, -1, -1, 357, 359, -1, 356, - -1, 128, -1, 129, -1, 358, -1, 123, -1, 125, - -1, 359, -1, 120, -1, -1, 361, 364, -1, -1, - 362, 360, -1, 365, -1, 356, -1, 363, -1, 123, - -1, 125, -1, -1, 128, 366, 361, 129, -1, -1, - 130, 368, 357, 131, -1, -1, 126, 370, 357, 127, - -1, -1, 10, 371, 357, 127, -1, -1, 11, 372, - 357, 127, -1, -1, 121, 374, 362, 122, -1, -1, - 375, 377, -1, -1, 376, 378, -1, 378, -1, 120, - -1, 379, -1, 381, -1, 380, -1, 72, -1, 71, - -1, 352, -1, 124, -1, 142, -1, 128, -1, 129, - -1, 123, -1, 125, -1, 353, -1, 354, -1, 319, - -1, 73, -1, 121, 375, 122, -1, 130, 375, 131, - -1, 382, 375, 127, -1, 126, -1, 10, -1, 11, - -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 1460, 1460, 1462, 1464, 1463, 1474, 1475, 1476, 1477, - 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, - 1488, 1491, 1492, 1493, 1494, 1501, 1508, 1509, 1509, 1513, - 1520, 1521, 1524, 1525, 1528, 1529, 1532, 1532, 1546, 1546, - 1548, 1548, 1552, 1553, 1554, 1556, 1558, 1557, 1566, 1570, - 1571, 1572, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, - 1583, 1584, 1585, 1586, 1587, 1590, 1591, 1594, 1595, 1596, - 1597, 1599, 1600, 1603, 1606, 1607, 1610, 1612, 1614, 1618, - 1619, 1622, 1623, 1626, 1627, 1628, 1639, 1640, 1644, 1644, - 1657, 1658, 1660, 1661, 1664, 1665, 1666, 1669, 1670, 1670, - 1678, 1681, 1682, 1683, 1684, 1687, 1688, 1696, 1697, 1700, - 1701, 1703, 1705, 1707, 1711, 1713, 1714, 1717, 1720, 1721, - 1724, 1725, 1724, 1729, 1763, 1766, 1767, 1768, 1770, 1772, - 1774, 1778, 1785, 1788, 1787, 1805, 1807, 1806, 1811, 1813, - 1811, 1815, 1817, 1815, 1819, 1820, 1822, 1819, 1833, 1834, - 1836, 1837, 1840, 1840, 1850, 1851, 1859, 1860, 1861, 1862, - 1865, 1868, 1869, 1870, 1873, 1874, 1875, 1878, 1879, 1880, - 1883, 1884, 1885, 1886, 1889, 1890, 1891, 1895, 1899, 1894, - 1911, 1915, 1915, 1926, 1925, 1934, 1938, 1941, 1950, 1951, - 1954, 1954, 1955, 1956, 1964, 1965, 1969, 1968, 1976, 1977, - 1985, 1986, 1985, 2004, 2004, 2007, 2008, 2011, 2012, 2015, - 2021, 2022, 2022, 2025, 2026, 2026, 2028, 2032, 2034, 2032, - 2058, 2059, 2062, 2062, 2070, 2073, 2132, 2133, 2135, 2136, - 2136, 2139, 2142, 2143, 2147, 2148, 2148, 2167, 2168, 2168, - 2186, 2187, 2189, 2193, 2195, 2198, 2199, 2200, 2199, 2205, - 2207, 2208, 2209, 2210, 2213, 2214, 2218, 2219, 2223, 2224, - 2227, 2228, 2231, 2232, 2233, 2236, 2237, 2240, 2240, 2243, - 2244, 2247, 2247, 2250, 2251, 2251, 2258, 2259, 2262, 2263, - 2266, 2268, 2270, 2274, 2276, 2278, 2280, 2282, 2282, 2287, - 2290, 2293, 2293, 2308, 2309, 2310, 2311, 2312, 2313, 2314, - 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, - 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, - 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2354, 2355, 2358, - 2359, 2361, 2362, 2365, 2366, 2369, 2370, 2371, 2374, 2375, - 2376, 2377, 2380, 2381, 2382, 2385, 2386, 2389, 2390, 2399, - 2402, 2402, 2404, 2404, 2408, 2409, 2409, 2411, 2413, 2415, - 2417, 2421, 2424, 2424, 2426, 2426, 2430, 2431, 2433, 2435, - 2437, 2439, 2443, 2444, 2447, 2448, 2449, 2450, 2451, 2452, - 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, - 2463, 2464, 2465, 2466, 2469, 2470, 2471, 2472, 2473, 2474, - 2475, 2476, 2477, 2478, 2479, 2499, 2500, 2501, 2504, 2507, - 2508, 2508, 2523, 2524, 2541, 2541, 2551, 2552, 2552, 2551, - 2561, 2561, 2571, 2571, 2580, 2580, 2580, 2613, 2612, 2623, - 2624, 2624, 2623, 2633, 2651, 2651, 2656, 2656, 2661, 2661, - 2666, 2666, 2671, 2671, 2676, 2676, 2681, 2681, 2686, 2686, - 2691, 2691, 2708, 2708, 2722, 2759, 2797, 2834, 2835, 2842, - 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2853, 2854, - 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, - 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, - 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, - 2885, 2886, 2887, 2890, 2891, 2892, 2893, 2894, 2895, 2896, - 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, - 2907, 2908, 2909, 2910, 2911, 2914, 2915, 2916, 2917, 2918, - 2919, 2920, 2927, 2928, 2931, 2932, 2933, 2934, 2965, 2965, - 2966, 2967, 2968, 2969, 2970, 2993, 2994, 2996, 2997, 2998, - 3000, 3001, 3002, 3004, 3005, 3007, 3008, 3010, 3011, 3014, - 3015, 3018, 3019, 3020, 3024, 3023, 3037, 3037, 3041, 3041, - 3043, 3043, 3045, 3045, 3049, 3049, 3054, 3055, 3057, 3058, - 3061, 3062, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3071, - 3071, 3071, 3071, 3071, 3072, 3072, 3073, 3074, 3077, 3080, - 3083, 3086, 3086, 3086 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "ID", "VTK_ID", "QT_ID", "StdString", - "UnicodeString", "OSTREAM", "ISTREAM", "LP", "LA", "STRING_LITERAL", - "INT_LITERAL", "HEX_LITERAL", "OCT_LITERAL", "FLOAT_LITERAL", - "CHAR_LITERAL", "ZERO", "STRUCT", "CLASS", "UNION", "ENUM", "PUBLIC", - "PRIVATE", "PROTECTED", "CONST", "VOLATILE", "MUTABLE", "STATIC", - "VIRTUAL", "EXPLICIT", "INLINE", "FRIEND", "EXTERN", "OPERATOR", - "TEMPLATE", "THROW", "TYPENAME", "TYPEDEF", "NAMESPACE", "USING", "NEW", - "DELETE", "STATIC_CAST", "DYNAMIC_CAST", "CONST_CAST", - "REINTERPRET_CAST", "OP_LSHIFT_EQ", "OP_RSHIFT_EQ", "OP_LSHIFT", - "OP_RSHIFT", "OP_DOT_POINTER", "OP_ARROW_POINTER", "OP_ARROW", "OP_INCR", - "OP_DECR", "OP_PLUS_EQ", "OP_MINUS_EQ", "OP_TIMES_EQ", "OP_DIVIDE_EQ", - "OP_REMAINDER_EQ", "OP_AND_EQ", "OP_OR_EQ", "OP_XOR_EQ", "OP_LOGIC_AND", - "OP_LOGIC_OR", "OP_LOGIC_EQ", "OP_LOGIC_NEQ", "OP_LOGIC_LEQ", - "OP_LOGIC_GEQ", "ELLIPSIS", "DOUBLE_COLON", "OTHER", "VOID", "BOOL", - "FLOAT", "DOUBLE", "INT", "SHORT", "LONG", "INT64__", "CHAR", "SIGNED", - "UNSIGNED", "SSIZE_T", "SIZE_T", "IdType", "TypeInt8", "TypeUInt8", - "TypeInt16", "TypeUInt16", "TypeInt32", "TypeUInt32", "TypeInt64", - "TypeUInt64", "TypeFloat32", "TypeFloat64", "SetMacro", "GetMacro", - "SetStringMacro", "GetStringMacro", "SetClampMacro", "SetObjectMacro", - "GetObjectMacro", "BooleanMacro", "SetVector2Macro", "SetVector3Macro", - "SetVector4Macro", "SetVector6Macro", "GetVector2Macro", - "GetVector3Macro", "GetVector4Macro", "GetVector6Macro", - "SetVectorMacro", "GetVectorMacro", "ViewportCoordinateMacro", - "WorldCoordinateMacro", "TypeMacro", "VTK_BYTE_SWAP_DECL", "';'", "'{'", - "'}'", "'='", "':'", "','", "'('", "')'", "'<'", "'>'", "'['", "']'", - "'~'", "'&'", "'*'", "'%'", "'/'", "'-'", "'+'", "'!'", "'|'", "'^'", - "'.'", "$accept", "translation_unit", "opt_declaration_seq", "$@1", - "declaration", "template_declaration", "linkage_specification", - "namespace_definition", "$@2", "namespace_alias_definition", - "forward_declaration", "simple_forward_declaration", "class_definition", - "class_specifier", "$@3", "class_head", "$@4", "$@5", "class_key", - "member_specification", "$@6", "member_access_specifier", - "member_declaration", "template_member_declaration", - "friend_declaration", "opt_base_clause", "base_clause", - "base_specifier_list", "base_specifier", "opt_virtual", - "opt_access_specifier", "access_specifier", "enum_definition", - "enum_specifier", "$@7", "enum_head", "opt_enumerator_list", - "enumerator_list", "enumerator_definition", "$@8", - "nested_variable_initialization", "ignored_class", "ignored_class_body", - "typedef_declaration", "basic_typedef_declaration", - "typedef_declarator_list", "typedef_declarator_list_cont", - "typedef_declarator", "typedef_direct_declarator", - "function_direct_declarator", "$@9", "$@10", "typedef_declarator_id", - "using_declaration", "using_id", "using_directive", "template_head", - "$@11", "template_parameter_list", "$@12", "template_parameter", "$@13", - "$@14", "$@15", "$@16", "$@17", "$@18", "$@19", "class_or_typename", - "opt_template_parameter_initializer", "template_parameter_initializer", - "$@20", "template_parameter_value", "function_definition", - "function_declaration", "nested_method_declaration", - "nested_operator_declaration", "method_definition", "method_declaration", - "operator_declaration", "conversion_function", "$@21", "$@22", - "conversion_function_id", "operator_function_nr", "$@23", - "operator_function_sig", "$@24", "operator_function_id", "operator_sig", - "function_nr", "function_trailer_clause", "function_trailer", "$@25", - "function_body", "function_sig", "$@26", "function_name", - "structor_declaration", "$@27", "$@28", "structor_sig", "$@29", - "opt_ctor_initializer", "mem_initializer_list", "mem_initializer", - "parameter_declaration_clause", "$@30", "parameter_list", "$@31", - "parameter_declaration", "$@32", "$@33", "opt_initializer", - "initializer", "$@34", "variable_declaration", "init_declarator_id", - "opt_declarator_list", "declarator_list_cont", "$@35", "init_declarator", - "opt_ptr_operator_seq", "direct_abstract_declarator", "$@36", - "direct_declarator", "$@37", "p_or_lp_or_la", "lp_or_la", - "opt_array_or_parameters", "$@38", "$@39", "function_qualifiers", - "abstract_declarator", "declarator", "opt_declarator_id", - "declarator_id", "bitfield_size", "opt_array_decorator_seq", - "array_decorator_seq", "$@40", "array_decorator_seq_impl", - "array_decorator", "$@41", "array_size_specifier", "$@42", - "id_expression", "unqualified_id", "qualified_id", - "nested_name_specifier", "$@43", "identifier_sig", "scope_operator_sig", - "template_id", "$@44", "simple_id", "identifier", - "opt_decl_specifier_seq", "decl_specifier2", "decl_specifier_seq", - "decl_specifier", "storage_class_specifier", "function_specifier", - "cv_qualifier", "cv_qualifier_seq", "store_type", "store_type_specifier", - "$@45", "$@46", "type_specifier", "$@47", "tparam_type", - "tparam_type_specifier2", "$@48", "$@49", "tparam_type_specifier", - "simple_type_specifier", "type_name", "primitive_type", - "ptr_operator_seq", "reference", "pointer", "$@50", "pointer_seq", - "declaration_macro", "$@51", "$@52", "$@53", "$@54", "$@55", "$@56", - "$@57", "$@58", "$@59", "$@60", "$@61", "$@62", "$@63", "$@64", "$@65", - "$@66", "$@67", "$@68", "$@69", "$@70", "$@71", "$@72", "opt_comma", - "operator_id", "operator_id_no_delim", "keyword", "literal", - "constant_expression", "common_bracket_item", "any_bracket_contents", - "bracket_pitem", "any_bracket_item", "braces_item", - "angle_bracket_contents", "braces_contents", "angle_bracket_pitem", - "angle_bracket_item", "angle_brackets_sig", "$@73", "brackets_sig", - "$@74", "parentheses_sig", "$@75", "$@76", "$@77", "braces_sig", "$@78", - "ignored_items", "ignored_expression", "ignored_item", - "ignored_item_no_semi", "ignored_braces", "ignored_brackets", - "ignored_parentheses", "ignored_left_parenthesis", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 59, 123, 125, 61, 58, 44, 40, 41, 60, 62, - 91, 93, 126, 38, 42, 37, 47, 45, 43, 33, - 124, 94, 46 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint16 yyr1[] = -{ - 0, 143, 144, 145, 146, 145, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 148, 148, 148, 148, 149, 150, 151, 150, 152, - 153, 153, 154, 154, 155, 155, 157, 156, 159, 158, - 160, 158, 161, 161, 161, 162, 163, 162, 162, 164, - 164, 164, 165, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 165, 165, 166, 166, 167, 167, 167, - 167, 168, 168, 169, 170, 170, 171, 171, 171, 172, - 172, 173, 173, 174, 174, 174, 175, 175, 177, 176, - 178, 178, 179, 179, 180, 180, 180, 181, 182, 181, - 183, 184, 184, 184, 184, 185, 185, 186, 186, 187, - 187, 187, 187, 187, 188, 189, 189, 190, 191, 191, - 193, 194, 192, 195, 196, 197, 197, 197, 197, 197, - 197, 198, 199, 200, 199, 201, 202, 201, 204, 205, - 203, 206, 207, 203, 208, 209, 210, 203, 211, 211, - 212, 212, 214, 213, 215, 215, 216, 216, 216, 216, - 217, 218, 218, 218, 219, 219, 219, 220, 220, 220, - 221, 221, 221, 221, 222, 222, 222, 224, 225, 223, - 226, 228, 227, 230, 229, 231, 232, 233, 234, 234, - 236, 235, 235, 235, 237, 237, 239, 238, 240, 240, - 242, 243, 241, 245, 244, 246, 246, 247, 247, 248, - 249, 250, 249, 251, 252, 251, 251, 254, 255, 253, - 256, 256, 258, 257, 259, 260, 261, 261, 262, 263, - 262, 264, 265, 265, 266, 267, 266, 268, 269, 268, - 270, 270, 270, 271, 271, 272, 273, 274, 272, 272, - 275, 275, 275, 275, 276, 276, 277, 277, 278, 278, - 279, 279, 280, 280, 280, 281, 281, 283, 282, 284, - 284, 286, 285, 287, 288, 287, 289, 289, 290, 290, - 291, 291, 291, 292, 292, 292, 292, 293, 292, 294, - 295, 297, 296, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 299, 299, 299, 299, 299, 299, 299, 300, 300, 301, - 301, 301, 301, 302, 302, 303, 303, 303, 304, 304, - 304, 304, 305, 305, 305, 306, 306, 307, 307, 308, - 310, 309, 311, 309, 312, 313, 312, 312, 312, 312, - 312, 314, 316, 315, 317, 315, 318, 318, 318, 318, - 318, 318, 319, 319, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 322, 322, 322, 323, 324, - 325, 324, 326, 326, 328, 327, 329, 330, 331, 327, - 332, 327, 333, 327, 334, 335, 327, 336, 327, 337, - 338, 339, 327, 327, 340, 327, 341, 327, 342, 327, - 343, 327, 344, 327, 345, 327, 346, 327, 347, 327, - 348, 327, 349, 327, 327, 327, 327, 350, 350, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 353, 353, 353, 353, 353, 353, 353, - 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, - 353, 353, 353, 353, 353, 354, 354, 354, 354, 354, - 354, 354, 355, 355, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 357, 357, 358, 358, 358, - 359, 359, 359, 360, 360, 361, 361, 362, 362, 363, - 363, 364, 364, 364, 366, 365, 368, 367, 370, 369, - 371, 369, 372, 369, 374, 373, 375, 375, 376, 376, - 377, 377, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 379, 380, - 381, 382, 382, 382 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 0, 0, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 2, 2, 2, 2, 5, 4, 0, 6, 5, - 1, 2, 3, 4, 4, 5, 0, 5, 0, 4, - 0, 3, 1, 1, 1, 0, 0, 3, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, - 3, 0, 1, 2, 1, 3, 1, 3, 3, 0, - 1, 0, 1, 1, 1, 1, 4, 5, 0, 5, - 2, 1, 0, 1, 1, 2, 3, 1, 0, 4, - 6, 3, 4, 2, 3, 5, 3, 1, 2, 5, - 5, 6, 5, 6, 2, 0, 3, 2, 1, 1, - 0, 0, 7, 1, 3, 1, 2, 2, 2, 3, - 3, 4, 3, 0, 5, 1, 0, 4, 0, 0, - 5, 0, 0, 5, 0, 0, 0, 7, 1, 1, - 0, 1, 0, 3, 1, 2, 2, 2, 2, 2, - 2, 3, 2, 3, 2, 3, 3, 2, 3, 4, - 2, 1, 1, 2, 1, 2, 2, 0, 0, 7, - 2, 0, 3, 0, 5, 2, 1, 2, 0, 2, - 0, 3, 1, 2, 3, 1, 0, 5, 1, 1, - 0, 0, 5, 0, 5, 0, 2, 1, 3, 2, - 0, 0, 2, 1, 0, 4, 3, 0, 0, 5, - 0, 1, 0, 3, 4, 2, 0, 2, 0, 0, - 4, 2, 0, 1, 2, 0, 5, 2, 0, 5, - 1, 1, 1, 1, 1, 0, 0, 0, 6, 1, - 0, 2, 2, 3, 1, 2, 1, 2, 0, 1, - 1, 3, 1, 1, 1, 0, 1, 0, 2, 1, - 2, 0, 4, 0, 0, 2, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 3, 3, 0, 5, 1, - 1, 0, 5, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 0, 3, 0, 4, 1, 0, 3, 1, 1, 2, - 2, 2, 0, 3, 0, 4, 1, 1, 1, 2, - 2, 2, 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, 2, 1, 1, - 0, 3, 1, 2, 0, 7, 0, 0, 0, 9, - 0, 5, 0, 5, 0, 0, 10, 0, 7, 0, - 0, 0, 9, 6, 0, 7, 0, 7, 0, 7, - 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, - 0, 9, 0, 9, 4, 4, 7, 0, 1, 2, - 2, 3, 3, 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, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, - 1, 1, 1, 1, 0, 4, 0, 4, 0, 4, - 0, 4, 0, 4, 0, 4, 0, 2, 0, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 3, 1, 1, 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 3, 0, 4, 1, 0, 378, 379, 380, 374, 375, - 376, 377, 43, 42, 44, 91, 345, 346, 338, 341, - 343, 344, 342, 339, 186, 0, 355, 0, 0, 0, - 290, 394, 395, 396, 397, 399, 400, 401, 402, 398, - 403, 404, 381, 382, 393, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 5, 17, - 11, 9, 10, 8, 30, 15, 327, 36, 40, 14, - 327, 0, 12, 107, 7, 6, 0, 16, 0, 0, - 0, 0, 174, 0, 0, 13, 0, 276, 358, 0, - 0, 0, 357, 278, 289, 0, 333, 335, 336, 337, - 0, 232, 350, 354, 373, 372, 18, 295, 293, 294, - 298, 299, 297, 296, 308, 307, 319, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 360, 277, 0, - 279, 340, 133, 0, 378, 379, 380, 374, 375, 376, - 377, 339, 381, 382, 393, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 327, 40, 327, 358, 357, - 0, 0, 320, 322, 321, 325, 326, 324, 323, 576, - 27, 0, 0, 0, 125, 0, 0, 0, 416, 420, - 422, 0, 0, 429, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 302, 300, - 301, 305, 306, 304, 303, 232, 0, 71, 359, 232, - 88, 0, 24, 31, 21, 23, 0, 22, 0, 0, - 195, 576, 156, 158, 159, 157, 177, 0, 0, 180, - 19, 287, 164, 0, 162, 200, 280, 0, 279, 278, - 283, 281, 282, 284, 291, 327, 40, 327, 108, 175, - 0, 334, 352, 243, 244, 176, 181, 0, 0, 160, - 188, 0, 228, 220, 0, 265, 0, 199, 260, 408, - 409, 349, 233, 405, 412, 406, 327, 279, 3, 132, - 138, 356, 340, 232, 359, 232, 327, 327, 295, 293, - 294, 298, 299, 297, 296, 123, 119, 115, 118, 265, - 260, 0, 0, 0, 126, 0, 124, 128, 127, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 332, 331, 0, 228, 0, 328, 329, 330, - 45, 0, 41, 72, 32, 71, 0, 92, 360, 0, - 0, 198, 0, 211, 359, 0, 203, 205, 285, 286, - 555, 232, 359, 232, 165, 163, 327, 188, 183, 478, - 479, 480, 481, 482, 483, 484, 485, 486, 492, 493, - 487, 488, 489, 490, 491, 494, 495, 496, 497, 498, - 499, 500, 501, 502, 466, 465, 0, 463, 464, 0, - 474, 475, 469, 468, 470, 471, 472, 473, 476, 477, - 185, 467, 187, 196, 0, 222, 225, 221, 256, 0, - 0, 237, 266, 0, 166, 161, 199, 0, 0, 407, - 413, 351, 4, 0, 135, 0, 0, 0, 0, 115, - 0, 0, 232, 232, 0, 120, 378, 379, 380, 374, - 375, 376, 377, 602, 603, 530, 526, 527, 525, 528, - 529, 531, 506, 505, 507, 519, 509, 511, 510, 512, - 513, 515, 514, 516, 518, 508, 520, 504, 503, 517, - 478, 479, 523, 522, 521, 524, 586, 585, 597, 581, - 576, 26, 592, 588, 593, 601, 590, 591, 576, 589, - 596, 587, 594, 595, 577, 580, 582, 584, 583, 576, - 0, 0, 3, 131, 130, 129, 414, 0, 0, 0, - 424, 427, 0, 0, 434, 438, 442, 446, 436, 440, - 444, 448, 450, 452, 454, 455, 0, 34, 227, 231, - 46, 83, 84, 85, 81, 73, 74, 79, 76, 39, - 86, 0, 93, 94, 97, 198, 194, 0, 217, 0, - 0, 211, 0, 201, 0, 0, 33, 0, 353, 182, - 211, 0, 0, 459, 460, 192, 190, 0, 189, 211, - 224, 229, 0, 238, 257, 271, 268, 269, 263, 264, - 262, 261, 347, 411, 25, 136, 134, 0, 0, 0, - 368, 367, 0, 258, 232, 362, 366, 148, 149, 258, - 0, 110, 114, 117, 112, 0, 0, 109, 232, 211, - 0, 0, 0, 29, 4, 0, 417, 421, 423, 0, - 0, 430, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 457, 49, 50, 51, 37, 0, 0, - 0, 82, 0, 80, 0, 89, 95, 98, 578, 178, - 212, 213, 0, 288, 0, 206, 207, 0, 188, 570, - 572, 540, 574, 562, 538, 563, 568, 564, 292, 566, - 539, 544, 543, 537, 541, 542, 560, 561, 556, 559, - 534, 535, 536, 35, 87, 0, 461, 462, 0, 193, - 0, 232, 548, 549, 223, 547, 532, 245, 274, 270, - 348, 138, 369, 370, 371, 364, 241, 242, 240, 139, - 258, 265, 259, 361, 327, 142, 145, 111, 113, 116, - 0, 598, 599, 600, 28, 0, 0, 425, 0, 0, - 433, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 458, 0, 0, 0, 0, 64, 53, 58, 47, - 60, 54, 57, 55, 52, 0, 59, 0, 171, 172, - 56, 0, 0, 357, 0, 0, 61, 48, 77, 75, - 78, 96, 0, 0, 188, 214, 258, 204, 0, 209, - 202, 545, 545, 557, 545, 555, 545, 184, 191, 197, - 230, 533, 246, 239, 249, 0, 0, 137, 327, 150, - 254, 0, 258, 234, 363, 150, 258, 121, 415, 418, - 0, 428, 431, 435, 439, 443, 447, 437, 441, 445, - 449, 0, 0, 456, 69, 0, 67, 0, 0, 357, - 0, 0, 62, 65, 66, 0, 167, 63, 0, 173, - 0, 170, 199, 99, 100, 579, 179, 216, 217, 218, - 208, 0, 0, 0, 0, 0, 0, 211, 272, 275, - 365, 152, 140, 151, 235, 255, 143, 146, 250, 0, - 578, 0, 0, 0, 576, 578, 103, 359, 0, 68, - 0, 70, 0, 168, 0, 215, 220, 551, 552, 571, - 550, 546, 573, 554, 575, 553, 558, 569, 565, 567, - 0, 0, 245, 150, 122, 419, 0, 432, 451, 453, - 0, 0, 101, 0, 0, 104, 359, 169, 219, 247, - 153, 154, 236, 147, 252, 251, 0, 426, 578, 106, - 0, 102, 250, 155, 253, 0, 248, 105 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 1, 2, 4, 78, 232, 80, 81, 323, 82, - 83, 84, 234, 86, 226, 87, 365, 227, 247, 560, - 668, 669, 779, 780, 781, 362, 363, 565, 566, 674, - 670, 567, 89, 90, 367, 91, 571, 572, 573, 802, - 235, 856, 906, 92, 93, 458, 464, 459, 315, 316, - 639, 898, 317, 94, 193, 95, 236, 300, 453, 731, - 454, 455, 829, 456, 835, 457, 836, 933, 629, 892, - 893, 931, 950, 237, 98, 99, 100, 786, 787, 101, - 102, 373, 804, 103, 275, 387, 276, 590, 277, 104, - 279, 432, 598, 718, 242, 280, 599, 253, 789, 377, - 688, 255, 581, 583, 685, 686, 577, 578, 680, 878, - 681, 682, 916, 436, 437, 602, 105, 282, 354, 434, - 721, 355, 356, 739, 932, 283, 727, 740, 284, 823, - 887, 962, 934, 831, 439, 741, 742, 611, 441, 442, - 443, 606, 607, 728, 825, 826, 194, 107, 178, 149, - 375, 110, 111, 179, 380, 113, 114, 225, 357, 248, - 116, 117, 118, 119, 613, 239, 121, 296, 386, 122, - 153, 623, 624, 744, 828, 625, 123, 124, 125, 292, - 293, 294, 448, 295, 126, 645, 332, 756, 899, 333, - 334, 649, 840, 650, 337, 759, 901, 653, 657, 654, - 658, 655, 659, 656, 660, 661, 662, 772, 430, 703, - 704, 705, 724, 725, 881, 920, 921, 926, 584, 883, - 707, 708, 709, 815, 710, 816, 711, 814, 811, 812, - 712, 813, 321, 803, 524, 525, 526, 527, 528, 529 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -872 -static const yytype_int16 yypact[] = -{ - -872, 77, 87, -872, 4255, 167, 191, 227, 280, 300, - 301, 304, -872, -872, -872, 4899, -872, -872, -872, -872, - -872, -872, -872, 98, -872, -8, -872, 5429, 383, 4624, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -38, 106, 121, 122, 133, 158, 171, 186, - 196, 203, 210, 228, 243, -3, 36, 43, 45, 90, - 114, 130, 138, 151, 179, 183, 187, 202, 215, 233, - 235, 249, 258, 267, 269, 271, -872, 438, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, 4899, -872, - -872, 21, -872, -872, -872, -872, 5144, -872, -71, -71, - -71, -71, -872, 281, 5524, -872, 54, -872, 284, 4742, - 350, 4899, -25, -872, 297, 5239, -872, -872, -872, -872, - 4672, 276, -872, -872, -872, -872, -872, -10, 9, 18, - 50, 52, 148, 166, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, 310, -872, 4921, - 350, 312, 321, 4899, -10, 9, 18, 50, 52, 148, - 166, 441, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, 4899, -872, -872, 350, - 5429, 4790, -872, -872, -872, -872, -872, -872, -872, -872, - 332, 4899, 4899, 337, -872, 4742, 4899, 4529, -872, -872, - -872, 4529, 4529, -872, 4529, 4529, 4529, 4529, 4529, 4529, - 4529, 4529, 4529, 4529, 4529, 4529, 4529, 4529, -872, -872, - -872, -872, -872, -872, -872, 1286, 343, 348, 259, 1286, - -872, 4899, -872, -872, -872, -872, 5144, -872, 5334, 4947, - -872, -872, -872, -872, -872, -872, -872, 4899, 5524, -872, - -872, -872, -872, 360, -872, -872, -872, 350, -13, 362, - -872, -872, -872, -872, -872, -872, 4899, -872, -872, -872, - 4742, -872, -872, -872, -872, -872, -872, 363, 5071, -872, - -872, 370, -872, 377, 1478, 372, 4742, 350, 15, -872, - 435, -872, -872, -872, -872, 276, -872, 350, -872, -872, - 73, -872, -872, 5028, 177, 5028, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, 107, - 379, 1212, 409, 384, -872, 386, -872, -872, -872, 1383, - 4742, 387, 4529, 4529, 4529, 388, 389, 4529, 390, 391, - 392, 393, 397, 398, 399, 401, 402, 403, 405, 404, - 406, 407, -872, -872, 414, -872, 4790, -872, -872, -872, - -872, 1111, -872, -872, -872, 348, 415, 4529, -872, 5334, - 4742, -872, 1617, 424, -872, 471, -872, 412, -872, -872, - -872, 1286, 278, 1286, -872, -872, -872, -872, -872, 381, - 423, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, 428, -872, -872, 411, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, 41, -872, 212, -872, -872, -872, -872, 429, - 4790, -872, -872, 427, -872, -872, 350, 470, 440, -872, - -872, 4121, 436, 11, -872, 5560, 88, 524, 442, -872, - 4790, 443, 5028, 5028, 224, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - 444, 350, -872, -872, -872, -872, -872, 445, 434, 439, - -872, -872, 446, 5524, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, 4529, -872, 447, -872, - 48, -872, -872, -872, 485, 448, -872, 535, -872, -872, - -872, 452, 451, -872, 456, 457, -872, 454, -872, 350, - 297, 424, 4899, -872, 3577, 449, -872, 462, 4121, 41, - 424, 437, 453, -872, -872, -872, -872, 549, -872, 424, - -872, -872, 3857, -872, -872, -872, 427, -872, -872, -872, - -872, -872, -872, 440, -872, -872, -872, 4899, 4899, 4899, - -872, 350, 5524, 4694, 276, -872, -872, -872, -872, 4694, - 563, -872, 461, -872, -872, 467, 468, -872, 276, 424, - 1757, 1897, 2037, -872, 472, 5524, -872, -872, -872, 5524, - 5524, -872, 463, 5524, 5524, 5524, 5524, 5524, 5524, 5524, - 5524, 5524, 5524, 464, -872, -872, -872, -872, 4137, 469, - 4899, -872, 1111, -872, 4899, -872, 4529, -872, -872, -872, - 473, -872, 5524, -872, 474, 475, -872, 58, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, 477, -872, -872, 92, -872, - 478, 276, -872, -872, 3857, -872, -872, 160, 465, -872, - -872, 73, -872, -872, -872, -872, -872, -872, -872, -872, - 969, 372, -872, -872, -872, -872, -872, -872, -872, -872, - 479, -872, -872, -872, -872, 480, 5524, -872, 481, 5524, - -872, 482, 483, 484, 489, 490, 491, 492, 496, 487, - 499, -872, 498, 4373, 4851, 58, -872, -872, -872, -872, - -872, -872, -872, -872, -872, 4563, -872, -71, -872, -872, - -872, 506, 4742, 129, 4468, 4672, -872, -872, -872, -872, - -872, -872, 3857, 2317, -872, 526, 4694, -872, 4899, -872, - 41, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, 497, 3857, -872, -872, 504, - -872, 502, 4694, -872, 4121, 504, 4694, -872, -872, -872, - 508, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, 622, 623, -872, -872, 4720, -872, 518, -71, -13, - 4563, 4947, -872, -872, -872, 4563, -872, -872, 520, -872, - 4742, -872, -872, 3857, -872, -872, 41, -872, -872, -872, - -872, 3017, 3157, 2877, 3297, 3717, 3437, 424, -872, 3857, - 4121, -872, -872, -872, -872, -872, -872, -872, -872, 514, - -872, 515, 516, 519, -872, -872, -872, 328, 4720, -872, - 518, -872, 4720, -872, 527, -872, 377, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - 521, 3997, 160, 504, 93, -872, 2457, -872, -872, -872, - 2177, 2597, -872, 328, 4720, -872, 339, -872, -872, -872, - 3997, -872, -872, -872, -872, -872, 58, -872, -872, -872, - 339, -872, -872, -872, -872, 2737, 93, -872 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -872, -872, -260, -872, -872, 645, -872, -872, -872, -872, - -613, -94, 1, -26, -872, -872, -872, -872, 16, -872, - -872, -872, -872, -872, -872, 285, -872, -872, -20, -872, - -872, 89, -17, -21, -872, -872, -872, -872, -22, -872, - -872, -202, -473, -9, -102, -249, 199, 22, -872, -872, - -872, -872, 201, -6, -872, -872, -1, -872, -872, -872, - -66, -872, -872, -872, -872, -872, -872, -872, -872, -770, - -872, -872, -872, 668, -872, -872, -872, -111, -97, -576, - -80, -872, -872, -154, -241, -872, -872, -872, -155, 35, - -270, -364, -872, -872, -91, -872, -872, -105, -67, -872, - -872, -872, -872, -872, -872, -129, -542, -872, -872, -872, - -198, -872, -872, -230, -872, -872, 20, 333, -166, 338, - -872, -5, -95, -575, -872, -157, -872, -872, -872, -237, - -872, -872, -261, -872, -872, -872, -98, -872, -29, -696, - -872, -872, 112, -872, -872, -872, 13, -45, 3, 32, - -872, -63, 23, -4, -872, 754, -24, 8, -872, 10, - -81, -872, -872, -415, -872, 49, -872, -872, -872, -19, - -872, -872, -872, -872, -872, -872, -121, -391, 194, -272, - 425, 430, -872, -872, 51, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, - -872, -872, -872, -872, -872, -872, -872, -872, -872, -204, - -302, 82, -751, -554, -456, -581, -153, -872, -89, -872, - -871, -872, -872, -872, -872, -872, 17, -872, -872, -872, - -872, -872, -183, -820, -872, -759, -872, -872, -660, -872 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -411 -static const yytype_int16 yytable[] = -{ - 112, 175, 233, 96, 190, 85, 177, 108, 243, 244, - 245, 150, 440, 268, 115, 281, 445, 106, 148, 522, - 88, 726, 285, 589, 318, 150, 291, 809, 147, 252, - 706, 824, 148, 612, 271, 269, 109, 180, 452, 684, - 328, 327, 254, 176, 875, 444, 257, 30, 715, 240, - 241, 873, 196, 120, 745, 777, 461, 720, 372, 30, - 951, 195, -320, 366, 256, 896, 261, 595, 473, 474, - 522, 664, 665, 666, 431, 889, 181, 3, 596, 963, - 936, -322, -308, 319, 150, 941, 257, -2, -308, 265, - -321, 148, 788, -141, 267, -279, 272, 750, 229, 271, - 445, 228, 689, 690, 256, 258, 238, 150, 627, -144, - 151, -141, 88, -199, 262, 862, 287, 521, -320, 954, - 152, 955, -325, 197, -326, 431, 628, 438, 109, 444, - 956, 266, 257, 260, 281, 263, 615, -322, 965, 447, - 616, -198, 230, 821, 358, 297, -321, 270, 358, 150, - 256, 261, 286, 249, 306, 278, 148, 271, 269, 307, - 854, 272, 198, 953, 597, 830, 301, 271, 521, 199, - 667, 200, 150, 263, 250, 535, 534, 875, -325, 148, - -326, 281, 875, 303, 515, 305, 285, 150, 150, 304, - 384, 297, 150, 701, 148, 148, 176, 788, 730, 262, - 520, 30, 263, 385, 324, 325, 875, 257, 460, 788, - 460, 701, 265, 635, 636, 585, 201, 587, 696, 272, - -324, 726, 358, 257, 358, 256, -307, 150, 330, 272, - 329, 879, -307, 465, 148, 287, 824, -267, -323, -320, - 202, -319, -309, 150, 368, 726, 369, -319, -309, -279, - 148, 520, 176, -310, 266, -199, 203, 895, 285, -310, - 374, 897, 150, -322, 204, 281, 258, 257, 109, 148, - 270, 370, 644, 381, 278, 383, -324, 205, -311, 382, - 378, 379, 446, 604, -311, 256, 822, -295, 271, 269, - -267, -312, 821, -295, -323, -320, 964, -312, -38, -321, - 358, -38, 358, 318, 451, 206, -313, 257, 821, 207, - 263, -293, -313, 208, 462, 463, -314, -293, 531, -322, - 379, 278, -314, -315, 810, 530, 297, 640, 209, -315, - -316, 706, 600, 701, 626, 641, -316, 601, 522, 522, - 522, 210, 285, 265, 637, 930, 642, -294, -317, 638, - 272, 580, -325, -294, -317, -321, 882, 150, 884, 211, - 886, 212, 319, -318, 148, 329, 446, 460, 460, -318, - 358, 579, -326, -324, 568, 213, -323, 706, 249, 364, - -38, 358, 358, -38, 214, 176, 182, 183, 184, 185, - 186, 187, 188, 215, 588, 216, 706, 217, 586, -38, - -298, 270, -38, 523, -277, 278, -298, 246, -325, 289, - 290, 701, 182, 183, 184, 185, 186, 187, 188, 359, - -299, -297, 30, 359, -296, 264, -299, -297, -326, -324, - -296, -90, -323, 298, 942, 701, 521, 521, 521, 945, - 876, 218, 219, 220, 221, 222, 223, 224, 364, 904, - 299, 621, 905, 302, 523, 322, 630, 326, 620, 586, - 904, -410, -410, 905, 360, 622, 16, 17, 832, 379, - 942, 945, 361, 961, 182, 183, 184, 185, 186, 187, - 188, 30, 701, 608, 609, 610, 376, 961, -198, 388, - 701, 701, 701, 701, 701, 701, 433, 359, 701, 359, - 435, 522, -267, 447, 189, 532, 533, 358, 561, 562, - 563, 591, 536, 540, 541, 543, 544, 545, 546, 520, - 520, 520, 547, 548, 549, 871, 550, 551, 552, 743, - 553, 554, 556, 555, 557, 570, 582, 12, 13, 14, - 701, 271, 594, 460, 16, 17, 18, 19, 20, 21, - 22, -210, 161, 592, 263, 593, 603, 605, 614, 701, - 25, 647, 631, 634, 643, 673, 648, 719, 716, 713, - 646, 651, 601, 672, 675, 359, 676, 359, 150, 677, - 678, 679, 714, 746, 717, 148, 638, 747, 748, 771, - 760, 871, 652, 797, 754, 687, -273, 877, 805, 521, - 808, 807, 683, 735, 817, 819, 837, 838, 841, 843, - 844, 845, 851, 150, 150, 150, 846, 847, 848, 849, - 148, 148, 148, 850, 852, 853, 867, 891, 888, 894, - 732, 733, 734, 900, 522, 902, 903, 868, 522, 522, - 913, 935, 937, 938, 263, 359, 939, 947, 949, 79, - 569, 782, 799, 671, 801, 909, 359, 359, 632, 783, - 749, 633, 784, 522, 793, 827, 150, 785, 150, 778, - 150, 108, 97, 148, 864, 148, 858, 148, 794, 880, - 915, 791, 520, 798, 88, 568, 948, 800, 790, 559, - 281, 233, 268, 558, 755, 952, 866, 285, 757, 758, - 792, 966, 761, 762, 763, 764, 765, 766, 767, 768, - 769, 770, 833, 271, 269, 914, 820, 795, 729, 796, - 449, 940, 523, 523, 523, 450, 885, 869, 0, 257, - 925, 806, 521, 0, 0, 818, 521, 521, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 256, 0, 0, - 0, 0, 834, 358, 0, 0, 281, 0, 0, 0, - 0, 521, 0, 233, 0, 0, 0, 911, 265, 859, - 150, 580, 857, 267, 0, 272, 0, 148, 702, 271, - 269, 859, 359, 860, 271, 269, 863, 0, 297, 855, - 859, 872, 0, 869, 0, 865, 702, 196, 869, 0, - 0, 88, 0, 0, 150, 839, 195, 257, 842, 358, - 266, 148, 0, 0, 0, 520, 263, 792, 0, 520, - 520, 687, 861, 0, 0, 256, 870, 278, 0, 271, - 278, 0, 0, 0, 861, 0, 890, 580, 0, 265, - 0, 272, 0, 0, 520, 0, 272, 0, 0, 0, - 0, 150, 0, 0, 0, 0, 859, 872, 148, 0, - 0, 859, 0, 259, 0, 0, 297, 910, 907, 0, - 0, 0, 0, 908, 288, 0, 912, 0, 0, 0, - 0, 266, 263, 0, 0, 523, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 278, 870, 0, 0, - 0, 0, 0, 0, 150, 278, 0, 0, 150, 0, - 0, 148, 0, 0, 0, 148, 0, 0, 702, 0, - 0, 943, 0, 0, 0, 946, 944, 0, 0, 0, - 0, 0, 0, 0, 0, 320, 0, 0, 0, 0, - 150, 0, 0, 0, 0, 0, 0, 148, 0, 0, - 0, 331, 0, 0, 0, 335, 336, 960, 338, 339, - 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 308, 309, 310, 311, 312, 313, 314, 736, - 737, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 371, 0, 0, 702, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 523, 0, - 702, 0, 523, 523, 259, 0, 0, 0, 359, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 320, 0, - 371, 0, 0, 0, 0, 0, 0, 523, 0, 0, - 0, 0, 0, 0, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 702, 0, 0, - 0, 0, 0, 0, 0, 702, 702, 702, 702, 702, - 702, 0, 0, 702, 359, 0, 537, 538, 539, 0, - 0, 542, 0, 0, 0, 738, 0, 0, 0, 0, - 0, 77, 289, 290, 0, 0, 0, 0, 0, 0, - 320, 0, 0, 0, 127, 128, 129, 130, 131, 132, - 133, 574, 0, 0, 575, 702, 0, 0, 0, 0, - 0, 0, 0, 0, 561, 562, 563, 0, 0, 0, - 0, 564, 0, 0, 702, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 320, 0, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, - 0, 0, 0, 0, 320, 466, 467, 468, 469, 470, - 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, - 481, 482, 483, 484, 485, 486, 487, 488, 489, 0, - 0, 490, 491, 77, 492, 0, 493, 494, 495, 496, - 497, 498, 499, 0, 500, 501, 502, 503, 504, 505, - 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, 412, 413, 506, 507, 508, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 663, 0, 16, 17, 18, 19, 20, 21, 22, 352, - 161, 0, 0, 0, 0, 353, 0, 0, 0, 0, - 0, 0, 509, 510, 511, 512, 513, 514, 515, 0, - 516, 517, 518, 0, 420, 421, 422, 423, 424, 425, - 426, 427, 428, 429, 519, 0, 0, 0, 0, 0, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 0, 0, 0, 0, 0, 0, 320, 0, 0, - 0, 0, 0, 320, 0, 0, 154, 155, 156, 157, - 158, 159, 160, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 12, 13, 14, 231, -226, 0, 0, 16, - 17, 18, 19, 20, 21, 22, 0, 161, 0, 289, - 290, 26, 259, 0, 0, 389, 390, 0, 0, 0, - 574, 391, 392, 393, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, 0, 30, 0, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 308, 309, 310, 311, 312, 313, 314, 273, 274, - 0, 0, 0, 0, 320, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 414, 0, 415, 416, - 0, 417, 418, 419, 0, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 0, 0, 371, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 371, - 0, 0, 0, 0, 0, 0, 0, 0, 371, 288, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 320, 0, 0, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 320, 0, 0, 0, - 320, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 77, 289, 290, 0, 371, 371, 0, 0, 0, 371, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 509, 510, 576, - 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 509, 510, 751, - 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 509, 510, 0, - 512, 513, 514, 515, 0, 516, 517, 518, 752, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 509, 510, 0, - 512, 513, 514, 515, 753, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 509, 510, 958, - 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 874, 510, 0, - 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, - 512, 513, 514, 515, 957, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 959, 510, 0, - 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, - 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 967, 510, 0, - 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 923, 692, 924, - 917, 694, 918, 696, 0, 722, 723, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 917, 694, 918, 696, 919, 722, 723, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 917, 694, 918, 696, 922, 722, 723, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 917, 694, 918, 696, 927, 722, 723, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 917, 694, 918, 696, 0, 722, 723, 699, 929, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 693, 694, 695, 696, 0, 697, 698, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 693, 694, 695, 696, 0, 697, 928, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 0, 694, 0, 696, 0, 722, 723, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, - 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, - 0, 694, 0, 696, 0, 697, 0, 699, 0, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, - 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, - 19, 20, 21, 22, 352, 161, 12, 13, 14, 15, - 353, 0, 0, 16, 17, 18, 19, 20, 21, 22, - 773, 161, 24, 25, 0, 26, 27, 0, 774, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 0, 0, 0, 30, - 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 775, 776, 5, 6, - 7, 8, 9, 10, 11, 0, 0, 0, 0, 77, - 0, 0, 0, 0, 12, 13, 14, 15, 0, 0, - 0, 16, 17, 18, 19, 20, 21, 22, 0, 23, - 24, 25, 0, 26, 27, 28, 29, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 30, 0, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 0, 76, 5, 6, 7, 8, - 9, 10, 11, 0, 0, 0, 0, 77, 0, 0, - 0, 0, 12, 13, 14, 231, 0, 0, 0, 16, - 17, 18, 19, 20, 21, 22, 0, 161, 24, 25, - 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 30, 0, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 5, 6, 7, 8, 9, 10, 11, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, - 15, 0, 0, 0, 16, 17, 18, 19, 20, 21, - 22, 0, 161, 24, 0, 77, 26, 27, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 308, 309, 310, 311, 312, 313, 314, 0, - 30, 0, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 5, 6, 7, 8, - 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 12, 13, 14, 231, 0, 0, 0, 16, - 17, 18, 19, 20, 21, 22, 0, 161, 24, 0, - 77, 26, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 127, 128, 129, - 130, 131, 132, 133, 0, 30, 0, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 77, 191, 0, 192, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 127, 128, 129, 130, 131, - 132, 133, 273, 274, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 77, 30, 308, 309, 310, - 311, 312, 313, 314, 736, 737, 0, 24, 0, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 0, 127, 128, 129, 130, 131, 132, 133, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 127, 128, 129, 130, 131, - 132, 133, 0, 0, 0, 0, 77, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 0, 0, 0, 0, 0, 0, 0, 24, 251, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 30, 308, 309, 310, 311, 312, 313, 314, - 273, 274, 0, 0, 77, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 0, 0, - 738, 0, 0, 0, 0, 0, 77, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 0, 904, 0, 0, 905, 0, 0, 0, 0, 0, - 0, 0, 77, 0, 127, 128, 129, 130, 131, 132, - 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 0, 191, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 127, 128, 129, 130, 131, 132, 133, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 77, 30, 127, 128, 129, 130, 131, 132, - 133, 0, 0, 0, 0, 0, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, - 127, 128, 129, 130, 131, 132, 133, 251, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 24, 77, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 77, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 0, 0, 0, 0, 0, - 0, 0, 0, 77, 16, 17, 18, 19, 20, 21, - 22, 352, 161, 0, 0, 0, 0, 353, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 389, 390, 0, 0, 0, 0, 391, - 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - 412, 413, 0, 0, 0, 0, 0, 154, 155, 156, - 157, 158, 159, 160, 0, 0, 0, 0, 0, 0, - 0, 289, 290, 12, 13, 14, 231, 0, 0, 0, - 16, 17, 18, 19, 20, 21, 22, 0, 161, 24, - 25, 0, 26, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 414, 0, 415, 416, 0, 417, - 418, 419, 0, 420, 421, 422, 423, 424, 425, 426, - 427, 428, 429, 0, 0, 0, 30, 0, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 154, 155, 156, 157, 158, 159, 160, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, - 14, 15, 0, 0, 0, 16, 17, 18, 19, 20, - 21, 22, 0, 161, 24, 0, 0, 26, 27, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 30, 0, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 154, 155, 156, - 157, 158, 159, 160, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 13, 14, 231, 0, 0, 0, - 16, 17, 18, 19, 20, 21, 22, 0, 161, 24, - 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 30, 0, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 154, 155, 156, 157, 158, 159, 160, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, - 14, 15, 0, 0, 0, 16, 17, 18, 19, 20, - 21, 22, 0, 161, 0, 0, 0, 26, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 30, 0, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 154, 155, 156, - 157, 158, 159, 160, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 13, 14, 231, 0, 0, 0, - 16, 17, 18, 19, 20, 21, 22, 0, 161, 0, - 0, 0, 26, 154, 155, 156, 157, 158, 159, 160, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 617, - 0, 618, 619, 0, 0, 0, 16, 17, 18, 19, - 20, 21, 22, 0, 161, 0, 30, 0, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 30, 0, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174 -}; - -static const yytype_int16 yycheck[] = -{ - 4, 27, 96, 4, 28, 4, 27, 4, 99, 100, - 101, 15, 284, 115, 4, 120, 286, 4, 15, 321, - 4, 602, 120, 387, 181, 29, 121, 687, 15, 109, - 584, 727, 29, 448, 115, 115, 4, 27, 298, 581, - 195, 195, 109, 27, 803, 286, 109, 72, 590, 120, - 121, 802, 29, 4, 629, 668, 305, 599, 241, 72, - 931, 29, 72, 229, 109, 835, 111, 26, 10, 11, - 372, 23, 24, 25, 278, 826, 27, 0, 37, 950, - 900, 72, 120, 181, 88, 905, 149, 0, 126, 115, - 72, 88, 668, 20, 115, 120, 115, 639, 90, 180, - 370, 88, 10, 11, 149, 109, 96, 111, 20, 36, - 12, 38, 96, 126, 111, 775, 120, 321, 128, 26, - 128, 28, 72, 126, 72, 329, 38, 284, 96, 370, - 37, 115, 195, 110, 239, 112, 125, 128, 958, 124, - 129, 126, 121, 724, 225, 149, 128, 115, 229, 153, - 195, 196, 120, 104, 180, 120, 153, 238, 238, 180, - 773, 180, 126, 933, 123, 740, 153, 248, 372, 126, - 122, 126, 176, 150, 120, 330, 330, 936, 128, 176, - 128, 286, 941, 175, 126, 177, 284, 191, 192, 176, - 270, 195, 196, 584, 191, 192, 180, 773, 613, 196, - 321, 72, 179, 270, 191, 192, 965, 270, 303, 785, - 305, 602, 238, 462, 463, 381, 126, 383, 126, 238, - 72, 802, 303, 286, 305, 270, 120, 231, 196, 248, - 195, 806, 126, 126, 231, 239, 932, 130, 72, 72, - 126, 120, 120, 247, 231, 826, 236, 126, 126, 120, - 247, 372, 236, 120, 238, 126, 126, 832, 356, 126, - 247, 836, 266, 72, 126, 370, 270, 330, 236, 266, - 238, 239, 532, 265, 239, 267, 128, 126, 120, 266, - 257, 258, 286, 440, 126, 330, 126, 120, 369, 369, - 130, 120, 873, 126, 128, 128, 956, 126, 121, 72, - 381, 124, 383, 460, 296, 126, 120, 370, 889, 126, - 287, 120, 126, 126, 306, 307, 120, 126, 322, 128, - 297, 286, 126, 120, 688, 322, 330, 510, 126, 126, - 120, 885, 120, 724, 455, 518, 126, 125, 640, 641, - 642, 126, 440, 369, 120, 887, 529, 120, 120, 125, - 369, 375, 72, 126, 126, 128, 812, 361, 814, 126, - 816, 126, 460, 120, 361, 330, 370, 462, 463, 126, - 451, 375, 72, 72, 361, 126, 72, 931, 329, 120, - 121, 462, 463, 124, 126, 369, 3, 4, 5, 6, - 7, 8, 9, 126, 386, 126, 950, 126, 120, 121, - 120, 369, 124, 321, 120, 370, 126, 126, 128, 133, - 134, 802, 3, 4, 5, 6, 7, 8, 9, 225, - 120, 120, 72, 229, 120, 128, 126, 126, 128, 128, - 126, 121, 128, 121, 907, 826, 640, 641, 642, 912, - 804, 3, 4, 5, 6, 7, 8, 9, 120, 121, - 129, 455, 124, 12, 372, 123, 457, 120, 455, 120, - 121, 26, 27, 124, 121, 455, 26, 27, 740, 446, - 943, 944, 124, 946, 3, 4, 5, 6, 7, 8, - 9, 72, 873, 13, 14, 15, 126, 960, 126, 126, - 881, 882, 883, 884, 885, 886, 126, 303, 889, 305, - 123, 803, 130, 124, 121, 121, 120, 588, 23, 24, - 25, 130, 125, 125, 125, 125, 125, 125, 125, 640, - 641, 642, 125, 125, 125, 795, 125, 125, 125, 624, - 125, 127, 125, 127, 120, 120, 124, 19, 20, 21, - 931, 622, 131, 638, 26, 27, 28, 29, 30, 31, - 32, 127, 34, 130, 531, 127, 127, 130, 122, 950, - 36, 127, 120, 120, 120, 30, 127, 18, 131, 120, - 125, 125, 125, 125, 122, 381, 125, 383, 582, 123, - 123, 127, 120, 20, 131, 582, 125, 120, 120, 125, - 127, 861, 543, 124, 122, 582, 131, 71, 125, 803, - 125, 127, 579, 622, 127, 127, 127, 127, 127, 127, - 127, 127, 125, 617, 618, 619, 127, 127, 127, 127, - 617, 618, 619, 127, 125, 127, 120, 123, 131, 127, - 617, 618, 619, 125, 936, 13, 13, 792, 940, 941, - 120, 127, 127, 127, 621, 451, 127, 120, 127, 4, - 365, 668, 672, 564, 676, 857, 462, 463, 459, 668, - 638, 460, 668, 965, 668, 731, 670, 668, 672, 668, - 674, 668, 4, 670, 785, 672, 773, 674, 668, 808, - 878, 668, 803, 670, 668, 672, 916, 674, 668, 356, - 795, 785, 794, 355, 645, 932, 787, 795, 649, 650, - 668, 962, 653, 654, 655, 656, 657, 658, 659, 660, - 661, 662, 741, 794, 794, 870, 721, 668, 606, 668, - 295, 904, 640, 641, 642, 295, 815, 794, -1, 792, - 883, 682, 936, -1, -1, 718, 940, 941, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 792, -1, -1, - -1, -1, 744, 834, -1, -1, 861, -1, -1, -1, - -1, 965, -1, 857, -1, -1, -1, 858, 794, 773, - 774, 795, 773, 794, -1, 794, -1, 774, 584, 860, - 860, 785, 588, 773, 865, 865, 785, -1, 792, 773, - 794, 795, -1, 860, -1, 785, 602, 774, 865, -1, - -1, 785, -1, -1, 808, 756, 774, 870, 759, 890, - 794, 808, -1, -1, -1, 936, 793, 785, -1, 940, - 941, 808, 773, -1, -1, 870, 794, 792, -1, 910, - 795, -1, -1, -1, 785, -1, 828, 861, -1, 865, - -1, 860, -1, -1, 965, -1, 865, -1, -1, -1, - -1, 855, -1, -1, -1, -1, 860, 861, 855, -1, - -1, 865, -1, 109, -1, -1, 870, 857, 855, -1, - -1, -1, -1, 857, 120, -1, 860, -1, -1, -1, - -1, 865, 859, -1, -1, 803, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 861, 865, -1, -1, - -1, -1, -1, -1, 908, 870, -1, -1, 912, -1, - -1, 908, -1, -1, -1, 912, -1, -1, 724, -1, - -1, 908, -1, -1, -1, 912, 910, -1, -1, -1, - -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, - 944, -1, -1, -1, -1, -1, -1, 944, -1, -1, - -1, 197, -1, -1, -1, 201, 202, 944, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 3, 4, 5, 6, 7, 8, 9, 10, - 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 239, -1, -1, 802, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 936, -1, - 826, -1, 940, 941, 270, -1, -1, -1, 834, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 284, -1, - 286, -1, -1, -1, -1, -1, -1, 965, -1, -1, - -1, -1, -1, -1, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 873, -1, -1, - -1, -1, -1, -1, -1, 881, 882, 883, 884, 885, - 886, -1, -1, 889, 890, -1, 332, 333, 334, -1, - -1, 337, -1, -1, -1, 126, -1, -1, -1, -1, - -1, 132, 133, 134, -1, -1, -1, -1, -1, -1, - 356, -1, -1, -1, 3, 4, 5, 6, 7, 8, - 9, 367, -1, -1, 370, 931, -1, -1, -1, -1, - -1, -1, -1, -1, 23, 24, 25, -1, -1, -1, - -1, 30, -1, -1, 950, -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, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 440, -1, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, -1, - -1, -1, -1, -1, 460, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, - -1, 29, 30, 132, 32, -1, 34, 35, 36, 37, - 38, 39, 40, -1, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 556, -1, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, -1, -1, -1, 39, -1, -1, -1, -1, - -1, -1, 120, 121, 122, 123, 124, 125, 126, -1, - 128, 129, 130, -1, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, -1, -1, -1, -1, -1, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, -1, -1, -1, -1, -1, -1, 623, -1, -1, - -1, -1, -1, 629, -1, -1, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 19, 20, 21, 22, 120, -1, -1, 26, - 27, 28, 29, 30, 31, 32, -1, 34, -1, 133, - 134, 38, 668, -1, -1, 42, 43, -1, -1, -1, - 676, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, -1, 72, -1, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 3, 4, 5, 6, 7, 8, 9, 10, 11, - -1, -1, -1, -1, 740, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 123, -1, 125, 126, - -1, 128, 129, 130, -1, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, -1, -1, 773, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 785, - -1, -1, -1, -1, -1, -1, -1, -1, 794, 795, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 806, -1, -1, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 832, -1, -1, -1, - 836, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 132, 133, 134, -1, 860, 861, -1, -1, -1, 865, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, - 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - -1, 124, -1, 126, -1, 128, 129, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, - -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, - -1, 124, -1, 126, -1, 128, -1, 130, -1, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 3, 4, 5, 6, 7, 8, 9, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 19, 20, 21, 22, - 39, -1, -1, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, -1, 38, 39, -1, 41, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, -1, 72, - -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 3, 4, - 5, 6, 7, 8, 9, -1, -1, -1, -1, 132, - -1, -1, -1, -1, 19, 20, 21, 22, -1, -1, - -1, 26, 27, 28, 29, 30, 31, 32, -1, 34, - 35, 36, -1, 38, 39, 40, 41, -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, 72, -1, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, -1, 120, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, -1, 132, -1, -1, - -1, -1, 19, 20, 21, 22, -1, -1, -1, 26, - 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, - -1, 38, -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, 72, -1, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 3, 4, 5, 6, 7, 8, 9, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, -1, -1, -1, 26, 27, 28, 29, 30, 31, - 32, -1, 34, 35, -1, 132, 38, 39, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, - 72, -1, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 19, 20, 21, 22, -1, -1, -1, 26, - 27, 28, 29, 30, 31, 32, -1, 34, 35, -1, - 132, 38, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 3, 4, 5, - 6, 7, 8, 9, -1, 72, -1, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 132, 38, -1, 40, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3, 4, 5, 6, 7, - 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 132, 72, 3, 4, 5, - 6, 7, 8, 9, 10, 11, -1, 35, -1, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, -1, 3, 4, 5, 6, 7, 8, 9, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3, 4, 5, 6, 7, - 8, 9, -1, -1, -1, -1, 132, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - -1, -1, -1, -1, -1, -1, -1, 35, 36, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 72, 3, 4, 5, 6, 7, 8, 9, - 10, 11, -1, -1, 132, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, -1, -1, - 126, -1, -1, -1, -1, -1, 132, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - -1, 121, -1, -1, 124, -1, -1, -1, -1, -1, - -1, -1, 132, -1, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 132, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, -1, 38, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 132, 72, 3, 4, 5, 6, 7, 8, - 9, -1, -1, -1, -1, -1, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, -1, - 3, 4, 5, 6, 7, 8, 9, 36, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 35, 132, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 132, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, -1, 132, 26, 27, 28, 29, 30, 31, - 32, 33, 34, -1, -1, -1, -1, 39, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 42, 43, -1, -1, -1, -1, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, -1, -1, -1, -1, -1, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, 133, 134, 19, 20, 21, 22, -1, -1, -1, - 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, - 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 123, -1, 125, 126, -1, 128, - 129, 130, -1, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, -1, -1, -1, 72, -1, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, - 21, 22, -1, -1, -1, 26, 27, 28, 29, 30, - 31, 32, -1, 34, 35, -1, -1, 38, 39, -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, 72, -1, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, -1, -1, -1, - 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, - -1, -1, 38, -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, 72, -1, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, - 21, 22, -1, -1, -1, 26, 27, 28, 29, 30, - 31, 32, -1, 34, -1, -1, -1, 38, -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, 72, -1, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, -1, -1, -1, - 26, 27, 28, 29, 30, 31, 32, -1, 34, -1, - -1, -1, 38, 3, 4, 5, 6, 7, 8, 9, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, - -1, 21, 22, -1, -1, -1, 26, 27, 28, 29, - 30, 31, 32, -1, 34, -1, 72, -1, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 72, -1, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint16 yystos[] = -{ - 0, 144, 145, 0, 146, 3, 4, 5, 6, 7, - 8, 9, 19, 20, 21, 22, 26, 27, 28, 29, - 30, 31, 32, 34, 35, 36, 38, 39, 40, 41, - 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 120, 132, 147, 148, - 149, 150, 152, 153, 154, 155, 156, 158, 161, 175, - 176, 178, 186, 187, 196, 198, 199, 216, 217, 218, - 219, 222, 223, 226, 232, 259, 289, 290, 291, 292, - 294, 295, 296, 298, 299, 302, 303, 304, 305, 306, - 308, 309, 312, 319, 320, 321, 327, 3, 4, 5, - 6, 7, 8, 9, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 289, 291, 292, - 296, 12, 128, 313, 3, 4, 5, 6, 7, 8, - 9, 34, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 156, 161, 176, 291, 296, - 302, 308, 3, 4, 5, 6, 7, 8, 9, 121, - 299, 38, 40, 197, 289, 292, 295, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 3, 4, - 5, 6, 7, 8, 9, 300, 157, 160, 289, 300, - 121, 22, 148, 154, 155, 183, 199, 216, 302, 308, - 120, 121, 237, 237, 237, 237, 126, 161, 302, 308, - 120, 36, 223, 240, 241, 244, 290, 294, 296, 298, - 295, 290, 291, 295, 128, 156, 161, 176, 187, 223, - 292, 303, 312, 10, 11, 227, 229, 231, 232, 233, - 238, 240, 260, 268, 271, 279, 292, 296, 298, 133, - 134, 265, 322, 323, 324, 326, 310, 296, 121, 129, - 200, 289, 12, 300, 289, 300, 156, 176, 3, 4, - 5, 6, 7, 8, 9, 191, 192, 195, 268, 279, - 298, 375, 123, 151, 289, 289, 120, 226, 231, 232, - 292, 298, 329, 332, 333, 298, 298, 337, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 33, 39, 261, 264, 265, 301, 303, 321, - 121, 124, 168, 169, 120, 159, 261, 177, 289, 302, - 292, 298, 375, 224, 289, 293, 126, 242, 295, 295, - 297, 300, 289, 300, 223, 241, 311, 228, 126, 42, - 43, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 123, 125, 126, 128, 129, 130, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 351, 352, 234, 126, 262, 123, 256, 257, 268, 277, - 322, 281, 282, 283, 227, 233, 296, 124, 325, 323, - 324, 300, 145, 201, 203, 204, 206, 208, 188, 190, - 265, 188, 300, 300, 189, 126, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, - 42, 43, 44, 45, 46, 47, 71, 72, 73, 120, - 121, 122, 123, 124, 125, 126, 128, 129, 130, 142, - 319, 352, 353, 354, 377, 378, 379, 380, 381, 382, - 291, 296, 121, 120, 226, 231, 125, 298, 298, 298, - 125, 125, 298, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 127, 127, 125, 120, 262, 260, - 162, 23, 24, 25, 30, 170, 171, 174, 289, 168, - 120, 179, 180, 181, 298, 298, 122, 249, 250, 296, - 299, 245, 124, 246, 361, 261, 120, 261, 300, 234, - 230, 130, 130, 127, 131, 26, 37, 123, 235, 239, - 120, 125, 258, 127, 268, 130, 284, 285, 13, 14, - 15, 280, 306, 307, 122, 125, 129, 19, 21, 22, - 291, 296, 302, 314, 315, 318, 319, 20, 38, 211, - 199, 120, 189, 195, 120, 188, 188, 120, 125, 193, - 375, 375, 375, 120, 145, 328, 125, 127, 127, 334, - 336, 125, 308, 340, 342, 344, 346, 341, 343, 345, - 347, 348, 349, 298, 23, 24, 25, 122, 163, 164, - 173, 174, 125, 30, 172, 122, 125, 123, 123, 127, - 251, 253, 254, 295, 249, 247, 248, 289, 243, 10, - 11, 72, 121, 123, 124, 125, 126, 128, 129, 130, - 142, 320, 321, 352, 353, 354, 356, 363, 364, 365, - 367, 369, 373, 120, 120, 249, 131, 131, 236, 18, - 249, 263, 128, 129, 355, 356, 358, 269, 286, 285, - 306, 202, 289, 289, 289, 312, 10, 11, 126, 266, - 270, 278, 279, 265, 316, 266, 20, 120, 120, 190, - 249, 122, 131, 127, 122, 308, 330, 308, 308, 338, - 127, 308, 308, 308, 308, 308, 308, 308, 308, 308, - 308, 125, 350, 33, 41, 119, 120, 153, 155, 165, - 166, 167, 175, 186, 196, 199, 220, 221, 222, 241, - 259, 289, 292, 296, 302, 308, 327, 124, 289, 171, - 289, 181, 182, 376, 225, 125, 308, 127, 125, 381, - 234, 371, 372, 374, 370, 366, 368, 127, 369, 127, - 264, 358, 126, 272, 282, 287, 288, 203, 317, 205, - 266, 276, 322, 281, 300, 207, 209, 127, 127, 308, - 335, 127, 308, 127, 127, 127, 127, 127, 127, 127, - 127, 125, 125, 127, 153, 161, 184, 199, 221, 296, - 302, 308, 381, 155, 220, 302, 237, 120, 231, 241, - 292, 233, 296, 355, 120, 378, 234, 71, 252, 266, - 248, 357, 357, 362, 357, 361, 357, 273, 131, 355, - 300, 123, 212, 213, 127, 266, 212, 266, 194, 331, - 125, 339, 13, 13, 121, 124, 185, 289, 161, 184, - 302, 237, 161, 120, 231, 253, 255, 123, 125, 127, - 358, 359, 127, 120, 122, 359, 360, 127, 129, 131, - 249, 214, 267, 210, 275, 127, 376, 127, 127, 127, - 375, 376, 185, 289, 161, 185, 289, 120, 256, 127, - 215, 363, 272, 212, 26, 28, 37, 127, 122, 120, - 289, 185, 274, 363, 381, 376, 275, 120 -}; - -#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 yyerrorlab - - -/* 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); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - 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; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* 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; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 4: - -/* Line 1455 of yacc.c */ -#line 1464 "vtkParse.y" - { - startSig(); - clearType(); - clearTypeId(); - clearTemplate(); - closeComment(); - } - break; - - case 27: - -/* Line 1455 of yacc.c */ -#line 1509 "vtkParse.y" - { pushNamespace((yyvsp[(2) - (2)].str)); } - break; - - case 28: - -/* Line 1455 of yacc.c */ -#line 1510 "vtkParse.y" - { popNamespace(); } - break; - - case 36: - -/* Line 1455 of yacc.c */ -#line 1532 "vtkParse.y" - { pushType(); } - break; - - case 37: - -/* Line 1455 of yacc.c */ -#line 1533 "vtkParse.y" - { - const char *name = (currentClass ? currentClass->Name : NULL); - popType(); - clearTypeId(); - if (name) - { - setTypeId(name); - setTypeBase(guess_id_type(name)); - } - end_class(); - } - break; - - case 38: - -/* Line 1455 of yacc.c */ -#line 1546 "vtkParse.y" - { start_class((yyvsp[(2) - (2)].str), (yyvsp[(1) - (2)].integer)); } - break; - - case 40: - -/* Line 1455 of yacc.c */ -#line 1548 "vtkParse.y" - { start_class(NULL, (yyvsp[(1) - (1)].integer)); } - break; - - case 42: - -/* Line 1455 of yacc.c */ -#line 1552 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 43: - -/* Line 1455 of yacc.c */ -#line 1553 "vtkParse.y" - { (yyval.integer) = 1; } - break; - - case 44: - -/* Line 1455 of yacc.c */ -#line 1554 "vtkParse.y" - { (yyval.integer) = 2; } - break; - - case 46: - -/* Line 1455 of yacc.c */ -#line 1558 "vtkParse.y" - { - startSig(); - clearType(); - clearTypeId(); - clearTemplate(); - closeComment(); - } - break; - - case 49: - -/* Line 1455 of yacc.c */ -#line 1570 "vtkParse.y" - { access_level = VTK_ACCESS_PUBLIC; } - break; - - case 50: - -/* Line 1455 of yacc.c */ -#line 1571 "vtkParse.y" - { access_level = VTK_ACCESS_PRIVATE; } - break; - - case 51: - -/* Line 1455 of yacc.c */ -#line 1572 "vtkParse.y" - { access_level = VTK_ACCESS_PROTECTED; } - break; - - case 70: - -/* Line 1455 of yacc.c */ -#line 1597 "vtkParse.y" - { output_friend_function(); } - break; - - case 76: - -/* Line 1455 of yacc.c */ -#line 1611 "vtkParse.y" - { add_base_class(currentClass, (yyvsp[(1) - (1)].str), access_level, 0); } - break; - - case 77: - -/* Line 1455 of yacc.c */ -#line 1613 "vtkParse.y" - { add_base_class(currentClass, (yyvsp[(3) - (3)].str), (yyvsp[(2) - (3)].integer), 1); } - break; - - case 78: - -/* Line 1455 of yacc.c */ -#line 1615 "vtkParse.y" - { add_base_class(currentClass, (yyvsp[(3) - (3)].str), (yyvsp[(1) - (3)].integer), (yyvsp[(2) - (3)].integer)); } - break; - - case 79: - -/* Line 1455 of yacc.c */ -#line 1618 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 80: - -/* Line 1455 of yacc.c */ -#line 1619 "vtkParse.y" - { (yyval.integer) = 1; } - break; - - case 81: - -/* Line 1455 of yacc.c */ -#line 1622 "vtkParse.y" - { (yyval.integer) = access_level; } - break; - - case 83: - -/* Line 1455 of yacc.c */ -#line 1626 "vtkParse.y" - { (yyval.integer) = VTK_ACCESS_PUBLIC; } - break; - - case 84: - -/* Line 1455 of yacc.c */ -#line 1627 "vtkParse.y" - { (yyval.integer) = VTK_ACCESS_PRIVATE; } - break; - - case 85: - -/* Line 1455 of yacc.c */ -#line 1628 "vtkParse.y" - { (yyval.integer) = VTK_ACCESS_PROTECTED; } - break; - - case 88: - -/* Line 1455 of yacc.c */ -#line 1644 "vtkParse.y" - { pushType(); start_enum((yyvsp[(1) - (2)].str)); } - break; - - case 89: - -/* Line 1455 of yacc.c */ -#line 1645 "vtkParse.y" - { - popType(); - clearTypeId(); - if ((yyvsp[(1) - (5)].str) != NULL) - { - setTypeId((yyvsp[(1) - (5)].str)); - setTypeBase(guess_id_type((yyvsp[(1) - (5)].str))); - } - end_enum(); - } - break; - - case 90: - -/* Line 1455 of yacc.c */ -#line 1657 "vtkParse.y" - { (yyval.str) = (yyvsp[(2) - (2)].str); } - break; - - case 91: - -/* Line 1455 of yacc.c */ -#line 1658 "vtkParse.y" - { (yyval.str) = NULL; } - break; - - case 97: - -/* Line 1455 of yacc.c */ -#line 1669 "vtkParse.y" - { add_enum((yyvsp[(1) - (1)].str), NULL); } - break; - - case 98: - -/* Line 1455 of yacc.c */ -#line 1670 "vtkParse.y" - { postSig("="); markSig(); } - break; - - case 99: - -/* Line 1455 of yacc.c */ -#line 1671 "vtkParse.y" - { chopSig(); add_enum((yyvsp[(1) - (4)].str), copySig()); } - break; - - case 120: - -/* Line 1455 of yacc.c */ -#line 1724 "vtkParse.y" - { pushFunction(); postSig("("); } - break; - - case 121: - -/* Line 1455 of yacc.c */ -#line 1725 "vtkParse.y" - { postSig(")"); } - break; - - case 122: - -/* Line 1455 of yacc.c */ -#line 1726 "vtkParse.y" - { (yyval.integer) = VTK_PARSE_FUNCTION; popFunction(); } - break; - - case 123: - -/* Line 1455 of yacc.c */ -#line 1730 "vtkParse.y" - { - ValueInfo *item = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(item); - item->ItemType = VTK_TYPEDEF_INFO; - item->Access = access_level; - - handle_complex_type(item, getType(), (yyvsp[(1) - (1)].integer), getSig()); - - if (getVarName()) - { - item->Name = getVarName(); - } - - if (item->Class == NULL) - { - vtkParse_FreeValue(item); - } - else if (currentClass) - { - vtkParse_AddTypedefToClass(currentClass, item); - } - else - { - vtkParse_AddTypedefToNamespace(currentNamespace, item); - } - } - break; - - case 124: - -/* Line 1455 of yacc.c */ -#line 1763 "vtkParse.y" - { add_using((yyvsp[(2) - (3)].str), 0); } - break; - - case 126: - -/* Line 1455 of yacc.c */ -#line 1767 "vtkParse.y" - { (yyval.str) = (yyvsp[(2) - (2)].str); } - break; - - case 127: - -/* Line 1455 of yacc.c */ -#line 1769 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 128: - -/* Line 1455 of yacc.c */ -#line 1771 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 129: - -/* Line 1455 of yacc.c */ -#line 1773 "vtkParse.y" - { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } - break; - - case 130: - -/* Line 1455 of yacc.c */ -#line 1775 "vtkParse.y" - { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } - break; - - case 131: - -/* Line 1455 of yacc.c */ -#line 1778 "vtkParse.y" - { add_using((yyvsp[(3) - (4)].str), 1); } - break; - - case 132: - -/* Line 1455 of yacc.c */ -#line 1786 "vtkParse.y" - { postSig("template<> "); clearTypeId(); } - break; - - case 133: - -/* Line 1455 of yacc.c */ -#line 1788 "vtkParse.y" - { - postSig("template<"); - pushType(); - clearType(); - clearTypeId(); - startTemplate(); - } - break; - - case 134: - -/* Line 1455 of yacc.c */ -#line 1796 "vtkParse.y" - { - chopSig(); - if (getSig()[getSigLength()-1] == '>') { postSig(" "); } - postSig("> "); - clearTypeId(); - popType(); - } - break; - - case 136: - -/* Line 1455 of yacc.c */ -#line 1807 "vtkParse.y" - { chopSig(); postSig(", "); clearType(); clearTypeId(); } - break; - - case 138: - -/* Line 1455 of yacc.c */ -#line 1811 "vtkParse.y" - { markSig(); } - break; - - case 139: - -/* Line 1455 of yacc.c */ -#line 1813 "vtkParse.y" - { add_template_parameter(getType(), (yyvsp[(3) - (3)].integer), copySig()); } - break; - - case 141: - -/* Line 1455 of yacc.c */ -#line 1815 "vtkParse.y" - { markSig(); } - break; - - case 142: - -/* Line 1455 of yacc.c */ -#line 1817 "vtkParse.y" - { add_template_parameter(0, (yyvsp[(3) - (3)].integer), copySig()); } - break; - - case 144: - -/* Line 1455 of yacc.c */ -#line 1819 "vtkParse.y" - { pushTemplate(); markSig(); } - break; - - case 145: - -/* Line 1455 of yacc.c */ -#line 1820 "vtkParse.y" - { postSig("class "); } - break; - - case 146: - -/* Line 1455 of yacc.c */ -#line 1822 "vtkParse.y" - { - int i; - TemplateInfo *newTemplate = currentTemplate; - popTemplate(); - add_template_parameter(0, (yyvsp[(5) - (5)].integer), copySig()); - i = currentTemplate->NumberOfParameters-1; - currentTemplate->Parameters[i]->Template = newTemplate; - } - break; - - case 148: - -/* Line 1455 of yacc.c */ -#line 1833 "vtkParse.y" - { postSig("class "); } - break; - - case 149: - -/* Line 1455 of yacc.c */ -#line 1834 "vtkParse.y" - { postSig("typename "); } - break; - - case 152: - -/* Line 1455 of yacc.c */ -#line 1840 "vtkParse.y" - { postSig("="); markSig(); } - break; - - case 153: - -/* Line 1455 of yacc.c */ -#line 1842 "vtkParse.y" - { - int i = currentTemplate->NumberOfParameters-1; - ValueInfo *param = currentTemplate->Parameters[i]; - chopSig(); - param->Value = copySig(); - } - break; - - case 156: - -/* Line 1455 of yacc.c */ -#line 1859 "vtkParse.y" - { output_function(); } - break; - - case 157: - -/* Line 1455 of yacc.c */ -#line 1860 "vtkParse.y" - { output_function(); } - break; - - case 158: - -/* Line 1455 of yacc.c */ -#line 1861 "vtkParse.y" - { reject_function(); } - break; - - case 159: - -/* Line 1455 of yacc.c */ -#line 1862 "vtkParse.y" - { reject_function(); } - break; - - case 167: - -/* Line 1455 of yacc.c */ -#line 1878 "vtkParse.y" - { output_function(); } - break; - - case 177: - -/* Line 1455 of yacc.c */ -#line 1895 "vtkParse.y" - { - postSig("("); - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 178: - -/* Line 1455 of yacc.c */ -#line 1899 "vtkParse.y" - { postSig(")"); } - break; - - case 179: - -/* Line 1455 of yacc.c */ -#line 1901 "vtkParse.y" - { - postSig(";"); - closeSig(); - currentFunction->IsOperator = 1; - currentFunction->Name = "operator typecast"; - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed operator", "operator typecast"); - } - break; - - case 180: - -/* Line 1455 of yacc.c */ -#line 1912 "vtkParse.y" - { (yyval.str) = copySig(); } - break; - - case 181: - -/* Line 1455 of yacc.c */ -#line 1915 "vtkParse.y" - { postSig(")"); } - break; - - case 182: - -/* Line 1455 of yacc.c */ -#line 1916 "vtkParse.y" - { - postSig(";"); - closeSig(); - currentFunction->Name = (yyvsp[(1) - (3)].str); - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed operator", currentFunction->Name); - } - break; - - case 183: - -/* Line 1455 of yacc.c */ -#line 1926 "vtkParse.y" - { - postSig("("); - currentFunction->IsOperator = 1; - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 185: - -/* Line 1455 of yacc.c */ -#line 1935 "vtkParse.y" - { chopSig(); (yyval.str) = vtkstrcat(copySig(), (yyvsp[(2) - (2)].str)); postSig((yyvsp[(2) - (2)].str)); } - break; - - case 186: - -/* Line 1455 of yacc.c */ -#line 1938 "vtkParse.y" - { markSig(); postSig("operator "); } - break; - - case 187: - -/* Line 1455 of yacc.c */ -#line 1942 "vtkParse.y" - { - postSig(";"); - closeSig(); - currentFunction->Name = (yyvsp[(1) - (2)].str); - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed func", currentFunction->Name); - } - break; - - case 190: - -/* Line 1455 of yacc.c */ -#line 1954 "vtkParse.y" - { postSig(" throw "); } - break; - - case 191: - -/* Line 1455 of yacc.c */ -#line 1954 "vtkParse.y" - { chopSig(); } - break; - - case 192: - -/* Line 1455 of yacc.c */ -#line 1955 "vtkParse.y" - { postSig(" const"); currentFunction->IsConst = 1; } - break; - - case 193: - -/* Line 1455 of yacc.c */ -#line 1957 "vtkParse.y" - { - postSig(" = 0"); - currentFunction->IsPureVirtual = 1; - if (currentClass) { currentClass->IsAbstract = 1; } - } - break; - - case 196: - -/* Line 1455 of yacc.c */ -#line 1969 "vtkParse.y" - { - postSig("("); - set_return(currentFunction, getType(), getTypeId(), 0); - } - break; - - case 197: - -/* Line 1455 of yacc.c */ -#line 1973 "vtkParse.y" - { postSig(")"); } - break; - - case 200: - -/* Line 1455 of yacc.c */ -#line 1985 "vtkParse.y" - { closeSig(); } - break; - - case 201: - -/* Line 1455 of yacc.c */ -#line 1986 "vtkParse.y" - { openSig(); } - break; - - case 202: - -/* Line 1455 of yacc.c */ -#line 1987 "vtkParse.y" - { - postSig(";"); - closeSig(); - if (getType() & VTK_PARSE_VIRTUAL) - { - currentFunction->IsVirtual = 1; - } - if (getType() & VTK_PARSE_EXPLICIT) - { - currentFunction->IsExplicit = 1; - } - currentFunction->Name = (yyvsp[(1) - (5)].str); - currentFunction->Comment = vtkstrdup(getComment()); - vtkParseDebug("Parsed func", currentFunction->Name); - } - break; - - case 203: - -/* Line 1455 of yacc.c */ -#line 2004 "vtkParse.y" - { pushType(); postSig("("); } - break; - - case 204: - -/* Line 1455 of yacc.c */ -#line 2005 "vtkParse.y" - { popType(); postSig(")"); } - break; - - case 211: - -/* Line 1455 of yacc.c */ -#line 2022 "vtkParse.y" - { clearType(); clearTypeId(); } - break; - - case 213: - -/* Line 1455 of yacc.c */ -#line 2025 "vtkParse.y" - { clearType(); clearTypeId(); } - break; - - case 214: - -/* Line 1455 of yacc.c */ -#line 2026 "vtkParse.y" - { clearType(); clearTypeId(); postSig(", "); } - break; - - case 216: - -/* Line 1455 of yacc.c */ -#line 2029 "vtkParse.y" - { currentFunction->IsVariadic = 1; postSig(", ..."); } - break; - - case 217: - -/* Line 1455 of yacc.c */ -#line 2032 "vtkParse.y" - { markSig(); } - break; - - case 218: - -/* Line 1455 of yacc.c */ -#line 2034 "vtkParse.y" - { - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - - handle_complex_type(param, getType(), (yyvsp[(3) - (3)].integer), copySig()); - add_legacy_parameter(currentFunction, param); - - if (getVarName()) - { - param->Name = getVarName(); - } - - vtkParse_AddParameterToFunction(currentFunction, param); - } - break; - - case 219: - -/* Line 1455 of yacc.c */ -#line 2049 "vtkParse.y" - { - int i = currentFunction->NumberOfParameters-1; - if (getVarValue()) - { - currentFunction->Parameters[i]->Value = getVarValue(); - } - } - break; - - case 220: - -/* Line 1455 of yacc.c */ -#line 2058 "vtkParse.y" - { clearVarValue(); } - break; - - case 222: - -/* Line 1455 of yacc.c */ -#line 2062 "vtkParse.y" - { postSig("="); clearVarValue(); markSig(); } - break; - - case 223: - -/* Line 1455 of yacc.c */ -#line 2063 "vtkParse.y" - { chopSig(); setVarValue(copySig()); } - break; - - case 225: - -/* Line 1455 of yacc.c */ -#line 2074 "vtkParse.y" - { - unsigned int type = getType(); - ValueInfo *var = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(var); - var->ItemType = VTK_VARIABLE_INFO; - var->Access = access_level; - - handle_complex_type(var, type, (yyvsp[(1) - (2)].integer), getSig()); - - var->Name = getVarName(); - - if (getVarValue()) - { - var->Value = getVarValue(); - } - - /* Is this a typedef? */ - if ((type & VTK_PARSE_TYPEDEF) != 0) - { - var->ItemType = VTK_TYPEDEF_INFO; - if (currentClass) - { - vtkParse_AddVariableToClass(currentClass, var); - } - else - { - vtkParse_AddVariableToNamespace(currentNamespace, var); - } - } - /* Is this a constant? */ - else if (((type & VTK_PARSE_CONST) != 0) && var->Value != NULL && - (((type & VTK_PARSE_INDIRECT) == 0) || - ((type & VTK_PARSE_INDIRECT) == VTK_PARSE_ARRAY))) - { - var->ItemType = VTK_CONSTANT_INFO; - if (currentClass) - { - vtkParse_AddConstantToClass(currentClass, var); - } - else - { - vtkParse_AddConstantToNamespace(currentNamespace, var); - } - } - /* This is a true variable i.e. not constant */ - else - { - if (currentClass) - { - vtkParse_AddVariableToClass(currentClass, var); - } - else - { - vtkParse_AddVariableToNamespace(currentNamespace, var); - } - } - } - break; - - case 229: - -/* Line 1455 of yacc.c */ -#line 2136 "vtkParse.y" - { postSig(", "); } - break; - - case 232: - -/* Line 1455 of yacc.c */ -#line 2142 "vtkParse.y" - { setTypePtr(0); } - break; - - case 233: - -/* Line 1455 of yacc.c */ -#line 2143 "vtkParse.y" - { setTypePtr((yyvsp[(1) - (1)].integer)); } - break; - - case 234: - -/* Line 1455 of yacc.c */ -#line 2147 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 235: - -/* Line 1455 of yacc.c */ -#line 2148 "vtkParse.y" - { postSig(")"); } - break; - - case 236: - -/* Line 1455 of yacc.c */ -#line 2150 "vtkParse.y" - { - const char *scope = getScope(); - unsigned int parens = add_indirection((yyvsp[(1) - (5)].integer), (yyvsp[(2) - (5)].integer)); - if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_FUNCTION) - { - if (scope) { scope = vtkstrndup(scope, strlen(scope) - 2); } - getFunction()->Class = scope; - (yyval.integer) = (parens | VTK_PARSE_FUNCTION); - } - else if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_ARRAY) - { - (yyval.integer) = add_indirection_to_array(parens); - } - } - break; - - case 237: - -/* Line 1455 of yacc.c */ -#line 2167 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 238: - -/* Line 1455 of yacc.c */ -#line 2168 "vtkParse.y" - { postSig(")"); } - break; - - case 239: - -/* Line 1455 of yacc.c */ -#line 2170 "vtkParse.y" - { - const char *scope = getScope(); - unsigned int parens = add_indirection((yyvsp[(1) - (5)].integer), (yyvsp[(2) - (5)].integer)); - if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_FUNCTION) - { - if (scope) { scope = vtkstrndup(scope, strlen(scope) - 2); } - getFunction()->Class = scope; - (yyval.integer) = (parens | VTK_PARSE_FUNCTION); - } - else if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_ARRAY) - { - (yyval.integer) = add_indirection_to_array(parens); - } - } - break; - - case 240: - -/* Line 1455 of yacc.c */ -#line 2186 "vtkParse.y" - { postSig("("); scopeSig(""); (yyval.integer) = 0; } - break; - - case 241: - -/* Line 1455 of yacc.c */ -#line 2187 "vtkParse.y" - { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("*"); - (yyval.integer) = VTK_PARSE_POINTER; } - break; - - case 242: - -/* Line 1455 of yacc.c */ -#line 2189 "vtkParse.y" - { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("&"); - (yyval.integer) = VTK_PARSE_REF; } - break; - - case 243: - -/* Line 1455 of yacc.c */ -#line 2193 "vtkParse.y" - { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("*"); - (yyval.integer) = VTK_PARSE_POINTER; } - break; - - case 244: - -/* Line 1455 of yacc.c */ -#line 2195 "vtkParse.y" - { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("&"); - (yyval.integer) = VTK_PARSE_REF; } - break; - - case 245: - -/* Line 1455 of yacc.c */ -#line 2198 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 246: - -/* Line 1455 of yacc.c */ -#line 2199 "vtkParse.y" - { pushFunction(); postSig("("); } - break; - - case 247: - -/* Line 1455 of yacc.c */ -#line 2200 "vtkParse.y" - { postSig(")"); } - break; - - case 248: - -/* Line 1455 of yacc.c */ -#line 2201 "vtkParse.y" - { - (yyval.integer) = VTK_PARSE_FUNCTION; - popFunction(); - } - break; - - case 249: - -/* Line 1455 of yacc.c */ -#line 2205 "vtkParse.y" - { (yyval.integer) = VTK_PARSE_ARRAY; } - break; - - case 252: - -/* Line 1455 of yacc.c */ -#line 2209 "vtkParse.y" - { currentFunction->IsConst = 1; } - break; - - case 255: - -/* Line 1455 of yacc.c */ -#line 2215 "vtkParse.y" - { (yyval.integer) = add_indirection((yyvsp[(1) - (2)].integer), (yyvsp[(2) - (2)].integer)); } - break; - - case 257: - -/* Line 1455 of yacc.c */ -#line 2220 "vtkParse.y" - { (yyval.integer) = add_indirection((yyvsp[(1) - (2)].integer), (yyvsp[(2) - (2)].integer)); } - break; - - case 258: - -/* Line 1455 of yacc.c */ -#line 2223 "vtkParse.y" - { clearVarName(); chopSig(); } - break; - - case 260: - -/* Line 1455 of yacc.c */ -#line 2227 "vtkParse.y" - { setVarName((yyvsp[(1) - (1)].str)); } - break; - - case 261: - -/* Line 1455 of yacc.c */ -#line 2228 "vtkParse.y" - { setVarName((yyvsp[(1) - (3)].str)); } - break; - - case 265: - -/* Line 1455 of yacc.c */ -#line 2236 "vtkParse.y" - { clearArray(); } - break; - - case 267: - -/* Line 1455 of yacc.c */ -#line 2240 "vtkParse.y" - { clearArray(); } - break; - - case 271: - -/* Line 1455 of yacc.c */ -#line 2247 "vtkParse.y" - { postSig("["); } - break; - - case 272: - -/* Line 1455 of yacc.c */ -#line 2247 "vtkParse.y" - { postSig("]"); } - break; - - case 273: - -/* Line 1455 of yacc.c */ -#line 2250 "vtkParse.y" - { pushArraySize(""); } - break; - - case 274: - -/* Line 1455 of yacc.c */ -#line 2251 "vtkParse.y" - { markSig(); } - break; - - case 275: - -/* Line 1455 of yacc.c */ -#line 2251 "vtkParse.y" - { chopSig(); pushArraySize(copySig()); } - break; - - case 280: - -/* Line 1455 of yacc.c */ -#line 2267 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 281: - -/* Line 1455 of yacc.c */ -#line 2269 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 282: - -/* Line 1455 of yacc.c */ -#line 2271 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 283: - -/* Line 1455 of yacc.c */ -#line 2275 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 284: - -/* Line 1455 of yacc.c */ -#line 2277 "vtkParse.y" - { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } - break; - - case 285: - -/* Line 1455 of yacc.c */ -#line 2279 "vtkParse.y" - { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } - break; - - case 286: - -/* Line 1455 of yacc.c */ -#line 2281 "vtkParse.y" - { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } - break; - - case 287: - -/* Line 1455 of yacc.c */ -#line 2282 "vtkParse.y" - { postSig("template "); } - break; - - case 288: - -/* Line 1455 of yacc.c */ -#line 2284 "vtkParse.y" - { (yyval.str) = vtkstrcat4((yyvsp[(1) - (5)].str), "template ", (yyvsp[(4) - (5)].str), (yyvsp[(5) - (5)].str)); } - break; - - case 289: - -/* Line 1455 of yacc.c */ -#line 2287 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 290: - -/* Line 1455 of yacc.c */ -#line 2290 "vtkParse.y" - { (yyval.str) = "::"; postSig((yyval.str)); } - break; - - case 291: - -/* Line 1455 of yacc.c */ -#line 2293 "vtkParse.y" - { markSig(); postSig((yyvsp[(1) - (2)].str)); postSig("<"); } - break; - - case 292: - -/* Line 1455 of yacc.c */ -#line 2295 "vtkParse.y" - { - chopSig(); if (getSig()[getSigLength()-1] == '>') { postSig(" "); } - postSig(">"); (yyval.str) = copySig(); clearTypeId(); - } - break; - - case 293: - -/* Line 1455 of yacc.c */ -#line 2308 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 294: - -/* Line 1455 of yacc.c */ -#line 2309 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 295: - -/* Line 1455 of yacc.c */ -#line 2310 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 296: - -/* Line 1455 of yacc.c */ -#line 2311 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 297: - -/* Line 1455 of yacc.c */ -#line 2312 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 298: - -/* Line 1455 of yacc.c */ -#line 2313 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 299: - -/* Line 1455 of yacc.c */ -#line 2314 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); } - break; - - case 300: - -/* Line 1455 of yacc.c */ -#line 2315 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 301: - -/* Line 1455 of yacc.c */ -#line 2316 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 302: - -/* Line 1455 of yacc.c */ -#line 2317 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 303: - -/* Line 1455 of yacc.c */ -#line 2318 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 304: - -/* Line 1455 of yacc.c */ -#line 2319 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 305: - -/* Line 1455 of yacc.c */ -#line 2320 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 306: - -/* Line 1455 of yacc.c */ -#line 2321 "vtkParse.y" - { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } - break; - - case 307: - -/* Line 1455 of yacc.c */ -#line 2322 "vtkParse.y" - { (yyval.str) = "size_t"; postSig((yyval.str)); } - break; - - case 308: - -/* Line 1455 of yacc.c */ -#line 2323 "vtkParse.y" - { (yyval.str) = "ssize_t"; postSig((yyval.str)); } - break; - - case 309: - -/* Line 1455 of yacc.c */ -#line 2324 "vtkParse.y" - { (yyval.str) = "vtkTypeInt8"; postSig((yyval.str)); } - break; - - case 310: - -/* Line 1455 of yacc.c */ -#line 2325 "vtkParse.y" - { (yyval.str) = "vtkTypeUInt8"; postSig((yyval.str)); } - break; - - case 311: - -/* Line 1455 of yacc.c */ -#line 2326 "vtkParse.y" - { (yyval.str) = "vtkTypeInt16"; postSig((yyval.str)); } - break; - - case 312: - -/* Line 1455 of yacc.c */ -#line 2327 "vtkParse.y" - { (yyval.str) = "vtkTypeUInt16"; postSig((yyval.str)); } - break; - - case 313: - -/* Line 1455 of yacc.c */ -#line 2328 "vtkParse.y" - { (yyval.str) = "vtkTypeInt32"; postSig((yyval.str)); } - break; - - case 314: - -/* Line 1455 of yacc.c */ -#line 2329 "vtkParse.y" - { (yyval.str) = "vtkTypeUInt32"; postSig((yyval.str)); } - break; - - case 315: - -/* Line 1455 of yacc.c */ -#line 2330 "vtkParse.y" - { (yyval.str) = "vtkTypeInt64"; postSig((yyval.str)); } - break; - - case 316: - -/* Line 1455 of yacc.c */ -#line 2331 "vtkParse.y" - { (yyval.str) = "vtkTypeUInt64"; postSig((yyval.str)); } - break; - - case 317: - -/* Line 1455 of yacc.c */ -#line 2332 "vtkParse.y" - { (yyval.str) = "vtkTypeFloat32"; postSig((yyval.str)); } - break; - - case 318: - -/* Line 1455 of yacc.c */ -#line 2333 "vtkParse.y" - { (yyval.str) = "vtkTypeFloat64"; postSig((yyval.str)); } - break; - - case 319: - -/* Line 1455 of yacc.c */ -#line 2334 "vtkParse.y" - { (yyval.str) = "vtkIdType"; postSig((yyval.str)); } - break; - - case 330: - -/* Line 1455 of yacc.c */ -#line 2360 "vtkParse.y" - { setTypeBase(buildTypeBase(getType(), (yyvsp[(1) - (1)].integer))); } - break; - - case 331: - -/* Line 1455 of yacc.c */ -#line 2361 "vtkParse.y" - { setTypeMod(VTK_PARSE_TYPEDEF); } - break; - - case 332: - -/* Line 1455 of yacc.c */ -#line 2362 "vtkParse.y" - { setTypeMod(VTK_PARSE_FRIEND); } - break; - - case 335: - -/* Line 1455 of yacc.c */ -#line 2369 "vtkParse.y" - { setTypeMod((yyvsp[(1) - (1)].integer)); } - break; - - case 336: - -/* Line 1455 of yacc.c */ -#line 2370 "vtkParse.y" - { setTypeMod((yyvsp[(1) - (1)].integer)); } - break; - - case 337: - -/* Line 1455 of yacc.c */ -#line 2371 "vtkParse.y" - { setTypeMod((yyvsp[(1) - (1)].integer)); } - break; - - case 338: - -/* Line 1455 of yacc.c */ -#line 2374 "vtkParse.y" - { postSig("mutable "); (yyval.integer) = VTK_PARSE_MUTABLE; } - break; - - case 339: - -/* Line 1455 of yacc.c */ -#line 2375 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 340: - -/* Line 1455 of yacc.c */ -#line 2376 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 341: - -/* Line 1455 of yacc.c */ -#line 2377 "vtkParse.y" - { postSig("static "); (yyval.integer) = VTK_PARSE_STATIC; } - break; - - case 342: - -/* Line 1455 of yacc.c */ -#line 2380 "vtkParse.y" - { (yyval.integer) = 0; } - break; - - case 343: - -/* Line 1455 of yacc.c */ -#line 2381 "vtkParse.y" - { postSig("virtual "); (yyval.integer) = VTK_PARSE_VIRTUAL; } - break; - - case 344: - -/* Line 1455 of yacc.c */ -#line 2382 "vtkParse.y" - { postSig("explicit "); (yyval.integer) = VTK_PARSE_EXPLICIT; } - break; - - case 345: - -/* Line 1455 of yacc.c */ -#line 2385 "vtkParse.y" - { postSig("const "); (yyval.integer) = VTK_PARSE_CONST; } - break; - - case 346: - -/* Line 1455 of yacc.c */ -#line 2386 "vtkParse.y" - { postSig("volatile "); (yyval.integer) = VTK_PARSE_VOLATILE; } - break; - - case 348: - -/* Line 1455 of yacc.c */ -#line 2391 "vtkParse.y" - { (yyval.integer) = ((yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer)); } - break; - - case 350: - -/* Line 1455 of yacc.c */ -#line 2402 "vtkParse.y" - { setTypeBase((yyvsp[(1) - (1)].integer)); } - break; - - case 352: - -/* Line 1455 of yacc.c */ -#line 2404 "vtkParse.y" - { setTypeBase((yyvsp[(2) - (2)].integer)); } - break; - - case 355: - -/* Line 1455 of yacc.c */ -#line 2409 "vtkParse.y" - { postSig("typename "); } - break; - - case 356: - -/* Line 1455 of yacc.c */ -#line 2410 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(3) - (3)].str)); (yyval.integer) = guess_id_type((yyvsp[(3) - (3)].str)); } - break; - - case 357: - -/* Line 1455 of yacc.c */ -#line 2412 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } - break; - - case 358: - -/* Line 1455 of yacc.c */ -#line 2414 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } - break; - - case 359: - -/* Line 1455 of yacc.c */ -#line 2416 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } - break; - - case 360: - -/* Line 1455 of yacc.c */ -#line 2418 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } - break; - - case 362: - -/* Line 1455 of yacc.c */ -#line 2424 "vtkParse.y" - { setTypeBase((yyvsp[(1) - (1)].integer)); } - break; - - case 364: - -/* Line 1455 of yacc.c */ -#line 2426 "vtkParse.y" - { setTypeBase((yyvsp[(2) - (2)].integer)); } - break; - - case 367: - -/* Line 1455 of yacc.c */ -#line 2432 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } - break; - - case 368: - -/* Line 1455 of yacc.c */ -#line 2434 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } - break; - - case 369: - -/* Line 1455 of yacc.c */ -#line 2436 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } - break; - - case 370: - -/* Line 1455 of yacc.c */ -#line 2438 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } - break; - - case 371: - -/* Line 1455 of yacc.c */ -#line 2440 "vtkParse.y" - { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } - break; - - case 372: - -/* Line 1455 of yacc.c */ -#line 2443 "vtkParse.y" - { setTypeId(""); } - break; - - case 374: - -/* Line 1455 of yacc.c */ -#line 2447 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_STRING; } - break; - - case 375: - -/* Line 1455 of yacc.c */ -#line 2448 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_UNICODE_STRING;} - break; - - case 376: - -/* Line 1455 of yacc.c */ -#line 2449 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_OSTREAM; } - break; - - case 377: - -/* Line 1455 of yacc.c */ -#line 2450 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_ISTREAM; } - break; - - case 378: - -/* Line 1455 of yacc.c */ -#line 2451 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_UNKNOWN; } - break; - - case 379: - -/* Line 1455 of yacc.c */ -#line 2452 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_OBJECT; } - break; - - case 380: - -/* Line 1455 of yacc.c */ -#line 2453 "vtkParse.y" - { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_QOBJECT; } - break; - - case 381: - -/* Line 1455 of yacc.c */ -#line 2454 "vtkParse.y" - { typeSig("ssize_t"); (yyval.integer) = VTK_PARSE_SSIZE_T; } - break; - - case 382: - -/* Line 1455 of yacc.c */ -#line 2455 "vtkParse.y" - { typeSig("size_t"); (yyval.integer) = VTK_PARSE_SIZE_T; } - break; - - case 383: - -/* Line 1455 of yacc.c */ -#line 2456 "vtkParse.y" - { typeSig("vtkTypeInt8"); (yyval.integer) = VTK_PARSE_INT8; } - break; - - case 384: - -/* Line 1455 of yacc.c */ -#line 2457 "vtkParse.y" - { typeSig("vtkTypeUInt8"); (yyval.integer) = VTK_PARSE_UINT8; } - break; - - case 385: - -/* Line 1455 of yacc.c */ -#line 2458 "vtkParse.y" - { typeSig("vtkTypeInt16"); (yyval.integer) = VTK_PARSE_INT16; } - break; - - case 386: - -/* Line 1455 of yacc.c */ -#line 2459 "vtkParse.y" - { typeSig("vtkTypeUInt16"); (yyval.integer) = VTK_PARSE_UINT16; } - break; - - case 387: - -/* Line 1455 of yacc.c */ -#line 2460 "vtkParse.y" - { typeSig("vtkTypeInt32"); (yyval.integer) = VTK_PARSE_INT32; } - break; - - case 388: - -/* Line 1455 of yacc.c */ -#line 2461 "vtkParse.y" - { typeSig("vtkTypeUInt32"); (yyval.integer) = VTK_PARSE_UINT32; } - break; - - case 389: - -/* Line 1455 of yacc.c */ -#line 2462 "vtkParse.y" - { typeSig("vtkTypeInt64"); (yyval.integer) = VTK_PARSE_INT64; } - break; - - case 390: - -/* Line 1455 of yacc.c */ -#line 2463 "vtkParse.y" - { typeSig("vtkTypeUInt64"); (yyval.integer) = VTK_PARSE_UINT64; } - break; - - case 391: - -/* Line 1455 of yacc.c */ -#line 2464 "vtkParse.y" - { typeSig("vtkTypeFloat32"); (yyval.integer) = VTK_PARSE_FLOAT32; } - break; - - case 392: - -/* Line 1455 of yacc.c */ -#line 2465 "vtkParse.y" - { typeSig("vtkTypeFloat64"); (yyval.integer) = VTK_PARSE_FLOAT64; } - break; - - case 393: - -/* Line 1455 of yacc.c */ -#line 2466 "vtkParse.y" - { typeSig("vtkIdType"); (yyval.integer) = VTK_PARSE_ID_TYPE; } - break; - - case 394: - -/* Line 1455 of yacc.c */ -#line 2469 "vtkParse.y" - { postSig("void "); (yyval.integer) = VTK_PARSE_VOID; } - break; - - case 395: - -/* Line 1455 of yacc.c */ -#line 2470 "vtkParse.y" - { postSig("bool "); (yyval.integer) = VTK_PARSE_BOOL; } - break; - - case 396: - -/* Line 1455 of yacc.c */ -#line 2471 "vtkParse.y" - { postSig("float "); (yyval.integer) = VTK_PARSE_FLOAT; } - break; - - case 397: - -/* Line 1455 of yacc.c */ -#line 2472 "vtkParse.y" - { postSig("double "); (yyval.integer) = VTK_PARSE_DOUBLE; } - break; - - case 398: - -/* Line 1455 of yacc.c */ -#line 2473 "vtkParse.y" - { postSig("char "); (yyval.integer) = VTK_PARSE_CHAR; } - break; - - case 399: - -/* Line 1455 of yacc.c */ -#line 2474 "vtkParse.y" - { postSig("int "); (yyval.integer) = VTK_PARSE_INT; } - break; - - case 400: - -/* Line 1455 of yacc.c */ -#line 2475 "vtkParse.y" - { postSig("short "); (yyval.integer) = VTK_PARSE_SHORT; } - break; - - case 401: - -/* Line 1455 of yacc.c */ -#line 2476 "vtkParse.y" - { postSig("long "); (yyval.integer) = VTK_PARSE_LONG; } - break; - - case 402: - -/* Line 1455 of yacc.c */ -#line 2477 "vtkParse.y" - { postSig("__int64 "); (yyval.integer) = VTK_PARSE___INT64; } - break; - - case 403: - -/* Line 1455 of yacc.c */ -#line 2478 "vtkParse.y" - { postSig("signed "); (yyval.integer) = VTK_PARSE_INT; } - break; - - case 404: - -/* Line 1455 of yacc.c */ -#line 2479 "vtkParse.y" - { postSig("unsigned "); (yyval.integer) = VTK_PARSE_UNSIGNED_INT; } - break; - - case 407: - -/* Line 1455 of yacc.c */ -#line 2501 "vtkParse.y" - { (yyval.integer) = ((yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer)); } - break; - - case 408: - -/* Line 1455 of yacc.c */ -#line 2504 "vtkParse.y" - { postSig("&"); (yyval.integer) = VTK_PARSE_REF; } - break; - - case 409: - -/* Line 1455 of yacc.c */ -#line 2507 "vtkParse.y" - { postSig("*"); (yyval.integer) = VTK_PARSE_POINTER; } - break; - - case 410: - -/* Line 1455 of yacc.c */ -#line 2508 "vtkParse.y" - { postSig("*"); } - break; - - case 411: - -/* Line 1455 of yacc.c */ -#line 2509 "vtkParse.y" - { - if (((yyvsp[(3) - (3)].integer) & VTK_PARSE_CONST) != 0) - { - (yyval.integer) = VTK_PARSE_CONST_POINTER; - } - if (((yyvsp[(3) - (3)].integer) & VTK_PARSE_VOLATILE) != 0) - { - (yyval.integer) = VTK_PARSE_BAD_INDIRECT; - } - } - break; - - case 413: - -/* Line 1455 of yacc.c */ -#line 2525 "vtkParse.y" - { - unsigned int n; - n = (((yyvsp[(1) - (2)].integer) << 2) | (yyvsp[(2) - (2)].integer)); - if ((n & VTK_PARSE_INDIRECT) != n) - { - n = VTK_PARSE_BAD_INDIRECT; - } - (yyval.integer) = n; - } - break; - - case 414: - -/* Line 1455 of yacc.c */ -#line 2541 "vtkParse.y" - {preSig("void Set"); postSig("(");} - break; - - case 415: - -/* Line 1455 of yacc.c */ -#line 2542 "vtkParse.y" - { - postSig("a);"); - currentFunction->Macro = "vtkSetMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (7)].str)); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, getType(), getTypeId(), 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 416: - -/* Line 1455 of yacc.c */ -#line 2551 "vtkParse.y" - {postSig("Get");} - break; - - case 417: - -/* Line 1455 of yacc.c */ -#line 2552 "vtkParse.y" - {markSig();} - break; - - case 418: - -/* Line 1455 of yacc.c */ -#line 2552 "vtkParse.y" - {swapSig();} - break; - - case 419: - -/* Line 1455 of yacc.c */ -#line 2553 "vtkParse.y" - { - postSig("();"); - currentFunction->Macro = "vtkGetMacro"; - currentFunction->Name = vtkstrcat("Get", (yyvsp[(4) - (9)].str)); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, getType(), getTypeId(), 0); - output_function(); - } - break; - - case 420: - -/* Line 1455 of yacc.c */ -#line 2561 "vtkParse.y" - {preSig("void Set");} - break; - - case 421: - -/* Line 1455 of yacc.c */ -#line 2562 "vtkParse.y" - { - postSig("(char *);"); - currentFunction->Macro = "vtkSetStringMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(4) - (5)].str)); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_CHAR_PTR, "char", 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 422: - -/* Line 1455 of yacc.c */ -#line 2571 "vtkParse.y" - {preSig("char *Get");} - break; - - case 423: - -/* Line 1455 of yacc.c */ -#line 2572 "vtkParse.y" - { - postSig("();"); - currentFunction->Macro = "vtkGetStringMacro"; - currentFunction->Name = vtkstrcat("Get", (yyvsp[(4) - (5)].str)); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_CHAR_PTR, "char", 0); - output_function(); - } - break; - - case 424: - -/* Line 1455 of yacc.c */ -#line 2580 "vtkParse.y" - {startSig(); markSig();} - break; - - case 425: - -/* Line 1455 of yacc.c */ -#line 2580 "vtkParse.y" - {closeSig();} - break; - - case 426: - -/* Line 1455 of yacc.c */ -#line 2582 "vtkParse.y" - { - const char *typeText; - chopSig(); - typeText = copySig(); - - currentFunction->Macro = "vtkSetClampMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (10)].str)); - currentFunction->Signature = - vtkstrcat5("void ", currentFunction->Name, "(", typeText, ");"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, getType(), getTypeId(), 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkSetClampMacro"; - currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (10)].str), "MinValue"); - currentFunction->Signature = - vtkstrcat4(typeText, " ", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, getType(), getTypeId(), 0); - output_function(); - - currentFunction->Macro = "vtkSetClampMacro"; - currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (10)].str), "MaxValue"); - currentFunction->Signature = - vtkstrcat4(typeText, " ", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, getType(), getTypeId(), 0); - output_function(); - } - break; - - case 427: - -/* Line 1455 of yacc.c */ -#line 2613 "vtkParse.y" - {preSig("void Set"); postSig("("); } - break; - - case 428: - -/* Line 1455 of yacc.c */ -#line 2614 "vtkParse.y" - { - postSig("*);"); - currentFunction->Macro = "vtkSetObjectMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (7)].str)); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_OBJECT_PTR, getTypeId(), 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 429: - -/* Line 1455 of yacc.c */ -#line 2623 "vtkParse.y" - {postSig("*Get");} - break; - - case 430: - -/* Line 1455 of yacc.c */ -#line 2624 "vtkParse.y" - {markSig();} - break; - - case 431: - -/* Line 1455 of yacc.c */ -#line 2624 "vtkParse.y" - {swapSig();} - break; - - case 432: - -/* Line 1455 of yacc.c */ -#line 2625 "vtkParse.y" - { - postSig("();"); - currentFunction->Macro = "vtkGetObjectMacro"; - currentFunction->Name = vtkstrcat("Get", (yyvsp[(4) - (9)].str)); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, getTypeId(), 0); - output_function(); - } - break; - - case 433: - -/* Line 1455 of yacc.c */ -#line 2634 "vtkParse.y" - { - currentFunction->Macro = "vtkBooleanMacro"; - currentFunction->Name = vtkstrcat((yyvsp[(3) - (6)].str), "On"); - currentFunction->Comment = vtkstrdup(getComment()); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "();"); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkBooleanMacro"; - currentFunction->Name = vtkstrcat((yyvsp[(3) - (6)].str), "Off"); - currentFunction->Comment = vtkstrdup(getComment()); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "();"); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 434: - -/* Line 1455 of yacc.c */ -#line 2651 "vtkParse.y" - {startSig(); markSig();} - break; - - case 435: - -/* Line 1455 of yacc.c */ -#line 2652 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 2); - } - break; - - case 436: - -/* Line 1455 of yacc.c */ -#line 2656 "vtkParse.y" - {startSig(); markSig();} - break; - - case 437: - -/* Line 1455 of yacc.c */ -#line 2657 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 2); - } - break; - - case 438: - -/* Line 1455 of yacc.c */ -#line 2661 "vtkParse.y" - {startSig(); markSig();} - break; - - case 439: - -/* Line 1455 of yacc.c */ -#line 2662 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 3); - } - break; - - case 440: - -/* Line 1455 of yacc.c */ -#line 2666 "vtkParse.y" - {startSig(); markSig();} - break; - - case 441: - -/* Line 1455 of yacc.c */ -#line 2667 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 3); - } - break; - - case 442: - -/* Line 1455 of yacc.c */ -#line 2671 "vtkParse.y" - {startSig(); markSig();} - break; - - case 443: - -/* Line 1455 of yacc.c */ -#line 2672 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 4); - } - break; - - case 444: - -/* Line 1455 of yacc.c */ -#line 2676 "vtkParse.y" - {startSig(); markSig();} - break; - - case 445: - -/* Line 1455 of yacc.c */ -#line 2677 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 4); - } - break; - - case 446: - -/* Line 1455 of yacc.c */ -#line 2681 "vtkParse.y" - {startSig(); markSig();} - break; - - case 447: - -/* Line 1455 of yacc.c */ -#line 2682 "vtkParse.y" - { - chopSig(); - outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 6); - } - break; - - case 448: - -/* Line 1455 of yacc.c */ -#line 2686 "vtkParse.y" - {startSig(); markSig();} - break; - - case 449: - -/* Line 1455 of yacc.c */ -#line 2687 "vtkParse.y" - { - chopSig(); - outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 6); - } - break; - - case 450: - -/* Line 1455 of yacc.c */ -#line 2691 "vtkParse.y" - {startSig(); markSig();} - break; - - case 451: - -/* Line 1455 of yacc.c */ -#line 2693 "vtkParse.y" - { - const char *typeText; - chopSig(); - typeText = copySig(); - currentFunction->Macro = "vtkSetVectorMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (9)].str)); - currentFunction->Signature = - vtkstrcat7("void ", currentFunction->Name, "(", typeText, - " a[", (yyvsp[(8) - (9)].str), "]);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, (VTK_PARSE_POINTER | getType()), - getTypeId(), (int)strtol((yyvsp[(8) - (9)].str), NULL, 0)); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - } - break; - - case 452: - -/* Line 1455 of yacc.c */ -#line 2708 "vtkParse.y" - {startSig();} - break; - - case 453: - -/* Line 1455 of yacc.c */ -#line 2710 "vtkParse.y" - { - chopSig(); - currentFunction->Macro = "vtkGetVectorMacro"; - currentFunction->Name = vtkstrcat("Get", (yyvsp[(3) - (9)].str)); - postSig(" *"); - postSig(currentFunction->Name); - postSig("();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, (VTK_PARSE_POINTER | getType()), - getTypeId(), (int)strtol((yyvsp[(8) - (9)].str), NULL, 0)); - output_function(); - } - break; - - case 454: - -/* Line 1455 of yacc.c */ -#line 2723 "vtkParse.y" - { - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (4)].str), "Coordinate"); - currentFunction->Signature = - vtkstrcat3("vtkCoordinate *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkCoordinate", 0); - output_function(); - - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double, double);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double a[2]);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 2); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkViewportCoordinateMacro"; - currentFunction->Name = vtkstrcat("Get", (yyvsp[(3) - (4)].str)); - currentFunction->Signature = - vtkstrcat3("double *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 2); - output_function(); - } - break; - - case 455: - -/* Line 1455 of yacc.c */ -#line 2760 "vtkParse.y" - { - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (4)].str), "Coordinate"); - currentFunction->Signature = - vtkstrcat3("vtkCoordinate *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkCoordinate", 0); - output_function(); - - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double, double, double);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); - currentFunction->Signature = - vtkstrcat3("void ", currentFunction->Name, "(double a[3]);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 3); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = "vtkWorldCoordinateMacro"; - currentFunction->Name = vtkstrcat("Get", (yyvsp[(3) - (4)].str)); - currentFunction->Signature = - vtkstrcat3("double *", currentFunction->Name, "();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 3); - output_function(); - } - break; - - case 456: - -/* Line 1455 of yacc.c */ -#line 2798 "vtkParse.y" - { - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "GetClassName"; - currentFunction->Signature = "const char *GetClassName();"; - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, (VTK_PARSE_CONST | VTK_PARSE_CHAR_PTR), - "char", 0); - output_function(); - - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "IsA"; - currentFunction->Signature = "int IsA(const char *name);"; - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, (VTK_PARSE_CONST | VTK_PARSE_CHAR_PTR), - "char", 0); - set_return(currentFunction, VTK_PARSE_INT, "int", 0); - output_function(); - - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "NewInstance"; - currentFunction->Signature = vtkstrcat((yyvsp[(3) - (7)].str), " *NewInstance();"); - currentFunction->Comment = vtkstrdup(getComment()); - set_return(currentFunction, VTK_PARSE_OBJECT_PTR, (yyvsp[(3) - (7)].str), 0); - output_function(); - - currentFunction->Macro = "vtkTypeMacro"; - currentFunction->Name = "SafeDownCast"; - currentFunction->Signature = - vtkstrcat((yyvsp[(3) - (7)].str), " *SafeDownCast(vtkObject* o);"); - currentFunction->Comment = vtkstrdup(getComment()); - add_parameter(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkObject", 0); - set_return(currentFunction, (VTK_PARSE_STATIC | VTK_PARSE_OBJECT_PTR), - (yyvsp[(3) - (7)].str), 0); - output_function(); - } - break; - - case 459: - -/* Line 1455 of yacc.c */ -#line 2842 "vtkParse.y" - { (yyval.str) = "()"; } - break; - - case 460: - -/* Line 1455 of yacc.c */ -#line 2843 "vtkParse.y" - { (yyval.str) = "[]"; } - break; - - case 461: - -/* Line 1455 of yacc.c */ -#line 2844 "vtkParse.y" - { (yyval.str) = " new[]"; } - break; - - case 462: - -/* Line 1455 of yacc.c */ -#line 2845 "vtkParse.y" - { (yyval.str) = " delete[]"; } - break; - - case 463: - -/* Line 1455 of yacc.c */ -#line 2846 "vtkParse.y" - { (yyval.str) = "<"; } - break; - - case 464: - -/* Line 1455 of yacc.c */ -#line 2847 "vtkParse.y" - { (yyval.str) = ">"; } - break; - - case 465: - -/* Line 1455 of yacc.c */ -#line 2848 "vtkParse.y" - { (yyval.str) = ","; } - break; - - case 466: - -/* Line 1455 of yacc.c */ -#line 2849 "vtkParse.y" - { (yyval.str) = "="; } - break; - - case 468: - -/* Line 1455 of yacc.c */ -#line 2853 "vtkParse.y" - { (yyval.str) = "%"; } - break; - - case 469: - -/* Line 1455 of yacc.c */ -#line 2854 "vtkParse.y" - { (yyval.str) = "*"; } - break; - - case 470: - -/* Line 1455 of yacc.c */ -#line 2855 "vtkParse.y" - { (yyval.str) = "/"; } - break; - - case 471: - -/* Line 1455 of yacc.c */ -#line 2856 "vtkParse.y" - { (yyval.str) = "-"; } - break; - - case 472: - -/* Line 1455 of yacc.c */ -#line 2857 "vtkParse.y" - { (yyval.str) = "+"; } - break; - - case 473: - -/* Line 1455 of yacc.c */ -#line 2858 "vtkParse.y" - { (yyval.str) = "!"; } - break; - - case 474: - -/* Line 1455 of yacc.c */ -#line 2859 "vtkParse.y" - { (yyval.str) = "~"; } - break; - - case 475: - -/* Line 1455 of yacc.c */ -#line 2860 "vtkParse.y" - { (yyval.str) = "&"; } - break; - - case 476: - -/* Line 1455 of yacc.c */ -#line 2861 "vtkParse.y" - { (yyval.str) = "|"; } - break; - - case 477: - -/* Line 1455 of yacc.c */ -#line 2862 "vtkParse.y" - { (yyval.str) = "^"; } - break; - - case 478: - -/* Line 1455 of yacc.c */ -#line 2863 "vtkParse.y" - { (yyval.str) = " new"; } - break; - - case 479: - -/* Line 1455 of yacc.c */ -#line 2864 "vtkParse.y" - { (yyval.str) = " delete"; } - break; - - case 480: - -/* Line 1455 of yacc.c */ -#line 2865 "vtkParse.y" - { (yyval.str) = "<<="; } - break; - - case 481: - -/* Line 1455 of yacc.c */ -#line 2866 "vtkParse.y" - { (yyval.str) = ">>="; } - break; - - case 482: - -/* Line 1455 of yacc.c */ -#line 2867 "vtkParse.y" - { (yyval.str) = "<<"; } - break; - - case 483: - -/* Line 1455 of yacc.c */ -#line 2868 "vtkParse.y" - { (yyval.str) = ">>"; } - break; - - case 484: - -/* Line 1455 of yacc.c */ -#line 2869 "vtkParse.y" - { (yyval.str) = ".*"; } - break; - - case 485: - -/* Line 1455 of yacc.c */ -#line 2870 "vtkParse.y" - { (yyval.str) = "->*"; } - break; - - case 486: - -/* Line 1455 of yacc.c */ -#line 2871 "vtkParse.y" - { (yyval.str) = "->"; } - break; - - case 487: - -/* Line 1455 of yacc.c */ -#line 2872 "vtkParse.y" - { (yyval.str) = "+="; } - break; - - case 488: - -/* Line 1455 of yacc.c */ -#line 2873 "vtkParse.y" - { (yyval.str) = "-="; } - break; - - case 489: - -/* Line 1455 of yacc.c */ -#line 2874 "vtkParse.y" - { (yyval.str) = "*="; } - break; - - case 490: - -/* Line 1455 of yacc.c */ -#line 2875 "vtkParse.y" - { (yyval.str) = "/="; } - break; - - case 491: - -/* Line 1455 of yacc.c */ -#line 2876 "vtkParse.y" - { (yyval.str) = "%="; } - break; - - case 492: - -/* Line 1455 of yacc.c */ -#line 2877 "vtkParse.y" - { (yyval.str) = "++"; } - break; - - case 493: - -/* Line 1455 of yacc.c */ -#line 2878 "vtkParse.y" - { (yyval.str) = "--"; } - break; - - case 494: - -/* Line 1455 of yacc.c */ -#line 2879 "vtkParse.y" - { (yyval.str) = "&="; } - break; - - case 495: - -/* Line 1455 of yacc.c */ -#line 2880 "vtkParse.y" - { (yyval.str) = "|="; } - break; - - case 496: - -/* Line 1455 of yacc.c */ -#line 2881 "vtkParse.y" - { (yyval.str) = "^="; } - break; - - case 497: - -/* Line 1455 of yacc.c */ -#line 2882 "vtkParse.y" - { (yyval.str) = "&&"; } - break; - - case 498: - -/* Line 1455 of yacc.c */ -#line 2883 "vtkParse.y" - { (yyval.str) = "||"; } - break; - - case 499: - -/* Line 1455 of yacc.c */ -#line 2884 "vtkParse.y" - { (yyval.str) = "=="; } - break; - - case 500: - -/* Line 1455 of yacc.c */ -#line 2885 "vtkParse.y" - { (yyval.str) = "!="; } - break; - - case 501: - -/* Line 1455 of yacc.c */ -#line 2886 "vtkParse.y" - { (yyval.str) = "<="; } - break; - - case 502: - -/* Line 1455 of yacc.c */ -#line 2887 "vtkParse.y" - { (yyval.str) = ">="; } - break; - - case 503: - -/* Line 1455 of yacc.c */ -#line 2890 "vtkParse.y" - { (yyval.str) = "typedef"; } - break; - - case 504: - -/* Line 1455 of yacc.c */ -#line 2891 "vtkParse.y" - { (yyval.str) = "typename"; } - break; - - case 505: - -/* Line 1455 of yacc.c */ -#line 2892 "vtkParse.y" - { (yyval.str) = "class"; } - break; - - case 506: - -/* Line 1455 of yacc.c */ -#line 2893 "vtkParse.y" - { (yyval.str) = "struct"; } - break; - - case 507: - -/* Line 1455 of yacc.c */ -#line 2894 "vtkParse.y" - { (yyval.str) = "union"; } - break; - - case 508: - -/* Line 1455 of yacc.c */ -#line 2895 "vtkParse.y" - { (yyval.str) = "template"; } - break; - - case 509: - -/* Line 1455 of yacc.c */ -#line 2896 "vtkParse.y" - { (yyval.str) = "public"; } - break; - - case 510: - -/* Line 1455 of yacc.c */ -#line 2897 "vtkParse.y" - { (yyval.str) = "protected"; } - break; - - case 511: - -/* Line 1455 of yacc.c */ -#line 2898 "vtkParse.y" - { (yyval.str) = "private"; } - break; - - case 512: - -/* Line 1455 of yacc.c */ -#line 2899 "vtkParse.y" - { (yyval.str) = "const"; } - break; - - case 513: - -/* Line 1455 of yacc.c */ -#line 2900 "vtkParse.y" - { (yyval.str) = "static"; } - break; - - case 514: - -/* Line 1455 of yacc.c */ -#line 2901 "vtkParse.y" - { (yyval.str) = "inline"; } - break; - - case 515: - -/* Line 1455 of yacc.c */ -#line 2902 "vtkParse.y" - { (yyval.str) = "virtual"; } - break; - - case 516: - -/* Line 1455 of yacc.c */ -#line 2903 "vtkParse.y" - { (yyval.str) = "extern"; } - break; - - case 517: - -/* Line 1455 of yacc.c */ -#line 2904 "vtkParse.y" - { (yyval.str) = "namespace"; } - break; - - case 518: - -/* Line 1455 of yacc.c */ -#line 2905 "vtkParse.y" - { (yyval.str) = "operator"; } - break; - - case 519: - -/* Line 1455 of yacc.c */ -#line 2906 "vtkParse.y" - { (yyval.str) = "enum"; } - break; - - case 520: - -/* Line 1455 of yacc.c */ -#line 2907 "vtkParse.y" - { (yyval.str) = "throw"; } - break; - - case 521: - -/* Line 1455 of yacc.c */ -#line 2908 "vtkParse.y" - { (yyval.str) = "const_cast"; } - break; - - case 522: - -/* Line 1455 of yacc.c */ -#line 2909 "vtkParse.y" - { (yyval.str) = "dynamic_cast"; } - break; - - case 523: - -/* Line 1455 of yacc.c */ -#line 2910 "vtkParse.y" - { (yyval.str) = "static_cast"; } - break; - - case 524: - -/* Line 1455 of yacc.c */ -#line 2911 "vtkParse.y" - { (yyval.str) = "reinterpret_cast"; } - break; - - case 537: - -/* Line 1455 of yacc.c */ -#line 2935 "vtkParse.y" - { - if ((((yyvsp[(1) - (1)].str))[0] == '+' || ((yyvsp[(1) - (1)].str))[0] == '-' || - ((yyvsp[(1) - (1)].str))[0] == '*' || ((yyvsp[(1) - (1)].str))[0] == '&') && - ((yyvsp[(1) - (1)].str))[1] == '\0') - { - int c1 = 0; - size_t l; - const char *cp; - chopSig(); - cp = getSig(); - l = getSigLength(); - if (l != 0) { c1 = cp[l-1]; } - if (c1 != 0 && c1 != '(' && c1 != '[' && c1 != '=') - { - postSig(" "); - } - postSig((yyvsp[(1) - (1)].str)); - if ((c1 >= 'A' && c1 <= 'Z') || (c1 >= 'a' && c1 <= 'z') || - (c1 >= '0' && c1 <= '9') || c1 == '_' || c1 == '\'' || - c1 == '\"' || c1 == ')' || c1 == ']') - { - postSig(" "); - } - } - else - { - postSig((yyvsp[(1) - (1)].str)); - postSig(" "); - } - } - break; - - case 538: - -/* Line 1455 of yacc.c */ -#line 2965 "vtkParse.y" - { postSig(":"); postSig(" "); } - break; - - case 539: - -/* Line 1455 of yacc.c */ -#line 2965 "vtkParse.y" - { postSig("."); } - break; - - case 540: - -/* Line 1455 of yacc.c */ -#line 2966 "vtkParse.y" - { chopSig(); postSig("::"); } - break; - - case 541: - -/* Line 1455 of yacc.c */ -#line 2967 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); postSig(" "); } - break; - - case 542: - -/* Line 1455 of yacc.c */ -#line 2968 "vtkParse.y" - { postSig((yyvsp[(1) - (1)].str)); postSig(" "); } - break; - - case 544: - -/* Line 1455 of yacc.c */ -#line 2971 "vtkParse.y" - { - int c1 = 0; - size_t l; - const char *cp; - chopSig(); - cp = getSig(); - l = getSigLength(); - if (l != 0) { c1 = cp[l-1]; } - while (((c1 >= 'A' && c1 <= 'Z') || (c1 >= 'a' && c1 <= 'z') || - (c1 >= '0' && c1 <= '9') || c1 == '_') && l != 0) - { - --l; - c1 = cp[l-1]; - } - if (l < 2 || cp[l-1] != ':' || cp[l-2] != ':') - { - cp = add_const_scope(&cp[l]); - resetSig(l); - postSig(cp); - } - } - break; - - case 548: - -/* Line 1455 of yacc.c */ -#line 2997 "vtkParse.y" - { postSig("< "); } - break; - - case 549: - -/* Line 1455 of yacc.c */ -#line 2998 "vtkParse.y" - { postSig("> "); } - break; - - case 551: - -/* Line 1455 of yacc.c */ -#line 3001 "vtkParse.y" - { postSig("= "); } - break; - - case 552: - -/* Line 1455 of yacc.c */ -#line 3002 "vtkParse.y" - { chopSig(); postSig(", "); } - break; - - case 554: - -/* Line 1455 of yacc.c */ -#line 3005 "vtkParse.y" - { chopSig(); postSig(";"); } - break; - - case 562: - -/* Line 1455 of yacc.c */ -#line 3019 "vtkParse.y" - { postSig("= "); } - break; - - case 563: - -/* Line 1455 of yacc.c */ -#line 3020 "vtkParse.y" - { chopSig(); postSig(", "); } - break; - - case 564: - -/* Line 1455 of yacc.c */ -#line 3024 "vtkParse.y" - { - chopSig(); - if (getSig()[getSigLength()-1] == '<') { postSig(" "); } - postSig("<"); - } - break; - - case 565: - -/* Line 1455 of yacc.c */ -#line 3030 "vtkParse.y" - { - chopSig(); - if (getSig()[getSigLength()-1] == '>') { postSig(" "); } - postSig("> "); - } - break; - - case 566: - -/* Line 1455 of yacc.c */ -#line 3037 "vtkParse.y" - { postSig("["); } - break; - - case 567: - -/* Line 1455 of yacc.c */ -#line 3038 "vtkParse.y" - { chopSig(); postSig("] "); } - break; - - case 568: - -/* Line 1455 of yacc.c */ -#line 3041 "vtkParse.y" - { postSig("("); } - break; - - case 569: - -/* Line 1455 of yacc.c */ -#line 3042 "vtkParse.y" - { chopSig(); postSig(") "); } - break; - - case 570: - -/* Line 1455 of yacc.c */ -#line 3043 "vtkParse.y" - { postSig("("); postSig((yyvsp[(1) - (1)].str)); postSig("*"); } - break; - - case 571: - -/* Line 1455 of yacc.c */ -#line 3044 "vtkParse.y" - { chopSig(); postSig(") "); } - break; - - case 572: - -/* Line 1455 of yacc.c */ -#line 3045 "vtkParse.y" - { postSig("("); postSig((yyvsp[(1) - (1)].str)); postSig("&"); } - break; - - case 573: - -/* Line 1455 of yacc.c */ -#line 3046 "vtkParse.y" - { chopSig(); postSig(") "); } - break; - - case 574: - -/* Line 1455 of yacc.c */ -#line 3049 "vtkParse.y" - { postSig("{ "); } - break; - - case 575: - -/* Line 1455 of yacc.c */ -#line 3049 "vtkParse.y" - { postSig("} "); } - break; - - - -/* Line 1455 of yacc.c */ -#line 7941 "vtkParse.tab.c" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* 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 - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined(yyoverflow) || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - - -/* Line 1675 of yacc.c */ -#line 3088 "vtkParse.y" - -#include -#include "lex.yy.c" - -/* fill in the type name if none given */ -const char *type_class(unsigned int type, const char *classname) -{ - if (classname) - { - if (classname[0] == '\0') - { - switch ((type & VTK_PARSE_BASE_TYPE)) - { - case VTK_PARSE_VOID: - classname = "void"; - break; - case VTK_PARSE_BOOL: - classname = "bool"; - break; - case VTK_PARSE_FLOAT: - classname = "float"; - break; - case VTK_PARSE_DOUBLE: - classname = "double"; - break; - case VTK_PARSE_LONG_DOUBLE: - classname = "long double"; - break; - case VTK_PARSE_CHAR: - classname = "char"; - break; - case VTK_PARSE_UNSIGNED_CHAR: - classname = "unsigned char"; - break; - case VTK_PARSE_SIGNED_CHAR: - classname = "signed char"; - break; - case VTK_PARSE_SHORT: - classname = "short"; - break; - case VTK_PARSE_UNSIGNED_SHORT: - classname = "unsigned short"; - break; - case VTK_PARSE_INT: - classname = "int"; - break; - case VTK_PARSE_UNSIGNED_INT: - classname = "unsigned int"; - break; - case VTK_PARSE_LONG: - classname = "long"; - break; - case VTK_PARSE_UNSIGNED_LONG: - classname = "unsigned long"; - break; - case VTK_PARSE_LONG_LONG: - classname = "long long"; - break; - case VTK_PARSE_UNSIGNED_LONG_LONG: - classname = "unsigned long long"; - break; - case VTK_PARSE___INT64: - classname = "__int64"; - break; - case VTK_PARSE_UNSIGNED___INT64: - classname = "unsigned __int64"; - break; - } - } - } - - return classname; -} - -/* check whether this is the class we are looking for */ -void start_class(const char *classname, int is_struct_or_union) -{ - ClassInfo *outerClass = currentClass; - pushClass(); - currentClass = (ClassInfo *)malloc(sizeof(ClassInfo)); - vtkParse_InitClass(currentClass); - currentClass->Name = classname; - if (is_struct_or_union == 1) - { - currentClass->ItemType = VTK_STRUCT_INFO; - } - if (is_struct_or_union == 2) - { - currentClass->ItemType = VTK_UNION_INFO; - } - - if (classname && classname[strlen(classname)-1] != '>') - { - if (outerClass) - { - vtkParse_AddClassToClass(outerClass, currentClass); - } - else - { - vtkParse_AddClassToNamespace(currentNamespace, currentClass); - } - } - - /* template information */ - if (currentTemplate) - { - currentClass->Template = currentTemplate; - currentTemplate = NULL; - } - - /* comment, if any */ - currentClass->Comment = vtkstrdup(getComment()); - - access_level = VTK_ACCESS_PRIVATE; - if (is_struct_or_union) - { - access_level = VTK_ACCESS_PUBLIC; - } - - vtkParse_InitFunction(currentFunction); - startSig(); - clearComment(); -} - -/* reject the class */ -void reject_class(const char *classname, int is_struct_or_union) -{ - static ClassInfo static_class; - - pushClass(); - currentClass = &static_class; - currentClass->Name = classname; - vtkParse_InitClass(currentClass); - - access_level = VTK_ACCESS_PRIVATE; - if (is_struct_or_union) - { - access_level = VTK_ACCESS_PUBLIC; - } - - vtkParse_InitFunction(currentFunction); - startSig(); - clearComment(); -} - -/* reached the end of a class definition */ -void end_class() -{ - /* add default constructors */ - vtkParse_AddDefaultConstructors(currentClass, data->Strings); - - popClass(); -} - -/* add a base class to the specified class */ -void add_base_class(ClassInfo *cls, const char *name, int al, int virt) -{ - if (cls && al == VTK_ACCESS_PUBLIC && virt == 0) - { - vtkParse_AddStringToArray(&cls->SuperClasses, - &cls->NumberOfSuperClasses, - name); - } -} - -/* add a using declaration or directive */ -void add_using(const char *name, int is_namespace) -{ - size_t i; - UsingInfo *item; - - item = (UsingInfo *)malloc(sizeof(UsingInfo)); - vtkParse_InitUsing(item); - if (is_namespace) - { - item->Name = NULL; - item->Scope = name; - } - else - { - i = strlen(name); - while (i > 0 && name[i-1] != ':') { i--; } - item->Name = vtkstrdup(&name[i]); - while (i > 0 && name[i-1] == ':') { i--; } - item->Scope = vtkstrndup(name, i); - } - - if (currentClass) - { - vtkParse_AddUsingToClass(currentClass, item); - } - else - { - vtkParse_AddUsingToNamespace(currentNamespace, item); - } -} - -/* start a new enum */ -void start_enum(const char *name) -{ - EnumInfo *item; - - currentEnumName = "int"; - currentEnumValue = NULL; - if (name) - { - currentEnumName = name; - item = (EnumInfo *)malloc(sizeof(EnumInfo)); - vtkParse_InitEnum(item); - item->Name = name; - item->Access = access_level; - if (currentClass) - { - vtkParse_AddEnumToClass(currentClass, item); - } - else - { - vtkParse_AddEnumToNamespace(currentNamespace, item); - } - } -} - -/* finish the enum */ -void end_enum() -{ - currentEnumName = NULL; - currentEnumValue = NULL; -} - -/* add a constant to the enum */ -void add_enum(const char *name, const char *value) -{ - static char text[2048]; - int i; - long j; - - if (value) - { - strcpy(text, value); - currentEnumValue = value; - } - else if (currentEnumValue) - { - i = strlen(text); - while (i > 0 && text[i-1] >= '0' && - text[i-1] <= '9') { i--; } - - if (i == 0 || text[i-1] == ' ' || - (i > 1 && text[i-2] == ' ' && - (text[i-1] == '-' || text[i-1] == '+'))) - { - if (i > 0 && text[i-1] != ' ') - { - i--; - } - j = (int)strtol(&text[i], NULL, 10); - sprintf(&text[i], "%li", j+1); - } - else - { - i = strlen(text); - strcpy(&text[i], " + 1"); - } - currentEnumValue = vtkstrdup(text); - } - else - { - strcpy(text, "0"); - currentEnumValue = "0"; - } - - add_constant(name, currentEnumValue, VTK_PARSE_INT, currentEnumName, 2); -} - -/* for a macro constant, guess the constant type, doesn't do any math */ -unsigned int guess_constant_type(const char *valstring) -{ - unsigned int valtype = 0; - size_t k; - int i; - int is_name = 0; - - if (valstring == NULL || valstring[0] == '\0') - { - return 0; - } - - if (valstring[0] < '0' || valstring[0] > '9') - { - k = 0; - while ((valstring[k] >= '0' && valstring[k] <= '9') || - (valstring[k] >= 'a' && valstring[k] <= 'z') || - (valstring[k] >= 'A' && valstring[k] <= 'Z') || - valstring[k] == '_') { k++; } - - if (valstring[k] == '\0') - { - is_name = 1; - } - } - - if (strcmp(valstring, "true") == 0 || strcmp(valstring, "false") == 0) - { - return VTK_PARSE_BOOL; - } - - if (valstring[0] == '\'') - { - return VTK_PARSE_CHAR; - } - - if (strncmp(valstring, "VTK_TYPE_CAST(", 14) == 0 || - strncmp(valstring, "static_cast<", 12) == 0 || - strncmp(valstring, "const_cast<", 11) == 0 || - strncmp(valstring, "(", 1) == 0) - { - const char *cp; - size_t n; - int is_unsigned = 0; - - cp = &valstring[1]; - if (valstring[0] == 'c') - { - cp = &valstring[11]; - } - else if (valstring[0] == 's') - { - cp = &valstring[12]; - } - else if (valstring[0] == 'V') - { - cp = &valstring[14]; - } - - if (strncmp(cp, "unsigned ", 9) == 0) - { - is_unsigned = 1; - cp += 9; - } - - n = strlen(cp); - for (k = 0; k < n && cp[k] != ',' && - cp[k] != '>' && cp[k] != ')'; k++) { ; }; - - if (strncmp(cp, "long long", k) == 0) - { valtype = VTK_PARSE_LONG_LONG; } - else if (strncmp(cp, "__int64", k) == 0) - { valtype = VTK_PARSE___INT64; } - else if (strncmp(cp, "long", k) == 0) - { valtype = VTK_PARSE_LONG; } - else if (strncmp(cp, "short", k) == 0) - { valtype = VTK_PARSE_SHORT; } - else if (strncmp(cp, "signed char", k) == 0) - { valtype = VTK_PARSE_SIGNED_CHAR; } - else if (strncmp(cp, "char", k) == 0) - { valtype = VTK_PARSE_CHAR; } - else if (strncmp(cp, "int", k) == 0 || - strncmp(cp, "signed", k) == 0) - { valtype = VTK_PARSE_INT; } - else if (strncmp(cp, "float", k) == 0) - { valtype = VTK_PARSE_FLOAT; } - else if (strncmp(cp, "double", k) == 0) - { valtype = VTK_PARSE_DOUBLE; } - else if (strncmp(cp, "char *", k) == 0) - { valtype = VTK_PARSE_CHAR_PTR; } - - if (is_unsigned) - { - if (valtype == 0) { valtype = VTK_PARSE_INT; } - valtype = (valtype | VTK_PARSE_UNSIGNED); - } - - if (valtype != 0) - { - return valtype; - } - } - - /* check the current scope */ - if (is_name) - { - NamespaceInfo *scope = currentNamespace; - if (namespaceDepth > 0) - { - scope = namespaceStack[0]; - } - - for (i = 0; i < scope->NumberOfConstants; i++) - { - if (strcmp(scope->Constants[i]->Name, valstring) == 0) - { - return scope->Constants[i]->Type; - } - } - } - - /* check for preprocessor macros */ - if (is_name) - { - MacroInfo *macro = vtkParsePreprocess_GetMacro( - preprocessor, valstring); - - if (macro && !macro->IsFunction) - { - return guess_constant_type(macro->Definition); - } - } - - /* fall back to the preprocessor to evaluate the constant */ - { - preproc_int_t val; - int is_unsigned; - int result = vtkParsePreprocess_EvaluateExpression( - preprocessor, valstring, &val, &is_unsigned); - - if (result == VTK_PARSE_PREPROC_DOUBLE) - { - return VTK_PARSE_DOUBLE; - } - else if (result == VTK_PARSE_PREPROC_FLOAT) - { - return VTK_PARSE_FLOAT; - } - else if (result == VTK_PARSE_PREPROC_STRING) - { - return VTK_PARSE_CHAR_PTR; - } - else if (result == VTK_PARSE_OK) - { - if (is_unsigned) - { - if ((preproc_uint_t)val <= VTK_UNSIGNED_INT_MAX) - { - return VTK_PARSE_UNSIGNED_INT; - } - else - { -#if defined(VTK_TYPE_USE_LONG_LONG) - return VTK_PARSE_UNSIGNED_LONG_LONG; -#elif defined(VTK_TYPE_USE___INT64) - return VTK_PARSE_UNSIGNED___INT64; -#else - return VTK_PARSE_UNSIGNED_LONG; -#endif - } - } - else - { - if (val >= VTK_INT_MIN && val <= VTK_INT_MAX) - { - return VTK_PARSE_INT; - } - else - { -#if defined(VTK_TYPE_USE_LONG_LONG) - return VTK_PARSE_LONG_LONG; -#elif defined(VTK_TYPE_USE___INT64) - return VTK_PARSE___INT64; -#else - return VTK_PARSE_LONG; -#endif - } - } - } - } - - return 0; -} - -/* add a constant to the current class or namespace */ -void add_constant(const char *name, const char *value, - unsigned int type, const char *typeclass, int flag) -{ - ValueInfo *con = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(con); - con->ItemType = VTK_CONSTANT_INFO; - con->Name = name; - con->Value = value; - con->Type = type; - con->Class = type_class(type, typeclass); - - if (flag == 2) - { - con->IsEnum = 1; - } - - if (flag == 1) - { - /* actually a macro, need to guess the type */ - ValueInfo **cptr = data->Contents->Constants; - int n = data->Contents->NumberOfConstants; - int i; - - con->Access = VTK_ACCESS_PUBLIC; - if (con->Type == 0) - { - con->Type = guess_constant_type(con->Value); - } - - for (i = 0; i < n; i++) - { - if (strcmp(cptr[i]->Name, con->Name) == 0) - { - break; - } - } - - if (i == n) - { - vtkParse_AddConstantToNamespace(data->Contents, con); - } - else - { - vtkParse_FreeValue(con); - } - } - else if (currentClass) - { - con->Access = access_level; - vtkParse_AddConstantToClass(currentClass, con); - } - else - { - con->Access = VTK_ACCESS_PUBLIC; - vtkParse_AddConstantToNamespace(currentNamespace, con); - } -} - -/* if the name is a const in this namespace, the scope it */ -const char *add_const_scope(const char *name) -{ - static char text[256]; - NamespaceInfo *scope = currentNamespace; - int i, j; - int addscope = 0; - - strcpy(text, name); - - if (currentClass) - { - for (j = 0; j < currentClass->NumberOfConstants; j++) - { - if (strcmp(currentClass->Constants[j]->Name, text) == 0) - { - prepend_scope(text, currentClass->Name); - addscope = 1; - } - } - } - i = namespaceDepth; - while (scope && scope->Name) - { - if (addscope) - { - prepend_scope(text, scope->Name); - } - else - { - for (j = 0; j < scope->NumberOfConstants; j++) - { - if (strcmp(scope->Constants[j]->Name, text) == 0) - { - prepend_scope(text, scope->Name); - addscope = 1; - } - } - } - - scope = 0; - if (i > 0) - { - scope = namespaceStack[--i]; - } - } - - return text; -} - -/* guess the type from the ID */ -unsigned int guess_id_type(const char *cp) -{ - unsigned int t = 0; - - if (cp) - { - size_t i; - const char *dp; - - i = strlen(cp); - while (i > 0 && cp[i-1] != ':') { i--; } - dp = &cp[i]; - - if (strcmp(dp, "vtkStdString") == 0 || - strcmp(cp, "std::string") == 0) - { - t = VTK_PARSE_STRING; - } - else if (strcmp(dp, "vtkUnicodeString") == 0) - { - t = VTK_PARSE_UNICODE_STRING; - } - else if (strncmp(dp, "vtk", 3) == 0) - { - t = VTK_PARSE_OBJECT; - } - else if (strncmp(dp, "Q", 1) == 0 || - strncmp(cp, "Qt::", 4) == 0) - { - t = VTK_PARSE_QOBJECT; - } - else - { - t = VTK_PARSE_UNKNOWN; - } - } - - return t; -} - -/* add a template parameter to the current template */ -void add_template_parameter( - unsigned int datatype, unsigned int extra, const char *funcSig) -{ - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - handle_complex_type(param, datatype, extra, funcSig); - param->Name = getVarName(); - vtkParse_AddParameterToTemplate(currentTemplate, param); -} - -/* add a parameter to a function */ -void add_parameter(FunctionInfo *func, unsigned int type, - const char *typeclass, int count) -{ - char text[64]; - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - - param->Type = type; - param->Class = type_class(type, typeclass); - - if (count) - { - param->Count = count; - sprintf(text, "%i", count); - vtkParse_AddStringToArray(¶m->Dimensions, ¶m->NumberOfDimensions, - vtkstrdup(text)); - } - - add_legacy_parameter(func, param); - - vtkParse_AddParameterToFunction(func, param); -} - -/* set the return type for the current function */ -void set_return(FunctionInfo *func, unsigned int type, - const char *typeclass, int count) -{ - char text[64]; - ValueInfo *val = (ValueInfo *)malloc(sizeof(ValueInfo)); - - vtkParse_InitValue(val); - val->Type = type; - val->Class = type_class(type, typeclass); - - if (count) - { - val->Count = count; - sprintf(text, "%i", count); - vtkParse_AddStringToArray(&val->Dimensions, &val->NumberOfDimensions, - vtkstrdup(text)); - } - - func->ReturnValue = val; - -#ifndef VTK_PARSE_LEGACY_REMOVE - func->ReturnType = val->Type; - func->ReturnClass = val->Class; - func->HaveHint = (count > 0); - func->HintSize = count; -#endif -} - -int count_from_dimensions(ValueInfo *val) -{ - int count, i, n; - const char *cp; - - /* count is the product of the dimensions */ - count = 0; - if (val->NumberOfDimensions) - { - count = 1; - for (i = 0; i < val->NumberOfDimensions; i++) - { - n = 0; - cp = val->Dimensions[i]; - if (cp[0] != '\0') - { - while (*cp != '\0' && *cp >= '0' && *cp <= '9') { cp++; } - while (*cp != '\0' && (*cp == 'u' || *cp == 'l' || - *cp == 'U' || *cp == 'L')) { cp++; } - if (*cp == '\0') - { - n = (int)strtol(val->Dimensions[i], NULL, 0); - } - } - count *= n; - } - } - - return count; -} - -/* deal with types that include function pointers or arrays */ -void handle_complex_type( - ValueInfo *val, unsigned int datatype, unsigned int extra, - const char *funcSig) -{ - FunctionInfo *func = 0; - - /* remove specifiers like "friend" and "typedef" */ - datatype &= VTK_PARSE_QUALIFIED_TYPE; - - /* if "extra" was set, parentheses were involved */ - if ((extra & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) - { - /* the current type becomes the function return type */ - func = getFunction(); - func->ReturnValue = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(func->ReturnValue); - func->ReturnValue->Type = datatype; - func->ReturnValue->Class = type_class(datatype, getTypeId()); - if (funcSig) { func->Signature = vtkstrdup(funcSig); } - val->Function = func; - -#ifndef VTK_PARSE_LEGACY_REMOVE - func->ReturnType = func->ReturnValue->Type; - func->ReturnClass = func->ReturnValue->Class; -#endif - - /* the val type is whatever was inside the parentheses */ - clearTypeId(); - setTypeId(func->Class ? "method" : "function"); - datatype = (extra & VTK_PARSE_UNQUALIFIED_TYPE); - } - else if ((extra & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) - { - datatype = (datatype | VTK_PARSE_BAD_INDIRECT); - } - else if ((extra & VTK_PARSE_INDIRECT) != 0) - { - extra = (extra & VTK_PARSE_INDIRECT); - - if ((extra & VTK_PARSE_REF) != 0) - { - datatype = (datatype | VTK_PARSE_REF); - extra = (extra & ~VTK_PARSE_REF); - } - - if (extra != 0 && getArrayNDims() > 0) - { - /* pointer represents an unsized array bracket */ - datatype = add_indirection(datatype, VTK_PARSE_ARRAY); - extra = ((extra >> 2) & VTK_PARSE_POINTER_MASK); - } - - datatype = add_indirection(datatype, extra); - } - - if (getArrayNDims() == 1) - { - if ((datatype & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) - { - /* turn the first set of brackets into a pointer */ - datatype = add_indirection(datatype, VTK_PARSE_POINTER); - } - else - { - pushArrayFront(""); - } - } - else if (getArrayNDims() > 1) - { - if ((datatype & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) - { - /* turn the first set of brackets into a pointer */ - datatype = add_indirection(datatype, VTK_PARSE_ARRAY); - } - else - { - pushArrayFront(""); - } - } - - /* get the data type */ - val->Type = datatype; - val->Class = type_class(datatype, getTypeId()); - - /* copy contents of all brackets to the ArgDimensions */ - val->NumberOfDimensions = getArrayNDims(); - val->Dimensions = getArray(); - clearArray(); - - /* count is the product of the dimensions */ - val->Count = count_from_dimensions(val); -} - -/* add a parameter to the legacy part of the FunctionInfo struct */ -void add_legacy_parameter(FunctionInfo *func, ValueInfo *param) -{ -#ifndef VTK_PARSE_LEGACY_REMOVE - int i = func->NumberOfArguments; - - if (i < MAX_ARGS) - { - func->NumberOfArguments = i + 1; - func->ArgTypes[i] = param->Type; - func->ArgClasses[i] = param->Class; - func->ArgCounts[i] = param->Count; - - /* legacy wrappers need VTK_PARSE_FUNCTION without POINTER */ - if (param->Type == VTK_PARSE_FUNCTION_PTR) - { - /* check for signature "void (*func)(void *)" */ - if (param->Function->NumberOfParameters == 1 && - param->Function->Parameters[0]->Type == VTK_PARSE_VOID_PTR && - param->Function->Parameters[0]->NumberOfDimensions == 0 && - param->Function->ReturnValue->Type == VTK_PARSE_VOID) - { - func->ArgTypes[i] = VTK_PARSE_FUNCTION; - } - } - } - else - { - func->ArrayFailure = 1; - } -#endif -} - - -/* reject the function, do not output it */ -void reject_function() -{ - vtkParse_InitFunction(currentFunction); - startSig(); - getMacro(); -} - -/* a simple routine that updates a few variables */ -void output_function() -{ - const char *macro = getMacro(); - size_t n; - int i, j; - int match; - - /* reject template specializations */ - n = strlen(currentFunction->Name); - if (currentFunction->Name[n-1] == '>') - { - /* make sure there is a matching angle bracket */ - while (n > 0 && currentFunction->Name[n-1] != '<') { n--; } - if (n > 0) - { - reject_function(); - return; - } - } - - /* static */ - if (currentFunction->ReturnValue && - currentFunction->ReturnValue->Type & VTK_PARSE_STATIC) - { - currentFunction->IsStatic = 1; - } - - /* virtual */ - if (currentFunction->ReturnValue && - currentFunction->ReturnValue->Type & VTK_PARSE_VIRTUAL) - { - currentFunction->IsVirtual = 1; - } - - /* the signature */ - if (!currentFunction->Signature) - { - currentFunction->Signature = getSig(); - } - - /* template information */ - if (currentTemplate) - { - currentFunction->Template = currentTemplate; - currentTemplate = NULL; - } - - /* a void argument is the same as no parameters */ - if (currentFunction->NumberOfParameters == 1 && - (currentFunction->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) == - VTK_PARSE_VOID) - { - currentFunction->NumberOfParameters = 0; - } - - /* is it defined in a legacy macro? */ - if (macro && strcmp(macro, "VTK_LEGACY") == 0) - { - currentFunction->IsLegacy = 1; - } - - /* set public, protected */ - if (currentClass) - { - currentFunction->Access = access_level; - } - else - { - currentFunction->Access = VTK_ACCESS_PUBLIC; - } - -#ifndef VTK_PARSE_LEGACY_REMOVE - /* a void argument is the same as no parameters */ - if (currentFunction->NumberOfArguments == 1 && - (currentFunction->ArgTypes[0] & VTK_PARSE_UNQUALIFIED_TYPE) == - VTK_PARSE_VOID) - { - currentFunction->NumberOfArguments = 0; - } - - /* if return type is void, set return class to void */ - if (currentFunction->ReturnClass == NULL && - (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE) == - VTK_PARSE_VOID) - { - currentFunction->ReturnClass = "void"; - } - - /* set legacy flags */ - if (currentClass) - { - currentFunction->IsPublic = (access_level == VTK_ACCESS_PUBLIC); - currentFunction->IsProtected = (access_level == VTK_ACCESS_PROTECTED); - } - else - { - currentFunction->IsPublic = 1; - currentFunction->IsProtected = 0; - } - - /* check for too many parameters */ - if (currentFunction->NumberOfParameters > MAX_ARGS) - { - currentFunction->ArrayFailure = 1; - } - - for (i = 0; i < currentFunction->NumberOfParameters; i++) - { - ValueInfo *param = currentFunction->Parameters[i]; - /* tell old wrappers that multi-dimensional arrays are bad */ - if ((param->Type & VTK_PARSE_POINTER_MASK) != 0) - { - if (((param->Type & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) || - ((param->Type & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_POINTER)) - { - currentFunction->ArrayFailure = 1; - } - } - - /* allow only "void (*func)(void *)" as a valid function pointer */ - if ((param->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) - { - if (i != 0 || param->Type != VTK_PARSE_FUNCTION_PTR || - currentFunction->NumberOfParameters != 2 || - currentFunction->Parameters[1]->Type != VTK_PARSE_VOID_PTR || - param->Function->NumberOfParameters != 1 || - param->Function->Parameters[0]->Type != VTK_PARSE_VOID_PTR || - param->Function->Parameters[0]->NumberOfDimensions != 0 || - param->Function->ReturnValue->Type != VTK_PARSE_VOID) - { - currentFunction->ArrayFailure = 1; - } - } - } -#endif /* VTK_PARSE_LEGACY_REMOVE */ - - if (currentClass) - { - /* is it a delete function */ - if (currentFunction->Name && !strcmp("Delete",currentFunction->Name)) - { - currentClass->HasDelete = 1; - } - - currentFunction->Class = currentClass->Name; - vtkParse_AddFunctionToClass(currentClass, currentFunction); - - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - } - else - { - /* make sure this function isn't a repeat */ - match = 0; - for (i = 0; i < currentNamespace->NumberOfFunctions; i++) - { - if (currentNamespace->Functions[i]->Name && - strcmp(currentNamespace->Functions[i]->Name, - currentFunction->Name) == 0) - { - if (currentNamespace->Functions[i]->NumberOfParameters == - currentFunction->NumberOfParameters) - { - for (j = 0; j < currentFunction->NumberOfParameters; j++) - { - if (currentNamespace->Functions[i]->Parameters[j]->Type == - currentFunction->Parameters[j]->Type) - { - if (currentFunction->Parameters[j]->Type == VTK_PARSE_OBJECT && - strcmp(currentNamespace->Functions[i]->Parameters[j]->Class, - currentFunction->Parameters[j]->Class) == 0) - { - break; - } - } - } - if (j == currentFunction->NumberOfParameters) - { - match = 1; - break; - } - } - } - } - - if (!match) - { - vtkParse_AddFunctionToNamespace(currentNamespace, currentFunction); - - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - } - } - - vtkParse_InitFunction(currentFunction); - startSig(); -} - -/* output a function that is not a method of the current class */ -void output_friend_function() -{ - ClassInfo *tmpc = currentClass; - currentClass = NULL; - output_function(); - currentClass = tmpc; -} - -void outputSetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n) -{ - static const char *mnames[] = { - NULL, NULL, - "vtkSetVector2Macro", "vtkSetVector3Macro", "vtkSetVector4Macro", - NULL, - "vtkSetVector6Macro", - NULL }; - char ntext[32]; - int i, m; - m = (n > 7 ? 0 : n); - - sprintf(ntext, "%i", n); - - currentFunction->Macro = mnames[m]; - currentFunction->Name = vtkstrcat("Set", var); - startSig(); - postSig("void "); - postSig(currentFunction->Name); - postSig("("); - postSig(typeText); - for (i = 1; i < n; i++) - { - postSig(", "); - postSig(typeText); - } - postSig(");"); - for (i = 0; i < n; i++) - { - add_parameter(currentFunction, paramType, getTypeId(), 0); - } - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); - - currentFunction->Macro = mnames[m]; - currentFunction->Name = vtkstrcat("Set", var); - currentFunction->Signature = - vtkstrcat7("void ", currentFunction->Name, "(", typeText, - " a[", ntext, "]);"); - add_parameter(currentFunction, (VTK_PARSE_POINTER | paramType), - getTypeId(), n); - set_return(currentFunction, VTK_PARSE_VOID, "void", 0); - output_function(); -} - -void outputGetVectorMacro(const char *var, unsigned int paramType, - const char *typeText, int n) -{ - static const char *mnames[] = { - NULL, NULL, - "vtkGetVector2Macro", "vtkGetVector3Macro", "vtkGetVector4Macro", - NULL, - "vtkGetVector6Macro", - NULL }; - int m; - m = (n > 7 ? 0 : n); - - currentFunction->Macro = mnames[m]; - currentFunction->Name = vtkstrcat("Get", var); - currentFunction->Signature = - vtkstrcat4(typeText, " *", currentFunction->Name, "();"); - set_return(currentFunction, (VTK_PARSE_POINTER | paramType), getTypeId(), n); - output_function(); -} - -/* Set a flag to ignore BTX/ETX markers in the files */ -void vtkParse_SetIgnoreBTX(int option) -{ - if (option) - { - IgnoreBTX = 1; - } - else - { - IgnoreBTX = 0; - } -} - -/* Set a flag to recurse into included files */ -void vtkParse_SetRecursive(int option) -{ - if (option) - { - Recursive = 1; - } - else - { - Recursive = 0; - } -} - -/* Parse a header file and return a FileInfo struct */ -FileInfo *vtkParse_ParseFile( - const char *filename, FILE *ifile, FILE *errfile) -{ - int i, j; - int ret; - FileInfo *file_info; - char *main_class; - - /* "data" is a global variable used by the parser */ - data = (FileInfo *)malloc(sizeof(FileInfo)); - vtkParse_InitFile(data); - data->Strings = (StringCache *)malloc(sizeof(StringCache)); - vtkParse_InitStringCache(data->Strings); - - /* "preprocessor" is a global struct used by the parser */ - preprocessor = (PreprocessInfo *)malloc(sizeof(PreprocessInfo)); - vtkParsePreprocess_Init(preprocessor, filename); - vtkParsePreprocess_AddStandardMacros(preprocessor, VTK_PARSE_NATIVE); - - /* add include files specified on the command line */ - for (i = 0; i < NumberOfIncludeDirectories; i++) - { - vtkParsePreprocess_IncludeDirectory(preprocessor, IncludeDirectories[i]); - } - - /* add macros specified on the command line */ - for (i = 0; i < NumberOfDefinitions; i++) - { - const char *cp = Definitions[i]; - - if (*cp == 'U') - { - vtkParsePreprocess_RemoveMacro(preprocessor, &cp[1]); - } - else if (*cp == 'D') - { - const char *definition = &cp[1]; - while (*definition != '=' && *definition != '\0') - { - definition++; - } - if (*definition == '=') - { - definition++; - } - else - { - definition = NULL; - } - vtkParsePreprocess_AddMacro(preprocessor, &cp[1], definition); - } - } - - /* should explicitly check for vtkConfigure.h, or even explicitly load it */ -#ifdef VTK_USE_64BIT_IDS - vtkParsePreprocess_AddMacro(preprocessor, "VTK_USE_64BIT_IDS", NULL); -#endif - - data->FileName = vtkstrdup(filename); - - clearComment(); - - namespaceDepth = 0; - currentNamespace = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_InitNamespace(currentNamespace); - data->Contents = currentNamespace; - - templateDepth = 0; - currentTemplate = NULL; - - currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(currentFunction); - startSig(); - - parseDebug = 0; - if (getenv("DEBUG") != NULL) - { - parseDebug = 1; - } - - yyset_in(ifile); - yyset_out(errfile); - ret = yyparse(); - - if (ret) - { - print_parser_error("syntax error", NULL, 0); - return NULL; - } - - free(currentFunction); - yylex_destroy(); - - /* The main class name should match the file name */ - i = strlen(filename); - j = i; - while (i > 0) - { - --i; - if (filename[i] == '.') - { - j = i; - } - if (filename[i] == '/' || filename[i] == '\\') - { - i++; - break; - } - } - main_class = (char *)malloc(j-i+1); - strncpy(main_class, &filename[i], j-i); - main_class[j-i] = '\0'; - - /* special treatment of the main class in the file */ - for (i = 0; i < currentNamespace->NumberOfClasses; i++) - { - if (strcmp(currentNamespace->Classes[i]->Name, main_class) == 0) - { - data->MainClass = currentNamespace->Classes[i]; - break; - } - } - free(main_class); - - vtkParsePreprocess_Free(preprocessor); - preprocessor = NULL; - macroName = NULL; - - file_info = data; - data = NULL; - - return file_info; -} - -/* Read a hints file and update the FileInfo */ -int vtkParse_ReadHints(FileInfo *file_info, FILE *hfile, FILE *errfile) -{ - char h_cls[512]; - char h_func[512]; - unsigned int h_type, type; - int h_value; - FunctionInfo *func_info; - ClassInfo *class_info; - NamespaceInfo *contents; - int i, j; - int lineno = 0; - int n; - - contents = file_info->Contents; - - /* read each hint line in succession */ - while ((n = fscanf(hfile,"%s %s %x %i", h_cls, h_func, &h_type, &h_value)) - != EOF) - { - lineno++; - if (n < 4) - { - fprintf(errfile, "Wrapping: error parsing hints file line %i\n", lineno); - exit(1); - } - - /* erase "ref" and qualifiers from hint type */ - type = ((h_type & VTK_PARSE_BASE_TYPE) | - (h_type & VTK_PARSE_POINTER_LOWMASK)); - - /* find the matching class */ - for (i = 0; i < contents->NumberOfClasses; i++) - { - class_info = contents->Classes[i]; - - if (strcmp(h_cls, class_info->Name) == 0) - { - /* find the matching function */ - for (j = 0; j < class_info->NumberOfFunctions; j++) - { - func_info = class_info->Functions[j]; - - if ((strcmp(h_func, func_info->Name) == 0) && - func_info->ReturnValue && - (type == ((func_info->ReturnValue->Type & ~VTK_PARSE_REF) & - VTK_PARSE_UNQUALIFIED_TYPE))) - { - /* types that hints are accepted for */ - switch (func_info->ReturnValue->Type & VTK_PARSE_UNQUALIFIED_TYPE) - { - case VTK_PARSE_FLOAT_PTR: - case VTK_PARSE_VOID_PTR: - case VTK_PARSE_DOUBLE_PTR: - case VTK_PARSE_ID_TYPE_PTR: - case VTK_PARSE_LONG_LONG_PTR: - case VTK_PARSE_UNSIGNED_LONG_LONG_PTR: - case VTK_PARSE___INT64_PTR: - case VTK_PARSE_UNSIGNED___INT64_PTR: - case VTK_PARSE_INT_PTR: - case VTK_PARSE_UNSIGNED_INT_PTR: - case VTK_PARSE_SHORT_PTR: - case VTK_PARSE_UNSIGNED_SHORT_PTR: - case VTK_PARSE_LONG_PTR: - case VTK_PARSE_UNSIGNED_LONG_PTR: - case VTK_PARSE_SIGNED_CHAR_PTR: - case VTK_PARSE_UNSIGNED_CHAR_PTR: - case VTK_PARSE_CHAR_PTR: - { - if (func_info->ReturnValue->NumberOfDimensions == 0) - { - char text[64]; - sprintf(text, "%i", h_value); - func_info->ReturnValue->Count = h_value; - vtkParse_AddStringToArray( - &func_info->ReturnValue->Dimensions, - &func_info->ReturnValue->NumberOfDimensions, - vtkParse_CacheString( - file_info->Strings, text, strlen(text))); -#ifndef VTK_PARSE_LEGACY_REMOVE - func_info->HaveHint = 1; - func_info->HintSize = h_value; -#endif - } - break; - } - default: - { - fprintf(errfile, - "Wrapping: unhandled hint type %#x\n", h_type); - } - } - } - } - } - } - } - - return 1; -} - -/* Free the FileInfo struct returned by vtkParse_ParseFile() */ -void vtkParse_Free(FileInfo *file_info) -{ - vtkParse_FreeFile(file_info); - vtkParse_FreeStringCache(file_info->Strings); - free(file_info->Strings); - free(file_info); -} - -/** Define a preprocessor macro. Function macros are not supported. */ -void vtkParse_DefineMacro(const char *name, const char *definition) -{ - size_t n = vtkidlen(name); - size_t l; - char *cp; - - if (definition == NULL) - { - definition = ""; - } - - l = n + strlen(definition) + 3; - cp = (char *)malloc(l); - cp[0] = 'D'; - strncpy(&cp[1], name, n); - cp[n+1] = '\0'; - if (definition[0] != '\0') - { - cp[n+1] = '='; - strcpy(&cp[n+2], definition); - } - cp[l] = '\0'; - - vtkParse_AddStringToArray(&Definitions, &NumberOfDefinitions, cp); -} - -/** Undefine a preprocessor macro. */ -void vtkParse_UndefineMacro(const char *name) -{ - size_t n = vtkidlen(name); - char *cp; - - cp = (char *)malloc(n+2); - cp[0] = 'U'; - strncpy(&cp[1], name, n); - cp[n+1] = '\0'; - - vtkParse_AddStringToArray(&Definitions, &NumberOfDefinitions, cp); -} - -/** Add an include directory, for use with the "-I" option. */ -void vtkParse_IncludeDirectory(const char *dirname) -{ - size_t n = strlen(dirname); - char *cp; - int i; - - for (i = 0; i < NumberOfIncludeDirectories; i++) - { - if (strncmp(IncludeDirectories[i], dirname, n) == 0 && - IncludeDirectories[i][n] == '\0') - { - return; - } - } - - cp = (char *)malloc(n+1); - strcpy(cp, dirname); - - vtkParse_AddStringToArray( - &IncludeDirectories, &NumberOfIncludeDirectories, cp); -} - -/** Return the full path to a header file. */ -const char *vtkParse_FindIncludeFile(const char *filename) -{ - static PreprocessInfo info = {0, 0, 0, 0, 0, 0, 0, 0, 0}; - int val; - int i; - - /* add include files specified on the command line */ - for (i = 0; i < NumberOfIncludeDirectories; i++) - { - vtkParsePreprocess_IncludeDirectory(&info, IncludeDirectories[i]); - } - - return vtkParsePreprocess_FindIncludeFile(&info, filename, 0, &val); -} diff --git a/src/ParaView/vtkParseData.c b/src/ParaView/vtkParseData.c deleted file mode 100644 index 6b27e862..00000000 --- a/src/ParaView/vtkParseData.c +++ /dev/null @@ -1,935 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseData.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseData.h" -#include -#include - -/* Initialize the FileInfo struct */ -void vtkParse_InitFile(FileInfo *file_info) -{ - /* file info */ - file_info->FileName = NULL; - file_info->NameComment = NULL; - file_info->Description = NULL; - file_info->Caveats = NULL; - file_info->SeeAlso = NULL; - - file_info->NumberOfIncludes = 0; - file_info->Includes = NULL; - file_info->MainClass = NULL; - file_info->Contents = NULL; - - file_info->Strings = NULL; -} - -/* Free the FileInfo struct */ -void vtkParse_FreeFile(FileInfo *file_info) -{ - int i, n; - - n = file_info->NumberOfIncludes; - for (i = 0; i < n; i++) - { - vtkParse_FreeFile(file_info->Includes[i]); - free(file_info->Includes[i]); - } - if (file_info->Includes) - { - free(file_info->Includes); - } - - vtkParse_FreeNamespace(file_info->Contents); - file_info->Contents = NULL; -} - -/* Initialize a TemplateInfo struct */ -void vtkParse_InitTemplate(TemplateInfo *info) -{ - info->NumberOfParameters = 0; - info->Parameters = NULL; -} - -/* Copy a TemplateInfo struct */ -void vtkParse_CopyTemplate(TemplateInfo *info, const TemplateInfo *orig) -{ - int i, n; - - n = orig->NumberOfParameters; - info->NumberOfParameters = n; - info->Parameters = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - - for (i = 0; i < n; i++) - { - info->Parameters[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(info->Parameters[i], orig->Parameters[i]); - } -} - -/* Free a TemplateInfo struct */ -void vtkParse_FreeTemplate(TemplateInfo *template_info) -{ - int j, m; - - m = template_info->NumberOfParameters; - for (j = 0; j < m; j++) - { - vtkParse_FreeValue(template_info->Parameters[j]); - } - - free(template_info); -} - - -/* Initialize a Function struct */ -void vtkParse_InitFunction(FunctionInfo *func) -{ -#ifndef VTK_PARSE_LEGACY_REMOVE - int i; -#endif - - func->ItemType = VTK_FUNCTION_INFO; - func->Access = VTK_ACCESS_PUBLIC; - func->Name = NULL; - func->Comment = NULL; - func->Class = NULL; - func->Signature = NULL; - func->Template = NULL; - func->NumberOfParameters = 0; - func->Parameters = NULL; - func->ReturnValue = NULL; - func->Macro = NULL; - func->SizeHint = NULL; - func->IsStatic = 0; - func->IsVirtual = 0; - func->IsPureVirtual = 0; - func->IsOperator = 0; - func->IsVariadic = 0; - func->IsConst = 0; - func->IsExplicit = 0; - func->IsLegacy = 0; - -#ifndef VTK_PARSE_LEGACY_REMOVE - /* everything below here is legacy information, * - * maintained only for backwards compatibility */ - func->NumberOfArguments = 0; - func->ReturnType = VTK_PARSE_VOID; - func->ReturnClass = NULL; - func->HaveHint = 0; - func->HintSize = 0; - func->ArrayFailure = 0; - func->IsPublic = 0; - func->IsProtected = 0; - - for (i = 0; i < MAX_ARGS; i++) - { - func->ArgTypes[i] = 0; - func->ArgClasses[i] = 0; - func->ArgCounts[i] = 0; - } -#endif -} - -/* Copy a Function struct */ -void vtkParse_CopyFunction(FunctionInfo *func, const FunctionInfo *orig) -{ - int i, n; - - func->ItemType = orig->ItemType; - func->Access = orig->Access; - func->Name = orig->Name; - func->Comment = orig->Comment; - func->Class = orig->Class; - func->Signature = orig->Signature; - func->Template = NULL; - - if (orig->Template) - { - func->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_CopyTemplate(func->Template, orig->Template); - } - - n = orig->NumberOfParameters; - func->NumberOfParameters = n; - if (n) - { - func->Parameters = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - func->Parameters[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(func->Parameters[i], orig->Parameters[i]); - } - } - - func->ReturnValue = NULL; - if (orig->ReturnValue) - { - func->ReturnValue = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(func->ReturnValue, orig->ReturnValue); - } - - func->Macro = orig->Macro; - func->SizeHint = orig->SizeHint; - func->IsStatic = orig->IsStatic; - func->IsVirtual = orig->IsVirtual; - func->IsPureVirtual = orig->IsPureVirtual; - func->IsOperator = orig->IsOperator; - func->IsVariadic = orig->IsVariadic; - func->IsConst = orig->IsConst; - func->IsExplicit = orig->IsExplicit; - func->IsLegacy = orig->IsLegacy; - -#ifndef VTK_PARSE_LEGACY_REMOVE - /* everything below here is legacy information, * - * maintained only for backwards compatibility */ - func->NumberOfArguments = orig->NumberOfArguments; - func->ReturnType = orig->ReturnType; - func->ReturnClass = orig->ReturnClass; - func->HaveHint = orig->HaveHint; - func->HintSize = orig->HintSize; - func->ArrayFailure = orig->ArrayFailure; - func->IsPublic = orig->IsPublic; - func->IsProtected = orig->IsProtected; - - for (i = 0; i < MAX_ARGS; i++) - { - func->ArgTypes[i] = orig->ArgTypes[i]; - func->ArgClasses[i] = orig->ArgClasses[i]; - func->ArgCounts[i] = orig->ArgCounts[i]; - } -#endif -} - -/* Free a Function struct */ -void vtkParse_FreeFunction(FunctionInfo *function_info) -{ - int j, m; - - if (function_info->Template) - { - vtkParse_FreeTemplate(function_info->Template); - } - - m = function_info->NumberOfParameters; - for (j = 0; j < m; j++) { vtkParse_FreeValue(function_info->Parameters[j]); } - if (m > 0) { free(function_info->Parameters); } - - if (function_info->ReturnValue) - { - vtkParse_FreeValue(function_info->ReturnValue); - } - - free(function_info); -} - - -/* Initialize a Value struct */ -void vtkParse_InitValue(ValueInfo *val) -{ - val->ItemType = VTK_VARIABLE_INFO; - val->Access = VTK_ACCESS_PUBLIC; - val->Name = NULL; - val->Comment = NULL; - val->Value = NULL; - val->Type = 0; - val->Class = NULL; - val->Count = 0; - val->CountHint = NULL; - val->NumberOfDimensions = 0; - val->Dimensions = NULL; - val->Function = NULL; - val->Template = NULL; - val->IsStatic = 0; - val->IsEnum = 0; -} - -/* Copy a Value struct */ -void vtkParse_CopyValue(ValueInfo *val, const ValueInfo *orig) -{ - int i, n; - - val->ItemType = orig->ItemType; - val->Access = orig->Access; - val->Name = orig->Name; - val->Comment = orig->Comment; - val->Value = orig->Value; - val->Type = orig->Type; - val->Class = orig->Class; - val->Count = orig->Count; - val->CountHint = orig->CountHint; - - n = orig->NumberOfDimensions; - val->NumberOfDimensions = n; - if (n) - { - val->Dimensions = (const char **)malloc(n*sizeof(char *)); - for (i = 0; i < n; i++) - { - val->Dimensions[i] = orig->Dimensions[i]; - } - } - - val->Function = NULL; - if (orig->Function) - { - val->Function = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_CopyFunction(val->Function, orig->Function); - } - - val->Template = NULL; - if (orig->Template) - { - val->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_CopyTemplate(val->Template, orig->Template); - } - - val->IsStatic = orig->IsStatic; - val->IsEnum = orig->IsEnum; -} - -/* Free a Value struct */ -void vtkParse_FreeValue(ValueInfo *value_info) -{ - if (value_info->NumberOfDimensions) - { - free((char **)value_info->Dimensions); - } - if (value_info->Function) - { - vtkParse_FreeFunction(value_info->Function); - } - if (value_info->Template) - { - vtkParse_FreeTemplate(value_info->Template); - } - - free(value_info); -} - - -/* Initialize an Enum struct */ -void vtkParse_InitEnum(EnumInfo *item) -{ - item->ItemType = VTK_ENUM_INFO; - item->Access = VTK_ACCESS_PUBLIC; - item->Name = NULL; - item->Comment = NULL; -} - -/* Copy an Enum struct */ -void vtkParse_CopyEnum(EnumInfo *item, const EnumInfo *orig) -{ - item->ItemType = orig->ItemType; - item->Access = orig->Access; - item->Name = orig->Name; - item->Comment = orig->Comment; -} - -/* Free an Enum struct */ -void vtkParse_FreeEnum(EnumInfo *enum_info) -{ - free(enum_info); -} - - -/* Initialize a Using struct */ -void vtkParse_InitUsing(UsingInfo *item) -{ - item->ItemType = VTK_USING_INFO; - item->Access = VTK_ACCESS_PUBLIC; - item->Name = NULL; - item->Comment = NULL; - item->Scope = NULL; -} - -/* Copy a Using struct */ -void vtkParse_CopyUsing(UsingInfo *item, const UsingInfo *orig) -{ - item->ItemType = orig->ItemType; - item->Access = orig->Access; - item->Name = orig->Name; - item->Comment = orig->Comment; - item->Scope = orig->Scope; -} - -/* Free a Using struct */ -void vtkParse_FreeUsing(UsingInfo *using_info) -{ - free(using_info); -} - - -/* Initialize a Class struct */ -void vtkParse_InitClass(ClassInfo *cls) -{ - cls->ItemType = VTK_CLASS_INFO; - cls->Access = VTK_ACCESS_PUBLIC; - cls->Name = NULL; - cls->Comment = NULL; - cls->Template = NULL; - cls->NumberOfSuperClasses = 0; - cls->SuperClasses = NULL; - cls->NumberOfItems = 0; - cls->Items = NULL; - cls->NumberOfClasses = 0; - cls->Classes = NULL; - cls->NumberOfFunctions = 0; - cls->Functions = NULL; - cls->NumberOfConstants = 0; - cls->Constants = NULL; - cls->NumberOfVariables = 0; - cls->Variables = NULL; - cls->NumberOfEnums = 0; - cls->Enums = NULL; - cls->NumberOfTypedefs = 0; - cls->Typedefs = NULL; - cls->NumberOfUsings = 0; - cls->Usings = NULL; - cls->NumberOfNamespaces = 0; - cls->Namespaces = NULL; - cls->IsAbstract = 0; - cls->HasDelete = 0; -} - -/* Copy a Class struct */ -void vtkParse_CopyClass(ClassInfo *cls, const ClassInfo *orig) -{ - int i, n; - - cls->ItemType = orig->ItemType; - cls->Access = orig->Access; - cls->Name = orig->Name; - cls->Comment = orig->Comment; - cls->Template = NULL; - - if (orig->Template) - { - cls->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); - vtkParse_CopyTemplate(cls->Template, orig->Template); - } - - n = orig->NumberOfSuperClasses; - cls->NumberOfSuperClasses = n; - if (n) - { - cls->SuperClasses = (const char **)malloc(n*sizeof(char *)); - for (i = 0; i < n; i++) - { - cls->SuperClasses[i] = orig->SuperClasses[i]; - } - } - - n = orig->NumberOfItems; - cls->NumberOfItems = n; - if (n) - { - cls->Items = (ItemInfo *)malloc(n*sizeof(ItemInfo)); - for (i = 0; i < n; i++) - { - cls->Items[i].Type = orig->Items[i].Type; - cls->Items[i].Index = orig->Items[i].Index; - } - } - - n = orig->NumberOfClasses; - cls->NumberOfClasses = n; - if (n) - { - cls->Classes = (ClassInfo **)malloc(n*sizeof(ClassInfo *)); - for (i = 0; i < n; i++) - { - cls->Classes[i] = (ClassInfo *)malloc(sizeof(ClassInfo)); - vtkParse_CopyClass(cls->Classes[i], orig->Classes[i]); - } - } - - n = orig->NumberOfFunctions; - cls->NumberOfFunctions = n; - if (n) - { - cls->Functions = (FunctionInfo **)malloc(n*sizeof(FunctionInfo *)); - for (i = 0; i < n; i++) - { - cls->Functions[i] = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_CopyFunction(cls->Functions[i], orig->Functions[i]); - } - } - - n = orig->NumberOfConstants; - cls->NumberOfConstants = n; - if (n) - { - cls->Constants = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - cls->Constants[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(cls->Constants[i], orig->Constants[i]); - } - } - - n = orig->NumberOfVariables; - cls->NumberOfVariables = n; - if (n) - { - cls->Variables = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - cls->Variables[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(cls->Variables[i], orig->Variables[i]); - } - } - - n = orig->NumberOfEnums; - cls->NumberOfEnums = n; - if (n) - { - cls->Enums = (EnumInfo **)malloc(n*sizeof(EnumInfo *)); - for (i = 0; i < n; i++) - { - cls->Enums[i] = (EnumInfo *)malloc(sizeof(EnumInfo)); - vtkParse_CopyEnum(cls->Enums[i], orig->Enums[i]); - } - } - - n = orig->NumberOfTypedefs; - cls->NumberOfTypedefs = n; - if (n) - { - cls->Typedefs = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); - for (i = 0; i < n; i++) - { - cls->Typedefs[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_CopyValue(cls->Typedefs[i], orig->Typedefs[i]); - } - } - - n = orig->NumberOfUsings; - cls->NumberOfUsings = n; - if (n) - { - cls->Usings = (UsingInfo **)malloc(n*sizeof(UsingInfo *)); - for (i = 0; i < n; i++) - { - cls->Usings[i] = (UsingInfo *)malloc(sizeof(UsingInfo)); - vtkParse_CopyUsing(cls->Usings[i], orig->Usings[i]); - } - } - - n = orig->NumberOfNamespaces; - cls->NumberOfNamespaces = n; - if (n) - { - cls->Namespaces = (NamespaceInfo **)malloc(n*sizeof(NamespaceInfo *)); - for (i = 0; i < n; i++) - { - cls->Namespaces[i] = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); - vtkParse_CopyNamespace(cls->Namespaces[i], orig->Namespaces[i]); - } - } - - cls->IsAbstract = orig->IsAbstract; - cls->HasDelete = orig->HasDelete; -} - -/* Free a Class struct */ -void vtkParse_FreeClass(ClassInfo *class_info) -{ - int j, m; - - if (class_info->Template) { vtkParse_FreeTemplate(class_info->Template); } - - m = class_info->NumberOfSuperClasses; - if (m > 0) { free((char **)class_info->SuperClasses); } - - m = class_info->NumberOfClasses; - for (j = 0; j < m; j++) { vtkParse_FreeClass(class_info->Classes[j]); } - if (m > 0) { free(class_info->Classes); } - - m = class_info->NumberOfFunctions; - for (j = 0; j < m; j++) { vtkParse_FreeFunction(class_info->Functions[j]); } - if (m > 0) { free(class_info->Functions); } - - m = class_info->NumberOfConstants; - for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Constants[j]); } - if (m > 0) { free(class_info->Constants); } - - m = class_info->NumberOfVariables; - for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Variables[j]); } - if (m > 0) { free(class_info->Variables); } - - m = class_info->NumberOfEnums; - for (j = 0; j < m; j++) { vtkParse_FreeEnum(class_info->Enums[j]); } - if (m > 0) { free(class_info->Enums); } - - m = class_info->NumberOfTypedefs; - for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Typedefs[j]); } - if (m > 0) { free(class_info->Typedefs); } - - m = class_info->NumberOfUsings; - for (j = 0; j < m; j++) { vtkParse_FreeUsing(class_info->Usings[j]); } - if (m > 0) { free(class_info->Usings); } - - m = class_info->NumberOfNamespaces; - for (j = 0; j < m; j++) { vtkParse_FreeNamespace(class_info->Namespaces[j]); } - if (m > 0) { free(class_info->Namespaces); } - - if (class_info->NumberOfItems > 0) { free(class_info->Items); } - - free(class_info); -} - - -/* Initialize a Namespace struct */ -void vtkParse_InitNamespace(NamespaceInfo *name_info) -{ - vtkParse_InitClass(name_info); - name_info->ItemType = VTK_NAMESPACE_INFO; -} - -/* Copy a Namespace struct */ -void vtkParse_CopyNamespace(NamespaceInfo *ninfo, const NamespaceInfo *orig) -{ - vtkParse_CopyClass(ninfo, orig); -} - -/* Free a Namespace struct */ -void vtkParse_FreeNamespace(NamespaceInfo *namespace_info) -{ - vtkParse_FreeClass(namespace_info); -} - - -/* This method is used for extending dynamic arrays in a progression of - * powers of two. If "n" reaches a power of two, then the array size is - * doubled so that "n" can be safely incremented. */ -static void *array_size_check( - void *arraymem, size_t size, int n) -{ - /* if empty, alloc for the first time */ - if (n == 0) - { - return malloc(size); - } - /* if count is power of two, reallocate with double size */ - else if ((n & (n-1)) == 0) - { - return realloc(arraymem, (n << 1)*size); - } - - /* no reallocation, just return the original array */ - return arraymem; -} - - -/* Utility method to add an included file to a FileInfo */ -void vtkParse_AddIncludeToFile( - FileInfo *file_info, FileInfo *include_file) -{ - file_info->Includes = (FileInfo **)array_size_check( - (FileInfo **)file_info->Includes, sizeof(FileInfo *), - file_info->NumberOfIncludes); - - file_info->Includes[file_info->NumberOfIncludes++] = include_file; - - if (!include_file->Strings) - { - include_file->Strings = file_info->Strings; - } -} - -/* Utility method to add a const char pointer to an array */ -void vtkParse_AddStringToArray( - const char ***valueArray, int *count, const char *value) -{ - *valueArray = (const char **)array_size_check( - (char **)*valueArray, sizeof(const char *), *count); - - (*valueArray)[(*count)++] = value; -} - -/* Utility method to add an item to an array */ -void vtkParse_AddItemToArray( - ItemInfo **valueArray, int *count, parse_item_t type, int idx) -{ - int n = *count; - ItemInfo *values = *valueArray; - - values = (ItemInfo *)array_size_check(values, sizeof(ItemInfo), n); - - values[n].Type = type; - values[n].Index = idx; - *count = n+1; - *valueArray = values; -} - -/* Add a ClassInfo to a ClassInfo */ -void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfClasses); - info->Classes = (ClassInfo **)array_size_check( - info->Classes, sizeof(ClassInfo *), info->NumberOfClasses); - info->Classes[info->NumberOfClasses++] = item; -} - -/* Add a FunctionInfo to a ClassInfo */ -void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfFunctions); - info->Functions = (FunctionInfo **)array_size_check( - info->Functions, sizeof(FunctionInfo *), info->NumberOfFunctions); - info->Functions[info->NumberOfFunctions++] = item; -} - -/* Add a EnumInfo to a ClassInfo */ -void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfEnums); - info->Enums = (EnumInfo **)array_size_check( - info->Enums, sizeof(EnumInfo *), info->NumberOfEnums); - info->Enums[info->NumberOfEnums++] = item; -} - -/* Add a Constant ValueInfo to a ClassInfo */ -void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfConstants); - info->Constants = (ValueInfo **)array_size_check( - info->Constants, sizeof(ValueInfo *), info->NumberOfConstants); - info->Constants[info->NumberOfConstants++] = item; -} - -/* Add a Variable ValueInfo to a ClassInfo */ -void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfVariables); - info->Variables = (ValueInfo **)array_size_check( - info->Variables, sizeof(ValueInfo *), info->NumberOfVariables); - info->Variables[info->NumberOfVariables++] = item; -} - -/* Add a Typedef ValueInfo to a ClassInfo */ -void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfTypedefs); - info->Typedefs = (ValueInfo **)array_size_check( - info->Typedefs, sizeof(ValueInfo *), info->NumberOfTypedefs); - info->Typedefs[info->NumberOfTypedefs++] = item; -} - -/* Add a UsingInfo to a ClassInfo */ -void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfUsings); - info->Usings = (UsingInfo **)array_size_check( - info->Usings, sizeof(UsingInfo *), info->NumberOfUsings); - info->Usings[info->NumberOfUsings++] = item; -} - - -/* Add a NamespaceInfo to a NamespaceInfo */ -void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info, NamespaceInfo *item) -{ - vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, - item->ItemType, info->NumberOfNamespaces); - info->Namespaces = (NamespaceInfo **)array_size_check( - info->Namespaces, sizeof(NamespaceInfo *), info->NumberOfNamespaces); - info->Namespaces[info->NumberOfNamespaces++] = item; -} - -/* Add a ClassInfo to a NamespaceInfo */ -void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item) -{ - vtkParse_AddClassToClass(info, item); -} - -/* Add a FunctionInfo to a NamespaceInfo */ -void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item) -{ - vtkParse_AddFunctionToClass(info, item); -} - -/* Add a EnumInfo to a NamespaceInfo */ -void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item) -{ - vtkParse_AddEnumToClass(info, item); -} - -/* Add a Constant ValueInfo to a NamespaceInfo */ -void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item) -{ - vtkParse_AddConstantToClass(info, item); -} - -/* Add a Variable ValueInfo to a NamespaceInfo */ -void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item) -{ - vtkParse_AddVariableToClass(info, item); -} - -/* Add a Typedef ValueInfo to a NamespaceInfo */ -void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item) -{ - vtkParse_AddTypedefToClass(info, item); -} - -/* Add a UsingInfo to a NamespaceInfo */ -void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item) -{ - vtkParse_AddUsingToClass(info, item); -} - - -/* Add a ValueInfo parameter to a FunctionInfo */ -void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item) -{ - info->Parameters = (ValueInfo **)array_size_check( - info->Parameters, sizeof(ValueInfo *), info->NumberOfParameters); - info->Parameters[info->NumberOfParameters++] = item; -} - - -/* Add a ValueInfo to a TemplateInfo */ -void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item) -{ - info->Parameters = (ValueInfo **)array_size_check( - info->Parameters, sizeof(ValueInfo *), info->NumberOfParameters); - info->Parameters[info->NumberOfParameters++] = item; -} - - -/* Add default constructors if they do not already exist */ -void vtkParse_AddDefaultConstructors(ClassInfo *cls, StringCache *cache) -{ - FunctionInfo *func; - ValueInfo *param; - size_t k, l; - int i, n; - int default_constructor = 1; - int copy_constructor = 1; - char *tname; - const char *ccname; - - if (cls == NULL || cls->Name == NULL) - { - return; - } - - n = cls->NumberOfFunctions; - for (i = 0; i < n; i++) - { - func = cls->Functions[i]; - if (func->Name && strcmp(func->Name, cls->Name) == 0) - { - default_constructor = 0; - - if (func->NumberOfParameters == 1) - { - param = func->Parameters[0]; - if (param->Class && - strcmp(param->Class, cls->Name) == 0 && - (param->Type & VTK_PARSE_POINTER_MASK) == 0) - { - copy_constructor = 0; - } - } - } - } - - if (default_constructor) - { - func = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(func); - func->Class = cls->Name; - func->Name = cls->Name; - k = strlen(cls->Name); - tname = vtkParse_NewString(cache, k + 2); - strcpy(tname, cls->Name); - strcpy(&tname[k], "()"); - func->Signature = tname; - vtkParse_AddFunctionToClass(cls, func); - } - - if (copy_constructor) - { - ccname = cls->Name; - - if (cls->Template) - { - /* specialize the name */ - n = cls->Template->NumberOfParameters; - - k = strlen(cls->Name) + 2; - for (i = 0; i < n; i++) - { - if (cls->Template->Parameters[i]->Name) - { - k += strlen(cls->Template->Parameters[i]->Name) + 2; - } - } - tname = vtkParse_NewString(cache, k); - strcpy(tname, cls->Name); - k = strlen(tname); - tname[k++] = '<'; - for (i = 0; i < n; i++) - { - if (cls->Template->Parameters[i]->Name) - { - strcpy(&tname[k], cls->Template->Parameters[i]->Name); - k += strlen(cls->Template->Parameters[i]->Name); - } - if (i+1 < n) - { - tname[k++] = ','; - tname[k++] = ' '; - } - } - tname[k++] = '>'; - tname[k] = '\0'; - ccname = tname; - } - - func = (FunctionInfo *)malloc(sizeof(FunctionInfo)); - vtkParse_InitFunction(func); - func->Class = cls->Name; - func->Name = cls->Name; - k = strlen(cls->Name); - l = strlen(ccname); - tname = vtkParse_NewString(cache, k + l + 9); - strcpy(tname, cls->Name); - strcpy(&tname[k], "(const &"); - strcpy(&tname[k+8], ccname); - strcpy(&tname[k+8+l], ")"); - func->Signature = tname; - param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - param->Type = (VTK_PARSE_OBJECT_REF | VTK_PARSE_CONST); - param->Class = ccname; - vtkParse_AddParameterToFunction(func, param); - vtkParse_AddFunctionToClass(cls, func); - } -} diff --git a/src/ParaView/vtkParseData.h b/src/ParaView/vtkParseData.h deleted file mode 100644 index cd03e67c..00000000 --- a/src/ParaView/vtkParseData.h +++ /dev/null @@ -1,335 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseData.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/* - Data structures used by vtkParse. -*/ - -#ifndef VTK_PARSE_DATA_H -#define VTK_PARSE_DATA_H - -#include "vtkParseType.h" -#include "vtkParseString.h" - -/* legacy */ -#ifndef VTK_PARSE_LEGACY_REMOVE -#define MAX_ARGS 20 -#endif - -/** - * Access flags - */ -typedef enum _parse_access_t -{ - VTK_ACCESS_PUBLIC = 0, - VTK_ACCESS_PROTECTED = 1, - VTK_ACCESS_PRIVATE = 2 -} parse_access_t; - -/** - * ItemType constants - */ -typedef enum _parse_item_t -{ - VTK_NAMESPACE_INFO = 1, - VTK_CLASS_INFO = 2, - VTK_STRUCT_INFO = 3, - VTK_UNION_INFO = 4, - VTK_ENUM_INFO = 5, - VTK_FUNCTION_INFO = 6, - VTK_VARIABLE_INFO = 7, - VTK_CONSTANT_INFO = 8, - VTK_TYPEDEF_INFO = 9, - VTK_USING_INFO = 10 -} parse_item_t; - -/** - * ItemInfo just contains an index - */ -typedef struct _ItemInfo -{ - parse_item_t Type; - int Index; -} ItemInfo; - -/* forward declarations */ -struct _ValueInfo; -struct _FunctionInfo; -struct _FileInfo; -typedef struct _ValueInfo ValueInfo; -typedef struct _FunctionInfo FunctionInfo; -typedef struct _FileInfo FileInfo; - -/** - * TemplateInfo holds template definitions - */ -typedef struct _TemplateInfo -{ - int NumberOfParameters; - ValueInfo **Parameters; -} TemplateInfo; - -/** - * ValueInfo is for typedefs, constants, variables, - * function parameters, and return values - * - * Note that Dimensions is an array of char pointers, in - * order to support dimensions that are sized according to - * template parameter values or according to named constants. - */ -struct _ValueInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; - const char *Value; /* for vars or default paramter values */ - unsigned int Type; /* as defined in vtkParseType.h */ - const char *Class; /* classname for type */ - int Count; /* total number of values, if known */ - const char *CountHint; /* hint about how to get the count */ - int NumberOfDimensions; /* dimensionality for arrays */ - const char **Dimensions; /* dimensions for arrays */ - FunctionInfo *Function; /* for function pointer values */ - TemplateInfo *Template; /* template parameters, or NULL */ - int IsStatic; /* for class variables only */ - int IsEnum; /* for constants only */ -}; - -/** - * FunctionInfo is for functions and methods - */ -struct _FunctionInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; - const char *Class; /* class name for methods */ - const char *Signature; /* function signature as text */ - TemplateInfo *Template; /* template parameters, or NULL */ - int NumberOfParameters; - ValueInfo **Parameters; - ValueInfo *ReturnValue; /* NULL for constructors and destructors */ - const char *Macro; /* the macro that defined this function */ - const char *SizeHint; /* hint the size e.g. for operator[] */ - int IsOperator; - int IsVariadic; - int IsLegacy; /* marked as a legacy method or function */ - int IsStatic; /* methods only */ - int IsVirtual; /* methods only */ - int IsPureVirtual; /* methods only */ - int IsConst; /* methods only */ - int IsExplicit; /* constructors only */ -#ifndef VTK_PARSE_LEGACY_REMOVE - int NumberOfArguments; /* legacy */ - unsigned int ArgTypes[MAX_ARGS]; /* legacy */ - const char *ArgClasses[MAX_ARGS];/* legacy */ - int ArgCounts[MAX_ARGS]; /* legacy */ - unsigned int ReturnType; /* legacy */ - const char *ReturnClass; /* legacy */ - int HaveHint; /* legacy */ - int HintSize; /* legacy */ - int ArrayFailure;/* legacy */ - int IsPublic; /* legacy */ - int IsProtected; /* legacy */ -#endif -}; - -/** - * EnumInfo is for enums - * Constants are at the same level as the Enum, not inside it. - */ -typedef struct _EnumInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; -} EnumInfo; - -/** - * UsingInfo is for using directives - */ -typedef struct _UsingInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; /* null for using whole namespace */ - const char *Comment; - const char *Scope; /* the namespace or class */ -} UsingInfo; - -/** - * ClassInfo is for classes, structs, unions, and namespaces - */ -typedef struct _ClassInfo -{ - parse_item_t ItemType; - parse_access_t Access; - const char *Name; - const char *Comment; - TemplateInfo *Template; - int NumberOfSuperClasses; - const char **SuperClasses; - int NumberOfItems; - ItemInfo *Items; - int NumberOfClasses; - struct _ClassInfo **Classes; - int NumberOfFunctions; - FunctionInfo **Functions; - int NumberOfConstants; - ValueInfo **Constants; - int NumberOfVariables; - ValueInfo **Variables; - int NumberOfEnums; - EnumInfo **Enums; - int NumberOfTypedefs; - ValueInfo **Typedefs; - int NumberOfUsings; - UsingInfo **Usings; - int NumberOfNamespaces; - struct _ClassInfo **Namespaces; - int IsAbstract; - int HasDelete; -} ClassInfo; - -/** - * Namespace is for namespaces - */ -typedef struct _ClassInfo NamespaceInfo; - -/** - * FileInfo is for header files - */ -struct _FileInfo -{ - const char *FileName; - const char *NameComment; - const char *Description; - const char *Caveats; - const char *SeeAlso; - - int NumberOfIncludes; - struct _FileInfo **Includes; - ClassInfo *MainClass; - NamespaceInfo *Contents; - StringCache *Strings; -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Initializer methods - */ -/*@{*/ -void vtkParse_InitFile(FileInfo *file_info); -void vtkParse_InitNamespace(NamespaceInfo *namespace_info); -void vtkParse_InitClass(ClassInfo *cls); -void vtkParse_InitFunction(FunctionInfo *func); -void vtkParse_InitValue(ValueInfo *val); -void vtkParse_InitEnum(EnumInfo *item); -void vtkParse_InitUsing(UsingInfo *item); -void vtkParse_InitTemplate(TemplateInfo *arg); -/*@}*/ - -/** - * Copy methods - * - * Strings are not deep-copied, they are assumed to be persistent. - */ -/*@{*/ -void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); -void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); -void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); -void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); -void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); -void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); -void vtkParse_CopyTemplate(TemplateInfo *data, const TemplateInfo *orig); -/*@}*/ - -/** - * Free methods - * - * Strings are not freed, they are assumed to be persistent. - */ -/*@{*/ -void vtkParse_FreeFile(FileInfo *file_info); -void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); -void vtkParse_FreeClass(ClassInfo *cls); -void vtkParse_FreeFunction(FunctionInfo *func); -void vtkParse_FreeValue(ValueInfo *val); -void vtkParse_FreeEnum(EnumInfo *item); -void vtkParse_FreeUsing(UsingInfo *item); -void vtkParse_FreeTemplate(TemplateInfo *arg); -/*@}*/ - - -/** - * Add a string to an array of strings, grow array as necessary. - */ -void vtkParse_AddStringToArray( - const char ***valueArray, int *count, const char *value); - -/** - * Expand the Item array for classes and namespaces. - */ -void vtkParse_AddItemToArray( - ItemInfo **valueArray, int *count, parse_item_t type, int idx); - - -/** - * Add various items to the structs. - */ -/*@{*/ -void vtkParse_AddIncludeToFile(FileInfo *info, FileInfo *item); -void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); -void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); -void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); -void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); -void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); -void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); -void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); -void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); -void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); -void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item); -void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item); -/*@}*/ - -/** - * Add default constructors to a class if they do not already exist - */ -void vtkParse_AddDefaultConstructors(ClassInfo *data, StringCache *cache); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkParseExtras.c b/src/ParaView/vtkParseExtras.c deleted file mode 100644 index 6504d3b8..00000000 --- a/src/ParaView/vtkParseExtras.c +++ /dev/null @@ -1,1469 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseExtras.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2011 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2011 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseExtras.h" -#include "vtkParseString.h" -#include "vtkType.h" -#include -#include -#include -#include -#include - -/* skip over an identifier */ -static size_t vtkparse_id_len(const char *text) -{ - size_t i = 0; - char c = text[0]; - - if ((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - c == '_') - { - do - { - c = text[++i]; - } - while ((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - c == '_'); - } - - return i; -} - -/* skip over numbers, int or float, including suffixes */ -static size_t vtkparse_number_len(const char *text) -{ - size_t i = 0; - char c = text[0]; - - if (c == '.') - { - c = text[1]; - } - - if (c >= '0' && c <= '9') - { - do - { - do - { - c = text[++i]; - } - while ((c >= '0' && c <= '9') || - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - c == '_' || c == '.'); - } - while ((c == '-' || c == '+') && - (text[i-1] == 'e' || text[i-1] == 'E')); - } - - return i; -} - -/* skip over string and char literals. */ -static size_t vtkparse_quote_len(const char *text) -{ - size_t i = 0; - const char qc = text[0]; - char c = text[0]; - - if (c == '\'' || c == '\"') - { - do - { - do - { - c = text[++i]; - } - while (c != qc && c != '\n' && c != '\0'); - } - while (c == qc && text[i-1] == '\\'); - - if (c == qc) - { - ++i; - } - } - - return i; -} - -/* skip over an expression in brackets */ -static size_t vtkparse_bracket_len(const char *text) -{ - size_t i = 0; - size_t j = 1; - char bc = text[0]; - char tc = 0; - char semi = ';'; - char c; - - if (bc == '(') { tc = ')'; } - else if (bc == '[') { tc = ']'; } - else if (bc == '{') { tc = '}'; semi = '\0'; } - else if (bc == '<') { tc = '>'; } - else { return 0; } - - do - { - i += j; - j = 1; - c = text[i]; - if (c == '\'' || c == '\"') - { - j = vtkparse_quote_len(&text[i]); - } - else if (c == bc || c == '(' || c == '[' || c == '{') - { - j = vtkparse_bracket_len(&text[i]); - } - } - while (c != tc && c != ')' && c != ']' && c != '}' && - c != '\0' && c != '\n' && c != semi && j != 0); - - if (c == tc) - { - i++; - } - - return i; -} - -/* skip over a name that is neither scoped or templated, return the - * total number of characters in the name */ -size_t vtkParse_IdentifierLength(const char *text) -{ - return vtkparse_id_len(text); -} - -/* skip over a name that might be templated, return the - * total number of characters in the name */ -size_t vtkParse_UnscopedNameLength(const char *text) -{ - size_t i = 0; - - i += vtkparse_id_len(text); - if (text[i] == '<') - { - i += vtkparse_bracket_len(&text[i]); - if (text[i-1] != '>') - { - fprintf(stderr, "Bad template args %*.*s\n", (int)i, (int)i, text); - assert(text[i-1] == '>'); - return 0; - } - } - - return i; -} - -/* skip over a name that might be scoped or templated, return the - * total number of characters in the name */ -size_t vtkParse_NameLength(const char *text) -{ - size_t i = 0; - do - { - if (text[i] == ':' && text[i+1] == ':') { i += 2; } - i += vtkParse_UnscopedNameLength(&text[i]); - } - while (text[i] == ':' && text[i+1] == ':'); - return i; -} - -/* Search and replace, return the initial string if no replacements - * occurred, otherwise return a new string. */ -static const char *vtkparse_string_replace( - StringCache *cache, const char *str1, - int n, const char *name[], const char *val[]) -{ - const char *cp = str1; - char result_store[1024]; - size_t resultMaxLen = 1024; - char *result, *tmp; - int k; - size_t i, j, l, m; - size_t lastPos, nameBegin, nameEnd; - int replaced = 0; - int any_replaced = 0; - - result = result_store; - - if (n == 0) - { - return str1; - } - - i = 0; - j = 0; - result[j] = '\0'; - - while (cp[i] != '\0') - { - lastPos = i; - - /* skip all chars that aren't part of a name */ - while ((cp[i] < 'a' || cp[i] > 'z') && - (cp[i] < 'A' || cp[i] > 'Z') && - cp[i] != '_' && cp[i] != '\0') - { - if (cp[i] == '\'' || cp[i] == '\"') - { - i += vtkparse_quote_len(&cp[i]); - } - else if (cp[i] >= '0' && cp[i] <= '9') - { - i += vtkparse_number_len(&cp[i]); - } - else - { - i++; - } - } - nameBegin = i; - - /* skip all chars that are part of a name */ - i += vtkparse_id_len(&cp[i]); - nameEnd = i; - - /* search through the list of names to replace */ - replaced = 0; - m = nameEnd - nameBegin; - for (k = 0; k < n; k++) - { - l = strlen(name[k]); - if (l > 0 && l == m && strncmp(&cp[nameBegin], name[k], l) == 0) - { - m = strlen(val[k]); - replaced = 1; - any_replaced = 1; - break; - } - } - - /* expand the storage space if needed */ - if (j + m + (nameBegin - lastPos) + 1 >= resultMaxLen) - { - resultMaxLen *= 2; - tmp = (char *)malloc(resultMaxLen); - strcpy(tmp, result); - if (result != result_store) - { - free(result); - } - result = tmp; - } - - /* copy the old bits */ - if (nameBegin > lastPos) - { - strncpy(&result[j], &cp[lastPos], nameBegin - lastPos); - j += (nameBegin - lastPos); - } - - /* do the replacement */ - if (replaced) - { - strncpy(&result[j], val[k], m); - j += m; - /* guard against creating double ">>" */ - if (val[k][m-1] == '>' && cp[nameEnd] == '>') - { - result[j++] = ' '; - } - } - else if (nameEnd > nameBegin) - { - strncpy(&result[j], &cp[nameBegin], nameEnd - nameBegin); - j += (nameEnd - nameBegin); - } - - result[j] = '\0'; - } - - if (cache) - { - if (any_replaced) - { - /* use the efficient CacheString method */ - cp = vtkParse_CacheString(cache, result, j); - if (result != result_store) - { - free(result); - } - } - } - else - { - if (any_replaced) - { - /* return a string that was allocated with malloc */ - if (result == result_store) - { - tmp = (char *)malloc(strlen(result) + 1); - strcpy(tmp, result); - result = tmp; - } - cp = result; - } - } - - return cp; -} - -/* Wherever one of the specified names exists inside a Value or inside - * a Dimension size, replace it with the corresponding val string. */ -void vtkParse_ExpandValues( - ValueInfo *valinfo, StringCache *cache, - int n, const char *name[], const char *val[]) -{ - int j, m, dim, count; - const char *cp; - - if (valinfo->Value) - { - valinfo->Value = vtkparse_string_replace( - cache, valinfo->Value, n, name, val); - } - - m = valinfo->NumberOfDimensions; - if (m) - { - count = 1; - for (j = 0; j < m; j++) - { - cp = valinfo->Dimensions[j]; - if (cp) - { - cp = vtkparse_string_replace(cache, cp, n, name, val); - valinfo->Dimensions[j] = cp; - - /* check whether dimension has become an integer literal */ - if (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) { cp += 2; } - while (*cp >= '0' && *cp <= '9') { cp++; } - while (*cp == 'u' || *cp == 'l' || *cp == 'U' || *cp == 'L') { cp++; } - dim = 0; - if (*cp == '\0') - { - dim = (int)strtol(valinfo->Dimensions[j], NULL, 0); - } - count *= dim; - } - } - - /* update count if all values are integer literals */ - if (count) - { - valinfo->Count = count; - } - } -} - -/* Expand a typedef within a type declaration. */ -void vtkParse_ExpandTypedef( - ValueInfo *valinfo, ValueInfo *typedefinfo) -{ - const char *classname; - unsigned int baseType; - unsigned int pointers; - unsigned int refbit; - unsigned int qualifiers; - unsigned int tmp1, tmp2; - int i; - - classname = typedefinfo->Class; - baseType = (typedefinfo->Type & VTK_PARSE_BASE_TYPE); - pointers = (typedefinfo->Type & VTK_PARSE_POINTER_MASK); - refbit = (valinfo->Type & VTK_PARSE_REF); - qualifiers = (typedefinfo->Type & VTK_PARSE_CONST); - - /* handle const */ - if ((valinfo->Type & VTK_PARSE_CONST) != 0) - { - if ((pointers & VTK_PARSE_POINTER_LOWMASK) != 0) - { - if ((pointers & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) - { - /* const turns into const pointer */ - pointers = (pointers & ~VTK_PARSE_POINTER_LOWMASK); - pointers = (pointers | VTK_PARSE_CONST_POINTER); - } - } - else - { - /* const remains as const value */ - qualifiers = (qualifiers | VTK_PARSE_CONST); - } - } - - /* make a reversed copy of the pointer bitfield */ - tmp1 = (valinfo->Type & VTK_PARSE_POINTER_MASK); - tmp2 = 0; - while (tmp1) - { - tmp2 = ((tmp2 << 2) | (tmp1 & VTK_PARSE_POINTER_LOWMASK)); - tmp1 = ((tmp1 >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* turn pointers into zero-element arrays where necessary */ - if ((pointers & VTK_PARSE_POINTER_LOWMASK) == VTK_PARSE_ARRAY) - { - tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); - while (tmp2) - { - vtkParse_AddStringToArray( - &valinfo->Dimensions, &valinfo->NumberOfDimensions, ""); - tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); - } - } - else - { - /* combine the pointers */ - while (tmp2) - { - pointers = ((pointers << 2) | (tmp2 & VTK_PARSE_POINTER_LOWMASK)); - tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); - } - } - - /* combine the arrays */ - for (i = 0; i < typedefinfo->NumberOfDimensions; i++) - { - vtkParse_AddStringToArray( - &valinfo->Dimensions, &valinfo->NumberOfDimensions, - typedefinfo->Dimensions[i]); - } - if (valinfo->NumberOfDimensions > 1) - { - pointers = ((pointers & ~VTK_PARSE_POINTER_LOWMASK) | VTK_PARSE_ARRAY); - } - - /* put everything together */ - valinfo->Type = (baseType | pointers | refbit | qualifiers); - valinfo->Class = classname; - valinfo->Function = typedefinfo->Function; - valinfo->Count *= typedefinfo->Count; -} - -/* Expand any unrecognized types within a variable, parameter, or typedef - * that match any of the supplied typedefs. The expansion is done in-place. */ -void vtkParse_ExpandTypedefs( - ValueInfo *val, StringCache *cache, - int n, const char *names[], const char *values[], - ValueInfo *typedefinfo[]) -{ - int i; - - if (((val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT || - (val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) && - val->Class != 0) - { - for (i = 0; i < n; i++) - { - if (typedefinfo[i] && strcmp(val->Class, typedefinfo[i]->Name) == 0) - { - vtkParse_ExpandTypedef(val, typedefinfo[i]); - break; - } - } - if (i == n) - { - /* in case type appears as a template arg of another type */ - val->Class = vtkparse_string_replace( - cache, val->Class, n, names, values); - } - } -} - -/* Helper struct for VTK-specific types */ -struct vtk_type_struct -{ - size_t len; - const char *name; - unsigned int type; -}; - -/* Simple utility for mapping VTK types to VTK_PARSE types */ -unsigned int vtkParse_MapType(int vtktype) -{ - static unsigned int typemap[] = - { - VTK_PARSE_VOID, /* VTK_VOID 0 */ - 0, /* VTK_BIT 1 */ - VTK_PARSE_CHAR, /* VTK_CHAR 2 */ - VTK_PARSE_UNSIGNED_CHAR, /* VTK_UNSIGNED_CHAR 3 */ - VTK_PARSE_SHORT, /* VTK_SHORT 4 */ - VTK_PARSE_UNSIGNED_SHORT, /* VTK_UNSIGNED_SHORT 5 */ - VTK_PARSE_INT, /* VTK_INT 6 */ - VTK_PARSE_UNSIGNED_INT, /* VTK_UNSIGNED_INT 7 */ - VTK_PARSE_LONG, /* VTK_LONG 8 */ - VTK_PARSE_UNSIGNED_LONG, /* VTK_UNSIGNED_LONG 9 */ - VTK_PARSE_FLOAT, /* VTK_FLOAT 10 */ - VTK_PARSE_DOUBLE, /* VTK_DOUBLE 11 */ - VTK_PARSE_ID_TYPE, /* VTK_ID_TYPE 12 */ - VTK_PARSE_STRING, /* VTK_STRING 13 */ - 0, /* VTK_OPAQUE 14 */ - VTK_PARSE_SIGNED_CHAR, /* VTK_SIGNED_CHAR 15 */ - VTK_PARSE_LONG_LONG, /* VTK_LONG_LONG 16 */ - VTK_PARSE_UNSIGNED_LONG_LONG, /* VTK_UNSIGNED_LONG_LONG 17 */ - VTK_PARSE___INT64, /* VTK___INT64 18 */ - VTK_PARSE_UNSIGNED___INT64, /* VTK_UNSIGNED___INT64 19 */ - 0, /* VTK_VARIANT 20 */ - 0, /* VTK_OBJECT 21 */ - VTK_PARSE_UNICODE_STRING /* VTK_UNICODE_STRING 22 */ - }; - - if (vtktype > 0 && vtktype <= VTK_UNICODE_STRING) - { - return typemap[vtktype]; - } - return 0; -} - -/* Get a type from a type name, and return the number of characters used. - * If the "classname" argument is not NULL, then it is used to return - * the short name for the type, e.g. "long int" becomes "long", while - * typedef names and class names are returned unchanged. If "const" - * appears in the type name, then the const bit flag is set for the - * type, but "const" will not appear in the returned classname. */ -size_t vtkParse_BasicTypeFromString( - const char *text, unsigned int *type_ptr, - const char **classname_ptr, size_t *len_ptr) -{ - /* The various typedefs and types specific to VTK */ - static struct vtk_type_struct vtktypes[] = { - { 9, "vtkIdType", VTK_ID_TYPE }, - { 12, "vtkStdString", VTK_STRING }, - { 16, "vtkUnicodeString", VTK_UNICODE_STRING }, - { 11, "vtkTypeInt8", VTK_TYPE_INT8 }, - { 12, "vtkTypeUInt8", VTK_TYPE_UINT8 }, - { 12, "vtkTypeInt16", VTK_TYPE_INT16 }, - { 13, "vtkTypeUInt16", VTK_TYPE_UINT16 }, - { 12, "vtkTypeInt32", VTK_TYPE_INT32 }, - { 13, "vtkTypeUInt32", VTK_TYPE_UINT32 }, - { 12, "vtkTypeInt64", VTK_TYPE_INT64 }, - { 13, "vtkTypeUInt64", VTK_TYPE_UINT64 }, - { 14, "vtkTypeFloat32", VTK_TYPE_FLOAT32 }, - { 14, "vtkTypeFloat64", VTK_TYPE_FLOAT64 }, - { 0, 0, 0 } }; - - /* Other typedefs and types */ - static struct vtk_type_struct stdtypes[] = { - { 6, "size_t", VTK_PARSE_SIZE_T }, - { 7, "ssize_t", VTK_PARSE_SSIZE_T }, - { 7, "ostream", VTK_PARSE_OSTREAM }, - { 7, "istream", VTK_PARSE_ISTREAM }, - { 8, "string", VTK_PARSE_STRING }, - { 0, 0, 0 } }; - - const char *cp = text; - const char *tmpcp; - size_t k, n, m; - int i; - unsigned int const_bits = 0; - unsigned int static_bits = 0; - unsigned int unsigned_bits = 0; - unsigned int base_bits = 0; - const char *classname = NULL; - size_t len = 0; - - while (*cp == ' ' || *cp == '\t') { cp++; } - - while ((*cp >= 'a' && *cp <= 'z') || - (*cp >= 'A' && *cp <= 'Z') || - (*cp == '_') || (cp[0] == ':' && cp[1] == ':')) - { - /* skip all chars that are part of a name */ - n = vtkParse_NameLength(cp); - - if ((n == 6 && strncmp("static", cp, n) == 0) || - (n == 4 && strncmp("auto", cp, n) == 0) || - (n == 8 && strncmp("register", cp, n) == 0) || - (n == 8 && strncmp("volatile", cp, n) == 0)) - { - if (strncmp("static", cp, n) == 0) - { - static_bits = VTK_PARSE_STATIC; - } - } - else if (n == 5 && strncmp(cp, "const", n) == 0) - { - const_bits |= VTK_PARSE_CONST; - } - else if (n == 8 && strncmp(cp, "unsigned", n) == 0) - { - unsigned_bits |= VTK_PARSE_UNSIGNED; - if (base_bits == 0) - { - classname = "int"; - base_bits = VTK_PARSE_INT; - } - } - else if (n == 6 && strncmp(cp, "signed", n) == 0) - { - if (base_bits == VTK_PARSE_CHAR) - { - classname = "signed char"; - base_bits = VTK_PARSE_SIGNED_CHAR; - } - else - { - classname = "int"; - base_bits = VTK_PARSE_INT; - } - } - else if (n == 3 && strncmp(cp, "int", n) == 0) - { - if (base_bits == 0) - { - classname = "int"; - base_bits = VTK_PARSE_INT; - } - } - else if (n == 4 && strncmp(cp, "long", n) == 0) - { - if (base_bits == VTK_PARSE_DOUBLE) - { - classname = "long double"; - base_bits = VTK_PARSE_LONG_DOUBLE; - } - else if (base_bits == VTK_PARSE_LONG) - { - classname = "long long"; - base_bits = VTK_PARSE_LONG_LONG; - } - else - { - classname = "long"; - base_bits = VTK_PARSE_LONG; - } - } - else if (n == 5 && strncmp(cp, "short", n) == 0) - { - classname = "short"; - base_bits = VTK_PARSE_SHORT; - } - else if (n == 4 && strncmp(cp, "char", n) == 0) - { - if (base_bits == VTK_PARSE_INT && unsigned_bits != VTK_PARSE_UNSIGNED) - { - classname = "signed char"; - base_bits = VTK_PARSE_SIGNED_CHAR; - } - else - { - classname = "char"; - base_bits = VTK_PARSE_CHAR; - } - } - else if (n == 5 && strncmp(cp, "float", n) == 0) - { - classname = "float"; - base_bits = VTK_PARSE_FLOAT; - } - else if (n == 6 && strncmp(cp, "double", n) == 0) - { - if (base_bits == VTK_PARSE_LONG) - { - classname = "long double"; - base_bits = VTK_PARSE_LONG_DOUBLE; - } - else - { - classname = "double"; - base_bits = VTK_PARSE_DOUBLE; - } - } - else if (n == 4 && strncmp(cp, "bool", n) == 0) - { - classname = "bool"; - base_bits = VTK_PARSE_BOOL; - } - else if (n == 4 && strncmp(cp, "void", n) == 0) - { - classname = "void"; - base_bits = VTK_PARSE_VOID; - } - else if (n == 7 && strncmp(cp, "__int64", n) == 0) - { - classname = "__int64"; - base_bits = VTK_PARSE___INT64; - } - else - { - /* if type already found, break */ - if (base_bits != 0) - { - break; - } - - /* check vtk typedefs */ - if (strncmp(cp, "vtk", 3) == 0) - { - for (i = 0; vtktypes[i].len != 0; i++) - { - if (n == vtktypes[i].len && strncmp(cp, vtktypes[i].name, n) == 0) - { - classname = vtktypes[i].name; - base_bits = vtkParse_MapType((int)vtktypes[i].type); - } - } - } - - /* check standard typedefs */ - if (base_bits == 0) - { - m = 0; - if (strncmp(cp, "::", 2) == 0) { m = 2; } - else if (strncmp(cp, "std::", 5) == 0) { m = 5; } - else if (strncmp(cp, "vtkstd::", 8) == 0) { m = 8; } - - /* advance past the namespace */ - tmpcp = cp + m; - - for (i = 0; stdtypes[i].len != 0; i++) - { - if (n == stdtypes[i].len && strncmp(tmpcp, stdtypes[i].name, n) == 0) - { - classname = stdtypes[i].name; - base_bits = stdtypes[i].type; - } - } - - /* include the namespace if present */ - if (base_bits != 0 && m > 0) - { - classname = cp; - len = n; - } - } - - /* anything else is assumed to be a class, enum, or who knows */ - if (base_bits == 0) - { - base_bits = VTK_PARSE_UNKNOWN; - classname = cp; - len = n; - - /* VTK classes all start with vtk */ - if (strncmp(classname, "vtk", 3) == 0) - { - base_bits = VTK_PARSE_OBJECT; - /* make sure the "vtk" isn't just part of the namespace */ - for (k = 0; k < n; k++) - { - if (cp[k] == ':') - { - base_bits = VTK_PARSE_UNKNOWN; - break; - } - } - } - /* Qt objects and enums */ - else if (classname[0] == 'Q' && - ((classname[1] >= 'A' && classname[2] <= 'Z') || - strncmp(classname, "Qt::", 4) == 0)) - { - base_bits = VTK_PARSE_QOBJECT; - } - } - } - - cp += n; - while (*cp == ' ' || *cp == '\t') { cp++; } - } - - if ((unsigned_bits & VTK_PARSE_UNSIGNED) != 0) - { - switch (base_bits) - { - case VTK_PARSE_CHAR: - classname = "unsigned char"; - break; - case VTK_PARSE_SHORT: - classname = "unsigned short"; - break; - case VTK_PARSE_INT: - classname = "unsigned int"; - break; - case VTK_PARSE_LONG: - classname = "unsigned long"; - break; - case VTK_PARSE_LONG_LONG: - classname = "unsigned long long"; - break; - case VTK_PARSE___INT64: - classname = "unsigned __int64"; - break; - } - } - - *type_ptr = (static_bits | const_bits | unsigned_bits | base_bits); - - if (classname_ptr) - { - *classname_ptr = classname; - if (len == 0) - { - len = strlen(classname); - } - *len_ptr = len; - } - - return (size_t)(cp - text); -} - -/* Parse a type description in "text" and generate a typedef named "name" */ -size_t vtkParse_ValueInfoFromString( - ValueInfo *data, StringCache *cache, const char *text) -{ - const char *cp = text; - size_t n; - int m, count; - unsigned int base_bits = 0; - unsigned int pointer_bits = 0; - unsigned int ref_bits = 0; - const char *classname = NULL; - - /* get the basic type with qualifiers */ - cp += vtkParse_BasicTypeFromString(cp, &base_bits, &classname, &n); - - data->Class = vtkParse_CacheString(cache, classname, n); - - if ((base_bits & VTK_PARSE_STATIC) != 0) - { - data->IsStatic = 1; - } - - /* look for pointers (and const pointers) */ - while (*cp == '*') - { - cp++; - pointer_bits = (pointer_bits << 2); - while (*cp == ' ' || *cp == '\t') { cp++; } - if (strncmp(cp, "const", 5) == 0 && - (cp[5] < 'a' || cp[5] > 'z') && - (cp[5] < 'A' || cp[5] > 'Z') && - (cp[5] < '0' || cp[5] > '9') && - cp[5] != '_') - { - cp += 5; - while (*cp == ' ' || *cp == '\t') { cp++; } - pointer_bits = (pointer_bits | VTK_PARSE_CONST_POINTER); - } - else - { - pointer_bits = (pointer_bits | VTK_PARSE_POINTER); - } - pointer_bits = (pointer_bits & VTK_PARSE_POINTER_MASK); - } - - /* look for ref */ - if (*cp == '&') - { - cp++; - while (*cp == ' ' || *cp == '\t') { cp++; } - ref_bits = VTK_PARSE_REF; - } - - /* look for the variable name */ - if ((*cp >= 'a' && *cp <= 'z') || - (*cp >= 'A' && *cp <= 'Z') || - (*cp == '_')) - { - /* skip all chars that are part of a name */ - n = vtkparse_id_len(cp); - data->Name = vtkParse_CacheString(cache, cp, n); - cp += n; - while (*cp == ' ' || *cp == '\t') { cp++; } - } - - /* look for array brackets */ - if (*cp == '[') - { - count = 1; - } - - while (*cp == '[') - { - n = vtkparse_bracket_len(cp); - if (n > 1) - { - cp++; - n -= 2; - } - while (*cp == ' ' || *cp == '\t') { cp++; n--; } - while (n > 0 && (cp[n-1] == ' ' || cp[n-1] == '\t')) { n--; } - vtkParse_AddStringToArray( - &data->Dimensions, - &data->NumberOfDimensions, - vtkParse_CacheString(cache, cp, n)); - m = 0; - if (*cp >= '0' && *cp <= '9' && vtkparse_number_len(cp) == n) - { - m = (int)strtol(cp, NULL, 0); - } - count *= m; - - cp += n; - while (*cp == ' ' || *cp == '\t') { cp++; } - if (*cp == ']') { cp++; } - while (*cp == ' ' || *cp == '\t') { cp++; } - } - - /* add pointer indirection to correspond to first array dimension */ - if (data->NumberOfDimensions > 1) - { - pointer_bits = ((pointer_bits << 2) | VTK_PARSE_ARRAY); - } - else if (data->NumberOfDimensions == 1) - { - pointer_bits = ((pointer_bits << 2) | VTK_PARSE_POINTER); - } - pointer_bits = (pointer_bits & VTK_PARSE_POINTER_MASK); - - /* (Add code here to look for "=" followed by a value ) */ - - data->Type = (pointer_bits | ref_bits | base_bits); - - return (cp - text); -} - -/* Generate a C++ declaration string from a ValueInfo struct */ -const char *vtkParse_ValueInfoToString( - ValueInfo *data, int *needs_free) -{ - unsigned int pointer_bits = (data->Type & VTK_PARSE_POINTER_MASK); - unsigned int ref_bits = (data->Type & VTK_PARSE_REF); - unsigned int qualifier_bits = (data->Type & VTK_PARSE_CONST); - unsigned int reverse_bits = 0; - unsigned int pointer_type = 0; - const char *classname = data->Class; - const char *name = data->Name; - char *text = NULL; - size_t i = 0; - size_t l; - int j = 0; - - if (pointer_bits == 0 && ref_bits == 0 && qualifier_bits == 0 && - name == NULL) - { - if (needs_free) - { - *needs_free = 0; - } - return classname; - } - - /* compute the length of string to allocate */ - l = 6; /* for const */ - l += 4*7; /* for pointers */ - l += 1; /* for ref */ - l += strlen(classname) + 1; /* for type */ - for (j = 0; j < data->NumberOfDimensions; j++) - { - l += 2 + strlen(data->Dimensions[j]); - } - l++; /* for NULL */ - l += 4; /* for safety */ - - text = (char *)malloc(l); - - if ((qualifier_bits & VTK_PARSE_CONST) != 0) - { - strcpy(&text[i], "const "); - i += 6; - } - - strcpy(&text[i], classname); - i += strlen(classname); - text[i++] = ' '; - - while (pointer_bits != 0) - { - reverse_bits <<= 2; - reverse_bits |= (pointer_bits & VTK_PARSE_POINTER_LOWMASK); - pointer_bits = ((pointer_bits >> 2) & VTK_PARSE_POINTER_MASK); - } - - while (reverse_bits != 0) - { - pointer_type = (reverse_bits & VTK_PARSE_POINTER_LOWMASK); - if (pointer_type == VTK_PARSE_ARRAY || - (reverse_bits == VTK_PARSE_POINTER && - data->NumberOfDimensions > 0)) - { - break; - } - else if (pointer_type == VTK_PARSE_POINTER) - { - text[i++] = '*'; - } - else if (pointer_type == VTK_PARSE_CONST_POINTER) - { - strcpy(&text[i], "*const "); - i += 7; - } - - reverse_bits = ((reverse_bits >> 2) & VTK_PARSE_POINTER_MASK); - } - - if (ref_bits) - { - text[i++] = '&'; - } - - if (name) - { - strcpy(&text[i], name); - i += strlen(name); - } - - for (j = 0; j < data->NumberOfDimensions; j++) - { - text[i++] = '['; - if (data->Dimensions[j]) - { - strcpy(&text[i], data->Dimensions[j]); - i += strlen(data->Dimensions[j]); - } - text[i++] = ']'; - } - - text[i] = '\0'; - - /* make sure enough space was allocated */ - assert(i < l); - - if (needs_free) - { - *needs_free = 1; - } - - return text; -} - -/* Search and replace, return the initial string if no replacements - * occurred, otherwise return a new string allocated with malloc. */ -const char *vtkParse_StringReplace( - const char *str1, int n, const char *name[], const char *val[]) -{ - return vtkparse_string_replace(NULL, str1, n, name, val); -} - -/* substitute generic types and values with actual types and values */ -static void func_substitution( - FunctionInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]); - -static void value_substitution( - ValueInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]) -{ - vtkParse_ExpandTypedefs(data, cache, m, arg_names, arg_values, arg_types); - vtkParse_ExpandValues(data, cache, m, arg_names, arg_values); - - if (data->Function) - { - func_substitution( - data->Function, cache, m, arg_names, arg_values, arg_types); - } -} - -static void func_substitution( - FunctionInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]) -{ - int i, n; - - n = data->NumberOfParameters; - for (i = 0; i < n; i++) - { - value_substitution( - data->Parameters[i], cache, m, arg_names, arg_values, arg_types); - } - - if (data->ReturnValue) - { - value_substitution( - data->ReturnValue, cache, m, arg_names, arg_values, arg_types); - } - - if (data->Signature) - { - data->Signature = - vtkparse_string_replace( - cache, data->Signature, m, arg_names, arg_values); - } - - /* legacy information for old wrappers */ -#ifndef VTK_PARSE_LEGACY_REMOVE - n = data->NumberOfArguments; - for (i = 0; i < n; i++) - { - data->ArgTypes[i] = data->Parameters[i]->Type; - data->ArgClasses[i] = data->Parameters[i]->Class; - if (data->Parameters[i]->NumberOfDimensions == 1 && - data->Parameters[i]->Count > 0) - { - data->ArgCounts[i] = data->Parameters[i]->Count; - } - } - - if (data->ReturnValue) - { - data->ReturnType = data->ReturnValue->Type; - data->ReturnClass = data->ReturnValue->Class; - if (data->ReturnValue->NumberOfDimensions == 1 && - data->ReturnValue->Count > 0) - { - data->HintSize = data->ReturnValue->Count; - data->HaveHint = 1; - } - } -#endif /* VTK_PARSE_LEGACY_REMOVE */ -} - -static void class_substitution( - ClassInfo *data, StringCache *cache, - int m, const char *arg_names[], - const char *arg_values[], ValueInfo *arg_types[]) -{ - int i, n; - - /* superclasses may be templated */ - n = data->NumberOfSuperClasses; - for (i = 0; i < n; i++) - { - data->SuperClasses[i] = vtkparse_string_replace( - cache, data->SuperClasses[i], m, arg_names, arg_values); - } - - n = data->NumberOfClasses; - for (i = 0; i < n; i++) - { - class_substitution( - data->Classes[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfFunctions; - for (i = 0; i < n; i++) - { - func_substitution( - data->Functions[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfConstants; - for (i = 0; i < n; i++) - { - value_substitution( - data->Constants[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfVariables; - for (i = 0; i < n; i++) - { - value_substitution( - data->Variables[i], cache, m, arg_names, arg_values, arg_types); - } - - n = data->NumberOfTypedefs; - for (i = 0; i < n; i++) - { - value_substitution( - data->Typedefs[i], cache, m, arg_names, arg_values, arg_types); - } -} - -/* Extract template args from a comma-separated list enclosed - * in angle brackets. Returns zero if no angle brackets found. */ -size_t vtkParse_DecomposeTemplatedType( - const char *text, const char **classname, - int nargs, const char ***argp, const char *defaults[]) -{ - size_t i, j, k, n; - const char *arg; - char *new_text; - const char **template_args = NULL; - int template_arg_count = 0; - - n = vtkParse_NameLength(text); - - /* is the class templated? */ - for (i = 0; i < n; i++) - { - if (text[i] == '<') - { - break; - } - } - - if (classname) - { - new_text = (char *)malloc(i + 1); - strncpy(new_text, text, i); - new_text[i] = '\0'; - *classname = new_text; - } - - if (text[i] == '<') - { - i++; - /* extract the template arguments */ - for (;;) - { - while (text[i] == ' ' || text[i] == '\t') { i++; } - j = i; - while (text[j] != ',' && text[j] != '>' && - text[j] != '\n' && text[j] != '\0') - { - if (text[j] == '<' || text[j] == '(' || - text[j] == '[' || text[j] == '{') - { - j += vtkparse_bracket_len(&text[j]); - } - else if (text[j] == '\'' || text[j] == '\"') - { - j += vtkparse_quote_len(&text[j]); - } - else - { - j++; - } - } - - k = j; - while (text[k-1] == ' ' || text[k-1] == '\t') { --k; } - - new_text = (char *)malloc(k-i + 1); - strncpy(new_text, &text[i], k-i); - new_text[k-i] = '\0'; - vtkParse_AddStringToArray(&template_args, &template_arg_count, - new_text); - - assert(template_arg_count <= nargs); - - i = j + 1; - - if (text[j] != ',') - { - break; - } - } - } - - while (template_arg_count < nargs) - { - assert(defaults != NULL); - arg = defaults[template_arg_count]; - assert(arg != NULL); - new_text = (char *)malloc(strlen(arg + 1)); - strcpy(new_text, arg); - vtkParse_AddStringToArray(&template_args, &template_arg_count, new_text); - } - - *argp = template_args; - - return i; -} - -/* Free the list of strings returned by ExtractTemplateArgs. */ -void vtkParse_FreeTemplateDecomposition( - const char *name, int n, const char **args) -{ - int i; - - if (name) - { - free((char *)name); - } - - if (n > 0) - { - for (i = 0; i < n; i++) - { - free((char *)args[i]); - } - - free((char **)args); - } -} - -/* Instantiate a class template by substituting the provided arguments. */ -void vtkParse_InstantiateClassTemplate( - ClassInfo *data, StringCache *cache, int n, const char *args[]) -{ - TemplateInfo *t = data->Template; - const char **new_args = NULL; - const char **arg_names = NULL; - ValueInfo **arg_types = NULL; - int i, m; - char *new_name; - size_t k; - - if (t == NULL) - { - fprintf(stderr, "vtkParse_InstantiateClassTemplate: " - "this class is not templated.\n"); - return; - } - - m = t->NumberOfParameters; - if (n > m) - { - fprintf(stderr, "vtkParse_InstantiateClassTemplate: " - "too many template args.\n"); - return; - } - - for (i = n; i < m; i++) - { - if (t->Parameters[i]->Value == NULL || - t->Parameters[i]->Value[0] == '\0') - { - fprintf(stderr, "vtkParse_InstantiateClassTemplate: " - "too few template args.\n"); - return; - } - } - - new_args = (const char **)malloc(m*sizeof(char **)); - for (i = 0; i < n; i++) - { - new_args[i] = args[i]; - } - for (i = n; i < m; i++) - { - new_args[i] = t->Parameters[i]->Value; - } - args = new_args; - - arg_names = (const char **)malloc(m*sizeof(char **)); - arg_types = (ValueInfo **)malloc(m*sizeof(ValueInfo *)); - for (i = 0; i < m; i++) - { - arg_names[i] = t->Parameters[i]->Name; - arg_types[i] = NULL; - if (t->Parameters[i]->Type == 0) - { - arg_types[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(arg_types[i]); - vtkParse_ValueInfoFromString(arg_types[i], cache, args[i]); - arg_types[i]->ItemType = VTK_TYPEDEF_INFO; - arg_types[i]->Name = arg_names[i]; - } - } - - /* no longer a template (has been instantiated) */ - if (data->Template) - { - vtkParse_FreeTemplate(data->Template); - } - data->Template = NULL; - - /* append template args to class name */ - k = strlen(data->Name) + 2; - for (i = 0; i < m; i++) - { - k += strlen(args[i]) + 2; - } - new_name = (char *)malloc(k); - strcpy(new_name, data->Name); - k = strlen(new_name); - new_name[k++] = '<'; - for (i = 0; i < m; i++) - { - strcpy(&new_name[k], args[i]); - k += strlen(args[i]); - if (i+1 < m) - { - new_name[k++] = ','; - new_name[k++] = ' '; - } - } - if (new_name[k-1] == '>') - { - new_name[k++] = ' '; - } - new_name[k++] = '>'; - new_name[k] = '\0'; - - data->Name = vtkParse_CacheString(cache, new_name, k); - free(new_name); - - /* do the template arg substitution */ - class_substitution(data, cache, m, arg_names, args, arg_types); - - /* free all allocated arrays */ - free((char **)new_args); - free((char **)arg_names); - - for (i = 0; i < m; i++) - { - if (arg_types[i]) - { - vtkParse_FreeValue(arg_types[i]); - } - } - free(arg_types); -} - -/* Get a zero-terminated array of the types in vtkTemplateMacro. */ -const char **vtkParse_GetTemplateMacroTypes() -{ - static const char *types[] = { - "char", "signed char", "unsigned char", "short", "unsigned short", - "int", "unsigned int", "long", "unsigned long", -#ifdef VTK_TYPE_USE_LONG_LONG - "long long", "unsigned long long", -#endif -#ifdef VTK_TYPE_USE___INT64 - "__int64", "unsigned __int64", -#endif - "float", "double", NULL }; - - return types; -} - -/* Get a zero-terminated array of the types in vtkArray. */ -const char **vtkParse_GetArrayTypes() -{ - static const char *types[] = { - "char", "signed char", "unsigned char", "short", "unsigned short", - "int", "unsigned int", "long", "unsigned long", -#ifdef VTK_TYPE_USE_LONG_LONG - "long long", "unsigned long long", -#endif -#ifdef VTK_TYPE_USE___INT64 - "__int64", "unsigned __int64", -#endif - "float", "double", - "vtkStdString", "vtkUnicodeString", "vtkVariant", NULL }; - - return types; -} diff --git a/src/ParaView/vtkParseExtras.h b/src/ParaView/vtkParseExtras.h deleted file mode 100644 index 3f3dceca..00000000 --- a/src/ParaView/vtkParseExtras.h +++ /dev/null @@ -1,173 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseExtras.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2011 David Gobbi. - - Contributed to the VisualizationToolkit by the author in May 2011 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - * This file contains extra utilities for parsing and wrapping. - */ - -#ifndef VTK_PARSE_EXTRAS_H -#define VTK_PARSE_EXTRAS_H - -#include "vtkParseData.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Skip over a sequence of characters that begin with an alphabetic - * character or an underscore, and include only alphanumeric - * characters or underscores. Return the number of characters. - */ -size_t vtkParse_IdentifierLength(const char *text); - -/** - * Skip over a name, including any namespace prefixes and - * any template arguments. Return the number of characters. - * Examples are "name", "::name", "name", "name::name2", - * "::name::name2". - */ -size_t vtkParse_NameLength(const char *text); - -/** - * Skip over a name, including any template arguments, but stopping - * if a '::' is encoutered. Return the number of characters. - * Examples are "name" and "name" - */ -size_t vtkParse_UnscopedNameLength(const char *text); - -/** - * Skip over a literal, which may be a number, a char in single - * quotes, a string in double quotes, or a name, or a name followed - * by arguments in parentheses. - */ -size_t vtkParse_LiteralLength(const char *text); - -/** - * Get a type from a type name, and return the number of characters used. - * If the "classname" argument is not NULL, then it is used to return - * the short name for the type, e.g. "long int" becomes "long", while - * typedef names and class names are returned unchanged. If "const" - * appears in the type name, then the const bit flag is set for the - * type, but "const" will not appear in the returned classname. - */ -size_t vtkParse_BasicTypeFromString( - const char *text, unsigned int *type, - const char **classname, size_t *classname_len); - -/** - * Generate a ValueInfo by parsing the type from the provided text. - * Only simple text strings are supported, e.g. "const T **". - * Returns the number of characters consumed. - */ -size_t vtkParse_ValueInfoFromString( - ValueInfo *val, StringCache *cache, const char *text); - -/** - * Generate a declaration string from a ValueInfo struct. If the - * "nf" arg is set, the returned string must be freed. - * Only simple text strings are supported, e.g. "const T **". - * The variable or typedef name, if present, is ignored. - */ -const char *vtkParse_ValueInfoToString(ValueInfo *val, int *nf); - -/** - * Expand a typedef within a variable, parameter, or typedef declaration. - * The expansion is done in-place. - */ -void vtkParse_ExpandTypedef(ValueInfo *valinfo, ValueInfo *typedefinfo); - -/** - * Expand any unrecognized types within a variable, parameter, or typedef - * that match any of the supplied typedefs. The expansion is done in-place. - */ -void vtkParse_ExpandTypedefs( - ValueInfo *valinfo, StringCache *cache, - int n, const char *name[], const char *val[], - ValueInfo *typedefinfo[]); - -/** - * Wherever one of the specified names exists inside a Value or inside - * a Dimension size, replace it with the corresponding val string. - * This is used to replace constants with their values. - */ -void vtkParse_ExpandValues( - ValueInfo *valinfo, StringCache *cache, - int n, const char *name[], const char *val[]); - -/** - * Search and replace, return the initial string if no replacements - * occurred, else return a new string allocated with malloc. */ -const char *vtkParse_StringReplace( - const char *str1, int n, const char *name[], const char *val[]); - -/** - * Extract the class name and template args from a templated - * class type ID. Returns the full number of characters that - * were consumed during the decomposition. - */ -size_t vtkParse_DecomposeTemplatedType( - const char *text, const char **classname, - int n, const char ***args, const char *defaults[]); - -/** - * Free the list of strings returned by ExtractTemplateArgs. - */ -void vtkParse_FreeTemplateDecomposition( - const char *classname, int n, const char **args); - -/** - * Instantiate a class template by substituting the provided arguments - * for the template parameters. If "n" is less than the number of template - * parameters, then default parameter values (if present) will be used. - * If an error occurs, the error will be printed to stderr and NULL will - * be returned. - */ -void vtkParse_InstantiateClassTemplate( - ClassInfo *data, StringCache *cache, int n, const char *args[]); - -/** - * Instantiate a function or class method template by substituting the - * provided arguments for the template parameters. If "n" is less than - * the number of template parameters, then default parameter values - * (if present) will be used. If an error occurs, the error will be - * printed to stderr and NULL will be returned. - */ -void vtkParse_IntantiateFunctionTemplate( - FunctionInfo *data, int n, const char *args[]); - -/** - * Get a zero-terminated array of the types in vtkTemplateMacro. - */ -const char **vtkParse_GetTemplateMacroTypes(); - -/** - * Get a zero-terminated array of the types in vtkArray. - */ -const char **vtkParse_GetArrayTypes(); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkParseHierarchy.c b/src/ParaView/vtkParseHierarchy.c deleted file mode 100644 index aa9d1b63..00000000 --- a/src/ParaView/vtkParseHierarchy.c +++ /dev/null @@ -1,1014 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseHierarchy.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseHierarchy.h" -#include "vtkParseExtras.h" -#include -#include -#include -#include -#include - -static size_t skip_space(const char *text) -{ - size_t i = 0; - while (isspace(text[i]) && text[i] != '\n') { i++; } - return i; -} - -static size_t skip_expression(const char *text, const char *delims) -{ - char newdelims[2]; - size_t i = 0; - size_t j; - int use_angle = 0; - char c; - - for (j = 0; delims[j] != '\0'; j++) - { - if (delims[j] == '>') - { - use_angle = 1; - } - } - - while (text[i] != '\0') - { - c = text[i]; - j = 0; - while (c != delims[j] && delims[j] != '\0') { j++; } - if (delims[j] != '\0' || c == '\0') { break; } - if (c == '\"' || c == '\'') - { - char d = c; - i++; - while (text[i] != d && text[i] != '\0') - { - if (text[i] == '\\' && text[i+1] != '\0') { i++; } - i++; - } - c = text[i]; - if (c == '\0') { break; } - } - i++; - if (c == '(' || c == '[' || c == '{' || (use_angle && c == '<')) - { - if (c == '(') { newdelims[0] = ')'; } - if (c == '[') { newdelims[0] = ']'; } - if (c == '{') { newdelims[0] = '}'; } - if (c == '<') { newdelims[0] = '>'; } - newdelims[1] = '\0'; - - i += skip_expression(&text[i], newdelims); - - if (text[i] == newdelims[0]) { i++; } else { break; } - } - } - - return i; -} - -/* helper: comparison of entries */ -static int compare_hierarchy_entries(const void *vp1, const void *vp2) -{ - const HierarchyEntry *entry1 = (const HierarchyEntry *)vp1; - const HierarchyEntry *entry2 = (const HierarchyEntry *)vp2; - - return strcmp(entry1->Name, entry2->Name); -} - -/* helper: sort the entries to facilitate searching */ -static void sort_hierarchy_entries(HierarchyInfo *info) -{ - qsort(info->Entries, info->NumberOfEntries, sizeof(HierarchyEntry), - &compare_hierarchy_entries); -} - -/* Find an entry with a binary search */ -HierarchyEntry *vtkParseHierarchy_FindEntry( - const HierarchyInfo *info, const char *classname) -{ - HierarchyEntry key; - HierarchyEntry *entry; - size_t i, n; - char name[32]; - char *cp; - - /* use classname as-is for the search if possible */ - cp = (char *)classname; - - /* get portion of name before final template parameters */ - n = vtkParse_UnscopedNameLength(classname); - i = 0; - while (classname[i+n] == ':' && classname[i+n+1] == ':') - { - i += n + 2; - n = vtkParse_UnscopedNameLength(&classname[i]); - } - i += vtkParse_IdentifierLength(&classname[i]); - - /* create a new (shorter) search string if necessary */ - if (classname[i] != '\0') - { - /* use stack space if possible */ - cp = name; - /* otherwise, use malloc */ - if (i > 31) - { - cp = (char *)malloc(i+1); - } - strncpy(cp, classname, i); - cp[i] = '\0'; - } - - key.Name = cp; - - entry = (HierarchyEntry *)bsearch(&key, info->Entries, - info->NumberOfEntries, sizeof(HierarchyEntry), - &compare_hierarchy_entries); - - if (cp != classname && cp != name) - { - free(cp); - } - - return entry; -} - - -/* read a hierarchy file into a HeirarchyInfo struct, or return NULL */ -HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename) -{ - HierarchyInfo *info; - HierarchyEntry *entry; - int maxClasses = 500; - FILE *fp; - char *line; - char *cp; - const char *ccp; - size_t maxlen = 15; - size_t i, j, n, m; - unsigned int bits, pointers; - static const char *delims = ">,="; - - line = (char *)malloc(maxlen); - - fp = fopen(filename, "r"); - - if (fp == NULL) - { - return NULL; - } - - info = (HierarchyInfo *)malloc(sizeof(HierarchyInfo)); - info->NumberOfEntries = 0; - info->Entries = (HierarchyEntry *)malloc(maxClasses*sizeof(HierarchyEntry)); - info->Strings = (StringCache *)malloc(sizeof(StringCache)); - vtkParse_InitStringCache(info->Strings); - - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - while (n > 0 && isspace(line[n-1])) - { - n--; - } - line[n] = '\0'; - - if (line[0] == '\0') - { - continue; - } - - if (info->NumberOfEntries == maxClasses) - { - maxClasses *= 2; - info->Entries = (HierarchyEntry *)realloc( - info->Entries, sizeof(HierarchyEntry)*maxClasses*2); - } - - entry = &info->Entries[info->NumberOfEntries++]; - entry->Name = NULL; - entry->HeaderFile = NULL; - entry->Module = NULL; - entry->NumberOfTemplateParameters = 0; - entry->TemplateParameters = NULL; - entry->TemplateDefaults = NULL; - entry->NumberOfProperties = 0; - entry->Properties = NULL; - entry->NumberOfSuperClasses = 0; - entry->SuperClasses = NULL; - entry->SuperClassIndex = NULL; - entry->Typedef = NULL; - entry->IsTypedef = 0; - entry->IsEnum = 0; - - i = skip_space(line); - n = vtkParse_NameLength(&line[i]); - for (m = 0; m < n; m++) - { - if (line[i+m] == '<') { break; } - } - - entry->Name = vtkParse_CacheString(info->Strings, &line[i], m); - i += m; - - if (line[i] == '<') - { - i++; - i += skip_space(&line[i]); - - for (j = 0; line[i] != '>' && line[i] != '\0'; j++) - { - if (j == 0) - { - entry->TemplateParameters = (const char **)malloc(sizeof(char *)); - entry->TemplateDefaults = (const char **)malloc(sizeof(char *)); - } - else - { - entry->TemplateParameters = (const char **)realloc( - (char **)entry->TemplateParameters, (j+1)*sizeof(char *)); - entry->TemplateDefaults = (const char **)realloc( - (char **)entry->TemplateDefaults, (j+1)*sizeof(char *)); - } - entry->NumberOfTemplateParameters++; - entry->TemplateDefaults[j] = NULL; - - m = skip_expression(&line[i], delims); - while (m > 0 && (line[i+m-1] == ' ' || line[i+m-1] == '\t')) - { - --m; - } - - entry->TemplateParameters[j] = - vtkParse_CacheString(info->Strings, &line[i], m); - i += m; - i += skip_space(&line[i]); - - if (line[i] == '=') - { - i++; - i += skip_space(&line[i]); - m = skip_expression(&line[i], delims); - while (m > 0 && (line[i+m-1] == ' ' || line[i+m-1] == '\t')) - { - --m; - } - entry->TemplateDefaults[j] = - vtkParse_CacheString(info->Strings, &line[i], m); - i += m; - i += skip_space(&line[i]); - } - - if (line[i] == ',') - { - i++; - i += skip_space(&line[i]); - } - } - - if (line[i] == '>') - { - i++; - i += skip_space(&line[i]); - } - - if (line[i] == ':' && line[i+1] == ':') - { - i += 2; - m = vtkParse_NameLength(&line[i]); - n = strlen(entry->Name); - cp = vtkParse_NewString(info->Strings, n+m+2); - strcpy(cp, entry->Name); - strcpy(&cp[n], "::"); - strncpy(&cp[n+2], &line[i], m); - i += m; - cp[n+m+2] = '\0'; - entry->Name = cp; - } - } - - i += skip_space(&line[i]); - - /* classes (and possibly enums) */ - if (line[i] == ':') - { - i++; - i += skip_space(&line[i]); - n = vtkParse_NameLength(&line[i]); - /* check for enum indicators */ - if ((n == 3 && strncmp(&line[i], "int", n)) || - (n == 4 && strncmp(&line[i], "enum", n))) - { - entry->IsEnum = 1; - i += n; - i += skip_space(&line[i]); - } - /* else check for superclasses */ - else for (j = 0; ; j++) - { - if (j == 0) - { - entry->SuperClasses = (const char **)malloc(sizeof(char *)); - entry->SuperClassIndex = (int *)malloc(sizeof(int)); - } - else - { - entry->SuperClasses = (const char **)realloc( - (char **)entry->SuperClasses, (j+1)*sizeof(char *)); - entry->SuperClassIndex = (int *)realloc( - entry->SuperClassIndex, (j+1)*sizeof(int)); - } - entry->NumberOfSuperClasses++; - - i += skip_space(&line[i]); - n = vtkParse_NameLength(&line[i]); - entry->SuperClasses[j] = - vtkParse_CacheString(info->Strings, &line[i], n); - entry->SuperClassIndex[j] = -1; - i += n; - - i += skip_space(&line[i]); - if (line[i] != ',') - { - break; - } - i++; - } - } - - /* read typedefs */ - else if (line[i] == '=') - { - i++; - i += skip_space(&line[i]); - entry->IsTypedef = 1; - entry->Typedef = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(entry->Typedef); - - /* type is a reference (does this ever occur?) */ - if (line[i] == '&') - { - i++; - i += skip_space(&line[i]); - entry->Typedef->Type |= VTK_PARSE_REF; - } - - /* type has array dimensions */ - if (line[i] == '[') - { - entry->Typedef->Count = 1; - } - - while (line[i] == '[') - { - i++; - n = 0; - while (line[i+n] != ']' && line[i+n] != '\n' && line[i+n] != '\0') - { - n++; - } - ccp = vtkParse_CacheString(info->Strings, &line[i], n); - vtkParse_AddStringToArray(&entry->Typedef->Dimensions, - &entry->Typedef->NumberOfDimensions, ccp); - if (ccp[0] >= '0' && ccp[0] <= '9') - { - entry->Typedef->Count *= (int)strtol(ccp, NULL, 0); - } - else - { - entry->Typedef->Count = 0; - } - i += n; - if (line[i] == ']') - { - i++; - } - } - i += skip_space(&line[i]); - - /* look for pointers (and const pointers) */ - bits = 0; - while (line[i] == '*' || strncmp(&line[i], "const*", 6) == 0) - { - bits = (bits << 2); - if (line[i] == '*') - { - bits = (bits | VTK_PARSE_POINTER); - } - else - { - bits = (bits | VTK_PARSE_CONST_POINTER); - i += 5; - } - bits = (bits & VTK_PARSE_POINTER_MASK); - i++; - i += skip_space(&line[i]); - } - - /* need to reverse to get correct pointer order */ - pointers = 0; - while (bits) - { - pointers = (pointers << 2); - pointers = (pointers | (bits & VTK_PARSE_POINTER_LOWMASK)); - bits = ((bits >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* add pointer indirection to correspond to first array dimension */ - if (entry->Typedef->NumberOfDimensions > 1) - { - pointers = ((pointers << 2) | VTK_PARSE_ARRAY); - } - else if (entry->Typedef->NumberOfDimensions == 1) - { - pointers = ((pointers << 2) | VTK_PARSE_POINTER); - } - - /* include the pointers in the type */ - entry->Typedef->Type |= (pointers & VTK_PARSE_POINTER_MASK); - - /* read the base type (and const) */ - bits = 0; - i += vtkParse_BasicTypeFromString(&line[i], &bits, &ccp, &n); - entry->Typedef->Class = vtkParse_CacheString(info->Strings, ccp, n); - entry->Typedef->Type |= bits; - } - - /* get the header file */ - if (line[i] == ';') - { - i++; - i += skip_space(&line[i]); - n = 0; - while(line[i+n] != '\0' && line[i+n] != ';' && - !isspace(line[i+n])) { n++; }; - entry->HeaderFile = vtkParse_CacheString(info->Strings, &line[i], n); - - i += n; - i += skip_space(&line[i]); - - /* get the module */ - if (line[i] == ';') - { - i++; - i += skip_space(&line[i]); - n = 0; - while(line[i+n] != '\0' && line[i+n] != ';' && - !isspace(line[i+n])) { n++; }; - entry->Module = vtkParse_CacheString(info->Strings, &line[i], n); - - i += n; - i += skip_space(&line[i]); - } - - /* get all flags */ - while (line[i] == ';') - { - i++; - i += skip_space(&line[i]); - if (entry->NumberOfProperties == 0) - { - entry->Properties = (const char **)malloc(sizeof(char **)); - } - else - { - entry->Properties = (const char **)realloc( - (char **)entry->Properties, - (entry->NumberOfProperties+1)*sizeof(char **)); - } - n = 0; - while (line[i+n] != '\0' && line[i+n] != '\n' && line[i+n] != ';') - { n++; } - if (n && skip_space(&line[i]) != n) - { - entry->Properties[entry->NumberOfProperties++] = - vtkParse_CacheString(info->Strings, &line[i], n); - } - i += n; - } - } - } - - if (!feof(fp)) - { - vtkParseHierarchy_Free(info); - info = NULL; - } - - free(line); - - sort_hierarchy_entries(info); - - return info; -} - -/* free a HierarchyInfo struct */ -void vtkParseHierarchy_Free(HierarchyInfo *info) -{ - HierarchyEntry *entry; - int i; - - for (i = 0; i < info->NumberOfEntries; i++) - { - entry = &info->Entries[i]; - if (entry->NumberOfTemplateParameters) - { - free((char **)entry->TemplateParameters); - free((char **)entry->TemplateDefaults); - } - if (entry->NumberOfSuperClasses) - { - free((char **)entry->SuperClasses); - free(entry->SuperClassIndex); - } - if (entry->NumberOfProperties) - { - free((char **)entry->Properties); - } - } - - free(info->Entries); - free(info); -} - - -/* Check whether class is derived from baseclass. You must supply - * the entry for the class (returned by FindEntry) as well as the - * classname. If the class is templated, the classname can include - * template args in angle brackets. If you provide a pointer for - * baseclass_with_args, then it will be used to return the name of - * name of the baseclass with template args in angle brackets. */ - -int vtkParseHierarchy_IsTypeOfTemplated( - const HierarchyInfo *info, - const HierarchyEntry *entry, const char *classname, - const char *baseclass, const char **baseclass_with_args) -{ - HierarchyEntry *tmph; - const char *name; - const char *supername; - char *tmp; - int templated; - int baseclass_is_template_parameter; - int supername_needs_free = 0; - int classname_needs_free = 0; - int i, j, k; - int nargs; - const char **args; - size_t m; - int iterating = 1; - int rval = 0; - - while (iterating) - { - iterating = 0; - templated = 0; - baseclass_is_template_parameter = 0; - nargs = 0; - args = NULL; - - /* if classname is the same as baseclass, done! */ - if (strcmp(entry->Name, baseclass) == 0) - { - if (baseclass_with_args) - { - if (!classname_needs_free) - { - tmp = (char *)malloc(strlen(classname) + 1); - strcpy(tmp, classname); - classname = tmp; - } - *baseclass_with_args = classname; - classname_needs_free = 0; - } - rval = 1; - break; - } - else if (entry->NumberOfSuperClasses == 0) - { - rval = 0; - break; - } - - /* if class is templated */ - if (entry->NumberOfTemplateParameters) - { - /* check for template args for classname */ - m = strlen(entry->Name); - if (classname[m] == '<') - { - templated = 1; - - nargs = entry->NumberOfTemplateParameters; - vtkParse_DecomposeTemplatedType(classname, &name, nargs, &args, - entry->TemplateDefaults); - } - } - - /* check all baseclasses */ - for (j = 0; j < entry->NumberOfSuperClasses && rval == 0; j++) - { - supername = entry->SuperClasses[j]; - - if (templated) - { - for (k = 0; k < entry->NumberOfTemplateParameters; k++) - { - /* check if the baseclass itself is a template parameter */ - m = strlen(entry->TemplateParameters[k]); - if (strncmp(entry->TemplateParameters[k], supername, m) == 0 && - !isalnum(supername[m]) && supername[m] != '_') - { - baseclass_is_template_parameter = 1; - break; - } - } - - /* use the class template args to find baseclass template args */ - supername = vtkParse_StringReplace( - supername, entry->NumberOfTemplateParameters, entry->TemplateParameters, args); - if (supername != entry->SuperClasses[j]) - { - supername_needs_free = 1; - } - } - - /* check the cached index for the baseclass entry */ - i = entry->SuperClassIndex[j]; - if (i == -1) - { - /* index was not set yet, so search for the entry */ - tmph = vtkParseHierarchy_FindEntry(info, supername); - while (tmph && tmph->IsTypedef) - { - if (tmph->Typedef->Class) - { - tmph = vtkParseHierarchy_FindEntry(info, tmph->Typedef->Class); - continue; - } - break; - } - - if (tmph) - { - i = (int)(tmph - info->Entries); - } - else - { - /* entry not found, don't try again */ - /* i = -2; messes things up for templates */ - /* fprintf(stderr, "not found \"%s\"\n", entry->SuperClasses[j]); */ - } - - /* if baseclass is a template parameter, its entry cannot be cached */ - if (!baseclass_is_template_parameter) - { - /* cache the position of the baseclass */ - ((HierarchyEntry *)entry)->SuperClassIndex[j] = i; - } - } - - /* if entry was found, continue down the chain */ - if (i >= 0) - { - if (classname_needs_free) - { - free((char *)classname); - } - classname = supername; - classname_needs_free = supername_needs_free; - supername_needs_free = 0; - - /* use the iteration loop instead of recursion */ - if (j+1 >= entry->NumberOfSuperClasses) - { - entry = &info->Entries[i]; - iterating = 1; - } - - /* recurse for multiple inheritance */ - else - { - rval = vtkParseHierarchy_IsTypeOfTemplated( - info, &info->Entries[i], classname, baseclass, - baseclass_with_args); - } - } - - if (supername_needs_free) - { - free((char *)supername); - supername_needs_free = 0; - } - - } /* end of loop over superclasses */ - - if (templated) - { - vtkParse_FreeTemplateDecomposition(name, nargs, args); - } - - } /* end of "while (iterating)" */ - - if (classname_needs_free) - { - free((char *)classname); - } - - if (baseclass_with_args && !rval) - { - *baseclass_with_args = NULL; - } - - return rval; -} - -int vtkParseHierarchy_IsTypeOf( - const HierarchyInfo *info, const HierarchyEntry *entry, - const char *baseclass) -{ - return vtkParseHierarchy_IsTypeOfTemplated( - info, entry, entry->Name, baseclass, NULL); -} - -/* Free args returned by IsTypeOfTemplated */ -void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]) -{ - int i; - - for (i = 0; i < n; i++) - { - free((char *)args[i]); - } - - free((char **)args); -} - -/* Given a classname with template parameters, get the superclass name - * with corresponding template parameters. Returns null if 'i' is out - * of range, i.e. greater than or equal to the number of superclasses. - * The returned classname must be freed with "free()". */ -const char *vtkParseHierarchy_TemplatedSuperClass( - const HierarchyEntry *entry, const char *classname, int i) -{ - const char *supername = NULL; - const char *name; - const char **args; - char *cp; - size_t j; - - if (i < entry->NumberOfSuperClasses) - { - supername = entry->SuperClasses[i]; - j = vtkParse_IdentifierLength(classname); - - if (classname[j] == '<') - { - vtkParse_DecomposeTemplatedType(classname, &name, - entry->NumberOfTemplateParameters, &args, entry->TemplateDefaults); - supername = vtkParse_StringReplace(entry->SuperClasses[i], - entry->NumberOfTemplateParameters, entry->TemplateParameters, args); - vtkParse_FreeTemplateDecomposition( - name, entry->NumberOfTemplateParameters, args); - } - - if (supername == entry->SuperClasses[i]) - { - cp = (char *)malloc(strlen(supername) + 1); - strcpy(cp, supername); - supername = cp; - } - } - - return supername; -} - -/* get the specified property, or return NULL */ -const char *vtkParseHierarchy_GetProperty( - const HierarchyEntry *entry, const char *property) -{ - int i; - size_t k; - - if (entry) - { - for (i = 0; i < entry->NumberOfProperties; i++) - { - /* skip the property name, everything after is the property */ - k = vtkParse_NameLength(entry->Properties[i]); - if (k == strlen(property) && - strncmp(entry->Properties[i], property, k) == 0) - { - if (entry->Properties[i][k] == ' ' || - entry->Properties[i][k] == '=') { k++; } - return &entry->Properties[i][k]; - } - } - } - - return NULL; -} - -/* Expand all unrecognized types in a ValueInfo struct by - * using the typedefs in the HierarchyInfo struct. */ -int vtkParseHierarchy_ExpandTypedefsInValue( - const HierarchyInfo *info, ValueInfo *val, StringCache *cache, - const char *scope) -{ - char text[128]; - char *cp; - const char *newclass; - size_t n, m; - int i; - HierarchyEntry *entry; - int scope_needs_free = 0; - int result = 1; - - while (((val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT || - (val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) && - val->Class != 0) - { - entry = 0; - - /* search for the type in the provided scope */ - while (entry == 0 && scope != 0) - { - cp = text; - n = strlen(scope); - m = strlen(val->Class); - /* only malloc if more than 128 chars needed */ - if (n + m + 2 >= 128) - { - cp = (char *)malloc(n+m+3); - } - - /* scope the name */ - strncpy(cp, scope, n); - cp[n++] = ':'; - cp[n++] = ':'; - strncpy(&cp[n], val->Class, m); - cp[n+m] = '\0'; - - entry = vtkParseHierarchy_FindEntry(info, cp); - - if (cp != text) { free(cp); } - - /* if not found, try inherited scopes */ - if (entry == 0) - { - entry = vtkParseHierarchy_FindEntry(info, scope); - scope = 0; - scope_needs_free = 0; - if (entry && entry->NumberOfSuperClasses) - { - for (i = 0; i+1 < entry->NumberOfSuperClasses; i++) - { - if (scope_needs_free) { free((char *)scope); } - scope = vtkParseHierarchy_ExpandTypedefsInName( - info, entry->SuperClasses[i], NULL); - scope_needs_free = (scope != entry->SuperClasses[i]); - /* recurse if more than one superclass */ - if (vtkParseHierarchy_ExpandTypedefsInValue( - info, val, cache, scope)) - { - if (scope_needs_free) { free((char *)scope); } - return 1; - } - } - if (scope_needs_free) { free((char *)scope); } - scope = vtkParseHierarchy_ExpandTypedefsInName( - info, entry->SuperClasses[i], NULL); - scope_needs_free = (scope != entry->SuperClasses[i]); - } - entry = 0; - } - } - - /* if not found, try again with no scope */ - if (entry == 0) - { - entry = vtkParseHierarchy_FindEntry(info, val->Class); - } - - if (entry && entry->IsTypedef) - { - vtkParse_ExpandTypedef(val, entry->Typedef); - } - else if (entry) - { - newclass = vtkParseHierarchy_ExpandTypedefsInName( - info, val->Class, scope); - if (newclass != val->Class) - { - val->Class = vtkParse_CacheString(cache, newclass, strlen(newclass)); - free((char *)newclass); - } - result = 1; - break; - } - else - { - result = 0; - break; - } - } - - if (scope_needs_free) { free((char *)scope); } - - return result; -} - -/* Expand typedefs found in an expression stored as a string. - * The value of "text" will be returned if no expansion occurred, - * else a new string is returned that must be freed with "free()". */ -const char *vtkParseHierarchy_ExpandTypedefsInName( - const HierarchyInfo *info, const char *name, const char *scope) -{ - char text[128]; - char *cp; - size_t n, m; - const char *newname = name; - HierarchyEntry *entry = NULL; - - /* note: unlike ExpandTypedefsInValue, this does not yet recurse - * or look in superclass scopes */ - - /* doesn't yet handle names that are scoped or templated */ - m = vtkParse_IdentifierLength(name); - if (name[m] != '\0') - { - return name; - } - - if (scope) - { - cp = text; - n = strlen(scope); - m = strlen(name); - /* only malloc if more than 128 chars needed */ - if (n + m + 2 >= 128) - { - cp = (char *)malloc(n+m+3); - } - - /* scope the name */ - strncpy(cp, scope, n); - cp[n++] = ':'; - cp[n++] = ':'; - strncpy(&cp[n], name, m); - cp[n+m] = '\0'; - - entry = vtkParseHierarchy_FindEntry(info, cp); - - if (cp != text) { free(cp); } - } - - if (!entry) - { - entry = vtkParseHierarchy_FindEntry(info, name); - } - - newname = NULL; - if (entry && entry->IsTypedef && entry->Typedef->Class) - { - newname = entry->Typedef->Class; - } - if (newname) - { - cp = (char *)malloc(strlen(newname) + 1); - strcpy(cp, newname); - name = cp; - } - - return name; -} diff --git a/src/ParaView/vtkParseHierarchy.h b/src/ParaView/vtkParseHierarchy.h deleted file mode 100644 index 876702c1..00000000 --- a/src/ParaView/vtkParseHierarchy.h +++ /dev/null @@ -1,159 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseHierarchy.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. ---------------------------------------------------------------------------*/ - -/** - This file contains utility functions for loading and parsing - a VTK hierarchy file. The file contains entries like the - following (one per line in the file): - - classname [ : superclass ] ; header.h ; vtkKit [; flags] - - For each typedef, the output file will have a line like this: - - name = &[2][3]* const type ; header.h ; vtkKit [; flags] - - For each enum, the output file will have: - - enumname : enum ; header.h ; vtkKit [; flags] - -*/ - -#ifndef VTK_PARSE_HIERARCHY_H -#define VTK_PARSE_HIERARCHY_H - -/* Need the ValueInfo struct for typedefs */ -#include "vtkParseData.h" - -/** - * One entry from the hierarchy file. - * It contains a class name, the superclasses, and the header file. - */ -typedef struct _HierarchyEntry -{ - const char *Name; /* the class or type name */ - const char *HeaderFile; /* header file the class is defined in */ - const char *Module; /* library the class is defined in */ - int NumberOfTemplateParameters; /* number of template params */ - const char **TemplateParameters; - const char **TemplateDefaults; - int NumberOfProperties; /* number of properties */ - const char **Properties; - int NumberOfSuperClasses; /* number of superclasses */ - const char **SuperClasses; - int *SuperClassIndex; /* for internal use only */ - ValueInfo *Typedef; /* for typedefs */ - int IsEnum; /* this entry is for an enum type */ - int IsTypedef; /* this entry is for a typedef */ -} HierarchyEntry; - -/** - * All the entries from a hierarchy file. - */ -typedef struct _HierarchyInfo -{ - int NumberOfEntries; - HierarchyEntry *Entries; - StringCache *Strings; -} HierarchyInfo; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Read a hierarchy file into a HeirarchyInfo struct, or return NULL - */ -HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename); - -/** - * Free a HierarchyInfo struct - */ -void vtkParseHierarchy_Free(HierarchyInfo *info); - -/** - * Return the entry for a class or type, or null if not found - */ -HierarchyEntry *vtkParseHierarchy_FindEntry( - const HierarchyInfo *info, const char *classname); - -/** - * Get properties for the class. Returns NULL if the property - * is not set, and returns either an empty string or a value string - * if the property is set. The properties supported are as follows: - * "WRAP_EXCLUDE", "WRAP_SPECIAL", and "ABSTRACT" - */ -const char *vtkParseHierarchy_GetProperty( - const HierarchyEntry *entry, const char *property); - -/** - * Check whether class is derived from baseclass. - */ -int vtkParseHierarchy_IsTypeOf(const HierarchyInfo *info, - const HierarchyEntry *entry, const char *baseclass); - -/** - * Check whether class is derived from baseclass. You must supply - * the entry for the class (returned by FindEntry) as well as the - * classname. The classname can include template args in angle brackets. - * The baseclass_with_args parameter, if not set to NULL, will be used - * to return the name of base class with the template args in angle - * brackets that classname was derived from. If not set to NULL, - * this should be freed with free() to avoid a memory leak. - */ -int vtkParseHierarchy_IsTypeOfTemplated(const HierarchyInfo *info, - const HierarchyEntry *entry, const char *classname, - const char *baseclass, const char **baseclass_with_args); - -/** - * Free the template args returned by IsTypeOfTemplated - */ -void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]); - -/** - * Given a classname with template parameters, get the superclass name - * with corresponding template parameters. Returns null if 'i' is out - * of range, i.e. greater than or equal to the number of superclasses. - * The returned classname must be freed with "free()". - */ -const char *vtkParseHierarchy_TemplatedSuperClass( - const HierarchyEntry *entry, const char *classname, int i); - -/** - * Expand all unrecognized types in a ValueInfo struct by - * using the typedefs in the HierarchyInfo struct. - */ -int vtkParseHierarchy_ExpandTypedefsInValue( - const HierarchyInfo *info, ValueInfo *data, StringCache *cache, - const char *scope); - -/** - * Expand typedefs found in a name stored as a string. The value - * of "text" will be returned if no expansion occurred, else a new - * string is returned that must be freed with "free()". - */ -const char *vtkParseHierarchy_ExpandTypedefsInName( - const HierarchyInfo *info, const char *text, const char *scope); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkParseInternal.h b/src/ParaView/vtkParseInternal.h deleted file mode 100644 index 8d3c9c64..00000000 --- a/src/ParaView/vtkParseInternal.h +++ /dev/null @@ -1,137 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseInternal.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/* - This is an internal header for vtkParse.y, it contains methods for - manipulating the data structures that are not meant for general - use by the wrappers, and that are likely to change over time. -*/ - -#ifndef VTK_PARSE_PRIVATE_H -#define VTK_PARSE_PRIVATE_H - -#include "vtkParse.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Initializer methods - */ -/*@{*/ -void vtkParse_InitFile(FileInfo *file_info); -void vtkParse_InitNamespace(NamespaceInfo *namespace_info); -void vtkParse_InitClass(ClassInfo *cls); -void vtkParse_InitFunction(FunctionInfo *func); -void vtkParse_InitValue(ValueInfo *val); -void vtkParse_InitEnum(EnumInfo *item); -void vtkParse_InitUsing(UsingInfo *item); -void vtkParse_InitTemplateArgs(TemplateArgs *arg); -void vtkParse_InitTemplateArg(TemplateArg *arg); -/*@}*/ - -/** - * Copy methods - */ -/*@{*/ -void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); -void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); -void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); -void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); -void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); -void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); -void vtkParse_CopyTemplateArgs(TemplateArgs *data, const TemplateArgs *orig); -void vtkParse_CopyTemplateArg(TemplateArg *data, const TemplateArg *orig); -/*@}*/ - -/** - * Free methods - */ -/*@{*/ -void vtkParse_FreeFile(FileInfo *file_info); -void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); -void vtkParse_FreeClass(ClassInfo *cls); -void vtkParse_FreeFunction(FunctionInfo *func); -void vtkParse_FreeValue(ValueInfo *val); -void vtkParse_FreeEnum(EnumInfo *item); -void vtkParse_FreeUsing(UsingInfo *item); -void vtkParse_FreeTemplateArgs(TemplateArgs *arg); -void vtkParse_FreeTemplateArg(TemplateArg *arg); -/*@}*/ - -/** - * Make a persistent copy of a string for use with AddStringToArray: - * At most 'n' chars will be copied, and the string will be terminated. - * If a null pointer is provided, then a null pointer will be returned. - */ -const char *vtkParse_DuplicateString(const char *cp, size_t n); - -/** - * Add a string to an array of strings, grow array as necessary. - */ -void vtkParse_AddStringToArray( - const char ***valueArray, int *count, const char *value); - -/** - * Expand the Item array for classes and namespaces. - */ -void vtkParse_AddItemToArray( - ItemInfo **valueArray, int *count, parse_item_t type, int idx); - - -/** - * Add various items to the structs. - */ -/*@{*/ -void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); -void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); -void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); -void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); -void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); -void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); -void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); -void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); -void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); -void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); -void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); -void vtkParse_AddArgumentToFunction(FunctionInfo *info, ValueInfo *item); -void vtkParse_AddArgumentToTemplate(TemplateArgs *info, TemplateArg *item); -/*@}*/ - -/** - * Add default constructors if they do not already exist - */ -void vtkParse_AddDefaultConstructors(ClassInfo *data); - -/** - * Simple utility for mapping VTK types to VTK_PARSE types. - */ -unsigned int vtkParse_MapType(int vtktype); - -/** - * Ignore BTX/ETX markers - */ -void vtkParse_SetIgnoreBTX(int option); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkParseMain.c b/src/ParaView/vtkParseMain.c deleted file mode 100644 index a9e4f7a8..00000000 --- a/src/ParaView/vtkParseMain.c +++ /dev/null @@ -1,508 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseMain.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/* - -This file provides a unified front-end for the wrapper generators. - -*/ - -#include "vtkParse.h" -#include "vtkParseData.h" -#include "vtkParseMain.h" -#include -#include -#include -#include - -/* This is the struct that contains the options */ -OptionInfo options; - -/* Get the base filename */ -static const char *parse_exename(const char *cmd) -{ - const char *exename; - - /* remove directory part of exe name */ - for (exename = cmd + strlen(cmd); exename > cmd; --exename) - { - char pc = exename[-1]; - if (pc == ':' || pc == '/' || pc == '\\') - { - break; - } - } - - return exename; -} - -/* Print the help */ -static void parse_print_help(FILE *fp, const char *cmd, int multi) -{ - fprintf(fp, - "Usage: %s [options] infile... \n" - " --help print this help message\n" - " --version print the VTK version\n" - " -o the output file\n" - " -I add an include directory\n" - " -D define a preprocessor macro\n" - " -U undefine a preprocessor macro\n" - " @ read arguments from a file\n", - parse_exename(cmd)); - - /* args for describing a singe header file input */ - if (!multi) - { - fprintf(fp, - " --hints the hints file to use\n" - " --types the type hierarchy file to use\n" - " --concrete force concrete class (ignored, deprecated)\n" - " --abstract force abstract class (ignored, deprecated)\n" - " --vtkobject vtkObjectBase-derived class (ignored, deprecated)\n" - " --special non-vtkObjectBase class (ignored, deprecated)\n"); - } -} - -/* append an arg to the arglist */ -static void parse_append_arg(int *argn, char ***args, char *arg) -{ - /* if argn is a power of two, allocate more space */ - if (*argn > 0 && (*argn & (*argn - 1)) == 0) - { - *args = (char **)realloc(*args, 2*(*argn)*sizeof(char *)); - } - /* append argument to list */ - (*args)[*argn] = arg; - (*argn)++; -} - -/* read options from a file, return zero on error */ -static int read_option_file( - StringCache *strings, const char *filename, int *argn, char ***args) -{ - static int option_file_stack_max = 10; - static int option_file_stack_size = 0; - static const char *option_file_stack[10]; - FILE *fp; - char *line; - const char *ccp; - char *argstring; - char *arg; - size_t maxlen = 15; - size_t i, n; - int j; - int in_string; - - line = (char *)malloc(maxlen); - - fp = fopen(filename, "r"); - - if (fp == NULL) - { - return 0; - } - - /* read the file line by line */ - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - /* allocate a string to hold the parsed arguments */ - argstring = vtkParse_NewString(strings, n); - arg = argstring; - i = 0; - - /* break the line into individual options */ - ccp = line; - in_string = 0; - while (*ccp != '\0') - { - for (;;) - { - if (*ccp == '\\') - { - ccp++; - } - else if (*ccp == '\"' || *ccp == '\'') - { - if (!in_string) - { - in_string = *ccp++; - continue; - } - else if (*ccp == in_string) - { - in_string = 0; - ccp++; - continue; - } - } - else if (!in_string && isspace(*ccp)) - { - do { ccp++; } while (isspace(*ccp)); - break; - } - if (*ccp == '\0') - { - break; - } - /* append character to argument */ - arg[i++] = *ccp++; - } - arg[i++] = '\0'; - - if (arg[0] == '@') - { - /* recursively expand '@file' option */ - if (option_file_stack_size == option_file_stack_max) - { - fprintf(stderr, "%s: @file recursion is too deep.\n", - (*args)[0]); - exit(1); - } - /* avoid reading the same file recursively */ - option_file_stack[option_file_stack_size++] = filename; - for (j = 0; j < option_file_stack_size; j++) - { - if (strcmp(&arg[1], option_file_stack[j]) == 0) - { - break; - } - } - if (j < option_file_stack_size) - { - parse_append_arg(argn, args, arg); - } - else if (read_option_file(strings, &arg[1], argn, args) == 0) - { - parse_append_arg(argn, args, arg); - } - option_file_stack_size--; - } - else if (arg[0] != '\0') - { - parse_append_arg(argn, args, arg); - } - /* prepare for next arg */ - arg += i; - i = 0; - } - } - - return 1; -} - -/* expand any "@file" args that occur in the command-line args */ -static void parse_expand_args( - StringCache *strings, int argc, char *argv[], int *argn, char ***args) -{ - int i; - - *argn = 0; - *args = (char **)malloc(sizeof(char *)); - - for (i = 0; i < argc; i++) - { - /* check for "@file" unless this is the command name */ - if (i > 0 || argv[i][0] == '@') - { - /* if read_option_file returns null, add "@file" to the args */ - /* (this mimics the way that gcc expands @file arguments) */ - if (read_option_file(strings, &argv[i][1], argn, args) == 0) - { - parse_append_arg(argn, args, argv[i]); - } - } - else - { - /* append any other arg */ - parse_append_arg(argn, args, argv[i]); - } - } -} - -/* Check the options: "multi" should be zero for wrapper tools that - * only take one input file, or one for wrapper tools that take multiple - * input files. Returns zero for "--version" or "--help", or returns -1 - * if an error occurred. Otherwise, it returns the number of args - * that were successfully parsed. */ -static int parse_check_options(int argc, char *argv[], int multi) -{ - int i; - size_t j; - char *cp; - char c; - - options.NumberOfFiles = 0; - options.Files = NULL; - options.InputFileName = NULL; - options.OutputFileName = NULL; - options.HierarchyFileName = 0; - options.HintFileName = 0; - - for (i = 1; i < argc; i++) - { - if (strcmp(argv[i], "--help") == 0) - { - parse_print_help(stdout, argv[0], multi); - return 0; - } - else if (strcmp(argv[i], "--version") == 0) - { - const char *ver = VTK_PARSE_VERSION; - fprintf(stdout, "%s %s\n", parse_exename(argv[0]), ver); - return 0; - } - else if (argv[i][0] != '-') - { - if (options.NumberOfFiles == 0) - { - options.Files = (char **)malloc(sizeof(char *)); - } - else if ((options.NumberOfFiles & (options.NumberOfFiles - 1)) == 0) - { - options.Files = (char **)realloc( - options.Files, 2*options.NumberOfFiles*sizeof(char *)); - } - options.Files[options.NumberOfFiles++] = argv[i]; - } - else if (argv[i][0] == '-' && isalpha(argv[i][1])) - { - c = argv[i][1]; - cp = &argv[i][2]; - if (*cp == '\0') - { - i++; - if (i >= argc || argv[i][0] == '-') - { - return -1; - } - cp = argv[i]; - } - - if (c == 'o') - { - options.OutputFileName = cp; - } - else if (c == 'I') - { - vtkParse_IncludeDirectory(cp); - } - else if (c == 'D') - { - j = 0; - while (cp[j] != '\0' && cp[j] != '=') { j++; } - if (cp[j] == '=') { j++; } - vtkParse_DefineMacro(cp, &cp[j]); - } - else if (c == 'U') - { - vtkParse_UndefineMacro(cp); - } - } - else if (!multi && strcmp(argv[i], "--hints") == 0) - { - i++; - if (i >= argc || argv[i][0] == '-') - { - return -1; - } - options.HintFileName = argv[i]; - } - else if (!multi && strcmp(argv[i], "--types") == 0) - { - i++; - if (i >= argc || argv[i][0] == '-') - { - return -1; - } - options.HierarchyFileName = argv[i]; - } - else if (strcmp(argv[i], "--vtkobject") == 0 || - strcmp(argv[i], "--special") == 0 || - strcmp(argv[i], "--abstract") == 0 || - strcmp(argv[i], "--concrete") == 0) - { - fprintf(stderr, "Warning: the %s option is deprecated " - "and will be ignored.\n", argv[i]); - } - } - - return i; -} - -/* Return a pointer to the static OptionInfo struct */ -OptionInfo *vtkParse_GetCommandLineOptions() -{ - return &options; -} - -/* Command-line argument handler for wrapper tools */ -FileInfo *vtkParse_Main(int argc, char *argv[]) -{ - int argi; - int expected_files; - FILE *ifile; - FILE *hfile = 0; - FileInfo *data; - StringCache strings; - int argn; - char **args; - - /* expand any "@file" args */ - vtkParse_InitStringCache(&strings); - parse_expand_args(&strings, argc, argv, &argn, &args); - - /* read the args into the static OptionInfo struct */ - argi = parse_check_options(argn, args, 0); - - /* was output file already specified by the "-o" option? */ - expected_files = (options.OutputFileName == NULL ? 2 : 1); - - /* verify number of args, print usage if not valid */ - if (argi == 0) - { - free(args); - exit(0); - } - else if (argi < 0 || options.NumberOfFiles != expected_files) - { - parse_print_help(stderr, args[0], 0); - exit(1); - } - - /* open the input file */ - options.InputFileName = options.Files[0]; - - if (!(ifile = fopen(options.InputFileName, "r"))) - { - fprintf(stderr, "Error opening input file %s\n", options.InputFileName); - exit(1); - } - - if (options.OutputFileName == NULL && - options.NumberOfFiles > 1) - { - /* allow outfile to be given after infile, if "-o" option not used */ - options.OutputFileName = options.Files[1]; - fprintf(stderr, "Deprecated: specify output file with \"-o\".\n"); - } - - /* free the expanded args */ - free(args); - - /* open the hint file, if given on the command line */ - if (options.HintFileName && options.HintFileName[0] != '\0') - { - if (!(hfile = fopen(options.HintFileName, "r"))) - { - fprintf(stderr, "Error opening hint file %s\n", options.HintFileName); - fclose(ifile); - exit(1); - } - } - - /* make sure than an output file was given on the command line */ - if (options.OutputFileName == NULL) - { - fprintf(stderr, "No output file was specified\n"); - fclose(ifile); - if (hfile) - { - fclose(hfile); - } - exit(1); - } - - /* if a hierarchy is was given, then BTX/ETX can be ignored */ - vtkParse_SetIgnoreBTX(0); - if (options.HierarchyFileName) - { - vtkParse_SetIgnoreBTX(1); - } - - /* parse the input file */ - data = vtkParse_ParseFile(options.InputFileName, ifile, stderr); - - if (!data) - { - exit(1); - } - - /* fill in some blanks by using the hints file */ - if (hfile) - { - vtkParse_ReadHints(data, hfile, stderr); - } - - if (data->MainClass) - { - /* mark class as abstract unless it has New() method */ - int nfunc = data->MainClass->NumberOfFunctions; - int ifunc; - for (ifunc = 0; ifunc < nfunc; ifunc++) - { - FunctionInfo *func = data->MainClass->Functions[ifunc]; - if (func && func->Access == VTK_ACCESS_PUBLIC && - func->Name && strcmp(func->Name, "New") == 0 && - func->NumberOfParameters == 0) - { - break; - } - } - data->MainClass->IsAbstract = ((ifunc == nfunc) ? 1 : 0); - } - - return data; -} - -/* Command-line argument handler for wrapper tools */ -void vtkParse_MainMulti(int argc, char *argv[]) -{ - int argi; - int argn; - char **args; - StringCache strings; - - /* expand any "@file" args */ - vtkParse_InitStringCache(&strings); - parse_expand_args(&strings, argc, argv, &argn, &args); - - /* read the args into the static OptionInfo struct */ - argi = parse_check_options(argn, args, 1); - free(args); - - if (argi == 0) - { - exit(0); - } - else if (argi < 0 || options.NumberOfFiles == 0) - { - parse_print_help(stderr, argv[0], 1); - exit(1); - } - - /* the input file */ - options.InputFileName = options.Files[0]; -} diff --git a/src/ParaView/vtkParseMain.h b/src/ParaView/vtkParseMain.h deleted file mode 100644 index 6bf6f406..00000000 --- a/src/ParaView/vtkParseMain.h +++ /dev/null @@ -1,86 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseMain.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/** - vtkParseMain.h provides argument parsing for the wrapper executables. - - Usage: vtkWrap [options] infile ... - - -D add a macro definition - -U cancel a macro definition - -I add an include directory - -o specify the output file - @ read arguments from a file - --help print a help message and exit - --version print the VTK version number and exit - --hints hints file - --types type hierarchy file - - Notes: - - 1) The "-o" option is needed when there are multiple input files. - Otherwise, the output file can be given after the input file. - - 2) The "@file" option allows arguments to be stored in a file, - instead of given on the command line. The use of such a file - is sometimes necessary to avoid overflowing the 8191-character - command-line limit on Windows. If the file is not found, then - "@file" will be passed as as a command-line parameter. -*/ - -#ifndef VTK_PARSE_MAIN_H -#define VTK_PARSE_MAIN_H - -#include "vtkParseData.h" -#include - -/** - * Options for the wrappers - */ -typedef struct _OptionInfo -{ - int NumberOfFiles; /* the total number of file arguments */ - char **Files; /* all of the file arguments */ - char *InputFileName; /* the first file argument */ - char *OutputFileName; /* the second file, or the "-o" file */ - char *HintFileName; /* the file preceded by "--hints" */ - char *HierarchyFileName; /* the file preceded by "--types" */ -} OptionInfo; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Return the options provided on the command line - */ -OptionInfo *vtkParse_GetCommandLineOptions(); - -/** - * The main function, parses the file and returns the result. - */ -FileInfo *vtkParse_Main(int argc, char *argv[]); - -/** - * A main function that can take multiple input files. - * It does not parse the files. It will exit on error. - */ -void vtkParse_MainMulti(int argc, char *argv[]); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkParsePreprocess.c b/src/ParaView/vtkParsePreprocess.c deleted file mode 100644 index 8107e37a..00000000 --- a/src/ParaView/vtkParsePreprocess.c +++ /dev/null @@ -1,3360 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParsePreprocess.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParsePreprocess.h" -#include -#include -#include -#include -#include - -/** - This file handles preprocessor directives via a simple - recursive-descent parser that only evaluates integers. -*/ - -#define PREPROC_DEBUG 0 - -/** Block size for reading files */ -#define FILE_BUFFER_SIZE 8192 - -/** Size of hash table must be a power of two */ -#define PREPROC_HASH_TABLE_SIZE 1024u - -/** Hashes for preprocessor keywords */ -#define HASH_IFDEF 0x0fa4b283u -#define HASH_IFNDEF 0x04407ab1u -#define HASH_IF 0x00597834u -#define HASH_ELIF 0x7c964b25u -#define HASH_ELSE 0x7c964c6eu -#define HASH_ENDIF 0x0f60b40bu -#define HASH_DEFINED 0x088998d4u -#define HASH_DEFINE 0xf8804a70u -#define HASH_UNDEF 0x10823b97u -#define HASH_INCLUDE 0x9e36af89u -#define HASH_ERROR 0x0f6321efu -#define HASH_LINE 0x7c9a15adu -#define HASH_PRAGMA 0x1566a9fdu - -/** Various possible char types */ -#define CPRE_ID 0x01 /* A-Z a-z and _ */ -#define CPRE_DIGIT 0x02 /* 0-9 */ -#define CPRE_IDGIT 0x03 /* 0-9 A-Z a-z and _ */ -#define CPRE_HEX 0x04 /* 0-9A-Fa-f */ -#define CPRE_EXP 0x08 /* EPep (exponents for floats) */ -#define CPRE_SIGN 0x10 /* +- (sign for floats) */ -#define CPRE_QUOTE 0x20 /* " and ' */ -#define CPRE_HSPACE 0x40 /* space, tab, carriage return */ -#define CPRE_VSPACE 0x80 /* newline, vertical tab, form feed */ -#define CPRE_WHITE 0xC0 /* all whitespace characters */ - -/** Whitespace types. - * WS_NO_EOL treats newline as end-of-line, instead of whitespace. - * WS_ALL treats newlines as regular whitespace. - * WS_COMMENT does not treat comments as whitespace, allowing - * comments blocks to be returned as tokens. */ -typedef enum _preproc_space_t -{ - WS_NO_EOL = CPRE_HSPACE, /* skip horizontal whitespace only */ - WS_ALL = CPRE_WHITE, /* skip all whitespace */ - WS_COMMENT = (CPRE_WHITE | 0x100), /* comments as tokens */ -} preproc_space_t; - -/** Preprocessor tokens. */ -typedef enum _preproc_token_t -{ - TOK_OTHER = 257, - TOK_ID, /* any id */ - TOK_CHAR, /* char literal */ - TOK_STRING, /* string literal */ - TOK_NUMBER, /* any numeric literal */ - TOK_COMMENT, /* C or C++ comment */ - TOK_DBLHASH, /* ## */ - TOK_SCOPE, /* :: */ - TOK_INCR, /* ++ */ - TOK_DECR, /* -- */ - TOK_RSHIFT, /* >> */ - TOK_LSHIFT, /* << */ - TOK_AND, /* && */ - TOK_OR, /* || */ - TOK_EQ, /* == */ - TOK_NE, /* != */ - TOK_GE, /* >= */ - TOK_LE, /* <= */ - TOK_ADD_EQ, /* += */ - TOK_SUB_EQ, /* -= */ - TOK_MUL_EQ, /* *= */ - TOK_DIV_EQ, /* /= */ - TOK_MOD_EQ, /* %= */ - TOK_AND_EQ, /* &= */ - TOK_OR_EQ, /* |= */ - TOK_XOR_EQ, /* ^= */ - TOK_ARROW, /* -> */ - TOK_DOT_STAR, /* .* */ - TOK_ARROW_STAR,/* ->* */ - TOK_RSHIFT_EQ, /* >>= */ - TOK_LSHIFT_EQ, /* <<= */ - TOK_ELLIPSIS, /* ... */ -} preproc_token_t; - -/** A struct for going through the input one token at a time. */ -typedef struct _preproc_tokenizer -{ - int tok; - unsigned int hash; - const char *text; - size_t len; -} preproc_tokenizer; - -/** Extend dynamic arrays in a progression of powers of two. - * Whenever "n" reaches a power of two, then the array size is - * doubled so that "n" can be safely incremented. */ -static void *preproc_array_check( - void *arraymem, size_t size, int n) -{ - /* if empty, alloc for the first time */ - if (n == 0) - { - return malloc(size); - } - /* if count is power of two, reallocate with double size */ - else if ((n & (n-1)) == 0) - { - return realloc(arraymem, (n << 1)*size); - } - - /* no reallocation, just return the original array */ - return arraymem; -} - -/** Convert string to int. */ -static preproc_int_t string_to_preproc_int(const char *cp, int base) -{ -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) - return _strtoi64(cp, NULL, base); -#else - return strtoll(cp, NULL, base); -#endif -} - -/** Convert string to unsigned int. */ -static preproc_uint_t string_to_preproc_uint(const char *cp, int base) -{ -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) - return _strtoui64(cp, NULL, base); -#else - return strtoull(cp, NULL, base); -#endif -} - -/** Array for quick lookup of char types */ -static unsigned char preproc_charbits[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, - CPRE_HSPACE, /* tab */ - CPRE_VSPACE, CPRE_VSPACE, CPRE_VSPACE, /* newline, vtab, form feed */ - CPRE_HSPACE, /* carriage return */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - CPRE_HSPACE, /* ' ' */ - 0, CPRE_QUOTE, 0, 0, 0, 0, CPRE_QUOTE, 0, 0, /* !"#$%&'() */ - 0, CPRE_SIGN, 0, CPRE_SIGN, 0, 0, /* *+,-./ */ - CPRE_DIGIT|CPRE_HEX, /* 0 */ - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, - CPRE_DIGIT|CPRE_HEX, /* 9 */ - 0, 0, 0, 0, 0, 0, 0, /* :;<=>?@ */ - CPRE_ID|CPRE_HEX, /* A */ - CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, /* BCD */ - CPRE_ID|CPRE_HEX|CPRE_EXP, /* E */ - CPRE_ID|CPRE_HEX, CPRE_ID, CPRE_ID, CPRE_ID, /* FGHI */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* JKLM */ - CPRE_ID, CPRE_ID, CPRE_ID|CPRE_EXP, CPRE_ID, /* NOPQ */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* RSTU */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* VWXY */ - CPRE_ID, /* Z */ - 0, 0, 0, 0, /* [\\]^ */ - CPRE_ID, /* _ */ - 0, /* ` */ - CPRE_ID|CPRE_HEX, /* a */ - CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, /* bcd */ - CPRE_ID|CPRE_HEX|CPRE_EXP, /* e */ - CPRE_ID|CPRE_HEX, CPRE_ID, CPRE_ID, CPRE_ID, /* fghi */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* jklm */ - CPRE_ID, CPRE_ID, CPRE_ID|CPRE_EXP, CPRE_ID, /* nopq */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* rstu */ - CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* vwxy */ - CPRE_ID, /* z */ - 0, 0, 0, 0, /* {|}~ */ - 0, /* '\x7f' */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; - -/** Macro to get char type */ -#define preproc_chartype(c, bits) \ - ((preproc_charbits[(unsigned char)(c)] & bits) != 0) - -/** Skip over a comment. */ -static void preproc_skip_comment(const char **cpp) -{ - const char *cp = *cpp; - - if (cp[0] == '/') - { - if (cp[1] == '/') - { - cp += 2; - while (*cp != '\n' && *cp != '\0') - { - if (cp[0] == '\\') - { - if (cp[1] == '\n') { cp++; } - else if (cp[1] == '\r' && cp[2] == '\n') { cp += 2; } - } - cp++; - } - } - else if (cp[1] == '*') - { - cp += 2; - while (*cp != '\0') - { - if (cp[0] == '*' && cp[1] == '/') { cp += 2; break; } - cp++; - } - } - } - - *cpp = cp; -} - -/** Skip over whitespace, but not newlines unless preceded by backlash. */ -static void preproc_skip_whitespace( - const char **cpp, preproc_space_t spacetype) -{ - const char *cp = *cpp; - - for (;;) - { - if (preproc_chartype(*cp, spacetype)) - { - do - { - cp++; - } - while (preproc_chartype(*cp, spacetype)); - } - if (cp[0] == '\\') - { - if (cp[1] == '\n') - { - cp += 2; - } - else if (cp[1] == '\r' && cp[2] == '\n') - { - cp += 3; - } - else - { - break; - } - } - else if (cp[0] == '/' && (spacetype & WS_COMMENT) != WS_COMMENT) - { - if (cp[1] == '/' || cp[1] == '*') - { - preproc_skip_comment(&cp); - } - else - { - break; - } - } - else - { - break; - } - } - - *cpp = cp; -} - -/** Skip over string and char literals. */ -static void preproc_skip_quotes(const char **cpp) -{ - const char *cp = *cpp; - const char qc = *cp; - - if (preproc_chartype(*cp, CPRE_QUOTE)) - { - cp++; - while (*cp != qc && *cp != '\n' && *cp != '\0') - { - if (*cp++ == '\\') - { - if (cp[0] == '\r' && cp[1] == '\n') { cp += 2; } - else if (*cp != '\0') { cp++; } - } - } - } - if (*cp == qc) - { - cp++; - } - - *cpp = cp; -} - -/** Skip over a name. */ -static void preproc_skip_name(const char **cpp) -{ - const char *cp = *cpp; - - if (preproc_chartype(*cp, CPRE_ID)) - { - do - { - cp++; - } - while (preproc_chartype(*cp, CPRE_IDGIT)); - } - - *cpp = cp; -} - -/** A simple 32-bit hash function based on "djb2". */ -static unsigned int preproc_hash_name(const char **cpp) -{ - const char *cp = (*cpp); - int h = 5381; - - if (preproc_chartype(*cp, CPRE_ID)) - { - do { h = (h << 5) + h + (unsigned char)*cp++; } - while (preproc_chartype(*cp, CPRE_IDGIT)); - } - - *cpp = cp; - return h; -} - -/** Skip over a number. */ -static void preproc_skip_number(const char **cpp) -{ - const char *cp = *cpp; - - if (preproc_chartype(cp[0], CPRE_DIGIT) || - (cp[0] == '.' && preproc_chartype(cp[1], CPRE_DIGIT))) - { - do - { - char c = *cp++; - if (preproc_chartype(c, CPRE_EXP) && - preproc_chartype(*cp, CPRE_SIGN)) - { - cp++; - } - } - while (preproc_chartype(*cp, CPRE_IDGIT) || *cp == '.'); - } - - *cpp = cp; -} - -/** Return the next preprocessor token, or '0' if none left. */ -static int preproc_next(preproc_tokenizer *tokens) -{ - const char *cp = tokens->text + tokens->len; - preproc_skip_whitespace(&cp, WS_NO_EOL); - - if (preproc_chartype(*cp, CPRE_ID)) - { - const char *ep = cp; - unsigned int h = preproc_hash_name(&ep); - tokens->tok = TOK_ID; - tokens->hash = h; - tokens->text = cp; - tokens->len = ep - cp; - } - else if (preproc_chartype(*cp, CPRE_QUOTE)) - { - const char *ep = cp; - preproc_skip_quotes(&ep); - tokens->tok = (*cp == '\"' ? TOK_STRING : TOK_CHAR); - tokens->hash = 0; - tokens->text = cp; - tokens->len = ep - cp; - } - else if (preproc_chartype(*cp, CPRE_DIGIT) || - (cp[0] == '.' && preproc_chartype(cp[1], CPRE_DIGIT))) - { - const char *ep = cp; - preproc_skip_number(&ep); - tokens->tok = TOK_NUMBER; - tokens->hash = 0; - tokens->text = cp; - tokens->len = ep - cp; - } - else if (cp[0] == '/' && (cp[1] == '/' || cp[1] == '*')) - { - const char *ep = cp; - preproc_skip_comment(&ep); - tokens->tok = TOK_COMMENT; - tokens->hash = 0; - tokens->text = cp; - tokens->len = ep - cp; - } - else - { - int t = cp[0]; - size_t l = 1; - - switch (cp[0]) - { - case ':': - if (cp[1] == ':') { l = 2; t = TOK_SCOPE; } - break; - case '.': - if (cp[1] == '.' && cp[2] == '.') { l = 3; t = TOK_ELLIPSIS; } - else if (cp[1] == '*') { l = 2; t = TOK_DOT_STAR; } - break; - case '=': - if (cp[1] == '=') { l = 2; t = TOK_EQ; } - break; - case '!': - if (cp[1] == '=') { l = 2; t = TOK_NE; } - break; - case '<': - if (cp[1] == '<' && cp[2] == '=') { l = 3; t = TOK_LSHIFT_EQ; } - else if (cp[1] == '<') { l = 2; t = TOK_LSHIFT; } - else if (cp[1] == '=') { l = 2; t = TOK_LE; } - break; - case '>': - if (cp[1] == '>' && cp[2] == '=') { l = 3; t = TOK_RSHIFT_EQ; } - else if (cp[1] == '>') { l = 2; t = TOK_RSHIFT; } - else if (cp[1] == '=') { l = 2; t = TOK_GE; } - break; - case '&': - if (cp[1] == '=') { l = 2; t = TOK_AND_EQ; } - else if (cp[1] == '&') { l = 2; t = TOK_AND; } - break; - case '|': - if (cp[1] == '=') { l = 2; t = TOK_OR_EQ; } - else if (cp[1] == '|') { l = 2; t = TOK_OR; } - break; - case '^': - if (cp[1] == '=') { l = 2; t = TOK_XOR_EQ; } - break; - case '*': - if (cp[1] == '=') { l = 2; t = TOK_MUL_EQ; } - break; - case '/': - if (cp[1] == '=') { l = 2; t = TOK_DIV_EQ; } - break; - case '%': - if (cp[1] == '=') { l = 2; t = TOK_MOD_EQ; } - break; - case '+': - if (cp[1] == '+') { l = 2; t = TOK_INCR; } - else if (cp[1] == '=') { l = 2; t = TOK_ADD_EQ; } - break; - case '-': - if (cp[1] == '>' && cp[2] == '*') { l = 3; t = TOK_ARROW_STAR; } - else if (cp[1] == '>') { l = 2; t = TOK_ARROW; } - else if (cp[1] == '-') { l = 2; t = TOK_DECR; } - else if (cp[1] == '=') { l = 2; t = TOK_SUB_EQ; } - break; - case '#': - if (cp[1] == '#') { l = 2; t = TOK_DBLHASH; } - break; - case '\n': - case '\0': - { l = 0; t = 0; } - break; - } - - tokens->tok = t; - tokens->hash = 0; - tokens->text = cp; - tokens->len = l; - } - - return tokens->tok; -} - -/** Initialize the tokenizer. */ -static void preproc_init(preproc_tokenizer *tokens, const char *text) -{ - tokens->tok = 0; - tokens->hash = 0; - tokens->text = text; - tokens->len = 0; - preproc_next(tokens); -} - -/** Tokenize and compare two strings */ -static int preproc_identical(const char *text1, const char *text2) -{ - int result = 1; - - if (text1 != text2) - { - result = 0; - - if (text1 && text2) - { - preproc_tokenizer t1; - preproc_tokenizer t2; - - preproc_init(&t1, text1); - preproc_init(&t2, text2); - - do - { - if (t1.tok != t2.tok || - t1.hash != t2.hash || - t1.len != t2.len || - strncmp(t1.text, t2.text, t1.len) != 0) - { - break; - } - preproc_next(&t1); - preproc_next(&t2); - } - while (t1.tok && t2.tok); - - result = (t1.tok == 0 && t2.tok == 0); - } - } - - return result; -} - -/** Duplicate the first n bytes of a string. */ -static const char *preproc_strndup(const char *in, size_t n) -{ - char *res = NULL; - - res = (char *)malloc(n+1); - strncpy(res, in, n); - res[n] = '\0'; - - return res; -} - -/** Create a new preprocessor macro. */ -static MacroInfo *preproc_new_macro( - PreprocessInfo *info, const char *name, const char *definition) -{ - MacroInfo *macro = (MacroInfo *)malloc(sizeof(MacroInfo)); - vtkParsePreprocess_InitMacro(macro); - - if (name) - { - size_t n; - const char *cp = name; - preproc_skip_name(&cp); - n = cp - name; - macro->Name = preproc_strndup(name, n); - } - - if (definition) - { - size_t n; - const char *cp = definition; - preproc_tokenizer tokens; - preproc_init(&tokens, cp); - - do - { - cp = tokens.text + tokens.len; - } - while (preproc_next(&tokens)); - - n = cp - definition; - macro->Definition = preproc_strndup(definition, n); - } - - macro->IsExternal = info->IsExternal; - - return macro; -} - -/** Free a preprocessor macro struct. */ -static void preproc_free_macro(MacroInfo *info) -{ - free(info); -} - -/** Find a preprocessor macro, return 0 if not found. */ -static MacroInfo *preproc_find_macro( - PreprocessInfo *info, preproc_tokenizer *token) -{ - unsigned int m = PREPROC_HASH_TABLE_SIZE - 1; - unsigned int i = (token->hash & m); - const char *name = token->text; - size_t l = token->len; - MacroInfo ***htable = info->MacroHashTable; - MacroInfo **hptr; - const char *mname; - - if (htable && ((hptr = htable[i]) != NULL) && *hptr) - { - do - { - mname = (*hptr)->Name; - if (mname[0] == name[0] && - strncmp(mname, name, l) == 0 && - mname[l] == '\0') - { - return *hptr; - } - hptr++; - } - while (*hptr); - } - - return NULL; -} - -/** Return the address of the macro within the hash table. - * If "insert" is nonzero, add a new location if macro not found. */ -static MacroInfo **preproc_macro_location( - PreprocessInfo *info, preproc_tokenizer *token, int insert) -{ - MacroInfo ***htable = info->MacroHashTable; - unsigned int m = PREPROC_HASH_TABLE_SIZE - 1; - unsigned int i = (token->hash & m); - const char *name = token->text; - size_t l = token->len; - size_t n; - MacroInfo **hptr; - const char *mname; - - if (htable == NULL) - { - if (!insert) - { - return NULL; - } - - m = PREPROC_HASH_TABLE_SIZE; - htable = (MacroInfo ***)malloc(m*sizeof(MacroInfo **)); - info->MacroHashTable = htable; - do { *htable++ = NULL; } while (--m); - htable = info->MacroHashTable; - } - - hptr = htable[i]; - - if (hptr == NULL) - { - if (!insert) - { - return NULL; - } - - hptr = (MacroInfo **)malloc(2*sizeof(MacroInfo *)); - hptr[0] = NULL; - hptr[1] = NULL; - htable[i] = hptr; - } - else if (*hptr) - { - /* see if macro is already there */ - n = 0; - do - { - mname = (*hptr)->Name; - if (mname[0] == name[0] && - strncmp(mname, name, l) == 0 && - mname[l] == '\0') - { - break; - } - n++; - hptr++; - } - while (*hptr); - - if (*hptr == NULL) - { - if (!insert) - { - return NULL; - } - - /* if n+1 is a power of two, double allocated space */ - if (n > 0 && (n & (n+1)) == 0) - { - hptr = htable[i]; - hptr = (MacroInfo **)realloc(hptr, (2*(n+1))*sizeof(MacroInfo *)); - htable[i] = hptr; - hptr += n; - } - - /* add a terminating null */ - hptr[1] = NULL; - } - } - - return hptr; -} - -/** Remove a preprocessor macro. Returns 0 if macro not found. */ -static int preproc_remove_macro( - PreprocessInfo *info, preproc_tokenizer *token) -{ - MacroInfo **hptr; - - hptr = preproc_macro_location(info, token, 0); - - if (hptr && *hptr) - { - preproc_free_macro(*hptr); - - do - { - hptr[0] = hptr[1]; - hptr++; - } - while (*hptr); - - return 1; - } - - return 0; -} - -/** A simple way to add a preprocessor macro definition. */ -static MacroInfo *preproc_add_macro_definition( - PreprocessInfo *info, const char *name, const char *definition) -{ - preproc_tokenizer token; - MacroInfo *macro; - MacroInfo **macro_p; - - preproc_init(&token, name); - - macro = preproc_new_macro(info, name, definition); - macro_p = preproc_macro_location(info, &token, 1); -#if PREPROC_DEBUG - if (*macro_p) - { - fprintf(stderr, "duplicate macro definition %s\n", name); - } -#endif - *macro_p = macro; - - return macro; -} - -/** Skip over parentheses, return nonzero if not closed. */ -static int preproc_skip_parentheses(preproc_tokenizer *tokens) -{ - int depth = 0; - - if (tokens->tok == '(') - { - depth = 1; - - while (depth > 0 && preproc_next(tokens)) - { - if (tokens->tok == '(') - { - depth++; - } - else if (tokens->tok == ')') - { - depth--; - } - } - } - - if (tokens->tok == ')') - { - preproc_next(tokens); - return VTK_PARSE_OK; - } - -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; -} - - -/** Evaluate a char literal to an integer value. */ -static int preproc_evaluate_char( - const char *cp, preproc_int_t *val, int *is_unsigned) -{ - if (cp[0] == '\'') - { - cp++; - if (*cp != '\\') - { - *val = *cp; - } - else if (*cp != '\'' && *cp != '\n' && *cp != '\0') - { - cp++; - if (*cp == 'a') { *val = '\a'; } - else if (*cp == 'b') { *val = '\b'; } - else if (*cp == 'f') { *val = '\f'; } - else if (*cp == 'n') { *val = '\n'; } - else if (*cp == 'r') { *val = '\r'; } - else if (*cp == 'b') { *val = '\b'; } - else if (*cp == 't') { *val = '\t'; } - else if (*cp == 'v') { *val = '\v'; } - else if (*cp == '\'') { *val = '\''; } - else if (*cp == '\"') { *val = '\"'; } - else if (*cp == '\\') { *val = '\\'; } - else if (*cp == '\?') { *val = '\?'; } - else if (*cp == '0') - { - *val = string_to_preproc_int(cp, 8); - do { cp++; } while (*cp >= '0' && *cp <= '7'); - } - else if (*cp == 'x') - { - *val = string_to_preproc_int(cp+1, 16); - do { cp++; } while (preproc_chartype(*cp, CPRE_HEX)); - } - } - if (*cp != '\'') - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - cp++; - *is_unsigned = 0; - return VTK_PARSE_OK; - } - -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; -} - -/* Evaluate an integer, ignoring any suffixes except 'u'. */ -static int preproc_evaluate_integer( - const char *cp, preproc_int_t *val, int *is_unsigned) -{ - const char *ep; - int base = 0; - ep = cp; - - if (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) - { - cp += 2; - base = 16; - *is_unsigned = 1; - ep = cp; - while (preproc_chartype(*ep, CPRE_HEX)) - { - ep++; - } - } - else if (cp[0] == '0' && preproc_chartype(cp[1], CPRE_DIGIT)) - { - cp += 1; - base = 8; - *is_unsigned = 1; - ep = cp; - while (*ep >= '0' && *ep <= '7') - { - ep++; - } - } - else - { - base = 10; - *is_unsigned = 0; - while (preproc_chartype(*ep, CPRE_DIGIT)) - { - ep++; - } - } - - for (;;) - { - if (ep[0] == 'i' && ep[1] == '6' && ep[2] == '4') { ep += 3; } - else if (*ep == 'u') { *is_unsigned = 1; ep++; } - else if (*ep == 'l' || *ep == 'L') { ep++; } - else { break; } - } - - if (*is_unsigned) - { - *val = (preproc_int_t)string_to_preproc_uint(cp, base); - } - else - { - *val = string_to_preproc_int(cp, base); - } - - if (*ep == '.' || *ep == 'e' || *ep == 'E') - { - return VTK_PARSE_PREPROC_DOUBLE; - } - - return VTK_PARSE_OK; -} - -/* forward declaration */ -static int preproc_evaluate_expression( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned); - -/** Evaluate a single item in an expression. */ -static int preproc_evaluate_single( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int result = VTK_PARSE_OK; - - while (tokens->tok == TOK_ID) - { - /* handle the "defined" keyword */ - if (tokens->hash == HASH_DEFINED && tokens->len == 7 && - strncmp("defined", tokens->text, tokens->len) == 0) - { - int paren = 0; - preproc_next(tokens); - - if (tokens->tok == '(') - { - paren = 1; - preproc_next(tokens); - } - if (tokens->tok != TOK_ID) - { - *val = 0; - *is_unsigned = 0; -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - /* do the name lookup */ - *is_unsigned = 0; - *val = (preproc_find_macro(info, tokens) != 0); - - preproc_next(tokens); - if (paren) - { - if (tokens->tok != ')') - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - preproc_next(tokens); - } - - return result; - } - else - { - /* look up and evaluate the macro */ - MacroInfo *macro = preproc_find_macro(info, tokens); - const char *args = NULL; - const char *expansion = NULL; - const char *cp; - preproc_next(tokens); - *val = 0; - *is_unsigned = 0; - - if (macro == NULL || macro->IsExcluded) - { - return VTK_PARSE_MACRO_UNDEFINED; - } - else if (macro->IsFunction) - { - /* expand function macros using the arguments */ - args = tokens->text; - if (tokens->tok != '(' || - preproc_skip_parentheses(tokens) != VTK_PARSE_OK) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - } - expansion = vtkParsePreprocess_ExpandMacro(info, macro, args); - if (expansion == NULL) - { - free((char *)args); -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return (args ? VTK_PARSE_MACRO_NUMARGS : VTK_PARSE_SYNTAX_ERROR); - } - cp = expansion; - preproc_skip_whitespace(&cp, WS_NO_EOL); - if (*cp != '\0') - { - macro->IsExcluded = 1; - result = vtkParsePreprocess_EvaluateExpression( - info, expansion, val, is_unsigned); - macro->IsExcluded = 0; - vtkParsePreprocess_FreeMacroExpansion( - info, macro, expansion); - return result; - } - vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); - } - /* if macro expansion was empty, continue */ - } - - if (tokens->tok == '(') - { - preproc_next(tokens); - result = preproc_evaluate_expression(info, tokens, val, is_unsigned); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok == ')') - { - preproc_next(tokens); - return result; - } -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - return result; - } - else if (tokens->tok == TOK_NUMBER) - { - result = preproc_evaluate_integer(tokens->text, val, is_unsigned); - if (tokens->text[tokens->len-1] == 'f' || - tokens->text[tokens->len-1] == 'F') - { - result = VTK_PARSE_PREPROC_FLOAT; - } - preproc_next(tokens); - return result; - } - else if (tokens->tok == TOK_CHAR) - { - result = preproc_evaluate_char(tokens->text, val, is_unsigned); - preproc_next(tokens); - return result; - } - else if (tokens->tok == TOK_STRING) - { - *val = 0; - *is_unsigned = 0; - preproc_next(tokens); - while (tokens->tok == TOK_STRING) - { - preproc_next(tokens); - } - return VTK_PARSE_PREPROC_STRING; - } - - *val = 0; - *is_unsigned = 0; -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d \"%*.*s\"\n", __LINE__, - (int)tokens->len, (int)tokens->len, tokens->text); -#endif - return VTK_PARSE_SYNTAX_ERROR; -} - -static int preproc_evaluate_unary( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op = tokens->tok; - int result = VTK_PARSE_OK; - - if (op != '+' && op != '-' && op != '~' && op != '!') - { - return preproc_evaluate_single(info, tokens, val, is_unsigned); - } - - preproc_next(tokens); - - result = preproc_evaluate_unary(info, tokens, val, is_unsigned); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (op == '~') { *val = ~(*val); } - else if (op == '!') { *val = !(*val); *is_unsigned = 0; } - else if (op == '-') { *val = -(*val); } - return result; - } - - return result; -} - -static int preproc_evaluate_multiply( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_unary(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != '*' && op != '/' && op != '%') - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_unary(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - - if (*is_unsigned) - { - if (op == '*') - { - *val = (preproc_int_t)((preproc_uint_t)*val * - (preproc_uint_t)rval); - } - else if (op == '/') - { - if (rval != 0) - { - *val = (preproc_int_t)((preproc_uint_t)*val / - (preproc_uint_t)rval); - } - else - { - *val = 2147483647; - } - } - else if (op == '%') - { - if (rval != 0) - { - *val = (preproc_int_t)((preproc_uint_t)*val % - (preproc_uint_t)rval); - } - else - { - *val = 2147483647; - } - } - } - else - { - if (op == '*') - { - *val = *val * rval; - } - else if (op == '/') - { - if (rval != 0) - { - *val = *val / rval; - } - else if (*val < 0) - { - *val = -2147483647; - } - else - { - *val = 2147483647; - } - } - else if (op == '%') - { - if (rval != 0) - { - *val = *val % rval; - } - else if (*val < 0) - { - *val = -2147483647; - } - else - { - *val = 2147483647; - } - } - } - } - - return result; -} - -static int preproc_evaluate_add( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_multiply(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != '+' && op != '-') - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_multiply(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - - if (op == '+') - { - *val = *val + rval; - } - else if (op == '-') - { - *val = *val - rval; - } - } - - return result; -} - -static int preproc_evaluate_bitshift( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_add(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - - if (op != TOK_LSHIFT && op != TOK_RSHIFT) - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_add(info, tokens, &rval, &rtype); - - if (*is_unsigned) - { - if (op == TOK_LSHIFT) - { - *val = (preproc_int_t)((preproc_uint_t)*val << rval); - } - else if (op == TOK_RSHIFT) - { - *val = (preproc_int_t)((preproc_uint_t)*val >> rval); - } - } - else - { - if (op == TOK_LSHIFT) - { - *val = *val << rval; - } - else if (op == TOK_RSHIFT) - { - *val = *val >> rval; - } - } - } - - return result; -} - -static int preproc_evaluate_compare( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_bitshift(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != '<' && op != '>' && op != TOK_LE && op != TOK_GE) - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_bitshift(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - - if (*is_unsigned) - { - if (op == TOK_LE) - { - *val = ((preproc_uint_t)*val <= (preproc_uint_t)rval); - } - else if (op == '<') - { - *val = ((preproc_uint_t)*val < (preproc_uint_t)rval); - } - else if (op == TOK_GE) - { - *val = ((preproc_uint_t)*val >= (preproc_uint_t)rval); - } - else if (op == '>') - { - *val = ((preproc_uint_t)*val > (preproc_uint_t)rval); - } - } - else - { - if (op == TOK_LE) - { - *val = (*val <= rval); - } - else if (op == '<') - { - *val = (*val < rval); - } - else if (op == TOK_GE) - { - *val = (*val >= rval); - } - else if (op == '>') - { - *val = (*val > rval); - } - } - *is_unsigned = 0; - } - - return result; -} - -static int preproc_evaluate_equal( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - int op; - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_compare(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - op = tokens->tok; - if (op != TOK_EQ && op != TOK_NE) - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_compare(info, tokens, &rval, &rtype); - - if (op == TOK_EQ) - { - *val = (*val == rval); - } - else if (op == TOK_NE) - { - *val = (*val != rval); - } - *is_unsigned = 0; - } - - return result; -} - -static int preproc_evaluate_and( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_equal(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '&') - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_equal(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - *val = (*val & rval); - } - - return result; -} - -static int preproc_evaluate_xor( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_and(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '^') - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_and(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - *val = (*val ^ rval); - } - - return result; -} - -static int preproc_evaluate_or( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_xor(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '|') - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_xor(info, tokens, &rval, &rtype); - - *is_unsigned = (*is_unsigned || rtype); - *val = (*val | rval); - } - - return result; -} - -static int preproc_evaluate_logic_and( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_or(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != TOK_AND) - { - return result; - } - - preproc_next(tokens); - - if (*val == 0) - { - /* short circuit */ - while (tokens->tok != 0 && tokens->tok != ')' && - tokens->tok != ':' && tokens->tok != '?' && - tokens->tok != ',' && tokens->tok != TOK_OR) - { - if (tokens->tok == '(') - { - if (preproc_skip_parentheses(tokens) != VTK_PARSE_OK) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - result = VTK_PARSE_SYNTAX_ERROR; - } - } - else - { - preproc_next(tokens); - } - } - - *is_unsigned = 0; - - return result; - } - - result = preproc_evaluate_or(info, tokens, &rval, &rtype); - - *is_unsigned = 0; - *val = (rval != 0); - } - - return result; -} - -static int preproc_evaluate_logic_or( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_logic_and(info, tokens, val, is_unsigned); - while ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != TOK_OR) - { - return result; - } - - preproc_next(tokens); - - if (*val != 0) - { - /* short circuit */ - while (tokens->tok != 0 && tokens->tok != ')' && - tokens->tok != ':' && tokens->tok != '?' && - tokens->tok != ',') - { - if (tokens->tok == '(') - { - if (preproc_skip_parentheses(tokens) != VTK_PARSE_OK) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - result = VTK_PARSE_SYNTAX_ERROR; - } - } - else - { - preproc_next(tokens); - } - } - - *is_unsigned = 0; - - return result; - } - - result = preproc_evaluate_logic_and(info, tokens, &rval, &rtype); - - *is_unsigned = 0; - *val = (rval != 0); - } - - return result; -} - -/** Evaluate an arimetic *expression. */ -int preproc_evaluate_expression( - PreprocessInfo *info, preproc_tokenizer *tokens, - preproc_int_t *val, int *is_unsigned) -{ - preproc_int_t rval, sval; - int rtype, stype; - int result; - - result = preproc_evaluate_logic_or(info, tokens, val, is_unsigned); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != '?') - { - return result; - } - - preproc_next(tokens); - - result = preproc_evaluate_expression(info, tokens, &rval, &rtype); - if ((result & VTK_PARSE_FATAL_ERROR) != 0) - { - return result; - } - - if (tokens->tok != ':') - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - preproc_next(tokens); - - result = preproc_evaluate_expression(info, tokens, &sval, &stype); - if ((result & VTK_PARSE_FATAL_ERROR) != 0) - { - return result; - } - - if (*val != 0) - { - *val = rval; - *is_unsigned = rtype; - } - else - { - *val = sval; - *is_unsigned = stype; - } - } - - return result; -} - -/** Evaluate a conditional *expression. - * Returns VTK_PARSE_OK if the expression is true, - * or VTK_PARSE_SKIP of the expression is false. */ -int preproc_evaluate_conditional( - PreprocessInfo *info, preproc_tokenizer *tokens) -{ - preproc_int_t rval; - int rtype; - int result; - - result = preproc_evaluate_expression(info, tokens, &rval, &rtype); - if ((result & VTK_PARSE_FATAL_ERROR) == 0) - { - if (tokens->tok != 0) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - return (rval == 0 ? VTK_PARSE_SKIP : VTK_PARSE_OK); - } - - return result; -} - -/** - * Handle any of the following directives: - * #if, #ifdef, #ifndef, #elif, #else, #endif - * A return value of VTK_PARSE_SKIP means that - * the following code block should be skipped. - */ -static int preproc_evaluate_if( - PreprocessInfo *info, preproc_tokenizer *tokens) -{ - MacroInfo *macro; - int v1, v2; - int result = VTK_PARSE_OK; - - if (tokens->hash == HASH_IF || - tokens->hash == HASH_IFDEF || - tokens->hash == HASH_IFNDEF) - { - if (info->ConditionalDepth == 0) - { - if (tokens->hash == HASH_IF) - { - preproc_next(tokens); - result = preproc_evaluate_conditional(info, tokens); - } - else - { - v1 = (tokens->hash != HASH_IFNDEF); - preproc_next(tokens); - if (tokens->tok != TOK_ID) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - macro = preproc_find_macro(info, tokens); - v2 = (macro && !macro->IsExcluded); - preproc_next(tokens); - result = ( (v1 ^ v2) ? VTK_PARSE_SKIP : VTK_PARSE_OK); - } - - if (result != VTK_PARSE_SKIP) - { - /* mark as done, so that the "else" clause is skipped */ - info->ConditionalDone = 1; - } - else - { - /* mark as not done, so that "else" clause is not skipped */ - info->ConditionalDone = 0; - /* skip the "if" clause */ - info->ConditionalDepth = 1; - } - } - else - { - /* increase the skip depth */ - info->ConditionalDepth++; - } - } - else if (tokens->hash == HASH_ELIF || - tokens->hash == HASH_ELSE) - { - if (info->ConditionalDepth == 0) - { - /* preceding clause was not skipped, so must skip this one */ - info->ConditionalDepth = 1; - } - else if (info->ConditionalDepth == 1 && - info->ConditionalDone == 0) - { - if (tokens->hash == HASH_ELIF) - { - preproc_next(tokens); - result = preproc_evaluate_conditional(info, tokens); - } - else - { - preproc_next(tokens); - } - if (result != VTK_PARSE_SKIP) - { - /* do not skip this clause */ - info->ConditionalDepth = 0; - /* make sure remaining else/elif clauses are skipped */ - info->ConditionalDone = 1; - } - } - } - else if (tokens->hash == HASH_ENDIF) - { - preproc_next(tokens); - if (info->ConditionalDepth > 0) - { - /* decrease the skip depth */ - info->ConditionalDepth--; - } - if (info->ConditionalDepth == 0) - { - /* set "done" flag for the context that is being returned to */ - info->ConditionalDone = 1; - } - } - - return result; -} - -/** - * Handle the #define and #undef directives. - */ -static int preproc_evaluate_define( - PreprocessInfo *info, preproc_tokenizer *tokens) -{ - MacroInfo **macro_p; - MacroInfo *macro; - int is_function; - const char *name; - size_t namelen; - const char *definition = 0; - int n = 0; - const char **params = NULL; - - if (tokens->hash == HASH_DEFINE) - { - preproc_next(tokens); - if (tokens->tok != TOK_ID) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - macro_p = preproc_macro_location(info, tokens, 1); - name = tokens->text; - namelen = tokens->len; - preproc_next(tokens); - - is_function = 0; - if (name[namelen] == '(') - { - is_function = 1; - preproc_next(tokens); - while (tokens->tok != 0 && tokens->tok != ')') - { - if (tokens->tok != TOK_ID && tokens->tok != TOK_ELLIPSIS) - { - if (params) { free((char **)params); } -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - - /* add to the arg list */ - params = (const char **)preproc_array_check( - (char **)params, sizeof(char *), n); - params[n++] = preproc_strndup(tokens->text, tokens->len); - - preproc_next(tokens); - if (tokens->tok == ',') - { - preproc_next(tokens); - } - else if (tokens->tok != ')') - { - if (params) { free((char **)params); } -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - } - preproc_next(tokens); - } - - if (tokens->tok) - { - definition = tokens->text; - } - - macro = *macro_p; - if (macro) - { - if (preproc_identical(macro->Definition, definition)) - { - return VTK_PARSE_OK; - } - if (params) { free((char **)params); } -#if PREPROC_DEBUG - fprintf(stderr, "macro redefined %d\n", __LINE__); -#endif - return VTK_PARSE_MACRO_REDEFINED; - } - - macro = preproc_new_macro(info, name, definition); - macro->IsFunction = is_function; - macro->NumberOfParameters = n; - macro->Parameters = params; - *macro_p = macro; - - return VTK_PARSE_OK; - } - else if (tokens->hash == HASH_UNDEF) - { - preproc_next(tokens); - if (tokens->tok != TOK_ID) - { -#if PREPROC_DEBUG - fprintf(stderr, "syntax error %d\n", __LINE__); -#endif - return VTK_PARSE_SYNTAX_ERROR; - } - preproc_remove_macro(info, tokens); - return VTK_PARSE_OK; - } - - return VTK_PARSE_OK; -} - -/** - * Add an include file to the list. Return 0 if it is already there. - */ -static int preproc_add_include_file(PreprocessInfo *info, const char *name) -{ - int i, n; - char *dp; - - n = info->NumberOfIncludeFiles; - for (i = 0; i < n; i++) - { - if (strcmp(info->IncludeFiles[i], name) == 0) - { - return 0; - } - } - - dp = (char *)malloc(strlen(name)+1); - strcpy(dp, name); - - info->IncludeFiles = (const char **)preproc_array_check( - (char **)info->IncludeFiles, sizeof(char *), info->NumberOfIncludeFiles); - info->IncludeFiles[info->NumberOfIncludeFiles++] = dp; - - return 1; -} - -/** - * Find an include file. If "cache_only" is set, then do a check to - * see if the file was previously found without going to the filesystem. - */ -const char *preproc_find_include_file( - PreprocessInfo *info, const char *filename, int system_first, - int cache_only) -{ - int i, n, ii, nn; - size_t j, m; - struct stat fs; - const char *directory; - char *output; - size_t outputsize = 16; - int count; - - /* allow filename to be terminated by quote or bracket */ - m = 0; - while (filename[m] != '\"' && filename[m] != '>' && - filename[m] != '\n' && filename[m] != '\0') { m++; } - - /* search file system for the file */ - output = (char *)malloc(outputsize); - - if (system_first != 0) - { - system_first = 1; - } - - if (cache_only != 0) - { - cache_only = 1; - } - - /* check for absolute path of form DRIVE: or /path/to/file */ - j = 0; - while (preproc_chartype(filename[j], CPRE_IDGIT)) { j++; } - - if (filename[j] == ':' || filename[0] == '/' || filename[0] == '\\') - { - if (m+1 > outputsize) - { - outputsize += m+1; - output = (char *)realloc(output, outputsize); - } - strncpy(output, filename, m); - output[m] = '\0'; - - nn = info->NumberOfIncludeFiles; - for (ii = 0; ii < nn; ii++) - { - if (strcmp(output, info->IncludeFiles[ii]) == 0) - { - free(output); - return info->IncludeFiles[ii]; - } - } - - if (cache_only) - { - free(output); - return NULL; - } - - info->IncludeFiles = (const char **)preproc_array_check( - (char **)info->IncludeFiles, sizeof(char *), - info->NumberOfIncludeFiles); - info->IncludeFiles[info->NumberOfIncludeFiles++] = output; - - return output; - } - - /* Make sure the current filename is already added */ - if (info->FileName) - { - preproc_add_include_file(info, info->FileName); - } - - /* Check twice. First check the cache, then stat the files. */ - for (count = 0; count < (2-cache_only); count++) - { - n = info->NumberOfIncludeDirectories; - for (i = 0; i < (n+1-system_first); i++) - { - /* search the directory of the file being processed */ - if (i == 0 && system_first == 0) - { - if (info->FileName) - { - j = strlen(info->FileName); - while (j > 0) - { - if (info->FileName[j-1] == '/') { break; } - j--; - } - if (m+j+1 > outputsize) - { - outputsize += m+j+1; - output = (char *)realloc(output, outputsize); - } - if (j > 0) - { - strncpy(output, info->FileName, j); - } - strncpy(&output[j], filename, m); - output[j+m] = '\0'; - } - else - { - if (m+1 > outputsize) - { - outputsize += m+1; - output = (char *)realloc(output, outputsize); - } - strncpy(output, filename, m); - output[m] = '\0'; - } - } - /* check all the search paths */ - else - { - directory = info->IncludeDirectories[i-1+system_first]; - j = strlen(directory); - if (j + m + 2 > outputsize) - { - outputsize += j+m+2; - output = (char *)realloc(output, outputsize); - } - - strncpy(output, directory, j); - if (directory[j-1] != '/') { output[j++] = '/'; } - strncpy(&output[j], filename, m); - output[j+m] = '\0'; - } - - if (count == 0) - { - nn = info->NumberOfIncludeFiles; - for (ii = 0; ii < nn; ii++) - { - if (strcmp(output, info->IncludeFiles[ii]) == 0) - { - free(output); - return info->IncludeFiles[ii]; - } - } - } - else if (stat(output, &fs) == 0) - { - info->IncludeFiles = (const char **)preproc_array_check( - (char **)info->IncludeFiles, sizeof(char *), - info->NumberOfIncludeFiles); - info->IncludeFiles[info->NumberOfIncludeFiles++] = output; - - return output; - } - } - } - - free(output); - return NULL; -} - -/** - * Include a file. All macros defined in the included file - * will have their IsExternal flag set. - */ -static int preproc_include_file( - PreprocessInfo *info, const char *filename, int system_first) -{ - char *tbuf; - size_t tbuflen = FILE_BUFFER_SIZE; - char *line; - size_t linelen = 80; - size_t i, j, n, r; - int in_comment = 0; - int in_quote = 0; - int result = VTK_PARSE_OK; - FILE *fp = NULL; - const char *path = NULL; - const char *save_filename; - int save_external; - - /* check to see if the file has aleady been included */ - path = preproc_find_include_file(info, filename, system_first, 1); - if (path != 0) - { -#if PREPROC_DEBUG - int k = 0; - while (filename[k] != '>' && filename[k] != '\"' && - filename[k] != '\n' && filename[k] != '\0') { k++; } - if (filename[k] == '>') - fprintf(stderr, "already loaded file <%*.*s>\n", k, k, filename); - else - fprintf(stderr, "already loaded file \"%*.*s\"\n", k, k, filename); -#endif - - return VTK_PARSE_OK; - } - /* go to the filesystem */ - path = preproc_find_include_file(info, filename, system_first, 0); - if (path == NULL) - { -#if PREPROC_DEBUG - int k = 0; - while (filename[k] != '>' && filename[k] != '\"' && - filename[k] != '\n' && filename[k] != '\0') { k++; } - if (filename[k] == '>') - fprintf(stderr, "couldn't find file <%*.*s>\n", k, k, filename); - else - fprintf(stderr, "couldn't find file \"%*.*s\"\n", k, k, filename); -#endif - return VTK_PARSE_FILE_NOT_FOUND; - } - -#if PREPROC_DEBUG - fprintf(stderr, "including file %s\n", path); -#endif - fp = fopen(path, "r"); - - if (fp == NULL) - { -#if PREPROC_DEBUG - fprintf(stderr, "couldn't open file %s\n", path); -#endif - return VTK_PARSE_FILE_OPEN_ERROR; - } - - save_external = info->IsExternal; - save_filename = info->FileName; - info->IsExternal = 1; - info->FileName = path; - - tbuf = (char *)malloc(tbuflen+4); - line = (char *)malloc(linelen); - - /* the buffer must hold a whole line for it to be processed */ - j = 0; - i = 0; - n = 0; - r = 0; - - do - { - if (i >= n) - { - /* recycle unused lookahead chars */ - if (r) - { - r = n + 2 - i; - if (r == 2) - { - tbuf[0] = tbuf[tbuflen-2]; - tbuf[1] = tbuf[tbuflen-1]; - } - else if (r == 1) - { - tbuf[0] = tbuf[tbuflen-1]; - } - } - - /* read the next chunk of the file */ - i = 0; - if (feof(fp)) - { - /* still have the lookahead chars left */ - n = r; - r = 0; - } - else - { - /* fill the remainder of the buffer */ - errno = 0; - tbuflen = r + FILE_BUFFER_SIZE; - while ((n = fread(&tbuf[r], 1, tbuflen-r, fp)) == 0 && ferror(fp)) - { - if (errno != EINTR) - { - fclose(fp); - free(tbuf); - free(line); - info->IsExternal = save_external; - return VTK_PARSE_FILE_READ_ERROR; - } - errno = 0; - clearerr(fp); - } - - if (n + r < tbuflen) - { - /* this only occurs if the final fread does not fill the buffer */ - n += r; - r = 0; - } - else - { - /* set a lookahead reserve of two chars */ - n -= (2 - r); - r = 2; - } - - /* guard against lookahead past last char in file */ - tbuf[n + r] = '\0'; - } - } - - /* copy the characters until end of line is found */ - while (i < n) - { - /* expand line buffer as necessary */ - while (j+4 > linelen) - { - linelen *= 2; - line = (char *)realloc(line, linelen); - } - - if (in_comment) - { - if (tbuf[i] == '*' && tbuf[i+1] == '/') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - in_comment = 0; - } - else - { - line[j++] = tbuf[i++]; - } - } - else if (in_quote) - { - if (tbuf[i] == '\"') - { - line[j++] = tbuf[i++]; - in_quote = 0; - } - else if (tbuf[i] == '\\' && tbuf[i+1] != '\0') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - } - else - { - line[j++] = tbuf[i++]; - } - } - else if (tbuf[i] == '/' && tbuf[i+1] == '*') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - in_comment = 1; - } - else if (tbuf[i] == '\"') - { - line[j++] = tbuf[i++]; - in_quote = 1; - } - else if (tbuf[i] == '\\' && tbuf[i+1] == '\n') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - } - else if (tbuf[i] == '\\' && tbuf[i+1] == '\r' && tbuf[i+2] == '\n') - { - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - line[j++] = tbuf[i++]; - } - else if (tbuf[i] != '\n' && tbuf[i] != '\0') - { - line[j++] = tbuf[i++]; - } - else - { - line[j++] = tbuf[i++]; - break; - } - } - - if (i < n || n == 0) - { - const char *cp = line; - line[j] = '\0'; - j = 0; - preproc_skip_whitespace(&cp, WS_NO_EOL); - if (*cp == '#') - { - vtkParsePreprocess_HandleDirective(info, line); - } - } - } - while (n > 0); - - free(tbuf); - free(line); - fclose(fp); - - info->IsExternal = save_external; - info->FileName = save_filename; - - return result; -} - -/** - * Handle the #include directive. The header file will - * only go through the preprocessor. - */ -static int preproc_evaluate_include( - PreprocessInfo *info, preproc_tokenizer *tokens) -{ - const char *cp; - const char *filename; - - if (tokens->hash == HASH_INCLUDE) - { - preproc_next(tokens); - - cp = tokens->text; - - if (tokens->tok == TOK_ID) - { - MacroInfo *macro = preproc_find_macro(info, tokens); - if (macro && !macro->IsExcluded && macro->Definition) - { - cp = macro->Definition; - } - else - { -#if PREPROC_DEBUG - fprintf(stderr, "couldn't find macro %*.*s.\n", - (int)tokens->len, (int)tokens->len, tokens->text); -#endif - return VTK_PARSE_MACRO_UNDEFINED; - } - } - - if (*cp == '\"') - { - filename = cp + 1; - preproc_skip_quotes(&cp); - if (cp <= filename + 1 || *(cp-1) != '\"') - { - return VTK_PARSE_SYNTAX_ERROR; - } - - return preproc_include_file(info, filename, 0); - } - else if (*cp == '<') - { - cp++; - filename = cp; - while (*cp != '>' && *cp != '\n' && *cp != '\0') { cp++; } - if (*cp != '>') - { - return VTK_PARSE_SYNTAX_ERROR; - } - - return preproc_include_file(info, filename, 1); - } - } - - return VTK_PARSE_OK; -} - -/** - * Handle any recognized directive. - * Unrecognized directives are ignored. - */ -int vtkParsePreprocess_HandleDirective( - PreprocessInfo *info, const char *directive) -{ - int result = VTK_PARSE_OK; - preproc_tokenizer tokens; - - preproc_init(&tokens, directive); - - if (tokens.tok != '#') - { - return VTK_PARSE_SYNTAX_ERROR; - } - - preproc_next(&tokens); - - if (tokens.tok == TOK_ID) - { - if ((tokens.hash == HASH_IFDEF && tokens.len == 5 && - strncmp("ifdef", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_IFNDEF && tokens.len == 6 && - strncmp("ifndef", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_IF && tokens.len == 2 && - strncmp("if", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_ELIF && tokens.len == 4 && - strncmp("elif", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_ELSE && tokens.len == 4 && - strncmp("else", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_ENDIF && tokens.len == 5 && - strncmp("endif", tokens.text, tokens.len) == 0)) - { - result = preproc_evaluate_if(info, &tokens); - while (tokens.tok) { preproc_next(&tokens); } -#if PREPROC_DEBUG - { - size_t n = tokens.text - directive; - - if (result == VTK_PARSE_SKIP) - { - fprintf(stderr, "SKIP: "); - } - else if (result == VTK_PARSE_OK) - { - fprintf(stderr, "READ: "); - } - else - { - fprintf(stderr, "ERR%-2.2d ", result); - } - fprintf(stderr, "%*.*s\n", (int)n, (int)n, directive); - } -#endif - } - else if (info->ConditionalDepth == 0) - { - if ((tokens.hash == HASH_DEFINE && tokens.len == 6 && - strncmp("define", tokens.text, tokens.len) == 0) || - (tokens.hash == HASH_UNDEF && tokens.len == 5 && - strncmp("undef", tokens.text, tokens.len) == 0)) - { - result = preproc_evaluate_define(info, &tokens); - } - else if (tokens.hash == HASH_INCLUDE && tokens.len == 7 && - strncmp("include", tokens.text, tokens.len) == 0) - { - result = preproc_evaluate_include(info, &tokens); - } - } - } - - if (info->ConditionalDepth > 0) - { - return VTK_PARSE_SKIP; - } - - return result; -} - -/** - * Evaluate a preprocessor expression. - * If no errors occurred, the result will be VTK_PARSE_OK. - */ -int vtkParsePreprocess_EvaluateExpression( - PreprocessInfo *info, const char *text, - preproc_int_t *val, int *is_unsigned) -{ - preproc_tokenizer tokens; - preproc_init(&tokens, text); - - return preproc_evaluate_expression(info, &tokens, val, is_unsigned); -} - -/** Add a macro for defining a macro */ -#define PREPROC_MACRO_TO_STRING2(x) #x -#define PREPROC_MACRO_TO_STRING(x) PREPROC_MACRO_TO_STRING2(x) -#define PREPROC_ADD_MACRO(info, x) \ -preproc_add_macro_definition(info, #x, PREPROC_MACRO_TO_STRING2(x)) - -/** - * Add all standard preprocessory macros. Specify the platform. - */ -void vtkParsePreprocess_AddStandardMacros( - PreprocessInfo *info, int platform) -{ - int save_external = info->IsExternal; - info->IsExternal = 1; - - /* a special macro to indicate that this is the wrapper */ - preproc_add_macro_definition(info, "__WRAP__", "1"); - - /* language macros - assume that we are wrapping C++ code */ - preproc_add_macro_definition(info, "__cplusplus", "1"); - - /* stdc version macros */ -#ifdef __STDC__ - PREPROC_ADD_MACRO(info, __STDC__); -#endif -#ifdef __STDC_VERSION__ - PREPROC_ADD_MACRO(info, __STDC_VERSION__); -#endif -#ifdef __STDC_HOSTED__ - PREPROC_ADD_MACRO(info, __STDC_HOSTED__); -#endif - - if (platform == VTK_PARSE_NATIVE) - { -#ifdef WIN32 - PREPROC_ADD_MACRO(info, WIN32); -#endif -#ifdef _WIN32 - PREPROC_ADD_MACRO(info, _WIN32); -#endif -#ifdef _MSC_VER - PREPROC_ADD_MACRO(info, _MSC_VER); -#endif - -#ifdef __BORLAND__ - PREPROC_ADD_MACRO(info, __BORLAND__); -#endif - -#ifdef __CYGWIN__ - PREPROC_ADD_MACRO(info, __CYGWIN__); -#endif -#ifdef MINGW - PREPROC_ADD_MACRO(info, MINGW); -#endif -#ifdef __MINGW32__ - PREPROC_ADD_MACRO(info, __MINGW32__); -#endif - -#ifdef __linux__ - PREPROC_ADD_MACRO(info, __linux__); -#endif -#ifdef __LINUX__ - PREPROC_ADD_MACRO(info, __LINUX__); -#endif - -#ifdef __APPLE__ - PREPROC_ADD_MACRO(info, __APPLE__); -#endif -#ifdef __MACH__ - PREPROC_ADD_MACRO(info, __MACH__); -#endif -#ifdef __DARWIN__ - PREPROC_ADD_MACRO(info, __DARWIN__); -#endif - -#ifdef __GNUC__ - PREPROC_ADD_MACRO(info, __GNUC__); -#endif -#ifdef __LP64__ - PREPROC_ADD_MACRO(info, __LP64__); -#endif -#ifdef __BIG_ENDIAN__ - PREPROC_ADD_MACRO(info, __BIG_ENDIAN__); -#endif -#ifdef __LITTLE_ENDIAN__ - PREPROC_ADD_MACRO(info, __LITTLE_ENDIAN__); -#endif - } - - info->IsExternal = save_external; -} - -/** - * Add a preprocessor macro, including a definition. - */ -int vtkParsePreprocess_AddMacro( - PreprocessInfo *info, const char *name, const char *definition) -{ - preproc_tokenizer token; - MacroInfo **macro_p; - MacroInfo *macro; - - preproc_init(&token, name); - macro_p = preproc_macro_location(info, &token, 1); - if (*macro_p) - { - macro = *macro_p; - if (preproc_identical(macro->Definition, definition)) - { - return VTK_PARSE_OK; - } - else - { - return VTK_PARSE_MACRO_REDEFINED; - } - } - - macro = preproc_new_macro(info, name, definition); - macro->IsExternal = 1; - *macro_p = macro; - - return VTK_PARSE_OK; -} - -/** - * Return a preprocessor macro struct, or NULL if not found. - */ -MacroInfo *vtkParsePreprocess_GetMacro( - PreprocessInfo *info, const char *name) -{ - preproc_tokenizer token; - MacroInfo *macro; - - preproc_init(&token, name); - macro = preproc_find_macro(info, &token); - - if (macro && !macro->IsExcluded) - { - return macro; - } - - return NULL; -} - -/** - * Remove a preprocessor macro. - */ -int vtkParsePreprocess_RemoveMacro( - PreprocessInfo *info, const char *name) -{ - preproc_tokenizer token; - - preproc_init(&token, name); - - if (preproc_remove_macro(info, &token)) - { - return VTK_PARSE_OK; - } - - return VTK_PARSE_MACRO_UNDEFINED; -} - -/** - * Expand a macro, argstring is ignored if not a function macro - */ -const char *vtkParsePreprocess_ExpandMacro( - PreprocessInfo *info, MacroInfo *macro, const char *argstring) -{ - const char *cp = argstring; - int n = 0; - int j = 0; - const char *stack_values[8]; - const char **values = NULL; - const char *pp = NULL; - const char *dp = NULL; - const char *wp = NULL; - char stack_rp[128]; - char *rp = NULL; - size_t rs = 0; - size_t i = 0; - size_t l = 0; - size_t k = 0; - int stringify = 0; - int noexpand = 0; - int depth = 1; - int c; - - if (macro->IsFunction) - { - if (argstring == NULL || *cp != '(') - { - return NULL; - } - - /* break the string into individual argument values */ - values = stack_values; - - cp++; - values[n++] = cp; - while (depth > 0 && *cp != '\0') - { - while (*cp != '\0') - { - if (*cp == '\"' || *cp == '\'') - { - preproc_skip_quotes(&cp); - } - else if (cp[0] == '/' && (cp[1] == '*' || cp[1] == '/')) - { - preproc_skip_comment(&cp); - } - else if (*cp == '(') - { - cp++; - depth++; - } - else if (*cp == ')') - { - cp++; - if (--depth == 0) - { - break; - } - } - else if (*cp == ',') - { - cp++; - if (depth == 1) - { - break; - } - } - else if (*cp != '\0') - { - cp++; - } - } - if (n >= 8 && (n & (n-1)) == 0) - { - if (values != stack_values) - { - values = (const char **)realloc( - (char **)values, 2*n*sizeof(const char **)); - } - else - { - values = (const char **)malloc(2*n*sizeof(const char **)); - memcpy((char **)values, stack_values, 8*sizeof(const char **)); - } - } - - values[n++] = cp; - } - --n; - - /* diagnostic: print out the values */ -#if PREPROC_DEBUG - for (j = 0; j < n; j++) - { - size_t m = values[j+1] - values[j] - 1; - fprintf(stderr, "arg %i: %*.*s\n", - (int)j, (int)m, (int)m, values[j]); - } -#endif - - if (macro->NumberOfParameters == 0 && n == 1) - { - const char *tp = values[0]; - preproc_skip_whitespace(&tp, WS_NO_EOL); - if (tp + 1 >= values[1]) - { - n = 0; - } - } - - if (n != macro->NumberOfParameters) - { - if (values != stack_values) { free((char **)values); } -#if PREPROC_DEBUG - fprintf(stderr, "wrong number of macro args to %s, %lu != %lu\n", - macro->Name, n, macro->NumberOfParameters); -#endif - return NULL; - } - } - - cp = macro->Definition; - cp = (cp ? cp : ""); - dp = cp; - rp = stack_rp; - rp[0] = '\0'; - rs = 128; - - while (*cp != '\0') - { - pp = cp; - wp = cp; - stringify = 0; - noexpand = 0; - /* skip all chars that aren't part of a name */ - while (!preproc_chartype(*cp, CPRE_ID) && *cp != '\0') - { - dp = cp; - preproc_skip_whitespace(&cp, WS_NO_EOL); - if (cp > dp) - { - dp = cp; - } - else if (preproc_chartype(*cp, CPRE_QUOTE)) - { - preproc_skip_quotes(&cp); - dp = cp; - wp = cp; - noexpand = 0; - } - else if (preproc_chartype(*cp, CPRE_DIGIT)) - { - preproc_skip_number(&cp); - dp = cp; - wp = cp; - noexpand = 0; - } - else if (cp[0] == '#' && cp[1] == '#') - { - noexpand = 1; - dp = wp; - cp += 2; - wp = cp; - preproc_skip_whitespace(&cp, WS_NO_EOL); - break; - } - else if (*cp == '#') - { - stringify = 1; - dp = cp; - wp = cp; - cp++; - preproc_skip_whitespace(&cp, WS_NO_EOL); - break; - } - else - { - cp++; - dp = cp; - wp = cp; - } - } - l = dp - pp; - if (l > 0) - { - if (i + l + 1 >= rs) - { - rs += rs + i + l + 1; - if (rp != stack_rp) - { - rp = (char *)realloc(rp, rs); - } - else - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - } - strncpy(&rp[i], pp, l); - i += l; - rp[i] = '\0'; - } - - /* get the name */ - pp = cp; - preproc_skip_name(&cp); - l = cp - pp; - if (l > 0) - { - for (j = 0; j < n; j++) - { - /* check whether the name matches a parameter */ - if (strncmp(pp, macro->Parameters[j], l) == 0 && - macro->Parameters[j][l] == '\0') - { - /* substitute the argument value */ - l = values[j+1] - values[j] - 1; - pp = values[j]; - /* remove leading whitespace from argument */ - c = *pp; - while (preproc_chartype(c, CPRE_WHITE)) - { - c = *(++pp); - l--; - } - /* remove trailing whitespace from argument */ - if (l > 0) - { - c = pp[l - 1]; - while (preproc_chartype(c, CPRE_WHITE)) - { - if (--l == 0) - { - break; - } - c = pp[l-1]; - } - } - /* check if followed by "##" */ - wp = cp; - preproc_skip_whitespace(&wp, WS_NO_EOL); - if (wp[0] == '#' && wp[1] == '#') - { - noexpand = 1; - } - break; - } - } - if (stringify) - { - /* compute number of chars that will be added */ - stringify = 2; - for (k = 0; k < l; k++) - { - c = pp[k]; - if (c == '\\' || c == '\"') - { - stringify++; - } - } - } - if (i + l + stringify + 1 >= rs) - { - rs += rs + i + l + 1; - if (rp != stack_rp) - { - rp = (char *)realloc(rp, rs); - } - else - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - } - if (stringify) - { - rp[i++] = '\"'; - for (k = 0; k < l; k++) - { - c = pp[k]; - if (c == '\\' || c == '\"') - { - rp[i++] = '\\'; - } - rp[i++] = c; - } - rp[i++] = '\"'; - } - else if (noexpand) - { - strncpy(&rp[i], pp, l); - i += l; - } - else - { - /* process the arguments before substituting them */ - const char *text; - int is_excluded = macro->IsExcluded; - macro->IsExcluded = 1; - strncpy(&rp[i], pp, l); - rp[i + l] = '\0'; - text = vtkParsePreprocess_ProcessString(info, &rp[i]); - if (text) - { - l = strlen(text); - if (text != &rp[i]) - { - char *tp = NULL; - if (i + l + 1 >= rs) - { - rs += rs + i + l + 1; - tp = rp; - rp = (char *)malloc(rs); - memcpy(rp, tp, i); - } - strncpy(&rp[i], text, l); - vtkParsePreprocess_FreeProcessedString(info, text); - if (tp && tp != stack_rp) - { - free(tp); - } - } - } - macro->IsExcluded = is_excluded; - i += l; - } - rp[i] = '\0'; - } - } - - if (values != stack_values) { free((char **)values); } - - if (!macro->IsFunction && macro->Definition && - strcmp(rp, macro->Definition) == 0) - { - if (rp != stack_rp) { free(rp); } - return macro->Definition; - } - - if (rp == stack_rp) - { - rp = (char *)malloc(strlen(stack_rp) + 1); - strcpy(rp, stack_rp); - } - - return rp; -} - -/** - * Process a string - */ -const char *vtkParsePreprocess_ProcessString( - PreprocessInfo *info, const char *text) -{ - char stack_rp[128]; - char *rp; - char *ep; - size_t i = 0; - size_t rs = 128; - int last_tok = 0; - preproc_tokenizer tokens; - preproc_init(&tokens, text); - - rp = stack_rp; - rp[0] = '\0'; - - while (tokens.tok) - { - size_t l = tokens.len; - size_t j; - const char *cp = tokens.text; - const char *dp; - - if (tokens.tok == TOK_STRING && last_tok == TOK_STRING) - { - if (i > 0) - { - do { --i; } while (i > 0 && rp[i] != '\"'); - } - cp++; - } - - if (i + l + 2 >= rs) - { - rs += rs + i + l + 2; - if (rp == stack_rp) - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - else - { - rp = (char *)realloc(rp, rs); - } - } - - /* copy the token, removing backslash-newline */ - dp = cp; - ep = &rp[i]; - for (j = 0; j < l; j++) - { - if (*dp == '\\') - { - if (dp[1] == '\n') { dp += 2; } - else if (dp[1] == '\r' && dp[2] == '\n') { dp += 3; } - else { *ep++ = *dp++; } - } - else - { - *ep++ = *dp++; - } - } - l = ep - &rp[i]; - - if (tokens.tok == TOK_ID) - { - MacroInfo *macro = preproc_find_macro(info, &tokens); - if (macro && !macro->IsExcluded) - { - const char *args = NULL; - int expand = 1; - - if (macro->IsFunction) - { - /* expand function macros using the arguments */ - preproc_next(&tokens); - if (tokens.tok == '(') - { - int depth = 1; - args = tokens.text; - while (depth > 0 && preproc_next(&tokens)) - { - if (tokens.tok == '(') - { - depth++; - } - else if (tokens.tok == ')') - { - depth--; - } - } - if (tokens.tok != ')') - { - if (rp != stack_rp) { free(rp); } - return NULL; - } - } - else - { - /* unput the last token if it isn't "(" */ - tokens.len = l; - tokens.text = cp; - expand = 0; - } - } - if (expand) - { - const char *expansion; - const char *processed; - expansion = vtkParsePreprocess_ExpandMacro(info, macro, args); - if (expansion == NULL) - { - if (rp != stack_rp) { free(rp); } - return NULL; - } - macro->IsExcluded = 1; - processed = vtkParsePreprocess_ProcessString(info, expansion); - macro->IsExcluded = 0; - if (processed == NULL) - { - vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); - if (rp != stack_rp) { free(rp); } - return NULL; - } - l = strlen(processed); - if (l > 0) - { - if (i + l + 2 >= rs) - { - rs += rs + i + l + 2; - if (rp == stack_rp) - { - rp = (char *)malloc(rs); - memcpy(rp, stack_rp, i); - } - else - { - rp = (char *)realloc(rp, rs); - } - } - strncpy(&rp[i], processed, l); - } - if (processed != expansion) - { - vtkParsePreprocess_FreeProcessedString(info, processed); - } - vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); - } - } - } - - i += l; - - last_tok = tokens.tok; - l = tokens.len; - cp = tokens.text; - if (preproc_next(&tokens) && tokens.text > cp + l) - { - rp[i++] = ' '; - } - } - rp[i] = '\0'; - - if (strcmp(rp, text) == 0) - { - /* no change, return */ - if (rp != stack_rp) { free(rp); } - return text; - } - else - { - /* string changed, recursively reprocess */ - const char *tp = vtkParsePreprocess_ProcessString(info, rp); - if (rp != tp) - { - if (rp != stack_rp) { free(rp); } - return tp; - } - if (rp == stack_rp) - { - rp = (char *)malloc(strlen(stack_rp) + 1); - strcpy(rp, stack_rp); - } - } - - return rp; -} - -/** - * Free a string returned by ExpandMacro - */ -void vtkParsePreprocess_FreeMacroExpansion( - PreprocessInfo *info, MacroInfo *macro, const char *text) -{ - /* only free expansion if it is different from definition */ - if (info && text != macro->Definition) - { - free((char *)text); - } -} - -/** - * Free a string returned by ProcessString - */ -void vtkParsePreprocess_FreeProcessedString( - PreprocessInfo *info, const char *text) -{ - if (info) - { - free((char *)text); - } -} - -/** - * Add an include directory. - */ -void vtkParsePreprocess_IncludeDirectory( - PreprocessInfo *info, const char *name) -{ - int i, n; - - n = info->NumberOfIncludeDirectories; - for (i = 0; i < n; i++) - { - if (strcmp(name, info->IncludeDirectories[i]) == 0) - { - return; - } - } - - info->IncludeDirectories = (const char **)preproc_array_check( - (char **)info->IncludeDirectories, sizeof(char *), - info->NumberOfIncludeDirectories); - info->IncludeDirectories[info->NumberOfIncludeDirectories++] = - preproc_strndup(name, strlen(name)); -} - -/** - * Find an include file in the path. If system_first is set, - * then the current directory is not searched. - */ -const char *vtkParsePreprocess_FindIncludeFile( - PreprocessInfo *info, const char *filename, int system_first, - int *already_loaded) -{ - const char *cp; - cp = preproc_find_include_file(info, filename, system_first, 1); - if (cp) - { - *already_loaded = 1; - return cp; - } - - *already_loaded = 0; - return preproc_find_include_file(info, filename, system_first, 0); -} - -/** - * Initialize a preprocessor macro struct - */ -void vtkParsePreprocess_InitMacro(MacroInfo *macro) -{ - macro->Name = NULL; - macro->Definition = NULL; - macro->Comment = NULL; - macro->NumberOfParameters = 0; - macro->Parameters = NULL; - macro->IsFunction = 0; - macro->IsExternal = 0; - macro->IsExcluded = 0; -} - -/** - * Free a preprocessor macro struct - */ -void vtkParsePreprocess_FreeMacro(MacroInfo *macro) -{ - int i, n; - - free((char *)macro->Name); - free((char *)macro->Definition); - free((char *)macro->Comment); - - n = macro->NumberOfParameters; - for (i = 0; i < n; i++) - { - free((char *)macro->Parameters[i]); - } - free((char **)macro->Parameters); - - free(macro); -} - -/** - * Initialize a preprocessor struct - */ -void vtkParsePreprocess_Init( - PreprocessInfo *info, const char *filename) -{ - info->FileName = NULL; - info->MacroHashTable = NULL; - info->NumberOfIncludeDirectories = 0; - info->IncludeDirectories = NULL; - info->NumberOfIncludeFiles = 0; - info->IncludeFiles = NULL; - info->IsExternal = 0; - info->ConditionalDepth = 0; - info->ConditionalDone = 0; - - if (filename) - { - info->FileName = preproc_strndup(filename, strlen(filename)); - } -} - -/** - * Free a preprocessor struct and its contents - */ -void vtkParsePreprocess_Free(PreprocessInfo *info) -{ - int i, n; - MacroInfo **mptr; - - free((char *)info->FileName); - - if (info->MacroHashTable) - { - n = PREPROC_HASH_TABLE_SIZE; - for (i = 0; i < n; i++) - { - mptr = info->MacroHashTable[i]; - if (mptr) - { - while (*mptr) - { - vtkParsePreprocess_FreeMacro(*mptr++); - } - } - free(info->MacroHashTable[i]); - } - free(info->MacroHashTable); - } - - n = info->NumberOfIncludeDirectories; - for (i = 0; i < n; i++) - { - free((char *)info->IncludeDirectories[i]); - } - free((char **)info->IncludeDirectories); - - n = info->NumberOfIncludeFiles; - for (i = 0; i < n; i++) - { - free((char *)info->IncludeFiles[i]); - } - free((char **)info->IncludeFiles); - - free(info); -} diff --git a/src/ParaView/vtkParsePreprocess.h b/src/ParaView/vtkParsePreprocess.h deleted file mode 100644 index 9a4010b2..00000000 --- a/src/ParaView/vtkParsePreprocess.h +++ /dev/null @@ -1,250 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParsePreprocess.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - This file provides subroutines to assist in preprocessing - C/C++ header files. It evaluates preprocessor directives - and stores a list of all preprocessor macros. - - The preprocessing is done in-line while the file is being - parsed. Macros that are defined in the file are stored but - are not automatically expanded. The parser can query the - macro definitions, expand them into plain text, or ask the - preprocessor to evaluate them and return an integer result. - - The typical usage of this preprocessor is that the main - parser will pass any lines that begin with '#' to the - vtkParsePreprocess_HandleDirective() function, which will - evaluate the line and provide a return code. The return - code will tell the main parser if a syntax error or macro - lookup error occurred, and will also let the parser know - if an #if or #else directive requires that the next block - of code be skipped. -*/ - -#ifndef VTK_PARSE_PREPROCESS_H -#define VTK_PARSE_PREPROCESS_H - -/** - * The preprocessor int type. Use the compiler's longest int type. - */ -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) -typedef __int64 preproc_int_t; -typedef unsigned __int64 preproc_uint_t; -#else -typedef long long preproc_int_t; -typedef unsigned long long preproc_uint_t; -#endif - -/** - * Struct to describe a preprocessor symbol. - */ -typedef struct _MacroInfo -{ - const char *Name; - const char *Definition; - const char *Comment; /* unused */ - int NumberOfParameters; /* only if IsFunction == 1 */ - const char **Parameters; /* symbols for parameters */ - int IsFunction; /* this macro requires arguments */ - int IsExternal; /* this macro is from an included file */ - int IsExcluded; /* do not expand this macro */ -} MacroInfo; - -/** - * Contains all symbols defined thus far (including those defined - * in any included header files). - */ -typedef struct _PreprocessInfo -{ - const char *FileName; /* the file that is being parsed */ - MacroInfo ***MacroHashTable; /* hash table for macro lookup */ - int NumberOfIncludeDirectories; - const char **IncludeDirectories; - int NumberOfIncludeFiles; /* all included files */ - const char **IncludeFiles; - int IsExternal; /* label all macros as "external" */ - int ConditionalDepth; /* internal state variable */ - int ConditionalDone; /* internal state variable */ -} PreprocessInfo; - -/** - * Platforms. Always choose native unless crosscompiling. - */ -enum _preproc_platform_t { - VTK_PARSE_NATIVE = 0, -}; - -/** - * Directive return values. - */ -enum _preproc_return_t { - VTK_PARSE_OK = 0, - VTK_PARSE_SKIP = 1, /* skip next block */ - VTK_PARSE_PREPROC_DOUBLE = 2, /* encountered a double */ - VTK_PARSE_PREPROC_FLOAT = 3, /* encountered a float */ - VTK_PARSE_PREPROC_STRING = 4, /* encountered a string */ - VTK_PARSE_MACRO_UNDEFINED = 5, /* macro lookup failed */ - VTK_PARSE_MACRO_REDEFINED = 6, /* attempt to redefine a macro */ - VTK_PARSE_FILE_NOT_FOUND = 7, /* include file not found */ - VTK_PARSE_FILE_OPEN_ERROR = 8, /* include file not readable */ - VTK_PARSE_FILE_READ_ERROR = 9, /* error during read */ - VTK_PARSE_MACRO_NUMARGS = 10, /* wrong number of args to func macro */ - VTK_PARSE_SYNTAX_ERROR = 11 /* any and all syntax errors */ -}; - -/** - * Bitfield for fatal errors. - */ -#define VTK_PARSE_FATAL_ERROR 0xF8 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Handle a preprocessor directive. Return value VTK_PARSE_OK - * means that no errors occurred, while VTK_PARSE_SKIP means that - * a conditional directive was encountered and the next code - * block should be skipped. The preprocessor has an internal state - * machine that keeps track of conditional if/else/endif directives. - * All other return values indicate errors, and it is up to the - * parser to decide which errors are fatal. The preprocessor - * only considers syntax errors and I/O errors to be fatal. - */ -int vtkParsePreprocess_HandleDirective( - PreprocessInfo *info, const char *directive); - -/** - * Evaluate a preprocessor expression, providing an integer result - * in "val", and whether it is unsigned in "is_unsigned". A return - * value of VTK_PARSE_OK means that no errors occurred, while - * VTK_PREPROC_DOUBLE, VTK_PREPROC_FLOAT, and VTK_PREPROC_STRING - * indicate that the preprocessor encountered a non-integer value. - * Error return values are VTK_PARSE_MACRO_UNDEFINED and - * VTK_PARSE_SYNTAX_ERRORS. Undefined macros evaluate to zero. - */ -int vtkParsePreprocess_EvaluateExpression( - PreprocessInfo *info, const char *text, - preproc_int_t *val, int *is_unsigned); - -/** - * Add all standard preprocessor symbols. Use VTK_PARSE_NATIVE - * as the platform. In the future, other platform specifiers - * might be added to allow crosscompiling. - */ -void vtkParsePreprocess_AddStandardMacros( - PreprocessInfo *info, int platform); - -/** - * Add a preprocessor symbol, including a definition. Return - * values are VTK_PARSE_OK and VTK_PARSE_MACRO_REDEFINED. - */ -int vtkParsePreprocess_AddMacro( - PreprocessInfo *info, const char *name, const char *definition); - -/** - * Remove a preprocessor symbol. Return values are VTK_PARSE_OK - * and VTK_PARSE_MACRO_UNDEFINED. - */ -int vtkParsePreprocess_RemoveMacro( - PreprocessInfo *info, const char *name); - -/** - * Return a preprocessor symbol struct, or NULL if not found. - */ -MacroInfo *vtkParsePreprocess_GetMacro( - PreprocessInfo *info, const char *name); - -/** - * Expand a macro. A function macro must be given an argstring - * with args in parentheses, otherwise the argstring can be NULL. - * returns NULL if the wrong number of arguments were given. - */ -const char *vtkParsePreprocess_ExpandMacro( - PreprocessInfo *info, MacroInfo *macro, const char *argstring); - -/** - * Free an expanded macro - */ -void vtkParsePreprocess_FreeMacroExpansion( - PreprocessInfo *info, MacroInfo *macro, const char *text); - -/** - * Fully process a string with the preprocessor, and - * return a new string or NULL if a fatal error occurred. - */ -const char *vtkParsePreprocess_ProcessString( - PreprocessInfo *info, const char *text); - -/** - * Free a processed string. Only call this method if - * the string returned by ProcessString is different from - * the original string, because ProcessString will just - * return the original string if no processing was needed. - */ -void vtkParsePreprocess_FreeProcessedString( - PreprocessInfo *info, const char *text); - -/** - * Add an include directory. The directories that were added - * first will be searched first. - */ -void vtkParsePreprocess_IncludeDirectory( - PreprocessInfo *info, const char *name); - -/** - * Find an include file in the path. If system_first is set, then - * the current directory is ignored unless it is explicitly in the - * path. A null return value indicates that the file was not found. - * If already_loaded is set, then the file was already loaded. This - * preprocessor never loads the same file twice. - */ -const char *vtkParsePreprocess_FindIncludeFile( - PreprocessInfo *info, const char *filename, int system_first, - int *already_loaded); - -/** - * Initialize a preprocessor symbol struct. - */ -void vtkParsePreprocess_InitMacro(MacroInfo *symbol); - -/** - * Free a preprocessor macro struct - */ -void vtkParsePreprocess_FreeMacro(MacroInfo *macro); - -/** - * Initialize a preprocessor struct. - */ -void vtkParsePreprocess_Init( - PreprocessInfo *info, const char *filename); - -/** - * Free a preprocessor struct and its contents; - */ -void vtkParsePreprocess_Free(PreprocessInfo *info); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkParseString.c b/src/ParaView/vtkParseString.c deleted file mode 100644 index f1863c02..00000000 --- a/src/ParaView/vtkParseString.c +++ /dev/null @@ -1,119 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseString.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2012 David Gobbi. - - Contributed to the VisualizationToolkit by the author in April 2012 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -#include "vtkParseString.h" -#include -#include - -/*---------------------------------------------------------------- - * String utility methods - * - * Strings are centrally allocated and are const. They should not - * be freed until the parse is complete and all the data structures - * generated by the parse have been freed. - */ - -/* allocate a string of n+1 bytes */ -void vtkParse_InitStringCache(StringCache *cache) -{ - cache->NumberOfChunks = 0; - cache->Chunks = NULL; - cache->ChunkSize = 0; - cache->Position = 0; -} - -/* allocate a string of n+1 bytes */ -char *vtkParse_NewString(StringCache *cache, size_t n) -{ - size_t nextPosition; - char *cp; - - if (cache->ChunkSize == 0) - { - cache->ChunkSize = 8176; - } - - // align next start position on an 8-byte boundary - nextPosition = (((cache->Position + n + 8) | 7 ) - 7); - - if (cache->NumberOfChunks == 0 || nextPosition > cache->ChunkSize) - { - if (n + 1 > cache->ChunkSize) - { - cache->ChunkSize = n + 1; - } - cp = (char *)malloc(cache->ChunkSize); - - /* if empty, alloc for the first time */ - if (cache->NumberOfChunks == 0) - { - cache->Chunks = (char **)malloc(sizeof(char *)); - } - /* if count is power of two, reallocate with double size */ - else if ((cache->NumberOfChunks & (cache->NumberOfChunks-1)) == 0) - { - cache->Chunks = (char **)realloc( - cache->Chunks, (2*cache->NumberOfChunks)*sizeof(char *)); - } - - cache->Chunks[cache->NumberOfChunks++] = cp; - - cache->Position = 0; - nextPosition = (((n + 8) | 7) - 7); - } - - cp = &cache->Chunks[cache->NumberOfChunks-1][cache->Position]; - cp[0] = '\0'; - - cache->Position = nextPosition; - - return cp; -} - -/* free all allocated strings */ -void vtkParse_FreeStringCache(StringCache *cache) -{ - unsigned long i; - - for (i = 0; i < cache->NumberOfChunks; i++) - { - free(cache->Chunks[i]); - } - if (cache->Chunks) - { - free(cache->Chunks); - } - - cache->Chunks = NULL; - cache->NumberOfChunks = 0; -} - -/* duplicate the first n bytes of a string and terminate it */ -const char *vtkParse_CacheString(StringCache *cache, const char *in, size_t n) -{ - char *res = NULL; - - res = vtkParse_NewString(cache, n); - strncpy(res, in, n); - res[n] = '\0'; - - return res; -} diff --git a/src/ParaView/vtkParseString.h b/src/ParaView/vtkParseString.h deleted file mode 100644 index 11430827..00000000 --- a/src/ParaView/vtkParseString.h +++ /dev/null @@ -1,78 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkParseString.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/* - String allocation routines used by vtkParse. - - The parser uses "const char *" as its string object type, and expects - all string objects to persist and be constant for the entire lifetime - of the data generated by the parse (usually this means until the parser - executable has exited). All strings that are stored in the parser's - data objects should either be statically allocated, or allocated with - the vtkParse_NewString() or vtkParse_CacheString() methods declared here. -*/ - -#ifndef VTK_PARSE_STRING_H -#define VTK_PARSE_STRING_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * StringCache provides a simple way of allocating strings centrally. - * It eliminates the need to allocate and free each individual strings, - * which makes the code simpler and more efficient. - */ -typedef struct _StringCache -{ - unsigned long NumberOfChunks; - char **Chunks; - size_t ChunkSize; - size_t Position; -} StringCache; - -/** - * Initialize the string cache. - */ -void vtkParse_InitStringCache(StringCache *cache); - -/** - * Alocate a new string from the cache. - * A total of n+1 bytes will be allocated, to leave room for null. - */ -char *vtkParse_NewString(StringCache *cache, size_t n); - -/** - * Cache a string so that it can then be used in the vtkParse data - * structures. The string will last until the application exits. - * At most 'n' chars will be copied, and the string will be terminated. - * If a null pointer is provided, then a null pointer will be returned. - */ -const char *vtkParse_CacheString(StringCache *cache, const char *cp, size_t n); - -/** - * Free all strings that were created with vtkParse_NewString() or - * with vtkParse_CacheString(). - */ -void vtkParse_FreeStringCache(StringCache *cache); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/ParaView/vtkWrap.c b/src/ParaView/vtkWrap.c deleted file mode 100644 index 25ede98b..00000000 --- a/src/ParaView/vtkWrap.c +++ /dev/null @@ -1,1032 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrap.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#include "vtkWrap.h" -#include "vtkParseData.h" -#include "vtkParseExtras.h" -#include "vtkParseString.h" -#include -#include -#include - -/* -------------------------------------------------------------------- */ -/* Common types. */ - -int vtkWrap_IsVoid(ValueInfo *val) -{ - if (val == 0) - { - return 1; - } - - return ((val->Type & VTK_PARSE_UNQUALIFIED_TYPE) == VTK_PARSE_VOID); -} - -int vtkWrap_IsVoidFunction(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - - if (t == VTK_PARSE_FUNCTION_PTR || t == VTK_PARSE_FUNCTION) - { - /* check for signature "void (*func)(void *)" */ - if (val->Function->NumberOfParameters == 1 && - val->Function->Parameters[0]->Type == VTK_PARSE_VOID_PTR && - val->Function->Parameters[0]->NumberOfDimensions == 0 && - val->Function->ReturnValue->Type == VTK_PARSE_VOID) - { - return 1; - } - } - - return 0; -} - -int vtkWrap_IsVoidPointer(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_VOID && vtkWrap_IsPointer(val)); -} - -int vtkWrap_IsCharPointer(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_CHAR && vtkWrap_IsPointer(val)); -} - -int vtkWrap_IsVTKObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - return (t == VTK_PARSE_OBJECT_PTR && - val->Class[0] == 'v' && strncmp(val->Class, "vtk", 3) == 0); -} - -int vtkWrap_IsSpecialObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - return ((t == VTK_PARSE_OBJECT || - t == VTK_PARSE_OBJECT_REF) && - val->Class[0] == 'v' && strncmp(val->Class, "vtk", 3) == 0); -} - -int vtkWrap_IsQtObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - if (t == VTK_PARSE_QOBJECT && - val->Class[0] == 'Q' && isupper(val->Class[1])) - { - return 1; - } - return 0; -} - -int vtkWrap_IsQtEnum(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - if ((t == VTK_PARSE_QOBJECT || t == VTK_PARSE_QOBJECT_REF) && - val->Class[0] == 'Q' && strncmp("Qt::", val->Class, 4) == 0) - { - return 1; - } - return 0; -} - - -/* -------------------------------------------------------------------- */ -/* The base types, all are mutually exclusive. */ - -int vtkWrap_IsObject(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_OBJECT || - t == VTK_PARSE_QOBJECT); -} - -int vtkWrap_IsFunction(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_FUNCTION); -} - -int vtkWrap_IsStream(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_ISTREAM || - t == VTK_PARSE_OSTREAM); -} - -int vtkWrap_IsNumeric(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - - t = (t & ~VTK_PARSE_UNSIGNED); - switch (t) - { - case VTK_PARSE_FLOAT: - case VTK_PARSE_DOUBLE: - case VTK_PARSE_CHAR: - case VTK_PARSE_SHORT: - case VTK_PARSE_INT: - case VTK_PARSE_LONG: - case VTK_PARSE_ID_TYPE: - case VTK_PARSE_LONG_LONG: - case VTK_PARSE___INT64: - case VTK_PARSE_SIGNED_CHAR: - case VTK_PARSE_SSIZE_T: - case VTK_PARSE_BOOL: - return 1; - } - - return 0; -} - -int vtkWrap_IsString(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_STRING || - t == VTK_PARSE_UNICODE_STRING); -} - -/* -------------------------------------------------------------------- */ -/* Subcategories */ - -int vtkWrap_IsBool(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_BOOL); -} - -int vtkWrap_IsChar(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_CHAR); -} - -int vtkWrap_IsInteger(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - - if (t != VTK_PARSE_UNSIGNED_CHAR) - { - t = (t & ~VTK_PARSE_UNSIGNED); - } - switch (t) - { - case VTK_PARSE_SHORT: - case VTK_PARSE_INT: - case VTK_PARSE_LONG: - case VTK_PARSE_ID_TYPE: - case VTK_PARSE_LONG_LONG: - case VTK_PARSE___INT64: - case VTK_PARSE_UNSIGNED_CHAR: - case VTK_PARSE_SIGNED_CHAR: - case VTK_PARSE_SSIZE_T: - return 1; - } - - return 0; -} - -int vtkWrap_IsRealNumber(ValueInfo *val) -{ - unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); - return (t == VTK_PARSE_FLOAT || t == VTK_PARSE_DOUBLE); -} - -/* -------------------------------------------------------------------- */ -/* These are mutually exclusive, as well. */ - -int vtkWrap_IsScalar(ValueInfo *val) -{ - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - return (i == 0); -} - -int vtkWrap_IsPointer(ValueInfo *val) -{ - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - return (i == VTK_PARSE_POINTER && val->Count == 0 && - val->CountHint == 0 && val->NumberOfDimensions <= 1); -} - -int vtkWrap_IsArray(ValueInfo *val) -{ - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - return (i == VTK_PARSE_POINTER && val->NumberOfDimensions <= 1 && - (val->Count != 0 || val->CountHint != 0)); -} - -int vtkWrap_IsNArray(ValueInfo *val) -{ - int j = 0; - unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); - if (i != VTK_PARSE_ARRAY || val->NumberOfDimensions <= 1) - { - return 0; - } - for (j = 0; j < val->NumberOfDimensions; j++) - { - if (val->Dimensions[j] == NULL || val->Dimensions[j][0] == '\0') - { - return 0; - } - } - return 1; -} - - -/* -------------------------------------------------------------------- */ -/* Other type properties, not mutually exclusive. */ - -int vtkWrap_IsNonConstRef(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_REF) != 0 && - (val->Type & VTK_PARSE_CONST) == 0); -} - -int vtkWrap_IsConstRef(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_REF) != 0 && - (val->Type & VTK_PARSE_CONST) != 0); -} - -int vtkWrap_IsRef(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_REF) != 0); -} - -int vtkWrap_IsConst(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_CONST) != 0); -} - -/* -------------------------------------------------------------------- */ -/* Hints */ - -int vtkWrap_IsNewInstance(ValueInfo *val) -{ - return ((val->Type & VTK_PARSE_NEWINSTANCE) != 0); -} - -/* -------------------------------------------------------------------- */ -/* Constructor/Destructor checks */ - -int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f) - -{ - size_t i, m; - const char *cp = c->Name; - - if (cp && f->Name && !vtkWrap_IsDestructor(c, f)) - { - /* remove namespaces and template parameters from the name */ - m = vtkParse_UnscopedNameLength(cp); - while (cp[m] == ':' && cp[m+1] == ':') - { - cp += m + 2; - m = vtkParse_UnscopedNameLength(cp); - } - for (i = 0; i < m; i++) - { - if (cp[i] == '<') - { - break; - } - } - - return (i == strlen(f->Name) && strncmp(cp, f->Name, i) == 0); - } - - return 0; -} - -int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f) -{ - size_t i; - const char *cp; - - if (c->Name && f->Name) - { - cp = f->Signature; - for (i = 0; cp[i] != '\0' && cp[i] != '('; i++) - { - if (cp[i] == '~') - { - return 1; - } - } - } - - return 0; -} - -int vtkWrap_IsSetVectorMethod(FunctionInfo *f) -{ - if (f->Macro && strncmp(f->Macro, "vtkSetVector", 12) == 0) - { - return 1; - } - - return 0; -} - -int vtkWrap_IsGetVectorMethod(FunctionInfo *f) -{ - if (f->Macro && strncmp(f->Macro, "vtkGetVector", 12) == 0) - { - return 1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Argument counting */ - -int vtkWrap_CountWrappedParameters(FunctionInfo *f) -{ - int totalArgs = f->NumberOfParameters; - - if (totalArgs > 0 && - (f->Parameters[0]->Type & VTK_PARSE_BASE_TYPE) - == VTK_PARSE_FUNCTION) - { - totalArgs = 1; - } - else if (totalArgs == 1 && - (f->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) - == VTK_PARSE_VOID) - { - totalArgs = 0; - } - - return totalArgs; -} - -int vtkWrap_CountRequiredArguments(FunctionInfo *f) -{ - int requiredArgs = 0; - int totalArgs; - int i; - - totalArgs = vtkWrap_CountWrappedParameters(f); - - for (i = 0; i < totalArgs; i++) - { - if (f->Parameters[i]->Value == NULL || - vtkWrap_IsArray(f->Parameters[i]) || - vtkWrap_IsNArray(f->Parameters[i])) - { - requiredArgs = i+1; - } - } - - return requiredArgs; -} - -/* -------------------------------------------------------------------- */ -/* Check whether the class is derived from vtkObjectBase. */ - -int vtkWrap_IsVTKObjectBaseType( - HierarchyInfo *hinfo, const char *classname) -{ - HierarchyEntry *entry; - - if (hinfo) - { - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - if (entry) - { - if (vtkParseHierarchy_IsTypeOf(hinfo, entry, "vtkObjectBase")) - { - return 1; - } - return 0; - } - } - - /* fallback if no HierarchyInfo */ - if (strncmp("vtk", classname, 3) == 0) - { - return 1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Check if the WRAP_SPECIAL flag is set for the class. */ - -int vtkWrap_IsSpecialType( - HierarchyInfo *hinfo, const char *classname) -{ - HierarchyEntry *entry; - - if (hinfo) - { - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - if (entry && vtkParseHierarchy_GetProperty(entry, "WRAP_SPECIAL")) - { - return 1; - } - return 0; - } - - /* fallback if no HierarchyInfo */ - if (strncmp("vtk", classname, 3) == 0) - { - return -1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Check if the class is derived from superclass */ - -int vtkWrap_IsTypeOf( - HierarchyInfo *hinfo, const char *classname, const char *superclass) -{ - HierarchyEntry *entry; - - if (strcmp(classname, superclass) == 0) - { - return 1; - } - - if (hinfo) - { - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - if (entry && vtkParseHierarchy_IsTypeOf(hinfo, entry, superclass)) - { - return 1; - } - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Make a guess about whether a class is wrapped */ - -int vtkWrap_IsClassWrapped( - HierarchyInfo *hinfo, const char *classname) -{ - if (hinfo) - { - HierarchyEntry *entry; - entry = vtkParseHierarchy_FindEntry(hinfo, classname); - - if (entry) - { - if (!vtkParseHierarchy_GetProperty(entry, "WRAP_EXCLUDE") || - vtkParseHierarchy_GetProperty(entry, "WRAP_SPECIAL")) - { - return 1; - } - } - } - else if (strncmp("vtk", classname, 3) == 0) - { - return 1; - } - - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Check whether the destructor is public */ -int vtkWrap_HasPublicDestructor(ClassInfo *data) -{ - FunctionInfo *func; - int i; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - func = data->Functions[i]; - - if (vtkWrap_IsDestructor(data, func) && - func->Access != VTK_ACCESS_PUBLIC) - { - return 0; - } - } - - return 1; -} - -/* -------------------------------------------------------------------- */ -/* Check whether the copy constructor is public */ -int vtkWrap_HasPublicCopyConstructor(ClassInfo *data) -{ - FunctionInfo *func; - int i; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - func = data->Functions[i]; - - if (vtkWrap_IsConstructor(data, func) && - func->NumberOfParameters == 1 && - func->Parameters[0]->Class && - strcmp(func->Parameters[0]->Class, data->Name) == 0 && - func->Access != VTK_ACCESS_PUBLIC) - { - return 0; - } - } - - return 1; -} - -/* -------------------------------------------------------------------- */ -/* Get the size for subclasses of vtkTuple */ -int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo) -{ - HierarchyEntry *entry; - const char *classname = NULL; - size_t m; - int size = 0; - - entry = vtkParseHierarchy_FindEntry(hinfo, data->Name); - if (entry && vtkParseHierarchy_IsTypeOfTemplated( - hinfo, entry, data->Name, "vtkTuple", &classname)) - { - /* attempt to get count from template parameter */ - if (classname) - { - m = strlen(classname); - if (m > 2 && classname[m - 1] == '>' && - isdigit(classname[m-2]) && (classname[m-3] == ' ' || - classname[m-3] == ',' || classname[m-3] == '<')) - { - size = classname[m-2] - '0'; - } - free((char *)classname); - } - } - - return size; -} - -/* -------------------------------------------------------------------- */ -/* This sets the CountHint for vtkDataArray methods where the - * tuple size is equal to GetNumberOfComponents. */ -void vtkWrap_FindCountHints( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) -{ - int i; - int count; - const char *countMethod; - FunctionInfo *theFunc; - - /* add hints for vtkInformation get methods */ - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkInformation")) - { - countMethod = "Length(temp0)"; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - if (strcmp(theFunc->Name, "Get") == 0 && - theFunc->NumberOfParameters >= 1 && - theFunc->Parameters[0]->Type == VTK_PARSE_OBJECT_PTR && - (strcmp(theFunc->Parameters[0]->Class, - "vtkInformationIntegerVectorKey") == 0 || - strcmp(theFunc->Parameters[0]->Class, - "vtkInformationDoubleVectorKey") == 0)) - { - if (theFunc->ReturnValue && theFunc->ReturnValue->Count == 0 && - theFunc->NumberOfParameters == 1) - { - theFunc->ReturnValue->CountHint = countMethod; - } - } - } - } - - /* add hints for array GetTuple methods */ - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkDataArray")) - { - countMethod = "GetNumberOfComponents()"; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - if ((strcmp(theFunc->Name, "GetTuple") == 0 || - strcmp(theFunc->Name, "GetTupleValue") == 0) && - theFunc->ReturnValue && theFunc->ReturnValue->Count == 0 && - theFunc->NumberOfParameters == 1 && - theFunc->Parameters[0]->Type == VTK_PARSE_ID_TYPE) - { - theFunc->ReturnValue->CountHint = countMethod; - } - else if ((strcmp(theFunc->Name, "SetTuple") == 0 || - strcmp(theFunc->Name, "SetTupleValue") == 0 || - strcmp(theFunc->Name, "GetTuple") == 0 || - strcmp(theFunc->Name, "GetTupleValue") == 0 || - strcmp(theFunc->Name, "InsertTuple") == 0 || - strcmp(theFunc->Name, "InsertTupleValue") == 0) && - theFunc->NumberOfParameters == 2 && - theFunc->Parameters[0]->Type == VTK_PARSE_ID_TYPE && - theFunc->Parameters[1]->Count == 0) - { - theFunc->Parameters[1]->CountHint = countMethod; - } - else if ((strcmp(theFunc->Name, "InsertNextTuple") == 0 || - strcmp(theFunc->Name, "InsertNextTupleValue") == 0) && - theFunc->NumberOfParameters == 1 && - theFunc->Parameters[0]->Count == 0) - { - theFunc->Parameters[0]->CountHint = countMethod; - } - } - } - - /* add hints for interpolator Interpolate methods */ - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractImageInterpolator")) - { - countMethod = "GetNumberOfComponents()"; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - if (strcmp(theFunc->Name, "Interpolate") == 0 && - theFunc->NumberOfParameters == 2 && - theFunc->Parameters[0]->Type == (VTK_PARSE_DOUBLE_PTR|VTK_PARSE_CONST) && - theFunc->Parameters[0]->Count == 3 && - theFunc->Parameters[1]->Type == VTK_PARSE_DOUBLE_PTR && - theFunc->Parameters[1]->Count == 0) - { - theFunc->Parameters[1]->CountHint = countMethod; - } - } - } - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - - /* hints for constructors that take arrays */ - if (vtkWrap_IsConstructor(data, theFunc) && - theFunc->NumberOfParameters == 1 && - vtkWrap_IsPointer(theFunc->Parameters[0]) && - vtkWrap_IsNumeric(theFunc->Parameters[0]) && - theFunc->Parameters[0]->Count == 0 && - hinfo) - { - count = vtkWrap_GetTupleSize(data, hinfo); - if (count) - { - char counttext[24]; - sprintf(counttext, "%d", count); - theFunc->Parameters[0]->Count = count; - vtkParse_AddStringToArray( - &theFunc->Parameters[0]->Dimensions, - &theFunc->Parameters[0]->NumberOfDimensions, - vtkParse_CacheString(finfo->Strings, counttext, strlen(counttext))); - } - } - - /* hints for operator[] index range */ - if (theFunc->IsOperator && theFunc->Name && - strcmp(theFunc->Name, "operator[]") == 0) - { - if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkTuple")) - { - theFunc->SizeHint = "GetSize()"; - } - else if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayCoordinates") || - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayExtents") || - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArraySort")) - { - theFunc->SizeHint = "GetDimensions()"; - } - else if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayExtentsList") || - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayWeights")) - { - theFunc->SizeHint = "GetCount()"; - } - } - } -} - -/* -------------------------------------------------------------------- */ -/* This sets the NewInstance hint for generator methods. */ -void vtkWrap_FindNewInstanceMethods( - ClassInfo *data, HierarchyInfo *hinfo) -{ - int i; - FunctionInfo *theFunc; - - for (i = 0; i < data->NumberOfFunctions; i++) - { - theFunc = data->Functions[i]; - if (theFunc->Name && theFunc->ReturnValue && - vtkWrap_IsVTKObject(theFunc->ReturnValue) && - vtkWrap_IsVTKObjectBaseType(hinfo, theFunc->ReturnValue->Class)) - { - if (strcmp(theFunc->Name, "NewInstance") == 0 || - strcmp(theFunc->Name, "CreateInstance") == 0 || - (strcmp(theFunc->Name, "CreateLookupTable") == 0 && - strcmp(data->Name, "vtkColorSeries") == 0) || - (strcmp(theFunc->Name, "CreateImageReader2") == 0 && - strcmp(data->Name, "vtkImageReader2Factory") == 0) || - (strcmp(theFunc->Name, "CreateDataArray") == 0 && - strcmp(data->Name, "vtkDataArray") == 0) || - (strcmp(theFunc->Name, "CreateArray") == 0 && - strcmp(data->Name, "vtkAbstractArray") == 0) || - (strcmp(theFunc->Name, "CreateArray") == 0 && - strcmp(data->Name, "vtkArray") == 0) || - (strcmp(theFunc->Name, "GetQueryInstance") == 0 && - strcmp(data->Name, "vtkSQLDatabase") == 0) || - (strcmp(theFunc->Name, "CreateFromURL") == 0 && - strcmp(data->Name, "vtkSQLDatabase") == 0) || - (strcmp(theFunc->Name, "MakeTransform") == 0 && - vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractTransform"))) - { - theFunc->ReturnValue->Type |= VTK_PARSE_NEWINSTANCE; - } - } - } -} - - -/* -------------------------------------------------------------------- */ -/* Expand all typedef types that are used in function arguments */ -void vtkWrap_ExpandTypedefs( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) -{ - int i, j, n; - FunctionInfo *funcInfo; - const char *newclass; - - n = data->NumberOfSuperClasses; - for (i = 0; i < n; i++) - { - newclass = vtkParseHierarchy_ExpandTypedefsInName( - hinfo, data->SuperClasses[i], NULL); - if (newclass != data->SuperClasses[i]) - { - data->SuperClasses[i] = - vtkParse_CacheString(finfo->Strings, newclass, strlen(newclass)); - free((char *)newclass); - } - } - - n = data->NumberOfFunctions; - for (i = 0; i < n; i++) - { - funcInfo = data->Functions[i]; - if (funcInfo->Access == VTK_ACCESS_PUBLIC) - { - for (j = 0; j < funcInfo->NumberOfParameters; j++) - { - vtkParseHierarchy_ExpandTypedefsInValue( - hinfo, funcInfo->Parameters[j], finfo->Strings, data->Name); - } - if (funcInfo->ReturnValue) - { - vtkParseHierarchy_ExpandTypedefsInValue( - hinfo, funcInfo->ReturnValue, finfo->Strings, data->Name); - } - } - } -} - - -/* -------------------------------------------------------------------- */ -/* get the type name */ - -const char *vtkWrap_GetTypeName(ValueInfo *val) -{ - unsigned int aType = val->Type; - const char *aClass = val->Class; - - /* print the type itself */ - switch (aType & VTK_PARSE_BASE_TYPE) - { - case VTK_PARSE_FLOAT: return "float"; - case VTK_PARSE_DOUBLE: return "double"; - case VTK_PARSE_INT: return "int"; - case VTK_PARSE_SHORT: return "short"; - case VTK_PARSE_LONG: return "long"; - case VTK_PARSE_VOID: return "void "; - case VTK_PARSE_CHAR: return "char"; - case VTK_PARSE_UNSIGNED_INT: return "unsigned int"; - case VTK_PARSE_UNSIGNED_SHORT: return "unsigned short"; - case VTK_PARSE_UNSIGNED_LONG: return "unsigned long"; - case VTK_PARSE_UNSIGNED_CHAR: return "unsigned char"; - case VTK_PARSE_ID_TYPE: return "vtkIdType"; - case VTK_PARSE_LONG_LONG: return "long long"; - case VTK_PARSE___INT64: return "__int64"; - case VTK_PARSE_UNSIGNED_LONG_LONG: return "unsigned long long"; - case VTK_PARSE_UNSIGNED___INT64: return "unsigned __int64"; - case VTK_PARSE_SIGNED_CHAR: return "signed char"; - case VTK_PARSE_BOOL: return "bool"; - case VTK_PARSE_UNICODE_STRING: return "vtkUnicodeString"; - case VTK_PARSE_SSIZE_T: return "ssize_t"; - case VTK_PARSE_SIZE_T: return "size_t"; - } - - return aClass; -} - -/* -------------------------------------------------------------------- */ -/* variable declarations */ - -void vtkWrap_DeclareVariable( - FILE *fp, ValueInfo *val, const char *name, int i, int flags) -{ - unsigned int aType; - int j; - - if (val == NULL) - { - return; - } - - aType = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); - - /* do nothing for void */ - if (aType == VTK_PARSE_VOID || - (aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) - { - return; - } - - /* add a couple spaces */ - fprintf(fp," "); - - /* for const * return types, prepend with const */ - if ((flags & VTK_WRAP_RETURN) != 0) - { - if ((val->Type & VTK_PARSE_CONST) != 0 && - (aType & VTK_PARSE_INDIRECT) != 0) - { - fprintf(fp,"const "); - } - } - /* do the same for "const char *" with initializer */ - else - { - if ((val->Type & VTK_PARSE_CONST) != 0 && - aType == VTK_PARSE_CHAR_PTR && - val->Value && - strcmp(val->Value, "0") != 0 && - strcmp(val->Value, "NULL") != 0) - { - fprintf(fp,"const "); - } - } - - /* print the type name */ - fprintf(fp, "%s ", vtkWrap_GetTypeName(val)); - - /* indirection */ - if ((flags & VTK_WRAP_RETURN) != 0) - { - /* ref and pointer return values are stored as pointers */ - if ((aType & VTK_PARSE_INDIRECT) == VTK_PARSE_POINTER || - (aType & VTK_PARSE_INDIRECT) == VTK_PARSE_REF) - { - fprintf(fp, "*"); - } - } - else - { - /* objects refs and pointers are always handled via pointers, - * other refs are passed by value */ - if (aType == VTK_PARSE_CHAR_PTR || - aType == VTK_PARSE_VOID_PTR || - aType == VTK_PARSE_OBJECT_PTR || - aType == VTK_PARSE_OBJECT_REF || - aType == VTK_PARSE_OBJECT || - vtkWrap_IsQtObject(val)) - { - fprintf(fp, "*"); - } - /* arrays of unknown size are handled via pointers */ - else if (val->CountHint) - { - fprintf(fp, "*"); - } - } - - /* the variable name */ - if (i >= 0) - { - fprintf(fp,"%s%i", name, i); - } - else - { - fprintf(fp,"%s", name); - } - - if ((flags & VTK_WRAP_ARG) != 0) - { - /* print the array decorators */ - if (((aType & VTK_PARSE_POINTER_MASK) != 0) && - aType != VTK_PARSE_CHAR_PTR && - aType != VTK_PARSE_VOID_PTR && - aType != VTK_PARSE_OBJECT_PTR && - !vtkWrap_IsQtObject(val) && - val->CountHint == NULL) - { - if (val->NumberOfDimensions == 1 && val->Count > 0) - { - fprintf(fp, "[%d]", val->Count); - } - else - { - for (j = 0; j < val->NumberOfDimensions; j++) - { - fprintf(fp, "[%s]", val->Dimensions[j]); - } - } - } - - /* add a default value */ - else if (val->Value) - { - fprintf(fp, " = %s", val->Value); - } - else if (aType == VTK_PARSE_CHAR_PTR || - aType == VTK_PARSE_VOID_PTR || - aType == VTK_PARSE_OBJECT_PTR || - aType == VTK_PARSE_OBJECT_REF || - aType == VTK_PARSE_OBJECT || - vtkWrap_IsQtObject(val)) - { - fprintf(fp, " = NULL"); - } - else if (val->CountHint) - { - fprintf(fp, " = NULL"); - } - else if (aType == VTK_PARSE_BOOL) - { - fprintf(fp, " = false"); - } - } - - /* finish off with a semicolon */ - if ((flags & VTK_WRAP_NOSEMI) == 0) - { - fprintf(fp, ";\n"); - } -} - -void vtkWrap_DeclareVariableSize( - FILE *fp, ValueInfo *val, const char *name, int i) -{ - char idx[32]; - int j; - - idx[0] = '\0'; - if (i >= 0) - { - sprintf(idx, "%d", i); - } - - if (val->NumberOfDimensions > 1) - { - fprintf(fp, - " static int %s%s[%d] = ", - name, idx, val->NumberOfDimensions); - - for (j = 0; j < val->NumberOfDimensions; j++) - { - fprintf(fp, "%c %s", ((j == 0) ? '{' : ','), val->Dimensions[j]); - } - - fprintf(fp, " };\n"); - } - else if (val->Count != 0 || val->CountHint) - { - fprintf(fp, - " %sint %s%s = %d;\n", - (val->CountHint ? "" : "const "), name, idx, - (val->CountHint ? 0 : val->Count)); - } - else if (val->NumberOfDimensions == 1) - { - fprintf(fp, - " const int %s%s = %s;\n", - name, idx, val->Dimensions[0]); - } -} diff --git a/src/ParaView/vtkWrap.h b/src/ParaView/vtkWrap.h deleted file mode 100644 index 8b385eb1..00000000 --- a/src/ParaView/vtkWrap.h +++ /dev/null @@ -1,248 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrap.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/** - * vtkWrap provides useful functions for generating wrapping code. -*/ - -#ifndef VTK_WRAP_H -#define VTK_WRAP_H - -#include "vtkParse.h" -#include "vtkParseHierarchy.h" - -/** - * For use with vtkWrap_DeclareVariable. - */ -/*@{*/ -#define VTK_WRAP_RETURN 1 -#define VTK_WRAP_ARG 2 -#define VTK_WRAP_NOSEMI 4 -/*@}*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Check for common types. - */ -/*@{*/ -int vtkWrap_IsVoid(ValueInfo *val); -int vtkWrap_IsVoidFunction(ValueInfo *val); -int vtkWrap_IsVoidPointer(ValueInfo *val); -int vtkWrap_IsCharPointer(ValueInfo *val); -int vtkWrap_IsVTKObject(ValueInfo *val); -int vtkWrap_IsSpecialObject(ValueInfo *val); -int vtkWrap_IsQtObject(ValueInfo *val); -int vtkWrap_IsQtEnum(ValueInfo *val); -/*@}*/ - -/** - * The basic types, all are mutually exclusive. - * Note that enums are considered to be objects, - * bool and char are considered to be numeric. - */ -/*@{*/ -int vtkWrap_IsObject(ValueInfo *val); -int vtkWrap_IsFunction(ValueInfo *val); -int vtkWrap_IsStream(ValueInfo *val); -int vtkWrap_IsNumeric(ValueInfo *val); -int vtkWrap_IsString(ValueInfo *val); -/*@}*/ - -/** - * Subcategories of numeric types. In this categorization, - * bool and char are not considered to be integers. - */ -/*@{*/ -int vtkWrap_IsBool(ValueInfo *val); -int vtkWrap_IsChar(ValueInfo *val); -int vtkWrap_IsInteger(ValueInfo *val); -int vtkWrap_IsRealNumber(ValueInfo *val); -/*@}*/ - -/** - * Arrays and pointers. These are mutually exclusive. - * IsPointer() does not include pointers to pointers. - * IsArray() and IsNArray() do not include unsized arrays. - * Arrays of pointers are not included in any of these. - */ -/*@{*/ -int vtkWrap_IsScalar(ValueInfo *val); -int vtkWrap_IsPointer(ValueInfo *val); -int vtkWrap_IsArray(ValueInfo *val); -int vtkWrap_IsNArray(ValueInfo *val); -/*@}*/ - -/** - * Properties that can combine with other properties. - */ -/*@{*/ -int vtkWrap_IsNonConstRef(ValueInfo *val); -int vtkWrap_IsConstRef(ValueInfo *val); -int vtkWrap_IsRef(ValueInfo *val); -int vtkWrap_IsConst(ValueInfo *val); -/*@}*/ - -/** - * Hints. - * NewInstance objects must be freed by the caller. - */ -/*@{*/ -int vtkWrap_IsNewInstance(ValueInfo *val); -/*@}*/ - - -/** - * Check whether the class is derived from vtkObjectBase. - * If "hinfo" is NULL, this just checks that the class - * name starts with "vtk". - */ -int vtkWrap_IsVTKObjectBaseType( - HierarchyInfo *hinfo, const char *classname); - -/** - * Check if the WRAP_SPECIAL flag is set for the class. - * If "hinfo" is NULL, it defaults to just checking if - * the class starts with "vtk" and returns -1 if so. - */ -int vtkWrap_IsSpecialType( - HierarchyInfo *hinfo, const char *classname); - -/** - * Check if the class is derived from superclass. - * If "hinfo" is NULL, then only an exact match to the - * superclass will succeed. - */ -int vtkWrap_IsTypeOf( - HierarchyInfo *hinfo, const char *classname, const char *superclass); - -/** - * Check whether a class is wrapped. If "hinfo" is NULL, - * it just checks that the class starts with "vtk". - */ -int vtkWrap_IsClassWrapped( - HierarchyInfo *hinfo, const char *classname); - -/** - * Check whether the destructor is public - */ -int vtkWrap_HasPublicDestructor(ClassInfo *data); - -/** - * Check whether the copy constructor is public - */ -int vtkWrap_HasPublicCopyConstructor(ClassInfo *data); - -/** - * Expand all typedef types that are used in function arguments. - * This should be done before any wrapping is done, to make sure - * that the wrappers see the real types. - */ -void vtkWrap_ExpandTypedefs( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo); - -/** - * Apply any hints about array sizes, e.g. hint that the - * GetNumberOfComponents() method gives the tuple size. - */ -void vtkWrap_FindCountHints( - ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo); - -/** - * Get the size of a fixed-size tuple - */ -int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo); - -/** - * Apply any hints about methods that return a new object instance, - * i.e. factory methods and the like. Reference counts must be - * handled differently for such returned objects. - */ -void vtkWrap_FindNewInstanceMethods( - ClassInfo *data, HierarchyInfo *hinfo); - -/** - * Get the name of a type. The name will not include "const". - */ -const char *vtkWrap_GetTypeName(ValueInfo *val); - -/** - * True if the method a constructor of the class. - */ -int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f); - -/** - * True if the method a destructor of the class. - */ -int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f); - -/** - * Check if a method is from a SetVector method. - */ -int vtkWrap_IsSetVectorMethod(FunctionInfo *f); - -/** - * Check if a method is from a GetVector method. - */ -int vtkWrap_IsGetVectorMethod(FunctionInfo *f); - -/** - * Count the number of parameters that are wrapped. - * This skips the "void *" parameter that follows - * wrapped function pointer parameters. - */ -int vtkWrap_CountWrappedParameters(FunctionInfo *f); - -/** - * Count the number of args that are required. - * This counts to the last argument that does not - * have a default value. Array args are not allowed - * to have default values. - */ -int vtkWrap_CountRequiredArguments(FunctionInfo *f); - -/** - * Write a variable declaration to a file. - * Void is automatically ignored, and nothing is written for - * function pointers - * Set "idx" to -1 to avoid writing an idx. - * Set "flags" to VTK_WRAP_RETURN to write a return value, - * or to VTK_WRAP_ARG to write a temp argument variable. - * The following rules apply: - * - if VTK_WRAP_NOSEMI is set, then no semicolon/newline is printed - * - if VTK_WRAP_RETURN is set, then "&" becomes "*" - * - if VTK_WRAP_ARG is set, "&" becomes "*" only for object - * types, and is removed for all other types. - * - "const" is removed except for return values with "&" or "*". - */ -void vtkWrap_DeclareVariable( - FILE *fp, ValueInfo *v, const char *name, int idx, int flags); - -/** - * Write an "int" size variable for arrays, initialized to - * the array size if the size is greater than zero. - * For N-dimensional arrays, write a static array of ints. - */ -void vtkWrap_DeclareVariableSize( - FILE *fp, ValueInfo *v, const char *name, int idx); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/ParaView/vtkWrapHierarchy.c b/src/ParaView/vtkWrapHierarchy.c deleted file mode 100644 index f53fec9d..00000000 --- a/src/ParaView/vtkWrapHierarchy.c +++ /dev/null @@ -1,977 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrapHierarchy.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*------------------------------------------------------------------------- - Copyright (c) 2010 David Gobbi. - - Contributed to the VisualizationToolkit by the author in June 2010 - under the terms of the Visualization Toolkit 2008 copyright. --------------------------------------------------------------------------*/ - -/** - The vtkWrapHierarchy program builds a text file that describes the - class hierarchy. - For each class, the output file will have a line in the following - format: - - classname [ : superclass ] ; header.h ; kit [; flags] - - For each enum type, - - enumname : enum ; header.h ; kit [; flags] - - For each typedef, - - name = [2][3]* const int ; header.h ; kit [; flags] - -*/ - -#include "vtkParse.h" -#include "vtkParseData.h" -#include "vtkParseMain.h" -#include "vtkParsePreprocess.h" -#include -#include -#include -#include -#ifdef _WIN32 -# include -#else -# include -#endif - -/** - * Helper to append a text line to an array of lines - */ -static char **append_unique_line(char **lines, char *line, size_t *np) -{ - size_t l, n; - - n = *np; - - /* check to make sure this line isn't a duplicate */ - for (l = 0; l < n; l++) - { - if (strcmp(line, lines[l]) == 0) - { - break; - } - } - if (l == n) - { - /* allocate more memory if n+1 is a power of two */ - if (((n+1) & n) == 0) - { - lines = (char **)realloc(lines, (n+1)*2*sizeof(char *)); - } - - lines[n] = (char *)malloc(strlen(line)+1); - strcpy(lines[n++], line); - lines[n] = NULL; - } - - *np = n; - return lines; -} - -/** - * Helper to append to a line, given the end marker - */ -static char *append_to_line( - char *line, const char *text, size_t *pos, size_t *maxlen) -{ - size_t n; - - n = strlen(text); - - if ((*pos) + n + 1 > (*maxlen)) - { - *maxlen = ((*pos) + n + 1 + 2*(*maxlen)); - line = (char *)realloc(line, (*maxlen)); - } - - strcpy(&line[*pos], text); - *pos = (*pos) + n; - - return line; -} - -/** - * Append scope to line - */ -static char *append_scope_to_line( - char *line, size_t *m, size_t *maxlen, const char *scope) -{ - if (scope && scope[0] != '\0') - { - line = append_to_line(line, scope, m, maxlen); - line = append_to_line(line, "::", m, maxlen); - } - - return line; -} - -/** - * Append template info - */ -static char *append_template_to_line( - char *line, size_t *m, size_t *maxlen, TemplateInfo *template_args) -{ - ValueInfo *arg; - int j; - - line = append_to_line(line, "<", m, maxlen); - - for (j = 0; j < template_args->NumberOfParameters; j++) - { - arg = template_args->Parameters[j]; - if (arg->Name) - { - line = append_to_line(line, arg->Name, m, maxlen); - } - if (arg->Value && arg->Value[0] != '\n') - { - line = append_to_line(line, "=", m, maxlen); - line = append_to_line(line, arg->Value, m, maxlen); - } - if (j+1 < template_args->NumberOfParameters) - { - line = append_to_line(line, ",", m, maxlen); - } - } - - line = append_to_line(line, ">", m, maxlen); - - return line; -} - -/** - * Append class info - */ -static char *append_class_to_line( - char *line, size_t *m, size_t *maxlen, ClassInfo *class_info) -{ - int j; - - line = append_to_line(line, class_info->Name, m, maxlen); - - if (class_info->Template) - { - line = append_template_to_line(line, m, maxlen, class_info->Template); - } - - line = append_to_line(line, " ", m, maxlen); - - if (class_info->NumberOfSuperClasses) - { - line = append_to_line(line, ": ", m, maxlen); - } - - for (j = 0; j < class_info->NumberOfSuperClasses; j++) - { - line = append_to_line(line, class_info->SuperClasses[j], m, maxlen); - line = append_to_line(line, " ", m, maxlen); - if (j+1 < class_info->NumberOfSuperClasses) - { - line = append_to_line(line, ", ", m, maxlen); - } - } - - return line; -} - -/** - * Append enum info - */ -static char *append_enum_to_line( - char *line, size_t *m, size_t *maxlen, EnumInfo *enum_info) -{ - line = append_to_line(line, enum_info->Name, m, maxlen); - line = append_to_line(line, " : enum ", m, maxlen); - - return line; -} - -/** - * Append the trailer, i.e. the filename and flags - */ -static char *append_trailer( - char *line, size_t *m, size_t *maxlen, - const char *header_file, const char *module_name, const char *flags) -{ - line = append_to_line(line, "; ", m, maxlen); - line = append_to_line(line, header_file, m, maxlen); - - line = append_to_line(line, " ; ", m, maxlen); - line = append_to_line(line, module_name, m, maxlen); - - if (flags && flags[0] != '\0') - { - line = append_to_line(line, " ; ", m, maxlen); - line = append_to_line(line, flags, m, maxlen); - } - - return line; -} - -/** - * Append typedef info - */ -static char *append_typedef_to_line( - char *line, size_t *m, size_t *maxlen, ValueInfo *typedef_info) -{ - unsigned int type; - int ndims; - int dim; - - line = append_to_line(line, typedef_info->Name, m, maxlen); - line = append_to_line(line, " = ", m, maxlen); - - type = typedef_info->Type; - - if ((type & VTK_PARSE_REF) != 0) - { - line = append_to_line(line, "&", m, maxlen); - } - - ndims = typedef_info->NumberOfDimensions; - - for (dim = 0; dim < ndims; dim++) - { - line = append_to_line(line, "[", m, maxlen); - line = append_to_line(line, typedef_info->Dimensions[dim], - m, maxlen); - line = append_to_line(line, "]", m, maxlen); - } - - type = (type & VTK_PARSE_POINTER_MASK); - if (ndims > 0 && (type & VTK_PARSE_POINTER_LOWMASK) == VTK_PARSE_ARRAY) - { - type = ((type >> 2) & VTK_PARSE_POINTER_MASK); - } - else if (ndims == 1) - { - type = ((type >> 2) & VTK_PARSE_POINTER_MASK); - } - - /* pointers are printed after brackets, and are intentionally - * printed in reverse order as compared to C++ declarations */ - while (type) - { - unsigned int bits = (type & VTK_PARSE_POINTER_LOWMASK); - type = ((type >> 2) & VTK_PARSE_POINTER_MASK); - - if (bits == VTK_PARSE_POINTER) - { - line = append_to_line(line, "*", m, maxlen); - } - else if (bits == VTK_PARSE_CONST_POINTER) - { - line = append_to_line(line, "const*", m, maxlen); - } - else - { - line = append_to_line(line, "[]", m, maxlen); - } - } - - if (line[*m-1] != ' ') - { - line = append_to_line(line, " ", m, maxlen); - } - - if ((type & VTK_PARSE_CONST) != 0) - { - line = append_to_line(line, "const ", m, maxlen); - } - - line = append_to_line(line, typedef_info->Class, m, maxlen); - line = append_to_line(line, " ", m, maxlen); - - return line; -} - -/** - * Append all types in a class - */ -static char **append_class_contents( - char **lines, size_t *np, ClassInfo *data, - const char *scope, const char *header_file, const char *module_name) -{ - int i; - const char *tmpflags; - char *new_scope; - char *line; - size_t m, n, maxlen; - size_t scope_m, scope_maxlen; - - /* append the name to the scope */ - new_scope = 0; - n = 0; - m = 0; - if (scope) - { - n = strlen(scope); - } - if (data->Name) - { - m = strlen(data->Name); - } - if (m && (n || data->Template)) - { - scope_maxlen = n + m + 3; - scope_m = 0; - new_scope = (char *)malloc(scope_maxlen); - new_scope[0] = '\0'; - if (n) - { - new_scope = append_to_line(new_scope, scope, &scope_m, &scope_maxlen); - new_scope = append_to_line(new_scope, "::", &scope_m, &scope_maxlen); - } - new_scope = append_to_line(new_scope, data->Name, &scope_m, &scope_maxlen); - if (data->Template) - { - new_scope = append_template_to_line( - new_scope, &scope_m, &scope_maxlen, data->Template); - } - scope = new_scope; - } - else if (m) - { - scope = data->Name; - } - - /* start with a buffer of 15 chars and grow from there */ - maxlen = 15; - m = 0; - line = (char *)malloc(maxlen); - - /* add a line for each type that is found */ - for (i = 0; i < data->NumberOfItems; i++) - { - m = 0; - line[m] = '\0'; - - tmpflags = 0; - - if (data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) - { - ClassInfo *class_info = - data->Classes[data->Items[i].Index]; - - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_class_to_line(line, &m, &maxlen, class_info); - tmpflags = "WRAP_EXCLUDE"; - } - else if (data->Items[i].Type == VTK_ENUM_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_enum_to_line(line, &m, &maxlen, - data->Enums[data->Items[i].Index]); - } - else if (data->Items[i].Type == VTK_TYPEDEF_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_typedef_to_line(line, &m, &maxlen, - data->Typedefs[data->Items[i].Index]); - } - else - { - /* unhandled file element */ - continue; - } - - /* append filename and flags */ - line = append_trailer( - line, &m, &maxlen, header_file, module_name, tmpflags); - - /* append the line to the file */ - lines = append_unique_line(lines, line, np); - - /* for classes, add all typed defined within the class */ - if ((data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) && - data->Classes[data->Items[i].Index]->Name) - { - lines = append_class_contents(lines, np, - data->Classes[data->Items[i].Index], - scope, header_file, module_name); - } - } - - free(line); - - if (new_scope != 0) - { - free(new_scope); - } - - return lines; -} - - -/** - * Append all types in a namespace - */ -static char **append_namespace_contents( - char **lines, size_t *np, NamespaceInfo *data, ClassInfo *main_class, - const char *scope, const char *header_file, const char *module_name, - const char *flags) -{ - int i; - const char *tmpflags; - char *line; - char *new_scope; - size_t n, m, maxlen; - - /* append the name to the scope */ - new_scope = 0; - n = 0; - m = 0; - if (scope) - { - n = strlen(scope); - } - if (data->Name) - { - m = strlen(data->Name); - } - if (m && n) - { - new_scope = (char *)malloc(m + n + 3); - if (n) - { - strncpy(new_scope, scope, n); - new_scope[n++] = ':'; - new_scope[n++] = ':'; - } - strncpy(&new_scope[n], data->Name, m); - new_scope[n+m] = '\0'; - scope = new_scope; - } - else if (m) - { - scope = data->Name; - } - - /* start with a buffer of 15 chars and grow from there */ - maxlen = 15; - m = 0; - line = (char *)malloc(maxlen); - - /* add a line for each type that is found */ - for (i = 0; i < data->NumberOfItems; i++) - { - tmpflags = 0; - m = 0; - line[m] = '\0'; - - if (data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) - { - ClassInfo *class_info = - data->Classes[data->Items[i].Index]; - - /* all but the main class in each file is excluded from wrapping */ - tmpflags = "WRAP_EXCLUDE"; - if (class_info == main_class) - { - tmpflags = flags; - } - - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_class_to_line(line, &m, &maxlen, class_info); - } - else if (data->Items[i].Type == VTK_ENUM_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_enum_to_line(line, &m, &maxlen, - data->Enums[data->Items[i].Index]); - } - else if (data->Items[i].Type == VTK_TYPEDEF_INFO) - { - line = append_scope_to_line(line, &m, &maxlen, scope); - line = append_typedef_to_line(line, &m, &maxlen, - data->Typedefs[data->Items[i].Index]); - } - else if (data->Items[i].Type != VTK_NAMESPACE_INFO) - { - /* unhandled file element */ - continue; - } - - if (data->Items[i].Type != VTK_NAMESPACE_INFO) - { - /* append filename and flags */ - line = append_trailer( - line, &m, &maxlen, header_file, module_name, tmpflags); - - /* append the line to the file */ - lines = append_unique_line(lines, line, np); - } - - /* for classes, add all typed defined within the class */ - if ((data->Items[i].Type == VTK_CLASS_INFO || - data->Items[i].Type == VTK_STRUCT_INFO) && - data->Classes[data->Items[i].Index]->Name) - { - lines = append_class_contents(lines, np, - data->Classes[data->Items[i].Index], - scope, header_file, module_name); - } - - /* for namespaces, add all types in the namespace */ - if (data->Items[i].Type == VTK_NAMESPACE_INFO && - data->Namespaces[data->Items[i].Index]->Name) - { - lines = append_namespace_contents(lines, np, - data->Namespaces[data->Items[i].Index], 0, - scope, header_file, module_name, "WRAP_EXCLUDE"); - } - } - - free(line); - - if (new_scope != 0) - { - free(new_scope); - } - - return lines; -} - -/** - * Read a header file with vtkParse.tab.c - * - * If "lines" is provided, the file contents - * will be appended to them. - */ -static char **vtkWrapHierarchy_ParseHeaderFile( - FILE *fp, const char *filename, const char *module_name, - const char *flags, char **lines) -{ - FileInfo *data; - const char *header_file; - size_t k, n; - - /* start with just a single output line and grow from there */ - if (lines == NULL) - { - lines = (char **)malloc(sizeof(char *)); - lines[0] = NULL; - } - - /* always ignore BTX markers when building hierarchy files */ - vtkParse_SetIgnoreBTX(1); - - /* the "concrete" flag doesn't matter, just set to zero */ - data = vtkParse_ParseFile(filename, fp, stderr); - - if (!data) - { - free(lines); - return 0; - } - - /* find the last line in "lines" */ - n = 0; - while (lines[n] != NULL) - { - n++; - } - - k = strlen(data->FileName) - 1; - while (k > 0 && data->FileName[k-1] != '/' && data->FileName[k-1] != '\\') - { - k--; - } - header_file = &data->FileName[k]; - - /* append the file contents to the output */ - lines = append_namespace_contents( - lines, &n, data->Contents, data->MainClass, 0, - header_file, module_name, flags); - - vtkParse_Free(data); - - return lines; -} - -/** - * Read a hierarchy file into "lines" without duplicating lines - */ -static char **vtkWrapHierarchy_ReadHierarchyFile(FILE *fp, char **lines) -{ - char *line; - size_t maxlen = 15; - size_t i, n; - - line = (char *)malloc(maxlen); - - if (lines == NULL) - { - lines = (char **)malloc(sizeof(char *)); - lines[0] = NULL; - } - - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - while (n > 0 && isspace(line[n-1])) - { - n--; - } - line[n] = '\0'; - - if (line[0] == '\0') - { - continue; - } - - for (i = 0; lines[i] != NULL; i++) - { - if (strcmp(line, lines[i]) == 0) - { - break; - } - } - - if (lines[i] == NULL) - { - /* allocate more memory if n+1 is a power of two */ - if (((i+1) & i) == 0) - { - lines = (char **)realloc(lines, (i+1)*2*sizeof(char *)); - } - - lines[i] = (char *)malloc(n+1); - strcpy(lines[i], line); - lines[i+1] = NULL; - } - } - - free(line); - - if (!feof(fp)) - { - free(lines); - return 0; - } - - return lines; -} - -/** - * Compare a file to "lines", return 0 if they are different - */ -static int vtkWrapHierarchy_CompareHierarchyFile(FILE *fp, char *lines[]) -{ - unsigned char *matched; - char *line; - size_t maxlen = 15; - size_t i, n; - - line = (char *)malloc(maxlen); - - for (i = 0; lines[i] != NULL; i++) { ; }; - matched = (unsigned char *)malloc(i); - memset(matched, 0, i); - - while (fgets(line, (int)maxlen, fp)) - { - n = strlen(line); - - /* if buffer not long enough, increase it */ - while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) - { - maxlen *= 2; - line = (char *)realloc(line, maxlen); - if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } - n += strlen(&line[n]); - } - - while (n > 0 && isspace(line[n-1])) - { - n--; - } - line[n] = '\0'; - - if (line[0] == '\0') - { - continue; - } - - for (i = 0; lines[i] != NULL; i++) - { - if (strcmp(line, lines[i]) == 0) - { - break; - } - } - - if (lines[i] == NULL) - { - free(matched); - return 0; - } - - matched[i] = 1; - } - - for (i = 0; lines[i] != NULL; i++) - { - if (matched[i] == 0) - { - free(matched); - return 0; - } - } - - free(line); - free(matched); - - if (!feof(fp)) - { - return 0; - } - - return 1; -} - -/** - * Write "lines" to a hierarchy file - */ -static int vtkWrapHierarchy_WriteHierarchyFile(FILE *fp, char *lines[]) -{ - size_t i; - - for (i = 0; lines[i] != NULL; i++) - { - if (fprintf(fp, "%s\n", lines[i]) < 0) - { - return 0; - } - } - - return 1; -} - -/** - * Try to parse a header file, print error and exit if fail - */ -static char **vtkWrapHierarchy_TryParseHeaderFile( - const char *file_name, const char *module_name, - const char *flags, char **lines) -{ - FILE *input_file; - - input_file = fopen(file_name, "r"); - - if (!input_file) - { - fprintf(stderr, "vtkWrapHierarchy: couldn't open file %s\n", - file_name); - exit(1); - } - - lines = vtkWrapHierarchy_ParseHeaderFile( - input_file, file_name, module_name, flags, lines); - - if (!lines) - { - fclose(input_file); - exit(1); - } - fclose(input_file); - - return lines; -} - -/** - * Try to read a file, print error and exit if fail - */ -static char **vtkWrapHierarchy_TryReadHierarchyFile( - const char *file_name, char **lines) -{ - FILE *input_file; - - input_file = fopen(file_name, "r"); - if (!input_file) - { - fprintf(stderr, "vtkWrapHierarchy: couldn't open file %s\n", - file_name); - exit(1); - } - - lines = vtkWrapHierarchy_ReadHierarchyFile(input_file, lines); - if (!lines) - { - fclose(input_file); - fprintf(stderr, "vtkWrapHierarchy: error reading file %s\n", - file_name); - exit(1); - } - fclose(input_file); - - return lines; -} - -/** - * Try to write a file, print error and exit if fail - */ -static int vtkWrapHierarchy_TryWriteHierarchyFile( - const char *file_name, char *lines[]) -{ - FILE *output_file; - int matched = 0; - - output_file = fopen(file_name, "r"); - if (output_file && vtkWrapHierarchy_CompareHierarchyFile(output_file, lines)) - { - matched = 1; - } - if (output_file) - { - fclose(output_file); - } - - if (!matched) - { - int tries = 1; - output_file = fopen(file_name, "w"); - while (!output_file && tries < 5) - { - /* There are two CMAKE_CUSTOM_COMMANDS for vtkWrapHierarchy, - * make sure they do not collide. */ - tries++; -#ifdef _WIN32 - Sleep(1000); -#else - sleep(1); -#endif - output_file = fopen(file_name, "r+"); - if (output_file && - vtkWrapHierarchy_CompareHierarchyFile(output_file, lines)) - { - /* if the contents match, no need to write it */ - fclose(output_file); - return 0; - } - if (output_file) - { - /* close and open in order to truncate the file */ - fclose(output_file); - output_file = fopen(file_name, "w"); - } - } - if (!output_file) - { - fprintf(stderr, "vtkWrapHierarchy: tried %i times to write %s\n", - tries, file_name); - exit(1); - } - if (!vtkWrapHierarchy_WriteHierarchyFile(output_file, lines)) - { - fclose(output_file); - fprintf(stderr, "vtkWrapHierarchy: error writing file %s\n", - file_name); - exit(1); - } - fclose(output_file); - } - - return 0; -} - -static int string_compare(const void *vp1, const void *vp2) -{ - return strcmp(*(const char **)vp1, *(const char **)vp2); -} - -int main(int argc, char *argv[]) -{ - OptionInfo *options; - int i; - size_t j, n; - char **lines = 0; - char **files = 0; - char *flags; - char *module_name; - - /* parse command-line options */ - vtkParse_MainMulti(argc, argv); - options = vtkParse_GetCommandLineOptions(); - - /* make sure than an output file was given on the command line */ - if (options->OutputFileName == NULL) - { - fprintf(stderr, "No output file was specified\n"); - exit(1); - } - - /* read the data file */ - files = vtkWrapHierarchy_TryReadHierarchyFile( - options->InputFileName, files); - - /* read in all the prior files */ - for (i = 1; i < options->NumberOfFiles; i++) - { - lines = vtkWrapHierarchy_TryReadHierarchyFile( - options->Files[i], lines); - } - - /* merge the files listed in the data file */ - for (i = 0; files[i] != NULL; i++) - { - /* look for semicolon that marks the module name */ - module_name = files[i]; - while(*module_name != ';' && *module_name != '\0') { module_name++; }; - if (*module_name == ';') { *module_name++ = '\0'; } - - /* look for semicolon that marks start of flags */ - flags = module_name; - while(*flags != ';' && *flags != '\0') { flags++; }; - if (*flags == ';') { *flags++ = '\0'; } - - lines = vtkWrapHierarchy_TryParseHeaderFile( - files[i], module_name, flags, lines); - } - - /* sort the lines to ease lookups in the file */ - for (n = 0; lines[n]; n++) { ; }; - qsort(lines, n, sizeof(char *), &string_compare); - - /* write the file, if it has changed */ - vtkWrapHierarchy_TryWriteHierarchyFile(options->OutputFileName, lines); - - for (j = 0; j < n; j++) - { - free(lines[j]); - } - - free(files); - free(lines); - return 0; -} diff --git a/src/ParaView/vtkWrapText.c b/src/ParaView/vtkWrapText.c deleted file mode 100644 index df65aba4..00000000 --- a/src/ParaView/vtkWrapText.c +++ /dev/null @@ -1,988 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrapText.c - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#include "vtkWrapText.h" -#include "vtkWrap.h" -#include -#include -#include -#include - -/* -------------------------------------------------------------------- */ -/* Convert special characters in a string into their escape codes - * so that the string can be quoted in a source file. The specified - * maxlen must be at least 32 chars, and should not be over 2047 since - * that is the maximum length of a string literal on some systems */ - -const char *vtkWrapText_QuoteString( - const char *comment, size_t maxlen) -{ - static char *result = 0; - static size_t oldmaxlen = 0; - size_t i, j, n; - - if (maxlen > oldmaxlen) - { - if (result) - { - free(result); - } - result = (char *)malloc((size_t)(maxlen+1)); - oldmaxlen = maxlen; - } - - if (comment == NULL) - { - return ""; - } - - j = 0; - - n = strlen(comment); - for (i = 0; i < n; i++) - { - if (comment[i] == '\"') - { - strcpy(&result[j],"\\\""); - j += 2; - } - else if (comment[i] == '\\') - { - strcpy(&result[j],"\\\\"); - j += 2; - } - else if (comment[i] == '\n') - { - strcpy(&result[j],"\\n"); - j += 2; - } - else if ((comment[i] & 0x80) != 0 || isprint(comment[i])) - { - // all characters in extended-ASCII set are printable. Some compilers (VS - // 2010, in debug mode) asserts when isprint() is passed a negative value. - // Hence, we simply skip the check. - result[j] = comment[i]; - j++; - } - else - { - sprintf(&result[j],"\\%3.3o",comment[i]); - j += 4; - } - if (j >= maxlen - 21) - { - sprintf(&result[j]," ...\\n [Truncated]\\n"); - j += (int)strlen(" ...\\n [Truncated]\\n"); - break; - } - } - result[j] = '\0'; - - return result; -} - -/* -------------------------------------------------------------------- */ -/* A simple string that grows as necessary. */ - -struct vtkWPString -{ - char *str; - size_t len; - size_t maxlen; -}; - -/* -- append ---------- */ -static void vtkWPString_Append( - struct vtkWPString *str, const char *text) -{ - size_t n = strlen(text); - - if (str->len + n + 1 > str->maxlen) - { - str->maxlen = (str->len + n + 1 + 2*str->maxlen); - str->str = (char *)realloc(str->str, str->maxlen); - } - - strncpy(&str->str[str->len], text, n); - str->len += n; - str->str[str->len] = '\0'; -} - -/* -- add a char ---------- */ -static void vtkWPString_PushChar( - struct vtkWPString *str, char c) -{ - if (str->len + 2 > str->maxlen) - { - str->maxlen = (str->len + 2 + 2*str->maxlen); - str->str = (char *)realloc(str->str, str->maxlen); - } - - str->str[str->len++] = c; - str->str[str->len] = '\0'; -} - -/* -- strip any of the given chars from the end ---------- */ -static void vtkWPString_Strip( - struct vtkWPString *str, const char *trailers) -{ - size_t k = str->len; - char *cp = str->str; - size_t j = 0; - size_t n; - - if (cp) - { - n = strlen(trailers); - - while (k > 0 && j < n) - { - for (j = 0; j < n; j++) - { - if (cp[k-1] == trailers[j]) - { - k--; - break; - } - } - } - - str->len = k; - str->str[k] = '\0'; - } -} - -/* -- Return the last char ---------- */ -static char vtkWPString_LastChar( - struct vtkWPString *str) -{ - if (str->str && str->len > 0) - { - return str->str[str->len-1]; - } - return '\0'; -} - -/* -- do a linebreak on a method declaration ---------- */ -static void vtkWPString_BreakSignatureLine( - struct vtkWPString *str, size_t *linestart, size_t indentation) -{ - size_t i = 0; - size_t m = 0; - size_t j = *linestart; - size_t l = str->len; - size_t k = str->len; - char *text = str->str; - char delim; - - if (!text) - { - return; - } - - while (l > j && text[l-1] != '\n' && text[l-1] != ',' && - text[l-1] != '(' && text[l-1] != ')') - { - /* treat each string as a unit */ - if (l > 4 && (text[l-1] == '\'' || text[l-1] == '\"')) - { - delim = text[l-1]; - l -= 2; - while (l > 3 && (text[l-1] != delim || text[l-3] == '\\')) - { - l--; - if (text[l-1] == '\\') - { - l--; - } - } - l -= 2; - } - else - { - l--; - } - } - - /* if none of these chars was found, split is impossible */ - if (text[l-1] != ',' && text[l-1] != '(' && - text[l-1] != ')' && text[l-1] != '\n') - { - j++; - } - - else - { - /* Append some chars to guarantee size */ - vtkWPString_PushChar(str, '\n'); - vtkWPString_PushChar(str, '\n'); - for (i = 0; i < indentation; i++) - { - vtkWPString_PushChar(str, ' '); - } - /* re-get the char pointer, it may have been reallocated */ - text = str->str; - - if (k > l) - { - m = 0; - while (m < indentation+2 && text[l+m] == ' ') - { - m++; - } - memmove(&text[l+indentation+2-m], &text[l], k-l); - k += indentation+2-m; - } - else - { - k += indentation+2; - } - text[l++] = '\\'; text[l++] = 'n'; - j = l; - for (i = 0; i < indentation; i++) - { - text[l++] = ' '; - } - } - - str->len = k; - - /* return the new line start position */ - *linestart = j; -} - -/* -- do a linebreak on regular text ---------- */ -static void vtkWPString_BreakCommentLine( - struct vtkWPString *str, size_t *linestart, size_t indent) -{ - size_t i = 0; - size_t j = *linestart; - size_t l = str->len; - char *text = str->str; - - if (!text) - { - return; - } - - /* try to break the line at a word */ - while (l > 0 && text[l-1] != ' ' && text[l-1] != '\n') - { - l--; - } - if (l > 0 && text[l-1] != '\n' && l-j > indent) - { - /* replace space with newline */ - text[l-1] = '\n'; - j = l; - - /* Append some chars to guarantee size */ - vtkWPString_PushChar(str, '\n'); - vtkWPString_PushChar(str, '\n'); - for (i = 0; i < indent; i++) - { - vtkWPString_PushChar(str, ' '); - } - /* re-get the char pointer, it may have been reallocated */ - text = str->str; - str->len -= indent+2; - - if (str->len > l && indent > 0) - { - memmove(&text[l+indent], &text[l], str->len-l); - memset(&text[l], ' ', indent); - str->len += indent; - } - } - else - { - /* long word, just split the word */ - vtkWPString_PushChar(str, '\n'); - j = str->len; - for (i = 0; i < indent; i++) - { - vtkWPString_PushChar(str, ' '); - } - } - - /* return the new line start position */ - *linestart = j; -} - -/* -------------------------------------------------------------------- */ -/* Format a signature to a 70 char linewidth and char limit */ -const char *vtkWrapText_FormatSignature( - const char *signature, size_t width, size_t maxlen) -{ - static struct vtkWPString staticString = { NULL, 0, 0 }; - struct vtkWPString *text; - size_t i, j, n; - const char *cp = signature; - char delim; - size_t lastSigStart = 0; - size_t sigCount = 0; - - text = &staticString; - text->len = 0; - - if (signature == 0) - { - return ""; - } - - i = 0; - j = 0; - - while (cp[i] != '\0') - { - while (text->len - j < width && cp[i] != '\n' && cp[i] != '\0') - { - /* escape quotes */ - if (cp[i] == '\"' || cp[i] == '\'') - { - delim = cp[i]; - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, cp[i++]); - while (cp[i] != delim && cp[i] != '\0') - { - if (cp[i] == '\\') - { - vtkWPString_PushChar(text, '\\'); - } - vtkWPString_PushChar(text, cp[i++]); - } - if (cp[i] == delim) - { - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, cp[i++]); - } - } - /* remove items that trail the closing parenthesis */ - else if (cp[i] == ')') - { - vtkWPString_PushChar(text, cp[i++]); - if (strncmp(&cp[i], " const", 6) == 0) - { - i += 6; - } - if (strncmp(&cp[i], " = 0", 4) == 0) - { - i += 4; - } - if (cp[i] == ';') - { - i++; - } - } - /* anything else */ - else - { - vtkWPString_PushChar(text, cp[i++]); - } - } - - /* break the line (try to break after a comma) */ - if (cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_BreakSignatureLine(text, &j, 4); - } - /* reached end of line: do next signature */ - else - { - vtkWPString_Strip(text, " \r\t"); - if (cp[i] != '\0') - { - sigCount++; - /* if sig count is even, check length against maxlen */ - if ((sigCount & 1) == 0) - { - n = strlen(text->str); - if (n >= maxlen) - { - break; - } - lastSigStart = n; - } - - i++; - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, 'n'); - } - /* mark the position of the start of the line */ - j = text->len; - } - } - - vtkWPString_Strip(text, " \r\t"); - - if (strlen(text->str) >= maxlen) - { - /* terminate before the current signature */ - text->str[lastSigStart] = '\0'; - } - - return text->str; -} - -/* -------------------------------------------------------------------- */ -/* Format a comment to a 70 char linewidth, in several steps: - * 1) remove html tags, convert

and
into breaks - * 2) remove doxygen tags like \em - * 3) remove extra whitespace (except paragraph breaks) - * 4) re-break the lines - */ - -const char *vtkWrapText_FormatComment( - const char *comment, size_t width) -{ - static struct vtkWPString staticString = { NULL, 0, 0 }; - struct vtkWPString *text; - const char *cp; - size_t i, j, l; - size_t indent = 0; - int nojoin = 0; - int start; - - text = &staticString; - text->len = 0; - - if (comment == 0) - { - return ""; - } - - i = 0; j = 0; l = 0; - start = 1; - cp = comment; - - /* skip any leading whitespace */ - while (cp[i] == '\n' || cp[i] == '\r' || - cp[i] == '\t' || cp[i] == ' ') - { - i++; - } - - while (cp[i] != '\0') - { - /* Add characters until the output line is complete */ - while (cp[i] != '\0' && text->len-j < width) - { - /* if the end of the line was found, see how next line begins */ - if (start) - { - /* eat the leading space */ - if (cp[i] == ' ') - { - i++; - } - - /* skip ahead to find any interesting first characters */ - l = i; - while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') - { - l++; - } - - /* check for new section */ - if (cp[l] == '.' && strncmp(&cp[l], ".SECTION", 8) == 0) - { - vtkWPString_Strip(text, "\n"); - if (text->len > 0) - { - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - } - i = l+8; - while (cp[i] == '\r' || cp[i] == '\t' || cp[i] == ' ') - { - i++; - } - while (cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - vtkWPString_Strip(text, " \t\r"); - - if (vtkWPString_LastChar(text) != ':') - { - vtkWPString_PushChar(text, ':'); - } - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - j = text->len; - indent = 0; - if (cp[i] == '\n') - { - i++; - } - start = 1; - continue; - } - - /* handle doxygen tags that appear at start of line */ - if (cp[l] == '\\' || cp[l] == '@') - { - if (strncmp(&cp[l+1], "brief", 5) == 0 || - strncmp(&cp[l+1], "short", 5) == 0 || - strncmp(&cp[l+1], "pre", 3) == 0 || - strncmp(&cp[l+1], "post", 4) == 0 || - strncmp(&cp[l+1], "param", 5) == 0 || - strncmp(&cp[l+1], "tparam", 6) == 0 || - strncmp(&cp[l+1], "cmdparam", 8) == 0 || - strncmp(&cp[l+1], "exception", 9) == 0 || - strncmp(&cp[l+1], "return", 6) == 0 || - strncmp(&cp[l+1], "li", 2) == 0) - { - nojoin = 2; - indent = 4; - if (text->len > 0 && vtkWPString_LastChar(text) != '\n') - { - vtkWPString_PushChar(text, '\n'); - } - j = text->len; - i = l; - } - } - - /* handle bullets and numbering */ - else if (cp[l] == '-' || cp[l] == '*' || cp[l] == '#' || - (cp[l] >= '0' && cp[l] <= '9' && - (cp[l+1] == ')' || cp[l+1] == '.') && cp[l+2] == ' ')) - { - indent = 0; - while (indent < 3 && cp[l+indent] != ' ') - { - indent++; - } - indent++; - if (text->len > 0 && vtkWPString_LastChar(text) != '\n') - { - vtkWPString_PushChar(text, '\n'); - } - j = text->len; - i = l; - } - - /* keep paragraph breaks */ - else if (cp[l] == '\n') - { - i = l+1; - vtkWPString_Strip(text, "\n"); - if (text->len > 0) - { - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - } - nojoin = 0; - indent = 0; - j = text->len; - start = 1; - continue; - } - - /* add newline if nojoin is not set */ - else if (nojoin || - (cp[i] == ' ' && !indent)) - { - if (nojoin == 2) - { - nojoin = 0; - indent = 0; - } - vtkWPString_PushChar(text, '\n'); - j = text->len; - } - - /* do line joining */ - else if (text->len > 0 && vtkWPString_LastChar(text) != '\n') - { - i = l; - vtkWPString_PushChar(text, ' '); - } - } - - /* handle quotes */ - if (cp[i] == '\"') - { - size_t q = i; - size_t r = text->len; - - /* try to keep the quote whole */ - vtkWPString_PushChar(text, cp[i++]); - while (cp[i] != '\"' && cp[i] != '\r' && - cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - /* if line ended before quote did, then reset */ - if (cp[i] != '\"') - { - i = q; - text->len = r; - } - } - else if (cp[i] == '\'') - { - size_t q = i; - size_t r = text->len; - - /* try to keep the quote whole */ - vtkWPString_PushChar(text, cp[i++]); - while (cp[i] != '\'' && cp[i] != '\r' && - cp[i] != '\n' && cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - /* if line ended before quote did, then reset */ - if (cp[i] != '\'') - { - i = q; - text->len = r; - } - } - - /* handle simple html tags */ - else if (cp[i] == '<') - { - l = i+1; - if (cp[l] == '/') { l++; } - while ((cp[l] >= 'a' && cp[l] <= 'z') || - (cp[l] >= 'a' && cp[l] <= 'z')) { l++; } - if (cp[l] == '>') - { - if (cp[i+1] == 'p' || cp[i+1] == 'P' || - (cp[i+1] == 'b' && cp[i+2] == 'r') || - (cp[i+1] == 'B' && cp[i+2] == 'R')) - { - vtkWPString_Strip(text, " \n"); - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - j = text->len; - indent = 0; - } - i = l+1; - while (cp[i] == '\r' || cp[i] == '\t' || cp[i] == ' ') - { - i++; - } - } - } - else if (cp[i] == '\\' || cp[i] == '@') - { - /* handle simple doxygen tags */ - if (strncmp(&cp[i+1], "em ", 3) == 0) - { - i += 4; - } - else if (strncmp(&cp[i+1], "a ", 2) == 0 || - strncmp(&cp[i+1], "e ", 2) == 0 || - strncmp(&cp[i+1], "c ", 2) == 0 || - strncmp(&cp[i+1], "b ", 2) == 0 || - strncmp(&cp[i+1], "p ", 2) == 0 || - strncmp(&cp[i+1], "f$", 2) == 0 || - strncmp(&cp[i+1], "f[", 2) == 0 || - strncmp(&cp[i+1], "f]", 2) == 0) - { - if (i > 0 && cp[i-1] != ' ') - { - vtkWPString_PushChar(text, ' '); - } - if (cp[i+1] == 'f') - { - if (cp[i+2] == '$') - { - vtkWPString_PushChar(text, '$'); - } - else - { - vtkWPString_PushChar(text, '\\'); - vtkWPString_PushChar(text, cp[i+2]); - } - } - i += 3; - } - else if (cp[i+1] == '&' || cp[i+1] == '$' || cp[i+1] == '#' || - cp[i+1] == '<' || cp[i+1] == '>' || cp[i+1] == '%' || - cp[i+1] == '@' || cp[i+1] == '\\' || cp[i+1] == '\"') - { - i++; - } - else if (cp[i+1] == 'n') - { - vtkWPString_Strip(text, " \n"); - vtkWPString_PushChar(text, '\n'); - vtkWPString_PushChar(text, '\n'); - indent = 0; - i += 2; - j = text->len; - } - else if (strncmp(&cp[i+1], "code", 4) == 0) - { - nojoin = 1; - i += 5; - while (cp[i] == ' ' || cp[i] == '\r' || - cp[i] == '\t' || cp[i] == '\n') - { - i++; - } - } - else if (strncmp(&cp[i+1], "endcode", 7) == 0) - { - nojoin = 0; - i += 8; - l = i; - while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') - { - l++; - } - if (cp[l] == '\n') - { - i = l; - vtkWPString_PushChar(text, '\n'); - j = text->len; - } - } - else if (strncmp(&cp[i+1], "verbatim", 8) == 0) - { - i += 9; - while (cp[i] != '\0' && ((cp[i] != '@' && cp[i] != '\\') || - strncmp(&cp[i+1], "endverbatim", 11) != 0)) - { - if (cp[i] != '\r') - { - vtkWPString_PushChar(text, cp[i]); - } - if (cp[i] == '\n') - { - j = text->len; - } - i++; - } - if (cp[i] != '\0') - { - i += 12; - } - } - } - - /* search for newline */ - start = 0; - l = i; - while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') - { - l++; - } - if (cp[l] == '\n') - { - i = l+1; - start = 1; - } - - /* append */ - else if (cp[i] != '\0') - { - vtkWPString_PushChar(text, cp[i++]); - } - - } /* while (cp[i] != '\0' && text->len-j < width) */ - - if (cp[i] == '\0') - { - break; - } - - vtkWPString_BreakCommentLine(text, &j, indent); - } - - /* remove any trailing blank lines */ - vtkWPString_Strip(text, "\n"); - vtkWPString_PushChar(text, '\n'); - - return text->str; -} - -/* -------------------------------------------------------------------- */ -/* Create a signature for the python version of a method. */ - -static void vtkWrapText_PythonTypeSignature( - struct vtkWPString *result, const char *delims[2], ValueInfo *arg); - -static void vtkWrapText_PythonArraySignature( - struct vtkWPString *result, const char *classname, - const char *delims[2], int ndim, const char **dims); - -const char *vtkWrapText_PythonSignature( - FunctionInfo *currentFunction) -{ - /* string is intentionally not freed until the program exits */ - static struct vtkWPString staticString = { NULL, 0, 0 }; - struct vtkWPString *result; - ValueInfo *arg, *ret; - const char *parens[2] = { "(", ")" }; - const char *braces[2] = { "[", "]" }; - const char **delims; - int i, n; - - n = vtkWrap_CountWrappedArgs(currentFunction); - - result = &staticString; - result->len = 0; - - /* print out the name of the method */ - vtkWPString_Append(result, "V."); - vtkWPString_Append(result, currentFunction->Name); - - /* print the arg list */ - vtkWPString_Append(result, "("); - - for (i = 0; i < n; i++) - { - arg = currentFunction->Arguments[i]; - - if (i != 0) - { - vtkWPString_Append(result, ", "); - } - - delims = parens; - if (!vtkWrap_IsConst(arg) && - !vtkWrap_IsSetVectorMethod(currentFunction)) - { - delims = braces; - } - - vtkWrapText_PythonTypeSignature(result, delims, arg); - } - - vtkWPString_Append(result, ")"); - - /* if this is a void method, we are finished */ - /* otherwise, print "->" and the return type */ - ret = currentFunction->ReturnValue; - if (ret && (ret->Type & VTK_PARSE_UNQUALIFIED_TYPE) != VTK_PARSE_VOID) - { - vtkWPString_Append(result, " -> "); - - vtkWrapText_PythonTypeSignature(result, parens, ret); - } - - if (currentFunction->Signature) - { - vtkWPString_Append(result, "\nC++: "); - vtkWPString_Append(result, currentFunction->Signature); - } - - return result->str; -} - -static void vtkWrapText_PythonTypeSignature( - struct vtkWPString *result, const char *braces[2], ValueInfo *arg) -{ - char text[32]; - const char *dimension; - const char *classname = ""; - - if (vtkWrap_IsVoid(arg)) - { - classname = "void"; - } - else if (vtkWrap_IsObject(arg)) - { - classname = arg->Class; - } - else if (vtkWrap_IsFunction(arg)) - { - classname = "function"; - } - else if (vtkWrap_IsString(arg) || vtkWrap_IsCharPointer(arg)) - { - classname = "string"; - if ((arg->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) - { - classname = "unicode"; - } - } - else if (vtkWrap_IsChar(arg)) - { - classname = "char"; - } - else if (vtkWrap_IsBool(arg)) - { - classname = "bool"; - } - else if (vtkWrap_IsRealNumber(arg)) - { - classname = "float"; - } - else if (vtkWrap_IsInteger(arg)) - { - classname = "int"; - } - - if (vtkWrap_IsArray(arg)) - { - if (arg->CountHint) - { - vtkWPString_Append(result, braces[0]); - vtkWPString_Append(result, classname); - vtkWPString_Append(result, ", ..."); - vtkWPString_Append(result, braces[1]); - } - else - { - sprintf(text, "%d", arg->Count); - dimension = text; - vtkWrapText_PythonArraySignature(result, classname, braces, - 1, &dimension); - } - } - else if (vtkWrap_IsNArray(arg)) - { - vtkWrapText_PythonArraySignature(result, classname, braces, - arg->NumberOfDimensions, arg->Dimensions); - } - else - { - vtkWPString_Append(result, classname); - } -} - -static void vtkWrapText_PythonArraySignature( - struct vtkWPString *result, const char *classname, - const char *braces[2], int ndim, const char **dims) -{ - int j, n; - - vtkWPString_Append(result, braces[0]); - n = (int)strtoul(dims[0], 0, 0); - if (ndim > 1) - { - for (j = 0; j < n; j++) - { - if (j != 0) { vtkWPString_Append(result, ", "); } - vtkWrapText_PythonArraySignature(result, classname, - braces, ndim-1, dims+1); - } - } - else - { - for (j = 0; j < n; j++) - { - if (j != 0) { vtkWPString_Append(result, ", "); } - vtkWPString_Append(result, classname); - } - } - vtkWPString_Append(result, braces[1]); -} diff --git a/src/ParaView/vtkWrapText.h b/src/ParaView/vtkWrapText.h deleted file mode 100644 index bc3a7f15..00000000 --- a/src/ParaView/vtkWrapText.h +++ /dev/null @@ -1,61 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkWrapText.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/** - * vtkWrap provides useful functions for generating wrapping code. -*/ - -#ifndef VTK_WRAP_TEXT_H -#define VTK_WRAP_TEXT_H - -#include "vtkParse.h" -#include "vtkParseHierarchy.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Quote a string for inclusion in a C string literal. The "maxlen" - * should be set to a value between 32 and 2047. Values over 2047 - * will result in string literals too long for some compilers. If - * the string is truncated, a "..." will be appended. - */ -const char *vtkWrapText_QuoteString(const char *comment, size_t maxlen); - -/** - * Format a doxygen comment for plain text, and word-wrap at - * the specified width. A 70-char width is recommended. - */ -const char *vtkWrapText_FormatComment(const char *comment, size_t width); - -/** - * Format a method signature by applying word-wrap at the specified - * width and taking special care not to split any literals or names. - * A width of 70 chars is recommended. - */ -const char *vtkWrapText_FormatSignature( - const char *signature, size_t width, size_t maxlen); - -/** - * Produce a python signature for a method, for use in documentation. - */ -const char *vtkWrapText_PythonSignature(FunctionInfo *currentFunction); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/VTKParser/CMakeLists.txt b/src/VTKParser/CMakeLists.txt deleted file mode 100644 index ca407da1..00000000 --- a/src/VTKParser/CMakeLists.txt +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - - -## Generation of the list of VTK classes (to be wrapped into IDLs) -## ===================================== -IF(NOT SALOME_LIGHT_ONLY) - # TODO: the below requires ParaView in the PYTHONPATH ... not so nice: - MESSAGE(STATUS "Generating list of wrapped VTK classes ...") - LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_INCLUDE_DIR0} - RESULT_VARIABLE _res) - IF(NOT _res EQUAL 0) - MESSAGE(FATAL_ERROR "Unable to run the Python script retrieving the list of VTK classes.") - ENDIF() -ENDIF() - -INCLUDE(GenerateWrapList.cmake) - -## Parser for VTK header files -## =========================== -## -## Everything under the ParaView subdirectory is a pure copy of ParaView source -## code. - -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR}/ParaView - ${PROJECT_BINARY_DIR}/idl - ${PROJECT_SOURCE_DIR}/src/PVGUI - ) - -# Wrapper executable generating the headers, source files and IDL files -# corresponding to VTK wrapping: -SET(_wrap_PROGRAMS - vtkWrapIDL_HH - vtkWrapIDL_CC - vtkWrapIDL - ) - -SET(vtkWrapIDL_HH_CPPFLAGS -DIDL_I_HH) -SET(vtkWrapIDL_CC_CPPFLAGS -DIDL_I_CC) -SET(vtkWrapIDL_CPPFLAGS) - -#VTN TODO: vtkParseData supports two types of structures for wrapping. -#We use old structures currently, but is is not influent for results of wrapping. -#It may be necessary to port vtkWrapIDL to new approach in future. -#IF(VTK_LEGACY_REMOVE) -# ADD_DEFINITIONS(-DVTK_PARSE_LEGACY_REMOVE) -#ENDIF() - -FOREACH(name ${_wrap_PROGRAMS}) - ADD_EXECUTABLE(${name} - ParaView/vtkParse.tab.c - ParaView/vtkParsePreprocess.c - ParaView/vtkParseHierarchy.c - ParaView/vtkParseExtras.c - ParaView/vtkParseMain.c - ParaView/vtkParseData.c - ParaView/vtkParseString.c - ParaView/vtkWrap.c -# ParaView/vtkWrapText.c - ${PROJECT_SOURCE_DIR}/idl/vtkWrapIDL.c) - ADD_DEPENDENCIES(${name} generate_txt) - - set_property(SOURCE ParaView/vtkParseMain.c PROPERTY COMPILE_DEFINITIONS - VTK_PARSE_VERSION="${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}") - - SET(flags) - FOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS}) - SET(flags "${flags} ${f}") - ENDFOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS}) - - SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}") - TARGET_LINK_LIBRARIES(${name} ${PLATFORM_LIBADD}) - - SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name}) - IF(WINDOWS) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${name}.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WINDOWS) - INSTALL(FILES ${${name}_EXEFILE} DESTINATION bin/salome PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -ENDFOREACH(name ${_wrap_PROGRAMS}) - -# Generate headers and sources corresponding to the IDL implementations: -INCLUDE(wrap.cmake) - -## From 2.8.10, we should use: -## SET(CMAKE_POSITION_INDEPENDENT_CODE ON) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -ADD_LIBRARY(VTK_IDL_Impl OBJECT ${WRAP_IDL_I_CC}) - -# Make the list of wrapped files visible from the top directory (will be used in PVGUI and idl): -SET(WRAP_IDL_I_HH "${WRAP_IDL_I_HH}" PARENT_SCOPE) -SET(WRAP_IDL_I_CC "${WRAP_IDL_I_CC}" PARENT_SCOPE) diff --git a/src/VTKParser/GenerateWrapList.cmake b/src/VTKParser/GenerateWrapList.cmake deleted file mode 100644 index c884b5b5..00000000 --- a/src/VTKParser/GenerateWrapList.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_BINARY_DIR}/wrapfiles.txt - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_PYTHON_EXECUTABLE} -) diff --git a/src/VTKParser/create_class.py b/src/VTKParser/create_class.py deleted file mode 100755 index 4532eda0..00000000 --- a/src/VTKParser/create_class.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import sys -import os - -ffile = "PARAVIS_CreateClass.cxx" -wfile = os.path.join(sys.argv[1], "wrapfiles.txt") - -ffile_stream = open(ffile, "w") - -ffile_stream.write('#include ' + '\n') -ffile_stream.write('#include ' + '\n') -ffile_stream.write('#include "PARAVIS_Gen_i.hh"' + '\n') -wfile_stream = open(wfile) -for line in wfile_stream: - if line.split()[0] == "vtkWebGLExporter" : - ffile_stream.write('#ifdef WIN32\n') - ffile_stream.write(' #ifdef GetObject\n') - ffile_stream.write(' #undef GetObject\n') - ffile_stream.write(' #endif\n') - ffile_stream.write('#endif\n') - pass - ffile_stream.write('#include "PARAVIS_Gen_%s_i.hh"'%(line.split()[0]) + '\n') - pass -wfile_stream.close() -ffile_stream.write('' + '\n') -ffile_stream.write('PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' + '\n') -ffile_stream.write('{' + '\n') -wfile_stream = open(wfile) -lst = [] -for line in wfile_stream: - lst.append(line.split()[0]) - pass -wfile_stream.close() -lst.reverse() -for item in lst: - ffile_stream.write(' if(theClassName == "%s" || (Inst != NULL && Inst->IsA("%s")))'%(item, item) + '\n') - ffile_stream.write(' return new PARAVIS::%s_i();'%(item) + '\n') - pass -ffile_stream.write('' + '\n') -ffile_stream.write(' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' + '\n') -ffile_stream.write(' return new PARAVIS::PARAVIS_Base_i();' + '\n') -ffile_stream.write('}' + '\n') -ffile_stream.close() diff --git a/src/VTKParser/create_class.sh b/src/VTKParser/create_class.sh deleted file mode 100755 index 8c2b8e01..00000000 --- a/src/VTKParser/create_class.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -file=PARAVIS_CreateClass.cxx -wfile=$1/wrapfiles.txt - -echo '#include ' > $file -echo '#include ' >> $file -echo '#include "PARAVIS_Gen_i.hh"' >> $file -awk '{print "#include \"PARAVIS_Gen_"$1"_i.hh\"";}' $wfile >> $file -echo '' >> $file -echo 'PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' >> $file -echo '{' >> $file -awk 'BEGIN {lst="";} {lst=lst" "$1;} END{i=split(lst,arr);for(j=i;j>0;j--) {print " if(theClassName == \""arr[j]"\" || (Inst != NULL && Inst->IsA(\""arr[j]"\")))";print " return new PARAVIS::"arr[j]"_i();"}}' $wfile >> $file -echo '' >> $file -echo ' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' >> $file -echo ' return new PARAVIS::PARAVIS_Base_i();' >> $file -echo '}' >> $file diff --git a/src/VTKParser/getwrapclasses.py b/src/VTKParser/getwrapclasses.py deleted file mode 100644 index 5981372c..00000000 --- a/src/VTKParser/getwrapclasses.py +++ /dev/null @@ -1,158 +0,0 @@ -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import paraview, os, sys -import string -import re - -classeslistsm = [] -classeslistvtk = [] - -from vtkPVCommonPython import * -from vtkPVClientServerCoreCorePython import * -from vtkPVClientServerCoreDefaultPython import * -from vtkPVClientServerCoreRenderingPython import * -from vtkPVServerImplementationCorePython import * -from vtkPVServerImplementationDefaultPython import * -from vtkPVServerImplementationRenderingPython import * -from vtkPVServerManagerApplicationPython import * -from vtkPVServerManagerCorePython import * -from vtkPVServerManagerDefaultPython import * -from vtkPVServerManagerRenderingPython import * -try: - from vtkPVVTKExtensionsCorePython import * -except: - pass -try: - from vtkPVVTKExtensionsDefaultPython import * -except: - pass -try: - from vtkPVVTKExtensionsRenderingPython import * -except: - pass -try: - from vtkPVVTKExtensionsWebGLExporterPython import * -except: - pass - -l1 = dir() -for a in l1: - if a.startswith("vtk") and (len(a) > 3): - classeslistsm.append(a) - -from paraview.vtk import * -l2 = dir() - -for a in l2: - if (a not in l1) and a.startswith("vtk"): - classeslistvtk.append(a) - -dic=dict() - -non_wrap_list = ["vtkVariant", "vtkTimeStamp"] - -pv_classes_new=classeslistsm -while len(pv_classes_new): - pv_classes_cur=pv_classes_new - pv_classes_new=[] - for c in pv_classes_cur: - ## ignore non wrappable classes - if c in non_wrap_list: - continue - filename=sys.argv[1]+"/"+c+".h" - if os.path.isfile(filename): - c_new=[] - f=open(filename) - for line in f: - if re.match('\s*/',line) is None: - if re.match('\s*public\s*:',line): - continue - - m=re.match('\s*class\s+(vtk\w+)\s*;',line) - if m is not None: - cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): - pv_classes_new.append(cn) - continue - - m=re.match('\s*struct\s+(vtk\w+)\s*;',line) - if m is not None: - cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): - pv_classes_new.append(cn) - continue - - m=re.match('\s*#include\s+"(vtk\w+)\.h"',line) - if m is not None: - cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): - pv_classes_new.append(cn) - continue - - cm=re.findall('public\s+(vtk\w+)',line) - if len(cm) == 0: - continue - for cn in cm: - ## do not extract Call Back classes - if cn.count('vtkClassMemberCallback'): - continue - if cn not in dic.keys() and cn not in pv_classes_new: - pv_classes_new.append(cn) - if cn not in c_new: - c_new.append(cn) - f.close() - dic[c]=[0, c_new] - - -pv_classes_sort=[] - -def collect_dic(cc): - ret=[] - for c in cc: - if c not in dic.keys(): - continue - if len(dic[c][1]) and dic[c][0] == 0: - ret+=collect_dic(dic[c][1]) - if dic[c][0] == 0: - ret.append(c) - dic[c][0]=1 - return ret - -pv_classes_sort=collect_dic(dic.keys()) - -wf_str="" -if(os.path.exists('wrapfiles.txt')): - wf_txt=open('wrapfiles.txt','r') - strs=wf_txt.readlines() - wf_txt.close() - for s in strs: - wf_str+=s -str="" - -for c in pv_classes_sort: - str+=c - for cc in dic[c][1]: - str+=' '+cc - str+='\n' - -if(str!=wf_str): - wf_txt=open('wrapfiles.txt','w') - wf_txt.write(str) - wf_txt.close() diff --git a/src/VTKParser/readme.txt b/src/VTKParser/readme.txt deleted file mode 100644 index cdceac2c..00000000 --- a/src/VTKParser/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -The files under the ParaView directory are pure copy from Paraview sources. -They need for extractor building. -Them has to be updated if the corresponded files in paraview will be changed \ No newline at end of file diff --git a/src/VTKParser/wrap.cmake b/src/VTKParser/wrap.cmake deleted file mode 100755 index daf5d126..00000000 --- a/src/VTKParser/wrap.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0) - -SET(WRAP_IDL_I_HH) -SET(WRAP_IDL_I_CC) - -IF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "f = open('${CMAKE_BINARY_DIR}/wrapfiles.txt') ; print f.read(), ; f.close()" - OUTPUT_VARIABLE WRAP_LIST_FULL - ) - - STRING(REGEX MATCHALL "[^\n]+" WRAP_LIST_REG ${WRAP_LIST_FULL}) - FOREACH(_str ${WRAP_LIST_REG}) - - SEPARATE_ARGUMENTS(_str) - LIST(LENGTH _str WRAP_LEN) - SET(DEP_HH) - SET(DEP_CC) - - LIST(GET _str 0 VAL) - - IF(WRAP_LEN GREATER 1) - MATH(EXPR WRAP_LEN1 "${WRAP_LEN} - 1" ) - - FOREACH(IND RANGE 1 ${WRAP_LEN1}) - LIST(GET _str ${IND} DEP_VAL) - SET(DEP_HH ${DEP_HH} PARAVIS_Gen_${DEP_VAL}_i.hh) - SET(DEP_CC ${DEP_CC} PARAVIS_Gen_${DEP_VAL}_i.cc) - ENDFOREACH(IND RANGE 1 ${WRAP_LEN1}) - - ENDIF(WRAP_LEN GREATER 1) - - LIST(APPEND WRAP_IDL_I_HH PARAVIS_Gen_${VAL}_i.hh) - LIST(APPEND WRAP_IDL_I_CC PARAVIS_Gen_${VAL}_i.cc) - - SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_HH) - IF(WINDOWS) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_HH.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/vtkWrapIDL_HH.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WINDOWS) - - ADD_CUSTOM_COMMAND( - OUTPUT PARAVIS_Gen_${VAL}_i.hh - COMMAND ${vtkWrapIDL_HH_EXEFILE} -o PARAVIS_Gen_${VAL}_i.hh --hints ${CMAKE_BINARY_DIR}/idl/hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h - DEPENDS vtkWrapIDL_HH ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h ${CMAKE_BINARY_DIR}/idl/hints ${DEP_HH} - ) - - SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_CC) - IF(WINDOWS) - IF(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_CC.exe) - ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) - SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/vtkWrapIDL_CC.exe) - ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) - ENDIF(WINDOWS) - - ADD_CUSTOM_COMMAND( - OUTPUT PARAVIS_Gen_${VAL}_i.cc - COMMAND ${vtkWrapIDL_CC_EXEFILE} -o PARAVIS_Gen_${VAL}_i.cc --hints ${CMAKE_BINARY_DIR}/idl/hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h - DEPENDS PARAVIS_Gen_${VAL}_i.hh vtkWrapIDL_CC ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h ${CMAKE_BINARY_DIR}/idl/hints ${DEP_CC} - ) - - ENDFOREACH(_str ${WRAP_LIST_REG}) -ENDIF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) - -ADD_CUSTOM_TARGET(generate_implements ALL DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt ${WRAP_IDL_I_HH} ${WRAP_IDL_I_CC}) diff --git a/src/VTKWrapping/GenerateWrapList.cmake b/src/VTKWrapping/GenerateWrapList.cmake new file mode 100644 index 00000000..c884b5b5 --- /dev/null +++ b/src/VTKWrapping/GenerateWrapList.cmake @@ -0,0 +1,24 @@ +# Copyright (C) 2010-2013 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +ADD_CUSTOM_COMMAND( + OUTPUT ${PROJECT_BINARY_DIR}/wrapfiles.txt + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_PYTHON_EXECUTABLE} +) diff --git a/src/VTKWrapping/ParaView/lex.yy.c b/src/VTKWrapping/ParaView/lex.yy.c new file mode 100644 index 00000000..a6c44384 --- /dev/null +++ b/src/VTKWrapping/ParaView/lex.yy.c @@ -0,0 +1,4722 @@ +#line 2 "lex.yy.c" + +#line 4 "lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#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. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + yy_size_t yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +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. + */ + yy_size_t 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; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* 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 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* 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". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* 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 (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (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 = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 173 +#define YY_END_OF_BUFFER 174 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[1116] = + { 0, + 0, 0, 174, 172, 142, 143, 143, 171, 172, 171, + 171, 172, 171, 171, 171, 171, 171, 171, 171, 140, + 139, 171, 171, 171, 171, 133, 133, 133, 133, 133, + 133, 169, 172, 170, 171, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 171, 142, 11, 11, 14, 171, + 172, 142, 164, 0, 15, 0, 157, 161, 158, 0, + 0, 0, 116, 117, 0, 0, 0, 0, 155, 151, + 153, 152, 154, 149, 147, 0, 134, 1, 13, 156, + 135, 138, 0, 0, 139, 139, 139, 168, 146, 165, + + 163, 166, 150, 133, 133, 133, 133, 133, 133, 133, + 133, 141, 0, 160, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 70, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 159, 162, 142, 11, 14, + 0, 0, 14, 14, 12, 0, 15, 16, 16, 0, + 0, 0, 0, 0, 148, 167, 134, 134, 13, 135, + 135, 138, 138, 0, 136, 137, 144, 145, 133, 133, + 133, 133, 0, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 68, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 25, + 133, 133, 133, 133, 58, 72, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 74, 12, 14, 12, 12, 12, 12, 0, 0, + 0, 0, 0, 0, 0, 134, 0, 135, 136, 137, + 133, 133, 133, 133, 0, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 66, 133, 133, 29, + 24, 133, 133, 133, 133, 133, 133, 42, 133, 133, + + 133, 133, 133, 133, 23, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 0, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 28, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 12, 12, 12, 12, + 12, 12, 12, 12, 0, 0, 0, 0, 0, 133, + 133, 133, 133, 128, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 77, 37, + 78, 45, 133, 133, 133, 133, 133, 20, 133, 133, + 133, 133, 133, 133, 133, 71, 133, 133, 133, 133, + + 133, 133, 22, 133, 133, 133, 133, 133, 0, 133, + 133, 133, 61, 133, 133, 43, 133, 57, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 12, 12, 12, 12, 12, 12, + 12, 2, 3, 0, 0, 0, 0, 0, 133, 133, + 133, 133, 128, 133, 133, 133, 121, 133, 133, 133, + 133, 133, 133, 133, 133, 69, 76, 133, 59, 19, + 133, 133, 52, 49, 50, 133, 133, 133, 73, 133, + 133, 133, 133, 39, 133, 133, 133, 27, 30, 133, + 51, 0, 0, 0, 133, 38, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 75, 12, 12, 12, 2, + 3, 12, 12, 12, 2, 3, 0, 0, 0, 0, + 0, 133, 133, 133, 133, 133, 133, 133, 120, 133, + 131, 133, 133, 133, 21, 133, 133, 133, 133, 133, + 133, 47, 133, 133, 133, 40, 133, 0, 133, 133, + 133, 31, 133, 0, 0, 0, 124, 124, 133, 55, + 133, 133, 44, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 0, 12, 12, 12, 2, 3, 12, + + 12, 12, 0, 0, 0, 0, 0, 118, 119, 121, + 17, 121, 32, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 60, 123, 123, 133, 48, 122, + 122, 0, 133, 0, 67, 133, 0, 36, 133, 0, + 0, 0, 53, 54, 26, 46, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 12, + 12, 12, 5, 12, 12, 0, 0, 0, 0, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 56, 0, + 41, 0, 133, 133, 0, 0, 0, 133, 133, 133, + + 133, 133, 133, 133, 79, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 5, 12, 12, 5, 12, 12, 0, 0, 133, 132, + 133, 133, 130, 64, 133, 0, 0, 0, 133, 133, + 0, 0, 0, 133, 133, 133, 133, 133, 133, 133, + 18, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 5, 12, 12, 12, 12, + 0, 4, 133, 133, 133, 133, 0, 0, 0, 133, + 62, 0, 0, 0, 133, 133, 133, 81, 133, 133, + 133, 133, 80, 133, 133, 133, 133, 133, 133, 133, + + 133, 106, 133, 133, 133, 133, 133, 133, 12, 12, + 12, 12, 0, 133, 133, 133, 63, 0, 0, 0, + 133, 0, 0, 133, 127, 133, 133, 133, 133, 133, + 133, 133, 133, 125, 133, 108, 110, 112, 102, 133, + 133, 133, 133, 107, 133, 133, 133, 12, 12, 12, + 12, 0, 133, 133, 129, 0, 0, 0, 33, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 109, 111, 113, 133, 133, 133, 12, 12, 12, 12, + 12, 12, 12, 0, 133, 133, 0, 34, 0, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 114, 115, 133, + 133, 133, 133, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 0, 133, 104, 0, 133, 87, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 6, 133, + 0, 35, 65, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 84, 133, 133, 133, 133, 133, 133, 133, + 133, 126, 133, 133, 12, 12, 12, 12, 6, 12, + + 12, 12, 12, 6, 133, 133, 133, 86, 83, 133, + 133, 133, 133, 97, 85, 82, 133, 133, 133, 133, + 96, 133, 133, 133, 12, 12, 12, 12, 6, 12, + 12, 12, 12, 105, 133, 133, 92, 93, 94, 95, + 88, 89, 90, 91, 133, 133, 133, 12, 12, 12, + 12, 12, 12, 12, 12, 133, 133, 133, 133, 133, + 12, 12, 12, 12, 10, 12, 12, 12, 100, 133, + 103, 133, 133, 10, 12, 12, 12, 10, 12, 8, + 9, 133, 133, 133, 10, 12, 8, 9, 12, 8, + 9, 133, 133, 133, 12, 8, 9, 12, 133, 133, + + 99, 12, 7, 133, 133, 7, 7, 133, 133, 7, + 133, 98, 133, 101, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 6, 7, 8, 9, 1, 10, 11, 12, 13, + 14, 15, 16, 14, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 25, 27, 25, 28, 14, 29, + 30, 31, 1, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 40, + 58, 59, 60, 61, 62, 1, 63, 64, 65, 66, + + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 14, 89, 14, 14, 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 flex_int32_t yy_meta[90] = + { 0, + 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, + 2, 4, 1, 1, 2, 1, 1, 5, 1, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 1, 1, + 1, 1, 8, 8, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, + 1, 9, 8, 8, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 1 + } ; + +static yyconst flex_int16_t yy_base[1153] = + { 0, + 0, 88, 2594, 2595, 90, 2595, 2595, 2563, 87, 2562, + 87, 2532, 97, 2595, 2560, 85, 88, 113, 91, 133, + 151, 2561, 84, 2558, 92, 63, 2525, 83, 42, 128, + 85, 2595, 124, 2595, 2556, 2523, 103, 120, 122, 136, + 119, 87, 125, 86, 79, 145, 147, 131, 148, 159, + 164, 162, 171, 106, 113, 252, 2595, 2595, 2525, 217, + 2512, 214, 2595, 158, 2595, 186, 2595, 2595, 2595, 223, + 227, 257, 2595, 2595, 116, 2554, 216, 209, 2595, 2595, + 2595, 2595, 2595, 2566, 2595, 2562, 254, 2595, 0, 2595, + 273, 293, 311, 0, 321, 341, 353, 2595, 2549, 2595, + + 2595, 2595, 2548, 2515, 205, 227, 208, 335, 241, 142, + 239, 2595, 2573, 2595, 344, 221, 226, 240, 247, 203, + 242, 323, 321, 267, 324, 322, 339, 325, 332, 334, + 244, 328, 329, 352, 351, 356, 287, 2513, 357, 358, + 261, 361, 360, 362, 371, 378, 372, 366, 381, 383, + 386, 387, 389, 393, 390, 2595, 2595, 466, 2595, 2515, + 2554, 2501, 2512, 471, 447, 276, 248, 2595, 444, 2542, + 2541, 437, 433, 434, 2595, 2595, 466, 484, 0, 492, + 511, 521, 533, 541, 549, 557, 2595, 2595, 458, 417, + 478, 462, 2540, 2505, 461, 420, 523, 459, 293, 421, + + 524, 80, 2504, 525, 536, 526, 534, 545, 539, 546, + 542, 541, 330, 553, 556, 549, 569, 567, 548, 2503, + 571, 573, 574, 576, 2502, 2501, 577, 603, 579, 582, + 585, 584, 583, 586, 588, 587, 593, 437, 590, 625, + 602, 599, 594, 607, 613, 617, 616, 614, 291, 618, + 661, 2500, 683, 679, 0, 665, 2509, 2508, 2481, 2476, + 716, 656, 666, 658, 723, 731, 739, 747, 755, 763, + 662, 663, 670, 664, 0, 758, 743, 647, 666, 731, + 672, 741, 732, 637, 668, 770, 2495, 742, 744, 2494, + 2493, 753, 747, 754, 757, 761, 750, 2492, 746, 771, + + 776, 778, 779, 673, 2491, 780, 781, 808, 784, 786, + 674, 787, 790, 797, 791, 794, 798, 804, 2490, 802, + 811, 2523, 801, 816, 812, 467, 817, 822, 823, 825, + 826, 2488, 828, 827, 833, 829, 835, 837, 839, 838, + 844, 845, 846, 849, 850, 876, 0, 900, 2497, 2496, + 868, 2480, 2490, 2489, 2470, 2476, 894, 895, 896, 873, + 880, 895, 893, 0, 877, 896, 887, 900, 883, 885, + 886, 890, 884, 927, 894, 892, 898, 899, 2480, 2479, + 2478, 2477, 905, 907, 908, 906, 914, 2476, 916, 913, + 921, 919, 923, 924, 925, 2475, 929, 926, 932, 933, + + 934, 937, 2474, 938, 940, 968, 2473, 948, 938, 949, + 952, 958, 2472, 955, 961, 2471, 963, 2470, 964, 966, + 967, 969, 970, 971, 983, 974, 976, 980, 979, 978, + 985, 981, 993, 992, 1014, 2464, 2474, 2473, 2495, 2490, + 2445, 0, 0, 2458, 2444, 1034, 1035, 1036, 1016, 1017, + 1034, 1035, 0, 1020, 1036, 1040, 1026, 1014, 1018, 1021, + 1019, 1025, 1065, 1031, 1039, 2461, 2460, 1054, 2459, 2458, + 1041, 1037, 2457, 2456, 2455, 1043, 1045, 1047, 2454, 1049, + 1053, 1055, 1051, 1118, 1063, 1052, 1067, 2453, 2452, 1094, + 2451, 2431, 2430, 2428, 1180, 2447, 1072, 1073, 1074, 1075, + + 1076, 1077, 1078, 1081, 1083, 1108, 1084, 1104, 1181, 1096, + 1101, 1099, 1151, 1103, 1186, 2446, 2474, 2469, 2424, 0, + 0, 2459, 2468, 2437, 0, 0, 2426, 2432, 1187, 1139, + 1216, 1116, 1117, 1184, 1168, 1187, 1190, 1185, 2437, 1189, + 2436, 1155, 1172, 1192, 2435, 1183, 1196, 1198, 2434, 1194, + 1276, 2433, 1110, 1247, 1365, 1260, 1205, 1268, 1248, 1251, + 1336, 2432, 1278, 2411, 2410, 2411, 2595, 2428, 1249, 2427, + 1250, 1252, 2426, 1257, 1258, 1288, 1264, 1268, 1283, 1270, + 1284, 1337, 1338, 1286, 1291, 1293, 1339, 1294, 1340, 1367, + 1341, 1349, 1296, 2459, 2441, 2450, 2419, 0, 0, 2446, + + 2430, 2401, 2413, 2416, 1376, 1385, 1429, 2595, 2450, 1368, + 2415, 1388, 2414, 2413, 1375, 2412, 1376, 1377, 1347, 1378, + 1379, 1381, 1380, 1408, 2411, 2595, 2410, 1395, 2409, 2595, + 2408, 1461, 1297, 2395, 2406, 1385, 1466, 2595, 1344, 2387, + 2386, 2394, 2402, 2401, 2400, 2399, 1386, 1394, 1396, 1414, + 1261, 1413, 1415, 1419, 1420, 1421, 1423, 1427, 1428, 1430, + 1429, 1436, 1384, 1434, 1438, 1460, 1440, 1441, 1469, 2423, + 2407, 2378, 0, 2416, 2385, 2379, 2389, 1509, 1523, 1470, + 1473, 1479, 1451, 1455, 1465, 1472, 1461, 1482, 2391, 2378, + 1547, 2374, 1492, 1474, 2383, 2382, 2372, 1485, 1478, 1498, + + 1486, 1500, 1501, 1494, 2385, 1502, 1507, 1508, 1511, 1512, + 1513, 1515, 1517, 1518, 1519, 1523, 1525, 1529, 1528, 1527, + 0, 2405, 2374, 0, 2397, 2365, 2360, 2374, 1213, 2378, + 1536, 1535, 2377, 2376, 1531, 2360, 1608, 2354, 1537, 1541, + 2372, 2371, 2364, 1560, 1553, 1555, 1556, 1562, 1544, 1563, + 2370, 1564, 1566, 1567, 1568, 1569, 1572, 1573, 1624, 1575, + 1587, 1577, 1590, 1591, 1592, 0, 2384, 2352, 2383, 2346, + 2364, 2595, 1605, 1608, 2364, 1595, 2343, 2350, 2342, 2360, + 2359, 2345, 2344, 0, 1599, 1601, 1612, 2356, 1603, 1606, + 1604, 1631, 2355, 1609, 1610, 1616, 1618, 1619, 1656, 1661, + + 1666, 2354, 1630, 1632, 1676, 1633, 1663, 1642, 2369, 2332, + 2407, 2341, 2329, 1652, 1668, 1669, 2348, 2328, 2331, 1706, + 1679, 0, 0, 1655, 2345, 1648, 1674, 1681, 1723, 1670, + 1692, 1694, 1729, 2344, 1698, 2343, 2342, 2341, 2340, 1686, + 1701, 1707, 1716, 2339, 1696, 1688, 1700, 2394, 2328, 1735, + 2321, 2326, 2334, 1711, 1705, 1777, 2313, 1787, 2595, 1725, + 1697, 1719, 1732, 1736, 1739, 1751, 1755, 1757, 1741, 1710, + 1744, 1746, 1765, 1766, 1767, 1769, 1758, 1796, 1798, 1761, + 2332, 2331, 2330, 1762, 1763, 1764, 1801, 2314, 2327, 2322, + 2321, 2320, 2310, 2308, 1805, 1784, 1842, 2595, 2303, 1770, + + 1772, 1788, 1791, 1792, 1799, 1801, 1803, 1806, 1809, 1797, + 1810, 1811, 1816, 1818, 1821, 1823, 1825, 2321, 2320, 1826, + 1827, 1829, 1830, 2318, 2313, 2312, 2311, 2301, 2292, 2294, + 2307, 2306, 2344, 2295, 1856, 2308, 1892, 1834, 2307, 1855, + 1839, 1842, 1845, 1846, 1850, 1859, 1851, 1837, 1861, 1863, + 1864, 1865, 1870, 1871, 1866, 1889, 1875, 1777, 1876, 2284, + 2286, 2299, 2298, 2336, 2296, 2297, 2355, 2354, 0, 1905, + 1947, 2595, 2297, 1885, 1892, 1880, 1883, 1893, 1894, 1896, + 1899, 1900, 2296, 1901, 1903, 1902, 1904, 1906, 1907, 1908, + 1909, 2295, 1919, 1921, 2289, 2290, 2348, 2341, 0, 2275, + + 2249, 2287, 2248, 0, 1944, 1927, 1929, 2240, 2231, 1931, + 1932, 1933, 1934, 2222, 2213, 2204, 1935, 1937, 1938, 1939, + 2174, 1940, 1942, 1955, 2164, 2138, 2176, 2137, 0, 2109, + 2115, 2102, 2097, 2105, 1945, 1957, 2097, 2093, 2089, 2084, + 2076, 2071, 2059, 2054, 1958, 1961, 1981, 2030, 2036, 2032, + 2031, 2023, 2018, 2000, 1999, 1959, 1965, 1967, 1968, 1969, + 1998, 2000, 1996, 1995, 0, 1992, 1995, 1994, 2007, 1971, + 2005, 1972, 1975, 0, 1916, 1687, 1442, 0, 1154, 0, + 0, 1979, 1990, 1983, 0, 1024, 0, 0, 784, 0, + 0, 1985, 1986, 1989, 733, 0, 0, 629, 2008, 1992, + + 550, 313, 0, 1996, 1993, 0, 0, 2000, 1998, 0, + 2002, 211, 2006, 47, 2595, 2083, 2092, 2100, 2105, 2109, + 2118, 2122, 2126, 2135, 2139, 2144, 2148, 2156, 2160, 2164, + 2173, 2175, 2179, 2188, 2197, 2206, 2215, 2224, 2233, 2242, + 2249, 2256, 2263, 2272, 2281, 2290, 2299, 2308, 2317, 2326, + 2335, 2344 + } ; + +static yyconst flex_int16_t yy_def[1153] = + { 0, + 1115, 1, 1115, 1115, 1115, 1115, 1115, 1115, 1116, 1115, + 1115, 1117, 1118, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1119, 1115, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, + 1120, 1115, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1121, 1115, + 1115, 1115, 1115, 1116, 1115, 1116, 1115, 1115, 1115, 1117, + 1117, 1118, 1115, 1115, 1122, 1122, 1122, 1122, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1123, 1115, 1124, 1115, + 1125, 1126, 1115, 1127, 1119, 1119, 1119, 1115, 1115, 1115, + + 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1121, + 1115, 1115, 1121, 1121, 1128, 1115, 1116, 1115, 1117, 1122, + 1115, 1122, 1122, 1122, 1115, 1115, 1123, 1123, 1124, 1125, + 1125, 1126, 1126, 1115, 1129, 1130, 1115, 1115, 1120, 1120, + 1120, 1120, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1131, 1121, 1128, 1128, 1128, 1128, 1115, 1115, + 1118, 1122, 1122, 1122, 1115, 1123, 1115, 1125, 1129, 1130, + 1120, 1120, 1120, 1120, 1132, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, + 1128, 1128, 1128, 1128, 1115, 1115, 1122, 1122, 1122, 1120, + 1120, 1120, 1120, 1133, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1115, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1128, 1128, + 1128, 1134, 1135, 1115, 1115, 1122, 1122, 1122, 1120, 1120, + 1120, 1120, 1133, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1136, + 1137, 1128, 1128, 1128, 1134, 1135, 1115, 1115, 1122, 1122, + 1122, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 495, 1120, 1120, 1120, 495, 1120, 1120, 1115, 1120, 1120, + 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1115, 1131, 1131, 1131, 1136, 1137, 1128, + + 1128, 1128, 1115, 1115, 1122, 1122, 1115, 1115, 1122, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1115, 1120, 1120, 1120, 1115, + 1120, 1115, 1120, 1115, 1120, 1120, 1115, 1115, 1120, 1115, + 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, + 1131, 1131, 1138, 1128, 1128, 1115, 1115, 1122, 1122, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1115, + 1120, 1115, 1120, 1120, 1115, 1115, 1115, 1120, 1120, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1139, 1131, 1131, 1138, 1128, 1128, 1115, 1115, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1120, 1120, + 1115, 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1139, 1131, 1131, 1128, 1128, + 1115, 1115, 1120, 1120, 1120, 1120, 1115, 1115, 1115, 1120, + 1120, 1115, 1115, 1140, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, + 1128, 1128, 1115, 1120, 1120, 1120, 1120, 1115, 1115, 1115, + 1120, 1141, 1142, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1128, + 1128, 1115, 1120, 1120, 1120, 1115, 1115, 1115, 1115, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1128, 1128, + 1128, 1128, 1128, 1115, 1120, 1120, 1115, 1115, 1115, 1120, + + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1131, 1128, 1128, + 1128, 1128, 1128, 1115, 1120, 1120, 1115, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, + 1131, 1131, 1131, 1131, 1128, 1128, 1128, 1128, 1143, 1120, + 1115, 1115, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1144, 1128, + + 1128, 1128, 1128, 1143, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1131, 1131, 1131, 1131, 1144, 1128, + 1128, 1128, 1128, 1120, 1120, 1120, 1120, 1120, 1120, 1120, + 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1131, 1131, 1131, + 1131, 1128, 1128, 1128, 1128, 1120, 1120, 1120, 1120, 1120, + 1131, 1131, 1131, 1131, 1145, 1128, 1128, 1128, 1120, 1120, + 1120, 1120, 1120, 1146, 1131, 1131, 1131, 1145, 1128, 1147, + 1148, 1120, 1120, 1120, 1146, 1131, 1149, 1150, 1128, 1147, + 1148, 1120, 1120, 1120, 1131, 1149, 1150, 1128, 1120, 1120, + + 1120, 1131, 1151, 1120, 1120, 1152, 1151, 1120, 1120, 1152, + 1120, 1120, 1120, 1120, 0, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115 + } ; + +static yyconst flex_int16_t yy_nxt[2685] = + { 0, + 4, 5, 6, 7, 7, 5, 8, 9, 4, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, + 25, 4, 26, 27, 28, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 29, 27, + 27, 27, 27, 30, 31, 27, 27, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 27, 27, + 43, 27, 27, 44, 45, 46, 47, 48, 27, 49, + 50, 51, 52, 53, 27, 54, 27, 27, 55, 56, + 57, 62, 58, 56, 65, 62, 59, 68, 72, 72, + + 80, 72, 72, 108, 82, 88, 60, 73, 106, 89, + 105, 74, 99, 100, 81, 107, 69, 83, 84, 61, + 90, 102, 103, 109, 106, 111, 112, 85, 113, 75, + 86, 77, 87, 87, 87, 87, 87, 87, 87, 87, + 106, 106, 156, 171, 106, 66, 106, 106, 106, 285, + 91, 78, 92, 92, 92, 92, 92, 92, 92, 92, + 128, 133, 132, 172, 106, 65, 129, 106, 91, 93, + 95, 95, 95, 95, 95, 95, 95, 95, 116, 110, + 106, 106, 155, 106, 194, 117, 106, 97, 94, 106, + 118, 120, 106, 167, 126, 121, 119, 106, 122, 93, + + 130, 157, 123, 106, 127, 131, 106, 134, 106, 106, + 140, 135, 124, 141, 142, 62, 66, 97, 94, 62, + 106, 136, 125, 106, 137, 106, 138, 139, 143, 144, + 147, 88, 106, 148, 168, 165, 171, 150, 169, 145, + 146, 152, 151, 171, 66, 189, 90, 153, 173, 174, + 149, 191, 154, 158, 159, 65, 159, 158, 72, 72, + 160, 72, 72, 190, 106, 207, 106, 73, 193, 106, + 161, 74, 106, 87, 87, 87, 87, 87, 87, 87, + 87, 71, 106, 162, 195, 71, 203, 106, 106, 75, + 178, 77, 87, 87, 87, 87, 87, 87, 87, 87, + + 106, 106, 106, 106, 208, 106, 66, 204, 106, 181, + 91, 78, 92, 92, 92, 92, 92, 92, 92, 92, + 178, 205, 106, 206, 232, 221, 184, 184, 106, 183, + 185, 185, 185, 185, 185, 185, 185, 185, 91, 181, + 95, 95, 95, 95, 95, 95, 95, 95, 106, 212, + 259, 260, 106, 227, 106, 282, 332, 97, 1115, 183, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 184, 184, + 1115, 190, 185, 185, 185, 185, 185, 185, 185, 185, + 190, 192, 106, 106, 106, 106, 106, 97, 1106, 106, + 106, 106, 297, 106, 211, 106, 106, 209, 210, 213, + + 106, 217, 218, 222, 214, 106, 196, 219, 197, 198, + 223, 199, 106, 106, 200, 220, 215, 106, 106, 106, + 216, 106, 106, 106, 201, 202, 224, 106, 230, 233, + 236, 234, 106, 106, 231, 225, 235, 226, 229, 106, + 239, 238, 106, 240, 106, 243, 242, 106, 106, 237, + 106, 106, 256, 245, 106, 168, 247, 241, 244, 249, + 171, 171, 250, 246, 171, 251, 248, 158, 159, 252, + 159, 158, 272, 163, 160, 254, 263, 262, 106, 264, + 257, 106, 106, 258, 161, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 277, 271, 274, 283, 162, 106, 265, + + 265, 278, 71, 266, 266, 266, 266, 266, 266, 266, + 266, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 106, + 106, 273, 106, 106, 320, 281, 267, 267, 106, 164, + 268, 268, 268, 268, 268, 268, 268, 268, 1115, 106, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 184, 184, + 1115, 413, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, + 186, 186, 186, 186, 106, 106, 106, 106, 279, 186, + 186, 186, 186, 186, 186, 106, 280, 106, 288, 290, + + 106, 287, 106, 106, 296, 284, 106, 106, 295, 106, + 106, 106, 289, 291, 106, 300, 293, 106, 303, 186, + 186, 186, 186, 186, 186, 292, 294, 298, 106, 299, + 106, 301, 106, 302, 106, 106, 306, 106, 106, 190, + 106, 305, 307, 106, 106, 106, 106, 106, 106, 106, + 304, 106, 322, 315, 106, 106, 309, 314, 311, 319, + 106, 316, 318, 106, 106, 312, 313, 317, 106, 310, + 326, 321, 323, 327, 106, 106, 325, 106, 106, 106, + 333, 163, 351, 171, 324, 171, 106, 329, 348, 328, + 359, 330, 357, 171, 334, 331, 335, 336, 106, 337, + + 352, 338, 375, 362, 1103, 363, 339, 360, 106, 358, + 361, 340, 341, 342, 343, 344, 349, 1115, 1115, 350, + 1115, 1115, 106, 106, 106, 106, 73, 106, 369, 106, + 74, 106, 370, 106, 106, 106, 372, 164, 376, 391, + 397, 345, 266, 266, 266, 266, 266, 266, 266, 266, + 266, 266, 266, 266, 266, 266, 266, 266, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 268, 268, 268, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 368, 365, 106, 106, 190, 1115, 1115, 1115, 1115, 1115, + + 1115, 366, 106, 106, 106, 106, 190, 106, 106, 1102, + 371, 106, 367, 374, 106, 106, 386, 378, 106, 106, + 381, 373, 106, 379, 385, 1115, 1115, 1115, 1115, 1115, + 1115, 106, 106, 380, 384, 382, 377, 106, 383, 106, + 106, 106, 106, 392, 190, 106, 395, 106, 106, 398, + 387, 106, 106, 389, 390, 106, 399, 388, 106, 106, + 1098, 393, 106, 106, 396, 106, 404, 400, 407, 106, + 405, 401, 106, 106, 394, 402, 410, 106, 106, 403, + 411, 408, 414, 106, 106, 412, 106, 106, 106, 106, + 106, 417, 415, 418, 106, 422, 106, 416, 106, 106, + + 106, 424, 425, 421, 427, 106, 106, 106, 419, 420, + 106, 106, 190, 439, 423, 426, 431, 435, 440, 428, + 430, 171, 171, 171, 449, 432, 450, 451, 447, 452, + 429, 433, 455, 454, 106, 436, 456, 106, 106, 446, + 457, 106, 434, 448, 106, 106, 106, 106, 106, 459, + 460, 106, 463, 106, 106, 106, 106, 106, 464, 106, + 106, 106, 458, 461, 467, 462, 106, 106, 106, 106, + 472, 469, 465, 470, 106, 106, 466, 106, 471, 475, + 106, 474, 106, 476, 106, 106, 106, 106, 106, 473, + 106, 481, 477, 106, 106, 106, 483, 484, 106, 106, + + 478, 106, 479, 486, 190, 488, 480, 482, 492, 106, + 106, 487, 491, 106, 493, 485, 106, 495, 494, 106, + 497, 498, 106, 499, 106, 106, 501, 106, 106, 106, + 106, 106, 106, 496, 507, 106, 502, 106, 500, 106, + 106, 106, 106, 503, 106, 510, 106, 505, 512, 489, + 504, 513, 506, 106, 106, 508, 511, 509, 515, 517, + 514, 171, 171, 171, 518, 532, 533, 530, 534, 535, + 516, 536, 538, 539, 537, 106, 531, 106, 106, 106, + 106, 106, 106, 542, 540, 529, 106, 106, 545, 544, + 190, 541, 106, 546, 1095, 106, 106, 106, 106, 543, + + 106, 106, 106, 547, 106, 549, 106, 550, 106, 553, + 106, 552, 106, 106, 106, 106, 106, 551, 548, 558, + 558, 556, 558, 558, 106, 554, 106, 555, 106, 559, + 190, 560, 557, 106, 106, 106, 106, 106, 106, 106, + 570, 572, 106, 576, 106, 106, 589, 561, 571, 573, + 574, 575, 578, 569, 579, 106, 583, 106, 580, 577, + 106, 581, 106, 591, 106, 106, 171, 590, 611, 106, + 582, 106, 610, 606, 628, 562, 593, 106, 106, 106, + 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, + 567, 567, 567, 567, 567, 567, 567, 567, 567, 568, + + 568, 568, 568, 568, 568, 568, 568, 567, 567, 567, + 567, 567, 106, 594, 171, 584, 106, 607, 607, 613, + 607, 607, 615, 614, 1089, 585, 612, 586, 618, 106, + 608, 587, 616, 106, 588, 592, 605, 567, 567, 567, + 567, 106, 106, 171, 106, 106, 106, 106, 106, 619, + 106, 106, 617, 106, 620, 106, 621, 106, 622, 106, + 623, 632, 632, 609, 632, 632, 106, 773, 567, 558, + 558, 633, 558, 558, 106, 625, 626, 626, 626, 626, + 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, + 626, 626, 626, 626, 626, 627, 627, 627, 627, 627, + + 627, 627, 627, 626, 626, 626, 626, 626, 106, 106, + 106, 106, 106, 106, 190, 643, 644, 645, 106, 106, + 648, 106, 106, 646, 647, 106, 629, 635, 636, 106, + 650, 106, 702, 626, 626, 626, 626, 637, 637, 106, + 637, 637, 639, 649, 106, 106, 651, 106, 634, 106, + 653, 652, 106, 657, 106, 106, 658, 106, 106, 656, + 660, 669, 691, 638, 626, 630, 630, 630, 630, 630, + 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, + 630, 630, 630, 630, 631, 631, 631, 631, 631, 631, + 631, 631, 630, 630, 630, 630, 630, 106, 106, 106, + + 106, 106, 106, 171, 662, 106, 694, 663, 106, 681, + 106, 664, 171, 684, 654, 539, 665, 667, 655, 666, + 659, 661, 630, 630, 630, 630, 668, 679, 106, 106, + 607, 607, 678, 607, 607, 539, 106, 106, 106, 106, + 106, 106, 106, 608, 190, 106, 106, 106, 698, 106, + 541, 685, 541, 630, 686, 106, 106, 106, 683, 714, + 687, 689, 632, 632, 693, 632, 632, 637, 637, 106, + 637, 637, 688, 699, 106, 106, 106, 700, 701, 704, + 106, 106, 106, 707, 106, 705, 706, 708, 106, 106, + 106, 106, 703, 638, 711, 106, 715, 106, 709, 106, + + 717, 106, 106, 720, 716, 718, 190, 710, 712, 713, + 607, 607, 106, 607, 607, 731, 106, 719, 1088, 733, + 729, 106, 106, 608, 607, 607, 106, 607, 607, 730, + 106, 106, 732, 106, 106, 106, 171, 608, 541, 106, + 106, 690, 734, 106, 735, 541, 106, 106, 737, 737, + 171, 737, 737, 106, 740, 106, 609, 745, 739, 106, + 744, 106, 106, 106, 746, 747, 748, 751, 106, 106, + 609, 749, 106, 106, 106, 750, 106, 754, 106, 106, + 106, 752, 755, 760, 106, 757, 106, 753, 106, 106, + 106, 774, 106, 758, 756, 763, 106, 106, 106, 759, + + 762, 775, 106, 765, 785, 106, 761, 764, 106, 737, + 737, 776, 737, 737, 106, 786, 106, 106, 780, 790, + 787, 106, 781, 106, 106, 106, 789, 106, 106, 106, + 106, 794, 788, 106, 106, 798, 106, 814, 106, 791, + 806, 792, 793, 795, 799, 796, 800, 797, 106, 801, + 802, 106, 106, 106, 803, 361, 106, 804, 805, 815, + 106, 824, 106, 826, 106, 106, 106, 106, 808, 106, + 106, 106, 807, 106, 828, 830, 817, 106, 832, 106, + 106, 836, 837, 829, 827, 106, 834, 825, 778, 838, + 831, 106, 106, 106, 106, 833, 841, 846, 842, 853, + + 835, 843, 844, 106, 854, 190, 839, 858, 858, 106, + 858, 858, 840, 106, 845, 190, 106, 106, 863, 861, + 878, 847, 106, 879, 106, 864, 881, 106, 882, 106, + 855, 106, 870, 859, 862, 106, 871, 106, 872, 883, + 106, 190, 106, 860, 865, 866, 867, 106, 868, 106, + 873, 874, 875, 106, 876, 106, 880, 106, 106, 106, + 896, 106, 106, 1087, 885, 886, 106, 869, 106, 889, + 890, 106, 106, 877, 910, 884, 901, 106, 897, 897, + 106, 897, 897, 905, 106, 891, 106, 900, 858, 858, + 106, 858, 858, 106, 903, 906, 902, 106, 904, 907, + + 106, 908, 106, 909, 898, 106, 911, 106, 912, 913, + 914, 915, 106, 916, 859, 892, 106, 918, 106, 106, + 917, 919, 106, 106, 106, 106, 106, 106, 106, 936, + 106, 106, 921, 106, 923, 924, 925, 920, 106, 922, + 935, 190, 993, 897, 897, 106, 897, 897, 939, 106, + 938, 926, 106, 106, 940, 941, 942, 106, 106, 106, + 106, 943, 106, 944, 106, 945, 106, 106, 946, 898, + 106, 106, 106, 947, 949, 950, 948, 106, 951, 106, + 952, 927, 106, 953, 106, 954, 106, 106, 106, 955, + 106, 106, 970, 971, 971, 106, 971, 971, 106, 974, + + 106, 956, 957, 106, 975, 959, 106, 106, 958, 978, + 979, 106, 106, 983, 980, 973, 106, 106, 976, 972, + 106, 977, 106, 981, 106, 106, 106, 106, 986, 987, + 982, 106, 106, 991, 988, 989, 106, 106, 994, 1005, + 984, 106, 985, 992, 106, 990, 106, 1006, 971, 971, + 106, 971, 971, 106, 106, 106, 1008, 106, 1007, 1009, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 1022, 1010, 1011, 972, 1012, 1014, 1015, 1013, 1016, + 106, 1017, 106, 1018, 1021, 1019, 1020, 1034, 106, 1023, + 106, 1035, 106, 106, 106, 106, 106, 1086, 106, 106, + + 106, 106, 1024, 106, 1045, 106, 106, 1037, 1038, 1039, + 1040, 1041, 1036, 1042, 1043, 1044, 106, 1046, 106, 106, + 106, 1047, 106, 1059, 1056, 1060, 106, 1057, 106, 106, + 106, 1073, 106, 106, 1093, 1069, 106, 1058, 1083, 1084, + 106, 1082, 106, 1071, 106, 1070, 106, 106, 1100, 1072, + 106, 106, 1104, 106, 106, 1092, 1105, 106, 1108, 106, + 1099, 106, 1094, 106, 1111, 1101, 106, 106, 106, 106, + 1081, 1080, 1109, 1079, 1112, 1077, 1076, 1075, 1074, 1068, + 1067, 1113, 1114, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 70, 70, 70, 1066, 70, 70, 70, 70, + + 70, 76, 76, 1065, 1064, 1063, 1062, 76, 76, 96, + 96, 1061, 96, 96, 104, 106, 104, 104, 163, 163, + 106, 163, 163, 163, 163, 163, 163, 170, 170, 170, + 170, 177, 106, 177, 177, 179, 179, 106, 179, 179, + 179, 179, 179, 179, 180, 106, 180, 180, 182, 182, + 106, 182, 182, 186, 106, 186, 255, 255, 106, 255, + 255, 255, 255, 255, 255, 269, 106, 269, 269, 270, + 1055, 270, 270, 347, 347, 1054, 347, 347, 347, 347, + 347, 347, 364, 364, 453, 1053, 453, 453, 525, 525, + 1052, 525, 525, 525, 525, 525, 525, 526, 526, 1051, + + 526, 526, 526, 526, 526, 526, 598, 598, 1050, 598, + 598, 598, 598, 598, 598, 599, 599, 1049, 599, 599, + 599, 599, 599, 599, 724, 724, 1048, 724, 724, 724, + 724, 724, 724, 766, 766, 106, 766, 766, 766, 766, + 766, 766, 567, 567, 567, 567, 567, 567, 567, 626, + 626, 626, 626, 626, 626, 626, 630, 630, 630, 630, + 630, 630, 630, 1004, 1004, 106, 1004, 1004, 1004, 1004, + 1004, 1004, 1029, 1029, 106, 1029, 1029, 1029, 1029, 1029, + 1029, 1078, 1078, 106, 1078, 1078, 1078, 1078, 1078, 1078, + 1085, 1085, 106, 1085, 1085, 1085, 1085, 1085, 1085, 1090, + + 1090, 106, 1090, 1090, 1090, 1090, 1090, 1090, 1091, 1091, + 1033, 1091, 1091, 1091, 1091, 1091, 1091, 1096, 1096, 1032, + 1096, 1096, 1096, 1096, 1096, 1096, 1097, 1097, 1031, 1097, + 1097, 1097, 1097, 1097, 1097, 1107, 1107, 1030, 1107, 1107, + 1107, 1107, 1107, 1107, 1110, 1110, 1028, 1110, 1110, 1110, + 1110, 1110, 1110, 1027, 1026, 1025, 106, 106, 106, 1003, + 1002, 1001, 1000, 999, 998, 997, 996, 995, 106, 106, + 772, 969, 968, 967, 966, 965, 964, 963, 962, 961, + 960, 106, 106, 937, 934, 933, 932, 931, 930, 929, + 928, 106, 106, 106, 899, 895, 894, 893, 888, 887, + + 106, 106, 106, 106, 106, 106, 106, 857, 856, 106, + 852, 851, 850, 849, 848, 106, 106, 106, 823, 822, + 106, 821, 820, 819, 818, 816, 813, 812, 811, 810, + 809, 106, 784, 783, 782, 779, 777, 106, 106, 106, + 772, 771, 770, 769, 768, 767, 106, 743, 742, 741, + 738, 736, 106, 728, 727, 726, 725, 723, 722, 721, + 106, 106, 106, 106, 697, 696, 695, 106, 692, 106, + 106, 106, 106, 682, 680, 106, 106, 171, 677, 676, + 675, 674, 673, 672, 671, 670, 409, 106, 106, 106, + 642, 641, 640, 106, 106, 624, 106, 106, 106, 604, + + 603, 602, 601, 600, 597, 596, 595, 106, 106, 566, + 565, 564, 563, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 528, 527, 524, 523, 522, 521, 520, + 519, 106, 106, 106, 490, 106, 106, 106, 468, 106, + 106, 106, 445, 444, 443, 442, 441, 438, 437, 106, + 409, 406, 106, 106, 106, 106, 106, 356, 355, 354, + 353, 346, 308, 106, 106, 286, 276, 275, 261, 171, + 164, 166, 253, 164, 228, 112, 106, 188, 187, 176, + 175, 171, 166, 164, 115, 114, 106, 101, 98, 79, + 71, 67, 63, 1115, 3, 1115, 1115, 1115, 1115, 1115, + + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115 + } ; + +static yyconst flex_int16_t yy_chk[2685] = + { 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, + 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, 2, + 2, 5, 2, 2, 9, 5, 2, 11, 13, 13, + + 16, 13, 13, 29, 17, 19, 2, 13, 1114, 19, + 26, 13, 23, 23, 16, 28, 11, 17, 17, 2, + 19, 25, 25, 29, 26, 31, 33, 18, 33, 13, + 18, 13, 18, 18, 18, 18, 18, 18, 18, 18, + 45, 202, 55, 75, 28, 9, 31, 44, 42, 202, + 20, 13, 20, 20, 20, 20, 20, 20, 20, 20, + 42, 45, 44, 75, 37, 64, 42, 54, 21, 20, + 21, 21, 21, 21, 21, 21, 21, 21, 37, 30, + 41, 38, 54, 39, 110, 37, 43, 21, 20, 30, + 38, 39, 48, 66, 41, 39, 38, 40, 39, 20, + + 43, 55, 40, 110, 41, 43, 46, 46, 47, 49, + 48, 46, 40, 48, 49, 62, 64, 21, 20, 62, + 50, 46, 40, 52, 47, 51, 47, 47, 50, 50, + 51, 60, 53, 51, 70, 60, 78, 52, 71, 50, + 50, 53, 52, 77, 66, 105, 60, 53, 77, 78, + 51, 107, 53, 56, 56, 167, 56, 56, 72, 72, + 56, 72, 72, 106, 120, 120, 105, 72, 109, 107, + 56, 72, 1112, 87, 87, 87, 87, 87, 87, 87, + 87, 70, 116, 56, 111, 71, 116, 117, 106, 72, + 87, 72, 91, 91, 91, 91, 91, 91, 91, 91, + + 111, 118, 109, 121, 121, 131, 167, 117, 119, 91, + 92, 72, 92, 92, 92, 92, 92, 92, 92, 92, + 87, 118, 141, 119, 141, 131, 93, 93, 124, 92, + 93, 93, 93, 93, 93, 93, 93, 93, 95, 91, + 95, 95, 95, 95, 95, 95, 95, 95, 137, 124, + 166, 166, 249, 137, 199, 199, 249, 95, 96, 92, + 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, + 97, 108, 97, 97, 97, 97, 97, 97, 97, 97, + 115, 108, 123, 126, 122, 125, 128, 95, 1102, 132, + 133, 213, 213, 129, 123, 130, 108, 122, 122, 125, + + 127, 128, 129, 132, 126, 115, 115, 130, 115, 115, + 133, 115, 135, 134, 115, 130, 127, 136, 139, 140, + 127, 143, 142, 144, 115, 115, 134, 148, 140, 142, + 144, 142, 145, 147, 140, 135, 143, 136, 139, 146, + 146, 145, 149, 146, 150, 148, 147, 151, 152, 144, + 153, 155, 165, 150, 154, 169, 151, 146, 149, 153, + 173, 174, 153, 150, 172, 154, 152, 158, 158, 155, + 158, 158, 190, 164, 158, 164, 173, 172, 190, 174, + 165, 196, 200, 165, 158, 177, 177, 177, 177, 177, + 177, 177, 177, 195, 189, 192, 200, 158, 238, 178, + + 178, 196, 169, 178, 178, 178, 178, 178, 178, 178, + 178, 180, 180, 180, 180, 180, 180, 180, 180, 189, + 198, 191, 195, 192, 238, 198, 181, 181, 326, 164, + 181, 181, 181, 181, 181, 181, 181, 181, 182, 191, + 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, + 183, 326, 183, 183, 183, 183, 183, 183, 183, 183, + 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, + 185, 185, 185, 185, 185, 185, 186, 186, 186, 186, + 186, 186, 186, 186, 197, 201, 204, 206, 197, 186, + 186, 186, 186, 186, 186, 207, 197, 205, 205, 206, + + 209, 204, 212, 211, 212, 201, 208, 210, 211, 219, + 216, 1101, 205, 207, 214, 216, 209, 215, 219, 186, + 186, 186, 186, 186, 186, 208, 210, 214, 218, 215, + 217, 217, 221, 218, 222, 223, 223, 224, 227, 228, + 229, 222, 224, 230, 233, 232, 231, 234, 236, 235, + 221, 239, 240, 233, 237, 243, 227, 232, 229, 237, + 242, 234, 236, 241, 228, 230, 231, 235, 244, 228, + 243, 239, 241, 244, 245, 248, 242, 247, 246, 250, + 250, 254, 256, 262, 241, 264, 240, 246, 253, 245, + 264, 247, 262, 263, 251, 248, 251, 251, 284, 251, + + 256, 251, 284, 273, 1098, 274, 251, 271, 278, 263, + 272, 251, 251, 251, 251, 251, 253, 261, 261, 253, + 261, 261, 251, 271, 272, 274, 261, 279, 278, 285, + 261, 273, 279, 281, 304, 311, 281, 254, 285, 304, + 311, 251, 265, 265, 265, 265, 265, 265, 265, 265, + 266, 266, 266, 266, 266, 266, 266, 266, 267, 267, + 267, 267, 267, 267, 267, 267, 268, 268, 268, 268, + 268, 268, 268, 268, 269, 269, 269, 269, 269, 269, + 269, 269, 270, 270, 270, 270, 270, 270, 270, 270, + 277, 276, 280, 283, 276, 270, 270, 270, 270, 270, + + 270, 276, 282, 288, 277, 289, 286, 299, 293, 1095, + 280, 297, 276, 283, 292, 294, 299, 288, 295, 276, + 293, 282, 296, 289, 297, 270, 270, 270, 270, 270, + 270, 286, 300, 292, 296, 294, 286, 301, 295, 302, + 303, 306, 307, 306, 308, 309, 309, 310, 312, 312, + 300, 313, 315, 302, 303, 316, 313, 301, 314, 317, + 1089, 307, 323, 320, 310, 318, 318, 314, 320, 308, + 318, 315, 321, 325, 308, 316, 323, 324, 327, 317, + 324, 321, 327, 328, 329, 325, 330, 331, 334, 333, + 336, 329, 327, 330, 335, 335, 337, 328, 338, 340, + + 339, 337, 338, 334, 340, 341, 342, 343, 331, 333, + 344, 345, 346, 351, 336, 339, 343, 348, 351, 340, + 342, 357, 358, 359, 360, 344, 361, 362, 358, 363, + 341, 345, 366, 365, 360, 348, 367, 346, 365, 357, + 368, 361, 346, 359, 369, 373, 370, 371, 367, 370, + 371, 372, 374, 376, 363, 375, 362, 366, 375, 377, + 378, 368, 369, 372, 378, 373, 383, 386, 384, 385, + 386, 383, 376, 384, 390, 387, 377, 389, 385, 390, + 392, 389, 391, 391, 393, 394, 395, 398, 374, 387, + 397, 397, 392, 399, 400, 401, 399, 400, 402, 404, + + 393, 405, 394, 402, 406, 405, 395, 398, 409, 408, + 410, 404, 408, 411, 409, 401, 414, 410, 409, 412, + 412, 414, 415, 415, 417, 419, 419, 420, 421, 406, + 422, 423, 424, 411, 425, 426, 420, 427, 417, 430, + 429, 428, 432, 421, 425, 428, 431, 423, 430, 406, + 422, 431, 424, 434, 433, 426, 429, 427, 433, 435, + 432, 446, 447, 448, 435, 449, 450, 447, 451, 452, + 434, 454, 456, 457, 455, 458, 448, 449, 450, 459, + 461, 454, 460, 460, 458, 446, 462, 457, 463, 462, + 468, 459, 464, 464, 1086, 451, 452, 455, 472, 461, + + 465, 456, 471, 465, 476, 471, 477, 472, 478, 478, + 480, 477, 483, 486, 481, 468, 482, 476, 468, 484, + 484, 482, 484, 484, 485, 480, 463, 481, 487, 485, + 490, 486, 483, 497, 498, 499, 500, 501, 502, 503, + 498, 500, 504, 504, 505, 507, 510, 487, 499, 501, + 502, 503, 506, 497, 506, 490, 508, 510, 506, 505, + 512, 506, 511, 512, 514, 508, 530, 511, 533, 506, + 507, 553, 532, 530, 553, 490, 514, 532, 533, 484, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 513, 515, 529, 509, 542, 531, 531, 535, + 531, 531, 537, 536, 1079, 509, 534, 509, 542, 535, + 531, 509, 538, 543, 509, 513, 529, 495, 495, 495, + 495, 495, 509, 531, 546, 534, 538, 515, 536, 543, + 540, 537, 540, 544, 544, 550, 546, 547, 547, 548, + 548, 556, 556, 531, 556, 556, 557, 729, 495, 558, + 558, 557, 558, 558, 729, 550, 551, 551, 551, 551, + 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, + 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, + + 551, 551, 551, 551, 551, 551, 551, 551, 554, 559, + 569, 571, 560, 572, 563, 569, 571, 572, 574, 575, + 576, 556, 651, 574, 575, 577, 554, 559, 560, 578, + 578, 580, 651, 551, 551, 551, 551, 561, 561, 563, + 561, 561, 563, 577, 579, 581, 579, 584, 558, 576, + 581, 580, 585, 585, 586, 588, 586, 593, 633, 584, + 588, 593, 633, 561, 551, 555, 555, 555, 555, 555, + 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, + 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, + 555, 555, 555, 555, 555, 555, 555, 561, 582, 583, + + 587, 589, 591, 605, 590, 639, 639, 590, 619, 615, + 592, 590, 606, 619, 582, 610, 590, 591, 583, 590, + 587, 589, 555, 555, 555, 555, 592, 606, 590, 610, + 607, 607, 605, 607, 607, 612, 615, 617, 618, 620, + 621, 623, 622, 607, 624, 663, 636, 647, 647, 612, + 618, 620, 621, 555, 622, 648, 628, 649, 617, 663, + 623, 628, 632, 632, 636, 632, 632, 637, 637, 624, + 637, 637, 624, 648, 652, 650, 653, 649, 650, 653, + 654, 655, 656, 656, 657, 654, 655, 657, 658, 659, + 661, 660, 652, 637, 660, 664, 664, 662, 658, 665, + + 666, 667, 668, 669, 665, 667, 680, 659, 661, 662, + 678, 678, 683, 678, 678, 682, 684, 668, 1077, 684, + 680, 666, 687, 678, 679, 679, 685, 679, 679, 681, + 669, 680, 683, 686, 681, 694, 678, 679, 685, 699, + 682, 632, 687, 688, 688, 686, 698, 701, 691, 691, + 679, 691, 691, 693, 694, 704, 678, 699, 693, 700, + 698, 702, 703, 706, 700, 701, 702, 706, 707, 708, + 679, 703, 709, 710, 711, 704, 712, 709, 713, 714, + 715, 707, 710, 715, 716, 712, 717, 708, 720, 719, + 718, 731, 735, 713, 711, 718, 732, 731, 739, 714, + + 717, 732, 740, 720, 744, 749, 716, 719, 691, 737, + 737, 735, 737, 737, 745, 745, 746, 747, 739, 749, + 746, 744, 740, 748, 750, 752, 748, 753, 754, 755, + 756, 754, 747, 757, 758, 758, 760, 773, 762, 750, + 763, 752, 753, 755, 759, 756, 759, 757, 761, 759, + 759, 763, 764, 765, 760, 774, 776, 761, 762, 774, + 785, 785, 786, 787, 789, 791, 773, 790, 765, 774, + 794, 795, 764, 787, 790, 792, 776, 796, 795, 797, + 798, 799, 800, 791, 789, 759, 797, 786, 737, 801, + 794, 803, 792, 804, 806, 796, 805, 807, 805, 814, + + 798, 805, 805, 808, 815, 816, 803, 820, 820, 826, + 820, 820, 804, 814, 806, 821, 824, 799, 827, 824, + 835, 808, 800, 835, 807, 828, 841, 801, 842, 815, + 816, 830, 830, 820, 826, 827, 831, 805, 832, 843, + 821, 855, 828, 821, 829, 829, 829, 840, 829, 846, + 833, 833, 833, 831, 833, 832, 840, 845, 861, 835, + 854, 847, 841, 1076, 846, 847, 855, 829, 842, 850, + 850, 870, 854, 833, 870, 845, 861, 843, 856, 856, + 862, 856, 856, 865, 829, 850, 860, 860, 858, 858, + 833, 858, 858, 863, 863, 866, 862, 864, 864, 867, + + 865, 868, 869, 869, 856, 871, 871, 872, 872, 873, + 874, 875, 866, 876, 858, 850, 867, 878, 868, 877, + 877, 879, 880, 884, 885, 886, 873, 874, 875, 896, + 876, 900, 884, 901, 886, 887, 887, 880, 958, 885, + 895, 895, 958, 897, 897, 896, 897, 897, 901, 902, + 900, 887, 903, 904, 902, 903, 904, 878, 910, 879, + 905, 905, 906, 906, 907, 907, 895, 908, 908, 897, + 909, 911, 912, 909, 911, 912, 910, 913, 913, 914, + 914, 887, 915, 915, 916, 916, 917, 920, 921, 917, + 922, 923, 935, 937, 937, 938, 937, 937, 948, 940, + + 941, 920, 921, 942, 940, 923, 943, 944, 922, 943, + 944, 945, 947, 948, 945, 938, 940, 935, 941, 937, + 946, 942, 949, 946, 950, 951, 952, 955, 951, 952, + 947, 953, 954, 956, 953, 954, 957, 959, 959, 970, + 949, 976, 950, 957, 977, 955, 974, 974, 971, 971, + 956, 971, 971, 975, 978, 979, 976, 980, 975, 977, + 981, 982, 984, 986, 985, 987, 970, 988, 989, 990, + 991, 991, 978, 979, 971, 980, 982, 984, 981, 985, + 993, 986, 994, 987, 990, 988, 989, 1005, 1006, 993, + 1007, 1006, 1010, 1011, 1012, 1013, 1017, 1075, 1018, 1019, + + 1020, 1022, 994, 1023, 1022, 1005, 1035, 1010, 1011, 1012, + 1013, 1017, 1007, 1018, 1019, 1020, 1024, 1023, 1036, 1045, + 1056, 1024, 1046, 1046, 1035, 1047, 1057, 1036, 1058, 1059, + 1060, 1060, 1070, 1072, 1083, 1056, 1073, 1045, 1072, 1073, + 1082, 1070, 1047, 1058, 1084, 1057, 1092, 1093, 1093, 1059, + 1094, 1083, 1099, 1100, 1105, 1082, 1100, 1104, 1104, 1109, + 1092, 1108, 1084, 1111, 1108, 1094, 1071, 1113, 1069, 1099, + 1068, 1067, 1105, 1066, 1109, 1064, 1063, 1062, 1061, 1055, + 1054, 1111, 1113, 1116, 1116, 1116, 1116, 1116, 1116, 1116, + 1116, 1116, 1117, 1117, 1117, 1053, 1117, 1117, 1117, 1117, + + 1117, 1118, 1118, 1052, 1051, 1050, 1049, 1118, 1118, 1119, + 1119, 1048, 1119, 1119, 1120, 1044, 1120, 1120, 1121, 1121, + 1043, 1121, 1121, 1121, 1121, 1121, 1121, 1122, 1122, 1122, + 1122, 1123, 1042, 1123, 1123, 1124, 1124, 1041, 1124, 1124, + 1124, 1124, 1124, 1124, 1125, 1040, 1125, 1125, 1126, 1126, + 1039, 1126, 1126, 1127, 1038, 1127, 1128, 1128, 1037, 1128, + 1128, 1128, 1128, 1128, 1128, 1129, 1034, 1129, 1129, 1130, + 1033, 1130, 1130, 1131, 1131, 1032, 1131, 1131, 1131, 1131, + 1131, 1131, 1132, 1132, 1133, 1031, 1133, 1133, 1134, 1134, + 1030, 1134, 1134, 1134, 1134, 1134, 1134, 1135, 1135, 1028, + + 1135, 1135, 1135, 1135, 1135, 1135, 1136, 1136, 1027, 1136, + 1136, 1136, 1136, 1136, 1136, 1137, 1137, 1026, 1137, 1137, + 1137, 1137, 1137, 1137, 1138, 1138, 1025, 1138, 1138, 1138, + 1138, 1138, 1138, 1139, 1139, 1021, 1139, 1139, 1139, 1139, + 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1141, + 1141, 1141, 1141, 1141, 1141, 1141, 1142, 1142, 1142, 1142, + 1142, 1142, 1142, 1143, 1143, 1016, 1143, 1143, 1143, 1143, + 1143, 1143, 1144, 1144, 1015, 1144, 1144, 1144, 1144, 1144, + 1144, 1145, 1145, 1014, 1145, 1145, 1145, 1145, 1145, 1145, + 1146, 1146, 1009, 1146, 1146, 1146, 1146, 1146, 1146, 1147, + + 1147, 1008, 1147, 1147, 1147, 1147, 1147, 1147, 1148, 1148, + 1003, 1148, 1148, 1148, 1148, 1148, 1148, 1149, 1149, 1002, + 1149, 1149, 1149, 1149, 1149, 1149, 1150, 1150, 1001, 1150, + 1150, 1150, 1150, 1150, 1150, 1151, 1151, 1000, 1151, 1151, + 1151, 1151, 1151, 1151, 1152, 1152, 998, 1152, 1152, 1152, + 1152, 1152, 1152, 997, 996, 995, 992, 983, 973, 968, + 967, 966, 965, 964, 963, 962, 961, 960, 939, 936, + 934, 933, 932, 931, 930, 929, 928, 927, 926, 925, + 924, 919, 918, 899, 894, 893, 892, 891, 890, 889, + 888, 883, 882, 881, 857, 853, 852, 851, 849, 848, + + 844, 839, 838, 837, 836, 834, 825, 819, 818, 817, + 813, 812, 811, 810, 809, 802, 793, 788, 783, 782, + 781, 780, 779, 778, 777, 775, 771, 770, 769, 768, + 767, 751, 743, 742, 741, 738, 736, 734, 733, 730, + 728, 727, 726, 725, 723, 722, 705, 697, 696, 695, + 692, 690, 689, 677, 676, 675, 674, 672, 671, 670, + 646, 645, 644, 643, 642, 641, 640, 635, 634, 631, + 629, 627, 625, 616, 614, 613, 611, 609, 604, 603, + 602, 601, 600, 597, 596, 595, 594, 573, 570, 568, + 566, 565, 564, 562, 552, 549, 545, 541, 539, 528, + + 527, 524, 523, 522, 519, 518, 517, 516, 496, 494, + 493, 492, 491, 489, 488, 479, 475, 474, 473, 470, + 469, 467, 466, 445, 444, 441, 440, 439, 438, 437, + 436, 418, 416, 413, 407, 403, 396, 388, 382, 381, + 380, 379, 356, 355, 354, 353, 352, 350, 349, 332, + 322, 319, 305, 298, 291, 290, 287, 260, 259, 258, + 257, 252, 226, 225, 220, 203, 194, 193, 171, 170, + 163, 162, 161, 160, 138, 113, 104, 103, 99, 86, + 84, 76, 61, 59, 36, 35, 27, 24, 22, 15, + 12, 10, 8, 3, 1115, 1115, 1115, 1115, 1115, 1115, + + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, + 1115, 1115, 1115, 1115 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[174] = + { 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, + 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* 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 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "vtkParse.l" +#line 3 "vtkParse.l" + +/* + +This file must be translated to C and modified to build everywhere. + +Run flex like this: + + flex --nodefault -olex.yy.c vtkParse.l + +Modify lex.yy.c: + - convert tabs to spaces (8 spaces per tab) + - remove extra space from end of lines + - remove blank lines from end of file + - replace "int yyl" with "yy_size_t yyl" + - compile with gcc and "-Wsign-compare", there should be no warnings + +*/ + +/* We do not care of interactive mode */ +#define YY_NEVER_INTERACTIVE 1 + +/* Do not include unistd.h in generated source. */ +#define YY_NO_UNISTD_H + +/* Skip declaring this function. It is a macro. */ +#define YY_SKIP_YYWRAP + +#ifdef _WIN32 +#pragma warning ( disable : 4018 ) +#pragma warning ( disable : 4127 ) +#pragma warning ( disable : 4131 ) +#pragma warning ( disable : 4244 ) +#pragma warning ( disable : 4251 ) +#pragma warning ( disable : 4267 ) +#pragma warning ( disable : 4305 ) +#pragma warning ( disable : 4309 ) +#pragma warning ( disable : 4706 ) +#pragma warning ( disable : 4786 ) +#endif + +#define SKIP_MATCH_MAXLEN 15 + +/* + * Skip ahead until one of the strings is found, + * then skip to the end of the line. + * Return 0 if no match found. + */ +static int skip_comment(); +static int skip_trailing_comment(const char *text, size_t l); +static int skip_ahead_multi(const char *strings[]); +static int skip_ahead_until(const char *text); +static int skip_to_next_directive(); +static int skip_conditional_block(); + +static void preprocessor_directive(const char *text, size_t l); +static void print_preprocessor_error(int result, const char *cp, size_t n); +static const char *get_macro_arguments(); + +static void push_buffer(); +static int pop_buffer(); + +static void push_include(const char *filename); +static void pop_include(); + +static void push_macro(MacroInfo *macro); +static void pop_macro(); +static int in_macro(); + +#line 1515 "lex.yy.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +yy_size_t yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#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 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_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t 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 \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#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 + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* 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 \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 77 "vtkParse.l" + + +#line 1703 "lex.yy.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#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 ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + 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_current_state += YY_AT_BOL(); +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 >= 1116 ) + 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] != 2595 ); + +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; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + yy_size_t yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; +; + } + +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 79 "vtkParse.l" +{ skip_comment(); } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 81 "vtkParse.l" +{ + if (!IgnoreBTX) { + skip_ahead_until("//ETX"); + } + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 87 "vtkParse.l" +/* eat mismatched ETX */ + YY_BREAK +case 4: +YY_RULE_SETUP +#line 89 "vtkParse.l" +{ + skip_ahead_until("@end"); + } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 93 "vtkParse.l" +{ + size_t pos = 1; + while (yytext[pos-1] != 'M' || yytext[pos] != 'E') + { + pos++; + } + data->NameComment = vtkstrndup(&yytext[pos + 1], yyleng - pos - 1); + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 102 "vtkParse.l" +{ setCommentState(1); } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 103 "vtkParse.l" +{ setCommentState(2); } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 104 "vtkParse.l" +{ setCommentState(3); } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 105 "vtkParse.l" +{ setCommentState(3); } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 106 "vtkParse.l" +{ setCommentState(4); } + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 107 "vtkParse.l" +{ closeOrClearComment(); } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 108 "vtkParse.l" +{ + size_t pos = 2; + while (yytext[pos-2] != '/' || yytext[pos-1] != '/') pos++; + addCommentLine(&yytext[pos], yyleng - pos); + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 114 "vtkParse.l" +/* eat C++ comments */ + YY_BREAK +case 14: +/* rule 14 can match eol */ +YY_RULE_SETUP +#line 116 "vtkParse.l" +{ + skip_trailing_comment(yytext, yyleng); + preprocessor_directive(yytext, yyleng); + } + YY_BREAK +case 15: +/* rule 15 can match eol */ +YY_RULE_SETUP +#line 121 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(STRING_LITERAL); + } + YY_BREAK +case 16: +/* rule 16 can match eol */ +YY_RULE_SETUP +#line 126 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(CHAR_LITERAL); + } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 131 "vtkParse.l" +/* ignore EXPORT macros */ + YY_BREAK +case 18: +YY_RULE_SETUP +#line 133 "vtkParse.l" +{ /* let the wrappers see the parameter */ + const char *args = NULL; + const char *cp; + size_t l = 0; + args = get_macro_arguments(); + if (args) + { + cp = args; + if (*cp == '(') { cp++; } + while (*cp == ' ' || *cp == '\t') { cp++; } + l = vtkidlen(cp); + if (l) + { + yylval.str = vtkstrndup(cp, l); + free((char *)args); + return(ID); + } + free((char *)args); + } + } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 154 "vtkParse.l" +return(DOUBLE); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 155 "vtkParse.l" +return(FLOAT); + YY_BREAK +case 21: +YY_RULE_SETUP +#line 156 "vtkParse.l" +return(INT64__); + YY_BREAK +case 22: +YY_RULE_SETUP +#line 157 "vtkParse.l" +return(SHORT); + YY_BREAK +case 23: +YY_RULE_SETUP +#line 158 "vtkParse.l" +return(LONG); + YY_BREAK +case 24: +YY_RULE_SETUP +#line 159 "vtkParse.l" +return(CHAR); + YY_BREAK +case 25: +YY_RULE_SETUP +#line 160 "vtkParse.l" +return(INT); + YY_BREAK +case 26: +YY_RULE_SETUP +#line 162 "vtkParse.l" +return(UNSIGNED); + YY_BREAK +case 27: +YY_RULE_SETUP +#line 163 "vtkParse.l" +return(SIGNED); + YY_BREAK +case 28: +YY_RULE_SETUP +#line 165 "vtkParse.l" +return(VOID); + YY_BREAK +case 29: +YY_RULE_SETUP +#line 166 "vtkParse.l" +return(BOOL); + YY_BREAK +case 30: +YY_RULE_SETUP +#line 168 "vtkParse.l" +return(SIZE_T); + YY_BREAK +case 31: +YY_RULE_SETUP +#line 169 "vtkParse.l" +return(SSIZE_T); + YY_BREAK +case 32: +YY_RULE_SETUP +#line 171 "vtkParse.l" +/* ignore the Q_OBJECT macro from Qt */ + YY_BREAK +case 33: +/* rule 33 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 172 "vtkParse.l" +return(PUBLIC); + YY_BREAK +case 34: +/* rule 34 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 173 "vtkParse.l" +return(PRIVATE); + YY_BREAK +case 35: +/* rule 35 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 174 "vtkParse.l" +return(PROTECTED); + YY_BREAK +case 36: +/* rule 36 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 175 "vtkParse.l" +return(PROTECTED); + YY_BREAK +case 37: +YY_RULE_SETUP +#line 177 "vtkParse.l" +return(CLASS); + YY_BREAK +case 38: +YY_RULE_SETUP +#line 178 "vtkParse.l" +return(STRUCT); + YY_BREAK +case 39: +YY_RULE_SETUP +#line 179 "vtkParse.l" +return(PUBLIC); + YY_BREAK +case 40: +YY_RULE_SETUP +#line 180 "vtkParse.l" +return(PRIVATE); + YY_BREAK +case 41: +YY_RULE_SETUP +#line 181 "vtkParse.l" +return(PROTECTED); + YY_BREAK +case 42: +YY_RULE_SETUP +#line 182 "vtkParse.l" +return(ENUM); + YY_BREAK +case 43: +YY_RULE_SETUP +#line 183 "vtkParse.l" +return(UNION); + YY_BREAK +case 44: +YY_RULE_SETUP +#line 184 "vtkParse.l" +return(VIRTUAL); + YY_BREAK +case 45: +YY_RULE_SETUP +#line 185 "vtkParse.l" +return(CONST); + YY_BREAK +case 46: +YY_RULE_SETUP +#line 186 "vtkParse.l" +return(VOLATILE); + YY_BREAK +case 47: +YY_RULE_SETUP +#line 187 "vtkParse.l" +return(MUTABLE); + YY_BREAK +case 48: +YY_RULE_SETUP +#line 188 "vtkParse.l" +return(OPERATOR); + YY_BREAK +case 49: +YY_RULE_SETUP +#line 189 "vtkParse.l" +return(FRIEND); + YY_BREAK +case 50: +YY_RULE_SETUP +#line 190 "vtkParse.l" +return(INLINE); + YY_BREAK +case 51: +YY_RULE_SETUP +#line 191 "vtkParse.l" +return(STATIC); + YY_BREAK +case 52: +YY_RULE_SETUP +#line 192 "vtkParse.l" +return(EXTERN); + YY_BREAK +case 53: +YY_RULE_SETUP +#line 193 "vtkParse.l" +return(TEMPLATE); + YY_BREAK +case 54: +YY_RULE_SETUP +#line 194 "vtkParse.l" +return(TYPENAME); + YY_BREAK +case 55: +YY_RULE_SETUP +#line 195 "vtkParse.l" +return(TYPEDEF); + YY_BREAK +case 56: +YY_RULE_SETUP +#line 196 "vtkParse.l" +return(NAMESPACE); + YY_BREAK +case 57: +YY_RULE_SETUP +#line 197 "vtkParse.l" +return(USING); + YY_BREAK +case 58: +YY_RULE_SETUP +#line 198 "vtkParse.l" +return(NEW); + YY_BREAK +case 59: +YY_RULE_SETUP +#line 199 "vtkParse.l" +return(DELETE); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 200 "vtkParse.l" +return(EXPLICIT); + YY_BREAK +case 61: +YY_RULE_SETUP +#line 201 "vtkParse.l" +return(THROW); + YY_BREAK +case 62: +YY_RULE_SETUP +#line 203 "vtkParse.l" +return(STATIC_CAST); + YY_BREAK +case 63: +YY_RULE_SETUP +#line 204 "vtkParse.l" +return(DYNAMIC_CAST); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 205 "vtkParse.l" +return(CONST_CAST); + YY_BREAK +case 65: +YY_RULE_SETUP +#line 206 "vtkParse.l" +return(REINTERPRET_CAST); + YY_BREAK +case 66: +YY_RULE_SETUP +#line 208 "vtkParse.l" +/* irrelevant to wrappers */ + YY_BREAK +case 67: +YY_RULE_SETUP +#line 209 "vtkParse.l" +/* irrelevant to wrappers */ + YY_BREAK +case 68: +YY_RULE_SETUP +#line 211 "vtkParse.l" +return(OP_LOGIC_AND); + YY_BREAK +case 69: +YY_RULE_SETUP +#line 212 "vtkParse.l" +return(OP_AND_EQ); + YY_BREAK +case 70: +YY_RULE_SETUP +#line 213 "vtkParse.l" +return(OP_LOGIC_OR); + YY_BREAK +case 71: +YY_RULE_SETUP +#line 214 "vtkParse.l" +return(OP_OR_EQ); + YY_BREAK +case 72: +YY_RULE_SETUP +#line 215 "vtkParse.l" +return('!'); + YY_BREAK +case 73: +YY_RULE_SETUP +#line 216 "vtkParse.l" +return(OP_LOGIC_NEQ); + YY_BREAK +case 74: +YY_RULE_SETUP +#line 217 "vtkParse.l" +return('^'); + YY_BREAK +case 75: +YY_RULE_SETUP +#line 218 "vtkParse.l" +return(OP_XOR_EQ); + YY_BREAK +case 76: +YY_RULE_SETUP +#line 219 "vtkParse.l" +return('&'); + YY_BREAK +case 77: +YY_RULE_SETUP +#line 220 "vtkParse.l" +return('|'); + YY_BREAK +case 78: +YY_RULE_SETUP +#line 221 "vtkParse.l" +return('~'); + YY_BREAK +case 79: +YY_RULE_SETUP +#line 223 "vtkParse.l" +return(IdType); + YY_BREAK +case 80: +YY_RULE_SETUP +#line 224 "vtkParse.l" +return(SetMacro); + YY_BREAK +case 81: +YY_RULE_SETUP +#line 225 "vtkParse.l" +return(GetMacro); + YY_BREAK +case 82: +YY_RULE_SETUP +#line 226 "vtkParse.l" +return(SetStringMacro); + YY_BREAK +case 83: +YY_RULE_SETUP +#line 227 "vtkParse.l" +return(GetStringMacro); + YY_BREAK +case 84: +YY_RULE_SETUP +#line 228 "vtkParse.l" +return(SetClampMacro); + YY_BREAK +case 85: +YY_RULE_SETUP +#line 229 "vtkParse.l" +return(SetObjectMacro); + YY_BREAK +case 86: +YY_RULE_SETUP +#line 230 "vtkParse.l" +return(GetObjectMacro); + YY_BREAK +case 87: +YY_RULE_SETUP +#line 231 "vtkParse.l" +return(BooleanMacro); + YY_BREAK +case 88: +YY_RULE_SETUP +#line 232 "vtkParse.l" +return(SetVector2Macro); + YY_BREAK +case 89: +YY_RULE_SETUP +#line 233 "vtkParse.l" +return(SetVector3Macro); + YY_BREAK +case 90: +YY_RULE_SETUP +#line 234 "vtkParse.l" +return(SetVector4Macro); + YY_BREAK +case 91: +YY_RULE_SETUP +#line 235 "vtkParse.l" +return(SetVector6Macro); + YY_BREAK +case 92: +YY_RULE_SETUP +#line 236 "vtkParse.l" +return(GetVector2Macro); + YY_BREAK +case 93: +YY_RULE_SETUP +#line 237 "vtkParse.l" +return(GetVector3Macro); + YY_BREAK +case 94: +YY_RULE_SETUP +#line 238 "vtkParse.l" +return(GetVector4Macro); + YY_BREAK +case 95: +YY_RULE_SETUP +#line 239 "vtkParse.l" +return(GetVector6Macro); + YY_BREAK +case 96: +YY_RULE_SETUP +#line 240 "vtkParse.l" +return(SetVectorMacro); + YY_BREAK +case 97: +YY_RULE_SETUP +#line 241 "vtkParse.l" +return(GetVectorMacro); + YY_BREAK +case 98: +YY_RULE_SETUP +#line 242 "vtkParse.l" +return(ViewportCoordinateMacro); + YY_BREAK +case 99: +YY_RULE_SETUP +#line 243 "vtkParse.l" +return(WorldCoordinateMacro); + YY_BREAK +case 100: +YY_RULE_SETUP +#line 244 "vtkParse.l" +return(TypeMacro); + YY_BREAK +case 101: +YY_RULE_SETUP +#line 245 "vtkParse.l" +return(TypeMacro); + YY_BREAK +case 102: +YY_RULE_SETUP +#line 246 "vtkParse.l" +return(TypeMacro); + YY_BREAK +case 103: +YY_RULE_SETUP +#line 247 "vtkParse.l" +return(TypeMacro); + YY_BREAK +case 104: +YY_RULE_SETUP +#line 248 "vtkParse.l" +; + YY_BREAK +case 105: +YY_RULE_SETUP +#line 249 "vtkParse.l" +return(VTK_BYTE_SWAP_DECL); + YY_BREAK +case 106: +YY_RULE_SETUP +#line 250 "vtkParse.l" +return(TypeInt8); + YY_BREAK +case 107: +YY_RULE_SETUP +#line 251 "vtkParse.l" +return(TypeUInt8); + YY_BREAK +case 108: +YY_RULE_SETUP +#line 252 "vtkParse.l" +return(TypeInt16); + YY_BREAK +case 109: +YY_RULE_SETUP +#line 253 "vtkParse.l" +return(TypeUInt16); + YY_BREAK +case 110: +YY_RULE_SETUP +#line 254 "vtkParse.l" +return(TypeInt32); + YY_BREAK +case 111: +YY_RULE_SETUP +#line 255 "vtkParse.l" +return(TypeUInt32); + YY_BREAK +case 112: +YY_RULE_SETUP +#line 256 "vtkParse.l" +return(TypeInt64); + YY_BREAK +case 113: +YY_RULE_SETUP +#line 257 "vtkParse.l" +return(TypeUInt64); + YY_BREAK +case 114: +YY_RULE_SETUP +#line 258 "vtkParse.l" +return(TypeFloat32); + YY_BREAK +case 115: +YY_RULE_SETUP +#line 259 "vtkParse.l" +return(TypeFloat64); + YY_BREAK +case 116: +/* rule 116 can match eol */ +YY_RULE_SETUP +#line 261 "vtkParse.l" +{ + size_t i = 1; + size_t j; + while (yytext[i]==' ' || yytext[i]=='\t' || + yytext[i]=='\r' || yytext[i]=='\n') { i++; } + j = i; + while (yytext[j]!='&') { j++; } + yylval.str = vtkstrndup(&yytext[i], j-i); + return(LA); + } + YY_BREAK +case 117: +/* rule 117 can match eol */ +YY_RULE_SETUP +#line 272 "vtkParse.l" +{ + size_t i = 1; + size_t j; + while (yytext[i]==' ' || yytext[i]=='\t' || + yytext[i]=='\r' || yytext[i]=='\n') { i++; } + j = i; + while (yytext[j]!='*') { j++; } + yylval.str = vtkstrndup(&yytext[i], j-i); + return(LP); + } + YY_BREAK +case 118: +/* rule 118 can match eol */ +YY_RULE_SETUP +#line 283 "vtkParse.l" +{ + yylval.str = ""; + return(LP); + } + YY_BREAK +case 119: +/* rule 119 can match eol */ +YY_RULE_SETUP +#line 288 "vtkParse.l" +{ + yylval.str = ""; + return(LP); + } + YY_BREAK +case 120: +YY_RULE_SETUP +#line 293 "vtkParse.l" +return('*'); + YY_BREAK +case 121: +YY_RULE_SETUP +#line 295 "vtkParse.l" +/* misc unused win32 macros */ + YY_BREAK +case 122: +/* rule 122 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 297 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(OSTREAM); + } + YY_BREAK +case 123: +/* rule 123 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 302 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(ISTREAM); + } + YY_BREAK +case 124: +/* rule 124 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 307 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(StdString); + } + YY_BREAK +case 125: +YY_RULE_SETUP +#line 312 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(StdString); + } + YY_BREAK +case 126: +YY_RULE_SETUP +#line 317 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(UnicodeString); + } + YY_BREAK +case 127: +YY_RULE_SETUP +#line 322 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(VTK_ID); + } + YY_BREAK +case 128: +YY_RULE_SETUP +#line 327 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(QT_ID); + } + YY_BREAK +case 129: +YY_RULE_SETUP +#line 332 "vtkParse.l" +get_macro_arguments(); /* gcc attributes */ + YY_BREAK +case 130: +YY_RULE_SETUP +#line 334 "vtkParse.l" +get_macro_arguments(); /* Windows linkage */ + YY_BREAK +case 131: +YY_RULE_SETUP +#line 336 "vtkParse.l" +/* Windows */ + YY_BREAK +case 132: +YY_RULE_SETUP +#line 338 "vtkParse.l" +{ + const char *args = get_macro_arguments(); + if (args && args[0] != '\0' && args[1] != '\0') + { + size_t l = strlen(args); + push_macro(NULL); + push_buffer(); + macroName = "VTK_LEGACY"; + macroUsed = 0; + macroEnded = 0; + yy_switch_to_buffer(yy_scan_bytes(&args[1],l-2)); + } + free((char *)args); + } + YY_BREAK +case 133: +YY_RULE_SETUP +#line 353 "vtkParse.l" +{ + const char *name = vtkstrndup(yytext, yyleng); + MacroInfo *macro = vtkParsePreprocess_GetMacro(preprocessor, name); + int expanded = 0; + if (macro) + { + const char *args = NULL; + const char *emacro = NULL; + + /* make sure that vtkNotUsed is never expanded */ + MacroInfo *ex; + ex = vtkParsePreprocess_GetMacro(preprocessor, "vtkNotUsed"); + if (ex) + { + ex->IsExcluded = 1; + } + + if (macro->IsFunction) + { + args = get_macro_arguments(); + if (args) + { + emacro = vtkParsePreprocess_ExpandMacro(preprocessor, macro, args); + if (!emacro) + { + print_preprocessor_error(VTK_PARSE_MACRO_NUMARGS, NULL, 0); + } + free((char *)args); + } + } + else if (macro->Definition && macro->Definition[0]) + { + /* first see if macro evaluates to a constant value */ + preproc_int_t val; + int is_unsigned; + int r; + macro->IsExcluded = 1; + r = vtkParsePreprocess_EvaluateExpression( + preprocessor, macro->Definition, &val, &is_unsigned); + macro->IsExcluded = 0; + /* if it isn't a constant expression, then expand it */ + if (r >= VTK_PARSE_MACRO_UNDEFINED) + { + emacro = vtkParsePreprocess_ExpandMacro(preprocessor, macro, NULL); + if (!emacro) + { + print_preprocessor_error(r, NULL, 0); + } + } + } + else + { + /* macros with no definition expand to nothing */ + expanded = 1; + } + if (emacro) + { + /* invoke the parser on any expanded macros */ + push_macro(macro); + push_buffer(); + yy_switch_to_buffer(yy_scan_string(emacro)); + vtkParsePreprocess_FreeMacroExpansion(preprocessor, macro, emacro); + expanded = 1; + } + } + if (!expanded) + { + /* if no macro expansion occurred, return the ID */ + yylval.str = name; + if (yyleng > 3 && name[0] == 'v' && name[1] == 't' && name[2] == 'k') + { + return(VTK_ID); + } + else if (name[0] == 'Q') + { + return(QT_ID); + } + else + { + return(ID); + } + } + } + YY_BREAK +case 134: +YY_RULE_SETUP +#line 437 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(FLOAT_LITERAL); + } + YY_BREAK +case 135: +YY_RULE_SETUP +#line 442 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(FLOAT_LITERAL); + } + YY_BREAK +case 136: +YY_RULE_SETUP +#line 447 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(FLOAT_LITERAL); + } + YY_BREAK +case 137: +YY_RULE_SETUP +#line 452 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(HEX_LITERAL); + } + YY_BREAK +case 138: +YY_RULE_SETUP +#line 457 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(OCT_LITERAL); + } + YY_BREAK +case 139: +YY_RULE_SETUP +#line 462 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(INT_LITERAL); + } + YY_BREAK +case 140: +YY_RULE_SETUP +#line 467 "vtkParse.l" +{ + yylval.str = vtkstrndup(yytext, yyleng); + return(ZERO); + } + YY_BREAK +case 141: +/* rule 141 can match eol */ +YY_RULE_SETUP +#line 472 "vtkParse.l" +/* escaped newlines */ + YY_BREAK +case 142: +YY_RULE_SETUP +#line 473 "vtkParse.l" +/* whitespace */ + YY_BREAK +case 143: +/* rule 143 can match eol */ +YY_RULE_SETUP +#line 474 "vtkParse.l" +/* whitespace */ + YY_BREAK +case 144: +YY_RULE_SETUP +#line 476 "vtkParse.l" +return(OP_LSHIFT_EQ); + YY_BREAK +case 145: +YY_RULE_SETUP +#line 477 "vtkParse.l" +return(OP_RSHIFT_EQ); + YY_BREAK +case 146: +YY_RULE_SETUP +#line 478 "vtkParse.l" +return(OP_LSHIFT); + YY_BREAK +case 147: +YY_RULE_SETUP +#line 479 "vtkParse.l" +return(OP_DOT_POINTER); + YY_BREAK +case 148: +YY_RULE_SETUP +#line 480 "vtkParse.l" +return(OP_ARROW_POINTER); + YY_BREAK +case 149: +YY_RULE_SETUP +#line 481 "vtkParse.l" +return(OP_ARROW); + YY_BREAK +case 150: +YY_RULE_SETUP +#line 482 "vtkParse.l" +return(OP_RSHIFT); + YY_BREAK +case 151: +YY_RULE_SETUP +#line 483 "vtkParse.l" +return(OP_INCR); + YY_BREAK +case 152: +YY_RULE_SETUP +#line 484 "vtkParse.l" +return(OP_DECR); + YY_BREAK +case 153: +YY_RULE_SETUP +#line 485 "vtkParse.l" +return(OP_PLUS_EQ); + YY_BREAK +case 154: +YY_RULE_SETUP +#line 486 "vtkParse.l" +return(OP_MINUS_EQ); + YY_BREAK +case 155: +YY_RULE_SETUP +#line 487 "vtkParse.l" +return(OP_TIMES_EQ); + YY_BREAK +case 156: +YY_RULE_SETUP +#line 488 "vtkParse.l" +return(OP_DIVIDE_EQ); + YY_BREAK +case 157: +YY_RULE_SETUP +#line 489 "vtkParse.l" +return(OP_REMAINDER_EQ); + YY_BREAK +case 158: +YY_RULE_SETUP +#line 490 "vtkParse.l" +return(OP_AND_EQ); + YY_BREAK +case 159: +YY_RULE_SETUP +#line 491 "vtkParse.l" +return(OP_OR_EQ); + YY_BREAK +case 160: +YY_RULE_SETUP +#line 492 "vtkParse.l" +return(OP_XOR_EQ); + YY_BREAK +case 161: +YY_RULE_SETUP +#line 493 "vtkParse.l" +return(OP_LOGIC_AND); + YY_BREAK +case 162: +YY_RULE_SETUP +#line 494 "vtkParse.l" +return(OP_LOGIC_OR); + YY_BREAK +case 163: +YY_RULE_SETUP +#line 495 "vtkParse.l" +return(OP_LOGIC_EQ); + YY_BREAK +case 164: +YY_RULE_SETUP +#line 496 "vtkParse.l" +return(OP_LOGIC_NEQ); + YY_BREAK +case 165: +YY_RULE_SETUP +#line 497 "vtkParse.l" +return(OP_LOGIC_LEQ); + YY_BREAK +case 166: +YY_RULE_SETUP +#line 498 "vtkParse.l" +return(OP_LOGIC_GEQ); + YY_BREAK +case 167: +YY_RULE_SETUP +#line 499 "vtkParse.l" +return(ELLIPSIS); + YY_BREAK +case 168: +YY_RULE_SETUP +#line 500 "vtkParse.l" +return(DOUBLE_COLON); + YY_BREAK +case 169: +YY_RULE_SETUP +#line 502 "vtkParse.l" +return('['); + YY_BREAK +case 170: +YY_RULE_SETUP +#line 503 "vtkParse.l" +return(']'); + YY_BREAK +case 171: +YY_RULE_SETUP +#line 505 "vtkParse.l" +return(yytext[0]); + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 507 "vtkParse.l" +{ if (!pop_buffer()) { yyterminate(); } } + YY_BREAK +case 172: +YY_RULE_SETUP +#line 509 "vtkParse.l" +{ return(OTHER); } + YY_BREAK +case 173: +YY_RULE_SETUP +#line 511 "vtkParse.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 2910 "lex.yy.c" + + 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); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->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_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->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_LVALUE->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_LVALUE->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 (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->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_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->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 single character, 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_LVALUE->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_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* 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 ) + { + yy_size_t 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. */ + yyrealloc((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_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + 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_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->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 (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + 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 >= 1116 ) + 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 ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + 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 >= 1116 ) + 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 == 1115); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#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_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + 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) + offset; + break; + } + } + } + + 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); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + + yylineno++; +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + 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_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = 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; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(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 *) yyalloc(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; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + 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( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + 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) yyalloc(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; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_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; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (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. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +yy_size_t yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* 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 ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 511 "vtkParse.l" + + + +/* + * Return a parenthetical macro arg list as a new string. + */ +const char *get_macro_arguments() +{ + char *cp = NULL; + size_t i = 0; + int depth; + int ws = 0; + int sl = 0; + int c1 = input(); + + if (c1 == '\0') + { + if (pop_buffer() == 0) + { + return NULL; + } + } + + while (c1 == ' ' || c1 == '\t' || c1 == '\r' || c1 == '\n') + { + c1 = input(); + } + + cp = (char *)malloc(4); + + if (c1 != '(') + { + unput(c1); + return NULL; + } + + cp[i++] = '('; + depth = 1; + c1 = input(); + + for (;;) + { + ws = 0; + sl = 0; + /* skip all whitespace */ + while (c1 == ' ' || c1 == '\t' || c1 == '\r' || c1 == '\n') + { + ws = 1; + c1 = input(); + } + if (c1 == '/') + { + c1 = input(); + if (c1 == '*') + { + /* skip a C style comment */ + ws = 1; + if (skip_comment() == 0) + { + return NULL; + } + c1 = input(); + } + else if (c1 == '/') + { + /* skip a C++ style comment */ + ws = 1; + do { c1 = input(); } + while (c1 != '\n' && c1 != '\0'); + if (c1 == '\0') + { + return NULL; + } + c1 = input(); + } + else + { + sl = 1; + } + } + if (ws) + { + /* add a single space to replace any whitespace */ + cp[i++] = ' '; + if (i >= 4 && (i & (i-1)) == 0) + { + cp = (char *)realloc(cp, 2*i); + } + } + if (sl) + { + /* add a single space to replace any whitespace */ + cp[i++] = '/'; + if (i >= 4 && (i & (i-1)) == 0) + { + cp = (char *)realloc(cp, 2*i); + } + } + if (c1 == '\"' || c1 == '\'') + { + int c2 = c1; + int escaped = 2; + int firstloop = 1; + do + { + if (escaped) + { + --escaped; + } + if (!firstloop) + { + c1 = input(); + } + firstloop = 0; + if (c1 == '\0') + { + break; + } + if (escaped == 0 && c1 == '\\') + { + escaped = 2; + } + cp[i++] = (char)c1; + if (i >= 4 && (i & (i-1)) == 0) + { + cp = (char *)realloc(cp, 2*i); + } + } + while (c1 != c2 || escaped); + } + else if (c1 != '\0') + { + cp[i++] = (char)c1; + if (i >= 4 && (i & (i-1)) == 0) + { + cp = (char *)realloc(cp, 2*i); + } + cp[i] = '\0'; + if (c1 == '(') + { + depth++; + } + if (c1 == ')') + { + if (--depth == 0) + { + break; + } + } + } + else + { + return NULL; + } + c1 = input(); + } + + return cp; +} + +/* + * Skip a C-style comment, return 0 if unterminated. + */ +int skip_comment() +{ + int c1 = 0, c2 = input(); + for (;;) + { + if (c2 == 0) + { + print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, + "Cannot find end of comment.", 27); + return 0; + } + if (c1 == '*' && c2 == '/') break; + c1 = c2; c2 = input(); + } + return 1; +} + +/* + * If token contains a comment, make sure whole comment is skipped. + */ +int skip_trailing_comment(const char *text, size_t l) +{ + const char *cp = text; + const char *ep = text + l; + int incomment = 0; + + while (cp < ep) + { + while (cp < ep && *cp != '/' && *cp != '\"') { cp++; }; + if (cp >= ep) + { + break; + } + else if (cp[0] == '/' && cp[1] == '*') + { + incomment = 1; + cp += 2; + while (cp < ep && *cp != '*') { cp++; }; + if (cp[0] == '*' && cp[1] == '/') + { + incomment = 0; + cp += 2; + } + else + { + cp++; + } + } + else if (cp[0] == '\"') + { + cp++; + while (cp < ep) + { + while (cp < ep && *cp != '\\' && *cp != '\"') { cp++; }; + if (cp >= ep) + { + break; + } + else if (*cp == '\"') + { + cp++; + break; + } + else /* if (*cp == '\\') */ + { + cp += 2; + } + } + } + else + { + cp++; + } + } + + if (incomment) + { + return skip_comment(); + } + + return 1; +} + +/* + * Skip ahead until the next preprocessor directive. + * This will eat the '#' that starts the directive. + * Return 0 if none found. + */ +int skip_to_next_directive() +{ + /* state == 0 at the start of a line */ + int state = 0; + int c; + + c = input(); + + while (c != 0) + { + /* whitespace */ + if (c == ' ' || c == '\t') + { + c = input(); + } + /* newline renews the start-of-line state */ + else if (c == '\n') + { + state = 0; + c = input(); + } + /* skip comments */ + else if (c == '/') + { + state = 1; + if ( (c = input()) == '*') + { + if (skip_comment() == 0) + { + return 0; + } + c = input(); + } + } + /* skip escaped characters */ + else if (c == '\\') + { + state = 1; + if ( (c = input()) == '\r') + { + if ( (c = input()) == '\n') + { + c = input(); + } + } + else if (c != 0) + { + c = input(); + } + } + /* any other chars except '#' at start of line */ + else if (c != '#' || state != 0) + { + state = 1; + c = input(); + } + else + { + break; + } + } + + return c; +} + +/* + * Skip to the next #else or #elif or #endif + */ +int skip_conditional_block() +{ + static char *linebuf = NULL; + static size_t linemaxlen = 80; + size_t i; + int c; + int result; + + if (linebuf == 0) + { + linebuf = (char *)malloc(linemaxlen); + } + + for (;;) + { + if (skip_to_next_directive() == 0) + { + return 0; + } + c = input(); + while (c == ' ' || c == '\t') + { + c = input(); + } + if (c == 0) + { + return 0; + } + + /* eat the whole line */ + i = 0; + linebuf[i++] = '#'; + while (c != 0 && c != '\n') + { + if (i >= linemaxlen-5) + { + linemaxlen += i+5; + linebuf = (char *)realloc(linebuf, linemaxlen); + } + linebuf[i++] = c; + /* be sure to skip escaped newlines */ + if (c == '\\') + { + c = input(); + linebuf[i++] = c; + if (c == '\r') + { + c = input(); + linebuf[i++] = c; + } + } + c = input(); + } + linebuf[i++] = c; + + result = vtkParsePreprocess_HandleDirective(preprocessor, linebuf); + if (result != VTK_PARSE_SKIP && result != VTK_PARSE_OK) + { + print_preprocessor_error(result, linebuf, i); + } + else if (result != VTK_PARSE_SKIP) + { + break; + } + } + + return 1; +} + +/* + * Skip ahead until one of the strings is found, + * then skip to the end of the line. + */ +int skip_ahead_multi(const char *strings[]) +{ + char textbuf[SKIP_MATCH_MAXLEN+1]; + char c = 0; + size_t i; + + for (i = 0; i < (SKIP_MATCH_MAXLEN+1); i++) + { + textbuf[i] = '\0'; + } + + for (;;) + { + for (i = 0; i < SKIP_MATCH_MAXLEN; i++) + { + textbuf[i] = textbuf[i+1]; + } + + if ((c = (char)input()) == '\0') + { + print_preprocessor_error(VTK_PARSE_SYNTAX_ERROR, NULL, 0); + return 0; + } + + textbuf[SKIP_MATCH_MAXLEN-1] = c; + + for (i = 0; strings[i]; i++) + { + if (strcmp(&textbuf[SKIP_MATCH_MAXLEN-strlen(strings[i])], + strings[i]) == 0) + { + break; + } + } + if (strings[i]) + { + break; + } + } + + while (c != '\0' && c != '\n') + { + c = (char)input(); + } + + return 1; +} + +/* + * Skip ahead until the string is found. + */ +int skip_ahead_until(const char *text) +{ + const char *strings[2]; + strings[0] = text; + strings[1] = NULL; + + return skip_ahead_multi(strings); +} + +/* + * buffer stack, used for macro expansion and include files + */ +static size_t buffer_stack_size = 0; +static YY_BUFFER_STATE *buffer_stack = NULL; + +/* + * push the current buffer onto the buffer stack. + */ +void push_buffer() +{ + size_t n = buffer_stack_size; + if (buffer_stack == NULL) + { + buffer_stack = (YY_BUFFER_STATE *)malloc(4*sizeof(YY_BUFFER_STATE)); + } + /* grow the stack whenever size reaches a power of two */ + else if (n >= 4 && (n & (n-1)) == 0) + { + buffer_stack = (YY_BUFFER_STATE *)realloc( + buffer_stack, 2*n*sizeof(YY_BUFFER_STATE)); + } + buffer_stack[buffer_stack_size++] = YY_CURRENT_BUFFER; +} + +/* + * pop the buffer stack and restore the previous buffer + */ +int pop_buffer() +{ + if (in_macro()) + { + pop_macro(); + } + else + { + pop_include(); + } + if (buffer_stack_size == 0) + { + return 0; + } + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(buffer_stack[--buffer_stack_size]); + return 1; +} + +/* + * include stack, to tell what include is being evaluated + */ +static size_t include_stack_size = 0; +static FileInfo **include_stack = NULL; +static int *lineno_stack = NULL; + +/* + * push the current include onto the include stack. + */ +void push_include(const char *filename) +{ + FileInfo *file_info = NULL; + int same_file = 0; + size_t n = include_stack_size; + + if (include_stack == NULL) + { + include_stack = (FileInfo **)malloc(4*sizeof(FileInfo *)); + lineno_stack = (int *)malloc(4*sizeof(int)); + } + + /* grow the stack whenever size reaches a power of two */ + else if (n >= 4 && (n & (n-1)) == 0) + { + include_stack = (FileInfo **)realloc( + include_stack, 2*n*sizeof(FileInfo *)); + lineno_stack = (int *)realloc( + lineno_stack, 2*n*sizeof(int)); + } + + lineno_stack[include_stack_size] = yyget_lineno(); + yyset_lineno(0); + include_stack[include_stack_size++] = data; + + /* if the file is including itself */ + if (filename == data->FileName || + (filename != 0 && data->FileName != 0 && + strcmp(filename, data->FileName) == 0)) + { + same_file = 1; + } + + /* make a new fileinfo, but only if we are in the base namespace + * and only if the only items added so far are constants */ + if (!same_file && currentNamespace == data->Contents && + data->Contents->NumberOfItems == data->Contents->NumberOfConstants) + { + file_info = (FileInfo *)malloc(sizeof(FileInfo)); + vtkParse_InitFile(file_info); + file_info->FileName = vtkstrdup(filename); + file_info->Contents = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); + vtkParse_InitNamespace(file_info->Contents); + vtkParse_AddIncludeToFile(data, file_info); + file_info->Strings = data->Strings; + data = file_info; + currentNamespace = file_info->Contents; + } +} + +/* + * pop the include stack + */ +void pop_include() +{ + if (include_stack_size > 0) + { + --include_stack_size; + fclose(yyin); + yyset_lineno(lineno_stack[include_stack_size]); + if (data != include_stack[include_stack_size]) + { + data = include_stack[include_stack_size]; + currentNamespace = data->Contents; + } + } +} + + +/* + * macro stack, to tell what macro is being evaluated + */ +static size_t macro_stack_size = 0; +static MacroInfo **macro_stack = NULL; + +/* + * push the current macro onto the macro stack. + */ +void push_macro(MacroInfo *macro) +{ + size_t n = macro_stack_size; + if (macro_stack == NULL) + { + macro_stack = (MacroInfo **)malloc(4*sizeof(MacroInfo *)); + } + /* grow the stack whenever size reaches a power of two */ + else if (n >= 4 && (n & (n-1)) == 0) + { + macro_stack = (MacroInfo **)realloc( + macro_stack, 2*n*sizeof(MacroInfo *)); + } + macro_stack[macro_stack_size++] = macro; + if (macro) + { + macro->IsExcluded = 1; + if (macro_stack_size == 1) + { + macroName = macro->Name; + macroUsed = 0; + macroEnded = 0; + } + } +} + +/* + * pop the macro stack + */ +void pop_macro() +{ + MacroInfo *macro; + + if (macro_stack_size > 0) + { + macro = macro_stack[--macro_stack_size]; + if (macro) + { + macro->IsExcluded = 0; + } + } + macroEnded = 1; +} + +/* + * are we currently processing a macro? + */ +int in_macro() +{ + return (macro_stack_size > 0); +} + +/* + * print a preprocessor error code with filename and line number. + */ +void print_preprocessor_error(int result, const char *cp, size_t n) +{ + const char *text = ""; + + switch (result) + { + case VTK_PARSE_OK: + case VTK_PARSE_SKIP: + return; + case VTK_PARSE_PREPROC_DOUBLE: + text = "double in preprocessor conditional"; + break; + case VTK_PARSE_PREPROC_FLOAT: + text = "float in preprocessor conditional"; + break; + case VTK_PARSE_PREPROC_STRING: + text = "string in preprocessor conditional"; + break; + case VTK_PARSE_MACRO_UNDEFINED: + text = "undefined macro"; + break; + case VTK_PARSE_MACRO_REDEFINED: + text = "redefined macro"; + break; + case VTK_PARSE_FILE_NOT_FOUND: + text = "file not found"; + break; + case VTK_PARSE_FILE_OPEN_ERROR: + text = "can\'t open file"; + break; + case VTK_PARSE_FILE_READ_ERROR: + text = "input/output error"; + break; + case VTK_PARSE_MACRO_NUMARGS: + text = "wrong number of macro args"; + break; + case VTK_PARSE_SYNTAX_ERROR: + text = "syntax error"; + break; + } + + /* be silent about missing include files */ + if (result == VTK_PARSE_FILE_NOT_FOUND) + { + return; + } + + print_parser_error(text, cp, n); +} + +/* + * print an error with filename and line number. + */ +void print_parser_error(const char *text, const char *cp, size_t n) +{ + size_t j = 0; + const char *fn = "(none)"; + + if (data->FileName) + { + fn = data->FileName; + } + fprintf(yyout, "In %s:", fn); + for (j = 0; j < include_stack_size; j++) + { + fprintf(yyout, "%i:\nIn %s:", + lineno_stack[j], include_stack[j]->FileName); + } + fprintf(yyout, "%i:\n", yylineno); + + if (cp) + { + fprintf(yyout, "%s: %*.*s\n", text, (int)n, (int)n, cp); + } + else if (text) + { + fprintf(yyout, "%s.\n", text); + } +} + +/* + * Execute a preprocessor directive. + */ +void preprocessor_directive(const char *text, size_t l) +{ + int result = 0; + size_t n = 0; + const char *cp = text; + const char *ep = text + l; + const char *directive = NULL; + + /* find the directive, store its length in "n" */ + while (*cp == ' ' || *cp == '\t') { cp++; } + if (*cp == '#') { cp++; } + while ((*cp == ' ' || *cp == '\t') && cp < ep) { cp++; } + directive = cp; + while (*cp >= 'a' && *cp <= 'z' && cp < ep) { cp++; } + n = cp - directive; + while ((*cp == ' ' || *cp == '\t') && cp < ep) { cp++; } + + if (n == 7 && strncmp(directive, "include", n) == 0) + { + /* include files */ + int already_loaded = 0; + if (*cp == '<' || *cp == '\"') + { + /* if asked to recurse into header files */ + if (Recursive && ep - cp > 3) + { + const char *dp; + dp = vtkParsePreprocess_FindIncludeFile(preprocessor, + &cp[1], (*cp != '\"'), &already_loaded); + if (dp) + { + yyin = fopen(dp, "r"); + if (yyin) + { + push_include(dp); + push_buffer(); + yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); + return; + } + } + } + } + } + + /* let the preprocessor handle the directive */ + result = vtkParsePreprocess_HandleDirective(preprocessor, text); + + if (result == VTK_PARSE_SKIP) + { + skip_conditional_block(); + } + else if (result != VTK_PARSE_OK) + { + print_preprocessor_error(result, text, l); + } + else if (n == 6 && strncmp(directive, "define", n) == 0 && + ep - cp > 4 && strncmp(cp, "VTK", 3) == 0) + { + /* macros that start with "VTK" */ + MacroInfo *macro; + + macro = vtkParsePreprocess_GetMacro(preprocessor, cp); + if (macro && macro->Definition && !macro->IsFunction) + { + /* if macro evaluates to a constant, add it as a constant */ + macro->IsExcluded = 1; + if (guess_constant_type(macro->Definition) == 0) + { + result = VTK_PARSE_MACRO_UNDEFINED; + } + macro->IsExcluded = 0; + if (result < VTK_PARSE_MACRO_UNDEFINED) + { + add_constant( + vtkstrdup(macro->Name), vtkstrdup(macro->Definition), 0, NULL, 1); + } + } + } +} diff --git a/src/VTKWrapping/ParaView/vtkParse.tab.c b/src/VTKWrapping/ParaView/vtkParse.tab.c new file mode 100644 index 00000000..59894246 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParse.tab.c @@ -0,0 +1,9505 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 3 of the License, 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, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 15 "vtkParse.y" + + +/* + +This file must be translated to C and modified to build everywhere. + +Run yacc like this: + + yacc -b vtkParse vtkParse.y + +Modify vtkParse.tab.c: + - convert TABs to spaces (eight per tab) + - remove spaces from ends of lines, s/ *$//g + - remove the "goto yyerrlab1;" that appears right before yyerrlab1: + - remove the #defined constants that appear right after the anonymous_enums + +*/ + +/* +The purpose of this parser is to read C++ header files in order to +generate data structures that describe the C++ interface of a library, +one header file at a time. As such, it is not a complete C++ parser. +It only parses what is relevant to the interface and skips the rest. + +While the parser reads method definitions, type definitions, and +template definitions it generates a "signature" which is a string +that matches (apart from whitespace) the text that was parsed. + +While parsing types, the parser creates an unsigned int that describes +the type as well as creating other data structures for arrays, function +pointers, etc. The parser also creates a typeId string, which is either +a simple id that gives the class name or type name, or is "function" for +function pointer types, or "method" for method pointer types. +*/ + +/* +Conformance Notes: + +This parser was designed empirically and incrementally. It has been +refactored to make it more similar to the ANSI C++ 1996 BNF grammar, +but there are still many very significant differences. + +The most significant difference between this parser and a "standard" +parser is that it only parses declarations in detail. All other +statements and expressions are parsed as arbitrary sequences of symbols, +without any syntactic analysis. + +The "unqualified_id" does not directly include "operator_function_id" or +"conversion_function_id" (e.g. ids like "operator=" or "operator int*"). +Instead, these two id types are used to allow operator functions to be +handled by their own rules, rather than by the generic function rules. +These ids can only be used in function declarations and using declarations. + +Types are handled quite differently from the ANSI BNF. These differences +represent a prolonged (and ultimately successful) attempt to empirically +create a yacc parser without any shift/reduce conflicts. The rules for +types are organized according to the way that types are usually defined +in working code, rather than strictly according to C++ grammar. + +The declaration specifiers "friend" and "typedef" can only appear at the +beginning of a declaration sequence. There are also restrictions on +where class and enum specifiers can be used: you can declare a new struct +within a variable declaration, but not within a parameter declaration. + +The lexer returns each of "(scope::*", "(*", "(a::b::*", etc. as single +tokens. The ANSI BNF, in contrast, would consider these to be a "(" +followed by a "ptr_operator". The lexer concatenates these tokens in +order to eliminate shift/reduce conflicts in the parser. However, this +means that this parser will only recognize "scope::*" as valid if it is +preceded by "(", e.g. as part of a member function pointer specification. + +An odd bit of C++ ambiguity is that y(x); can be interpreted variously +as declaration of variable "x" of type "y", as a function call if "y" +is the name of a function, or as a constructor if "y" is the name of +a class. This parser always interprets this pattern as a constructor +declaration, because function calls are ignored by the parser, and +variable declarations of the form y(x); are exceedingly rare compared +to the more usual form y x; without parentheses. +*/ + +#include +#include +#include +#define yyerror(a) fprintf(stderr,"%s\n",a) +#define yywrap() 1 + +/* Make sure yacc-generated code knows we have included stdlib.h. */ +#ifndef _STDLIB_H +# define _STDLIB_H +#endif +#define YYINCLUDED_STDLIB_H + +/* Borland and MSVC do not define __STDC__ properly. */ +#if !defined(__STDC__) +# if (defined(_MSC_VER) && _MSC_VER >= 1200) || defined(__BORLANDC__) +# define __STDC__ 1 +# endif +#endif + +/* Disable warnings in generated code. */ +#if defined(_MSC_VER) +# pragma warning (disable: 4127) /* conditional expression is constant */ +# pragma warning (disable: 4244) /* conversion to smaller integer type */ +#endif +#if defined(__BORLANDC__) +# pragma warn -8004 /* assigned a value that is never used */ +# pragma warn -8008 /* conditional is always true */ +# pragma warn -8066 /* unreachable code */ +#endif + +/* Map from the type anonymous_enumeration in vtkType.h to the + VTK wrapping type system number for the type. */ + +#include "vtkParse.h" +#include "vtkParsePreprocess.h" +#include "vtkParseData.h" +#include "vtkType.h" + +static unsigned int vtkParseTypeMap[] = + { + VTK_PARSE_VOID, /* VTK_VOID 0 */ + 0, /* VTK_BIT 1 */ + VTK_PARSE_CHAR, /* VTK_CHAR 2 */ + VTK_PARSE_UNSIGNED_CHAR, /* VTK_UNSIGNED_CHAR 3 */ + VTK_PARSE_SHORT, /* VTK_SHORT 4 */ + VTK_PARSE_UNSIGNED_SHORT, /* VTK_UNSIGNED_SHORT 5 */ + VTK_PARSE_INT, /* VTK_INT 6 */ + VTK_PARSE_UNSIGNED_INT, /* VTK_UNSIGNED_INT 7 */ + VTK_PARSE_LONG, /* VTK_LONG 8 */ + VTK_PARSE_UNSIGNED_LONG, /* VTK_UNSIGNED_LONG 9 */ + VTK_PARSE_FLOAT, /* VTK_FLOAT 10 */ + VTK_PARSE_DOUBLE, /* VTK_DOUBLE 11 */ + VTK_PARSE_ID_TYPE, /* VTK_ID_TYPE 12 */ + VTK_PARSE_STRING, /* VTK_STRING 13 */ + 0, /* VTK_OPAQUE 14 */ + VTK_PARSE_SIGNED_CHAR, /* VTK_SIGNED_CHAR 15 */ + VTK_PARSE_LONG_LONG, /* VTK_LONG_LONG 16 */ + VTK_PARSE_UNSIGNED_LONG_LONG, /* VTK_UNSIGNED_LONG_LONG 17 */ + VTK_PARSE___INT64, /* VTK___INT64 18 */ + VTK_PARSE_UNSIGNED___INT64, /* VTK_UNSIGNED___INT64 19 */ + 0, /* VTK_VARIANT 20 */ + 0, /* VTK_OBJECT 21 */ + VTK_PARSE_UNICODE_STRING /* VTK_UNICODE_STRING 22 */ + }; + +/* Define some constants to simplify references to the table lookup in + the primitive_type production rule code. */ +#define VTK_PARSE_INT8 vtkParseTypeMap[VTK_TYPE_INT8] +#define VTK_PARSE_UINT8 vtkParseTypeMap[VTK_TYPE_UINT8] +#define VTK_PARSE_INT16 vtkParseTypeMap[VTK_TYPE_INT16] +#define VTK_PARSE_UINT16 vtkParseTypeMap[VTK_TYPE_UINT16] +#define VTK_PARSE_INT32 vtkParseTypeMap[VTK_TYPE_INT32] +#define VTK_PARSE_UINT32 vtkParseTypeMap[VTK_TYPE_UINT32] +#define VTK_PARSE_INT64 vtkParseTypeMap[VTK_TYPE_INT64] +#define VTK_PARSE_UINT64 vtkParseTypeMap[VTK_TYPE_UINT64] +#define VTK_PARSE_FLOAT32 vtkParseTypeMap[VTK_TYPE_FLOAT32] +#define VTK_PARSE_FLOAT64 vtkParseTypeMap[VTK_TYPE_FLOAT64] + +#define vtkParseDebug(s1, s2) \ + if ( parseDebug ) { fprintf(stderr, " %s %s\n", s1, s2); } + +/* the tokenizer */ +int yylex(void); + +/* global variables */ +FileInfo *data = NULL; +int parseDebug; + +/* the "preprocessor" */ +PreprocessInfo *preprocessor = NULL; + +/* include dirs specified on the command line */ +int NumberOfIncludeDirectories= 0; +const char **IncludeDirectories; + +/* macros specified on the command line */ +int NumberOfDefinitions = 0; +const char **Definitions; + +/* options that can be set by the programs that use the parser */ +int IgnoreBTX = 0; +int Recursive = 0; + +/* various state variables */ +NamespaceInfo *currentNamespace = NULL; +ClassInfo *currentClass = NULL; +FunctionInfo *currentFunction = NULL; +TemplateInfo *currentTemplate = NULL; +const char *currentEnumName = NULL; +const char *currentEnumValue = NULL; +parse_access_t access_level = VTK_ACCESS_PUBLIC; + +/* functions from vtkParse.l */ +void print_parser_error(const char *text, const char *cp, size_t n); + +/* helper functions */ +const char *type_class(unsigned int type, const char *classname); +void start_class(const char *classname, int is_struct_or_union); +void reject_class(const char *classname, int is_struct_or_union); +void end_class(); +void add_base_class(ClassInfo *cls, const char *name, int access_lev, + int is_virtual); +void output_friend_function(void); +void output_function(void); +void reject_function(void); +void set_return(FunctionInfo *func, unsigned int type, + const char *typeclass, int count); +void add_parameter(FunctionInfo *func, unsigned int type, + const char *classname, int count); +void add_template_parameter(unsigned int datatype, + unsigned int extra, const char *funcSig); +void add_using(const char *name, int is_namespace); +void start_enum(const char *enumname); +void add_enum(const char *name, const char *value); +void end_enum(); +unsigned int guess_constant_type(const char *value); +void add_constant(const char *name, const char *value, + unsigned int type, const char *typeclass, int global); +const char *add_const_scope(const char *name); +void prepend_scope(char *cp, const char *arg); +unsigned int guess_id_type(const char *cp); +unsigned int add_indirection(unsigned int tval, unsigned int ptr); +unsigned int add_indirection_to_array(unsigned int ptr); +void handle_complex_type(ValueInfo *val, unsigned int datatype, + unsigned int extra, const char *funcSig); +void handle_function_type(ValueInfo *param, const char *name, + const char *funcSig); +void add_legacy_parameter(FunctionInfo *func, ValueInfo *param); + +void outputSetVectorMacro(const char *var, unsigned int paramType, + const char *typeText, int n); +void outputGetVectorMacro(const char *var, unsigned int paramType, + const char *typeText, int n); + +/*---------------------------------------------------------------- + * String utility methods + * + * Strings are centrally allocated and are const, and they are not + * freed until the program exits. If they need to be freed before + * then, vtkParse_FreeStringCache() can be called. + */ + +/* duplicate the first n bytes of a string and terminate */ +static const char *vtkstrndup(const char *in, size_t n) +{ + return vtkParse_CacheString(data->Strings, in, n); +} + +/* duplicate a string */ +static const char *vtkstrdup(const char *in) +{ + if (in) + { + in = vtkParse_CacheString(data->Strings, in, strlen(in)); + } + + return in; +} + +/* helper function for concatenating strings */ +static const char *vtkstrncat(size_t n, const char **str) +{ + char *cp; + size_t i; + size_t j[8]; + size_t m = 0; + + for (i = 0; i < n; i++) + { + j[i] = 0; + if (str[i]) + { + j[i] = strlen(str[i]); + m += j[i]; + } + } + cp = vtkParse_NewString(data->Strings, m); + m = 0; + for (i = 0; i < n; i++) + { + if (j[i]) + { + strncpy(&cp[m], str[i], j[i]); + m += j[i]; + } + } + cp[m] = '\0'; + + return cp; +} + +/* concatenate strings */ +static const char *vtkstrcat(const char *str1, const char *str2) +{ + const char *cp[2]; + + cp[0] = str1; + cp[1] = str2; + return vtkstrncat(2, cp); +} + +static const char *vtkstrcat3(const char *str1, const char *str2, + const char *str3) +{ + const char *cp[3]; + + cp[0] = str1; + cp[1] = str2; + cp[2] = str3; + return vtkstrncat(3, cp); +} + +static const char *vtkstrcat4(const char *str1, const char *str2, + const char *str3, const char *str4) +{ + const char *cp[4]; + + cp[0] = str1; + cp[1] = str2; + cp[2] = str3; + cp[3] = str4; + return vtkstrncat(4, cp); +} + +static const char *vtkstrcat5(const char *str1, const char *str2, + const char *str3, const char *str4, + const char *str5) +{ + const char *cp[5]; + + cp[0] = str1; + cp[1] = str2; + cp[2] = str3; + cp[3] = str4; + cp[4] = str5; + return vtkstrncat(5, cp); +} + +static const char *vtkstrcat7(const char *str1, const char *str2, + const char *str3, const char *str4, + const char *str5, const char *str6, + const char *str7) +{ + const char *cp[7]; + + cp[0] = str1; + cp[1] = str2; + cp[2] = str3; + cp[3] = str4; + cp[4] = str5; + cp[5] = str6; + cp[6] = str7; + return vtkstrncat(7, cp); +} + +static size_t vtkidlen(const char *text) +{ + size_t i = 0; + char c = text[0]; + + if ((c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + c == '_') + { + do + { + c = text[++i]; + } + while ((c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '_'); + } + + return i; +} + +/*---------------------------------------------------------------- + * Comments + */ + +/* "private" variables */ +char *commentText = NULL; +size_t commentLength = 0; +size_t commentAllocatedLength = 0; +int commentState = 0; + +const char *getComment() +{ + if (commentState != 0) + { + return commentText; + } + return NULL; +} + +void clearComment() +{ + commentLength = 0; + if (commentText) + { + commentText[commentLength] = '\0'; + } + commentState = 0; +} + +void addCommentLine(const char *line, size_t n) +{ + if (commentState <= 0) + { + clearComment(); + return; + } + + if (commentText == NULL) + { + commentAllocatedLength = n+80; + commentText = (char *)malloc(commentAllocatedLength); + commentLength = 0; + commentText[0] = '\0'; + } + else if (commentLength + n + 2 > commentAllocatedLength) + { + commentAllocatedLength = commentAllocatedLength + commentLength + n + 2; + commentText = (char *)realloc(commentText, commentAllocatedLength); + } + + if (n > 0) + { + memcpy(&commentText[commentLength], line, n); + } + commentLength += n; + commentText[commentLength++] = '\n'; + commentText[commentLength] = '\0'; +} + +void closeComment() +{ + switch (commentState) + { + case 1: + /* Make comment persist until a new comment starts */ + commentState = -1; + break; + case 2: + data->Description = vtkstrdup(getComment()); + clearComment(); + break; + case 3: + data->SeeAlso = vtkstrdup(getComment()); + clearComment(); + break; + case 4: + data->Caveats = vtkstrdup(getComment()); + clearComment(); + break; + } +} + +void closeOrClearComment() +{ + if (commentState < 0) + { + clearComment(); + } + else + { + closeComment(); + } +} + +void setCommentState(int state) +{ + switch (state) + { + case 0: + closeComment(); + break; + default: + closeComment(); + clearComment(); + break; + } + + commentState = state; +} + + +/*---------------------------------------------------------------- + * Macros + */ + +/* "private" variables */ +const char *macroName = NULL; +int macroUsed = 0; +int macroEnded = 0; + +const char *getMacro() +{ + if (macroUsed == 0) + { + macroUsed = macroEnded; + return macroName; + } + return NULL; +} + + +/*---------------------------------------------------------------- + * Namespaces + * + * operates on: currentNamespace + */ + +/* "private" variables */ +NamespaceInfo *namespaceStack[10]; +int namespaceDepth = 0; + +/* enter a namespace */ +void pushNamespace(const char *name) +{ + int i; + NamespaceInfo *oldNamespace = currentNamespace; + + for (i = 0; i < oldNamespace->NumberOfNamespaces; i++) + { + /* see if the namespace already exists */ + if (strcmp(name, oldNamespace->Namespaces[i]->Name) == 0) + { + currentNamespace = oldNamespace->Namespaces[i]; + } + } + + /* create a new namespace */ + if (i == oldNamespace->NumberOfNamespaces) + { + currentNamespace = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); + vtkParse_InitNamespace(currentNamespace); + currentNamespace->Name = name; + vtkParse_AddNamespaceToNamespace(oldNamespace, currentNamespace); + } + + namespaceStack[namespaceDepth++] = oldNamespace; +} + +/* leave the namespace */ +void popNamespace() +{ + currentNamespace = namespaceStack[--namespaceDepth]; +} + + +/*---------------------------------------------------------------- + * Classes + * + * operates on: currentClass, access_level + */ + +/* "private" variables */ +ClassInfo *classStack[10]; +parse_access_t classAccessStack[10]; +int classDepth = 0; + +/* start an internal class definition */ +void pushClass() +{ + classAccessStack[classDepth] = access_level; + classStack[classDepth++] = currentClass; +} + +/* leave the internal class */ +void popClass() +{ + currentClass = classStack[--classDepth]; + access_level = classAccessStack[classDepth]; +} + + +/*---------------------------------------------------------------- + * Templates + * + * operates on: currentTemplate + */ + +/* "private" variables */ +TemplateInfo *templateStack[10]; +int templateDepth = 0; + +/* begin a template */ +void startTemplate() +{ + currentTemplate = (TemplateInfo *)malloc(sizeof(TemplateInfo)); + vtkParse_InitTemplate(currentTemplate); +} + +/* clear a template, if set */ +void clearTemplate() +{ + if (currentTemplate) + { + free(currentTemplate); + } + currentTemplate = NULL; +} + +/* push the template onto the stack, and start a new one */ +void pushTemplate() +{ + templateStack[templateDepth++] = currentTemplate; + startTemplate(); +} + +/* pop a template off the stack */ +void popTemplate() +{ + currentTemplate = templateStack[--templateDepth]; +} + +/*---------------------------------------------------------------- + * Function signatures + * + * operates on: currentFunction + */ + +/* "private" variables */ +int sigClosed = 0; +size_t sigMark[10]; +size_t sigLength = 0; +size_t sigAllocatedLength = 0; +int sigMarkDepth = 0; +char *signature = NULL; + +/* start a new signature */ +void startSig() +{ + signature = NULL; + sigLength = 0; + sigAllocatedLength = 0; + sigClosed = 0; + sigMarkDepth = 0; + sigMark[0] = 0; +} + +/* get the signature */ +const char *getSig() +{ + return signature; +} + +/* get the signature length */ +size_t getSigLength() +{ + return sigLength; +} + +/* reset the sig to the specified length */ +void resetSig(size_t n) +{ + if (n < sigLength) + { + sigLength = n; + } +} + +/* reallocate Signature if n chars cannot be appended */ +void checkSigSize(size_t n) +{ + const char *ccp; + + if (sigAllocatedLength == 0) + { + sigLength = 0; + sigAllocatedLength = 80 + n; + signature = vtkParse_NewString(data->Strings, sigAllocatedLength); + signature[0] = '\0'; + } + else if (sigLength + n > sigAllocatedLength) + { + sigAllocatedLength += sigLength + n; + ccp = signature; + signature = vtkParse_NewString(data->Strings, sigAllocatedLength); + strncpy(signature, ccp, sigLength); + signature[sigLength] = '\0'; + } +} + +/* close the signature, i.e. allow no more additions to it */ +void closeSig() +{ + sigClosed = 1; +} + +/* re-open the signature */ +void openSig() +{ + sigClosed = 0; +} + +/* insert text at the beginning of the signature */ +void preSig(const char *arg) +{ + if (!sigClosed) + { + size_t n = strlen(arg); + checkSigSize(n); + if (n > 0) + { + memmove(&signature[n], signature, sigLength); + strncpy(signature, arg, n); + sigLength += n; + } + signature[sigLength] = '\0'; + } +} + +/* append text to the end of the signature */ +void postSig(const char *arg) +{ + if (!sigClosed) + { + size_t n = strlen(arg); + checkSigSize(n); + if (n > 0) + { + strncpy(&signature[sigLength], arg, n); + sigLength += n; + } + signature[sigLength] = '\0'; + } +} + +/* set a mark in the signature for later operations */ +void markSig() +{ + sigMark[sigMarkDepth] = 0; + if (signature) + { + sigMark[sigMarkDepth] = sigLength; + } + sigMarkDepth++; +} + +/* get the contents of the sig from the mark, and clear the mark */ +const char *copySig() +{ + const char *cp = NULL; + if (sigMarkDepth > 0) + { + sigMarkDepth--; + } + if (signature) + { + cp = &signature[sigMark[sigMarkDepth]]; + } + return vtkstrdup(cp); +} + +/* swap the signature text using the mark as the radix */ +void swapSig() +{ + if (sigMarkDepth > 0) + { + sigMarkDepth--; + } + if (signature && sigMark[sigMarkDepth] > 0) + { + size_t i, m, n, nn; + char c; + char *cp; + cp = signature; + n = sigLength; + m = sigMark[sigMarkDepth]; + nn = m/2; + for (i = 0; i < nn; i++) + { + c = cp[i]; cp[i] = cp[m-i-1]; cp[m-i-1] = c; + } + nn = (n-m)/2; + for (i = 0; i < nn; i++) + { + c = cp[i+m]; cp[i+m] = cp[n-i-1]; cp[n-i-1] = c; + } + nn = n/2; + for (i = 0; i < nn; i++) + { + c = cp[i]; cp[i] = cp[n-i-1]; cp[n-i-1] = c; + } + } +} + +/* chop the last space from the signature */ +void chopSig(void) +{ + if (signature) + { + size_t n = sigLength; + if (n > 0 && signature[n-1] == ' ') + { + signature[n-1] = '\0'; + sigLength--; + } + } +} + +/*---------------------------------------------------------------- + * Subroutines for building a type + */ + +/* "private" variables */ +unsigned int storedType; +unsigned int typeStack[10]; +int typeDepth = 0; + +/* save the type on the stack */ +void pushType() +{ + typeStack[typeDepth++] = storedType; +} + +/* pop the type stack */ +void popType() +{ + storedType = typeStack[--typeDepth]; +} + +/* clear the storage type */ +void clearType() +{ + storedType = 0; +} + +/* save the type */ +void setTypeBase(unsigned int base) +{ + storedType &= ~(unsigned int)(VTK_PARSE_BASE_TYPE); + storedType |= base; +} + +/* set a type modifier bit */ +void setTypeMod(unsigned int mod) +{ + storedType |= mod; +} + +/* modify the indirection (pointers, refs) in the storage type */ +void setTypePtr(unsigned int ind) +{ + storedType &= ~(unsigned int)(VTK_PARSE_INDIRECT); + ind &= VTK_PARSE_INDIRECT; + storedType |= ind; +} + +/* retrieve the storage type */ +unsigned int getType() +{ + return storedType; +} + +/* combine two primitive type parts, e.g. "long int" */ +unsigned int buildTypeBase(unsigned int a, unsigned int b) +{ + unsigned int base = (a & VTK_PARSE_BASE_TYPE); + unsigned int basemod = (b & VTK_PARSE_BASE_TYPE); + + switch (base) + { + case 0: + base = basemod; + break; + case VTK_PARSE_UNSIGNED_INT: + base = (basemod | VTK_PARSE_UNSIGNED); + break; + case VTK_PARSE_INT: + base = basemod; + if (base == VTK_PARSE_CHAR) + { + base = VTK_PARSE_SIGNED_CHAR; + } + break; + case VTK_PARSE_CHAR: + if (basemod == VTK_PARSE_INT) + { + base = VTK_PARSE_SIGNED_CHAR; + } + else if (basemod == VTK_PARSE_UNSIGNED_INT) + { + base = VTK_PARSE_UNSIGNED_CHAR; + } + break; + case VTK_PARSE_SHORT: + if (basemod == VTK_PARSE_UNSIGNED_INT) + { + base = VTK_PARSE_UNSIGNED_SHORT; + } + break; + case VTK_PARSE_LONG: + if (basemod == VTK_PARSE_UNSIGNED_INT) + { + base = VTK_PARSE_UNSIGNED_LONG; + } + else if (basemod == VTK_PARSE_LONG) + { + base = VTK_PARSE_LONG_LONG; + } + else if (basemod == VTK_PARSE_DOUBLE) + { + base = VTK_PARSE_LONG_DOUBLE; + } + break; + case VTK_PARSE_UNSIGNED_LONG: + if (basemod == VTK_PARSE_LONG) + { + base = VTK_PARSE_UNSIGNED_LONG_LONG; + } + break; + case VTK_PARSE_LONG_LONG: + if (basemod == VTK_PARSE_UNSIGNED_INT) + { + base = VTK_PARSE_UNSIGNED_LONG_LONG; + } + break; + case VTK_PARSE___INT64: + if (basemod == VTK_PARSE_UNSIGNED_INT) + { + base = VTK_PARSE_UNSIGNED___INT64; + } + break; + case VTK_PARSE_DOUBLE: + if (basemod == VTK_PARSE_LONG) + { + base = VTK_PARSE_LONG_DOUBLE; + } + break; + } + + return ((a & ~(unsigned int)(VTK_PARSE_BASE_TYPE)) | base); +} + + +/*---------------------------------------------------------------- + * Array information + */ + +/* "private" variables */ +int numberOfDimensions = 0; +const char **arrayDimensions = NULL; + +/* clear the array counter */ +void clearArray(void) +{ + numberOfDimensions = 0; + arrayDimensions = NULL; +} + +/* add another dimension */ +void pushArraySize(const char *size) +{ + vtkParse_AddStringToArray(&arrayDimensions, &numberOfDimensions, + size); +} + +/* add another dimension to the front */ +void pushArrayFront(const char *size) +{ + int i; + + vtkParse_AddStringToArray(&arrayDimensions, &numberOfDimensions, 0); + + for (i = numberOfDimensions-1; i > 0; i--) + { + arrayDimensions[i] = arrayDimensions[i-1]; + } + + arrayDimensions[0] = size; +} + +/* get the number of dimensions */ +int getArrayNDims() +{ + return numberOfDimensions; +} + +/* get the whole array */ +const char **getArray() +{ + if (numberOfDimensions > 0) + { + return arrayDimensions; + } + return NULL; +} + +/*---------------------------------------------------------------- + * Variables and Parameters + */ + +/* "private" variables */ +const char *currentVarName = 0; +const char *currentVarValue = 0; +const char *currentId = 0; + +/* clear the var Id */ +void clearVarName(void) +{ + currentVarName = NULL; +} + +/* set the var Id */ +void setVarName(const char *text) +{ + currentVarName = text; +} + +/* return the var id */ +const char *getVarName() +{ + return currentVarName; +} + +/* variable value -------------- */ + +/* clear the var value */ +void clearVarValue(void) +{ + currentVarValue = NULL; +} + +/* set the var value */ +void setVarValue(const char *text) +{ + currentVarValue = text; +} + +/* return the var value */ +const char *getVarValue() +{ + return currentVarValue; +} + +/* variable type -------------- */ + +/* clear the current Id */ +void clearTypeId(void) +{ + currentId = NULL; +} + +/* set the current Id, it is sticky until cleared */ +void setTypeId(const char *text) +{ + if (currentId == NULL) + { + currentId = text; + } +} + +/* set the signature and type together */ +void typeSig(const char *text) +{ + postSig(text); + postSig(" "); + + if (currentId == 0) + { + setTypeId(text); + } +} + +/* return the current Id */ +const char *getTypeId() +{ + return currentId; +} + +/*---------------------------------------------------------------- + * Specifically for function pointers, the scope (i.e. class) that + * the function is a method of. + */ + +const char *pointerScopeStack[10]; +int pointerScopeDepth = 0; + +/* save the scope for scoped method pointers */ +void scopeSig(const char *scope) +{ + if (scope && scope[0] != '\0') + { + postSig(scope); + } + else + { + scope = NULL; + } + pointerScopeStack[pointerScopeDepth++] = vtkstrdup(scope); +} + +/* get the scope back */ +const char *getScope() +{ + return pointerScopeStack[--pointerScopeDepth]; +} + +/*---------------------------------------------------------------- + * Function stack + * + * operates on: currentFunction + */ + +/* "private" variables */ +FunctionInfo *functionStack[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const char *functionVarNameStack[10]; +const char *functionTypeIdStack[10]; +int functionDepth = 0; + +void pushFunction() +{ + functionStack[functionDepth] = currentFunction; + currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + vtkParse_InitFunction(currentFunction); + if (!functionStack[functionDepth]) + { + startSig(); + } + functionVarNameStack[functionDepth] = getVarName(); + functionTypeIdStack[functionDepth] = getTypeId(); + pushType(); + clearType(); + clearVarName(); + clearTypeId(); + functionDepth++; + functionStack[functionDepth] = 0; +} + +void popFunction() +{ + FunctionInfo *newFunction = currentFunction; + + --functionDepth; + currentFunction = functionStack[functionDepth]; + clearVarName(); + if (functionVarNameStack[functionDepth]) + { + setVarName(functionVarNameStack[functionDepth]); + } + clearTypeId(); + if (functionTypeIdStack[functionDepth]) + { + setTypeId(functionTypeIdStack[functionDepth]); + } + popType(); + + functionStack[functionDepth+1] = newFunction; +} + +FunctionInfo *getFunction() +{ + return functionStack[functionDepth+1]; +} + +/*---------------------------------------------------------------- + * Utility methods + */ + +/* prepend a scope:: to a name */ +void prepend_scope(char *cp, const char *arg) +{ + size_t i, j, m, n; + int depth; + + m = strlen(cp); + n = strlen(arg); + i = m; + while (i > 0 && + ((cp[i-1] >= 'a' && cp[i-1] <= 'z') || + (cp[i-1] >= 'A' && cp[i-1] <= 'Z') || + (cp[i-1] >= '0' && cp[i-1] <= '9') || + cp[i-1] == '_' || cp[i-1] == ':' || + cp[i-1] == '>')) + { + i--; + if (cp[i] == '>') + { + depth = 1; + while (i > 0) + { + i--; + if (cp[i] == '<') + { + if (--depth == 0) + { + break; + } + } + if (cp[i] == '>') + { + depth++; + } + } + } + } + + for (j = m; j > i; j--) + { + cp[j+n+1] = cp[j-1]; + } + for (j = 0; j < n; j++) + { + cp[j+i] = arg[j]; + } + cp[n+i] = ':'; cp[n+i+1] = ':'; + cp[m+n+2] = '\0'; +} + +/* expand a type by including pointers from another */ +unsigned int add_indirection(unsigned int type1, unsigned int type2) +{ + unsigned int ptr1 = (type1 & VTK_PARSE_POINTER_MASK); + unsigned int ptr2 = (type2 & VTK_PARSE_POINTER_MASK); + unsigned int reverse = 0; + unsigned int result; + + /* one of type1 or type2 will only have VTK_PARSE_INDIRECT, but + * we don't know which one. */ + result = ((type1 & ~VTK_PARSE_POINTER_MASK) | + (type2 & ~VTK_PARSE_POINTER_MASK)); + + while (ptr2) + { + reverse = ((reverse << 2) | (ptr2 & VTK_PARSE_POINTER_LOWMASK)); + ptr2 = ((ptr2 >> 2) & VTK_PARSE_POINTER_MASK); + } + + while (reverse) + { + ptr1 = ((ptr1 << 2) | (reverse & VTK_PARSE_POINTER_LOWMASK)); + reverse = ((reverse >> 2) & VTK_PARSE_POINTER_MASK); + + /* make sure we don't exceed the VTK_PARSE_POINTER bitfield */ + if ((ptr1 & VTK_PARSE_POINTER_MASK) != ptr1) + { + ptr1 = VTK_PARSE_BAD_INDIRECT; + break; + } + } + + return (ptr1 | result); +} + +/* There is only one array, so add any parenthetical indirection to it */ +unsigned int add_indirection_to_array(unsigned int type) +{ + unsigned int ptrs = (type & VTK_PARSE_POINTER_MASK); + unsigned int result = (type & ~VTK_PARSE_POINTER_MASK); + unsigned int reverse = 0; + + if ((type & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) + { + return (result | VTK_PARSE_BAD_INDIRECT); + } + + while (ptrs) + { + reverse = ((reverse << 2) | (ptrs & VTK_PARSE_POINTER_LOWMASK)); + ptrs = ((ptrs >> 2) & VTK_PARSE_POINTER_MASK); + } + + /* I know the reversal makes no difference, but it is still + * nice to add the pointers in the correct order, just in + * case const pointers are thrown into the mix. */ + while (reverse) + { + pushArrayFront(""); + reverse = ((reverse >> 2) & VTK_PARSE_POINTER_MASK); + } + + return result; +} + + + +/* Line 189 of yacc.c */ +#line 1354 "vtkParse.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ID = 258, + VTK_ID = 259, + QT_ID = 260, + StdString = 261, + UnicodeString = 262, + OSTREAM = 263, + ISTREAM = 264, + LP = 265, + LA = 266, + STRING_LITERAL = 267, + INT_LITERAL = 268, + HEX_LITERAL = 269, + OCT_LITERAL = 270, + FLOAT_LITERAL = 271, + CHAR_LITERAL = 272, + ZERO = 273, + STRUCT = 274, + CLASS = 275, + UNION = 276, + ENUM = 277, + PUBLIC = 278, + PRIVATE = 279, + PROTECTED = 280, + CONST = 281, + VOLATILE = 282, + MUTABLE = 283, + STATIC = 284, + VIRTUAL = 285, + EXPLICIT = 286, + INLINE = 287, + FRIEND = 288, + EXTERN = 289, + OPERATOR = 290, + TEMPLATE = 291, + THROW = 292, + TYPENAME = 293, + TYPEDEF = 294, + NAMESPACE = 295, + USING = 296, + NEW = 297, + DELETE = 298, + STATIC_CAST = 299, + DYNAMIC_CAST = 300, + CONST_CAST = 301, + REINTERPRET_CAST = 302, + OP_LSHIFT_EQ = 303, + OP_RSHIFT_EQ = 304, + OP_LSHIFT = 305, + OP_RSHIFT = 306, + OP_DOT_POINTER = 307, + OP_ARROW_POINTER = 308, + OP_ARROW = 309, + OP_INCR = 310, + OP_DECR = 311, + OP_PLUS_EQ = 312, + OP_MINUS_EQ = 313, + OP_TIMES_EQ = 314, + OP_DIVIDE_EQ = 315, + OP_REMAINDER_EQ = 316, + OP_AND_EQ = 317, + OP_OR_EQ = 318, + OP_XOR_EQ = 319, + OP_LOGIC_AND = 320, + OP_LOGIC_OR = 321, + OP_LOGIC_EQ = 322, + OP_LOGIC_NEQ = 323, + OP_LOGIC_LEQ = 324, + OP_LOGIC_GEQ = 325, + ELLIPSIS = 326, + DOUBLE_COLON = 327, + OTHER = 328, + VOID = 329, + BOOL = 330, + FLOAT = 331, + DOUBLE = 332, + INT = 333, + SHORT = 334, + LONG = 335, + INT64__ = 336, + CHAR = 337, + SIGNED = 338, + UNSIGNED = 339, + SSIZE_T = 340, + SIZE_T = 341, + IdType = 342, + TypeInt8 = 343, + TypeUInt8 = 344, + TypeInt16 = 345, + TypeUInt16 = 346, + TypeInt32 = 347, + TypeUInt32 = 348, + TypeInt64 = 349, + TypeUInt64 = 350, + TypeFloat32 = 351, + TypeFloat64 = 352, + SetMacro = 353, + GetMacro = 354, + SetStringMacro = 355, + GetStringMacro = 356, + SetClampMacro = 357, + SetObjectMacro = 358, + GetObjectMacro = 359, + BooleanMacro = 360, + SetVector2Macro = 361, + SetVector3Macro = 362, + SetVector4Macro = 363, + SetVector6Macro = 364, + GetVector2Macro = 365, + GetVector3Macro = 366, + GetVector4Macro = 367, + GetVector6Macro = 368, + SetVectorMacro = 369, + GetVectorMacro = 370, + ViewportCoordinateMacro = 371, + WorldCoordinateMacro = 372, + TypeMacro = 373, + VTK_BYTE_SWAP_DECL = 374 + }; +#endif + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 222 of yacc.c */ +#line 1302 "vtkParse.y" + + const char *str; + unsigned int integer; + + + +/* Line 222 of yacc.c */ +#line 1635 "vtkParse.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 1647 "vtkParse.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 5657 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 143 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 240 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 603 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 968 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 374 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 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, 139, 2, 2, 2, 135, 133, 2, + 126, 127, 134, 138, 125, 137, 142, 136, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 124, 120, + 128, 123, 129, 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, 130, 2, 131, 141, 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, 121, 140, 122, 132, 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, 2, 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, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 5, 6, 7, 11, 13, 15, 17, + 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 40, 42, 45, 48, 51, 54, 60, 65, 66, 73, + 79, 81, 84, 88, 93, 98, 104, 105, 111, 112, + 117, 118, 122, 124, 126, 128, 129, 130, 134, 138, + 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, + 160, 162, 164, 167, 170, 172, 175, 178, 181, 185, + 188, 192, 193, 195, 198, 200, 204, 206, 210, 214, + 215, 217, 218, 220, 222, 224, 226, 231, 237, 238, + 244, 247, 249, 250, 252, 254, 257, 261, 263, 264, + 269, 276, 280, 285, 288, 292, 298, 302, 304, 307, + 313, 319, 326, 332, 339, 342, 343, 347, 350, 352, + 354, 355, 356, 364, 366, 370, 372, 375, 378, 381, + 385, 389, 394, 398, 399, 405, 407, 408, 413, 414, + 415, 421, 422, 423, 429, 430, 431, 432, 440, 442, + 444, 445, 447, 448, 452, 454, 457, 460, 463, 466, + 469, 472, 476, 479, 483, 486, 490, 494, 497, 501, + 506, 509, 511, 513, 516, 518, 521, 524, 525, 526, + 534, 537, 538, 542, 543, 549, 552, 554, 557, 558, + 561, 562, 566, 568, 571, 575, 577, 578, 584, 586, + 588, 589, 590, 596, 597, 603, 604, 607, 609, 613, + 616, 617, 618, 621, 623, 624, 629, 633, 634, 635, + 641, 642, 644, 645, 649, 654, 657, 658, 661, 662, + 663, 668, 671, 672, 674, 677, 678, 684, 687, 688, + 694, 696, 698, 700, 702, 704, 705, 706, 707, 714, + 716, 717, 720, 723, 727, 729, 732, 734, 737, 738, + 740, 742, 746, 748, 750, 752, 753, 755, 756, 759, + 761, 764, 765, 770, 771, 772, 775, 777, 779, 781, + 783, 786, 789, 792, 795, 798, 802, 806, 807, 813, + 815, 817, 818, 824, 826, 828, 830, 832, 834, 836, + 838, 841, 844, 847, 850, 853, 856, 859, 861, 863, + 865, 867, 869, 871, 873, 875, 877, 879, 881, 883, + 885, 887, 889, 891, 893, 895, 897, 899, 900, 903, + 905, 907, 909, 911, 913, 916, 918, 920, 922, 924, + 926, 929, 931, 933, 935, 937, 939, 941, 943, 946, + 949, 950, 954, 955, 960, 962, 963, 967, 969, 971, + 974, 977, 980, 981, 985, 986, 991, 993, 995, 997, + 1000, 1003, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, + 1022, 1024, 1026, 1028, 1030, 1032, 1034, 1036, 1038, 1040, + 1042, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1058, 1060, + 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1079, 1081, + 1083, 1084, 1088, 1090, 1093, 1094, 1102, 1103, 1104, 1105, + 1115, 1116, 1122, 1123, 1129, 1130, 1131, 1142, 1143, 1151, + 1152, 1153, 1154, 1164, 1171, 1172, 1180, 1181, 1189, 1190, + 1198, 1199, 1207, 1208, 1216, 1217, 1225, 1226, 1234, 1235, + 1243, 1244, 1254, 1255, 1265, 1270, 1275, 1283, 1284, 1286, + 1289, 1292, 1296, 1300, 1302, 1304, 1306, 1308, 1310, 1312, + 1314, 1316, 1318, 1320, 1322, 1324, 1326, 1328, 1330, 1332, + 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, + 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, + 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, + 1394, 1396, 1398, 1400, 1402, 1404, 1406, 1408, 1410, 1412, + 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, + 1434, 1436, 1438, 1440, 1443, 1445, 1447, 1449, 1451, 1453, + 1455, 1457, 1459, 1461, 1463, 1465, 1466, 1469, 1471, 1473, + 1475, 1477, 1479, 1481, 1483, 1485, 1486, 1489, 1490, 1493, + 1495, 1497, 1499, 1501, 1503, 1504, 1509, 1510, 1515, 1516, + 1521, 1522, 1527, 1528, 1533, 1534, 1539, 1540, 1543, 1544, + 1547, 1549, 1551, 1553, 1555, 1557, 1559, 1561, 1563, 1565, + 1567, 1569, 1571, 1573, 1575, 1577, 1579, 1581, 1583, 1587, + 1591, 1595, 1597, 1599 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 144, 0, -1, 145, -1, -1, -1, 145, 146, 147, + -1, 198, -1, 196, -1, 153, -1, 150, -1, 152, + -1, 149, -1, 186, -1, 259, -1, 175, -1, 155, + -1, 216, -1, 148, -1, 327, -1, 289, 120, -1, + 120, -1, 199, 155, -1, 199, 216, -1, 199, 183, + -1, 199, 148, -1, 34, 12, 121, 145, 122, -1, + 40, 121, 375, 122, -1, -1, 40, 299, 151, 121, + 145, 122, -1, 40, 299, 123, 291, 120, -1, 154, + -1, 199, 154, -1, 161, 289, 120, -1, 302, 161, + 289, 120, -1, 156, 300, 261, 120, -1, 302, 156, + 300, 261, 120, -1, -1, 158, 157, 121, 162, 122, + -1, -1, 161, 289, 159, 168, -1, -1, 161, 160, + 168, -1, 20, -1, 19, -1, 21, -1, -1, -1, + 162, 163, 165, -1, 162, 164, 124, -1, 23, -1, + 24, -1, 25, -1, 196, -1, 153, -1, 167, -1, + 186, -1, 259, -1, 175, -1, 155, -1, 220, -1, + 166, -1, 327, -1, 119, 381, -1, 289, 120, -1, + 120, -1, 199, 155, -1, 199, 220, -1, 33, 184, + -1, 33, 199, 184, -1, 33, 153, -1, 33, 221, + 237, -1, -1, 169, -1, 124, 170, -1, 171, -1, + 170, 125, 171, -1, 289, -1, 30, 173, 289, -1, + 174, 172, 289, -1, -1, 30, -1, -1, 174, -1, + 23, -1, 24, -1, 25, -1, 176, 300, 261, 120, + -1, 302, 176, 300, 261, 120, -1, -1, 178, 121, + 177, 179, 122, -1, 22, 289, -1, 22, -1, -1, + 180, -1, 181, -1, 180, 125, -1, 180, 125, 181, + -1, 298, -1, -1, 298, 123, 182, 355, -1, 308, + 292, 298, 123, 376, 120, -1, 161, 289, 185, -1, + 302, 161, 289, 185, -1, 161, 185, -1, 302, 161, + 185, -1, 121, 375, 122, 376, 120, -1, 124, 376, + 120, -1, 187, -1, 302, 187, -1, 39, 308, 195, + 189, 120, -1, 39, 156, 300, 188, 120, -1, 39, + 302, 156, 300, 188, 120, -1, 39, 176, 300, 188, + 120, -1, 39, 302, 176, 300, 188, 120, -1, 190, + 189, -1, -1, 189, 125, 190, -1, 265, 195, -1, + 268, -1, 192, -1, -1, -1, 279, 126, 193, 249, + 127, 194, 275, -1, 191, -1, 41, 197, 120, -1, + 289, -1, 38, 289, -1, 292, 231, -1, 292, 226, + -1, 295, 292, 231, -1, 295, 292, 226, -1, 41, + 40, 289, 120, -1, 36, 128, 129, -1, -1, 36, + 128, 200, 201, 129, -1, 203, -1, -1, 201, 125, + 202, 203, -1, -1, -1, 204, 314, 266, 205, 212, + -1, -1, -1, 206, 211, 266, 207, 212, -1, -1, + -1, -1, 208, 199, 20, 209, 266, 210, 212, -1, + 20, -1, 38, -1, -1, 213, -1, -1, 123, 214, + 215, -1, 363, -1, 215, 363, -1, 217, 237, -1, + 222, 237, -1, 218, 237, -1, 219, 237, -1, 308, + 233, -1, 308, 292, 233, -1, 292, 241, -1, 302, + 292, 241, -1, 292, 223, -1, 302, 292, 223, -1, + 308, 292, 227, -1, 221, 237, -1, 292, 231, 120, + -1, 302, 292, 231, 120, -1, 308, 233, -1, 222, + -1, 241, -1, 302, 241, -1, 223, -1, 302, 223, + -1, 308, 227, -1, -1, -1, 226, 126, 224, 249, + 127, 225, 234, -1, 232, 308, -1, -1, 229, 228, + 234, -1, -1, 231, 126, 230, 249, 127, -1, 232, + 351, -1, 35, -1, 238, 234, -1, -1, 234, 235, + -1, -1, 37, 236, 369, -1, 26, -1, 123, 18, + -1, 121, 375, 122, -1, 120, -1, -1, 240, 126, + 239, 249, 127, -1, 298, -1, 296, -1, -1, -1, + 244, 242, 246, 243, 234, -1, -1, 240, 126, 245, + 249, 127, -1, -1, 124, 247, -1, 248, -1, 247, + 125, 248, -1, 289, 381, -1, -1, -1, 250, 251, + -1, 253, -1, -1, 251, 125, 252, 253, -1, 251, + 125, 71, -1, -1, -1, 254, 308, 266, 255, 256, + -1, -1, 257, -1, -1, 123, 258, 355, -1, 308, + 260, 262, 120, -1, 268, 256, -1, -1, 264, 262, + -1, -1, -1, 262, 125, 263, 264, -1, 265, 260, + -1, -1, 322, -1, 278, 281, -1, -1, 270, 276, + 127, 267, 272, -1, 279, 281, -1, -1, 271, 277, + 127, 269, 272, -1, 126, -1, 10, -1, 11, -1, + 10, -1, 11, -1, -1, -1, -1, 126, 273, 249, + 127, 274, 275, -1, 282, -1, -1, 275, 28, -1, + 275, 26, -1, 275, 37, 381, -1, 266, -1, 322, + 266, -1, 268, -1, 322, 268, -1, -1, 279, -1, + 298, -1, 298, 124, 280, -1, 15, -1, 13, -1, + 14, -1, -1, 282, -1, -1, 283, 284, -1, 285, + -1, 284, 285, -1, -1, 130, 286, 287, 131, -1, + -1, -1, 288, 355, -1, 290, -1, 291, -1, 298, + -1, 296, -1, 292, 290, -1, 295, 290, -1, 295, + 291, -1, 294, 295, -1, 296, 295, -1, 292, 294, + 295, -1, 292, 296, 295, -1, -1, 292, 36, 293, + 296, 295, -1, 299, -1, 72, -1, -1, 299, 128, + 297, 361, 129, -1, 4, -1, 5, -1, 3, -1, + 9, -1, 8, -1, 6, -1, 7, -1, 132, 4, + -1, 132, 5, -1, 132, 3, -1, 132, 9, -1, + 132, 8, -1, 132, 6, -1, 132, 7, -1, 86, + -1, 85, -1, 88, -1, 89, -1, 90, -1, 91, + -1, 92, -1, 93, -1, 94, -1, 95, -1, 96, + -1, 97, -1, 87, -1, 3, -1, 5, -1, 4, + -1, 9, -1, 8, -1, 6, -1, 7, -1, -1, + 300, 301, -1, 303, -1, 321, -1, 39, -1, 33, + -1, 303, -1, 302, 303, -1, 304, -1, 305, -1, + 306, -1, 28, -1, 34, -1, 34, 12, -1, 29, + -1, 32, -1, 30, -1, 31, -1, 26, -1, 27, + -1, 306, -1, 307, 306, -1, 309, 265, -1, -1, + 312, 310, 300, -1, -1, 302, 312, 311, 300, -1, + 319, -1, -1, 38, 313, 289, -1, 296, -1, 291, + -1, 161, 289, -1, 22, 289, -1, 315, 265, -1, + -1, 318, 316, 300, -1, -1, 302, 312, 317, 300, + -1, 319, -1, 296, -1, 291, -1, 19, 289, -1, + 21, 289, -1, 22, 289, -1, 321, -1, 320, -1, + 6, -1, 7, -1, 8, -1, 9, -1, 3, -1, + 4, -1, 5, -1, 85, -1, 86, -1, 88, -1, + 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, + 94, -1, 95, -1, 96, -1, 97, -1, 87, -1, + 74, -1, 75, -1, 76, -1, 77, -1, 82, -1, + 78, -1, 79, -1, 80, -1, 81, -1, 83, -1, + 84, -1, 323, -1, 326, -1, 326, 323, -1, 133, + -1, 134, -1, -1, 134, 325, 307, -1, 324, -1, + 326, 324, -1, -1, 98, 126, 298, 125, 328, 308, + 127, -1, -1, -1, -1, 99, 126, 329, 298, 125, + 330, 308, 331, 127, -1, -1, 100, 126, 332, 298, + 127, -1, -1, 101, 126, 333, 298, 127, -1, -1, + -1, 102, 126, 298, 125, 334, 308, 335, 125, 376, + 127, -1, -1, 103, 126, 298, 125, 336, 308, 127, + -1, -1, -1, -1, 104, 126, 337, 298, 125, 338, + 308, 339, 127, -1, 105, 126, 298, 125, 308, 127, + -1, -1, 106, 126, 298, 125, 340, 308, 127, -1, + -1, 110, 126, 298, 125, 341, 308, 127, -1, -1, + 107, 126, 298, 125, 342, 308, 127, -1, -1, 111, + 126, 298, 125, 343, 308, 127, -1, -1, 108, 126, + 298, 125, 344, 308, 127, -1, -1, 112, 126, 298, + 125, 345, 308, 127, -1, -1, 109, 126, 298, 125, + 346, 308, 127, -1, -1, 113, 126, 298, 125, 347, + 308, 127, -1, -1, 114, 126, 298, 125, 348, 308, + 125, 13, 127, -1, -1, 115, 126, 298, 125, 349, + 308, 125, 13, 127, -1, 116, 126, 298, 127, -1, + 117, 126, 298, 127, -1, 118, 126, 298, 125, 298, + 350, 127, -1, -1, 125, -1, 126, 127, -1, 130, + 131, -1, 42, 130, 131, -1, 43, 130, 131, -1, + 128, -1, 129, -1, 125, -1, 123, -1, 352, -1, + 135, -1, 134, -1, 136, -1, 137, -1, 138, -1, + 139, -1, 132, -1, 133, -1, 140, -1, 141, -1, + 42, -1, 43, -1, 48, -1, 49, -1, 50, -1, + 51, -1, 52, -1, 53, -1, 54, -1, 57, -1, + 58, -1, 59, -1, 60, -1, 61, -1, 55, -1, + 56, -1, 62, -1, 63, -1, 64, -1, 65, -1, + 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, + 39, -1, 38, -1, 20, -1, 19, -1, 21, -1, + 36, -1, 23, -1, 25, -1, 24, -1, 26, -1, + 29, -1, 32, -1, 30, -1, 34, -1, 40, -1, + 35, -1, 22, -1, 37, -1, 46, -1, 45, -1, + 44, -1, 47, -1, 15, -1, 13, -1, 14, -1, + 16, -1, 17, -1, 12, -1, 18, -1, 358, -1, + 355, 358, -1, 367, -1, 369, -1, 373, -1, 352, + -1, 124, -1, 142, -1, 72, -1, 353, -1, 354, + -1, 321, -1, 320, -1, -1, 357, 359, -1, 356, + -1, 128, -1, 129, -1, 358, -1, 123, -1, 125, + -1, 359, -1, 120, -1, -1, 361, 364, -1, -1, + 362, 360, -1, 365, -1, 356, -1, 363, -1, 123, + -1, 125, -1, -1, 128, 366, 361, 129, -1, -1, + 130, 368, 357, 131, -1, -1, 126, 370, 357, 127, + -1, -1, 10, 371, 357, 127, -1, -1, 11, 372, + 357, 127, -1, -1, 121, 374, 362, 122, -1, -1, + 375, 377, -1, -1, 376, 378, -1, 378, -1, 120, + -1, 379, -1, 381, -1, 380, -1, 72, -1, 71, + -1, 352, -1, 124, -1, 142, -1, 128, -1, 129, + -1, 123, -1, 125, -1, 353, -1, 354, -1, 319, + -1, 73, -1, 121, 375, 122, -1, 130, 375, 131, + -1, 382, 375, 127, -1, 126, -1, 10, -1, 11, + -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 1460, 1460, 1462, 1464, 1463, 1474, 1475, 1476, 1477, + 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, + 1488, 1491, 1492, 1493, 1494, 1501, 1508, 1509, 1509, 1513, + 1520, 1521, 1524, 1525, 1528, 1529, 1532, 1532, 1546, 1546, + 1548, 1548, 1552, 1553, 1554, 1556, 1558, 1557, 1566, 1570, + 1571, 1572, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, + 1583, 1584, 1585, 1586, 1587, 1590, 1591, 1594, 1595, 1596, + 1597, 1599, 1600, 1603, 1606, 1607, 1610, 1612, 1614, 1618, + 1619, 1622, 1623, 1626, 1627, 1628, 1639, 1640, 1644, 1644, + 1657, 1658, 1660, 1661, 1664, 1665, 1666, 1669, 1670, 1670, + 1678, 1681, 1682, 1683, 1684, 1687, 1688, 1696, 1697, 1700, + 1701, 1703, 1705, 1707, 1711, 1713, 1714, 1717, 1720, 1721, + 1724, 1725, 1724, 1729, 1763, 1766, 1767, 1768, 1770, 1772, + 1774, 1778, 1785, 1788, 1787, 1805, 1807, 1806, 1811, 1813, + 1811, 1815, 1817, 1815, 1819, 1820, 1822, 1819, 1833, 1834, + 1836, 1837, 1840, 1840, 1850, 1851, 1859, 1860, 1861, 1862, + 1865, 1868, 1869, 1870, 1873, 1874, 1875, 1878, 1879, 1880, + 1883, 1884, 1885, 1886, 1889, 1890, 1891, 1895, 1899, 1894, + 1911, 1915, 1915, 1926, 1925, 1934, 1938, 1941, 1950, 1951, + 1954, 1954, 1955, 1956, 1964, 1965, 1969, 1968, 1976, 1977, + 1985, 1986, 1985, 2004, 2004, 2007, 2008, 2011, 2012, 2015, + 2021, 2022, 2022, 2025, 2026, 2026, 2028, 2032, 2034, 2032, + 2058, 2059, 2062, 2062, 2070, 2073, 2132, 2133, 2135, 2136, + 2136, 2139, 2142, 2143, 2147, 2148, 2148, 2167, 2168, 2168, + 2186, 2187, 2189, 2193, 2195, 2198, 2199, 2200, 2199, 2205, + 2207, 2208, 2209, 2210, 2213, 2214, 2218, 2219, 2223, 2224, + 2227, 2228, 2231, 2232, 2233, 2236, 2237, 2240, 2240, 2243, + 2244, 2247, 2247, 2250, 2251, 2251, 2258, 2259, 2262, 2263, + 2266, 2268, 2270, 2274, 2276, 2278, 2280, 2282, 2282, 2287, + 2290, 2293, 2293, 2308, 2309, 2310, 2311, 2312, 2313, 2314, + 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, + 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, + 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2354, 2355, 2358, + 2359, 2361, 2362, 2365, 2366, 2369, 2370, 2371, 2374, 2375, + 2376, 2377, 2380, 2381, 2382, 2385, 2386, 2389, 2390, 2399, + 2402, 2402, 2404, 2404, 2408, 2409, 2409, 2411, 2413, 2415, + 2417, 2421, 2424, 2424, 2426, 2426, 2430, 2431, 2433, 2435, + 2437, 2439, 2443, 2444, 2447, 2448, 2449, 2450, 2451, 2452, + 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, + 2463, 2464, 2465, 2466, 2469, 2470, 2471, 2472, 2473, 2474, + 2475, 2476, 2477, 2478, 2479, 2499, 2500, 2501, 2504, 2507, + 2508, 2508, 2523, 2524, 2541, 2541, 2551, 2552, 2552, 2551, + 2561, 2561, 2571, 2571, 2580, 2580, 2580, 2613, 2612, 2623, + 2624, 2624, 2623, 2633, 2651, 2651, 2656, 2656, 2661, 2661, + 2666, 2666, 2671, 2671, 2676, 2676, 2681, 2681, 2686, 2686, + 2691, 2691, 2708, 2708, 2722, 2759, 2797, 2834, 2835, 2842, + 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2853, 2854, + 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, + 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, + 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, + 2885, 2886, 2887, 2890, 2891, 2892, 2893, 2894, 2895, 2896, + 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, + 2907, 2908, 2909, 2910, 2911, 2914, 2915, 2916, 2917, 2918, + 2919, 2920, 2927, 2928, 2931, 2932, 2933, 2934, 2965, 2965, + 2966, 2967, 2968, 2969, 2970, 2993, 2994, 2996, 2997, 2998, + 3000, 3001, 3002, 3004, 3005, 3007, 3008, 3010, 3011, 3014, + 3015, 3018, 3019, 3020, 3024, 3023, 3037, 3037, 3041, 3041, + 3043, 3043, 3045, 3045, 3049, 3049, 3054, 3055, 3057, 3058, + 3061, 3062, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3071, + 3071, 3071, 3071, 3071, 3072, 3072, 3073, 3074, 3077, 3080, + 3083, 3086, 3086, 3086 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ID", "VTK_ID", "QT_ID", "StdString", + "UnicodeString", "OSTREAM", "ISTREAM", "LP", "LA", "STRING_LITERAL", + "INT_LITERAL", "HEX_LITERAL", "OCT_LITERAL", "FLOAT_LITERAL", + "CHAR_LITERAL", "ZERO", "STRUCT", "CLASS", "UNION", "ENUM", "PUBLIC", + "PRIVATE", "PROTECTED", "CONST", "VOLATILE", "MUTABLE", "STATIC", + "VIRTUAL", "EXPLICIT", "INLINE", "FRIEND", "EXTERN", "OPERATOR", + "TEMPLATE", "THROW", "TYPENAME", "TYPEDEF", "NAMESPACE", "USING", "NEW", + "DELETE", "STATIC_CAST", "DYNAMIC_CAST", "CONST_CAST", + "REINTERPRET_CAST", "OP_LSHIFT_EQ", "OP_RSHIFT_EQ", "OP_LSHIFT", + "OP_RSHIFT", "OP_DOT_POINTER", "OP_ARROW_POINTER", "OP_ARROW", "OP_INCR", + "OP_DECR", "OP_PLUS_EQ", "OP_MINUS_EQ", "OP_TIMES_EQ", "OP_DIVIDE_EQ", + "OP_REMAINDER_EQ", "OP_AND_EQ", "OP_OR_EQ", "OP_XOR_EQ", "OP_LOGIC_AND", + "OP_LOGIC_OR", "OP_LOGIC_EQ", "OP_LOGIC_NEQ", "OP_LOGIC_LEQ", + "OP_LOGIC_GEQ", "ELLIPSIS", "DOUBLE_COLON", "OTHER", "VOID", "BOOL", + "FLOAT", "DOUBLE", "INT", "SHORT", "LONG", "INT64__", "CHAR", "SIGNED", + "UNSIGNED", "SSIZE_T", "SIZE_T", "IdType", "TypeInt8", "TypeUInt8", + "TypeInt16", "TypeUInt16", "TypeInt32", "TypeUInt32", "TypeInt64", + "TypeUInt64", "TypeFloat32", "TypeFloat64", "SetMacro", "GetMacro", + "SetStringMacro", "GetStringMacro", "SetClampMacro", "SetObjectMacro", + "GetObjectMacro", "BooleanMacro", "SetVector2Macro", "SetVector3Macro", + "SetVector4Macro", "SetVector6Macro", "GetVector2Macro", + "GetVector3Macro", "GetVector4Macro", "GetVector6Macro", + "SetVectorMacro", "GetVectorMacro", "ViewportCoordinateMacro", + "WorldCoordinateMacro", "TypeMacro", "VTK_BYTE_SWAP_DECL", "';'", "'{'", + "'}'", "'='", "':'", "','", "'('", "')'", "'<'", "'>'", "'['", "']'", + "'~'", "'&'", "'*'", "'%'", "'/'", "'-'", "'+'", "'!'", "'|'", "'^'", + "'.'", "$accept", "translation_unit", "opt_declaration_seq", "$@1", + "declaration", "template_declaration", "linkage_specification", + "namespace_definition", "$@2", "namespace_alias_definition", + "forward_declaration", "simple_forward_declaration", "class_definition", + "class_specifier", "$@3", "class_head", "$@4", "$@5", "class_key", + "member_specification", "$@6", "member_access_specifier", + "member_declaration", "template_member_declaration", + "friend_declaration", "opt_base_clause", "base_clause", + "base_specifier_list", "base_specifier", "opt_virtual", + "opt_access_specifier", "access_specifier", "enum_definition", + "enum_specifier", "$@7", "enum_head", "opt_enumerator_list", + "enumerator_list", "enumerator_definition", "$@8", + "nested_variable_initialization", "ignored_class", "ignored_class_body", + "typedef_declaration", "basic_typedef_declaration", + "typedef_declarator_list", "typedef_declarator_list_cont", + "typedef_declarator", "typedef_direct_declarator", + "function_direct_declarator", "$@9", "$@10", "typedef_declarator_id", + "using_declaration", "using_id", "using_directive", "template_head", + "$@11", "template_parameter_list", "$@12", "template_parameter", "$@13", + "$@14", "$@15", "$@16", "$@17", "$@18", "$@19", "class_or_typename", + "opt_template_parameter_initializer", "template_parameter_initializer", + "$@20", "template_parameter_value", "function_definition", + "function_declaration", "nested_method_declaration", + "nested_operator_declaration", "method_definition", "method_declaration", + "operator_declaration", "conversion_function", "$@21", "$@22", + "conversion_function_id", "operator_function_nr", "$@23", + "operator_function_sig", "$@24", "operator_function_id", "operator_sig", + "function_nr", "function_trailer_clause", "function_trailer", "$@25", + "function_body", "function_sig", "$@26", "function_name", + "structor_declaration", "$@27", "$@28", "structor_sig", "$@29", + "opt_ctor_initializer", "mem_initializer_list", "mem_initializer", + "parameter_declaration_clause", "$@30", "parameter_list", "$@31", + "parameter_declaration", "$@32", "$@33", "opt_initializer", + "initializer", "$@34", "variable_declaration", "init_declarator_id", + "opt_declarator_list", "declarator_list_cont", "$@35", "init_declarator", + "opt_ptr_operator_seq", "direct_abstract_declarator", "$@36", + "direct_declarator", "$@37", "p_or_lp_or_la", "lp_or_la", + "opt_array_or_parameters", "$@38", "$@39", "function_qualifiers", + "abstract_declarator", "declarator", "opt_declarator_id", + "declarator_id", "bitfield_size", "opt_array_decorator_seq", + "array_decorator_seq", "$@40", "array_decorator_seq_impl", + "array_decorator", "$@41", "array_size_specifier", "$@42", + "id_expression", "unqualified_id", "qualified_id", + "nested_name_specifier", "$@43", "identifier_sig", "scope_operator_sig", + "template_id", "$@44", "simple_id", "identifier", + "opt_decl_specifier_seq", "decl_specifier2", "decl_specifier_seq", + "decl_specifier", "storage_class_specifier", "function_specifier", + "cv_qualifier", "cv_qualifier_seq", "store_type", "store_type_specifier", + "$@45", "$@46", "type_specifier", "$@47", "tparam_type", + "tparam_type_specifier2", "$@48", "$@49", "tparam_type_specifier", + "simple_type_specifier", "type_name", "primitive_type", + "ptr_operator_seq", "reference", "pointer", "$@50", "pointer_seq", + "declaration_macro", "$@51", "$@52", "$@53", "$@54", "$@55", "$@56", + "$@57", "$@58", "$@59", "$@60", "$@61", "$@62", "$@63", "$@64", "$@65", + "$@66", "$@67", "$@68", "$@69", "$@70", "$@71", "$@72", "opt_comma", + "operator_id", "operator_id_no_delim", "keyword", "literal", + "constant_expression", "common_bracket_item", "any_bracket_contents", + "bracket_pitem", "any_bracket_item", "braces_item", + "angle_bracket_contents", "braces_contents", "angle_bracket_pitem", + "angle_bracket_item", "angle_brackets_sig", "$@73", "brackets_sig", + "$@74", "parentheses_sig", "$@75", "$@76", "$@77", "braces_sig", "$@78", + "ignored_items", "ignored_expression", "ignored_item", + "ignored_item_no_semi", "ignored_braces", "ignored_brackets", + "ignored_parentheses", "ignored_left_parenthesis", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 59, 123, 125, 61, 58, 44, 40, 41, 60, 62, + 91, 93, 126, 38, 42, 37, 47, 45, 43, 33, + 124, 94, 46 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 143, 144, 145, 146, 145, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 148, 148, 148, 148, 149, 150, 151, 150, 152, + 153, 153, 154, 154, 155, 155, 157, 156, 159, 158, + 160, 158, 161, 161, 161, 162, 163, 162, 162, 164, + 164, 164, 165, 165, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 166, 166, 167, 167, 167, + 167, 168, 168, 169, 170, 170, 171, 171, 171, 172, + 172, 173, 173, 174, 174, 174, 175, 175, 177, 176, + 178, 178, 179, 179, 180, 180, 180, 181, 182, 181, + 183, 184, 184, 184, 184, 185, 185, 186, 186, 187, + 187, 187, 187, 187, 188, 189, 189, 190, 191, 191, + 193, 194, 192, 195, 196, 197, 197, 197, 197, 197, + 197, 198, 199, 200, 199, 201, 202, 201, 204, 205, + 203, 206, 207, 203, 208, 209, 210, 203, 211, 211, + 212, 212, 214, 213, 215, 215, 216, 216, 216, 216, + 217, 218, 218, 218, 219, 219, 219, 220, 220, 220, + 221, 221, 221, 221, 222, 222, 222, 224, 225, 223, + 226, 228, 227, 230, 229, 231, 232, 233, 234, 234, + 236, 235, 235, 235, 237, 237, 239, 238, 240, 240, + 242, 243, 241, 245, 244, 246, 246, 247, 247, 248, + 249, 250, 249, 251, 252, 251, 251, 254, 255, 253, + 256, 256, 258, 257, 259, 260, 261, 261, 262, 263, + 262, 264, 265, 265, 266, 267, 266, 268, 269, 268, + 270, 270, 270, 271, 271, 272, 273, 274, 272, 272, + 275, 275, 275, 275, 276, 276, 277, 277, 278, 278, + 279, 279, 280, 280, 280, 281, 281, 283, 282, 284, + 284, 286, 285, 287, 288, 287, 289, 289, 290, 290, + 291, 291, 291, 292, 292, 292, 292, 293, 292, 294, + 295, 297, 296, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + 299, 299, 299, 299, 299, 299, 299, 300, 300, 301, + 301, 301, 301, 302, 302, 303, 303, 303, 304, 304, + 304, 304, 305, 305, 305, 306, 306, 307, 307, 308, + 310, 309, 311, 309, 312, 313, 312, 312, 312, 312, + 312, 314, 316, 315, 317, 315, 318, 318, 318, 318, + 318, 318, 319, 319, 320, 320, 320, 320, 320, 320, + 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, + 320, 320, 320, 320, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 322, 322, 322, 323, 324, + 325, 324, 326, 326, 328, 327, 329, 330, 331, 327, + 332, 327, 333, 327, 334, 335, 327, 336, 327, 337, + 338, 339, 327, 327, 340, 327, 341, 327, 342, 327, + 343, 327, 344, 327, 345, 327, 346, 327, 347, 327, + 348, 327, 349, 327, 327, 327, 327, 350, 350, 351, + 351, 351, 351, 351, 351, 351, 351, 351, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + 352, 352, 352, 353, 353, 353, 353, 353, 353, 353, + 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, + 353, 353, 353, 353, 353, 354, 354, 354, 354, 354, + 354, 354, 355, 355, 356, 356, 356, 356, 356, 356, + 356, 356, 356, 356, 356, 357, 357, 358, 358, 358, + 359, 359, 359, 360, 360, 361, 361, 362, 362, 363, + 363, 364, 364, 364, 366, 365, 368, 367, 370, 369, + 371, 369, 372, 369, 374, 373, 375, 375, 376, 376, + 377, 377, 378, 378, 378, 378, 378, 378, 378, 378, + 378, 378, 378, 378, 378, 378, 378, 378, 379, 380, + 381, 382, 382, 382 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 0, 3, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 2, 2, 2, 2, 5, 4, 0, 6, 5, + 1, 2, 3, 4, 4, 5, 0, 5, 0, 4, + 0, 3, 1, 1, 1, 0, 0, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, + 3, 0, 1, 2, 1, 3, 1, 3, 3, 0, + 1, 0, 1, 1, 1, 1, 4, 5, 0, 5, + 2, 1, 0, 1, 1, 2, 3, 1, 0, 4, + 6, 3, 4, 2, 3, 5, 3, 1, 2, 5, + 5, 6, 5, 6, 2, 0, 3, 2, 1, 1, + 0, 0, 7, 1, 3, 1, 2, 2, 2, 3, + 3, 4, 3, 0, 5, 1, 0, 4, 0, 0, + 5, 0, 0, 5, 0, 0, 0, 7, 1, 1, + 0, 1, 0, 3, 1, 2, 2, 2, 2, 2, + 2, 3, 2, 3, 2, 3, 3, 2, 3, 4, + 2, 1, 1, 2, 1, 2, 2, 0, 0, 7, + 2, 0, 3, 0, 5, 2, 1, 2, 0, 2, + 0, 3, 1, 2, 3, 1, 0, 5, 1, 1, + 0, 0, 5, 0, 5, 0, 2, 1, 3, 2, + 0, 0, 2, 1, 0, 4, 3, 0, 0, 5, + 0, 1, 0, 3, 4, 2, 0, 2, 0, 0, + 4, 2, 0, 1, 2, 0, 5, 2, 0, 5, + 1, 1, 1, 1, 1, 0, 0, 0, 6, 1, + 0, 2, 2, 3, 1, 2, 1, 2, 0, 1, + 1, 3, 1, 1, 1, 0, 1, 0, 2, 1, + 2, 0, 4, 0, 0, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 3, 3, 0, 5, 1, + 1, 0, 5, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, + 0, 3, 0, 4, 1, 0, 3, 1, 1, 2, + 2, 2, 0, 3, 0, 4, 1, 1, 1, 2, + 2, 2, 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, 2, 1, 1, + 0, 3, 1, 2, 0, 7, 0, 0, 0, 9, + 0, 5, 0, 5, 0, 0, 10, 0, 7, 0, + 0, 0, 9, 6, 0, 7, 0, 7, 0, 7, + 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, + 0, 9, 0, 9, 4, 4, 7, 0, 1, 2, + 2, 3, 3, 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, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, + 1, 1, 1, 1, 0, 4, 0, 4, 0, 4, + 0, 4, 0, 4, 0, 4, 0, 2, 0, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 3, 1, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 3, 0, 4, 1, 0, 378, 379, 380, 374, 375, + 376, 377, 43, 42, 44, 91, 345, 346, 338, 341, + 343, 344, 342, 339, 186, 0, 355, 0, 0, 0, + 290, 394, 395, 396, 397, 399, 400, 401, 402, 398, + 403, 404, 381, 382, 393, 383, 384, 385, 386, 387, + 388, 389, 390, 391, 392, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 20, 0, 5, 17, + 11, 9, 10, 8, 30, 15, 327, 36, 40, 14, + 327, 0, 12, 107, 7, 6, 0, 16, 0, 0, + 0, 0, 174, 0, 0, 13, 0, 276, 358, 0, + 0, 0, 357, 278, 289, 0, 333, 335, 336, 337, + 0, 232, 350, 354, 373, 372, 18, 295, 293, 294, + 298, 299, 297, 296, 308, 307, 319, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 360, 277, 0, + 279, 340, 133, 0, 378, 379, 380, 374, 375, 376, + 377, 339, 381, 382, 393, 383, 384, 385, 386, 387, + 388, 389, 390, 391, 392, 327, 40, 327, 358, 357, + 0, 0, 320, 322, 321, 325, 326, 324, 323, 576, + 27, 0, 0, 0, 125, 0, 0, 0, 416, 420, + 422, 0, 0, 429, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 302, 300, + 301, 305, 306, 304, 303, 232, 0, 71, 359, 232, + 88, 0, 24, 31, 21, 23, 0, 22, 0, 0, + 195, 576, 156, 158, 159, 157, 177, 0, 0, 180, + 19, 287, 164, 0, 162, 200, 280, 0, 279, 278, + 283, 281, 282, 284, 291, 327, 40, 327, 108, 175, + 0, 334, 352, 243, 244, 176, 181, 0, 0, 160, + 188, 0, 228, 220, 0, 265, 0, 199, 260, 408, + 409, 349, 233, 405, 412, 406, 327, 279, 3, 132, + 138, 356, 340, 232, 359, 232, 327, 327, 295, 293, + 294, 298, 299, 297, 296, 123, 119, 115, 118, 265, + 260, 0, 0, 0, 126, 0, 124, 128, 127, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 332, 331, 0, 228, 0, 328, 329, 330, + 45, 0, 41, 72, 32, 71, 0, 92, 360, 0, + 0, 198, 0, 211, 359, 0, 203, 205, 285, 286, + 555, 232, 359, 232, 165, 163, 327, 188, 183, 478, + 479, 480, 481, 482, 483, 484, 485, 486, 492, 493, + 487, 488, 489, 490, 491, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 466, 465, 0, 463, 464, 0, + 474, 475, 469, 468, 470, 471, 472, 473, 476, 477, + 185, 467, 187, 196, 0, 222, 225, 221, 256, 0, + 0, 237, 266, 0, 166, 161, 199, 0, 0, 407, + 413, 351, 4, 0, 135, 0, 0, 0, 0, 115, + 0, 0, 232, 232, 0, 120, 378, 379, 380, 374, + 375, 376, 377, 602, 603, 530, 526, 527, 525, 528, + 529, 531, 506, 505, 507, 519, 509, 511, 510, 512, + 513, 515, 514, 516, 518, 508, 520, 504, 503, 517, + 478, 479, 523, 522, 521, 524, 586, 585, 597, 581, + 576, 26, 592, 588, 593, 601, 590, 591, 576, 589, + 596, 587, 594, 595, 577, 580, 582, 584, 583, 576, + 0, 0, 3, 131, 130, 129, 414, 0, 0, 0, + 424, 427, 0, 0, 434, 438, 442, 446, 436, 440, + 444, 448, 450, 452, 454, 455, 0, 34, 227, 231, + 46, 83, 84, 85, 81, 73, 74, 79, 76, 39, + 86, 0, 93, 94, 97, 198, 194, 0, 217, 0, + 0, 211, 0, 201, 0, 0, 33, 0, 353, 182, + 211, 0, 0, 459, 460, 192, 190, 0, 189, 211, + 224, 229, 0, 238, 257, 271, 268, 269, 263, 264, + 262, 261, 347, 411, 25, 136, 134, 0, 0, 0, + 368, 367, 0, 258, 232, 362, 366, 148, 149, 258, + 0, 110, 114, 117, 112, 0, 0, 109, 232, 211, + 0, 0, 0, 29, 4, 0, 417, 421, 423, 0, + 0, 430, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 457, 49, 50, 51, 37, 0, 0, + 0, 82, 0, 80, 0, 89, 95, 98, 578, 178, + 212, 213, 0, 288, 0, 206, 207, 0, 188, 570, + 572, 540, 574, 562, 538, 563, 568, 564, 292, 566, + 539, 544, 543, 537, 541, 542, 560, 561, 556, 559, + 534, 535, 536, 35, 87, 0, 461, 462, 0, 193, + 0, 232, 548, 549, 223, 547, 532, 245, 274, 270, + 348, 138, 369, 370, 371, 364, 241, 242, 240, 139, + 258, 265, 259, 361, 327, 142, 145, 111, 113, 116, + 0, 598, 599, 600, 28, 0, 0, 425, 0, 0, + 433, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 458, 0, 0, 0, 0, 64, 53, 58, 47, + 60, 54, 57, 55, 52, 0, 59, 0, 171, 172, + 56, 0, 0, 357, 0, 0, 61, 48, 77, 75, + 78, 96, 0, 0, 188, 214, 258, 204, 0, 209, + 202, 545, 545, 557, 545, 555, 545, 184, 191, 197, + 230, 533, 246, 239, 249, 0, 0, 137, 327, 150, + 254, 0, 258, 234, 363, 150, 258, 121, 415, 418, + 0, 428, 431, 435, 439, 443, 447, 437, 441, 445, + 449, 0, 0, 456, 69, 0, 67, 0, 0, 357, + 0, 0, 62, 65, 66, 0, 167, 63, 0, 173, + 0, 170, 199, 99, 100, 579, 179, 216, 217, 218, + 208, 0, 0, 0, 0, 0, 0, 211, 272, 275, + 365, 152, 140, 151, 235, 255, 143, 146, 250, 0, + 578, 0, 0, 0, 576, 578, 103, 359, 0, 68, + 0, 70, 0, 168, 0, 215, 220, 551, 552, 571, + 550, 546, 573, 554, 575, 553, 558, 569, 565, 567, + 0, 0, 245, 150, 122, 419, 0, 432, 451, 453, + 0, 0, 101, 0, 0, 104, 359, 169, 219, 247, + 153, 154, 236, 147, 252, 251, 0, 426, 578, 106, + 0, 102, 250, 155, 253, 0, 248, 105 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 2, 4, 78, 232, 80, 81, 323, 82, + 83, 84, 234, 86, 226, 87, 365, 227, 247, 560, + 668, 669, 779, 780, 781, 362, 363, 565, 566, 674, + 670, 567, 89, 90, 367, 91, 571, 572, 573, 802, + 235, 856, 906, 92, 93, 458, 464, 459, 315, 316, + 639, 898, 317, 94, 193, 95, 236, 300, 453, 731, + 454, 455, 829, 456, 835, 457, 836, 933, 629, 892, + 893, 931, 950, 237, 98, 99, 100, 786, 787, 101, + 102, 373, 804, 103, 275, 387, 276, 590, 277, 104, + 279, 432, 598, 718, 242, 280, 599, 253, 789, 377, + 688, 255, 581, 583, 685, 686, 577, 578, 680, 878, + 681, 682, 916, 436, 437, 602, 105, 282, 354, 434, + 721, 355, 356, 739, 932, 283, 727, 740, 284, 823, + 887, 962, 934, 831, 439, 741, 742, 611, 441, 442, + 443, 606, 607, 728, 825, 826, 194, 107, 178, 149, + 375, 110, 111, 179, 380, 113, 114, 225, 357, 248, + 116, 117, 118, 119, 613, 239, 121, 296, 386, 122, + 153, 623, 624, 744, 828, 625, 123, 124, 125, 292, + 293, 294, 448, 295, 126, 645, 332, 756, 899, 333, + 334, 649, 840, 650, 337, 759, 901, 653, 657, 654, + 658, 655, 659, 656, 660, 661, 662, 772, 430, 703, + 704, 705, 724, 725, 881, 920, 921, 926, 584, 883, + 707, 708, 709, 815, 710, 816, 711, 814, 811, 812, + 712, 813, 321, 803, 524, 525, 526, 527, 528, 529 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -872 +static const yytype_int16 yypact[] = +{ + -872, 77, 87, -872, 4255, 167, 191, 227, 280, 300, + 301, 304, -872, -872, -872, 4899, -872, -872, -872, -872, + -872, -872, -872, 98, -872, -8, -872, 5429, 383, 4624, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -38, 106, 121, 122, 133, 158, 171, 186, + 196, 203, 210, 228, 243, -3, 36, 43, 45, 90, + 114, 130, 138, 151, 179, 183, 187, 202, 215, 233, + 235, 249, 258, 267, 269, 271, -872, 438, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, 4899, -872, + -872, 21, -872, -872, -872, -872, 5144, -872, -71, -71, + -71, -71, -872, 281, 5524, -872, 54, -872, 284, 4742, + 350, 4899, -25, -872, 297, 5239, -872, -872, -872, -872, + 4672, 276, -872, -872, -872, -872, -872, -10, 9, 18, + 50, 52, 148, 166, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, 310, -872, 4921, + 350, 312, 321, 4899, -10, 9, 18, 50, 52, 148, + 166, 441, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, 4899, -872, -872, 350, + 5429, 4790, -872, -872, -872, -872, -872, -872, -872, -872, + 332, 4899, 4899, 337, -872, 4742, 4899, 4529, -872, -872, + -872, 4529, 4529, -872, 4529, 4529, 4529, 4529, 4529, 4529, + 4529, 4529, 4529, 4529, 4529, 4529, 4529, 4529, -872, -872, + -872, -872, -872, -872, -872, 1286, 343, 348, 259, 1286, + -872, 4899, -872, -872, -872, -872, 5144, -872, 5334, 4947, + -872, -872, -872, -872, -872, -872, -872, 4899, 5524, -872, + -872, -872, -872, 360, -872, -872, -872, 350, -13, 362, + -872, -872, -872, -872, -872, -872, 4899, -872, -872, -872, + 4742, -872, -872, -872, -872, -872, -872, 363, 5071, -872, + -872, 370, -872, 377, 1478, 372, 4742, 350, 15, -872, + 435, -872, -872, -872, -872, 276, -872, 350, -872, -872, + 73, -872, -872, 5028, 177, 5028, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, 107, + 379, 1212, 409, 384, -872, 386, -872, -872, -872, 1383, + 4742, 387, 4529, 4529, 4529, 388, 389, 4529, 390, 391, + 392, 393, 397, 398, 399, 401, 402, 403, 405, 404, + 406, 407, -872, -872, 414, -872, 4790, -872, -872, -872, + -872, 1111, -872, -872, -872, 348, 415, 4529, -872, 5334, + 4742, -872, 1617, 424, -872, 471, -872, 412, -872, -872, + -872, 1286, 278, 1286, -872, -872, -872, -872, -872, 381, + 423, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, 428, -872, -872, 411, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, 41, -872, 212, -872, -872, -872, -872, 429, + 4790, -872, -872, 427, -872, -872, 350, 470, 440, -872, + -872, 4121, 436, 11, -872, 5560, 88, 524, 442, -872, + 4790, 443, 5028, 5028, 224, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + 444, 350, -872, -872, -872, -872, -872, 445, 434, 439, + -872, -872, 446, 5524, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, 4529, -872, 447, -872, + 48, -872, -872, -872, 485, 448, -872, 535, -872, -872, + -872, 452, 451, -872, 456, 457, -872, 454, -872, 350, + 297, 424, 4899, -872, 3577, 449, -872, 462, 4121, 41, + 424, 437, 453, -872, -872, -872, -872, 549, -872, 424, + -872, -872, 3857, -872, -872, -872, 427, -872, -872, -872, + -872, -872, -872, 440, -872, -872, -872, 4899, 4899, 4899, + -872, 350, 5524, 4694, 276, -872, -872, -872, -872, 4694, + 563, -872, 461, -872, -872, 467, 468, -872, 276, 424, + 1757, 1897, 2037, -872, 472, 5524, -872, -872, -872, 5524, + 5524, -872, 463, 5524, 5524, 5524, 5524, 5524, 5524, 5524, + 5524, 5524, 5524, 464, -872, -872, -872, -872, 4137, 469, + 4899, -872, 1111, -872, 4899, -872, 4529, -872, -872, -872, + 473, -872, 5524, -872, 474, 475, -872, 58, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, 477, -872, -872, 92, -872, + 478, 276, -872, -872, 3857, -872, -872, 160, 465, -872, + -872, 73, -872, -872, -872, -872, -872, -872, -872, -872, + 969, 372, -872, -872, -872, -872, -872, -872, -872, -872, + 479, -872, -872, -872, -872, 480, 5524, -872, 481, 5524, + -872, 482, 483, 484, 489, 490, 491, 492, 496, 487, + 499, -872, 498, 4373, 4851, 58, -872, -872, -872, -872, + -872, -872, -872, -872, -872, 4563, -872, -71, -872, -872, + -872, 506, 4742, 129, 4468, 4672, -872, -872, -872, -872, + -872, -872, 3857, 2317, -872, 526, 4694, -872, 4899, -872, + 41, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, 497, 3857, -872, -872, 504, + -872, 502, 4694, -872, 4121, 504, 4694, -872, -872, -872, + 508, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, 622, 623, -872, -872, 4720, -872, 518, -71, -13, + 4563, 4947, -872, -872, -872, 4563, -872, -872, 520, -872, + 4742, -872, -872, 3857, -872, -872, 41, -872, -872, -872, + -872, 3017, 3157, 2877, 3297, 3717, 3437, 424, -872, 3857, + 4121, -872, -872, -872, -872, -872, -872, -872, -872, 514, + -872, 515, 516, 519, -872, -872, -872, 328, 4720, -872, + 518, -872, 4720, -872, 527, -872, 377, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + 521, 3997, 160, 504, 93, -872, 2457, -872, -872, -872, + 2177, 2597, -872, 328, 4720, -872, 339, -872, -872, -872, + 3997, -872, -872, -872, -872, -872, 58, -872, -872, -872, + 339, -872, -872, -872, -872, 2737, 93, -872 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -872, -872, -260, -872, -872, 645, -872, -872, -872, -872, + -613, -94, 1, -26, -872, -872, -872, -872, 16, -872, + -872, -872, -872, -872, -872, 285, -872, -872, -20, -872, + -872, 89, -17, -21, -872, -872, -872, -872, -22, -872, + -872, -202, -473, -9, -102, -249, 199, 22, -872, -872, + -872, -872, 201, -6, -872, -872, -1, -872, -872, -872, + -66, -872, -872, -872, -872, -872, -872, -872, -872, -770, + -872, -872, -872, 668, -872, -872, -872, -111, -97, -576, + -80, -872, -872, -154, -241, -872, -872, -872, -155, 35, + -270, -364, -872, -872, -91, -872, -872, -105, -67, -872, + -872, -872, -872, -872, -872, -129, -542, -872, -872, -872, + -198, -872, -872, -230, -872, -872, 20, 333, -166, 338, + -872, -5, -95, -575, -872, -157, -872, -872, -872, -237, + -872, -872, -261, -872, -872, -872, -98, -872, -29, -696, + -872, -872, 112, -872, -872, -872, 13, -45, 3, 32, + -872, -63, 23, -4, -872, 754, -24, 8, -872, 10, + -81, -872, -872, -415, -872, 49, -872, -872, -872, -19, + -872, -872, -872, -872, -872, -872, -121, -391, 194, -272, + 425, 430, -872, -872, 51, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -204, + -302, 82, -751, -554, -456, -581, -153, -872, -89, -872, + -871, -872, -872, -872, -872, -872, 17, -872, -872, -872, + -872, -872, -183, -820, -872, -759, -872, -872, -660, -872 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -411 +static const yytype_int16 yytable[] = +{ + 112, 175, 233, 96, 190, 85, 177, 108, 243, 244, + 245, 150, 440, 268, 115, 281, 445, 106, 148, 522, + 88, 726, 285, 589, 318, 150, 291, 809, 147, 252, + 706, 824, 148, 612, 271, 269, 109, 180, 452, 684, + 328, 327, 254, 176, 875, 444, 257, 30, 715, 240, + 241, 873, 196, 120, 745, 777, 461, 720, 372, 30, + 951, 195, -320, 366, 256, 896, 261, 595, 473, 474, + 522, 664, 665, 666, 431, 889, 181, 3, 596, 963, + 936, -322, -308, 319, 150, 941, 257, -2, -308, 265, + -321, 148, 788, -141, 267, -279, 272, 750, 229, 271, + 445, 228, 689, 690, 256, 258, 238, 150, 627, -144, + 151, -141, 88, -199, 262, 862, 287, 521, -320, 954, + 152, 955, -325, 197, -326, 431, 628, 438, 109, 444, + 956, 266, 257, 260, 281, 263, 615, -322, 965, 447, + 616, -198, 230, 821, 358, 297, -321, 270, 358, 150, + 256, 261, 286, 249, 306, 278, 148, 271, 269, 307, + 854, 272, 198, 953, 597, 830, 301, 271, 521, 199, + 667, 200, 150, 263, 250, 535, 534, 875, -325, 148, + -326, 281, 875, 303, 515, 305, 285, 150, 150, 304, + 384, 297, 150, 701, 148, 148, 176, 788, 730, 262, + 520, 30, 263, 385, 324, 325, 875, 257, 460, 788, + 460, 701, 265, 635, 636, 585, 201, 587, 696, 272, + -324, 726, 358, 257, 358, 256, -307, 150, 330, 272, + 329, 879, -307, 465, 148, 287, 824, -267, -323, -320, + 202, -319, -309, 150, 368, 726, 369, -319, -309, -279, + 148, 520, 176, -310, 266, -199, 203, 895, 285, -310, + 374, 897, 150, -322, 204, 281, 258, 257, 109, 148, + 270, 370, 644, 381, 278, 383, -324, 205, -311, 382, + 378, 379, 446, 604, -311, 256, 822, -295, 271, 269, + -267, -312, 821, -295, -323, -320, 964, -312, -38, -321, + 358, -38, 358, 318, 451, 206, -313, 257, 821, 207, + 263, -293, -313, 208, 462, 463, -314, -293, 531, -322, + 379, 278, -314, -315, 810, 530, 297, 640, 209, -315, + -316, 706, 600, 701, 626, 641, -316, 601, 522, 522, + 522, 210, 285, 265, 637, 930, 642, -294, -317, 638, + 272, 580, -325, -294, -317, -321, 882, 150, 884, 211, + 886, 212, 319, -318, 148, 329, 446, 460, 460, -318, + 358, 579, -326, -324, 568, 213, -323, 706, 249, 364, + -38, 358, 358, -38, 214, 176, 182, 183, 184, 185, + 186, 187, 188, 215, 588, 216, 706, 217, 586, -38, + -298, 270, -38, 523, -277, 278, -298, 246, -325, 289, + 290, 701, 182, 183, 184, 185, 186, 187, 188, 359, + -299, -297, 30, 359, -296, 264, -299, -297, -326, -324, + -296, -90, -323, 298, 942, 701, 521, 521, 521, 945, + 876, 218, 219, 220, 221, 222, 223, 224, 364, 904, + 299, 621, 905, 302, 523, 322, 630, 326, 620, 586, + 904, -410, -410, 905, 360, 622, 16, 17, 832, 379, + 942, 945, 361, 961, 182, 183, 184, 185, 186, 187, + 188, 30, 701, 608, 609, 610, 376, 961, -198, 388, + 701, 701, 701, 701, 701, 701, 433, 359, 701, 359, + 435, 522, -267, 447, 189, 532, 533, 358, 561, 562, + 563, 591, 536, 540, 541, 543, 544, 545, 546, 520, + 520, 520, 547, 548, 549, 871, 550, 551, 552, 743, + 553, 554, 556, 555, 557, 570, 582, 12, 13, 14, + 701, 271, 594, 460, 16, 17, 18, 19, 20, 21, + 22, -210, 161, 592, 263, 593, 603, 605, 614, 701, + 25, 647, 631, 634, 643, 673, 648, 719, 716, 713, + 646, 651, 601, 672, 675, 359, 676, 359, 150, 677, + 678, 679, 714, 746, 717, 148, 638, 747, 748, 771, + 760, 871, 652, 797, 754, 687, -273, 877, 805, 521, + 808, 807, 683, 735, 817, 819, 837, 838, 841, 843, + 844, 845, 851, 150, 150, 150, 846, 847, 848, 849, + 148, 148, 148, 850, 852, 853, 867, 891, 888, 894, + 732, 733, 734, 900, 522, 902, 903, 868, 522, 522, + 913, 935, 937, 938, 263, 359, 939, 947, 949, 79, + 569, 782, 799, 671, 801, 909, 359, 359, 632, 783, + 749, 633, 784, 522, 793, 827, 150, 785, 150, 778, + 150, 108, 97, 148, 864, 148, 858, 148, 794, 880, + 915, 791, 520, 798, 88, 568, 948, 800, 790, 559, + 281, 233, 268, 558, 755, 952, 866, 285, 757, 758, + 792, 966, 761, 762, 763, 764, 765, 766, 767, 768, + 769, 770, 833, 271, 269, 914, 820, 795, 729, 796, + 449, 940, 523, 523, 523, 450, 885, 869, 0, 257, + 925, 806, 521, 0, 0, 818, 521, 521, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 256, 0, 0, + 0, 0, 834, 358, 0, 0, 281, 0, 0, 0, + 0, 521, 0, 233, 0, 0, 0, 911, 265, 859, + 150, 580, 857, 267, 0, 272, 0, 148, 702, 271, + 269, 859, 359, 860, 271, 269, 863, 0, 297, 855, + 859, 872, 0, 869, 0, 865, 702, 196, 869, 0, + 0, 88, 0, 0, 150, 839, 195, 257, 842, 358, + 266, 148, 0, 0, 0, 520, 263, 792, 0, 520, + 520, 687, 861, 0, 0, 256, 870, 278, 0, 271, + 278, 0, 0, 0, 861, 0, 890, 580, 0, 265, + 0, 272, 0, 0, 520, 0, 272, 0, 0, 0, + 0, 150, 0, 0, 0, 0, 859, 872, 148, 0, + 0, 859, 0, 259, 0, 0, 297, 910, 907, 0, + 0, 0, 0, 908, 288, 0, 912, 0, 0, 0, + 0, 266, 263, 0, 0, 523, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 278, 870, 0, 0, + 0, 0, 0, 0, 150, 278, 0, 0, 150, 0, + 0, 148, 0, 0, 0, 148, 0, 0, 702, 0, + 0, 943, 0, 0, 0, 946, 944, 0, 0, 0, + 0, 0, 0, 0, 0, 320, 0, 0, 0, 0, + 150, 0, 0, 0, 0, 0, 0, 148, 0, 0, + 0, 331, 0, 0, 0, 335, 336, 960, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, + 350, 351, 308, 309, 310, 311, 312, 313, 314, 736, + 737, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 371, 0, 0, 702, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 523, 0, + 702, 0, 523, 523, 259, 0, 0, 0, 359, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 320, 0, + 371, 0, 0, 0, 0, 0, 0, 523, 0, 0, + 0, 0, 0, 0, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 702, 0, 0, + 0, 0, 0, 0, 0, 702, 702, 702, 702, 702, + 702, 0, 0, 702, 359, 0, 537, 538, 539, 0, + 0, 542, 0, 0, 0, 738, 0, 0, 0, 0, + 0, 77, 289, 290, 0, 0, 0, 0, 0, 0, + 320, 0, 0, 0, 127, 128, 129, 130, 131, 132, + 133, 574, 0, 0, 575, 702, 0, 0, 0, 0, + 0, 0, 0, 0, 561, 562, 563, 0, 0, 0, + 0, 564, 0, 0, 702, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 320, 0, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, + 0, 0, 0, 0, 320, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, + 481, 482, 483, 484, 485, 486, 487, 488, 489, 0, + 0, 490, 491, 77, 492, 0, 493, 494, 495, 496, + 497, 498, 499, 0, 500, 501, 502, 503, 504, 505, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, + 411, 412, 413, 506, 507, 508, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 663, 0, 16, 17, 18, 19, 20, 21, 22, 352, + 161, 0, 0, 0, 0, 353, 0, 0, 0, 0, + 0, 0, 509, 510, 511, 512, 513, 514, 515, 0, + 516, 517, 518, 0, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 429, 519, 0, 0, 0, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 0, 0, 0, 0, 0, 0, 320, 0, 0, + 0, 0, 0, 320, 0, 0, 154, 155, 156, 157, + 158, 159, 160, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 14, 231, -226, 0, 0, 16, + 17, 18, 19, 20, 21, 22, 0, 161, 0, 289, + 290, 26, 259, 0, 0, 389, 390, 0, 0, 0, + 574, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 410, 411, 412, 413, 0, 30, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 308, 309, 310, 311, 312, 313, 314, 273, 274, + 0, 0, 0, 0, 320, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 414, 0, 415, 416, + 0, 417, 418, 419, 0, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 429, 0, 0, 371, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 371, + 0, 0, 0, 0, 0, 0, 0, 0, 371, 288, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 320, 0, 0, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 320, 0, 0, 0, + 320, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 289, 290, 0, 371, 371, 0, 0, 0, 371, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 509, 510, 576, + 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 509, 510, 751, + 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 509, 510, 0, + 512, 513, 514, 515, 0, 516, 517, 518, 752, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 509, 510, 0, + 512, 513, 514, 515, 753, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 509, 510, 958, + 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 874, 510, 0, + 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 510, 0, + 512, 513, 514, 515, 957, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 959, 510, 0, + 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 506, 507, + 508, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 967, 510, 0, + 512, 513, 514, 515, 0, 516, 517, 518, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 519, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 923, 692, 924, + 917, 694, 918, 696, 0, 722, 723, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 917, 694, 918, 696, 919, 722, 723, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 917, 694, 918, 696, 922, 722, 723, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 917, 694, 918, 696, 927, 722, 723, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 917, 694, 918, 696, 0, 722, 723, 699, 929, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 693, 694, 695, 696, 0, 697, 698, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 693, 694, 695, 696, 0, 697, 928, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 0, 694, 0, 696, 0, 722, 723, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 466, 467, 468, 469, 470, 471, 472, 689, 690, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 0, 0, 490, 491, 0, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 0, 500, + 501, 502, 503, 504, 505, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 691, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 692, 0, + 0, 694, 0, 696, 0, 697, 0, 699, 0, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, 700, + 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, + 19, 20, 21, 22, 352, 161, 12, 13, 14, 15, + 353, 0, 0, 16, 17, 18, 19, 20, 21, 22, + 773, 161, 24, 25, 0, 26, 27, 0, 774, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 0, 0, 0, 30, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 775, 776, 5, 6, + 7, 8, 9, 10, 11, 0, 0, 0, 0, 77, + 0, 0, 0, 0, 12, 13, 14, 15, 0, 0, + 0, 16, 17, 18, 19, 20, 21, 22, 0, 23, + 24, 25, 0, 26, 27, 28, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 30, 0, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 0, 76, 5, 6, 7, 8, + 9, 10, 11, 0, 0, 0, 0, 77, 0, 0, + 0, 0, 12, 13, 14, 231, 0, 0, 0, 16, + 17, 18, 19, 20, 21, 22, 0, 161, 24, 25, + 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 30, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 5, 6, 7, 8, 9, 10, 11, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, + 15, 0, 0, 0, 16, 17, 18, 19, 20, 21, + 22, 0, 161, 24, 0, 77, 26, 27, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 308, 309, 310, 311, 312, 313, 314, 0, + 30, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 5, 6, 7, 8, + 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 14, 231, 0, 0, 0, 16, + 17, 18, 19, 20, 21, 22, 0, 161, 24, 0, + 77, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 127, 128, 129, + 130, 131, 132, 133, 0, 30, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 77, 191, 0, 192, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 127, 128, 129, 130, 131, + 132, 133, 273, 274, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 77, 30, 308, 309, 310, + 311, 312, 313, 314, 736, 737, 0, 24, 0, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 0, 127, 128, 129, 130, 131, 132, 133, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 127, 128, 129, 130, 131, + 132, 133, 0, 0, 0, 0, 77, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 0, 0, 0, 0, 0, 0, 0, 24, 251, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 30, 308, 309, 310, 311, 312, 313, 314, + 273, 274, 0, 0, 77, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 0, 0, + 738, 0, 0, 0, 0, 0, 77, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 0, 904, 0, 0, 905, 0, 0, 0, 0, 0, + 0, 0, 77, 0, 127, 128, 129, 130, 131, 132, + 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 77, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 0, 191, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 127, 128, 129, 130, 131, 132, 133, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 77, 30, 127, 128, 129, 130, 131, 132, + 133, 0, 0, 0, 0, 0, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, + 127, 128, 129, 130, 131, 132, 133, 251, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 24, 77, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 77, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 0, 0, 0, 0, 0, + 0, 0, 0, 77, 16, 17, 18, 19, 20, 21, + 22, 352, 161, 0, 0, 0, 0, 353, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 389, 390, 0, 0, 0, 0, 391, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + 412, 413, 0, 0, 0, 0, 0, 154, 155, 156, + 157, 158, 159, 160, 0, 0, 0, 0, 0, 0, + 0, 289, 290, 12, 13, 14, 231, 0, 0, 0, + 16, 17, 18, 19, 20, 21, 22, 0, 161, 24, + 25, 0, 26, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 414, 0, 415, 416, 0, 417, + 418, 419, 0, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 429, 0, 0, 0, 30, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 154, 155, 156, 157, 158, 159, 160, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, + 14, 15, 0, 0, 0, 16, 17, 18, 19, 20, + 21, 22, 0, 161, 24, 0, 0, 26, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 30, 0, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 154, 155, 156, + 157, 158, 159, 160, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 13, 14, 231, 0, 0, 0, + 16, 17, 18, 19, 20, 21, 22, 0, 161, 24, + 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 154, 155, 156, 157, 158, 159, 160, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, + 14, 15, 0, 0, 0, 16, 17, 18, 19, 20, + 21, 22, 0, 161, 0, 0, 0, 26, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 30, 0, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 154, 155, 156, + 157, 158, 159, 160, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 13, 14, 231, 0, 0, 0, + 16, 17, 18, 19, 20, 21, 22, 0, 161, 0, + 0, 0, 26, 154, 155, 156, 157, 158, 159, 160, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 617, + 0, 618, 619, 0, 0, 0, 16, 17, 18, 19, + 20, 21, 22, 0, 161, 0, 30, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 30, 0, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174 +}; + +static const yytype_int16 yycheck[] = +{ + 4, 27, 96, 4, 28, 4, 27, 4, 99, 100, + 101, 15, 284, 115, 4, 120, 286, 4, 15, 321, + 4, 602, 120, 387, 181, 29, 121, 687, 15, 109, + 584, 727, 29, 448, 115, 115, 4, 27, 298, 581, + 195, 195, 109, 27, 803, 286, 109, 72, 590, 120, + 121, 802, 29, 4, 629, 668, 305, 599, 241, 72, + 931, 29, 72, 229, 109, 835, 111, 26, 10, 11, + 372, 23, 24, 25, 278, 826, 27, 0, 37, 950, + 900, 72, 120, 181, 88, 905, 149, 0, 126, 115, + 72, 88, 668, 20, 115, 120, 115, 639, 90, 180, + 370, 88, 10, 11, 149, 109, 96, 111, 20, 36, + 12, 38, 96, 126, 111, 775, 120, 321, 128, 26, + 128, 28, 72, 126, 72, 329, 38, 284, 96, 370, + 37, 115, 195, 110, 239, 112, 125, 128, 958, 124, + 129, 126, 121, 724, 225, 149, 128, 115, 229, 153, + 195, 196, 120, 104, 180, 120, 153, 238, 238, 180, + 773, 180, 126, 933, 123, 740, 153, 248, 372, 126, + 122, 126, 176, 150, 120, 330, 330, 936, 128, 176, + 128, 286, 941, 175, 126, 177, 284, 191, 192, 176, + 270, 195, 196, 584, 191, 192, 180, 773, 613, 196, + 321, 72, 179, 270, 191, 192, 965, 270, 303, 785, + 305, 602, 238, 462, 463, 381, 126, 383, 126, 238, + 72, 802, 303, 286, 305, 270, 120, 231, 196, 248, + 195, 806, 126, 126, 231, 239, 932, 130, 72, 72, + 126, 120, 120, 247, 231, 826, 236, 126, 126, 120, + 247, 372, 236, 120, 238, 126, 126, 832, 356, 126, + 247, 836, 266, 72, 126, 370, 270, 330, 236, 266, + 238, 239, 532, 265, 239, 267, 128, 126, 120, 266, + 257, 258, 286, 440, 126, 330, 126, 120, 369, 369, + 130, 120, 873, 126, 128, 128, 956, 126, 121, 72, + 381, 124, 383, 460, 296, 126, 120, 370, 889, 126, + 287, 120, 126, 126, 306, 307, 120, 126, 322, 128, + 297, 286, 126, 120, 688, 322, 330, 510, 126, 126, + 120, 885, 120, 724, 455, 518, 126, 125, 640, 641, + 642, 126, 440, 369, 120, 887, 529, 120, 120, 125, + 369, 375, 72, 126, 126, 128, 812, 361, 814, 126, + 816, 126, 460, 120, 361, 330, 370, 462, 463, 126, + 451, 375, 72, 72, 361, 126, 72, 931, 329, 120, + 121, 462, 463, 124, 126, 369, 3, 4, 5, 6, + 7, 8, 9, 126, 386, 126, 950, 126, 120, 121, + 120, 369, 124, 321, 120, 370, 126, 126, 128, 133, + 134, 802, 3, 4, 5, 6, 7, 8, 9, 225, + 120, 120, 72, 229, 120, 128, 126, 126, 128, 128, + 126, 121, 128, 121, 907, 826, 640, 641, 642, 912, + 804, 3, 4, 5, 6, 7, 8, 9, 120, 121, + 129, 455, 124, 12, 372, 123, 457, 120, 455, 120, + 121, 26, 27, 124, 121, 455, 26, 27, 740, 446, + 943, 944, 124, 946, 3, 4, 5, 6, 7, 8, + 9, 72, 873, 13, 14, 15, 126, 960, 126, 126, + 881, 882, 883, 884, 885, 886, 126, 303, 889, 305, + 123, 803, 130, 124, 121, 121, 120, 588, 23, 24, + 25, 130, 125, 125, 125, 125, 125, 125, 125, 640, + 641, 642, 125, 125, 125, 795, 125, 125, 125, 624, + 125, 127, 125, 127, 120, 120, 124, 19, 20, 21, + 931, 622, 131, 638, 26, 27, 28, 29, 30, 31, + 32, 127, 34, 130, 531, 127, 127, 130, 122, 950, + 36, 127, 120, 120, 120, 30, 127, 18, 131, 120, + 125, 125, 125, 125, 122, 381, 125, 383, 582, 123, + 123, 127, 120, 20, 131, 582, 125, 120, 120, 125, + 127, 861, 543, 124, 122, 582, 131, 71, 125, 803, + 125, 127, 579, 622, 127, 127, 127, 127, 127, 127, + 127, 127, 125, 617, 618, 619, 127, 127, 127, 127, + 617, 618, 619, 127, 125, 127, 120, 123, 131, 127, + 617, 618, 619, 125, 936, 13, 13, 792, 940, 941, + 120, 127, 127, 127, 621, 451, 127, 120, 127, 4, + 365, 668, 672, 564, 676, 857, 462, 463, 459, 668, + 638, 460, 668, 965, 668, 731, 670, 668, 672, 668, + 674, 668, 4, 670, 785, 672, 773, 674, 668, 808, + 878, 668, 803, 670, 668, 672, 916, 674, 668, 356, + 795, 785, 794, 355, 645, 932, 787, 795, 649, 650, + 668, 962, 653, 654, 655, 656, 657, 658, 659, 660, + 661, 662, 741, 794, 794, 870, 721, 668, 606, 668, + 295, 904, 640, 641, 642, 295, 815, 794, -1, 792, + 883, 682, 936, -1, -1, 718, 940, 941, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 792, -1, -1, + -1, -1, 744, 834, -1, -1, 861, -1, -1, -1, + -1, 965, -1, 857, -1, -1, -1, 858, 794, 773, + 774, 795, 773, 794, -1, 794, -1, 774, 584, 860, + 860, 785, 588, 773, 865, 865, 785, -1, 792, 773, + 794, 795, -1, 860, -1, 785, 602, 774, 865, -1, + -1, 785, -1, -1, 808, 756, 774, 870, 759, 890, + 794, 808, -1, -1, -1, 936, 793, 785, -1, 940, + 941, 808, 773, -1, -1, 870, 794, 792, -1, 910, + 795, -1, -1, -1, 785, -1, 828, 861, -1, 865, + -1, 860, -1, -1, 965, -1, 865, -1, -1, -1, + -1, 855, -1, -1, -1, -1, 860, 861, 855, -1, + -1, 865, -1, 109, -1, -1, 870, 857, 855, -1, + -1, -1, -1, 857, 120, -1, 860, -1, -1, -1, + -1, 865, 859, -1, -1, 803, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 861, 865, -1, -1, + -1, -1, -1, -1, 908, 870, -1, -1, 912, -1, + -1, 908, -1, -1, -1, 912, -1, -1, 724, -1, + -1, 908, -1, -1, -1, 912, 910, -1, -1, -1, + -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, + 944, -1, -1, -1, -1, -1, -1, 944, -1, -1, + -1, 197, -1, -1, -1, 201, 202, 944, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 239, -1, -1, 802, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 936, -1, + 826, -1, 940, 941, 270, -1, -1, -1, 834, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 284, -1, + 286, -1, -1, -1, -1, -1, -1, 965, -1, -1, + -1, -1, -1, -1, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 873, -1, -1, + -1, -1, -1, -1, -1, 881, 882, 883, 884, 885, + 886, -1, -1, 889, 890, -1, 332, 333, 334, -1, + -1, 337, -1, -1, -1, 126, -1, -1, -1, -1, + -1, 132, 133, 134, -1, -1, -1, -1, -1, -1, + 356, -1, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 367, -1, -1, 370, 931, -1, -1, -1, -1, + -1, -1, -1, -1, 23, 24, 25, -1, -1, -1, + -1, 30, -1, -1, 950, -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, 72, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 440, -1, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, -1, + -1, -1, -1, -1, 460, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 29, 30, 132, 32, -1, 34, 35, 36, 37, + 38, 39, 40, -1, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 556, -1, 26, 27, 28, 29, 30, 31, 32, 33, + 34, -1, -1, -1, -1, 39, -1, -1, -1, -1, + -1, -1, 120, 121, 122, 123, 124, 125, 126, -1, + 128, 129, 130, -1, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, -1, -1, -1, -1, -1, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, -1, -1, -1, -1, -1, -1, 623, -1, -1, + -1, -1, -1, 629, -1, -1, 3, 4, 5, 6, + 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 19, 20, 21, 22, 120, -1, -1, 26, + 27, 28, 29, 30, 31, 32, -1, 34, -1, 133, + 134, 38, 668, -1, -1, 42, 43, -1, -1, -1, + 676, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, -1, 72, -1, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 3, 4, 5, 6, 7, 8, 9, 10, 11, + -1, -1, -1, -1, 740, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 123, -1, 125, 126, + -1, 128, 129, 130, -1, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, -1, -1, 773, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 785, + -1, -1, -1, -1, -1, -1, -1, -1, 794, 795, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 806, -1, -1, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 832, -1, -1, -1, + 836, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 132, 133, 134, -1, 860, 861, -1, -1, -1, 865, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, + 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, 127, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + 123, 124, 125, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + -1, 124, -1, 126, -1, 128, 129, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, 29, 30, -1, 32, + -1, 34, 35, 36, 37, 38, 39, 40, -1, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, + -1, 124, -1, 126, -1, 128, -1, 130, -1, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 3, 4, 5, 6, 7, 8, 9, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 19, 20, 21, 22, + 39, -1, -1, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, -1, 38, 39, -1, 41, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, -1, 72, + -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 3, 4, + 5, 6, 7, 8, 9, -1, -1, -1, -1, 132, + -1, -1, -1, -1, 19, 20, 21, 22, -1, -1, + -1, 26, 27, 28, 29, 30, 31, 32, -1, 34, + 35, 36, -1, 38, 39, 40, 41, -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, 72, -1, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, -1, 120, 3, 4, 5, 6, + 7, 8, 9, -1, -1, -1, -1, 132, -1, -1, + -1, -1, 19, 20, 21, 22, -1, -1, -1, 26, + 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, + -1, 38, -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, 72, -1, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 3, 4, 5, 6, 7, 8, 9, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, -1, -1, -1, 26, 27, 28, 29, 30, 31, + 32, -1, 34, 35, -1, 132, 38, 39, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, + 72, -1, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 3, 4, 5, 6, + 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 19, 20, 21, 22, -1, -1, -1, 26, + 27, 28, 29, 30, 31, 32, -1, 34, 35, -1, + 132, 38, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 3, 4, 5, + 6, 7, 8, 9, -1, 72, -1, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 132, 38, -1, 40, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 3, 4, 5, 6, 7, + 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 132, 72, 3, 4, 5, + 6, 7, 8, 9, 10, 11, -1, 35, -1, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, -1, 3, 4, 5, 6, 7, 8, 9, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 3, 4, 5, 6, 7, + 8, 9, -1, -1, -1, -1, 132, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 35, 36, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 72, 3, 4, 5, 6, 7, 8, 9, + 10, 11, -1, -1, 132, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, -1, -1, + 126, -1, -1, -1, -1, -1, 132, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + -1, 121, -1, -1, 124, -1, -1, -1, -1, -1, + -1, -1, 132, -1, 3, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 132, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, -1, 38, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 132, 72, 3, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, -1, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, -1, + 3, 4, 5, 6, 7, 8, 9, 36, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 35, 132, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 132, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, + -1, -1, -1, 132, 26, 27, 28, 29, 30, 31, + 32, 33, 34, -1, -1, -1, -1, 39, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 42, 43, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, -1, -1, -1, -1, -1, 3, 4, 5, + 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, + -1, 133, 134, 19, 20, 21, 22, -1, -1, -1, + 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, + 36, -1, 38, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 123, -1, 125, 126, -1, 128, + 129, 130, -1, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, -1, -1, -1, 72, -1, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 3, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, + 21, 22, -1, -1, -1, 26, 27, 28, 29, 30, + 31, 32, -1, 34, 35, -1, -1, 38, 39, -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, 72, -1, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 3, 4, 5, + 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 19, 20, 21, 22, -1, -1, -1, + 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, + -1, -1, 38, -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, 72, -1, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 3, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, + 21, 22, -1, -1, -1, 26, 27, 28, 29, 30, + 31, 32, -1, 34, -1, -1, -1, 38, -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, 72, -1, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 3, 4, 5, + 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 19, 20, 21, 22, -1, -1, -1, + 26, 27, 28, 29, 30, 31, 32, -1, 34, -1, + -1, -1, 38, 3, 4, 5, 6, 7, 8, 9, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, + -1, 21, 22, -1, -1, -1, 26, 27, 28, 29, + 30, 31, 32, -1, 34, -1, 72, -1, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 72, -1, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = +{ + 0, 144, 145, 0, 146, 3, 4, 5, 6, 7, + 8, 9, 19, 20, 21, 22, 26, 27, 28, 29, + 30, 31, 32, 34, 35, 36, 38, 39, 40, 41, + 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 120, 132, 147, 148, + 149, 150, 152, 153, 154, 155, 156, 158, 161, 175, + 176, 178, 186, 187, 196, 198, 199, 216, 217, 218, + 219, 222, 223, 226, 232, 259, 289, 290, 291, 292, + 294, 295, 296, 298, 299, 302, 303, 304, 305, 306, + 308, 309, 312, 319, 320, 321, 327, 3, 4, 5, + 6, 7, 8, 9, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 289, 291, 292, + 296, 12, 128, 313, 3, 4, 5, 6, 7, 8, + 9, 34, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 156, 161, 176, 291, 296, + 302, 308, 3, 4, 5, 6, 7, 8, 9, 121, + 299, 38, 40, 197, 289, 292, 295, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 3, 4, + 5, 6, 7, 8, 9, 300, 157, 160, 289, 300, + 121, 22, 148, 154, 155, 183, 199, 216, 302, 308, + 120, 121, 237, 237, 237, 237, 126, 161, 302, 308, + 120, 36, 223, 240, 241, 244, 290, 294, 296, 298, + 295, 290, 291, 295, 128, 156, 161, 176, 187, 223, + 292, 303, 312, 10, 11, 227, 229, 231, 232, 233, + 238, 240, 260, 268, 271, 279, 292, 296, 298, 133, + 134, 265, 322, 323, 324, 326, 310, 296, 121, 129, + 200, 289, 12, 300, 289, 300, 156, 176, 3, 4, + 5, 6, 7, 8, 9, 191, 192, 195, 268, 279, + 298, 375, 123, 151, 289, 289, 120, 226, 231, 232, + 292, 298, 329, 332, 333, 298, 298, 337, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 33, 39, 261, 264, 265, 301, 303, 321, + 121, 124, 168, 169, 120, 159, 261, 177, 289, 302, + 292, 298, 375, 224, 289, 293, 126, 242, 295, 295, + 297, 300, 289, 300, 223, 241, 311, 228, 126, 42, + 43, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 123, 125, 126, 128, 129, 130, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 351, 352, 234, 126, 262, 123, 256, 257, 268, 277, + 322, 281, 282, 283, 227, 233, 296, 124, 325, 323, + 324, 300, 145, 201, 203, 204, 206, 208, 188, 190, + 265, 188, 300, 300, 189, 126, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, + 42, 43, 44, 45, 46, 47, 71, 72, 73, 120, + 121, 122, 123, 124, 125, 126, 128, 129, 130, 142, + 319, 352, 353, 354, 377, 378, 379, 380, 381, 382, + 291, 296, 121, 120, 226, 231, 125, 298, 298, 298, + 125, 125, 298, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 127, 127, 125, 120, 262, 260, + 162, 23, 24, 25, 30, 170, 171, 174, 289, 168, + 120, 179, 180, 181, 298, 298, 122, 249, 250, 296, + 299, 245, 124, 246, 361, 261, 120, 261, 300, 234, + 230, 130, 130, 127, 131, 26, 37, 123, 235, 239, + 120, 125, 258, 127, 268, 130, 284, 285, 13, 14, + 15, 280, 306, 307, 122, 125, 129, 19, 21, 22, + 291, 296, 302, 314, 315, 318, 319, 20, 38, 211, + 199, 120, 189, 195, 120, 188, 188, 120, 125, 193, + 375, 375, 375, 120, 145, 328, 125, 127, 127, 334, + 336, 125, 308, 340, 342, 344, 346, 341, 343, 345, + 347, 348, 349, 298, 23, 24, 25, 122, 163, 164, + 173, 174, 125, 30, 172, 122, 125, 123, 123, 127, + 251, 253, 254, 295, 249, 247, 248, 289, 243, 10, + 11, 72, 121, 123, 124, 125, 126, 128, 129, 130, + 142, 320, 321, 352, 353, 354, 356, 363, 364, 365, + 367, 369, 373, 120, 120, 249, 131, 131, 236, 18, + 249, 263, 128, 129, 355, 356, 358, 269, 286, 285, + 306, 202, 289, 289, 289, 312, 10, 11, 126, 266, + 270, 278, 279, 265, 316, 266, 20, 120, 120, 190, + 249, 122, 131, 127, 122, 308, 330, 308, 308, 338, + 127, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 125, 350, 33, 41, 119, 120, 153, 155, 165, + 166, 167, 175, 186, 196, 199, 220, 221, 222, 241, + 259, 289, 292, 296, 302, 308, 327, 124, 289, 171, + 289, 181, 182, 376, 225, 125, 308, 127, 125, 381, + 234, 371, 372, 374, 370, 366, 368, 127, 369, 127, + 264, 358, 126, 272, 282, 287, 288, 203, 317, 205, + 266, 276, 322, 281, 300, 207, 209, 127, 127, 308, + 335, 127, 308, 127, 127, 127, 127, 127, 127, 127, + 127, 125, 125, 127, 153, 161, 184, 199, 221, 296, + 302, 308, 381, 155, 220, 302, 237, 120, 231, 241, + 292, 233, 296, 355, 120, 378, 234, 71, 252, 266, + 248, 357, 357, 362, 357, 361, 357, 273, 131, 355, + 300, 123, 212, 213, 127, 266, 212, 266, 194, 331, + 125, 339, 13, 13, 121, 124, 185, 289, 161, 184, + 302, 237, 161, 120, 231, 253, 255, 123, 125, 127, + 358, 359, 127, 120, 122, 359, 360, 127, 129, 131, + 249, 214, 267, 210, 275, 127, 376, 127, 127, 127, + 375, 376, 185, 289, 161, 185, 289, 120, 256, 127, + 215, 363, 272, 212, 26, 28, 37, 127, 122, 120, + 289, 185, 274, 363, 381, 376, 275, 120 +}; + +#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 yyerrorlab + + +/* 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); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + 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; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* 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; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: + +/* Line 1455 of yacc.c */ +#line 1464 "vtkParse.y" + { + startSig(); + clearType(); + clearTypeId(); + clearTemplate(); + closeComment(); + } + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 1509 "vtkParse.y" + { pushNamespace((yyvsp[(2) - (2)].str)); } + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 1510 "vtkParse.y" + { popNamespace(); } + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 1532 "vtkParse.y" + { pushType(); } + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 1533 "vtkParse.y" + { + const char *name = (currentClass ? currentClass->Name : NULL); + popType(); + clearTypeId(); + if (name) + { + setTypeId(name); + setTypeBase(guess_id_type(name)); + } + end_class(); + } + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 1546 "vtkParse.y" + { start_class((yyvsp[(2) - (2)].str), (yyvsp[(1) - (2)].integer)); } + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 1548 "vtkParse.y" + { start_class(NULL, (yyvsp[(1) - (1)].integer)); } + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 1552 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 1553 "vtkParse.y" + { (yyval.integer) = 1; } + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 1554 "vtkParse.y" + { (yyval.integer) = 2; } + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 1558 "vtkParse.y" + { + startSig(); + clearType(); + clearTypeId(); + clearTemplate(); + closeComment(); + } + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 1570 "vtkParse.y" + { access_level = VTK_ACCESS_PUBLIC; } + break; + + case 50: + +/* Line 1455 of yacc.c */ +#line 1571 "vtkParse.y" + { access_level = VTK_ACCESS_PRIVATE; } + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 1572 "vtkParse.y" + { access_level = VTK_ACCESS_PROTECTED; } + break; + + case 70: + +/* Line 1455 of yacc.c */ +#line 1597 "vtkParse.y" + { output_friend_function(); } + break; + + case 76: + +/* Line 1455 of yacc.c */ +#line 1611 "vtkParse.y" + { add_base_class(currentClass, (yyvsp[(1) - (1)].str), access_level, 0); } + break; + + case 77: + +/* Line 1455 of yacc.c */ +#line 1613 "vtkParse.y" + { add_base_class(currentClass, (yyvsp[(3) - (3)].str), (yyvsp[(2) - (3)].integer), 1); } + break; + + case 78: + +/* Line 1455 of yacc.c */ +#line 1615 "vtkParse.y" + { add_base_class(currentClass, (yyvsp[(3) - (3)].str), (yyvsp[(1) - (3)].integer), (yyvsp[(2) - (3)].integer)); } + break; + + case 79: + +/* Line 1455 of yacc.c */ +#line 1618 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 80: + +/* Line 1455 of yacc.c */ +#line 1619 "vtkParse.y" + { (yyval.integer) = 1; } + break; + + case 81: + +/* Line 1455 of yacc.c */ +#line 1622 "vtkParse.y" + { (yyval.integer) = access_level; } + break; + + case 83: + +/* Line 1455 of yacc.c */ +#line 1626 "vtkParse.y" + { (yyval.integer) = VTK_ACCESS_PUBLIC; } + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 1627 "vtkParse.y" + { (yyval.integer) = VTK_ACCESS_PRIVATE; } + break; + + case 85: + +/* Line 1455 of yacc.c */ +#line 1628 "vtkParse.y" + { (yyval.integer) = VTK_ACCESS_PROTECTED; } + break; + + case 88: + +/* Line 1455 of yacc.c */ +#line 1644 "vtkParse.y" + { pushType(); start_enum((yyvsp[(1) - (2)].str)); } + break; + + case 89: + +/* Line 1455 of yacc.c */ +#line 1645 "vtkParse.y" + { + popType(); + clearTypeId(); + if ((yyvsp[(1) - (5)].str) != NULL) + { + setTypeId((yyvsp[(1) - (5)].str)); + setTypeBase(guess_id_type((yyvsp[(1) - (5)].str))); + } + end_enum(); + } + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 1657 "vtkParse.y" + { (yyval.str) = (yyvsp[(2) - (2)].str); } + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 1658 "vtkParse.y" + { (yyval.str) = NULL; } + break; + + case 97: + +/* Line 1455 of yacc.c */ +#line 1669 "vtkParse.y" + { add_enum((yyvsp[(1) - (1)].str), NULL); } + break; + + case 98: + +/* Line 1455 of yacc.c */ +#line 1670 "vtkParse.y" + { postSig("="); markSig(); } + break; + + case 99: + +/* Line 1455 of yacc.c */ +#line 1671 "vtkParse.y" + { chopSig(); add_enum((yyvsp[(1) - (4)].str), copySig()); } + break; + + case 120: + +/* Line 1455 of yacc.c */ +#line 1724 "vtkParse.y" + { pushFunction(); postSig("("); } + break; + + case 121: + +/* Line 1455 of yacc.c */ +#line 1725 "vtkParse.y" + { postSig(")"); } + break; + + case 122: + +/* Line 1455 of yacc.c */ +#line 1726 "vtkParse.y" + { (yyval.integer) = VTK_PARSE_FUNCTION; popFunction(); } + break; + + case 123: + +/* Line 1455 of yacc.c */ +#line 1730 "vtkParse.y" + { + ValueInfo *item = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(item); + item->ItemType = VTK_TYPEDEF_INFO; + item->Access = access_level; + + handle_complex_type(item, getType(), (yyvsp[(1) - (1)].integer), getSig()); + + if (getVarName()) + { + item->Name = getVarName(); + } + + if (item->Class == NULL) + { + vtkParse_FreeValue(item); + } + else if (currentClass) + { + vtkParse_AddTypedefToClass(currentClass, item); + } + else + { + vtkParse_AddTypedefToNamespace(currentNamespace, item); + } + } + break; + + case 124: + +/* Line 1455 of yacc.c */ +#line 1763 "vtkParse.y" + { add_using((yyvsp[(2) - (3)].str), 0); } + break; + + case 126: + +/* Line 1455 of yacc.c */ +#line 1767 "vtkParse.y" + { (yyval.str) = (yyvsp[(2) - (2)].str); } + break; + + case 127: + +/* Line 1455 of yacc.c */ +#line 1769 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 128: + +/* Line 1455 of yacc.c */ +#line 1771 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 129: + +/* Line 1455 of yacc.c */ +#line 1773 "vtkParse.y" + { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } + break; + + case 130: + +/* Line 1455 of yacc.c */ +#line 1775 "vtkParse.y" + { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } + break; + + case 131: + +/* Line 1455 of yacc.c */ +#line 1778 "vtkParse.y" + { add_using((yyvsp[(3) - (4)].str), 1); } + break; + + case 132: + +/* Line 1455 of yacc.c */ +#line 1786 "vtkParse.y" + { postSig("template<> "); clearTypeId(); } + break; + + case 133: + +/* Line 1455 of yacc.c */ +#line 1788 "vtkParse.y" + { + postSig("template<"); + pushType(); + clearType(); + clearTypeId(); + startTemplate(); + } + break; + + case 134: + +/* Line 1455 of yacc.c */ +#line 1796 "vtkParse.y" + { + chopSig(); + if (getSig()[getSigLength()-1] == '>') { postSig(" "); } + postSig("> "); + clearTypeId(); + popType(); + } + break; + + case 136: + +/* Line 1455 of yacc.c */ +#line 1807 "vtkParse.y" + { chopSig(); postSig(", "); clearType(); clearTypeId(); } + break; + + case 138: + +/* Line 1455 of yacc.c */ +#line 1811 "vtkParse.y" + { markSig(); } + break; + + case 139: + +/* Line 1455 of yacc.c */ +#line 1813 "vtkParse.y" + { add_template_parameter(getType(), (yyvsp[(3) - (3)].integer), copySig()); } + break; + + case 141: + +/* Line 1455 of yacc.c */ +#line 1815 "vtkParse.y" + { markSig(); } + break; + + case 142: + +/* Line 1455 of yacc.c */ +#line 1817 "vtkParse.y" + { add_template_parameter(0, (yyvsp[(3) - (3)].integer), copySig()); } + break; + + case 144: + +/* Line 1455 of yacc.c */ +#line 1819 "vtkParse.y" + { pushTemplate(); markSig(); } + break; + + case 145: + +/* Line 1455 of yacc.c */ +#line 1820 "vtkParse.y" + { postSig("class "); } + break; + + case 146: + +/* Line 1455 of yacc.c */ +#line 1822 "vtkParse.y" + { + int i; + TemplateInfo *newTemplate = currentTemplate; + popTemplate(); + add_template_parameter(0, (yyvsp[(5) - (5)].integer), copySig()); + i = currentTemplate->NumberOfParameters-1; + currentTemplate->Parameters[i]->Template = newTemplate; + } + break; + + case 148: + +/* Line 1455 of yacc.c */ +#line 1833 "vtkParse.y" + { postSig("class "); } + break; + + case 149: + +/* Line 1455 of yacc.c */ +#line 1834 "vtkParse.y" + { postSig("typename "); } + break; + + case 152: + +/* Line 1455 of yacc.c */ +#line 1840 "vtkParse.y" + { postSig("="); markSig(); } + break; + + case 153: + +/* Line 1455 of yacc.c */ +#line 1842 "vtkParse.y" + { + int i = currentTemplate->NumberOfParameters-1; + ValueInfo *param = currentTemplate->Parameters[i]; + chopSig(); + param->Value = copySig(); + } + break; + + case 156: + +/* Line 1455 of yacc.c */ +#line 1859 "vtkParse.y" + { output_function(); } + break; + + case 157: + +/* Line 1455 of yacc.c */ +#line 1860 "vtkParse.y" + { output_function(); } + break; + + case 158: + +/* Line 1455 of yacc.c */ +#line 1861 "vtkParse.y" + { reject_function(); } + break; + + case 159: + +/* Line 1455 of yacc.c */ +#line 1862 "vtkParse.y" + { reject_function(); } + break; + + case 167: + +/* Line 1455 of yacc.c */ +#line 1878 "vtkParse.y" + { output_function(); } + break; + + case 177: + +/* Line 1455 of yacc.c */ +#line 1895 "vtkParse.y" + { + postSig("("); + set_return(currentFunction, getType(), getTypeId(), 0); + } + break; + + case 178: + +/* Line 1455 of yacc.c */ +#line 1899 "vtkParse.y" + { postSig(")"); } + break; + + case 179: + +/* Line 1455 of yacc.c */ +#line 1901 "vtkParse.y" + { + postSig(";"); + closeSig(); + currentFunction->IsOperator = 1; + currentFunction->Name = "operator typecast"; + currentFunction->Comment = vtkstrdup(getComment()); + vtkParseDebug("Parsed operator", "operator typecast"); + } + break; + + case 180: + +/* Line 1455 of yacc.c */ +#line 1912 "vtkParse.y" + { (yyval.str) = copySig(); } + break; + + case 181: + +/* Line 1455 of yacc.c */ +#line 1915 "vtkParse.y" + { postSig(")"); } + break; + + case 182: + +/* Line 1455 of yacc.c */ +#line 1916 "vtkParse.y" + { + postSig(";"); + closeSig(); + currentFunction->Name = (yyvsp[(1) - (3)].str); + currentFunction->Comment = vtkstrdup(getComment()); + vtkParseDebug("Parsed operator", currentFunction->Name); + } + break; + + case 183: + +/* Line 1455 of yacc.c */ +#line 1926 "vtkParse.y" + { + postSig("("); + currentFunction->IsOperator = 1; + set_return(currentFunction, getType(), getTypeId(), 0); + } + break; + + case 185: + +/* Line 1455 of yacc.c */ +#line 1935 "vtkParse.y" + { chopSig(); (yyval.str) = vtkstrcat(copySig(), (yyvsp[(2) - (2)].str)); postSig((yyvsp[(2) - (2)].str)); } + break; + + case 186: + +/* Line 1455 of yacc.c */ +#line 1938 "vtkParse.y" + { markSig(); postSig("operator "); } + break; + + case 187: + +/* Line 1455 of yacc.c */ +#line 1942 "vtkParse.y" + { + postSig(";"); + closeSig(); + currentFunction->Name = (yyvsp[(1) - (2)].str); + currentFunction->Comment = vtkstrdup(getComment()); + vtkParseDebug("Parsed func", currentFunction->Name); + } + break; + + case 190: + +/* Line 1455 of yacc.c */ +#line 1954 "vtkParse.y" + { postSig(" throw "); } + break; + + case 191: + +/* Line 1455 of yacc.c */ +#line 1954 "vtkParse.y" + { chopSig(); } + break; + + case 192: + +/* Line 1455 of yacc.c */ +#line 1955 "vtkParse.y" + { postSig(" const"); currentFunction->IsConst = 1; } + break; + + case 193: + +/* Line 1455 of yacc.c */ +#line 1957 "vtkParse.y" + { + postSig(" = 0"); + currentFunction->IsPureVirtual = 1; + if (currentClass) { currentClass->IsAbstract = 1; } + } + break; + + case 196: + +/* Line 1455 of yacc.c */ +#line 1969 "vtkParse.y" + { + postSig("("); + set_return(currentFunction, getType(), getTypeId(), 0); + } + break; + + case 197: + +/* Line 1455 of yacc.c */ +#line 1973 "vtkParse.y" + { postSig(")"); } + break; + + case 200: + +/* Line 1455 of yacc.c */ +#line 1985 "vtkParse.y" + { closeSig(); } + break; + + case 201: + +/* Line 1455 of yacc.c */ +#line 1986 "vtkParse.y" + { openSig(); } + break; + + case 202: + +/* Line 1455 of yacc.c */ +#line 1987 "vtkParse.y" + { + postSig(";"); + closeSig(); + if (getType() & VTK_PARSE_VIRTUAL) + { + currentFunction->IsVirtual = 1; + } + if (getType() & VTK_PARSE_EXPLICIT) + { + currentFunction->IsExplicit = 1; + } + currentFunction->Name = (yyvsp[(1) - (5)].str); + currentFunction->Comment = vtkstrdup(getComment()); + vtkParseDebug("Parsed func", currentFunction->Name); + } + break; + + case 203: + +/* Line 1455 of yacc.c */ +#line 2004 "vtkParse.y" + { pushType(); postSig("("); } + break; + + case 204: + +/* Line 1455 of yacc.c */ +#line 2005 "vtkParse.y" + { popType(); postSig(")"); } + break; + + case 211: + +/* Line 1455 of yacc.c */ +#line 2022 "vtkParse.y" + { clearType(); clearTypeId(); } + break; + + case 213: + +/* Line 1455 of yacc.c */ +#line 2025 "vtkParse.y" + { clearType(); clearTypeId(); } + break; + + case 214: + +/* Line 1455 of yacc.c */ +#line 2026 "vtkParse.y" + { clearType(); clearTypeId(); postSig(", "); } + break; + + case 216: + +/* Line 1455 of yacc.c */ +#line 2029 "vtkParse.y" + { currentFunction->IsVariadic = 1; postSig(", ..."); } + break; + + case 217: + +/* Line 1455 of yacc.c */ +#line 2032 "vtkParse.y" + { markSig(); } + break; + + case 218: + +/* Line 1455 of yacc.c */ +#line 2034 "vtkParse.y" + { + ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(param); + + handle_complex_type(param, getType(), (yyvsp[(3) - (3)].integer), copySig()); + add_legacy_parameter(currentFunction, param); + + if (getVarName()) + { + param->Name = getVarName(); + } + + vtkParse_AddParameterToFunction(currentFunction, param); + } + break; + + case 219: + +/* Line 1455 of yacc.c */ +#line 2049 "vtkParse.y" + { + int i = currentFunction->NumberOfParameters-1; + if (getVarValue()) + { + currentFunction->Parameters[i]->Value = getVarValue(); + } + } + break; + + case 220: + +/* Line 1455 of yacc.c */ +#line 2058 "vtkParse.y" + { clearVarValue(); } + break; + + case 222: + +/* Line 1455 of yacc.c */ +#line 2062 "vtkParse.y" + { postSig("="); clearVarValue(); markSig(); } + break; + + case 223: + +/* Line 1455 of yacc.c */ +#line 2063 "vtkParse.y" + { chopSig(); setVarValue(copySig()); } + break; + + case 225: + +/* Line 1455 of yacc.c */ +#line 2074 "vtkParse.y" + { + unsigned int type = getType(); + ValueInfo *var = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(var); + var->ItemType = VTK_VARIABLE_INFO; + var->Access = access_level; + + handle_complex_type(var, type, (yyvsp[(1) - (2)].integer), getSig()); + + var->Name = getVarName(); + + if (getVarValue()) + { + var->Value = getVarValue(); + } + + /* Is this a typedef? */ + if ((type & VTK_PARSE_TYPEDEF) != 0) + { + var->ItemType = VTK_TYPEDEF_INFO; + if (currentClass) + { + vtkParse_AddVariableToClass(currentClass, var); + } + else + { + vtkParse_AddVariableToNamespace(currentNamespace, var); + } + } + /* Is this a constant? */ + else if (((type & VTK_PARSE_CONST) != 0) && var->Value != NULL && + (((type & VTK_PARSE_INDIRECT) == 0) || + ((type & VTK_PARSE_INDIRECT) == VTK_PARSE_ARRAY))) + { + var->ItemType = VTK_CONSTANT_INFO; + if (currentClass) + { + vtkParse_AddConstantToClass(currentClass, var); + } + else + { + vtkParse_AddConstantToNamespace(currentNamespace, var); + } + } + /* This is a true variable i.e. not constant */ + else + { + if (currentClass) + { + vtkParse_AddVariableToClass(currentClass, var); + } + else + { + vtkParse_AddVariableToNamespace(currentNamespace, var); + } + } + } + break; + + case 229: + +/* Line 1455 of yacc.c */ +#line 2136 "vtkParse.y" + { postSig(", "); } + break; + + case 232: + +/* Line 1455 of yacc.c */ +#line 2142 "vtkParse.y" + { setTypePtr(0); } + break; + + case 233: + +/* Line 1455 of yacc.c */ +#line 2143 "vtkParse.y" + { setTypePtr((yyvsp[(1) - (1)].integer)); } + break; + + case 234: + +/* Line 1455 of yacc.c */ +#line 2147 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 235: + +/* Line 1455 of yacc.c */ +#line 2148 "vtkParse.y" + { postSig(")"); } + break; + + case 236: + +/* Line 1455 of yacc.c */ +#line 2150 "vtkParse.y" + { + const char *scope = getScope(); + unsigned int parens = add_indirection((yyvsp[(1) - (5)].integer), (yyvsp[(2) - (5)].integer)); + if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_FUNCTION) + { + if (scope) { scope = vtkstrndup(scope, strlen(scope) - 2); } + getFunction()->Class = scope; + (yyval.integer) = (parens | VTK_PARSE_FUNCTION); + } + else if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_ARRAY) + { + (yyval.integer) = add_indirection_to_array(parens); + } + } + break; + + case 237: + +/* Line 1455 of yacc.c */ +#line 2167 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 238: + +/* Line 1455 of yacc.c */ +#line 2168 "vtkParse.y" + { postSig(")"); } + break; + + case 239: + +/* Line 1455 of yacc.c */ +#line 2170 "vtkParse.y" + { + const char *scope = getScope(); + unsigned int parens = add_indirection((yyvsp[(1) - (5)].integer), (yyvsp[(2) - (5)].integer)); + if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_FUNCTION) + { + if (scope) { scope = vtkstrndup(scope, strlen(scope) - 2); } + getFunction()->Class = scope; + (yyval.integer) = (parens | VTK_PARSE_FUNCTION); + } + else if ((yyvsp[(5) - (5)].integer) == VTK_PARSE_ARRAY) + { + (yyval.integer) = add_indirection_to_array(parens); + } + } + break; + + case 240: + +/* Line 1455 of yacc.c */ +#line 2186 "vtkParse.y" + { postSig("("); scopeSig(""); (yyval.integer) = 0; } + break; + + case 241: + +/* Line 1455 of yacc.c */ +#line 2187 "vtkParse.y" + { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("*"); + (yyval.integer) = VTK_PARSE_POINTER; } + break; + + case 242: + +/* Line 1455 of yacc.c */ +#line 2189 "vtkParse.y" + { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("&"); + (yyval.integer) = VTK_PARSE_REF; } + break; + + case 243: + +/* Line 1455 of yacc.c */ +#line 2193 "vtkParse.y" + { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("*"); + (yyval.integer) = VTK_PARSE_POINTER; } + break; + + case 244: + +/* Line 1455 of yacc.c */ +#line 2195 "vtkParse.y" + { postSig("("); scopeSig((yyvsp[(1) - (1)].str)); postSig("&"); + (yyval.integer) = VTK_PARSE_REF; } + break; + + case 245: + +/* Line 1455 of yacc.c */ +#line 2198 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 246: + +/* Line 1455 of yacc.c */ +#line 2199 "vtkParse.y" + { pushFunction(); postSig("("); } + break; + + case 247: + +/* Line 1455 of yacc.c */ +#line 2200 "vtkParse.y" + { postSig(")"); } + break; + + case 248: + +/* Line 1455 of yacc.c */ +#line 2201 "vtkParse.y" + { + (yyval.integer) = VTK_PARSE_FUNCTION; + popFunction(); + } + break; + + case 249: + +/* Line 1455 of yacc.c */ +#line 2205 "vtkParse.y" + { (yyval.integer) = VTK_PARSE_ARRAY; } + break; + + case 252: + +/* Line 1455 of yacc.c */ +#line 2209 "vtkParse.y" + { currentFunction->IsConst = 1; } + break; + + case 255: + +/* Line 1455 of yacc.c */ +#line 2215 "vtkParse.y" + { (yyval.integer) = add_indirection((yyvsp[(1) - (2)].integer), (yyvsp[(2) - (2)].integer)); } + break; + + case 257: + +/* Line 1455 of yacc.c */ +#line 2220 "vtkParse.y" + { (yyval.integer) = add_indirection((yyvsp[(1) - (2)].integer), (yyvsp[(2) - (2)].integer)); } + break; + + case 258: + +/* Line 1455 of yacc.c */ +#line 2223 "vtkParse.y" + { clearVarName(); chopSig(); } + break; + + case 260: + +/* Line 1455 of yacc.c */ +#line 2227 "vtkParse.y" + { setVarName((yyvsp[(1) - (1)].str)); } + break; + + case 261: + +/* Line 1455 of yacc.c */ +#line 2228 "vtkParse.y" + { setVarName((yyvsp[(1) - (3)].str)); } + break; + + case 265: + +/* Line 1455 of yacc.c */ +#line 2236 "vtkParse.y" + { clearArray(); } + break; + + case 267: + +/* Line 1455 of yacc.c */ +#line 2240 "vtkParse.y" + { clearArray(); } + break; + + case 271: + +/* Line 1455 of yacc.c */ +#line 2247 "vtkParse.y" + { postSig("["); } + break; + + case 272: + +/* Line 1455 of yacc.c */ +#line 2247 "vtkParse.y" + { postSig("]"); } + break; + + case 273: + +/* Line 1455 of yacc.c */ +#line 2250 "vtkParse.y" + { pushArraySize(""); } + break; + + case 274: + +/* Line 1455 of yacc.c */ +#line 2251 "vtkParse.y" + { markSig(); } + break; + + case 275: + +/* Line 1455 of yacc.c */ +#line 2251 "vtkParse.y" + { chopSig(); pushArraySize(copySig()); } + break; + + case 280: + +/* Line 1455 of yacc.c */ +#line 2267 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 281: + +/* Line 1455 of yacc.c */ +#line 2269 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 282: + +/* Line 1455 of yacc.c */ +#line 2271 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 283: + +/* Line 1455 of yacc.c */ +#line 2275 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 284: + +/* Line 1455 of yacc.c */ +#line 2277 "vtkParse.y" + { (yyval.str) = vtkstrcat((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } + break; + + case 285: + +/* Line 1455 of yacc.c */ +#line 2279 "vtkParse.y" + { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } + break; + + case 286: + +/* Line 1455 of yacc.c */ +#line 2281 "vtkParse.y" + { (yyval.str) = vtkstrcat3((yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } + break; + + case 287: + +/* Line 1455 of yacc.c */ +#line 2282 "vtkParse.y" + { postSig("template "); } + break; + + case 288: + +/* Line 1455 of yacc.c */ +#line 2284 "vtkParse.y" + { (yyval.str) = vtkstrcat4((yyvsp[(1) - (5)].str), "template ", (yyvsp[(4) - (5)].str), (yyvsp[(5) - (5)].str)); } + break; + + case 289: + +/* Line 1455 of yacc.c */ +#line 2287 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 290: + +/* Line 1455 of yacc.c */ +#line 2290 "vtkParse.y" + { (yyval.str) = "::"; postSig((yyval.str)); } + break; + + case 291: + +/* Line 1455 of yacc.c */ +#line 2293 "vtkParse.y" + { markSig(); postSig((yyvsp[(1) - (2)].str)); postSig("<"); } + break; + + case 292: + +/* Line 1455 of yacc.c */ +#line 2295 "vtkParse.y" + { + chopSig(); if (getSig()[getSigLength()-1] == '>') { postSig(" "); } + postSig(">"); (yyval.str) = copySig(); clearTypeId(); + } + break; + + case 293: + +/* Line 1455 of yacc.c */ +#line 2308 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 294: + +/* Line 1455 of yacc.c */ +#line 2309 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 295: + +/* Line 1455 of yacc.c */ +#line 2310 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 296: + +/* Line 1455 of yacc.c */ +#line 2311 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 297: + +/* Line 1455 of yacc.c */ +#line 2312 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 298: + +/* Line 1455 of yacc.c */ +#line 2313 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 299: + +/* Line 1455 of yacc.c */ +#line 2314 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); } + break; + + case 300: + +/* Line 1455 of yacc.c */ +#line 2315 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 301: + +/* Line 1455 of yacc.c */ +#line 2316 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 302: + +/* Line 1455 of yacc.c */ +#line 2317 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 303: + +/* Line 1455 of yacc.c */ +#line 2318 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 304: + +/* Line 1455 of yacc.c */ +#line 2319 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 305: + +/* Line 1455 of yacc.c */ +#line 2320 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 306: + +/* Line 1455 of yacc.c */ +#line 2321 "vtkParse.y" + { (yyval.str) = vtkstrcat("~",(yyvsp[(2) - (2)].str)); postSig((yyval.str)); } + break; + + case 307: + +/* Line 1455 of yacc.c */ +#line 2322 "vtkParse.y" + { (yyval.str) = "size_t"; postSig((yyval.str)); } + break; + + case 308: + +/* Line 1455 of yacc.c */ +#line 2323 "vtkParse.y" + { (yyval.str) = "ssize_t"; postSig((yyval.str)); } + break; + + case 309: + +/* Line 1455 of yacc.c */ +#line 2324 "vtkParse.y" + { (yyval.str) = "vtkTypeInt8"; postSig((yyval.str)); } + break; + + case 310: + +/* Line 1455 of yacc.c */ +#line 2325 "vtkParse.y" + { (yyval.str) = "vtkTypeUInt8"; postSig((yyval.str)); } + break; + + case 311: + +/* Line 1455 of yacc.c */ +#line 2326 "vtkParse.y" + { (yyval.str) = "vtkTypeInt16"; postSig((yyval.str)); } + break; + + case 312: + +/* Line 1455 of yacc.c */ +#line 2327 "vtkParse.y" + { (yyval.str) = "vtkTypeUInt16"; postSig((yyval.str)); } + break; + + case 313: + +/* Line 1455 of yacc.c */ +#line 2328 "vtkParse.y" + { (yyval.str) = "vtkTypeInt32"; postSig((yyval.str)); } + break; + + case 314: + +/* Line 1455 of yacc.c */ +#line 2329 "vtkParse.y" + { (yyval.str) = "vtkTypeUInt32"; postSig((yyval.str)); } + break; + + case 315: + +/* Line 1455 of yacc.c */ +#line 2330 "vtkParse.y" + { (yyval.str) = "vtkTypeInt64"; postSig((yyval.str)); } + break; + + case 316: + +/* Line 1455 of yacc.c */ +#line 2331 "vtkParse.y" + { (yyval.str) = "vtkTypeUInt64"; postSig((yyval.str)); } + break; + + case 317: + +/* Line 1455 of yacc.c */ +#line 2332 "vtkParse.y" + { (yyval.str) = "vtkTypeFloat32"; postSig((yyval.str)); } + break; + + case 318: + +/* Line 1455 of yacc.c */ +#line 2333 "vtkParse.y" + { (yyval.str) = "vtkTypeFloat64"; postSig((yyval.str)); } + break; + + case 319: + +/* Line 1455 of yacc.c */ +#line 2334 "vtkParse.y" + { (yyval.str) = "vtkIdType"; postSig((yyval.str)); } + break; + + case 330: + +/* Line 1455 of yacc.c */ +#line 2360 "vtkParse.y" + { setTypeBase(buildTypeBase(getType(), (yyvsp[(1) - (1)].integer))); } + break; + + case 331: + +/* Line 1455 of yacc.c */ +#line 2361 "vtkParse.y" + { setTypeMod(VTK_PARSE_TYPEDEF); } + break; + + case 332: + +/* Line 1455 of yacc.c */ +#line 2362 "vtkParse.y" + { setTypeMod(VTK_PARSE_FRIEND); } + break; + + case 335: + +/* Line 1455 of yacc.c */ +#line 2369 "vtkParse.y" + { setTypeMod((yyvsp[(1) - (1)].integer)); } + break; + + case 336: + +/* Line 1455 of yacc.c */ +#line 2370 "vtkParse.y" + { setTypeMod((yyvsp[(1) - (1)].integer)); } + break; + + case 337: + +/* Line 1455 of yacc.c */ +#line 2371 "vtkParse.y" + { setTypeMod((yyvsp[(1) - (1)].integer)); } + break; + + case 338: + +/* Line 1455 of yacc.c */ +#line 2374 "vtkParse.y" + { postSig("mutable "); (yyval.integer) = VTK_PARSE_MUTABLE; } + break; + + case 339: + +/* Line 1455 of yacc.c */ +#line 2375 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 340: + +/* Line 1455 of yacc.c */ +#line 2376 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 341: + +/* Line 1455 of yacc.c */ +#line 2377 "vtkParse.y" + { postSig("static "); (yyval.integer) = VTK_PARSE_STATIC; } + break; + + case 342: + +/* Line 1455 of yacc.c */ +#line 2380 "vtkParse.y" + { (yyval.integer) = 0; } + break; + + case 343: + +/* Line 1455 of yacc.c */ +#line 2381 "vtkParse.y" + { postSig("virtual "); (yyval.integer) = VTK_PARSE_VIRTUAL; } + break; + + case 344: + +/* Line 1455 of yacc.c */ +#line 2382 "vtkParse.y" + { postSig("explicit "); (yyval.integer) = VTK_PARSE_EXPLICIT; } + break; + + case 345: + +/* Line 1455 of yacc.c */ +#line 2385 "vtkParse.y" + { postSig("const "); (yyval.integer) = VTK_PARSE_CONST; } + break; + + case 346: + +/* Line 1455 of yacc.c */ +#line 2386 "vtkParse.y" + { postSig("volatile "); (yyval.integer) = VTK_PARSE_VOLATILE; } + break; + + case 348: + +/* Line 1455 of yacc.c */ +#line 2391 "vtkParse.y" + { (yyval.integer) = ((yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer)); } + break; + + case 350: + +/* Line 1455 of yacc.c */ +#line 2402 "vtkParse.y" + { setTypeBase((yyvsp[(1) - (1)].integer)); } + break; + + case 352: + +/* Line 1455 of yacc.c */ +#line 2404 "vtkParse.y" + { setTypeBase((yyvsp[(2) - (2)].integer)); } + break; + + case 355: + +/* Line 1455 of yacc.c */ +#line 2409 "vtkParse.y" + { postSig("typename "); } + break; + + case 356: + +/* Line 1455 of yacc.c */ +#line 2410 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(3) - (3)].str)); (yyval.integer) = guess_id_type((yyvsp[(3) - (3)].str)); } + break; + + case 357: + +/* Line 1455 of yacc.c */ +#line 2412 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } + break; + + case 358: + +/* Line 1455 of yacc.c */ +#line 2414 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } + break; + + case 359: + +/* Line 1455 of yacc.c */ +#line 2416 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } + break; + + case 360: + +/* Line 1455 of yacc.c */ +#line 2418 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } + break; + + case 362: + +/* Line 1455 of yacc.c */ +#line 2424 "vtkParse.y" + { setTypeBase((yyvsp[(1) - (1)].integer)); } + break; + + case 364: + +/* Line 1455 of yacc.c */ +#line 2426 "vtkParse.y" + { setTypeBase((yyvsp[(2) - (2)].integer)); } + break; + + case 367: + +/* Line 1455 of yacc.c */ +#line 2432 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } + break; + + case 368: + +/* Line 1455 of yacc.c */ +#line 2434 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(1) - (1)].str)); (yyval.integer) = guess_id_type((yyvsp[(1) - (1)].str)); } + break; + + case 369: + +/* Line 1455 of yacc.c */ +#line 2436 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } + break; + + case 370: + +/* Line 1455 of yacc.c */ +#line 2438 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } + break; + + case 371: + +/* Line 1455 of yacc.c */ +#line 2440 "vtkParse.y" + { postSig(" "); setTypeId((yyvsp[(2) - (2)].str)); (yyval.integer) = guess_id_type((yyvsp[(2) - (2)].str)); } + break; + + case 372: + +/* Line 1455 of yacc.c */ +#line 2443 "vtkParse.y" + { setTypeId(""); } + break; + + case 374: + +/* Line 1455 of yacc.c */ +#line 2447 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_STRING; } + break; + + case 375: + +/* Line 1455 of yacc.c */ +#line 2448 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_UNICODE_STRING;} + break; + + case 376: + +/* Line 1455 of yacc.c */ +#line 2449 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_OSTREAM; } + break; + + case 377: + +/* Line 1455 of yacc.c */ +#line 2450 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_ISTREAM; } + break; + + case 378: + +/* Line 1455 of yacc.c */ +#line 2451 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_UNKNOWN; } + break; + + case 379: + +/* Line 1455 of yacc.c */ +#line 2452 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_OBJECT; } + break; + + case 380: + +/* Line 1455 of yacc.c */ +#line 2453 "vtkParse.y" + { typeSig((yyvsp[(1) - (1)].str)); (yyval.integer) = VTK_PARSE_QOBJECT; } + break; + + case 381: + +/* Line 1455 of yacc.c */ +#line 2454 "vtkParse.y" + { typeSig("ssize_t"); (yyval.integer) = VTK_PARSE_SSIZE_T; } + break; + + case 382: + +/* Line 1455 of yacc.c */ +#line 2455 "vtkParse.y" + { typeSig("size_t"); (yyval.integer) = VTK_PARSE_SIZE_T; } + break; + + case 383: + +/* Line 1455 of yacc.c */ +#line 2456 "vtkParse.y" + { typeSig("vtkTypeInt8"); (yyval.integer) = VTK_PARSE_INT8; } + break; + + case 384: + +/* Line 1455 of yacc.c */ +#line 2457 "vtkParse.y" + { typeSig("vtkTypeUInt8"); (yyval.integer) = VTK_PARSE_UINT8; } + break; + + case 385: + +/* Line 1455 of yacc.c */ +#line 2458 "vtkParse.y" + { typeSig("vtkTypeInt16"); (yyval.integer) = VTK_PARSE_INT16; } + break; + + case 386: + +/* Line 1455 of yacc.c */ +#line 2459 "vtkParse.y" + { typeSig("vtkTypeUInt16"); (yyval.integer) = VTK_PARSE_UINT16; } + break; + + case 387: + +/* Line 1455 of yacc.c */ +#line 2460 "vtkParse.y" + { typeSig("vtkTypeInt32"); (yyval.integer) = VTK_PARSE_INT32; } + break; + + case 388: + +/* Line 1455 of yacc.c */ +#line 2461 "vtkParse.y" + { typeSig("vtkTypeUInt32"); (yyval.integer) = VTK_PARSE_UINT32; } + break; + + case 389: + +/* Line 1455 of yacc.c */ +#line 2462 "vtkParse.y" + { typeSig("vtkTypeInt64"); (yyval.integer) = VTK_PARSE_INT64; } + break; + + case 390: + +/* Line 1455 of yacc.c */ +#line 2463 "vtkParse.y" + { typeSig("vtkTypeUInt64"); (yyval.integer) = VTK_PARSE_UINT64; } + break; + + case 391: + +/* Line 1455 of yacc.c */ +#line 2464 "vtkParse.y" + { typeSig("vtkTypeFloat32"); (yyval.integer) = VTK_PARSE_FLOAT32; } + break; + + case 392: + +/* Line 1455 of yacc.c */ +#line 2465 "vtkParse.y" + { typeSig("vtkTypeFloat64"); (yyval.integer) = VTK_PARSE_FLOAT64; } + break; + + case 393: + +/* Line 1455 of yacc.c */ +#line 2466 "vtkParse.y" + { typeSig("vtkIdType"); (yyval.integer) = VTK_PARSE_ID_TYPE; } + break; + + case 394: + +/* Line 1455 of yacc.c */ +#line 2469 "vtkParse.y" + { postSig("void "); (yyval.integer) = VTK_PARSE_VOID; } + break; + + case 395: + +/* Line 1455 of yacc.c */ +#line 2470 "vtkParse.y" + { postSig("bool "); (yyval.integer) = VTK_PARSE_BOOL; } + break; + + case 396: + +/* Line 1455 of yacc.c */ +#line 2471 "vtkParse.y" + { postSig("float "); (yyval.integer) = VTK_PARSE_FLOAT; } + break; + + case 397: + +/* Line 1455 of yacc.c */ +#line 2472 "vtkParse.y" + { postSig("double "); (yyval.integer) = VTK_PARSE_DOUBLE; } + break; + + case 398: + +/* Line 1455 of yacc.c */ +#line 2473 "vtkParse.y" + { postSig("char "); (yyval.integer) = VTK_PARSE_CHAR; } + break; + + case 399: + +/* Line 1455 of yacc.c */ +#line 2474 "vtkParse.y" + { postSig("int "); (yyval.integer) = VTK_PARSE_INT; } + break; + + case 400: + +/* Line 1455 of yacc.c */ +#line 2475 "vtkParse.y" + { postSig("short "); (yyval.integer) = VTK_PARSE_SHORT; } + break; + + case 401: + +/* Line 1455 of yacc.c */ +#line 2476 "vtkParse.y" + { postSig("long "); (yyval.integer) = VTK_PARSE_LONG; } + break; + + case 402: + +/* Line 1455 of yacc.c */ +#line 2477 "vtkParse.y" + { postSig("__int64 "); (yyval.integer) = VTK_PARSE___INT64; } + break; + + case 403: + +/* Line 1455 of yacc.c */ +#line 2478 "vtkParse.y" + { postSig("signed "); (yyval.integer) = VTK_PARSE_INT; } + break; + + case 404: + +/* Line 1455 of yacc.c */ +#line 2479 "vtkParse.y" + { postSig("unsigned "); (yyval.integer) = VTK_PARSE_UNSIGNED_INT; } + break; + + case 407: + +/* Line 1455 of yacc.c */ +#line 2501 "vtkParse.y" + { (yyval.integer) = ((yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer)); } + break; + + case 408: + +/* Line 1455 of yacc.c */ +#line 2504 "vtkParse.y" + { postSig("&"); (yyval.integer) = VTK_PARSE_REF; } + break; + + case 409: + +/* Line 1455 of yacc.c */ +#line 2507 "vtkParse.y" + { postSig("*"); (yyval.integer) = VTK_PARSE_POINTER; } + break; + + case 410: + +/* Line 1455 of yacc.c */ +#line 2508 "vtkParse.y" + { postSig("*"); } + break; + + case 411: + +/* Line 1455 of yacc.c */ +#line 2509 "vtkParse.y" + { + if (((yyvsp[(3) - (3)].integer) & VTK_PARSE_CONST) != 0) + { + (yyval.integer) = VTK_PARSE_CONST_POINTER; + } + if (((yyvsp[(3) - (3)].integer) & VTK_PARSE_VOLATILE) != 0) + { + (yyval.integer) = VTK_PARSE_BAD_INDIRECT; + } + } + break; + + case 413: + +/* Line 1455 of yacc.c */ +#line 2525 "vtkParse.y" + { + unsigned int n; + n = (((yyvsp[(1) - (2)].integer) << 2) | (yyvsp[(2) - (2)].integer)); + if ((n & VTK_PARSE_INDIRECT) != n) + { + n = VTK_PARSE_BAD_INDIRECT; + } + (yyval.integer) = n; + } + break; + + case 414: + +/* Line 1455 of yacc.c */ +#line 2541 "vtkParse.y" + {preSig("void Set"); postSig("(");} + break; + + case 415: + +/* Line 1455 of yacc.c */ +#line 2542 "vtkParse.y" + { + postSig("a);"); + currentFunction->Macro = "vtkSetMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (7)].str)); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, getType(), getTypeId(), 0); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + } + break; + + case 416: + +/* Line 1455 of yacc.c */ +#line 2551 "vtkParse.y" + {postSig("Get");} + break; + + case 417: + +/* Line 1455 of yacc.c */ +#line 2552 "vtkParse.y" + {markSig();} + break; + + case 418: + +/* Line 1455 of yacc.c */ +#line 2552 "vtkParse.y" + {swapSig();} + break; + + case 419: + +/* Line 1455 of yacc.c */ +#line 2553 "vtkParse.y" + { + postSig("();"); + currentFunction->Macro = "vtkGetMacro"; + currentFunction->Name = vtkstrcat("Get", (yyvsp[(4) - (9)].str)); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, getType(), getTypeId(), 0); + output_function(); + } + break; + + case 420: + +/* Line 1455 of yacc.c */ +#line 2561 "vtkParse.y" + {preSig("void Set");} + break; + + case 421: + +/* Line 1455 of yacc.c */ +#line 2562 "vtkParse.y" + { + postSig("(char *);"); + currentFunction->Macro = "vtkSetStringMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(4) - (5)].str)); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_CHAR_PTR, "char", 0); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + } + break; + + case 422: + +/* Line 1455 of yacc.c */ +#line 2571 "vtkParse.y" + {preSig("char *Get");} + break; + + case 423: + +/* Line 1455 of yacc.c */ +#line 2572 "vtkParse.y" + { + postSig("();"); + currentFunction->Macro = "vtkGetStringMacro"; + currentFunction->Name = vtkstrcat("Get", (yyvsp[(4) - (5)].str)); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_CHAR_PTR, "char", 0); + output_function(); + } + break; + + case 424: + +/* Line 1455 of yacc.c */ +#line 2580 "vtkParse.y" + {startSig(); markSig();} + break; + + case 425: + +/* Line 1455 of yacc.c */ +#line 2580 "vtkParse.y" + {closeSig();} + break; + + case 426: + +/* Line 1455 of yacc.c */ +#line 2582 "vtkParse.y" + { + const char *typeText; + chopSig(); + typeText = copySig(); + + currentFunction->Macro = "vtkSetClampMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (10)].str)); + currentFunction->Signature = + vtkstrcat5("void ", currentFunction->Name, "(", typeText, ");"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, getType(), getTypeId(), 0); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = "vtkSetClampMacro"; + currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (10)].str), "MinValue"); + currentFunction->Signature = + vtkstrcat4(typeText, " ", currentFunction->Name, "();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, getType(), getTypeId(), 0); + output_function(); + + currentFunction->Macro = "vtkSetClampMacro"; + currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (10)].str), "MaxValue"); + currentFunction->Signature = + vtkstrcat4(typeText, " ", currentFunction->Name, "();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, getType(), getTypeId(), 0); + output_function(); + } + break; + + case 427: + +/* Line 1455 of yacc.c */ +#line 2613 "vtkParse.y" + {preSig("void Set"); postSig("("); } + break; + + case 428: + +/* Line 1455 of yacc.c */ +#line 2614 "vtkParse.y" + { + postSig("*);"); + currentFunction->Macro = "vtkSetObjectMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (7)].str)); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_OBJECT_PTR, getTypeId(), 0); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + } + break; + + case 429: + +/* Line 1455 of yacc.c */ +#line 2623 "vtkParse.y" + {postSig("*Get");} + break; + + case 430: + +/* Line 1455 of yacc.c */ +#line 2624 "vtkParse.y" + {markSig();} + break; + + case 431: + +/* Line 1455 of yacc.c */ +#line 2624 "vtkParse.y" + {swapSig();} + break; + + case 432: + +/* Line 1455 of yacc.c */ +#line 2625 "vtkParse.y" + { + postSig("();"); + currentFunction->Macro = "vtkGetObjectMacro"; + currentFunction->Name = vtkstrcat("Get", (yyvsp[(4) - (9)].str)); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_OBJECT_PTR, getTypeId(), 0); + output_function(); + } + break; + + case 433: + +/* Line 1455 of yacc.c */ +#line 2634 "vtkParse.y" + { + currentFunction->Macro = "vtkBooleanMacro"; + currentFunction->Name = vtkstrcat((yyvsp[(3) - (6)].str), "On"); + currentFunction->Comment = vtkstrdup(getComment()); + currentFunction->Signature = + vtkstrcat3("void ", currentFunction->Name, "();"); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = "vtkBooleanMacro"; + currentFunction->Name = vtkstrcat((yyvsp[(3) - (6)].str), "Off"); + currentFunction->Comment = vtkstrdup(getComment()); + currentFunction->Signature = + vtkstrcat3("void ", currentFunction->Name, "();"); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + } + break; + + case 434: + +/* Line 1455 of yacc.c */ +#line 2651 "vtkParse.y" + {startSig(); markSig();} + break; + + case 435: + +/* Line 1455 of yacc.c */ +#line 2652 "vtkParse.y" + { + chopSig(); + outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 2); + } + break; + + case 436: + +/* Line 1455 of yacc.c */ +#line 2656 "vtkParse.y" + {startSig(); markSig();} + break; + + case 437: + +/* Line 1455 of yacc.c */ +#line 2657 "vtkParse.y" + { + chopSig(); + outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 2); + } + break; + + case 438: + +/* Line 1455 of yacc.c */ +#line 2661 "vtkParse.y" + {startSig(); markSig();} + break; + + case 439: + +/* Line 1455 of yacc.c */ +#line 2662 "vtkParse.y" + { + chopSig(); + outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 3); + } + break; + + case 440: + +/* Line 1455 of yacc.c */ +#line 2666 "vtkParse.y" + {startSig(); markSig();} + break; + + case 441: + +/* Line 1455 of yacc.c */ +#line 2667 "vtkParse.y" + { + chopSig(); + outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 3); + } + break; + + case 442: + +/* Line 1455 of yacc.c */ +#line 2671 "vtkParse.y" + {startSig(); markSig();} + break; + + case 443: + +/* Line 1455 of yacc.c */ +#line 2672 "vtkParse.y" + { + chopSig(); + outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 4); + } + break; + + case 444: + +/* Line 1455 of yacc.c */ +#line 2676 "vtkParse.y" + {startSig(); markSig();} + break; + + case 445: + +/* Line 1455 of yacc.c */ +#line 2677 "vtkParse.y" + { + chopSig(); + outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 4); + } + break; + + case 446: + +/* Line 1455 of yacc.c */ +#line 2681 "vtkParse.y" + {startSig(); markSig();} + break; + + case 447: + +/* Line 1455 of yacc.c */ +#line 2682 "vtkParse.y" + { + chopSig(); + outputSetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 6); + } + break; + + case 448: + +/* Line 1455 of yacc.c */ +#line 2686 "vtkParse.y" + {startSig(); markSig();} + break; + + case 449: + +/* Line 1455 of yacc.c */ +#line 2687 "vtkParse.y" + { + chopSig(); + outputGetVectorMacro((yyvsp[(3) - (7)].str), getType(), copySig(), 6); + } + break; + + case 450: + +/* Line 1455 of yacc.c */ +#line 2691 "vtkParse.y" + {startSig(); markSig();} + break; + + case 451: + +/* Line 1455 of yacc.c */ +#line 2693 "vtkParse.y" + { + const char *typeText; + chopSig(); + typeText = copySig(); + currentFunction->Macro = "vtkSetVectorMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (9)].str)); + currentFunction->Signature = + vtkstrcat7("void ", currentFunction->Name, "(", typeText, + " a[", (yyvsp[(8) - (9)].str), "]);"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, (VTK_PARSE_POINTER | getType()), + getTypeId(), (int)strtol((yyvsp[(8) - (9)].str), NULL, 0)); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + } + break; + + case 452: + +/* Line 1455 of yacc.c */ +#line 2708 "vtkParse.y" + {startSig();} + break; + + case 453: + +/* Line 1455 of yacc.c */ +#line 2710 "vtkParse.y" + { + chopSig(); + currentFunction->Macro = "vtkGetVectorMacro"; + currentFunction->Name = vtkstrcat("Get", (yyvsp[(3) - (9)].str)); + postSig(" *"); + postSig(currentFunction->Name); + postSig("();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, (VTK_PARSE_POINTER | getType()), + getTypeId(), (int)strtol((yyvsp[(8) - (9)].str), NULL, 0)); + output_function(); + } + break; + + case 454: + +/* Line 1455 of yacc.c */ +#line 2723 "vtkParse.y" + { + currentFunction->Macro = "vtkViewportCoordinateMacro"; + currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (4)].str), "Coordinate"); + currentFunction->Signature = + vtkstrcat3("vtkCoordinate *", currentFunction->Name, "();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkCoordinate", 0); + output_function(); + + currentFunction->Macro = "vtkViewportCoordinateMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); + currentFunction->Signature = + vtkstrcat3("void ", currentFunction->Name, "(double, double);"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); + add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = "vtkViewportCoordinateMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); + currentFunction->Signature = + vtkstrcat3("void ", currentFunction->Name, "(double a[2]);"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 2); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = "vtkViewportCoordinateMacro"; + currentFunction->Name = vtkstrcat("Get", (yyvsp[(3) - (4)].str)); + currentFunction->Signature = + vtkstrcat3("double *", currentFunction->Name, "();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 2); + output_function(); + } + break; + + case 455: + +/* Line 1455 of yacc.c */ +#line 2760 "vtkParse.y" + { + currentFunction->Macro = "vtkWorldCoordinateMacro"; + currentFunction->Name = vtkstrcat3("Get", (yyvsp[(3) - (4)].str), "Coordinate"); + currentFunction->Signature = + vtkstrcat3("vtkCoordinate *", currentFunction->Name, "();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkCoordinate", 0); + output_function(); + + currentFunction->Macro = "vtkWorldCoordinateMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); + currentFunction->Signature = + vtkstrcat3("void ", currentFunction->Name, "(double, double, double);"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); + add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); + add_parameter(currentFunction, VTK_PARSE_DOUBLE, "double", 0); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = "vtkWorldCoordinateMacro"; + currentFunction->Name = vtkstrcat("Set", (yyvsp[(3) - (4)].str)); + currentFunction->Signature = + vtkstrcat3("void ", currentFunction->Name, "(double a[3]);"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 3); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = "vtkWorldCoordinateMacro"; + currentFunction->Name = vtkstrcat("Get", (yyvsp[(3) - (4)].str)); + currentFunction->Signature = + vtkstrcat3("double *", currentFunction->Name, "();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_DOUBLE_PTR, "double", 3); + output_function(); + } + break; + + case 456: + +/* Line 1455 of yacc.c */ +#line 2798 "vtkParse.y" + { + currentFunction->Macro = "vtkTypeMacro"; + currentFunction->Name = "GetClassName"; + currentFunction->Signature = "const char *GetClassName();"; + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, (VTK_PARSE_CONST | VTK_PARSE_CHAR_PTR), + "char", 0); + output_function(); + + currentFunction->Macro = "vtkTypeMacro"; + currentFunction->Name = "IsA"; + currentFunction->Signature = "int IsA(const char *name);"; + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, (VTK_PARSE_CONST | VTK_PARSE_CHAR_PTR), + "char", 0); + set_return(currentFunction, VTK_PARSE_INT, "int", 0); + output_function(); + + currentFunction->Macro = "vtkTypeMacro"; + currentFunction->Name = "NewInstance"; + currentFunction->Signature = vtkstrcat((yyvsp[(3) - (7)].str), " *NewInstance();"); + currentFunction->Comment = vtkstrdup(getComment()); + set_return(currentFunction, VTK_PARSE_OBJECT_PTR, (yyvsp[(3) - (7)].str), 0); + output_function(); + + currentFunction->Macro = "vtkTypeMacro"; + currentFunction->Name = "SafeDownCast"; + currentFunction->Signature = + vtkstrcat((yyvsp[(3) - (7)].str), " *SafeDownCast(vtkObject* o);"); + currentFunction->Comment = vtkstrdup(getComment()); + add_parameter(currentFunction, VTK_PARSE_OBJECT_PTR, "vtkObject", 0); + set_return(currentFunction, (VTK_PARSE_STATIC | VTK_PARSE_OBJECT_PTR), + (yyvsp[(3) - (7)].str), 0); + output_function(); + } + break; + + case 459: + +/* Line 1455 of yacc.c */ +#line 2842 "vtkParse.y" + { (yyval.str) = "()"; } + break; + + case 460: + +/* Line 1455 of yacc.c */ +#line 2843 "vtkParse.y" + { (yyval.str) = "[]"; } + break; + + case 461: + +/* Line 1455 of yacc.c */ +#line 2844 "vtkParse.y" + { (yyval.str) = " new[]"; } + break; + + case 462: + +/* Line 1455 of yacc.c */ +#line 2845 "vtkParse.y" + { (yyval.str) = " delete[]"; } + break; + + case 463: + +/* Line 1455 of yacc.c */ +#line 2846 "vtkParse.y" + { (yyval.str) = "<"; } + break; + + case 464: + +/* Line 1455 of yacc.c */ +#line 2847 "vtkParse.y" + { (yyval.str) = ">"; } + break; + + case 465: + +/* Line 1455 of yacc.c */ +#line 2848 "vtkParse.y" + { (yyval.str) = ","; } + break; + + case 466: + +/* Line 1455 of yacc.c */ +#line 2849 "vtkParse.y" + { (yyval.str) = "="; } + break; + + case 468: + +/* Line 1455 of yacc.c */ +#line 2853 "vtkParse.y" + { (yyval.str) = "%"; } + break; + + case 469: + +/* Line 1455 of yacc.c */ +#line 2854 "vtkParse.y" + { (yyval.str) = "*"; } + break; + + case 470: + +/* Line 1455 of yacc.c */ +#line 2855 "vtkParse.y" + { (yyval.str) = "/"; } + break; + + case 471: + +/* Line 1455 of yacc.c */ +#line 2856 "vtkParse.y" + { (yyval.str) = "-"; } + break; + + case 472: + +/* Line 1455 of yacc.c */ +#line 2857 "vtkParse.y" + { (yyval.str) = "+"; } + break; + + case 473: + +/* Line 1455 of yacc.c */ +#line 2858 "vtkParse.y" + { (yyval.str) = "!"; } + break; + + case 474: + +/* Line 1455 of yacc.c */ +#line 2859 "vtkParse.y" + { (yyval.str) = "~"; } + break; + + case 475: + +/* Line 1455 of yacc.c */ +#line 2860 "vtkParse.y" + { (yyval.str) = "&"; } + break; + + case 476: + +/* Line 1455 of yacc.c */ +#line 2861 "vtkParse.y" + { (yyval.str) = "|"; } + break; + + case 477: + +/* Line 1455 of yacc.c */ +#line 2862 "vtkParse.y" + { (yyval.str) = "^"; } + break; + + case 478: + +/* Line 1455 of yacc.c */ +#line 2863 "vtkParse.y" + { (yyval.str) = " new"; } + break; + + case 479: + +/* Line 1455 of yacc.c */ +#line 2864 "vtkParse.y" + { (yyval.str) = " delete"; } + break; + + case 480: + +/* Line 1455 of yacc.c */ +#line 2865 "vtkParse.y" + { (yyval.str) = "<<="; } + break; + + case 481: + +/* Line 1455 of yacc.c */ +#line 2866 "vtkParse.y" + { (yyval.str) = ">>="; } + break; + + case 482: + +/* Line 1455 of yacc.c */ +#line 2867 "vtkParse.y" + { (yyval.str) = "<<"; } + break; + + case 483: + +/* Line 1455 of yacc.c */ +#line 2868 "vtkParse.y" + { (yyval.str) = ">>"; } + break; + + case 484: + +/* Line 1455 of yacc.c */ +#line 2869 "vtkParse.y" + { (yyval.str) = ".*"; } + break; + + case 485: + +/* Line 1455 of yacc.c */ +#line 2870 "vtkParse.y" + { (yyval.str) = "->*"; } + break; + + case 486: + +/* Line 1455 of yacc.c */ +#line 2871 "vtkParse.y" + { (yyval.str) = "->"; } + break; + + case 487: + +/* Line 1455 of yacc.c */ +#line 2872 "vtkParse.y" + { (yyval.str) = "+="; } + break; + + case 488: + +/* Line 1455 of yacc.c */ +#line 2873 "vtkParse.y" + { (yyval.str) = "-="; } + break; + + case 489: + +/* Line 1455 of yacc.c */ +#line 2874 "vtkParse.y" + { (yyval.str) = "*="; } + break; + + case 490: + +/* Line 1455 of yacc.c */ +#line 2875 "vtkParse.y" + { (yyval.str) = "/="; } + break; + + case 491: + +/* Line 1455 of yacc.c */ +#line 2876 "vtkParse.y" + { (yyval.str) = "%="; } + break; + + case 492: + +/* Line 1455 of yacc.c */ +#line 2877 "vtkParse.y" + { (yyval.str) = "++"; } + break; + + case 493: + +/* Line 1455 of yacc.c */ +#line 2878 "vtkParse.y" + { (yyval.str) = "--"; } + break; + + case 494: + +/* Line 1455 of yacc.c */ +#line 2879 "vtkParse.y" + { (yyval.str) = "&="; } + break; + + case 495: + +/* Line 1455 of yacc.c */ +#line 2880 "vtkParse.y" + { (yyval.str) = "|="; } + break; + + case 496: + +/* Line 1455 of yacc.c */ +#line 2881 "vtkParse.y" + { (yyval.str) = "^="; } + break; + + case 497: + +/* Line 1455 of yacc.c */ +#line 2882 "vtkParse.y" + { (yyval.str) = "&&"; } + break; + + case 498: + +/* Line 1455 of yacc.c */ +#line 2883 "vtkParse.y" + { (yyval.str) = "||"; } + break; + + case 499: + +/* Line 1455 of yacc.c */ +#line 2884 "vtkParse.y" + { (yyval.str) = "=="; } + break; + + case 500: + +/* Line 1455 of yacc.c */ +#line 2885 "vtkParse.y" + { (yyval.str) = "!="; } + break; + + case 501: + +/* Line 1455 of yacc.c */ +#line 2886 "vtkParse.y" + { (yyval.str) = "<="; } + break; + + case 502: + +/* Line 1455 of yacc.c */ +#line 2887 "vtkParse.y" + { (yyval.str) = ">="; } + break; + + case 503: + +/* Line 1455 of yacc.c */ +#line 2890 "vtkParse.y" + { (yyval.str) = "typedef"; } + break; + + case 504: + +/* Line 1455 of yacc.c */ +#line 2891 "vtkParse.y" + { (yyval.str) = "typename"; } + break; + + case 505: + +/* Line 1455 of yacc.c */ +#line 2892 "vtkParse.y" + { (yyval.str) = "class"; } + break; + + case 506: + +/* Line 1455 of yacc.c */ +#line 2893 "vtkParse.y" + { (yyval.str) = "struct"; } + break; + + case 507: + +/* Line 1455 of yacc.c */ +#line 2894 "vtkParse.y" + { (yyval.str) = "union"; } + break; + + case 508: + +/* Line 1455 of yacc.c */ +#line 2895 "vtkParse.y" + { (yyval.str) = "template"; } + break; + + case 509: + +/* Line 1455 of yacc.c */ +#line 2896 "vtkParse.y" + { (yyval.str) = "public"; } + break; + + case 510: + +/* Line 1455 of yacc.c */ +#line 2897 "vtkParse.y" + { (yyval.str) = "protected"; } + break; + + case 511: + +/* Line 1455 of yacc.c */ +#line 2898 "vtkParse.y" + { (yyval.str) = "private"; } + break; + + case 512: + +/* Line 1455 of yacc.c */ +#line 2899 "vtkParse.y" + { (yyval.str) = "const"; } + break; + + case 513: + +/* Line 1455 of yacc.c */ +#line 2900 "vtkParse.y" + { (yyval.str) = "static"; } + break; + + case 514: + +/* Line 1455 of yacc.c */ +#line 2901 "vtkParse.y" + { (yyval.str) = "inline"; } + break; + + case 515: + +/* Line 1455 of yacc.c */ +#line 2902 "vtkParse.y" + { (yyval.str) = "virtual"; } + break; + + case 516: + +/* Line 1455 of yacc.c */ +#line 2903 "vtkParse.y" + { (yyval.str) = "extern"; } + break; + + case 517: + +/* Line 1455 of yacc.c */ +#line 2904 "vtkParse.y" + { (yyval.str) = "namespace"; } + break; + + case 518: + +/* Line 1455 of yacc.c */ +#line 2905 "vtkParse.y" + { (yyval.str) = "operator"; } + break; + + case 519: + +/* Line 1455 of yacc.c */ +#line 2906 "vtkParse.y" + { (yyval.str) = "enum"; } + break; + + case 520: + +/* Line 1455 of yacc.c */ +#line 2907 "vtkParse.y" + { (yyval.str) = "throw"; } + break; + + case 521: + +/* Line 1455 of yacc.c */ +#line 2908 "vtkParse.y" + { (yyval.str) = "const_cast"; } + break; + + case 522: + +/* Line 1455 of yacc.c */ +#line 2909 "vtkParse.y" + { (yyval.str) = "dynamic_cast"; } + break; + + case 523: + +/* Line 1455 of yacc.c */ +#line 2910 "vtkParse.y" + { (yyval.str) = "static_cast"; } + break; + + case 524: + +/* Line 1455 of yacc.c */ +#line 2911 "vtkParse.y" + { (yyval.str) = "reinterpret_cast"; } + break; + + case 537: + +/* Line 1455 of yacc.c */ +#line 2935 "vtkParse.y" + { + if ((((yyvsp[(1) - (1)].str))[0] == '+' || ((yyvsp[(1) - (1)].str))[0] == '-' || + ((yyvsp[(1) - (1)].str))[0] == '*' || ((yyvsp[(1) - (1)].str))[0] == '&') && + ((yyvsp[(1) - (1)].str))[1] == '\0') + { + int c1 = 0; + size_t l; + const char *cp; + chopSig(); + cp = getSig(); + l = getSigLength(); + if (l != 0) { c1 = cp[l-1]; } + if (c1 != 0 && c1 != '(' && c1 != '[' && c1 != '=') + { + postSig(" "); + } + postSig((yyvsp[(1) - (1)].str)); + if ((c1 >= 'A' && c1 <= 'Z') || (c1 >= 'a' && c1 <= 'z') || + (c1 >= '0' && c1 <= '9') || c1 == '_' || c1 == '\'' || + c1 == '\"' || c1 == ')' || c1 == ']') + { + postSig(" "); + } + } + else + { + postSig((yyvsp[(1) - (1)].str)); + postSig(" "); + } + } + break; + + case 538: + +/* Line 1455 of yacc.c */ +#line 2965 "vtkParse.y" + { postSig(":"); postSig(" "); } + break; + + case 539: + +/* Line 1455 of yacc.c */ +#line 2965 "vtkParse.y" + { postSig("."); } + break; + + case 540: + +/* Line 1455 of yacc.c */ +#line 2966 "vtkParse.y" + { chopSig(); postSig("::"); } + break; + + case 541: + +/* Line 1455 of yacc.c */ +#line 2967 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); postSig(" "); } + break; + + case 542: + +/* Line 1455 of yacc.c */ +#line 2968 "vtkParse.y" + { postSig((yyvsp[(1) - (1)].str)); postSig(" "); } + break; + + case 544: + +/* Line 1455 of yacc.c */ +#line 2971 "vtkParse.y" + { + int c1 = 0; + size_t l; + const char *cp; + chopSig(); + cp = getSig(); + l = getSigLength(); + if (l != 0) { c1 = cp[l-1]; } + while (((c1 >= 'A' && c1 <= 'Z') || (c1 >= 'a' && c1 <= 'z') || + (c1 >= '0' && c1 <= '9') || c1 == '_') && l != 0) + { + --l; + c1 = cp[l-1]; + } + if (l < 2 || cp[l-1] != ':' || cp[l-2] != ':') + { + cp = add_const_scope(&cp[l]); + resetSig(l); + postSig(cp); + } + } + break; + + case 548: + +/* Line 1455 of yacc.c */ +#line 2997 "vtkParse.y" + { postSig("< "); } + break; + + case 549: + +/* Line 1455 of yacc.c */ +#line 2998 "vtkParse.y" + { postSig("> "); } + break; + + case 551: + +/* Line 1455 of yacc.c */ +#line 3001 "vtkParse.y" + { postSig("= "); } + break; + + case 552: + +/* Line 1455 of yacc.c */ +#line 3002 "vtkParse.y" + { chopSig(); postSig(", "); } + break; + + case 554: + +/* Line 1455 of yacc.c */ +#line 3005 "vtkParse.y" + { chopSig(); postSig(";"); } + break; + + case 562: + +/* Line 1455 of yacc.c */ +#line 3019 "vtkParse.y" + { postSig("= "); } + break; + + case 563: + +/* Line 1455 of yacc.c */ +#line 3020 "vtkParse.y" + { chopSig(); postSig(", "); } + break; + + case 564: + +/* Line 1455 of yacc.c */ +#line 3024 "vtkParse.y" + { + chopSig(); + if (getSig()[getSigLength()-1] == '<') { postSig(" "); } + postSig("<"); + } + break; + + case 565: + +/* Line 1455 of yacc.c */ +#line 3030 "vtkParse.y" + { + chopSig(); + if (getSig()[getSigLength()-1] == '>') { postSig(" "); } + postSig("> "); + } + break; + + case 566: + +/* Line 1455 of yacc.c */ +#line 3037 "vtkParse.y" + { postSig("["); } + break; + + case 567: + +/* Line 1455 of yacc.c */ +#line 3038 "vtkParse.y" + { chopSig(); postSig("] "); } + break; + + case 568: + +/* Line 1455 of yacc.c */ +#line 3041 "vtkParse.y" + { postSig("("); } + break; + + case 569: + +/* Line 1455 of yacc.c */ +#line 3042 "vtkParse.y" + { chopSig(); postSig(") "); } + break; + + case 570: + +/* Line 1455 of yacc.c */ +#line 3043 "vtkParse.y" + { postSig("("); postSig((yyvsp[(1) - (1)].str)); postSig("*"); } + break; + + case 571: + +/* Line 1455 of yacc.c */ +#line 3044 "vtkParse.y" + { chopSig(); postSig(") "); } + break; + + case 572: + +/* Line 1455 of yacc.c */ +#line 3045 "vtkParse.y" + { postSig("("); postSig((yyvsp[(1) - (1)].str)); postSig("&"); } + break; + + case 573: + +/* Line 1455 of yacc.c */ +#line 3046 "vtkParse.y" + { chopSig(); postSig(") "); } + break; + + case 574: + +/* Line 1455 of yacc.c */ +#line 3049 "vtkParse.y" + { postSig("{ "); } + break; + + case 575: + +/* Line 1455 of yacc.c */ +#line 3049 "vtkParse.y" + { postSig("} "); } + break; + + + +/* Line 1455 of yacc.c */ +#line 7941 "vtkParse.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* 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 - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 3088 "vtkParse.y" + +#include +#include "lex.yy.c" + +/* fill in the type name if none given */ +const char *type_class(unsigned int type, const char *classname) +{ + if (classname) + { + if (classname[0] == '\0') + { + switch ((type & VTK_PARSE_BASE_TYPE)) + { + case VTK_PARSE_VOID: + classname = "void"; + break; + case VTK_PARSE_BOOL: + classname = "bool"; + break; + case VTK_PARSE_FLOAT: + classname = "float"; + break; + case VTK_PARSE_DOUBLE: + classname = "double"; + break; + case VTK_PARSE_LONG_DOUBLE: + classname = "long double"; + break; + case VTK_PARSE_CHAR: + classname = "char"; + break; + case VTK_PARSE_UNSIGNED_CHAR: + classname = "unsigned char"; + break; + case VTK_PARSE_SIGNED_CHAR: + classname = "signed char"; + break; + case VTK_PARSE_SHORT: + classname = "short"; + break; + case VTK_PARSE_UNSIGNED_SHORT: + classname = "unsigned short"; + break; + case VTK_PARSE_INT: + classname = "int"; + break; + case VTK_PARSE_UNSIGNED_INT: + classname = "unsigned int"; + break; + case VTK_PARSE_LONG: + classname = "long"; + break; + case VTK_PARSE_UNSIGNED_LONG: + classname = "unsigned long"; + break; + case VTK_PARSE_LONG_LONG: + classname = "long long"; + break; + case VTK_PARSE_UNSIGNED_LONG_LONG: + classname = "unsigned long long"; + break; + case VTK_PARSE___INT64: + classname = "__int64"; + break; + case VTK_PARSE_UNSIGNED___INT64: + classname = "unsigned __int64"; + break; + } + } + } + + return classname; +} + +/* check whether this is the class we are looking for */ +void start_class(const char *classname, int is_struct_or_union) +{ + ClassInfo *outerClass = currentClass; + pushClass(); + currentClass = (ClassInfo *)malloc(sizeof(ClassInfo)); + vtkParse_InitClass(currentClass); + currentClass->Name = classname; + if (is_struct_or_union == 1) + { + currentClass->ItemType = VTK_STRUCT_INFO; + } + if (is_struct_or_union == 2) + { + currentClass->ItemType = VTK_UNION_INFO; + } + + if (classname && classname[strlen(classname)-1] != '>') + { + if (outerClass) + { + vtkParse_AddClassToClass(outerClass, currentClass); + } + else + { + vtkParse_AddClassToNamespace(currentNamespace, currentClass); + } + } + + /* template information */ + if (currentTemplate) + { + currentClass->Template = currentTemplate; + currentTemplate = NULL; + } + + /* comment, if any */ + currentClass->Comment = vtkstrdup(getComment()); + + access_level = VTK_ACCESS_PRIVATE; + if (is_struct_or_union) + { + access_level = VTK_ACCESS_PUBLIC; + } + + vtkParse_InitFunction(currentFunction); + startSig(); + clearComment(); +} + +/* reject the class */ +void reject_class(const char *classname, int is_struct_or_union) +{ + static ClassInfo static_class; + + pushClass(); + currentClass = &static_class; + currentClass->Name = classname; + vtkParse_InitClass(currentClass); + + access_level = VTK_ACCESS_PRIVATE; + if (is_struct_or_union) + { + access_level = VTK_ACCESS_PUBLIC; + } + + vtkParse_InitFunction(currentFunction); + startSig(); + clearComment(); +} + +/* reached the end of a class definition */ +void end_class() +{ + /* add default constructors */ + vtkParse_AddDefaultConstructors(currentClass, data->Strings); + + popClass(); +} + +/* add a base class to the specified class */ +void add_base_class(ClassInfo *cls, const char *name, int al, int virt) +{ + if (cls && al == VTK_ACCESS_PUBLIC && virt == 0) + { + vtkParse_AddStringToArray(&cls->SuperClasses, + &cls->NumberOfSuperClasses, + name); + } +} + +/* add a using declaration or directive */ +void add_using(const char *name, int is_namespace) +{ + size_t i; + UsingInfo *item; + + item = (UsingInfo *)malloc(sizeof(UsingInfo)); + vtkParse_InitUsing(item); + if (is_namespace) + { + item->Name = NULL; + item->Scope = name; + } + else + { + i = strlen(name); + while (i > 0 && name[i-1] != ':') { i--; } + item->Name = vtkstrdup(&name[i]); + while (i > 0 && name[i-1] == ':') { i--; } + item->Scope = vtkstrndup(name, i); + } + + if (currentClass) + { + vtkParse_AddUsingToClass(currentClass, item); + } + else + { + vtkParse_AddUsingToNamespace(currentNamespace, item); + } +} + +/* start a new enum */ +void start_enum(const char *name) +{ + EnumInfo *item; + + currentEnumName = "int"; + currentEnumValue = NULL; + if (name) + { + currentEnumName = name; + item = (EnumInfo *)malloc(sizeof(EnumInfo)); + vtkParse_InitEnum(item); + item->Name = name; + item->Access = access_level; + if (currentClass) + { + vtkParse_AddEnumToClass(currentClass, item); + } + else + { + vtkParse_AddEnumToNamespace(currentNamespace, item); + } + } +} + +/* finish the enum */ +void end_enum() +{ + currentEnumName = NULL; + currentEnumValue = NULL; +} + +/* add a constant to the enum */ +void add_enum(const char *name, const char *value) +{ + static char text[2048]; + int i; + long j; + + if (value) + { + strcpy(text, value); + currentEnumValue = value; + } + else if (currentEnumValue) + { + i = strlen(text); + while (i > 0 && text[i-1] >= '0' && + text[i-1] <= '9') { i--; } + + if (i == 0 || text[i-1] == ' ' || + (i > 1 && text[i-2] == ' ' && + (text[i-1] == '-' || text[i-1] == '+'))) + { + if (i > 0 && text[i-1] != ' ') + { + i--; + } + j = (int)strtol(&text[i], NULL, 10); + sprintf(&text[i], "%li", j+1); + } + else + { + i = strlen(text); + strcpy(&text[i], " + 1"); + } + currentEnumValue = vtkstrdup(text); + } + else + { + strcpy(text, "0"); + currentEnumValue = "0"; + } + + add_constant(name, currentEnumValue, VTK_PARSE_INT, currentEnumName, 2); +} + +/* for a macro constant, guess the constant type, doesn't do any math */ +unsigned int guess_constant_type(const char *valstring) +{ + unsigned int valtype = 0; + size_t k; + int i; + int is_name = 0; + + if (valstring == NULL || valstring[0] == '\0') + { + return 0; + } + + if (valstring[0] < '0' || valstring[0] > '9') + { + k = 0; + while ((valstring[k] >= '0' && valstring[k] <= '9') || + (valstring[k] >= 'a' && valstring[k] <= 'z') || + (valstring[k] >= 'A' && valstring[k] <= 'Z') || + valstring[k] == '_') { k++; } + + if (valstring[k] == '\0') + { + is_name = 1; + } + } + + if (strcmp(valstring, "true") == 0 || strcmp(valstring, "false") == 0) + { + return VTK_PARSE_BOOL; + } + + if (valstring[0] == '\'') + { + return VTK_PARSE_CHAR; + } + + if (strncmp(valstring, "VTK_TYPE_CAST(", 14) == 0 || + strncmp(valstring, "static_cast<", 12) == 0 || + strncmp(valstring, "const_cast<", 11) == 0 || + strncmp(valstring, "(", 1) == 0) + { + const char *cp; + size_t n; + int is_unsigned = 0; + + cp = &valstring[1]; + if (valstring[0] == 'c') + { + cp = &valstring[11]; + } + else if (valstring[0] == 's') + { + cp = &valstring[12]; + } + else if (valstring[0] == 'V') + { + cp = &valstring[14]; + } + + if (strncmp(cp, "unsigned ", 9) == 0) + { + is_unsigned = 1; + cp += 9; + } + + n = strlen(cp); + for (k = 0; k < n && cp[k] != ',' && + cp[k] != '>' && cp[k] != ')'; k++) { ; }; + + if (strncmp(cp, "long long", k) == 0) + { valtype = VTK_PARSE_LONG_LONG; } + else if (strncmp(cp, "__int64", k) == 0) + { valtype = VTK_PARSE___INT64; } + else if (strncmp(cp, "long", k) == 0) + { valtype = VTK_PARSE_LONG; } + else if (strncmp(cp, "short", k) == 0) + { valtype = VTK_PARSE_SHORT; } + else if (strncmp(cp, "signed char", k) == 0) + { valtype = VTK_PARSE_SIGNED_CHAR; } + else if (strncmp(cp, "char", k) == 0) + { valtype = VTK_PARSE_CHAR; } + else if (strncmp(cp, "int", k) == 0 || + strncmp(cp, "signed", k) == 0) + { valtype = VTK_PARSE_INT; } + else if (strncmp(cp, "float", k) == 0) + { valtype = VTK_PARSE_FLOAT; } + else if (strncmp(cp, "double", k) == 0) + { valtype = VTK_PARSE_DOUBLE; } + else if (strncmp(cp, "char *", k) == 0) + { valtype = VTK_PARSE_CHAR_PTR; } + + if (is_unsigned) + { + if (valtype == 0) { valtype = VTK_PARSE_INT; } + valtype = (valtype | VTK_PARSE_UNSIGNED); + } + + if (valtype != 0) + { + return valtype; + } + } + + /* check the current scope */ + if (is_name) + { + NamespaceInfo *scope = currentNamespace; + if (namespaceDepth > 0) + { + scope = namespaceStack[0]; + } + + for (i = 0; i < scope->NumberOfConstants; i++) + { + if (strcmp(scope->Constants[i]->Name, valstring) == 0) + { + return scope->Constants[i]->Type; + } + } + } + + /* check for preprocessor macros */ + if (is_name) + { + MacroInfo *macro = vtkParsePreprocess_GetMacro( + preprocessor, valstring); + + if (macro && !macro->IsFunction) + { + return guess_constant_type(macro->Definition); + } + } + + /* fall back to the preprocessor to evaluate the constant */ + { + preproc_int_t val; + int is_unsigned; + int result = vtkParsePreprocess_EvaluateExpression( + preprocessor, valstring, &val, &is_unsigned); + + if (result == VTK_PARSE_PREPROC_DOUBLE) + { + return VTK_PARSE_DOUBLE; + } + else if (result == VTK_PARSE_PREPROC_FLOAT) + { + return VTK_PARSE_FLOAT; + } + else if (result == VTK_PARSE_PREPROC_STRING) + { + return VTK_PARSE_CHAR_PTR; + } + else if (result == VTK_PARSE_OK) + { + if (is_unsigned) + { + if ((preproc_uint_t)val <= VTK_UNSIGNED_INT_MAX) + { + return VTK_PARSE_UNSIGNED_INT; + } + else + { +#if defined(VTK_TYPE_USE_LONG_LONG) + return VTK_PARSE_UNSIGNED_LONG_LONG; +#elif defined(VTK_TYPE_USE___INT64) + return VTK_PARSE_UNSIGNED___INT64; +#else + return VTK_PARSE_UNSIGNED_LONG; +#endif + } + } + else + { + if (val >= VTK_INT_MIN && val <= VTK_INT_MAX) + { + return VTK_PARSE_INT; + } + else + { +#if defined(VTK_TYPE_USE_LONG_LONG) + return VTK_PARSE_LONG_LONG; +#elif defined(VTK_TYPE_USE___INT64) + return VTK_PARSE___INT64; +#else + return VTK_PARSE_LONG; +#endif + } + } + } + } + + return 0; +} + +/* add a constant to the current class or namespace */ +void add_constant(const char *name, const char *value, + unsigned int type, const char *typeclass, int flag) +{ + ValueInfo *con = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(con); + con->ItemType = VTK_CONSTANT_INFO; + con->Name = name; + con->Value = value; + con->Type = type; + con->Class = type_class(type, typeclass); + + if (flag == 2) + { + con->IsEnum = 1; + } + + if (flag == 1) + { + /* actually a macro, need to guess the type */ + ValueInfo **cptr = data->Contents->Constants; + int n = data->Contents->NumberOfConstants; + int i; + + con->Access = VTK_ACCESS_PUBLIC; + if (con->Type == 0) + { + con->Type = guess_constant_type(con->Value); + } + + for (i = 0; i < n; i++) + { + if (strcmp(cptr[i]->Name, con->Name) == 0) + { + break; + } + } + + if (i == n) + { + vtkParse_AddConstantToNamespace(data->Contents, con); + } + else + { + vtkParse_FreeValue(con); + } + } + else if (currentClass) + { + con->Access = access_level; + vtkParse_AddConstantToClass(currentClass, con); + } + else + { + con->Access = VTK_ACCESS_PUBLIC; + vtkParse_AddConstantToNamespace(currentNamespace, con); + } +} + +/* if the name is a const in this namespace, the scope it */ +const char *add_const_scope(const char *name) +{ + static char text[256]; + NamespaceInfo *scope = currentNamespace; + int i, j; + int addscope = 0; + + strcpy(text, name); + + if (currentClass) + { + for (j = 0; j < currentClass->NumberOfConstants; j++) + { + if (strcmp(currentClass->Constants[j]->Name, text) == 0) + { + prepend_scope(text, currentClass->Name); + addscope = 1; + } + } + } + i = namespaceDepth; + while (scope && scope->Name) + { + if (addscope) + { + prepend_scope(text, scope->Name); + } + else + { + for (j = 0; j < scope->NumberOfConstants; j++) + { + if (strcmp(scope->Constants[j]->Name, text) == 0) + { + prepend_scope(text, scope->Name); + addscope = 1; + } + } + } + + scope = 0; + if (i > 0) + { + scope = namespaceStack[--i]; + } + } + + return text; +} + +/* guess the type from the ID */ +unsigned int guess_id_type(const char *cp) +{ + unsigned int t = 0; + + if (cp) + { + size_t i; + const char *dp; + + i = strlen(cp); + while (i > 0 && cp[i-1] != ':') { i--; } + dp = &cp[i]; + + if (strcmp(dp, "vtkStdString") == 0 || + strcmp(cp, "std::string") == 0) + { + t = VTK_PARSE_STRING; + } + else if (strcmp(dp, "vtkUnicodeString") == 0) + { + t = VTK_PARSE_UNICODE_STRING; + } + else if (strncmp(dp, "vtk", 3) == 0) + { + t = VTK_PARSE_OBJECT; + } + else if (strncmp(dp, "Q", 1) == 0 || + strncmp(cp, "Qt::", 4) == 0) + { + t = VTK_PARSE_QOBJECT; + } + else + { + t = VTK_PARSE_UNKNOWN; + } + } + + return t; +} + +/* add a template parameter to the current template */ +void add_template_parameter( + unsigned int datatype, unsigned int extra, const char *funcSig) +{ + ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(param); + handle_complex_type(param, datatype, extra, funcSig); + param->Name = getVarName(); + vtkParse_AddParameterToTemplate(currentTemplate, param); +} + +/* add a parameter to a function */ +void add_parameter(FunctionInfo *func, unsigned int type, + const char *typeclass, int count) +{ + char text[64]; + ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(param); + + param->Type = type; + param->Class = type_class(type, typeclass); + + if (count) + { + param->Count = count; + sprintf(text, "%i", count); + vtkParse_AddStringToArray(¶m->Dimensions, ¶m->NumberOfDimensions, + vtkstrdup(text)); + } + + add_legacy_parameter(func, param); + + vtkParse_AddParameterToFunction(func, param); +} + +/* set the return type for the current function */ +void set_return(FunctionInfo *func, unsigned int type, + const char *typeclass, int count) +{ + char text[64]; + ValueInfo *val = (ValueInfo *)malloc(sizeof(ValueInfo)); + + vtkParse_InitValue(val); + val->Type = type; + val->Class = type_class(type, typeclass); + + if (count) + { + val->Count = count; + sprintf(text, "%i", count); + vtkParse_AddStringToArray(&val->Dimensions, &val->NumberOfDimensions, + vtkstrdup(text)); + } + + func->ReturnValue = val; + +#ifndef VTK_PARSE_LEGACY_REMOVE + func->ReturnType = val->Type; + func->ReturnClass = val->Class; + func->HaveHint = (count > 0); + func->HintSize = count; +#endif +} + +int count_from_dimensions(ValueInfo *val) +{ + int count, i, n; + const char *cp; + + /* count is the product of the dimensions */ + count = 0; + if (val->NumberOfDimensions) + { + count = 1; + for (i = 0; i < val->NumberOfDimensions; i++) + { + n = 0; + cp = val->Dimensions[i]; + if (cp[0] != '\0') + { + while (*cp != '\0' && *cp >= '0' && *cp <= '9') { cp++; } + while (*cp != '\0' && (*cp == 'u' || *cp == 'l' || + *cp == 'U' || *cp == 'L')) { cp++; } + if (*cp == '\0') + { + n = (int)strtol(val->Dimensions[i], NULL, 0); + } + } + count *= n; + } + } + + return count; +} + +/* deal with types that include function pointers or arrays */ +void handle_complex_type( + ValueInfo *val, unsigned int datatype, unsigned int extra, + const char *funcSig) +{ + FunctionInfo *func = 0; + + /* remove specifiers like "friend" and "typedef" */ + datatype &= VTK_PARSE_QUALIFIED_TYPE; + + /* if "extra" was set, parentheses were involved */ + if ((extra & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) + { + /* the current type becomes the function return type */ + func = getFunction(); + func->ReturnValue = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(func->ReturnValue); + func->ReturnValue->Type = datatype; + func->ReturnValue->Class = type_class(datatype, getTypeId()); + if (funcSig) { func->Signature = vtkstrdup(funcSig); } + val->Function = func; + +#ifndef VTK_PARSE_LEGACY_REMOVE + func->ReturnType = func->ReturnValue->Type; + func->ReturnClass = func->ReturnValue->Class; +#endif + + /* the val type is whatever was inside the parentheses */ + clearTypeId(); + setTypeId(func->Class ? "method" : "function"); + datatype = (extra & VTK_PARSE_UNQUALIFIED_TYPE); + } + else if ((extra & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) + { + datatype = (datatype | VTK_PARSE_BAD_INDIRECT); + } + else if ((extra & VTK_PARSE_INDIRECT) != 0) + { + extra = (extra & VTK_PARSE_INDIRECT); + + if ((extra & VTK_PARSE_REF) != 0) + { + datatype = (datatype | VTK_PARSE_REF); + extra = (extra & ~VTK_PARSE_REF); + } + + if (extra != 0 && getArrayNDims() > 0) + { + /* pointer represents an unsized array bracket */ + datatype = add_indirection(datatype, VTK_PARSE_ARRAY); + extra = ((extra >> 2) & VTK_PARSE_POINTER_MASK); + } + + datatype = add_indirection(datatype, extra); + } + + if (getArrayNDims() == 1) + { + if ((datatype & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) + { + /* turn the first set of brackets into a pointer */ + datatype = add_indirection(datatype, VTK_PARSE_POINTER); + } + else + { + pushArrayFront(""); + } + } + else if (getArrayNDims() > 1) + { + if ((datatype & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) + { + /* turn the first set of brackets into a pointer */ + datatype = add_indirection(datatype, VTK_PARSE_ARRAY); + } + else + { + pushArrayFront(""); + } + } + + /* get the data type */ + val->Type = datatype; + val->Class = type_class(datatype, getTypeId()); + + /* copy contents of all brackets to the ArgDimensions */ + val->NumberOfDimensions = getArrayNDims(); + val->Dimensions = getArray(); + clearArray(); + + /* count is the product of the dimensions */ + val->Count = count_from_dimensions(val); +} + +/* add a parameter to the legacy part of the FunctionInfo struct */ +void add_legacy_parameter(FunctionInfo *func, ValueInfo *param) +{ +#ifndef VTK_PARSE_LEGACY_REMOVE + int i = func->NumberOfArguments; + + if (i < MAX_ARGS) + { + func->NumberOfArguments = i + 1; + func->ArgTypes[i] = param->Type; + func->ArgClasses[i] = param->Class; + func->ArgCounts[i] = param->Count; + + /* legacy wrappers need VTK_PARSE_FUNCTION without POINTER */ + if (param->Type == VTK_PARSE_FUNCTION_PTR) + { + /* check for signature "void (*func)(void *)" */ + if (param->Function->NumberOfParameters == 1 && + param->Function->Parameters[0]->Type == VTK_PARSE_VOID_PTR && + param->Function->Parameters[0]->NumberOfDimensions == 0 && + param->Function->ReturnValue->Type == VTK_PARSE_VOID) + { + func->ArgTypes[i] = VTK_PARSE_FUNCTION; + } + } + } + else + { + func->ArrayFailure = 1; + } +#endif +} + + +/* reject the function, do not output it */ +void reject_function() +{ + vtkParse_InitFunction(currentFunction); + startSig(); + getMacro(); +} + +/* a simple routine that updates a few variables */ +void output_function() +{ + const char *macro = getMacro(); + size_t n; + int i, j; + int match; + + /* reject template specializations */ + n = strlen(currentFunction->Name); + if (currentFunction->Name[n-1] == '>') + { + /* make sure there is a matching angle bracket */ + while (n > 0 && currentFunction->Name[n-1] != '<') { n--; } + if (n > 0) + { + reject_function(); + return; + } + } + + /* static */ + if (currentFunction->ReturnValue && + currentFunction->ReturnValue->Type & VTK_PARSE_STATIC) + { + currentFunction->IsStatic = 1; + } + + /* virtual */ + if (currentFunction->ReturnValue && + currentFunction->ReturnValue->Type & VTK_PARSE_VIRTUAL) + { + currentFunction->IsVirtual = 1; + } + + /* the signature */ + if (!currentFunction->Signature) + { + currentFunction->Signature = getSig(); + } + + /* template information */ + if (currentTemplate) + { + currentFunction->Template = currentTemplate; + currentTemplate = NULL; + } + + /* a void argument is the same as no parameters */ + if (currentFunction->NumberOfParameters == 1 && + (currentFunction->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) == + VTK_PARSE_VOID) + { + currentFunction->NumberOfParameters = 0; + } + + /* is it defined in a legacy macro? */ + if (macro && strcmp(macro, "VTK_LEGACY") == 0) + { + currentFunction->IsLegacy = 1; + } + + /* set public, protected */ + if (currentClass) + { + currentFunction->Access = access_level; + } + else + { + currentFunction->Access = VTK_ACCESS_PUBLIC; + } + +#ifndef VTK_PARSE_LEGACY_REMOVE + /* a void argument is the same as no parameters */ + if (currentFunction->NumberOfArguments == 1 && + (currentFunction->ArgTypes[0] & VTK_PARSE_UNQUALIFIED_TYPE) == + VTK_PARSE_VOID) + { + currentFunction->NumberOfArguments = 0; + } + + /* if return type is void, set return class to void */ + if (currentFunction->ReturnClass == NULL && + (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE) == + VTK_PARSE_VOID) + { + currentFunction->ReturnClass = "void"; + } + + /* set legacy flags */ + if (currentClass) + { + currentFunction->IsPublic = (access_level == VTK_ACCESS_PUBLIC); + currentFunction->IsProtected = (access_level == VTK_ACCESS_PROTECTED); + } + else + { + currentFunction->IsPublic = 1; + currentFunction->IsProtected = 0; + } + + /* check for too many parameters */ + if (currentFunction->NumberOfParameters > MAX_ARGS) + { + currentFunction->ArrayFailure = 1; + } + + for (i = 0; i < currentFunction->NumberOfParameters; i++) + { + ValueInfo *param = currentFunction->Parameters[i]; + /* tell old wrappers that multi-dimensional arrays are bad */ + if ((param->Type & VTK_PARSE_POINTER_MASK) != 0) + { + if (((param->Type & VTK_PARSE_INDIRECT) == VTK_PARSE_BAD_INDIRECT) || + ((param->Type & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_POINTER)) + { + currentFunction->ArrayFailure = 1; + } + } + + /* allow only "void (*func)(void *)" as a valid function pointer */ + if ((param->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) + { + if (i != 0 || param->Type != VTK_PARSE_FUNCTION_PTR || + currentFunction->NumberOfParameters != 2 || + currentFunction->Parameters[1]->Type != VTK_PARSE_VOID_PTR || + param->Function->NumberOfParameters != 1 || + param->Function->Parameters[0]->Type != VTK_PARSE_VOID_PTR || + param->Function->Parameters[0]->NumberOfDimensions != 0 || + param->Function->ReturnValue->Type != VTK_PARSE_VOID) + { + currentFunction->ArrayFailure = 1; + } + } + } +#endif /* VTK_PARSE_LEGACY_REMOVE */ + + if (currentClass) + { + /* is it a delete function */ + if (currentFunction->Name && !strcmp("Delete",currentFunction->Name)) + { + currentClass->HasDelete = 1; + } + + currentFunction->Class = currentClass->Name; + vtkParse_AddFunctionToClass(currentClass, currentFunction); + + currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + } + else + { + /* make sure this function isn't a repeat */ + match = 0; + for (i = 0; i < currentNamespace->NumberOfFunctions; i++) + { + if (currentNamespace->Functions[i]->Name && + strcmp(currentNamespace->Functions[i]->Name, + currentFunction->Name) == 0) + { + if (currentNamespace->Functions[i]->NumberOfParameters == + currentFunction->NumberOfParameters) + { + for (j = 0; j < currentFunction->NumberOfParameters; j++) + { + if (currentNamespace->Functions[i]->Parameters[j]->Type == + currentFunction->Parameters[j]->Type) + { + if (currentFunction->Parameters[j]->Type == VTK_PARSE_OBJECT && + strcmp(currentNamespace->Functions[i]->Parameters[j]->Class, + currentFunction->Parameters[j]->Class) == 0) + { + break; + } + } + } + if (j == currentFunction->NumberOfParameters) + { + match = 1; + break; + } + } + } + } + + if (!match) + { + vtkParse_AddFunctionToNamespace(currentNamespace, currentFunction); + + currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + } + } + + vtkParse_InitFunction(currentFunction); + startSig(); +} + +/* output a function that is not a method of the current class */ +void output_friend_function() +{ + ClassInfo *tmpc = currentClass; + currentClass = NULL; + output_function(); + currentClass = tmpc; +} + +void outputSetVectorMacro(const char *var, unsigned int paramType, + const char *typeText, int n) +{ + static const char *mnames[] = { + NULL, NULL, + "vtkSetVector2Macro", "vtkSetVector3Macro", "vtkSetVector4Macro", + NULL, + "vtkSetVector6Macro", + NULL }; + char ntext[32]; + int i, m; + m = (n > 7 ? 0 : n); + + sprintf(ntext, "%i", n); + + currentFunction->Macro = mnames[m]; + currentFunction->Name = vtkstrcat("Set", var); + startSig(); + postSig("void "); + postSig(currentFunction->Name); + postSig("("); + postSig(typeText); + for (i = 1; i < n; i++) + { + postSig(", "); + postSig(typeText); + } + postSig(");"); + for (i = 0; i < n; i++) + { + add_parameter(currentFunction, paramType, getTypeId(), 0); + } + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); + + currentFunction->Macro = mnames[m]; + currentFunction->Name = vtkstrcat("Set", var); + currentFunction->Signature = + vtkstrcat7("void ", currentFunction->Name, "(", typeText, + " a[", ntext, "]);"); + add_parameter(currentFunction, (VTK_PARSE_POINTER | paramType), + getTypeId(), n); + set_return(currentFunction, VTK_PARSE_VOID, "void", 0); + output_function(); +} + +void outputGetVectorMacro(const char *var, unsigned int paramType, + const char *typeText, int n) +{ + static const char *mnames[] = { + NULL, NULL, + "vtkGetVector2Macro", "vtkGetVector3Macro", "vtkGetVector4Macro", + NULL, + "vtkGetVector6Macro", + NULL }; + int m; + m = (n > 7 ? 0 : n); + + currentFunction->Macro = mnames[m]; + currentFunction->Name = vtkstrcat("Get", var); + currentFunction->Signature = + vtkstrcat4(typeText, " *", currentFunction->Name, "();"); + set_return(currentFunction, (VTK_PARSE_POINTER | paramType), getTypeId(), n); + output_function(); +} + +/* Set a flag to ignore BTX/ETX markers in the files */ +void vtkParse_SetIgnoreBTX(int option) +{ + if (option) + { + IgnoreBTX = 1; + } + else + { + IgnoreBTX = 0; + } +} + +/* Set a flag to recurse into included files */ +void vtkParse_SetRecursive(int option) +{ + if (option) + { + Recursive = 1; + } + else + { + Recursive = 0; + } +} + +/* Parse a header file and return a FileInfo struct */ +FileInfo *vtkParse_ParseFile( + const char *filename, FILE *ifile, FILE *errfile) +{ + int i, j; + int ret; + FileInfo *file_info; + char *main_class; + + /* "data" is a global variable used by the parser */ + data = (FileInfo *)malloc(sizeof(FileInfo)); + vtkParse_InitFile(data); + data->Strings = (StringCache *)malloc(sizeof(StringCache)); + vtkParse_InitStringCache(data->Strings); + + /* "preprocessor" is a global struct used by the parser */ + preprocessor = (PreprocessInfo *)malloc(sizeof(PreprocessInfo)); + vtkParsePreprocess_Init(preprocessor, filename); + vtkParsePreprocess_AddStandardMacros(preprocessor, VTK_PARSE_NATIVE); + + /* add include files specified on the command line */ + for (i = 0; i < NumberOfIncludeDirectories; i++) + { + vtkParsePreprocess_IncludeDirectory(preprocessor, IncludeDirectories[i]); + } + + /* add macros specified on the command line */ + for (i = 0; i < NumberOfDefinitions; i++) + { + const char *cp = Definitions[i]; + + if (*cp == 'U') + { + vtkParsePreprocess_RemoveMacro(preprocessor, &cp[1]); + } + else if (*cp == 'D') + { + const char *definition = &cp[1]; + while (*definition != '=' && *definition != '\0') + { + definition++; + } + if (*definition == '=') + { + definition++; + } + else + { + definition = NULL; + } + vtkParsePreprocess_AddMacro(preprocessor, &cp[1], definition); + } + } + + /* should explicitly check for vtkConfigure.h, or even explicitly load it */ +#ifdef VTK_USE_64BIT_IDS + vtkParsePreprocess_AddMacro(preprocessor, "VTK_USE_64BIT_IDS", NULL); +#endif + + data->FileName = vtkstrdup(filename); + + clearComment(); + + namespaceDepth = 0; + currentNamespace = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); + vtkParse_InitNamespace(currentNamespace); + data->Contents = currentNamespace; + + templateDepth = 0; + currentTemplate = NULL; + + currentFunction = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + vtkParse_InitFunction(currentFunction); + startSig(); + + parseDebug = 0; + if (getenv("DEBUG") != NULL) + { + parseDebug = 1; + } + + yyset_in(ifile); + yyset_out(errfile); + ret = yyparse(); + + if (ret) + { + print_parser_error("syntax error", NULL, 0); + return NULL; + } + + free(currentFunction); + yylex_destroy(); + + /* The main class name should match the file name */ + i = strlen(filename); + j = i; + while (i > 0) + { + --i; + if (filename[i] == '.') + { + j = i; + } + if (filename[i] == '/' || filename[i] == '\\') + { + i++; + break; + } + } + main_class = (char *)malloc(j-i+1); + strncpy(main_class, &filename[i], j-i); + main_class[j-i] = '\0'; + + /* special treatment of the main class in the file */ + for (i = 0; i < currentNamespace->NumberOfClasses; i++) + { + if (strcmp(currentNamespace->Classes[i]->Name, main_class) == 0) + { + data->MainClass = currentNamespace->Classes[i]; + break; + } + } + free(main_class); + + vtkParsePreprocess_Free(preprocessor); + preprocessor = NULL; + macroName = NULL; + + file_info = data; + data = NULL; + + return file_info; +} + +/* Read a hints file and update the FileInfo */ +int vtkParse_ReadHints(FileInfo *file_info, FILE *hfile, FILE *errfile) +{ + char h_cls[512]; + char h_func[512]; + unsigned int h_type, type; + int h_value; + FunctionInfo *func_info; + ClassInfo *class_info; + NamespaceInfo *contents; + int i, j; + int lineno = 0; + int n; + + contents = file_info->Contents; + + /* read each hint line in succession */ + while ((n = fscanf(hfile,"%s %s %x %i", h_cls, h_func, &h_type, &h_value)) + != EOF) + { + lineno++; + if (n < 4) + { + fprintf(errfile, "Wrapping: error parsing hints file line %i\n", lineno); + exit(1); + } + + /* erase "ref" and qualifiers from hint type */ + type = ((h_type & VTK_PARSE_BASE_TYPE) | + (h_type & VTK_PARSE_POINTER_LOWMASK)); + + /* find the matching class */ + for (i = 0; i < contents->NumberOfClasses; i++) + { + class_info = contents->Classes[i]; + + if (strcmp(h_cls, class_info->Name) == 0) + { + /* find the matching function */ + for (j = 0; j < class_info->NumberOfFunctions; j++) + { + func_info = class_info->Functions[j]; + + if ((strcmp(h_func, func_info->Name) == 0) && + func_info->ReturnValue && + (type == ((func_info->ReturnValue->Type & ~VTK_PARSE_REF) & + VTK_PARSE_UNQUALIFIED_TYPE))) + { + /* types that hints are accepted for */ + switch (func_info->ReturnValue->Type & VTK_PARSE_UNQUALIFIED_TYPE) + { + case VTK_PARSE_FLOAT_PTR: + case VTK_PARSE_VOID_PTR: + case VTK_PARSE_DOUBLE_PTR: + case VTK_PARSE_ID_TYPE_PTR: + case VTK_PARSE_LONG_LONG_PTR: + case VTK_PARSE_UNSIGNED_LONG_LONG_PTR: + case VTK_PARSE___INT64_PTR: + case VTK_PARSE_UNSIGNED___INT64_PTR: + case VTK_PARSE_INT_PTR: + case VTK_PARSE_UNSIGNED_INT_PTR: + case VTK_PARSE_SHORT_PTR: + case VTK_PARSE_UNSIGNED_SHORT_PTR: + case VTK_PARSE_LONG_PTR: + case VTK_PARSE_UNSIGNED_LONG_PTR: + case VTK_PARSE_SIGNED_CHAR_PTR: + case VTK_PARSE_UNSIGNED_CHAR_PTR: + case VTK_PARSE_CHAR_PTR: + { + if (func_info->ReturnValue->NumberOfDimensions == 0) + { + char text[64]; + sprintf(text, "%i", h_value); + func_info->ReturnValue->Count = h_value; + vtkParse_AddStringToArray( + &func_info->ReturnValue->Dimensions, + &func_info->ReturnValue->NumberOfDimensions, + vtkParse_CacheString( + file_info->Strings, text, strlen(text))); +#ifndef VTK_PARSE_LEGACY_REMOVE + func_info->HaveHint = 1; + func_info->HintSize = h_value; +#endif + } + break; + } + default: + { + fprintf(errfile, + "Wrapping: unhandled hint type %#x\n", h_type); + } + } + } + } + } + } + } + + return 1; +} + +/* Free the FileInfo struct returned by vtkParse_ParseFile() */ +void vtkParse_Free(FileInfo *file_info) +{ + vtkParse_FreeFile(file_info); + vtkParse_FreeStringCache(file_info->Strings); + free(file_info->Strings); + free(file_info); +} + +/** Define a preprocessor macro. Function macros are not supported. */ +void vtkParse_DefineMacro(const char *name, const char *definition) +{ + size_t n = vtkidlen(name); + size_t l; + char *cp; + + if (definition == NULL) + { + definition = ""; + } + + l = n + strlen(definition) + 3; + cp = (char *)malloc(l); + cp[0] = 'D'; + strncpy(&cp[1], name, n); + cp[n+1] = '\0'; + if (definition[0] != '\0') + { + cp[n+1] = '='; + strcpy(&cp[n+2], definition); + } + cp[l] = '\0'; + + vtkParse_AddStringToArray(&Definitions, &NumberOfDefinitions, cp); +} + +/** Undefine a preprocessor macro. */ +void vtkParse_UndefineMacro(const char *name) +{ + size_t n = vtkidlen(name); + char *cp; + + cp = (char *)malloc(n+2); + cp[0] = 'U'; + strncpy(&cp[1], name, n); + cp[n+1] = '\0'; + + vtkParse_AddStringToArray(&Definitions, &NumberOfDefinitions, cp); +} + +/** Add an include directory, for use with the "-I" option. */ +void vtkParse_IncludeDirectory(const char *dirname) +{ + size_t n = strlen(dirname); + char *cp; + int i; + + for (i = 0; i < NumberOfIncludeDirectories; i++) + { + if (strncmp(IncludeDirectories[i], dirname, n) == 0 && + IncludeDirectories[i][n] == '\0') + { + return; + } + } + + cp = (char *)malloc(n+1); + strcpy(cp, dirname); + + vtkParse_AddStringToArray( + &IncludeDirectories, &NumberOfIncludeDirectories, cp); +} + +/** Return the full path to a header file. */ +const char *vtkParse_FindIncludeFile(const char *filename) +{ + static PreprocessInfo info = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + int val; + int i; + + /* add include files specified on the command line */ + for (i = 0; i < NumberOfIncludeDirectories; i++) + { + vtkParsePreprocess_IncludeDirectory(&info, IncludeDirectories[i]); + } + + return vtkParsePreprocess_FindIncludeFile(&info, filename, 0, &val); +} diff --git a/src/VTKWrapping/ParaView/vtkParseData.c b/src/VTKWrapping/ParaView/vtkParseData.c new file mode 100644 index 00000000..6b27e862 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseData.c @@ -0,0 +1,935 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseData.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in May 2010 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +#include "vtkParseData.h" +#include +#include + +/* Initialize the FileInfo struct */ +void vtkParse_InitFile(FileInfo *file_info) +{ + /* file info */ + file_info->FileName = NULL; + file_info->NameComment = NULL; + file_info->Description = NULL; + file_info->Caveats = NULL; + file_info->SeeAlso = NULL; + + file_info->NumberOfIncludes = 0; + file_info->Includes = NULL; + file_info->MainClass = NULL; + file_info->Contents = NULL; + + file_info->Strings = NULL; +} + +/* Free the FileInfo struct */ +void vtkParse_FreeFile(FileInfo *file_info) +{ + int i, n; + + n = file_info->NumberOfIncludes; + for (i = 0; i < n; i++) + { + vtkParse_FreeFile(file_info->Includes[i]); + free(file_info->Includes[i]); + } + if (file_info->Includes) + { + free(file_info->Includes); + } + + vtkParse_FreeNamespace(file_info->Contents); + file_info->Contents = NULL; +} + +/* Initialize a TemplateInfo struct */ +void vtkParse_InitTemplate(TemplateInfo *info) +{ + info->NumberOfParameters = 0; + info->Parameters = NULL; +} + +/* Copy a TemplateInfo struct */ +void vtkParse_CopyTemplate(TemplateInfo *info, const TemplateInfo *orig) +{ + int i, n; + + n = orig->NumberOfParameters; + info->NumberOfParameters = n; + info->Parameters = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); + + for (i = 0; i < n; i++) + { + info->Parameters[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_CopyValue(info->Parameters[i], orig->Parameters[i]); + } +} + +/* Free a TemplateInfo struct */ +void vtkParse_FreeTemplate(TemplateInfo *template_info) +{ + int j, m; + + m = template_info->NumberOfParameters; + for (j = 0; j < m; j++) + { + vtkParse_FreeValue(template_info->Parameters[j]); + } + + free(template_info); +} + + +/* Initialize a Function struct */ +void vtkParse_InitFunction(FunctionInfo *func) +{ +#ifndef VTK_PARSE_LEGACY_REMOVE + int i; +#endif + + func->ItemType = VTK_FUNCTION_INFO; + func->Access = VTK_ACCESS_PUBLIC; + func->Name = NULL; + func->Comment = NULL; + func->Class = NULL; + func->Signature = NULL; + func->Template = NULL; + func->NumberOfParameters = 0; + func->Parameters = NULL; + func->ReturnValue = NULL; + func->Macro = NULL; + func->SizeHint = NULL; + func->IsStatic = 0; + func->IsVirtual = 0; + func->IsPureVirtual = 0; + func->IsOperator = 0; + func->IsVariadic = 0; + func->IsConst = 0; + func->IsExplicit = 0; + func->IsLegacy = 0; + +#ifndef VTK_PARSE_LEGACY_REMOVE + /* everything below here is legacy information, * + * maintained only for backwards compatibility */ + func->NumberOfArguments = 0; + func->ReturnType = VTK_PARSE_VOID; + func->ReturnClass = NULL; + func->HaveHint = 0; + func->HintSize = 0; + func->ArrayFailure = 0; + func->IsPublic = 0; + func->IsProtected = 0; + + for (i = 0; i < MAX_ARGS; i++) + { + func->ArgTypes[i] = 0; + func->ArgClasses[i] = 0; + func->ArgCounts[i] = 0; + } +#endif +} + +/* Copy a Function struct */ +void vtkParse_CopyFunction(FunctionInfo *func, const FunctionInfo *orig) +{ + int i, n; + + func->ItemType = orig->ItemType; + func->Access = orig->Access; + func->Name = orig->Name; + func->Comment = orig->Comment; + func->Class = orig->Class; + func->Signature = orig->Signature; + func->Template = NULL; + + if (orig->Template) + { + func->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); + vtkParse_CopyTemplate(func->Template, orig->Template); + } + + n = orig->NumberOfParameters; + func->NumberOfParameters = n; + if (n) + { + func->Parameters = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); + for (i = 0; i < n; i++) + { + func->Parameters[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_CopyValue(func->Parameters[i], orig->Parameters[i]); + } + } + + func->ReturnValue = NULL; + if (orig->ReturnValue) + { + func->ReturnValue = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_CopyValue(func->ReturnValue, orig->ReturnValue); + } + + func->Macro = orig->Macro; + func->SizeHint = orig->SizeHint; + func->IsStatic = orig->IsStatic; + func->IsVirtual = orig->IsVirtual; + func->IsPureVirtual = orig->IsPureVirtual; + func->IsOperator = orig->IsOperator; + func->IsVariadic = orig->IsVariadic; + func->IsConst = orig->IsConst; + func->IsExplicit = orig->IsExplicit; + func->IsLegacy = orig->IsLegacy; + +#ifndef VTK_PARSE_LEGACY_REMOVE + /* everything below here is legacy information, * + * maintained only for backwards compatibility */ + func->NumberOfArguments = orig->NumberOfArguments; + func->ReturnType = orig->ReturnType; + func->ReturnClass = orig->ReturnClass; + func->HaveHint = orig->HaveHint; + func->HintSize = orig->HintSize; + func->ArrayFailure = orig->ArrayFailure; + func->IsPublic = orig->IsPublic; + func->IsProtected = orig->IsProtected; + + for (i = 0; i < MAX_ARGS; i++) + { + func->ArgTypes[i] = orig->ArgTypes[i]; + func->ArgClasses[i] = orig->ArgClasses[i]; + func->ArgCounts[i] = orig->ArgCounts[i]; + } +#endif +} + +/* Free a Function struct */ +void vtkParse_FreeFunction(FunctionInfo *function_info) +{ + int j, m; + + if (function_info->Template) + { + vtkParse_FreeTemplate(function_info->Template); + } + + m = function_info->NumberOfParameters; + for (j = 0; j < m; j++) { vtkParse_FreeValue(function_info->Parameters[j]); } + if (m > 0) { free(function_info->Parameters); } + + if (function_info->ReturnValue) + { + vtkParse_FreeValue(function_info->ReturnValue); + } + + free(function_info); +} + + +/* Initialize a Value struct */ +void vtkParse_InitValue(ValueInfo *val) +{ + val->ItemType = VTK_VARIABLE_INFO; + val->Access = VTK_ACCESS_PUBLIC; + val->Name = NULL; + val->Comment = NULL; + val->Value = NULL; + val->Type = 0; + val->Class = NULL; + val->Count = 0; + val->CountHint = NULL; + val->NumberOfDimensions = 0; + val->Dimensions = NULL; + val->Function = NULL; + val->Template = NULL; + val->IsStatic = 0; + val->IsEnum = 0; +} + +/* Copy a Value struct */ +void vtkParse_CopyValue(ValueInfo *val, const ValueInfo *orig) +{ + int i, n; + + val->ItemType = orig->ItemType; + val->Access = orig->Access; + val->Name = orig->Name; + val->Comment = orig->Comment; + val->Value = orig->Value; + val->Type = orig->Type; + val->Class = orig->Class; + val->Count = orig->Count; + val->CountHint = orig->CountHint; + + n = orig->NumberOfDimensions; + val->NumberOfDimensions = n; + if (n) + { + val->Dimensions = (const char **)malloc(n*sizeof(char *)); + for (i = 0; i < n; i++) + { + val->Dimensions[i] = orig->Dimensions[i]; + } + } + + val->Function = NULL; + if (orig->Function) + { + val->Function = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + vtkParse_CopyFunction(val->Function, orig->Function); + } + + val->Template = NULL; + if (orig->Template) + { + val->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); + vtkParse_CopyTemplate(val->Template, orig->Template); + } + + val->IsStatic = orig->IsStatic; + val->IsEnum = orig->IsEnum; +} + +/* Free a Value struct */ +void vtkParse_FreeValue(ValueInfo *value_info) +{ + if (value_info->NumberOfDimensions) + { + free((char **)value_info->Dimensions); + } + if (value_info->Function) + { + vtkParse_FreeFunction(value_info->Function); + } + if (value_info->Template) + { + vtkParse_FreeTemplate(value_info->Template); + } + + free(value_info); +} + + +/* Initialize an Enum struct */ +void vtkParse_InitEnum(EnumInfo *item) +{ + item->ItemType = VTK_ENUM_INFO; + item->Access = VTK_ACCESS_PUBLIC; + item->Name = NULL; + item->Comment = NULL; +} + +/* Copy an Enum struct */ +void vtkParse_CopyEnum(EnumInfo *item, const EnumInfo *orig) +{ + item->ItemType = orig->ItemType; + item->Access = orig->Access; + item->Name = orig->Name; + item->Comment = orig->Comment; +} + +/* Free an Enum struct */ +void vtkParse_FreeEnum(EnumInfo *enum_info) +{ + free(enum_info); +} + + +/* Initialize a Using struct */ +void vtkParse_InitUsing(UsingInfo *item) +{ + item->ItemType = VTK_USING_INFO; + item->Access = VTK_ACCESS_PUBLIC; + item->Name = NULL; + item->Comment = NULL; + item->Scope = NULL; +} + +/* Copy a Using struct */ +void vtkParse_CopyUsing(UsingInfo *item, const UsingInfo *orig) +{ + item->ItemType = orig->ItemType; + item->Access = orig->Access; + item->Name = orig->Name; + item->Comment = orig->Comment; + item->Scope = orig->Scope; +} + +/* Free a Using struct */ +void vtkParse_FreeUsing(UsingInfo *using_info) +{ + free(using_info); +} + + +/* Initialize a Class struct */ +void vtkParse_InitClass(ClassInfo *cls) +{ + cls->ItemType = VTK_CLASS_INFO; + cls->Access = VTK_ACCESS_PUBLIC; + cls->Name = NULL; + cls->Comment = NULL; + cls->Template = NULL; + cls->NumberOfSuperClasses = 0; + cls->SuperClasses = NULL; + cls->NumberOfItems = 0; + cls->Items = NULL; + cls->NumberOfClasses = 0; + cls->Classes = NULL; + cls->NumberOfFunctions = 0; + cls->Functions = NULL; + cls->NumberOfConstants = 0; + cls->Constants = NULL; + cls->NumberOfVariables = 0; + cls->Variables = NULL; + cls->NumberOfEnums = 0; + cls->Enums = NULL; + cls->NumberOfTypedefs = 0; + cls->Typedefs = NULL; + cls->NumberOfUsings = 0; + cls->Usings = NULL; + cls->NumberOfNamespaces = 0; + cls->Namespaces = NULL; + cls->IsAbstract = 0; + cls->HasDelete = 0; +} + +/* Copy a Class struct */ +void vtkParse_CopyClass(ClassInfo *cls, const ClassInfo *orig) +{ + int i, n; + + cls->ItemType = orig->ItemType; + cls->Access = orig->Access; + cls->Name = orig->Name; + cls->Comment = orig->Comment; + cls->Template = NULL; + + if (orig->Template) + { + cls->Template = (TemplateInfo *)malloc(sizeof(TemplateInfo)); + vtkParse_CopyTemplate(cls->Template, orig->Template); + } + + n = orig->NumberOfSuperClasses; + cls->NumberOfSuperClasses = n; + if (n) + { + cls->SuperClasses = (const char **)malloc(n*sizeof(char *)); + for (i = 0; i < n; i++) + { + cls->SuperClasses[i] = orig->SuperClasses[i]; + } + } + + n = orig->NumberOfItems; + cls->NumberOfItems = n; + if (n) + { + cls->Items = (ItemInfo *)malloc(n*sizeof(ItemInfo)); + for (i = 0; i < n; i++) + { + cls->Items[i].Type = orig->Items[i].Type; + cls->Items[i].Index = orig->Items[i].Index; + } + } + + n = orig->NumberOfClasses; + cls->NumberOfClasses = n; + if (n) + { + cls->Classes = (ClassInfo **)malloc(n*sizeof(ClassInfo *)); + for (i = 0; i < n; i++) + { + cls->Classes[i] = (ClassInfo *)malloc(sizeof(ClassInfo)); + vtkParse_CopyClass(cls->Classes[i], orig->Classes[i]); + } + } + + n = orig->NumberOfFunctions; + cls->NumberOfFunctions = n; + if (n) + { + cls->Functions = (FunctionInfo **)malloc(n*sizeof(FunctionInfo *)); + for (i = 0; i < n; i++) + { + cls->Functions[i] = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + vtkParse_CopyFunction(cls->Functions[i], orig->Functions[i]); + } + } + + n = orig->NumberOfConstants; + cls->NumberOfConstants = n; + if (n) + { + cls->Constants = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); + for (i = 0; i < n; i++) + { + cls->Constants[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_CopyValue(cls->Constants[i], orig->Constants[i]); + } + } + + n = orig->NumberOfVariables; + cls->NumberOfVariables = n; + if (n) + { + cls->Variables = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); + for (i = 0; i < n; i++) + { + cls->Variables[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_CopyValue(cls->Variables[i], orig->Variables[i]); + } + } + + n = orig->NumberOfEnums; + cls->NumberOfEnums = n; + if (n) + { + cls->Enums = (EnumInfo **)malloc(n*sizeof(EnumInfo *)); + for (i = 0; i < n; i++) + { + cls->Enums[i] = (EnumInfo *)malloc(sizeof(EnumInfo)); + vtkParse_CopyEnum(cls->Enums[i], orig->Enums[i]); + } + } + + n = orig->NumberOfTypedefs; + cls->NumberOfTypedefs = n; + if (n) + { + cls->Typedefs = (ValueInfo **)malloc(n*sizeof(ValueInfo *)); + for (i = 0; i < n; i++) + { + cls->Typedefs[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_CopyValue(cls->Typedefs[i], orig->Typedefs[i]); + } + } + + n = orig->NumberOfUsings; + cls->NumberOfUsings = n; + if (n) + { + cls->Usings = (UsingInfo **)malloc(n*sizeof(UsingInfo *)); + for (i = 0; i < n; i++) + { + cls->Usings[i] = (UsingInfo *)malloc(sizeof(UsingInfo)); + vtkParse_CopyUsing(cls->Usings[i], orig->Usings[i]); + } + } + + n = orig->NumberOfNamespaces; + cls->NumberOfNamespaces = n; + if (n) + { + cls->Namespaces = (NamespaceInfo **)malloc(n*sizeof(NamespaceInfo *)); + for (i = 0; i < n; i++) + { + cls->Namespaces[i] = (NamespaceInfo *)malloc(sizeof(NamespaceInfo)); + vtkParse_CopyNamespace(cls->Namespaces[i], orig->Namespaces[i]); + } + } + + cls->IsAbstract = orig->IsAbstract; + cls->HasDelete = orig->HasDelete; +} + +/* Free a Class struct */ +void vtkParse_FreeClass(ClassInfo *class_info) +{ + int j, m; + + if (class_info->Template) { vtkParse_FreeTemplate(class_info->Template); } + + m = class_info->NumberOfSuperClasses; + if (m > 0) { free((char **)class_info->SuperClasses); } + + m = class_info->NumberOfClasses; + for (j = 0; j < m; j++) { vtkParse_FreeClass(class_info->Classes[j]); } + if (m > 0) { free(class_info->Classes); } + + m = class_info->NumberOfFunctions; + for (j = 0; j < m; j++) { vtkParse_FreeFunction(class_info->Functions[j]); } + if (m > 0) { free(class_info->Functions); } + + m = class_info->NumberOfConstants; + for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Constants[j]); } + if (m > 0) { free(class_info->Constants); } + + m = class_info->NumberOfVariables; + for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Variables[j]); } + if (m > 0) { free(class_info->Variables); } + + m = class_info->NumberOfEnums; + for (j = 0; j < m; j++) { vtkParse_FreeEnum(class_info->Enums[j]); } + if (m > 0) { free(class_info->Enums); } + + m = class_info->NumberOfTypedefs; + for (j = 0; j < m; j++) { vtkParse_FreeValue(class_info->Typedefs[j]); } + if (m > 0) { free(class_info->Typedefs); } + + m = class_info->NumberOfUsings; + for (j = 0; j < m; j++) { vtkParse_FreeUsing(class_info->Usings[j]); } + if (m > 0) { free(class_info->Usings); } + + m = class_info->NumberOfNamespaces; + for (j = 0; j < m; j++) { vtkParse_FreeNamespace(class_info->Namespaces[j]); } + if (m > 0) { free(class_info->Namespaces); } + + if (class_info->NumberOfItems > 0) { free(class_info->Items); } + + free(class_info); +} + + +/* Initialize a Namespace struct */ +void vtkParse_InitNamespace(NamespaceInfo *name_info) +{ + vtkParse_InitClass(name_info); + name_info->ItemType = VTK_NAMESPACE_INFO; +} + +/* Copy a Namespace struct */ +void vtkParse_CopyNamespace(NamespaceInfo *ninfo, const NamespaceInfo *orig) +{ + vtkParse_CopyClass(ninfo, orig); +} + +/* Free a Namespace struct */ +void vtkParse_FreeNamespace(NamespaceInfo *namespace_info) +{ + vtkParse_FreeClass(namespace_info); +} + + +/* This method is used for extending dynamic arrays in a progression of + * powers of two. If "n" reaches a power of two, then the array size is + * doubled so that "n" can be safely incremented. */ +static void *array_size_check( + void *arraymem, size_t size, int n) +{ + /* if empty, alloc for the first time */ + if (n == 0) + { + return malloc(size); + } + /* if count is power of two, reallocate with double size */ + else if ((n & (n-1)) == 0) + { + return realloc(arraymem, (n << 1)*size); + } + + /* no reallocation, just return the original array */ + return arraymem; +} + + +/* Utility method to add an included file to a FileInfo */ +void vtkParse_AddIncludeToFile( + FileInfo *file_info, FileInfo *include_file) +{ + file_info->Includes = (FileInfo **)array_size_check( + (FileInfo **)file_info->Includes, sizeof(FileInfo *), + file_info->NumberOfIncludes); + + file_info->Includes[file_info->NumberOfIncludes++] = include_file; + + if (!include_file->Strings) + { + include_file->Strings = file_info->Strings; + } +} + +/* Utility method to add a const char pointer to an array */ +void vtkParse_AddStringToArray( + const char ***valueArray, int *count, const char *value) +{ + *valueArray = (const char **)array_size_check( + (char **)*valueArray, sizeof(const char *), *count); + + (*valueArray)[(*count)++] = value; +} + +/* Utility method to add an item to an array */ +void vtkParse_AddItemToArray( + ItemInfo **valueArray, int *count, parse_item_t type, int idx) +{ + int n = *count; + ItemInfo *values = *valueArray; + + values = (ItemInfo *)array_size_check(values, sizeof(ItemInfo), n); + + values[n].Type = type; + values[n].Index = idx; + *count = n+1; + *valueArray = values; +} + +/* Add a ClassInfo to a ClassInfo */ +void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfClasses); + info->Classes = (ClassInfo **)array_size_check( + info->Classes, sizeof(ClassInfo *), info->NumberOfClasses); + info->Classes[info->NumberOfClasses++] = item; +} + +/* Add a FunctionInfo to a ClassInfo */ +void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfFunctions); + info->Functions = (FunctionInfo **)array_size_check( + info->Functions, sizeof(FunctionInfo *), info->NumberOfFunctions); + info->Functions[info->NumberOfFunctions++] = item; +} + +/* Add a EnumInfo to a ClassInfo */ +void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfEnums); + info->Enums = (EnumInfo **)array_size_check( + info->Enums, sizeof(EnumInfo *), info->NumberOfEnums); + info->Enums[info->NumberOfEnums++] = item; +} + +/* Add a Constant ValueInfo to a ClassInfo */ +void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfConstants); + info->Constants = (ValueInfo **)array_size_check( + info->Constants, sizeof(ValueInfo *), info->NumberOfConstants); + info->Constants[info->NumberOfConstants++] = item; +} + +/* Add a Variable ValueInfo to a ClassInfo */ +void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfVariables); + info->Variables = (ValueInfo **)array_size_check( + info->Variables, sizeof(ValueInfo *), info->NumberOfVariables); + info->Variables[info->NumberOfVariables++] = item; +} + +/* Add a Typedef ValueInfo to a ClassInfo */ +void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfTypedefs); + info->Typedefs = (ValueInfo **)array_size_check( + info->Typedefs, sizeof(ValueInfo *), info->NumberOfTypedefs); + info->Typedefs[info->NumberOfTypedefs++] = item; +} + +/* Add a UsingInfo to a ClassInfo */ +void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfUsings); + info->Usings = (UsingInfo **)array_size_check( + info->Usings, sizeof(UsingInfo *), info->NumberOfUsings); + info->Usings[info->NumberOfUsings++] = item; +} + + +/* Add a NamespaceInfo to a NamespaceInfo */ +void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info, NamespaceInfo *item) +{ + vtkParse_AddItemToArray(&info->Items, &info->NumberOfItems, + item->ItemType, info->NumberOfNamespaces); + info->Namespaces = (NamespaceInfo **)array_size_check( + info->Namespaces, sizeof(NamespaceInfo *), info->NumberOfNamespaces); + info->Namespaces[info->NumberOfNamespaces++] = item; +} + +/* Add a ClassInfo to a NamespaceInfo */ +void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item) +{ + vtkParse_AddClassToClass(info, item); +} + +/* Add a FunctionInfo to a NamespaceInfo */ +void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item) +{ + vtkParse_AddFunctionToClass(info, item); +} + +/* Add a EnumInfo to a NamespaceInfo */ +void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item) +{ + vtkParse_AddEnumToClass(info, item); +} + +/* Add a Constant ValueInfo to a NamespaceInfo */ +void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item) +{ + vtkParse_AddConstantToClass(info, item); +} + +/* Add a Variable ValueInfo to a NamespaceInfo */ +void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item) +{ + vtkParse_AddVariableToClass(info, item); +} + +/* Add a Typedef ValueInfo to a NamespaceInfo */ +void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item) +{ + vtkParse_AddTypedefToClass(info, item); +} + +/* Add a UsingInfo to a NamespaceInfo */ +void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item) +{ + vtkParse_AddUsingToClass(info, item); +} + + +/* Add a ValueInfo parameter to a FunctionInfo */ +void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item) +{ + info->Parameters = (ValueInfo **)array_size_check( + info->Parameters, sizeof(ValueInfo *), info->NumberOfParameters); + info->Parameters[info->NumberOfParameters++] = item; +} + + +/* Add a ValueInfo to a TemplateInfo */ +void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item) +{ + info->Parameters = (ValueInfo **)array_size_check( + info->Parameters, sizeof(ValueInfo *), info->NumberOfParameters); + info->Parameters[info->NumberOfParameters++] = item; +} + + +/* Add default constructors if they do not already exist */ +void vtkParse_AddDefaultConstructors(ClassInfo *cls, StringCache *cache) +{ + FunctionInfo *func; + ValueInfo *param; + size_t k, l; + int i, n; + int default_constructor = 1; + int copy_constructor = 1; + char *tname; + const char *ccname; + + if (cls == NULL || cls->Name == NULL) + { + return; + } + + n = cls->NumberOfFunctions; + for (i = 0; i < n; i++) + { + func = cls->Functions[i]; + if (func->Name && strcmp(func->Name, cls->Name) == 0) + { + default_constructor = 0; + + if (func->NumberOfParameters == 1) + { + param = func->Parameters[0]; + if (param->Class && + strcmp(param->Class, cls->Name) == 0 && + (param->Type & VTK_PARSE_POINTER_MASK) == 0) + { + copy_constructor = 0; + } + } + } + } + + if (default_constructor) + { + func = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + vtkParse_InitFunction(func); + func->Class = cls->Name; + func->Name = cls->Name; + k = strlen(cls->Name); + tname = vtkParse_NewString(cache, k + 2); + strcpy(tname, cls->Name); + strcpy(&tname[k], "()"); + func->Signature = tname; + vtkParse_AddFunctionToClass(cls, func); + } + + if (copy_constructor) + { + ccname = cls->Name; + + if (cls->Template) + { + /* specialize the name */ + n = cls->Template->NumberOfParameters; + + k = strlen(cls->Name) + 2; + for (i = 0; i < n; i++) + { + if (cls->Template->Parameters[i]->Name) + { + k += strlen(cls->Template->Parameters[i]->Name) + 2; + } + } + tname = vtkParse_NewString(cache, k); + strcpy(tname, cls->Name); + k = strlen(tname); + tname[k++] = '<'; + for (i = 0; i < n; i++) + { + if (cls->Template->Parameters[i]->Name) + { + strcpy(&tname[k], cls->Template->Parameters[i]->Name); + k += strlen(cls->Template->Parameters[i]->Name); + } + if (i+1 < n) + { + tname[k++] = ','; + tname[k++] = ' '; + } + } + tname[k++] = '>'; + tname[k] = '\0'; + ccname = tname; + } + + func = (FunctionInfo *)malloc(sizeof(FunctionInfo)); + vtkParse_InitFunction(func); + func->Class = cls->Name; + func->Name = cls->Name; + k = strlen(cls->Name); + l = strlen(ccname); + tname = vtkParse_NewString(cache, k + l + 9); + strcpy(tname, cls->Name); + strcpy(&tname[k], "(const &"); + strcpy(&tname[k+8], ccname); + strcpy(&tname[k+8+l], ")"); + func->Signature = tname; + param = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(param); + param->Type = (VTK_PARSE_OBJECT_REF | VTK_PARSE_CONST); + param->Class = ccname; + vtkParse_AddParameterToFunction(func, param); + vtkParse_AddFunctionToClass(cls, func); + } +} diff --git a/src/VTKWrapping/ParaView/vtkParseData.h b/src/VTKWrapping/ParaView/vtkParseData.h new file mode 100644 index 00000000..cd03e67c --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseData.h @@ -0,0 +1,335 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseData.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in May 2010 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +/* + Data structures used by vtkParse. +*/ + +#ifndef VTK_PARSE_DATA_H +#define VTK_PARSE_DATA_H + +#include "vtkParseType.h" +#include "vtkParseString.h" + +/* legacy */ +#ifndef VTK_PARSE_LEGACY_REMOVE +#define MAX_ARGS 20 +#endif + +/** + * Access flags + */ +typedef enum _parse_access_t +{ + VTK_ACCESS_PUBLIC = 0, + VTK_ACCESS_PROTECTED = 1, + VTK_ACCESS_PRIVATE = 2 +} parse_access_t; + +/** + * ItemType constants + */ +typedef enum _parse_item_t +{ + VTK_NAMESPACE_INFO = 1, + VTK_CLASS_INFO = 2, + VTK_STRUCT_INFO = 3, + VTK_UNION_INFO = 4, + VTK_ENUM_INFO = 5, + VTK_FUNCTION_INFO = 6, + VTK_VARIABLE_INFO = 7, + VTK_CONSTANT_INFO = 8, + VTK_TYPEDEF_INFO = 9, + VTK_USING_INFO = 10 +} parse_item_t; + +/** + * ItemInfo just contains an index + */ +typedef struct _ItemInfo +{ + parse_item_t Type; + int Index; +} ItemInfo; + +/* forward declarations */ +struct _ValueInfo; +struct _FunctionInfo; +struct _FileInfo; +typedef struct _ValueInfo ValueInfo; +typedef struct _FunctionInfo FunctionInfo; +typedef struct _FileInfo FileInfo; + +/** + * TemplateInfo holds template definitions + */ +typedef struct _TemplateInfo +{ + int NumberOfParameters; + ValueInfo **Parameters; +} TemplateInfo; + +/** + * ValueInfo is for typedefs, constants, variables, + * function parameters, and return values + * + * Note that Dimensions is an array of char pointers, in + * order to support dimensions that are sized according to + * template parameter values or according to named constants. + */ +struct _ValueInfo +{ + parse_item_t ItemType; + parse_access_t Access; + const char *Name; + const char *Comment; + const char *Value; /* for vars or default paramter values */ + unsigned int Type; /* as defined in vtkParseType.h */ + const char *Class; /* classname for type */ + int Count; /* total number of values, if known */ + const char *CountHint; /* hint about how to get the count */ + int NumberOfDimensions; /* dimensionality for arrays */ + const char **Dimensions; /* dimensions for arrays */ + FunctionInfo *Function; /* for function pointer values */ + TemplateInfo *Template; /* template parameters, or NULL */ + int IsStatic; /* for class variables only */ + int IsEnum; /* for constants only */ +}; + +/** + * FunctionInfo is for functions and methods + */ +struct _FunctionInfo +{ + parse_item_t ItemType; + parse_access_t Access; + const char *Name; + const char *Comment; + const char *Class; /* class name for methods */ + const char *Signature; /* function signature as text */ + TemplateInfo *Template; /* template parameters, or NULL */ + int NumberOfParameters; + ValueInfo **Parameters; + ValueInfo *ReturnValue; /* NULL for constructors and destructors */ + const char *Macro; /* the macro that defined this function */ + const char *SizeHint; /* hint the size e.g. for operator[] */ + int IsOperator; + int IsVariadic; + int IsLegacy; /* marked as a legacy method or function */ + int IsStatic; /* methods only */ + int IsVirtual; /* methods only */ + int IsPureVirtual; /* methods only */ + int IsConst; /* methods only */ + int IsExplicit; /* constructors only */ +#ifndef VTK_PARSE_LEGACY_REMOVE + int NumberOfArguments; /* legacy */ + unsigned int ArgTypes[MAX_ARGS]; /* legacy */ + const char *ArgClasses[MAX_ARGS];/* legacy */ + int ArgCounts[MAX_ARGS]; /* legacy */ + unsigned int ReturnType; /* legacy */ + const char *ReturnClass; /* legacy */ + int HaveHint; /* legacy */ + int HintSize; /* legacy */ + int ArrayFailure;/* legacy */ + int IsPublic; /* legacy */ + int IsProtected; /* legacy */ +#endif +}; + +/** + * EnumInfo is for enums + * Constants are at the same level as the Enum, not inside it. + */ +typedef struct _EnumInfo +{ + parse_item_t ItemType; + parse_access_t Access; + const char *Name; + const char *Comment; +} EnumInfo; + +/** + * UsingInfo is for using directives + */ +typedef struct _UsingInfo +{ + parse_item_t ItemType; + parse_access_t Access; + const char *Name; /* null for using whole namespace */ + const char *Comment; + const char *Scope; /* the namespace or class */ +} UsingInfo; + +/** + * ClassInfo is for classes, structs, unions, and namespaces + */ +typedef struct _ClassInfo +{ + parse_item_t ItemType; + parse_access_t Access; + const char *Name; + const char *Comment; + TemplateInfo *Template; + int NumberOfSuperClasses; + const char **SuperClasses; + int NumberOfItems; + ItemInfo *Items; + int NumberOfClasses; + struct _ClassInfo **Classes; + int NumberOfFunctions; + FunctionInfo **Functions; + int NumberOfConstants; + ValueInfo **Constants; + int NumberOfVariables; + ValueInfo **Variables; + int NumberOfEnums; + EnumInfo **Enums; + int NumberOfTypedefs; + ValueInfo **Typedefs; + int NumberOfUsings; + UsingInfo **Usings; + int NumberOfNamespaces; + struct _ClassInfo **Namespaces; + int IsAbstract; + int HasDelete; +} ClassInfo; + +/** + * Namespace is for namespaces + */ +typedef struct _ClassInfo NamespaceInfo; + +/** + * FileInfo is for header files + */ +struct _FileInfo +{ + const char *FileName; + const char *NameComment; + const char *Description; + const char *Caveats; + const char *SeeAlso; + + int NumberOfIncludes; + struct _FileInfo **Includes; + ClassInfo *MainClass; + NamespaceInfo *Contents; + StringCache *Strings; +}; + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Initializer methods + */ +/*@{*/ +void vtkParse_InitFile(FileInfo *file_info); +void vtkParse_InitNamespace(NamespaceInfo *namespace_info); +void vtkParse_InitClass(ClassInfo *cls); +void vtkParse_InitFunction(FunctionInfo *func); +void vtkParse_InitValue(ValueInfo *val); +void vtkParse_InitEnum(EnumInfo *item); +void vtkParse_InitUsing(UsingInfo *item); +void vtkParse_InitTemplate(TemplateInfo *arg); +/*@}*/ + +/** + * Copy methods + * + * Strings are not deep-copied, they are assumed to be persistent. + */ +/*@{*/ +void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); +void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); +void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); +void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); +void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); +void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); +void vtkParse_CopyTemplate(TemplateInfo *data, const TemplateInfo *orig); +/*@}*/ + +/** + * Free methods + * + * Strings are not freed, they are assumed to be persistent. + */ +/*@{*/ +void vtkParse_FreeFile(FileInfo *file_info); +void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); +void vtkParse_FreeClass(ClassInfo *cls); +void vtkParse_FreeFunction(FunctionInfo *func); +void vtkParse_FreeValue(ValueInfo *val); +void vtkParse_FreeEnum(EnumInfo *item); +void vtkParse_FreeUsing(UsingInfo *item); +void vtkParse_FreeTemplate(TemplateInfo *arg); +/*@}*/ + + +/** + * Add a string to an array of strings, grow array as necessary. + */ +void vtkParse_AddStringToArray( + const char ***valueArray, int *count, const char *value); + +/** + * Expand the Item array for classes and namespaces. + */ +void vtkParse_AddItemToArray( + ItemInfo **valueArray, int *count, parse_item_t type, int idx); + + +/** + * Add various items to the structs. + */ +/*@{*/ +void vtkParse_AddIncludeToFile(FileInfo *info, FileInfo *item); +void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); +void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); +void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); +void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); +void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); +void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); +void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); +void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); +void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); +void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); +void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); +void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); +void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); +void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); +void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); +void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item); +void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item); +/*@}*/ + +/** + * Add default constructors to a class if they do not already exist + */ +void vtkParse_AddDefaultConstructors(ClassInfo *data, StringCache *cache); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkParseExtras.c b/src/VTKWrapping/ParaView/vtkParseExtras.c new file mode 100644 index 00000000..6504d3b8 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseExtras.c @@ -0,0 +1,1469 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseExtras.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2011 David Gobbi. + + Contributed to the VisualizationToolkit by the author in May 2011 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +#include "vtkParseExtras.h" +#include "vtkParseString.h" +#include "vtkType.h" +#include +#include +#include +#include +#include + +/* skip over an identifier */ +static size_t vtkparse_id_len(const char *text) +{ + size_t i = 0; + char c = text[0]; + + if ((c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + c == '_') + { + do + { + c = text[++i]; + } + while ((c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '_'); + } + + return i; +} + +/* skip over numbers, int or float, including suffixes */ +static size_t vtkparse_number_len(const char *text) +{ + size_t i = 0; + char c = text[0]; + + if (c == '.') + { + c = text[1]; + } + + if (c >= '0' && c <= '9') + { + do + { + do + { + c = text[++i]; + } + while ((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + c == '_' || c == '.'); + } + while ((c == '-' || c == '+') && + (text[i-1] == 'e' || text[i-1] == 'E')); + } + + return i; +} + +/* skip over string and char literals. */ +static size_t vtkparse_quote_len(const char *text) +{ + size_t i = 0; + const char qc = text[0]; + char c = text[0]; + + if (c == '\'' || c == '\"') + { + do + { + do + { + c = text[++i]; + } + while (c != qc && c != '\n' && c != '\0'); + } + while (c == qc && text[i-1] == '\\'); + + if (c == qc) + { + ++i; + } + } + + return i; +} + +/* skip over an expression in brackets */ +static size_t vtkparse_bracket_len(const char *text) +{ + size_t i = 0; + size_t j = 1; + char bc = text[0]; + char tc = 0; + char semi = ';'; + char c; + + if (bc == '(') { tc = ')'; } + else if (bc == '[') { tc = ']'; } + else if (bc == '{') { tc = '}'; semi = '\0'; } + else if (bc == '<') { tc = '>'; } + else { return 0; } + + do + { + i += j; + j = 1; + c = text[i]; + if (c == '\'' || c == '\"') + { + j = vtkparse_quote_len(&text[i]); + } + else if (c == bc || c == '(' || c == '[' || c == '{') + { + j = vtkparse_bracket_len(&text[i]); + } + } + while (c != tc && c != ')' && c != ']' && c != '}' && + c != '\0' && c != '\n' && c != semi && j != 0); + + if (c == tc) + { + i++; + } + + return i; +} + +/* skip over a name that is neither scoped or templated, return the + * total number of characters in the name */ +size_t vtkParse_IdentifierLength(const char *text) +{ + return vtkparse_id_len(text); +} + +/* skip over a name that might be templated, return the + * total number of characters in the name */ +size_t vtkParse_UnscopedNameLength(const char *text) +{ + size_t i = 0; + + i += vtkparse_id_len(text); + if (text[i] == '<') + { + i += vtkparse_bracket_len(&text[i]); + if (text[i-1] != '>') + { + fprintf(stderr, "Bad template args %*.*s\n", (int)i, (int)i, text); + assert(text[i-1] == '>'); + return 0; + } + } + + return i; +} + +/* skip over a name that might be scoped or templated, return the + * total number of characters in the name */ +size_t vtkParse_NameLength(const char *text) +{ + size_t i = 0; + do + { + if (text[i] == ':' && text[i+1] == ':') { i += 2; } + i += vtkParse_UnscopedNameLength(&text[i]); + } + while (text[i] == ':' && text[i+1] == ':'); + return i; +} + +/* Search and replace, return the initial string if no replacements + * occurred, otherwise return a new string. */ +static const char *vtkparse_string_replace( + StringCache *cache, const char *str1, + int n, const char *name[], const char *val[]) +{ + const char *cp = str1; + char result_store[1024]; + size_t resultMaxLen = 1024; + char *result, *tmp; + int k; + size_t i, j, l, m; + size_t lastPos, nameBegin, nameEnd; + int replaced = 0; + int any_replaced = 0; + + result = result_store; + + if (n == 0) + { + return str1; + } + + i = 0; + j = 0; + result[j] = '\0'; + + while (cp[i] != '\0') + { + lastPos = i; + + /* skip all chars that aren't part of a name */ + while ((cp[i] < 'a' || cp[i] > 'z') && + (cp[i] < 'A' || cp[i] > 'Z') && + cp[i] != '_' && cp[i] != '\0') + { + if (cp[i] == '\'' || cp[i] == '\"') + { + i += vtkparse_quote_len(&cp[i]); + } + else if (cp[i] >= '0' && cp[i] <= '9') + { + i += vtkparse_number_len(&cp[i]); + } + else + { + i++; + } + } + nameBegin = i; + + /* skip all chars that are part of a name */ + i += vtkparse_id_len(&cp[i]); + nameEnd = i; + + /* search through the list of names to replace */ + replaced = 0; + m = nameEnd - nameBegin; + for (k = 0; k < n; k++) + { + l = strlen(name[k]); + if (l > 0 && l == m && strncmp(&cp[nameBegin], name[k], l) == 0) + { + m = strlen(val[k]); + replaced = 1; + any_replaced = 1; + break; + } + } + + /* expand the storage space if needed */ + if (j + m + (nameBegin - lastPos) + 1 >= resultMaxLen) + { + resultMaxLen *= 2; + tmp = (char *)malloc(resultMaxLen); + strcpy(tmp, result); + if (result != result_store) + { + free(result); + } + result = tmp; + } + + /* copy the old bits */ + if (nameBegin > lastPos) + { + strncpy(&result[j], &cp[lastPos], nameBegin - lastPos); + j += (nameBegin - lastPos); + } + + /* do the replacement */ + if (replaced) + { + strncpy(&result[j], val[k], m); + j += m; + /* guard against creating double ">>" */ + if (val[k][m-1] == '>' && cp[nameEnd] == '>') + { + result[j++] = ' '; + } + } + else if (nameEnd > nameBegin) + { + strncpy(&result[j], &cp[nameBegin], nameEnd - nameBegin); + j += (nameEnd - nameBegin); + } + + result[j] = '\0'; + } + + if (cache) + { + if (any_replaced) + { + /* use the efficient CacheString method */ + cp = vtkParse_CacheString(cache, result, j); + if (result != result_store) + { + free(result); + } + } + } + else + { + if (any_replaced) + { + /* return a string that was allocated with malloc */ + if (result == result_store) + { + tmp = (char *)malloc(strlen(result) + 1); + strcpy(tmp, result); + result = tmp; + } + cp = result; + } + } + + return cp; +} + +/* Wherever one of the specified names exists inside a Value or inside + * a Dimension size, replace it with the corresponding val string. */ +void vtkParse_ExpandValues( + ValueInfo *valinfo, StringCache *cache, + int n, const char *name[], const char *val[]) +{ + int j, m, dim, count; + const char *cp; + + if (valinfo->Value) + { + valinfo->Value = vtkparse_string_replace( + cache, valinfo->Value, n, name, val); + } + + m = valinfo->NumberOfDimensions; + if (m) + { + count = 1; + for (j = 0; j < m; j++) + { + cp = valinfo->Dimensions[j]; + if (cp) + { + cp = vtkparse_string_replace(cache, cp, n, name, val); + valinfo->Dimensions[j] = cp; + + /* check whether dimension has become an integer literal */ + if (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) { cp += 2; } + while (*cp >= '0' && *cp <= '9') { cp++; } + while (*cp == 'u' || *cp == 'l' || *cp == 'U' || *cp == 'L') { cp++; } + dim = 0; + if (*cp == '\0') + { + dim = (int)strtol(valinfo->Dimensions[j], NULL, 0); + } + count *= dim; + } + } + + /* update count if all values are integer literals */ + if (count) + { + valinfo->Count = count; + } + } +} + +/* Expand a typedef within a type declaration. */ +void vtkParse_ExpandTypedef( + ValueInfo *valinfo, ValueInfo *typedefinfo) +{ + const char *classname; + unsigned int baseType; + unsigned int pointers; + unsigned int refbit; + unsigned int qualifiers; + unsigned int tmp1, tmp2; + int i; + + classname = typedefinfo->Class; + baseType = (typedefinfo->Type & VTK_PARSE_BASE_TYPE); + pointers = (typedefinfo->Type & VTK_PARSE_POINTER_MASK); + refbit = (valinfo->Type & VTK_PARSE_REF); + qualifiers = (typedefinfo->Type & VTK_PARSE_CONST); + + /* handle const */ + if ((valinfo->Type & VTK_PARSE_CONST) != 0) + { + if ((pointers & VTK_PARSE_POINTER_LOWMASK) != 0) + { + if ((pointers & VTK_PARSE_POINTER_LOWMASK) != VTK_PARSE_ARRAY) + { + /* const turns into const pointer */ + pointers = (pointers & ~VTK_PARSE_POINTER_LOWMASK); + pointers = (pointers | VTK_PARSE_CONST_POINTER); + } + } + else + { + /* const remains as const value */ + qualifiers = (qualifiers | VTK_PARSE_CONST); + } + } + + /* make a reversed copy of the pointer bitfield */ + tmp1 = (valinfo->Type & VTK_PARSE_POINTER_MASK); + tmp2 = 0; + while (tmp1) + { + tmp2 = ((tmp2 << 2) | (tmp1 & VTK_PARSE_POINTER_LOWMASK)); + tmp1 = ((tmp1 >> 2) & VTK_PARSE_POINTER_MASK); + } + + /* turn pointers into zero-element arrays where necessary */ + if ((pointers & VTK_PARSE_POINTER_LOWMASK) == VTK_PARSE_ARRAY) + { + tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); + while (tmp2) + { + vtkParse_AddStringToArray( + &valinfo->Dimensions, &valinfo->NumberOfDimensions, ""); + tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); + } + } + else + { + /* combine the pointers */ + while (tmp2) + { + pointers = ((pointers << 2) | (tmp2 & VTK_PARSE_POINTER_LOWMASK)); + tmp2 = ((tmp2 >> 2) & VTK_PARSE_POINTER_MASK); + } + } + + /* combine the arrays */ + for (i = 0; i < typedefinfo->NumberOfDimensions; i++) + { + vtkParse_AddStringToArray( + &valinfo->Dimensions, &valinfo->NumberOfDimensions, + typedefinfo->Dimensions[i]); + } + if (valinfo->NumberOfDimensions > 1) + { + pointers = ((pointers & ~VTK_PARSE_POINTER_LOWMASK) | VTK_PARSE_ARRAY); + } + + /* put everything together */ + valinfo->Type = (baseType | pointers | refbit | qualifiers); + valinfo->Class = classname; + valinfo->Function = typedefinfo->Function; + valinfo->Count *= typedefinfo->Count; +} + +/* Expand any unrecognized types within a variable, parameter, or typedef + * that match any of the supplied typedefs. The expansion is done in-place. */ +void vtkParse_ExpandTypedefs( + ValueInfo *val, StringCache *cache, + int n, const char *names[], const char *values[], + ValueInfo *typedefinfo[]) +{ + int i; + + if (((val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT || + (val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) && + val->Class != 0) + { + for (i = 0; i < n; i++) + { + if (typedefinfo[i] && strcmp(val->Class, typedefinfo[i]->Name) == 0) + { + vtkParse_ExpandTypedef(val, typedefinfo[i]); + break; + } + } + if (i == n) + { + /* in case type appears as a template arg of another type */ + val->Class = vtkparse_string_replace( + cache, val->Class, n, names, values); + } + } +} + +/* Helper struct for VTK-specific types */ +struct vtk_type_struct +{ + size_t len; + const char *name; + unsigned int type; +}; + +/* Simple utility for mapping VTK types to VTK_PARSE types */ +unsigned int vtkParse_MapType(int vtktype) +{ + static unsigned int typemap[] = + { + VTK_PARSE_VOID, /* VTK_VOID 0 */ + 0, /* VTK_BIT 1 */ + VTK_PARSE_CHAR, /* VTK_CHAR 2 */ + VTK_PARSE_UNSIGNED_CHAR, /* VTK_UNSIGNED_CHAR 3 */ + VTK_PARSE_SHORT, /* VTK_SHORT 4 */ + VTK_PARSE_UNSIGNED_SHORT, /* VTK_UNSIGNED_SHORT 5 */ + VTK_PARSE_INT, /* VTK_INT 6 */ + VTK_PARSE_UNSIGNED_INT, /* VTK_UNSIGNED_INT 7 */ + VTK_PARSE_LONG, /* VTK_LONG 8 */ + VTK_PARSE_UNSIGNED_LONG, /* VTK_UNSIGNED_LONG 9 */ + VTK_PARSE_FLOAT, /* VTK_FLOAT 10 */ + VTK_PARSE_DOUBLE, /* VTK_DOUBLE 11 */ + VTK_PARSE_ID_TYPE, /* VTK_ID_TYPE 12 */ + VTK_PARSE_STRING, /* VTK_STRING 13 */ + 0, /* VTK_OPAQUE 14 */ + VTK_PARSE_SIGNED_CHAR, /* VTK_SIGNED_CHAR 15 */ + VTK_PARSE_LONG_LONG, /* VTK_LONG_LONG 16 */ + VTK_PARSE_UNSIGNED_LONG_LONG, /* VTK_UNSIGNED_LONG_LONG 17 */ + VTK_PARSE___INT64, /* VTK___INT64 18 */ + VTK_PARSE_UNSIGNED___INT64, /* VTK_UNSIGNED___INT64 19 */ + 0, /* VTK_VARIANT 20 */ + 0, /* VTK_OBJECT 21 */ + VTK_PARSE_UNICODE_STRING /* VTK_UNICODE_STRING 22 */ + }; + + if (vtktype > 0 && vtktype <= VTK_UNICODE_STRING) + { + return typemap[vtktype]; + } + return 0; +} + +/* Get a type from a type name, and return the number of characters used. + * If the "classname" argument is not NULL, then it is used to return + * the short name for the type, e.g. "long int" becomes "long", while + * typedef names and class names are returned unchanged. If "const" + * appears in the type name, then the const bit flag is set for the + * type, but "const" will not appear in the returned classname. */ +size_t vtkParse_BasicTypeFromString( + const char *text, unsigned int *type_ptr, + const char **classname_ptr, size_t *len_ptr) +{ + /* The various typedefs and types specific to VTK */ + static struct vtk_type_struct vtktypes[] = { + { 9, "vtkIdType", VTK_ID_TYPE }, + { 12, "vtkStdString", VTK_STRING }, + { 16, "vtkUnicodeString", VTK_UNICODE_STRING }, + { 11, "vtkTypeInt8", VTK_TYPE_INT8 }, + { 12, "vtkTypeUInt8", VTK_TYPE_UINT8 }, + { 12, "vtkTypeInt16", VTK_TYPE_INT16 }, + { 13, "vtkTypeUInt16", VTK_TYPE_UINT16 }, + { 12, "vtkTypeInt32", VTK_TYPE_INT32 }, + { 13, "vtkTypeUInt32", VTK_TYPE_UINT32 }, + { 12, "vtkTypeInt64", VTK_TYPE_INT64 }, + { 13, "vtkTypeUInt64", VTK_TYPE_UINT64 }, + { 14, "vtkTypeFloat32", VTK_TYPE_FLOAT32 }, + { 14, "vtkTypeFloat64", VTK_TYPE_FLOAT64 }, + { 0, 0, 0 } }; + + /* Other typedefs and types */ + static struct vtk_type_struct stdtypes[] = { + { 6, "size_t", VTK_PARSE_SIZE_T }, + { 7, "ssize_t", VTK_PARSE_SSIZE_T }, + { 7, "ostream", VTK_PARSE_OSTREAM }, + { 7, "istream", VTK_PARSE_ISTREAM }, + { 8, "string", VTK_PARSE_STRING }, + { 0, 0, 0 } }; + + const char *cp = text; + const char *tmpcp; + size_t k, n, m; + int i; + unsigned int const_bits = 0; + unsigned int static_bits = 0; + unsigned int unsigned_bits = 0; + unsigned int base_bits = 0; + const char *classname = NULL; + size_t len = 0; + + while (*cp == ' ' || *cp == '\t') { cp++; } + + while ((*cp >= 'a' && *cp <= 'z') || + (*cp >= 'A' && *cp <= 'Z') || + (*cp == '_') || (cp[0] == ':' && cp[1] == ':')) + { + /* skip all chars that are part of a name */ + n = vtkParse_NameLength(cp); + + if ((n == 6 && strncmp("static", cp, n) == 0) || + (n == 4 && strncmp("auto", cp, n) == 0) || + (n == 8 && strncmp("register", cp, n) == 0) || + (n == 8 && strncmp("volatile", cp, n) == 0)) + { + if (strncmp("static", cp, n) == 0) + { + static_bits = VTK_PARSE_STATIC; + } + } + else if (n == 5 && strncmp(cp, "const", n) == 0) + { + const_bits |= VTK_PARSE_CONST; + } + else if (n == 8 && strncmp(cp, "unsigned", n) == 0) + { + unsigned_bits |= VTK_PARSE_UNSIGNED; + if (base_bits == 0) + { + classname = "int"; + base_bits = VTK_PARSE_INT; + } + } + else if (n == 6 && strncmp(cp, "signed", n) == 0) + { + if (base_bits == VTK_PARSE_CHAR) + { + classname = "signed char"; + base_bits = VTK_PARSE_SIGNED_CHAR; + } + else + { + classname = "int"; + base_bits = VTK_PARSE_INT; + } + } + else if (n == 3 && strncmp(cp, "int", n) == 0) + { + if (base_bits == 0) + { + classname = "int"; + base_bits = VTK_PARSE_INT; + } + } + else if (n == 4 && strncmp(cp, "long", n) == 0) + { + if (base_bits == VTK_PARSE_DOUBLE) + { + classname = "long double"; + base_bits = VTK_PARSE_LONG_DOUBLE; + } + else if (base_bits == VTK_PARSE_LONG) + { + classname = "long long"; + base_bits = VTK_PARSE_LONG_LONG; + } + else + { + classname = "long"; + base_bits = VTK_PARSE_LONG; + } + } + else if (n == 5 && strncmp(cp, "short", n) == 0) + { + classname = "short"; + base_bits = VTK_PARSE_SHORT; + } + else if (n == 4 && strncmp(cp, "char", n) == 0) + { + if (base_bits == VTK_PARSE_INT && unsigned_bits != VTK_PARSE_UNSIGNED) + { + classname = "signed char"; + base_bits = VTK_PARSE_SIGNED_CHAR; + } + else + { + classname = "char"; + base_bits = VTK_PARSE_CHAR; + } + } + else if (n == 5 && strncmp(cp, "float", n) == 0) + { + classname = "float"; + base_bits = VTK_PARSE_FLOAT; + } + else if (n == 6 && strncmp(cp, "double", n) == 0) + { + if (base_bits == VTK_PARSE_LONG) + { + classname = "long double"; + base_bits = VTK_PARSE_LONG_DOUBLE; + } + else + { + classname = "double"; + base_bits = VTK_PARSE_DOUBLE; + } + } + else if (n == 4 && strncmp(cp, "bool", n) == 0) + { + classname = "bool"; + base_bits = VTK_PARSE_BOOL; + } + else if (n == 4 && strncmp(cp, "void", n) == 0) + { + classname = "void"; + base_bits = VTK_PARSE_VOID; + } + else if (n == 7 && strncmp(cp, "__int64", n) == 0) + { + classname = "__int64"; + base_bits = VTK_PARSE___INT64; + } + else + { + /* if type already found, break */ + if (base_bits != 0) + { + break; + } + + /* check vtk typedefs */ + if (strncmp(cp, "vtk", 3) == 0) + { + for (i = 0; vtktypes[i].len != 0; i++) + { + if (n == vtktypes[i].len && strncmp(cp, vtktypes[i].name, n) == 0) + { + classname = vtktypes[i].name; + base_bits = vtkParse_MapType((int)vtktypes[i].type); + } + } + } + + /* check standard typedefs */ + if (base_bits == 0) + { + m = 0; + if (strncmp(cp, "::", 2) == 0) { m = 2; } + else if (strncmp(cp, "std::", 5) == 0) { m = 5; } + else if (strncmp(cp, "vtkstd::", 8) == 0) { m = 8; } + + /* advance past the namespace */ + tmpcp = cp + m; + + for (i = 0; stdtypes[i].len != 0; i++) + { + if (n == stdtypes[i].len && strncmp(tmpcp, stdtypes[i].name, n) == 0) + { + classname = stdtypes[i].name; + base_bits = stdtypes[i].type; + } + } + + /* include the namespace if present */ + if (base_bits != 0 && m > 0) + { + classname = cp; + len = n; + } + } + + /* anything else is assumed to be a class, enum, or who knows */ + if (base_bits == 0) + { + base_bits = VTK_PARSE_UNKNOWN; + classname = cp; + len = n; + + /* VTK classes all start with vtk */ + if (strncmp(classname, "vtk", 3) == 0) + { + base_bits = VTK_PARSE_OBJECT; + /* make sure the "vtk" isn't just part of the namespace */ + for (k = 0; k < n; k++) + { + if (cp[k] == ':') + { + base_bits = VTK_PARSE_UNKNOWN; + break; + } + } + } + /* Qt objects and enums */ + else if (classname[0] == 'Q' && + ((classname[1] >= 'A' && classname[2] <= 'Z') || + strncmp(classname, "Qt::", 4) == 0)) + { + base_bits = VTK_PARSE_QOBJECT; + } + } + } + + cp += n; + while (*cp == ' ' || *cp == '\t') { cp++; } + } + + if ((unsigned_bits & VTK_PARSE_UNSIGNED) != 0) + { + switch (base_bits) + { + case VTK_PARSE_CHAR: + classname = "unsigned char"; + break; + case VTK_PARSE_SHORT: + classname = "unsigned short"; + break; + case VTK_PARSE_INT: + classname = "unsigned int"; + break; + case VTK_PARSE_LONG: + classname = "unsigned long"; + break; + case VTK_PARSE_LONG_LONG: + classname = "unsigned long long"; + break; + case VTK_PARSE___INT64: + classname = "unsigned __int64"; + break; + } + } + + *type_ptr = (static_bits | const_bits | unsigned_bits | base_bits); + + if (classname_ptr) + { + *classname_ptr = classname; + if (len == 0) + { + len = strlen(classname); + } + *len_ptr = len; + } + + return (size_t)(cp - text); +} + +/* Parse a type description in "text" and generate a typedef named "name" */ +size_t vtkParse_ValueInfoFromString( + ValueInfo *data, StringCache *cache, const char *text) +{ + const char *cp = text; + size_t n; + int m, count; + unsigned int base_bits = 0; + unsigned int pointer_bits = 0; + unsigned int ref_bits = 0; + const char *classname = NULL; + + /* get the basic type with qualifiers */ + cp += vtkParse_BasicTypeFromString(cp, &base_bits, &classname, &n); + + data->Class = vtkParse_CacheString(cache, classname, n); + + if ((base_bits & VTK_PARSE_STATIC) != 0) + { + data->IsStatic = 1; + } + + /* look for pointers (and const pointers) */ + while (*cp == '*') + { + cp++; + pointer_bits = (pointer_bits << 2); + while (*cp == ' ' || *cp == '\t') { cp++; } + if (strncmp(cp, "const", 5) == 0 && + (cp[5] < 'a' || cp[5] > 'z') && + (cp[5] < 'A' || cp[5] > 'Z') && + (cp[5] < '0' || cp[5] > '9') && + cp[5] != '_') + { + cp += 5; + while (*cp == ' ' || *cp == '\t') { cp++; } + pointer_bits = (pointer_bits | VTK_PARSE_CONST_POINTER); + } + else + { + pointer_bits = (pointer_bits | VTK_PARSE_POINTER); + } + pointer_bits = (pointer_bits & VTK_PARSE_POINTER_MASK); + } + + /* look for ref */ + if (*cp == '&') + { + cp++; + while (*cp == ' ' || *cp == '\t') { cp++; } + ref_bits = VTK_PARSE_REF; + } + + /* look for the variable name */ + if ((*cp >= 'a' && *cp <= 'z') || + (*cp >= 'A' && *cp <= 'Z') || + (*cp == '_')) + { + /* skip all chars that are part of a name */ + n = vtkparse_id_len(cp); + data->Name = vtkParse_CacheString(cache, cp, n); + cp += n; + while (*cp == ' ' || *cp == '\t') { cp++; } + } + + /* look for array brackets */ + if (*cp == '[') + { + count = 1; + } + + while (*cp == '[') + { + n = vtkparse_bracket_len(cp); + if (n > 1) + { + cp++; + n -= 2; + } + while (*cp == ' ' || *cp == '\t') { cp++; n--; } + while (n > 0 && (cp[n-1] == ' ' || cp[n-1] == '\t')) { n--; } + vtkParse_AddStringToArray( + &data->Dimensions, + &data->NumberOfDimensions, + vtkParse_CacheString(cache, cp, n)); + m = 0; + if (*cp >= '0' && *cp <= '9' && vtkparse_number_len(cp) == n) + { + m = (int)strtol(cp, NULL, 0); + } + count *= m; + + cp += n; + while (*cp == ' ' || *cp == '\t') { cp++; } + if (*cp == ']') { cp++; } + while (*cp == ' ' || *cp == '\t') { cp++; } + } + + /* add pointer indirection to correspond to first array dimension */ + if (data->NumberOfDimensions > 1) + { + pointer_bits = ((pointer_bits << 2) | VTK_PARSE_ARRAY); + } + else if (data->NumberOfDimensions == 1) + { + pointer_bits = ((pointer_bits << 2) | VTK_PARSE_POINTER); + } + pointer_bits = (pointer_bits & VTK_PARSE_POINTER_MASK); + + /* (Add code here to look for "=" followed by a value ) */ + + data->Type = (pointer_bits | ref_bits | base_bits); + + return (cp - text); +} + +/* Generate a C++ declaration string from a ValueInfo struct */ +const char *vtkParse_ValueInfoToString( + ValueInfo *data, int *needs_free) +{ + unsigned int pointer_bits = (data->Type & VTK_PARSE_POINTER_MASK); + unsigned int ref_bits = (data->Type & VTK_PARSE_REF); + unsigned int qualifier_bits = (data->Type & VTK_PARSE_CONST); + unsigned int reverse_bits = 0; + unsigned int pointer_type = 0; + const char *classname = data->Class; + const char *name = data->Name; + char *text = NULL; + size_t i = 0; + size_t l; + int j = 0; + + if (pointer_bits == 0 && ref_bits == 0 && qualifier_bits == 0 && + name == NULL) + { + if (needs_free) + { + *needs_free = 0; + } + return classname; + } + + /* compute the length of string to allocate */ + l = 6; /* for const */ + l += 4*7; /* for pointers */ + l += 1; /* for ref */ + l += strlen(classname) + 1; /* for type */ + for (j = 0; j < data->NumberOfDimensions; j++) + { + l += 2 + strlen(data->Dimensions[j]); + } + l++; /* for NULL */ + l += 4; /* for safety */ + + text = (char *)malloc(l); + + if ((qualifier_bits & VTK_PARSE_CONST) != 0) + { + strcpy(&text[i], "const "); + i += 6; + } + + strcpy(&text[i], classname); + i += strlen(classname); + text[i++] = ' '; + + while (pointer_bits != 0) + { + reverse_bits <<= 2; + reverse_bits |= (pointer_bits & VTK_PARSE_POINTER_LOWMASK); + pointer_bits = ((pointer_bits >> 2) & VTK_PARSE_POINTER_MASK); + } + + while (reverse_bits != 0) + { + pointer_type = (reverse_bits & VTK_PARSE_POINTER_LOWMASK); + if (pointer_type == VTK_PARSE_ARRAY || + (reverse_bits == VTK_PARSE_POINTER && + data->NumberOfDimensions > 0)) + { + break; + } + else if (pointer_type == VTK_PARSE_POINTER) + { + text[i++] = '*'; + } + else if (pointer_type == VTK_PARSE_CONST_POINTER) + { + strcpy(&text[i], "*const "); + i += 7; + } + + reverse_bits = ((reverse_bits >> 2) & VTK_PARSE_POINTER_MASK); + } + + if (ref_bits) + { + text[i++] = '&'; + } + + if (name) + { + strcpy(&text[i], name); + i += strlen(name); + } + + for (j = 0; j < data->NumberOfDimensions; j++) + { + text[i++] = '['; + if (data->Dimensions[j]) + { + strcpy(&text[i], data->Dimensions[j]); + i += strlen(data->Dimensions[j]); + } + text[i++] = ']'; + } + + text[i] = '\0'; + + /* make sure enough space was allocated */ + assert(i < l); + + if (needs_free) + { + *needs_free = 1; + } + + return text; +} + +/* Search and replace, return the initial string if no replacements + * occurred, otherwise return a new string allocated with malloc. */ +const char *vtkParse_StringReplace( + const char *str1, int n, const char *name[], const char *val[]) +{ + return vtkparse_string_replace(NULL, str1, n, name, val); +} + +/* substitute generic types and values with actual types and values */ +static void func_substitution( + FunctionInfo *data, StringCache *cache, + int m, const char *arg_names[], + const char *arg_values[], ValueInfo *arg_types[]); + +static void value_substitution( + ValueInfo *data, StringCache *cache, + int m, const char *arg_names[], + const char *arg_values[], ValueInfo *arg_types[]) +{ + vtkParse_ExpandTypedefs(data, cache, m, arg_names, arg_values, arg_types); + vtkParse_ExpandValues(data, cache, m, arg_names, arg_values); + + if (data->Function) + { + func_substitution( + data->Function, cache, m, arg_names, arg_values, arg_types); + } +} + +static void func_substitution( + FunctionInfo *data, StringCache *cache, + int m, const char *arg_names[], + const char *arg_values[], ValueInfo *arg_types[]) +{ + int i, n; + + n = data->NumberOfParameters; + for (i = 0; i < n; i++) + { + value_substitution( + data->Parameters[i], cache, m, arg_names, arg_values, arg_types); + } + + if (data->ReturnValue) + { + value_substitution( + data->ReturnValue, cache, m, arg_names, arg_values, arg_types); + } + + if (data->Signature) + { + data->Signature = + vtkparse_string_replace( + cache, data->Signature, m, arg_names, arg_values); + } + + /* legacy information for old wrappers */ +#ifndef VTK_PARSE_LEGACY_REMOVE + n = data->NumberOfArguments; + for (i = 0; i < n; i++) + { + data->ArgTypes[i] = data->Parameters[i]->Type; + data->ArgClasses[i] = data->Parameters[i]->Class; + if (data->Parameters[i]->NumberOfDimensions == 1 && + data->Parameters[i]->Count > 0) + { + data->ArgCounts[i] = data->Parameters[i]->Count; + } + } + + if (data->ReturnValue) + { + data->ReturnType = data->ReturnValue->Type; + data->ReturnClass = data->ReturnValue->Class; + if (data->ReturnValue->NumberOfDimensions == 1 && + data->ReturnValue->Count > 0) + { + data->HintSize = data->ReturnValue->Count; + data->HaveHint = 1; + } + } +#endif /* VTK_PARSE_LEGACY_REMOVE */ +} + +static void class_substitution( + ClassInfo *data, StringCache *cache, + int m, const char *arg_names[], + const char *arg_values[], ValueInfo *arg_types[]) +{ + int i, n; + + /* superclasses may be templated */ + n = data->NumberOfSuperClasses; + for (i = 0; i < n; i++) + { + data->SuperClasses[i] = vtkparse_string_replace( + cache, data->SuperClasses[i], m, arg_names, arg_values); + } + + n = data->NumberOfClasses; + for (i = 0; i < n; i++) + { + class_substitution( + data->Classes[i], cache, m, arg_names, arg_values, arg_types); + } + + n = data->NumberOfFunctions; + for (i = 0; i < n; i++) + { + func_substitution( + data->Functions[i], cache, m, arg_names, arg_values, arg_types); + } + + n = data->NumberOfConstants; + for (i = 0; i < n; i++) + { + value_substitution( + data->Constants[i], cache, m, arg_names, arg_values, arg_types); + } + + n = data->NumberOfVariables; + for (i = 0; i < n; i++) + { + value_substitution( + data->Variables[i], cache, m, arg_names, arg_values, arg_types); + } + + n = data->NumberOfTypedefs; + for (i = 0; i < n; i++) + { + value_substitution( + data->Typedefs[i], cache, m, arg_names, arg_values, arg_types); + } +} + +/* Extract template args from a comma-separated list enclosed + * in angle brackets. Returns zero if no angle brackets found. */ +size_t vtkParse_DecomposeTemplatedType( + const char *text, const char **classname, + int nargs, const char ***argp, const char *defaults[]) +{ + size_t i, j, k, n; + const char *arg; + char *new_text; + const char **template_args = NULL; + int template_arg_count = 0; + + n = vtkParse_NameLength(text); + + /* is the class templated? */ + for (i = 0; i < n; i++) + { + if (text[i] == '<') + { + break; + } + } + + if (classname) + { + new_text = (char *)malloc(i + 1); + strncpy(new_text, text, i); + new_text[i] = '\0'; + *classname = new_text; + } + + if (text[i] == '<') + { + i++; + /* extract the template arguments */ + for (;;) + { + while (text[i] == ' ' || text[i] == '\t') { i++; } + j = i; + while (text[j] != ',' && text[j] != '>' && + text[j] != '\n' && text[j] != '\0') + { + if (text[j] == '<' || text[j] == '(' || + text[j] == '[' || text[j] == '{') + { + j += vtkparse_bracket_len(&text[j]); + } + else if (text[j] == '\'' || text[j] == '\"') + { + j += vtkparse_quote_len(&text[j]); + } + else + { + j++; + } + } + + k = j; + while (text[k-1] == ' ' || text[k-1] == '\t') { --k; } + + new_text = (char *)malloc(k-i + 1); + strncpy(new_text, &text[i], k-i); + new_text[k-i] = '\0'; + vtkParse_AddStringToArray(&template_args, &template_arg_count, + new_text); + + assert(template_arg_count <= nargs); + + i = j + 1; + + if (text[j] != ',') + { + break; + } + } + } + + while (template_arg_count < nargs) + { + assert(defaults != NULL); + arg = defaults[template_arg_count]; + assert(arg != NULL); + new_text = (char *)malloc(strlen(arg + 1)); + strcpy(new_text, arg); + vtkParse_AddStringToArray(&template_args, &template_arg_count, new_text); + } + + *argp = template_args; + + return i; +} + +/* Free the list of strings returned by ExtractTemplateArgs. */ +void vtkParse_FreeTemplateDecomposition( + const char *name, int n, const char **args) +{ + int i; + + if (name) + { + free((char *)name); + } + + if (n > 0) + { + for (i = 0; i < n; i++) + { + free((char *)args[i]); + } + + free((char **)args); + } +} + +/* Instantiate a class template by substituting the provided arguments. */ +void vtkParse_InstantiateClassTemplate( + ClassInfo *data, StringCache *cache, int n, const char *args[]) +{ + TemplateInfo *t = data->Template; + const char **new_args = NULL; + const char **arg_names = NULL; + ValueInfo **arg_types = NULL; + int i, m; + char *new_name; + size_t k; + + if (t == NULL) + { + fprintf(stderr, "vtkParse_InstantiateClassTemplate: " + "this class is not templated.\n"); + return; + } + + m = t->NumberOfParameters; + if (n > m) + { + fprintf(stderr, "vtkParse_InstantiateClassTemplate: " + "too many template args.\n"); + return; + } + + for (i = n; i < m; i++) + { + if (t->Parameters[i]->Value == NULL || + t->Parameters[i]->Value[0] == '\0') + { + fprintf(stderr, "vtkParse_InstantiateClassTemplate: " + "too few template args.\n"); + return; + } + } + + new_args = (const char **)malloc(m*sizeof(char **)); + for (i = 0; i < n; i++) + { + new_args[i] = args[i]; + } + for (i = n; i < m; i++) + { + new_args[i] = t->Parameters[i]->Value; + } + args = new_args; + + arg_names = (const char **)malloc(m*sizeof(char **)); + arg_types = (ValueInfo **)malloc(m*sizeof(ValueInfo *)); + for (i = 0; i < m; i++) + { + arg_names[i] = t->Parameters[i]->Name; + arg_types[i] = NULL; + if (t->Parameters[i]->Type == 0) + { + arg_types[i] = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(arg_types[i]); + vtkParse_ValueInfoFromString(arg_types[i], cache, args[i]); + arg_types[i]->ItemType = VTK_TYPEDEF_INFO; + arg_types[i]->Name = arg_names[i]; + } + } + + /* no longer a template (has been instantiated) */ + if (data->Template) + { + vtkParse_FreeTemplate(data->Template); + } + data->Template = NULL; + + /* append template args to class name */ + k = strlen(data->Name) + 2; + for (i = 0; i < m; i++) + { + k += strlen(args[i]) + 2; + } + new_name = (char *)malloc(k); + strcpy(new_name, data->Name); + k = strlen(new_name); + new_name[k++] = '<'; + for (i = 0; i < m; i++) + { + strcpy(&new_name[k], args[i]); + k += strlen(args[i]); + if (i+1 < m) + { + new_name[k++] = ','; + new_name[k++] = ' '; + } + } + if (new_name[k-1] == '>') + { + new_name[k++] = ' '; + } + new_name[k++] = '>'; + new_name[k] = '\0'; + + data->Name = vtkParse_CacheString(cache, new_name, k); + free(new_name); + + /* do the template arg substitution */ + class_substitution(data, cache, m, arg_names, args, arg_types); + + /* free all allocated arrays */ + free((char **)new_args); + free((char **)arg_names); + + for (i = 0; i < m; i++) + { + if (arg_types[i]) + { + vtkParse_FreeValue(arg_types[i]); + } + } + free(arg_types); +} + +/* Get a zero-terminated array of the types in vtkTemplateMacro. */ +const char **vtkParse_GetTemplateMacroTypes() +{ + static const char *types[] = { + "char", "signed char", "unsigned char", "short", "unsigned short", + "int", "unsigned int", "long", "unsigned long", +#ifdef VTK_TYPE_USE_LONG_LONG + "long long", "unsigned long long", +#endif +#ifdef VTK_TYPE_USE___INT64 + "__int64", "unsigned __int64", +#endif + "float", "double", NULL }; + + return types; +} + +/* Get a zero-terminated array of the types in vtkArray. */ +const char **vtkParse_GetArrayTypes() +{ + static const char *types[] = { + "char", "signed char", "unsigned char", "short", "unsigned short", + "int", "unsigned int", "long", "unsigned long", +#ifdef VTK_TYPE_USE_LONG_LONG + "long long", "unsigned long long", +#endif +#ifdef VTK_TYPE_USE___INT64 + "__int64", "unsigned __int64", +#endif + "float", "double", + "vtkStdString", "vtkUnicodeString", "vtkVariant", NULL }; + + return types; +} diff --git a/src/VTKWrapping/ParaView/vtkParseExtras.h b/src/VTKWrapping/ParaView/vtkParseExtras.h new file mode 100644 index 00000000..3f3dceca --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseExtras.h @@ -0,0 +1,173 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseExtras.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2011 David Gobbi. + + Contributed to the VisualizationToolkit by the author in May 2011 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +/** + * This file contains extra utilities for parsing and wrapping. + */ + +#ifndef VTK_PARSE_EXTRAS_H +#define VTK_PARSE_EXTRAS_H + +#include "vtkParseData.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Skip over a sequence of characters that begin with an alphabetic + * character or an underscore, and include only alphanumeric + * characters or underscores. Return the number of characters. + */ +size_t vtkParse_IdentifierLength(const char *text); + +/** + * Skip over a name, including any namespace prefixes and + * any template arguments. Return the number of characters. + * Examples are "name", "::name", "name", "name::name2", + * "::name::name2". + */ +size_t vtkParse_NameLength(const char *text); + +/** + * Skip over a name, including any template arguments, but stopping + * if a '::' is encoutered. Return the number of characters. + * Examples are "name" and "name" + */ +size_t vtkParse_UnscopedNameLength(const char *text); + +/** + * Skip over a literal, which may be a number, a char in single + * quotes, a string in double quotes, or a name, or a name followed + * by arguments in parentheses. + */ +size_t vtkParse_LiteralLength(const char *text); + +/** + * Get a type from a type name, and return the number of characters used. + * If the "classname" argument is not NULL, then it is used to return + * the short name for the type, e.g. "long int" becomes "long", while + * typedef names and class names are returned unchanged. If "const" + * appears in the type name, then the const bit flag is set for the + * type, but "const" will not appear in the returned classname. + */ +size_t vtkParse_BasicTypeFromString( + const char *text, unsigned int *type, + const char **classname, size_t *classname_len); + +/** + * Generate a ValueInfo by parsing the type from the provided text. + * Only simple text strings are supported, e.g. "const T **". + * Returns the number of characters consumed. + */ +size_t vtkParse_ValueInfoFromString( + ValueInfo *val, StringCache *cache, const char *text); + +/** + * Generate a declaration string from a ValueInfo struct. If the + * "nf" arg is set, the returned string must be freed. + * Only simple text strings are supported, e.g. "const T **". + * The variable or typedef name, if present, is ignored. + */ +const char *vtkParse_ValueInfoToString(ValueInfo *val, int *nf); + +/** + * Expand a typedef within a variable, parameter, or typedef declaration. + * The expansion is done in-place. + */ +void vtkParse_ExpandTypedef(ValueInfo *valinfo, ValueInfo *typedefinfo); + +/** + * Expand any unrecognized types within a variable, parameter, or typedef + * that match any of the supplied typedefs. The expansion is done in-place. + */ +void vtkParse_ExpandTypedefs( + ValueInfo *valinfo, StringCache *cache, + int n, const char *name[], const char *val[], + ValueInfo *typedefinfo[]); + +/** + * Wherever one of the specified names exists inside a Value or inside + * a Dimension size, replace it with the corresponding val string. + * This is used to replace constants with their values. + */ +void vtkParse_ExpandValues( + ValueInfo *valinfo, StringCache *cache, + int n, const char *name[], const char *val[]); + +/** + * Search and replace, return the initial string if no replacements + * occurred, else return a new string allocated with malloc. */ +const char *vtkParse_StringReplace( + const char *str1, int n, const char *name[], const char *val[]); + +/** + * Extract the class name and template args from a templated + * class type ID. Returns the full number of characters that + * were consumed during the decomposition. + */ +size_t vtkParse_DecomposeTemplatedType( + const char *text, const char **classname, + int n, const char ***args, const char *defaults[]); + +/** + * Free the list of strings returned by ExtractTemplateArgs. + */ +void vtkParse_FreeTemplateDecomposition( + const char *classname, int n, const char **args); + +/** + * Instantiate a class template by substituting the provided arguments + * for the template parameters. If "n" is less than the number of template + * parameters, then default parameter values (if present) will be used. + * If an error occurs, the error will be printed to stderr and NULL will + * be returned. + */ +void vtkParse_InstantiateClassTemplate( + ClassInfo *data, StringCache *cache, int n, const char *args[]); + +/** + * Instantiate a function or class method template by substituting the + * provided arguments for the template parameters. If "n" is less than + * the number of template parameters, then default parameter values + * (if present) will be used. If an error occurs, the error will be + * printed to stderr and NULL will be returned. + */ +void vtkParse_IntantiateFunctionTemplate( + FunctionInfo *data, int n, const char *args[]); + +/** + * Get a zero-terminated array of the types in vtkTemplateMacro. + */ +const char **vtkParse_GetTemplateMacroTypes(); + +/** + * Get a zero-terminated array of the types in vtkArray. + */ +const char **vtkParse_GetArrayTypes(); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkParseHierarchy.c b/src/VTKWrapping/ParaView/vtkParseHierarchy.c new file mode 100644 index 00000000..aa9d1b63 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseHierarchy.c @@ -0,0 +1,1014 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseHierarchy.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in June 2010 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +#include "vtkParseHierarchy.h" +#include "vtkParseExtras.h" +#include +#include +#include +#include +#include + +static size_t skip_space(const char *text) +{ + size_t i = 0; + while (isspace(text[i]) && text[i] != '\n') { i++; } + return i; +} + +static size_t skip_expression(const char *text, const char *delims) +{ + char newdelims[2]; + size_t i = 0; + size_t j; + int use_angle = 0; + char c; + + for (j = 0; delims[j] != '\0'; j++) + { + if (delims[j] == '>') + { + use_angle = 1; + } + } + + while (text[i] != '\0') + { + c = text[i]; + j = 0; + while (c != delims[j] && delims[j] != '\0') { j++; } + if (delims[j] != '\0' || c == '\0') { break; } + if (c == '\"' || c == '\'') + { + char d = c; + i++; + while (text[i] != d && text[i] != '\0') + { + if (text[i] == '\\' && text[i+1] != '\0') { i++; } + i++; + } + c = text[i]; + if (c == '\0') { break; } + } + i++; + if (c == '(' || c == '[' || c == '{' || (use_angle && c == '<')) + { + if (c == '(') { newdelims[0] = ')'; } + if (c == '[') { newdelims[0] = ']'; } + if (c == '{') { newdelims[0] = '}'; } + if (c == '<') { newdelims[0] = '>'; } + newdelims[1] = '\0'; + + i += skip_expression(&text[i], newdelims); + + if (text[i] == newdelims[0]) { i++; } else { break; } + } + } + + return i; +} + +/* helper: comparison of entries */ +static int compare_hierarchy_entries(const void *vp1, const void *vp2) +{ + const HierarchyEntry *entry1 = (const HierarchyEntry *)vp1; + const HierarchyEntry *entry2 = (const HierarchyEntry *)vp2; + + return strcmp(entry1->Name, entry2->Name); +} + +/* helper: sort the entries to facilitate searching */ +static void sort_hierarchy_entries(HierarchyInfo *info) +{ + qsort(info->Entries, info->NumberOfEntries, sizeof(HierarchyEntry), + &compare_hierarchy_entries); +} + +/* Find an entry with a binary search */ +HierarchyEntry *vtkParseHierarchy_FindEntry( + const HierarchyInfo *info, const char *classname) +{ + HierarchyEntry key; + HierarchyEntry *entry; + size_t i, n; + char name[32]; + char *cp; + + /* use classname as-is for the search if possible */ + cp = (char *)classname; + + /* get portion of name before final template parameters */ + n = vtkParse_UnscopedNameLength(classname); + i = 0; + while (classname[i+n] == ':' && classname[i+n+1] == ':') + { + i += n + 2; + n = vtkParse_UnscopedNameLength(&classname[i]); + } + i += vtkParse_IdentifierLength(&classname[i]); + + /* create a new (shorter) search string if necessary */ + if (classname[i] != '\0') + { + /* use stack space if possible */ + cp = name; + /* otherwise, use malloc */ + if (i > 31) + { + cp = (char *)malloc(i+1); + } + strncpy(cp, classname, i); + cp[i] = '\0'; + } + + key.Name = cp; + + entry = (HierarchyEntry *)bsearch(&key, info->Entries, + info->NumberOfEntries, sizeof(HierarchyEntry), + &compare_hierarchy_entries); + + if (cp != classname && cp != name) + { + free(cp); + } + + return entry; +} + + +/* read a hierarchy file into a HeirarchyInfo struct, or return NULL */ +HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename) +{ + HierarchyInfo *info; + HierarchyEntry *entry; + int maxClasses = 500; + FILE *fp; + char *line; + char *cp; + const char *ccp; + size_t maxlen = 15; + size_t i, j, n, m; + unsigned int bits, pointers; + static const char *delims = ">,="; + + line = (char *)malloc(maxlen); + + fp = fopen(filename, "r"); + + if (fp == NULL) + { + return NULL; + } + + info = (HierarchyInfo *)malloc(sizeof(HierarchyInfo)); + info->NumberOfEntries = 0; + info->Entries = (HierarchyEntry *)malloc(maxClasses*sizeof(HierarchyEntry)); + info->Strings = (StringCache *)malloc(sizeof(StringCache)); + vtkParse_InitStringCache(info->Strings); + + while (fgets(line, (int)maxlen, fp)) + { + n = strlen(line); + + /* if buffer not long enough, increase it */ + while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) + { + maxlen *= 2; + line = (char *)realloc(line, maxlen); + if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } + n += strlen(&line[n]); + } + + while (n > 0 && isspace(line[n-1])) + { + n--; + } + line[n] = '\0'; + + if (line[0] == '\0') + { + continue; + } + + if (info->NumberOfEntries == maxClasses) + { + maxClasses *= 2; + info->Entries = (HierarchyEntry *)realloc( + info->Entries, sizeof(HierarchyEntry)*maxClasses*2); + } + + entry = &info->Entries[info->NumberOfEntries++]; + entry->Name = NULL; + entry->HeaderFile = NULL; + entry->Module = NULL; + entry->NumberOfTemplateParameters = 0; + entry->TemplateParameters = NULL; + entry->TemplateDefaults = NULL; + entry->NumberOfProperties = 0; + entry->Properties = NULL; + entry->NumberOfSuperClasses = 0; + entry->SuperClasses = NULL; + entry->SuperClassIndex = NULL; + entry->Typedef = NULL; + entry->IsTypedef = 0; + entry->IsEnum = 0; + + i = skip_space(line); + n = vtkParse_NameLength(&line[i]); + for (m = 0; m < n; m++) + { + if (line[i+m] == '<') { break; } + } + + entry->Name = vtkParse_CacheString(info->Strings, &line[i], m); + i += m; + + if (line[i] == '<') + { + i++; + i += skip_space(&line[i]); + + for (j = 0; line[i] != '>' && line[i] != '\0'; j++) + { + if (j == 0) + { + entry->TemplateParameters = (const char **)malloc(sizeof(char *)); + entry->TemplateDefaults = (const char **)malloc(sizeof(char *)); + } + else + { + entry->TemplateParameters = (const char **)realloc( + (char **)entry->TemplateParameters, (j+1)*sizeof(char *)); + entry->TemplateDefaults = (const char **)realloc( + (char **)entry->TemplateDefaults, (j+1)*sizeof(char *)); + } + entry->NumberOfTemplateParameters++; + entry->TemplateDefaults[j] = NULL; + + m = skip_expression(&line[i], delims); + while (m > 0 && (line[i+m-1] == ' ' || line[i+m-1] == '\t')) + { + --m; + } + + entry->TemplateParameters[j] = + vtkParse_CacheString(info->Strings, &line[i], m); + i += m; + i += skip_space(&line[i]); + + if (line[i] == '=') + { + i++; + i += skip_space(&line[i]); + m = skip_expression(&line[i], delims); + while (m > 0 && (line[i+m-1] == ' ' || line[i+m-1] == '\t')) + { + --m; + } + entry->TemplateDefaults[j] = + vtkParse_CacheString(info->Strings, &line[i], m); + i += m; + i += skip_space(&line[i]); + } + + if (line[i] == ',') + { + i++; + i += skip_space(&line[i]); + } + } + + if (line[i] == '>') + { + i++; + i += skip_space(&line[i]); + } + + if (line[i] == ':' && line[i+1] == ':') + { + i += 2; + m = vtkParse_NameLength(&line[i]); + n = strlen(entry->Name); + cp = vtkParse_NewString(info->Strings, n+m+2); + strcpy(cp, entry->Name); + strcpy(&cp[n], "::"); + strncpy(&cp[n+2], &line[i], m); + i += m; + cp[n+m+2] = '\0'; + entry->Name = cp; + } + } + + i += skip_space(&line[i]); + + /* classes (and possibly enums) */ + if (line[i] == ':') + { + i++; + i += skip_space(&line[i]); + n = vtkParse_NameLength(&line[i]); + /* check for enum indicators */ + if ((n == 3 && strncmp(&line[i], "int", n)) || + (n == 4 && strncmp(&line[i], "enum", n))) + { + entry->IsEnum = 1; + i += n; + i += skip_space(&line[i]); + } + /* else check for superclasses */ + else for (j = 0; ; j++) + { + if (j == 0) + { + entry->SuperClasses = (const char **)malloc(sizeof(char *)); + entry->SuperClassIndex = (int *)malloc(sizeof(int)); + } + else + { + entry->SuperClasses = (const char **)realloc( + (char **)entry->SuperClasses, (j+1)*sizeof(char *)); + entry->SuperClassIndex = (int *)realloc( + entry->SuperClassIndex, (j+1)*sizeof(int)); + } + entry->NumberOfSuperClasses++; + + i += skip_space(&line[i]); + n = vtkParse_NameLength(&line[i]); + entry->SuperClasses[j] = + vtkParse_CacheString(info->Strings, &line[i], n); + entry->SuperClassIndex[j] = -1; + i += n; + + i += skip_space(&line[i]); + if (line[i] != ',') + { + break; + } + i++; + } + } + + /* read typedefs */ + else if (line[i] == '=') + { + i++; + i += skip_space(&line[i]); + entry->IsTypedef = 1; + entry->Typedef = (ValueInfo *)malloc(sizeof(ValueInfo)); + vtkParse_InitValue(entry->Typedef); + + /* type is a reference (does this ever occur?) */ + if (line[i] == '&') + { + i++; + i += skip_space(&line[i]); + entry->Typedef->Type |= VTK_PARSE_REF; + } + + /* type has array dimensions */ + if (line[i] == '[') + { + entry->Typedef->Count = 1; + } + + while (line[i] == '[') + { + i++; + n = 0; + while (line[i+n] != ']' && line[i+n] != '\n' && line[i+n] != '\0') + { + n++; + } + ccp = vtkParse_CacheString(info->Strings, &line[i], n); + vtkParse_AddStringToArray(&entry->Typedef->Dimensions, + &entry->Typedef->NumberOfDimensions, ccp); + if (ccp[0] >= '0' && ccp[0] <= '9') + { + entry->Typedef->Count *= (int)strtol(ccp, NULL, 0); + } + else + { + entry->Typedef->Count = 0; + } + i += n; + if (line[i] == ']') + { + i++; + } + } + i += skip_space(&line[i]); + + /* look for pointers (and const pointers) */ + bits = 0; + while (line[i] == '*' || strncmp(&line[i], "const*", 6) == 0) + { + bits = (bits << 2); + if (line[i] == '*') + { + bits = (bits | VTK_PARSE_POINTER); + } + else + { + bits = (bits | VTK_PARSE_CONST_POINTER); + i += 5; + } + bits = (bits & VTK_PARSE_POINTER_MASK); + i++; + i += skip_space(&line[i]); + } + + /* need to reverse to get correct pointer order */ + pointers = 0; + while (bits) + { + pointers = (pointers << 2); + pointers = (pointers | (bits & VTK_PARSE_POINTER_LOWMASK)); + bits = ((bits >> 2) & VTK_PARSE_POINTER_MASK); + } + + /* add pointer indirection to correspond to first array dimension */ + if (entry->Typedef->NumberOfDimensions > 1) + { + pointers = ((pointers << 2) | VTK_PARSE_ARRAY); + } + else if (entry->Typedef->NumberOfDimensions == 1) + { + pointers = ((pointers << 2) | VTK_PARSE_POINTER); + } + + /* include the pointers in the type */ + entry->Typedef->Type |= (pointers & VTK_PARSE_POINTER_MASK); + + /* read the base type (and const) */ + bits = 0; + i += vtkParse_BasicTypeFromString(&line[i], &bits, &ccp, &n); + entry->Typedef->Class = vtkParse_CacheString(info->Strings, ccp, n); + entry->Typedef->Type |= bits; + } + + /* get the header file */ + if (line[i] == ';') + { + i++; + i += skip_space(&line[i]); + n = 0; + while(line[i+n] != '\0' && line[i+n] != ';' && + !isspace(line[i+n])) { n++; }; + entry->HeaderFile = vtkParse_CacheString(info->Strings, &line[i], n); + + i += n; + i += skip_space(&line[i]); + + /* get the module */ + if (line[i] == ';') + { + i++; + i += skip_space(&line[i]); + n = 0; + while(line[i+n] != '\0' && line[i+n] != ';' && + !isspace(line[i+n])) { n++; }; + entry->Module = vtkParse_CacheString(info->Strings, &line[i], n); + + i += n; + i += skip_space(&line[i]); + } + + /* get all flags */ + while (line[i] == ';') + { + i++; + i += skip_space(&line[i]); + if (entry->NumberOfProperties == 0) + { + entry->Properties = (const char **)malloc(sizeof(char **)); + } + else + { + entry->Properties = (const char **)realloc( + (char **)entry->Properties, + (entry->NumberOfProperties+1)*sizeof(char **)); + } + n = 0; + while (line[i+n] != '\0' && line[i+n] != '\n' && line[i+n] != ';') + { n++; } + if (n && skip_space(&line[i]) != n) + { + entry->Properties[entry->NumberOfProperties++] = + vtkParse_CacheString(info->Strings, &line[i], n); + } + i += n; + } + } + } + + if (!feof(fp)) + { + vtkParseHierarchy_Free(info); + info = NULL; + } + + free(line); + + sort_hierarchy_entries(info); + + return info; +} + +/* free a HierarchyInfo struct */ +void vtkParseHierarchy_Free(HierarchyInfo *info) +{ + HierarchyEntry *entry; + int i; + + for (i = 0; i < info->NumberOfEntries; i++) + { + entry = &info->Entries[i]; + if (entry->NumberOfTemplateParameters) + { + free((char **)entry->TemplateParameters); + free((char **)entry->TemplateDefaults); + } + if (entry->NumberOfSuperClasses) + { + free((char **)entry->SuperClasses); + free(entry->SuperClassIndex); + } + if (entry->NumberOfProperties) + { + free((char **)entry->Properties); + } + } + + free(info->Entries); + free(info); +} + + +/* Check whether class is derived from baseclass. You must supply + * the entry for the class (returned by FindEntry) as well as the + * classname. If the class is templated, the classname can include + * template args in angle brackets. If you provide a pointer for + * baseclass_with_args, then it will be used to return the name of + * name of the baseclass with template args in angle brackets. */ + +int vtkParseHierarchy_IsTypeOfTemplated( + const HierarchyInfo *info, + const HierarchyEntry *entry, const char *classname, + const char *baseclass, const char **baseclass_with_args) +{ + HierarchyEntry *tmph; + const char *name; + const char *supername; + char *tmp; + int templated; + int baseclass_is_template_parameter; + int supername_needs_free = 0; + int classname_needs_free = 0; + int i, j, k; + int nargs; + const char **args; + size_t m; + int iterating = 1; + int rval = 0; + + while (iterating) + { + iterating = 0; + templated = 0; + baseclass_is_template_parameter = 0; + nargs = 0; + args = NULL; + + /* if classname is the same as baseclass, done! */ + if (strcmp(entry->Name, baseclass) == 0) + { + if (baseclass_with_args) + { + if (!classname_needs_free) + { + tmp = (char *)malloc(strlen(classname) + 1); + strcpy(tmp, classname); + classname = tmp; + } + *baseclass_with_args = classname; + classname_needs_free = 0; + } + rval = 1; + break; + } + else if (entry->NumberOfSuperClasses == 0) + { + rval = 0; + break; + } + + /* if class is templated */ + if (entry->NumberOfTemplateParameters) + { + /* check for template args for classname */ + m = strlen(entry->Name); + if (classname[m] == '<') + { + templated = 1; + + nargs = entry->NumberOfTemplateParameters; + vtkParse_DecomposeTemplatedType(classname, &name, nargs, &args, + entry->TemplateDefaults); + } + } + + /* check all baseclasses */ + for (j = 0; j < entry->NumberOfSuperClasses && rval == 0; j++) + { + supername = entry->SuperClasses[j]; + + if (templated) + { + for (k = 0; k < entry->NumberOfTemplateParameters; k++) + { + /* check if the baseclass itself is a template parameter */ + m = strlen(entry->TemplateParameters[k]); + if (strncmp(entry->TemplateParameters[k], supername, m) == 0 && + !isalnum(supername[m]) && supername[m] != '_') + { + baseclass_is_template_parameter = 1; + break; + } + } + + /* use the class template args to find baseclass template args */ + supername = vtkParse_StringReplace( + supername, entry->NumberOfTemplateParameters, entry->TemplateParameters, args); + if (supername != entry->SuperClasses[j]) + { + supername_needs_free = 1; + } + } + + /* check the cached index for the baseclass entry */ + i = entry->SuperClassIndex[j]; + if (i == -1) + { + /* index was not set yet, so search for the entry */ + tmph = vtkParseHierarchy_FindEntry(info, supername); + while (tmph && tmph->IsTypedef) + { + if (tmph->Typedef->Class) + { + tmph = vtkParseHierarchy_FindEntry(info, tmph->Typedef->Class); + continue; + } + break; + } + + if (tmph) + { + i = (int)(tmph - info->Entries); + } + else + { + /* entry not found, don't try again */ + /* i = -2; messes things up for templates */ + /* fprintf(stderr, "not found \"%s\"\n", entry->SuperClasses[j]); */ + } + + /* if baseclass is a template parameter, its entry cannot be cached */ + if (!baseclass_is_template_parameter) + { + /* cache the position of the baseclass */ + ((HierarchyEntry *)entry)->SuperClassIndex[j] = i; + } + } + + /* if entry was found, continue down the chain */ + if (i >= 0) + { + if (classname_needs_free) + { + free((char *)classname); + } + classname = supername; + classname_needs_free = supername_needs_free; + supername_needs_free = 0; + + /* use the iteration loop instead of recursion */ + if (j+1 >= entry->NumberOfSuperClasses) + { + entry = &info->Entries[i]; + iterating = 1; + } + + /* recurse for multiple inheritance */ + else + { + rval = vtkParseHierarchy_IsTypeOfTemplated( + info, &info->Entries[i], classname, baseclass, + baseclass_with_args); + } + } + + if (supername_needs_free) + { + free((char *)supername); + supername_needs_free = 0; + } + + } /* end of loop over superclasses */ + + if (templated) + { + vtkParse_FreeTemplateDecomposition(name, nargs, args); + } + + } /* end of "while (iterating)" */ + + if (classname_needs_free) + { + free((char *)classname); + } + + if (baseclass_with_args && !rval) + { + *baseclass_with_args = NULL; + } + + return rval; +} + +int vtkParseHierarchy_IsTypeOf( + const HierarchyInfo *info, const HierarchyEntry *entry, + const char *baseclass) +{ + return vtkParseHierarchy_IsTypeOfTemplated( + info, entry, entry->Name, baseclass, NULL); +} + +/* Free args returned by IsTypeOfTemplated */ +void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]) +{ + int i; + + for (i = 0; i < n; i++) + { + free((char *)args[i]); + } + + free((char **)args); +} + +/* Given a classname with template parameters, get the superclass name + * with corresponding template parameters. Returns null if 'i' is out + * of range, i.e. greater than or equal to the number of superclasses. + * The returned classname must be freed with "free()". */ +const char *vtkParseHierarchy_TemplatedSuperClass( + const HierarchyEntry *entry, const char *classname, int i) +{ + const char *supername = NULL; + const char *name; + const char **args; + char *cp; + size_t j; + + if (i < entry->NumberOfSuperClasses) + { + supername = entry->SuperClasses[i]; + j = vtkParse_IdentifierLength(classname); + + if (classname[j] == '<') + { + vtkParse_DecomposeTemplatedType(classname, &name, + entry->NumberOfTemplateParameters, &args, entry->TemplateDefaults); + supername = vtkParse_StringReplace(entry->SuperClasses[i], + entry->NumberOfTemplateParameters, entry->TemplateParameters, args); + vtkParse_FreeTemplateDecomposition( + name, entry->NumberOfTemplateParameters, args); + } + + if (supername == entry->SuperClasses[i]) + { + cp = (char *)malloc(strlen(supername) + 1); + strcpy(cp, supername); + supername = cp; + } + } + + return supername; +} + +/* get the specified property, or return NULL */ +const char *vtkParseHierarchy_GetProperty( + const HierarchyEntry *entry, const char *property) +{ + int i; + size_t k; + + if (entry) + { + for (i = 0; i < entry->NumberOfProperties; i++) + { + /* skip the property name, everything after is the property */ + k = vtkParse_NameLength(entry->Properties[i]); + if (k == strlen(property) && + strncmp(entry->Properties[i], property, k) == 0) + { + if (entry->Properties[i][k] == ' ' || + entry->Properties[i][k] == '=') { k++; } + return &entry->Properties[i][k]; + } + } + } + + return NULL; +} + +/* Expand all unrecognized types in a ValueInfo struct by + * using the typedefs in the HierarchyInfo struct. */ +int vtkParseHierarchy_ExpandTypedefsInValue( + const HierarchyInfo *info, ValueInfo *val, StringCache *cache, + const char *scope) +{ + char text[128]; + char *cp; + const char *newclass; + size_t n, m; + int i; + HierarchyEntry *entry; + int scope_needs_free = 0; + int result = 1; + + while (((val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT || + (val->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) && + val->Class != 0) + { + entry = 0; + + /* search for the type in the provided scope */ + while (entry == 0 && scope != 0) + { + cp = text; + n = strlen(scope); + m = strlen(val->Class); + /* only malloc if more than 128 chars needed */ + if (n + m + 2 >= 128) + { + cp = (char *)malloc(n+m+3); + } + + /* scope the name */ + strncpy(cp, scope, n); + cp[n++] = ':'; + cp[n++] = ':'; + strncpy(&cp[n], val->Class, m); + cp[n+m] = '\0'; + + entry = vtkParseHierarchy_FindEntry(info, cp); + + if (cp != text) { free(cp); } + + /* if not found, try inherited scopes */ + if (entry == 0) + { + entry = vtkParseHierarchy_FindEntry(info, scope); + scope = 0; + scope_needs_free = 0; + if (entry && entry->NumberOfSuperClasses) + { + for (i = 0; i+1 < entry->NumberOfSuperClasses; i++) + { + if (scope_needs_free) { free((char *)scope); } + scope = vtkParseHierarchy_ExpandTypedefsInName( + info, entry->SuperClasses[i], NULL); + scope_needs_free = (scope != entry->SuperClasses[i]); + /* recurse if more than one superclass */ + if (vtkParseHierarchy_ExpandTypedefsInValue( + info, val, cache, scope)) + { + if (scope_needs_free) { free((char *)scope); } + return 1; + } + } + if (scope_needs_free) { free((char *)scope); } + scope = vtkParseHierarchy_ExpandTypedefsInName( + info, entry->SuperClasses[i], NULL); + scope_needs_free = (scope != entry->SuperClasses[i]); + } + entry = 0; + } + } + + /* if not found, try again with no scope */ + if (entry == 0) + { + entry = vtkParseHierarchy_FindEntry(info, val->Class); + } + + if (entry && entry->IsTypedef) + { + vtkParse_ExpandTypedef(val, entry->Typedef); + } + else if (entry) + { + newclass = vtkParseHierarchy_ExpandTypedefsInName( + info, val->Class, scope); + if (newclass != val->Class) + { + val->Class = vtkParse_CacheString(cache, newclass, strlen(newclass)); + free((char *)newclass); + } + result = 1; + break; + } + else + { + result = 0; + break; + } + } + + if (scope_needs_free) { free((char *)scope); } + + return result; +} + +/* Expand typedefs found in an expression stored as a string. + * The value of "text" will be returned if no expansion occurred, + * else a new string is returned that must be freed with "free()". */ +const char *vtkParseHierarchy_ExpandTypedefsInName( + const HierarchyInfo *info, const char *name, const char *scope) +{ + char text[128]; + char *cp; + size_t n, m; + const char *newname = name; + HierarchyEntry *entry = NULL; + + /* note: unlike ExpandTypedefsInValue, this does not yet recurse + * or look in superclass scopes */ + + /* doesn't yet handle names that are scoped or templated */ + m = vtkParse_IdentifierLength(name); + if (name[m] != '\0') + { + return name; + } + + if (scope) + { + cp = text; + n = strlen(scope); + m = strlen(name); + /* only malloc if more than 128 chars needed */ + if (n + m + 2 >= 128) + { + cp = (char *)malloc(n+m+3); + } + + /* scope the name */ + strncpy(cp, scope, n); + cp[n++] = ':'; + cp[n++] = ':'; + strncpy(&cp[n], name, m); + cp[n+m] = '\0'; + + entry = vtkParseHierarchy_FindEntry(info, cp); + + if (cp != text) { free(cp); } + } + + if (!entry) + { + entry = vtkParseHierarchy_FindEntry(info, name); + } + + newname = NULL; + if (entry && entry->IsTypedef && entry->Typedef->Class) + { + newname = entry->Typedef->Class; + } + if (newname) + { + cp = (char *)malloc(strlen(newname) + 1); + strcpy(cp, newname); + name = cp; + } + + return name; +} diff --git a/src/VTKWrapping/ParaView/vtkParseHierarchy.h b/src/VTKWrapping/ParaView/vtkParseHierarchy.h new file mode 100644 index 00000000..876702c1 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseHierarchy.h @@ -0,0 +1,159 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseHierarchy.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in June 2010 + under the terms of the Visualization Toolkit 2008 copyright. +--------------------------------------------------------------------------*/ + +/** + This file contains utility functions for loading and parsing + a VTK hierarchy file. The file contains entries like the + following (one per line in the file): + + classname [ : superclass ] ; header.h ; vtkKit [; flags] + + For each typedef, the output file will have a line like this: + + name = &[2][3]* const type ; header.h ; vtkKit [; flags] + + For each enum, the output file will have: + + enumname : enum ; header.h ; vtkKit [; flags] + +*/ + +#ifndef VTK_PARSE_HIERARCHY_H +#define VTK_PARSE_HIERARCHY_H + +/* Need the ValueInfo struct for typedefs */ +#include "vtkParseData.h" + +/** + * One entry from the hierarchy file. + * It contains a class name, the superclasses, and the header file. + */ +typedef struct _HierarchyEntry +{ + const char *Name; /* the class or type name */ + const char *HeaderFile; /* header file the class is defined in */ + const char *Module; /* library the class is defined in */ + int NumberOfTemplateParameters; /* number of template params */ + const char **TemplateParameters; + const char **TemplateDefaults; + int NumberOfProperties; /* number of properties */ + const char **Properties; + int NumberOfSuperClasses; /* number of superclasses */ + const char **SuperClasses; + int *SuperClassIndex; /* for internal use only */ + ValueInfo *Typedef; /* for typedefs */ + int IsEnum; /* this entry is for an enum type */ + int IsTypedef; /* this entry is for a typedef */ +} HierarchyEntry; + +/** + * All the entries from a hierarchy file. + */ +typedef struct _HierarchyInfo +{ + int NumberOfEntries; + HierarchyEntry *Entries; + StringCache *Strings; +} HierarchyInfo; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Read a hierarchy file into a HeirarchyInfo struct, or return NULL + */ +HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename); + +/** + * Free a HierarchyInfo struct + */ +void vtkParseHierarchy_Free(HierarchyInfo *info); + +/** + * Return the entry for a class or type, or null if not found + */ +HierarchyEntry *vtkParseHierarchy_FindEntry( + const HierarchyInfo *info, const char *classname); + +/** + * Get properties for the class. Returns NULL if the property + * is not set, and returns either an empty string or a value string + * if the property is set. The properties supported are as follows: + * "WRAP_EXCLUDE", "WRAP_SPECIAL", and "ABSTRACT" + */ +const char *vtkParseHierarchy_GetProperty( + const HierarchyEntry *entry, const char *property); + +/** + * Check whether class is derived from baseclass. + */ +int vtkParseHierarchy_IsTypeOf(const HierarchyInfo *info, + const HierarchyEntry *entry, const char *baseclass); + +/** + * Check whether class is derived from baseclass. You must supply + * the entry for the class (returned by FindEntry) as well as the + * classname. The classname can include template args in angle brackets. + * The baseclass_with_args parameter, if not set to NULL, will be used + * to return the name of base class with the template args in angle + * brackets that classname was derived from. If not set to NULL, + * this should be freed with free() to avoid a memory leak. + */ +int vtkParseHierarchy_IsTypeOfTemplated(const HierarchyInfo *info, + const HierarchyEntry *entry, const char *classname, + const char *baseclass, const char **baseclass_with_args); + +/** + * Free the template args returned by IsTypeOfTemplated + */ +void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]); + +/** + * Given a classname with template parameters, get the superclass name + * with corresponding template parameters. Returns null if 'i' is out + * of range, i.e. greater than or equal to the number of superclasses. + * The returned classname must be freed with "free()". + */ +const char *vtkParseHierarchy_TemplatedSuperClass( + const HierarchyEntry *entry, const char *classname, int i); + +/** + * Expand all unrecognized types in a ValueInfo struct by + * using the typedefs in the HierarchyInfo struct. + */ +int vtkParseHierarchy_ExpandTypedefsInValue( + const HierarchyInfo *info, ValueInfo *data, StringCache *cache, + const char *scope); + +/** + * Expand typedefs found in a name stored as a string. The value + * of "text" will be returned if no expansion occurred, else a new + * string is returned that must be freed with "free()". + */ +const char *vtkParseHierarchy_ExpandTypedefsInName( + const HierarchyInfo *info, const char *text, const char *scope); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkParseInternal.h b/src/VTKWrapping/ParaView/vtkParseInternal.h new file mode 100644 index 00000000..8d3c9c64 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseInternal.h @@ -0,0 +1,137 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseInternal.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +/* + This is an internal header for vtkParse.y, it contains methods for + manipulating the data structures that are not meant for general + use by the wrappers, and that are likely to change over time. +*/ + +#ifndef VTK_PARSE_PRIVATE_H +#define VTK_PARSE_PRIVATE_H + +#include "vtkParse.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Initializer methods + */ +/*@{*/ +void vtkParse_InitFile(FileInfo *file_info); +void vtkParse_InitNamespace(NamespaceInfo *namespace_info); +void vtkParse_InitClass(ClassInfo *cls); +void vtkParse_InitFunction(FunctionInfo *func); +void vtkParse_InitValue(ValueInfo *val); +void vtkParse_InitEnum(EnumInfo *item); +void vtkParse_InitUsing(UsingInfo *item); +void vtkParse_InitTemplateArgs(TemplateArgs *arg); +void vtkParse_InitTemplateArg(TemplateArg *arg); +/*@}*/ + +/** + * Copy methods + */ +/*@{*/ +void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); +void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); +void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); +void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); +void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); +void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); +void vtkParse_CopyTemplateArgs(TemplateArgs *data, const TemplateArgs *orig); +void vtkParse_CopyTemplateArg(TemplateArg *data, const TemplateArg *orig); +/*@}*/ + +/** + * Free methods + */ +/*@{*/ +void vtkParse_FreeFile(FileInfo *file_info); +void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); +void vtkParse_FreeClass(ClassInfo *cls); +void vtkParse_FreeFunction(FunctionInfo *func); +void vtkParse_FreeValue(ValueInfo *val); +void vtkParse_FreeEnum(EnumInfo *item); +void vtkParse_FreeUsing(UsingInfo *item); +void vtkParse_FreeTemplateArgs(TemplateArgs *arg); +void vtkParse_FreeTemplateArg(TemplateArg *arg); +/*@}*/ + +/** + * Make a persistent copy of a string for use with AddStringToArray: + * At most 'n' chars will be copied, and the string will be terminated. + * If a null pointer is provided, then a null pointer will be returned. + */ +const char *vtkParse_DuplicateString(const char *cp, size_t n); + +/** + * Add a string to an array of strings, grow array as necessary. + */ +void vtkParse_AddStringToArray( + const char ***valueArray, int *count, const char *value); + +/** + * Expand the Item array for classes and namespaces. + */ +void vtkParse_AddItemToArray( + ItemInfo **valueArray, int *count, parse_item_t type, int idx); + + +/** + * Add various items to the structs. + */ +/*@{*/ +void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); +void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); +void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); +void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); +void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); +void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); +void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); +void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); +void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); +void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); +void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); +void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); +void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); +void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); +void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); +void vtkParse_AddArgumentToFunction(FunctionInfo *info, ValueInfo *item); +void vtkParse_AddArgumentToTemplate(TemplateArgs *info, TemplateArg *item); +/*@}*/ + +/** + * Add default constructors if they do not already exist + */ +void vtkParse_AddDefaultConstructors(ClassInfo *data); + +/** + * Simple utility for mapping VTK types to VTK_PARSE types. + */ +unsigned int vtkParse_MapType(int vtktype); + +/** + * Ignore BTX/ETX markers + */ +void vtkParse_SetIgnoreBTX(int option); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkParseMain.c b/src/VTKWrapping/ParaView/vtkParseMain.c new file mode 100644 index 00000000..a9e4f7a8 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseMain.c @@ -0,0 +1,508 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseMain.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +/* + +This file provides a unified front-end for the wrapper generators. + +*/ + +#include "vtkParse.h" +#include "vtkParseData.h" +#include "vtkParseMain.h" +#include +#include +#include +#include + +/* This is the struct that contains the options */ +OptionInfo options; + +/* Get the base filename */ +static const char *parse_exename(const char *cmd) +{ + const char *exename; + + /* remove directory part of exe name */ + for (exename = cmd + strlen(cmd); exename > cmd; --exename) + { + char pc = exename[-1]; + if (pc == ':' || pc == '/' || pc == '\\') + { + break; + } + } + + return exename; +} + +/* Print the help */ +static void parse_print_help(FILE *fp, const char *cmd, int multi) +{ + fprintf(fp, + "Usage: %s [options] infile... \n" + " --help print this help message\n" + " --version print the VTK version\n" + " -o the output file\n" + " -I

add an include directory\n" + " -D define a preprocessor macro\n" + " -U undefine a preprocessor macro\n" + " @ read arguments from a file\n", + parse_exename(cmd)); + + /* args for describing a singe header file input */ + if (!multi) + { + fprintf(fp, + " --hints the hints file to use\n" + " --types the type hierarchy file to use\n" + " --concrete force concrete class (ignored, deprecated)\n" + " --abstract force abstract class (ignored, deprecated)\n" + " --vtkobject vtkObjectBase-derived class (ignored, deprecated)\n" + " --special non-vtkObjectBase class (ignored, deprecated)\n"); + } +} + +/* append an arg to the arglist */ +static void parse_append_arg(int *argn, char ***args, char *arg) +{ + /* if argn is a power of two, allocate more space */ + if (*argn > 0 && (*argn & (*argn - 1)) == 0) + { + *args = (char **)realloc(*args, 2*(*argn)*sizeof(char *)); + } + /* append argument to list */ + (*args)[*argn] = arg; + (*argn)++; +} + +/* read options from a file, return zero on error */ +static int read_option_file( + StringCache *strings, const char *filename, int *argn, char ***args) +{ + static int option_file_stack_max = 10; + static int option_file_stack_size = 0; + static const char *option_file_stack[10]; + FILE *fp; + char *line; + const char *ccp; + char *argstring; + char *arg; + size_t maxlen = 15; + size_t i, n; + int j; + int in_string; + + line = (char *)malloc(maxlen); + + fp = fopen(filename, "r"); + + if (fp == NULL) + { + return 0; + } + + /* read the file line by line */ + while (fgets(line, (int)maxlen, fp)) + { + n = strlen(line); + + /* if buffer not long enough, increase it */ + while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) + { + maxlen *= 2; + line = (char *)realloc(line, maxlen); + if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } + n += strlen(&line[n]); + } + + /* allocate a string to hold the parsed arguments */ + argstring = vtkParse_NewString(strings, n); + arg = argstring; + i = 0; + + /* break the line into individual options */ + ccp = line; + in_string = 0; + while (*ccp != '\0') + { + for (;;) + { + if (*ccp == '\\') + { + ccp++; + } + else if (*ccp == '\"' || *ccp == '\'') + { + if (!in_string) + { + in_string = *ccp++; + continue; + } + else if (*ccp == in_string) + { + in_string = 0; + ccp++; + continue; + } + } + else if (!in_string && isspace(*ccp)) + { + do { ccp++; } while (isspace(*ccp)); + break; + } + if (*ccp == '\0') + { + break; + } + /* append character to argument */ + arg[i++] = *ccp++; + } + arg[i++] = '\0'; + + if (arg[0] == '@') + { + /* recursively expand '@file' option */ + if (option_file_stack_size == option_file_stack_max) + { + fprintf(stderr, "%s: @file recursion is too deep.\n", + (*args)[0]); + exit(1); + } + /* avoid reading the same file recursively */ + option_file_stack[option_file_stack_size++] = filename; + for (j = 0; j < option_file_stack_size; j++) + { + if (strcmp(&arg[1], option_file_stack[j]) == 0) + { + break; + } + } + if (j < option_file_stack_size) + { + parse_append_arg(argn, args, arg); + } + else if (read_option_file(strings, &arg[1], argn, args) == 0) + { + parse_append_arg(argn, args, arg); + } + option_file_stack_size--; + } + else if (arg[0] != '\0') + { + parse_append_arg(argn, args, arg); + } + /* prepare for next arg */ + arg += i; + i = 0; + } + } + + return 1; +} + +/* expand any "@file" args that occur in the command-line args */ +static void parse_expand_args( + StringCache *strings, int argc, char *argv[], int *argn, char ***args) +{ + int i; + + *argn = 0; + *args = (char **)malloc(sizeof(char *)); + + for (i = 0; i < argc; i++) + { + /* check for "@file" unless this is the command name */ + if (i > 0 || argv[i][0] == '@') + { + /* if read_option_file returns null, add "@file" to the args */ + /* (this mimics the way that gcc expands @file arguments) */ + if (read_option_file(strings, &argv[i][1], argn, args) == 0) + { + parse_append_arg(argn, args, argv[i]); + } + } + else + { + /* append any other arg */ + parse_append_arg(argn, args, argv[i]); + } + } +} + +/* Check the options: "multi" should be zero for wrapper tools that + * only take one input file, or one for wrapper tools that take multiple + * input files. Returns zero for "--version" or "--help", or returns -1 + * if an error occurred. Otherwise, it returns the number of args + * that were successfully parsed. */ +static int parse_check_options(int argc, char *argv[], int multi) +{ + int i; + size_t j; + char *cp; + char c; + + options.NumberOfFiles = 0; + options.Files = NULL; + options.InputFileName = NULL; + options.OutputFileName = NULL; + options.HierarchyFileName = 0; + options.HintFileName = 0; + + for (i = 1; i < argc; i++) + { + if (strcmp(argv[i], "--help") == 0) + { + parse_print_help(stdout, argv[0], multi); + return 0; + } + else if (strcmp(argv[i], "--version") == 0) + { + const char *ver = VTK_PARSE_VERSION; + fprintf(stdout, "%s %s\n", parse_exename(argv[0]), ver); + return 0; + } + else if (argv[i][0] != '-') + { + if (options.NumberOfFiles == 0) + { + options.Files = (char **)malloc(sizeof(char *)); + } + else if ((options.NumberOfFiles & (options.NumberOfFiles - 1)) == 0) + { + options.Files = (char **)realloc( + options.Files, 2*options.NumberOfFiles*sizeof(char *)); + } + options.Files[options.NumberOfFiles++] = argv[i]; + } + else if (argv[i][0] == '-' && isalpha(argv[i][1])) + { + c = argv[i][1]; + cp = &argv[i][2]; + if (*cp == '\0') + { + i++; + if (i >= argc || argv[i][0] == '-') + { + return -1; + } + cp = argv[i]; + } + + if (c == 'o') + { + options.OutputFileName = cp; + } + else if (c == 'I') + { + vtkParse_IncludeDirectory(cp); + } + else if (c == 'D') + { + j = 0; + while (cp[j] != '\0' && cp[j] != '=') { j++; } + if (cp[j] == '=') { j++; } + vtkParse_DefineMacro(cp, &cp[j]); + } + else if (c == 'U') + { + vtkParse_UndefineMacro(cp); + } + } + else if (!multi && strcmp(argv[i], "--hints") == 0) + { + i++; + if (i >= argc || argv[i][0] == '-') + { + return -1; + } + options.HintFileName = argv[i]; + } + else if (!multi && strcmp(argv[i], "--types") == 0) + { + i++; + if (i >= argc || argv[i][0] == '-') + { + return -1; + } + options.HierarchyFileName = argv[i]; + } + else if (strcmp(argv[i], "--vtkobject") == 0 || + strcmp(argv[i], "--special") == 0 || + strcmp(argv[i], "--abstract") == 0 || + strcmp(argv[i], "--concrete") == 0) + { + fprintf(stderr, "Warning: the %s option is deprecated " + "and will be ignored.\n", argv[i]); + } + } + + return i; +} + +/* Return a pointer to the static OptionInfo struct */ +OptionInfo *vtkParse_GetCommandLineOptions() +{ + return &options; +} + +/* Command-line argument handler for wrapper tools */ +FileInfo *vtkParse_Main(int argc, char *argv[]) +{ + int argi; + int expected_files; + FILE *ifile; + FILE *hfile = 0; + FileInfo *data; + StringCache strings; + int argn; + char **args; + + /* expand any "@file" args */ + vtkParse_InitStringCache(&strings); + parse_expand_args(&strings, argc, argv, &argn, &args); + + /* read the args into the static OptionInfo struct */ + argi = parse_check_options(argn, args, 0); + + /* was output file already specified by the "-o" option? */ + expected_files = (options.OutputFileName == NULL ? 2 : 1); + + /* verify number of args, print usage if not valid */ + if (argi == 0) + { + free(args); + exit(0); + } + else if (argi < 0 || options.NumberOfFiles != expected_files) + { + parse_print_help(stderr, args[0], 0); + exit(1); + } + + /* open the input file */ + options.InputFileName = options.Files[0]; + + if (!(ifile = fopen(options.InputFileName, "r"))) + { + fprintf(stderr, "Error opening input file %s\n", options.InputFileName); + exit(1); + } + + if (options.OutputFileName == NULL && + options.NumberOfFiles > 1) + { + /* allow outfile to be given after infile, if "-o" option not used */ + options.OutputFileName = options.Files[1]; + fprintf(stderr, "Deprecated: specify output file with \"-o\".\n"); + } + + /* free the expanded args */ + free(args); + + /* open the hint file, if given on the command line */ + if (options.HintFileName && options.HintFileName[0] != '\0') + { + if (!(hfile = fopen(options.HintFileName, "r"))) + { + fprintf(stderr, "Error opening hint file %s\n", options.HintFileName); + fclose(ifile); + exit(1); + } + } + + /* make sure than an output file was given on the command line */ + if (options.OutputFileName == NULL) + { + fprintf(stderr, "No output file was specified\n"); + fclose(ifile); + if (hfile) + { + fclose(hfile); + } + exit(1); + } + + /* if a hierarchy is was given, then BTX/ETX can be ignored */ + vtkParse_SetIgnoreBTX(0); + if (options.HierarchyFileName) + { + vtkParse_SetIgnoreBTX(1); + } + + /* parse the input file */ + data = vtkParse_ParseFile(options.InputFileName, ifile, stderr); + + if (!data) + { + exit(1); + } + + /* fill in some blanks by using the hints file */ + if (hfile) + { + vtkParse_ReadHints(data, hfile, stderr); + } + + if (data->MainClass) + { + /* mark class as abstract unless it has New() method */ + int nfunc = data->MainClass->NumberOfFunctions; + int ifunc; + for (ifunc = 0; ifunc < nfunc; ifunc++) + { + FunctionInfo *func = data->MainClass->Functions[ifunc]; + if (func && func->Access == VTK_ACCESS_PUBLIC && + func->Name && strcmp(func->Name, "New") == 0 && + func->NumberOfParameters == 0) + { + break; + } + } + data->MainClass->IsAbstract = ((ifunc == nfunc) ? 1 : 0); + } + + return data; +} + +/* Command-line argument handler for wrapper tools */ +void vtkParse_MainMulti(int argc, char *argv[]) +{ + int argi; + int argn; + char **args; + StringCache strings; + + /* expand any "@file" args */ + vtkParse_InitStringCache(&strings); + parse_expand_args(&strings, argc, argv, &argn, &args); + + /* read the args into the static OptionInfo struct */ + argi = parse_check_options(argn, args, 1); + free(args); + + if (argi == 0) + { + exit(0); + } + else if (argi < 0 || options.NumberOfFiles == 0) + { + parse_print_help(stderr, argv[0], 1); + exit(1); + } + + /* the input file */ + options.InputFileName = options.Files[0]; +} diff --git a/src/VTKWrapping/ParaView/vtkParseMain.h b/src/VTKWrapping/ParaView/vtkParseMain.h new file mode 100644 index 00000000..6bf6f406 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseMain.h @@ -0,0 +1,86 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseMain.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +/** + vtkParseMain.h provides argument parsing for the wrapper executables. + + Usage: vtkWrap [options] infile ... + + -D add a macro definition + -U cancel a macro definition + -I add an include directory + -o specify the output file + @ read arguments from a file + --help print a help message and exit + --version print the VTK version number and exit + --hints hints file + --types type hierarchy file + + Notes: + + 1) The "-o" option is needed when there are multiple input files. + Otherwise, the output file can be given after the input file. + + 2) The "@file" option allows arguments to be stored in a file, + instead of given on the command line. The use of such a file + is sometimes necessary to avoid overflowing the 8191-character + command-line limit on Windows. If the file is not found, then + "@file" will be passed as as a command-line parameter. +*/ + +#ifndef VTK_PARSE_MAIN_H +#define VTK_PARSE_MAIN_H + +#include "vtkParseData.h" +#include + +/** + * Options for the wrappers + */ +typedef struct _OptionInfo +{ + int NumberOfFiles; /* the total number of file arguments */ + char **Files; /* all of the file arguments */ + char *InputFileName; /* the first file argument */ + char *OutputFileName; /* the second file, or the "-o" file */ + char *HintFileName; /* the file preceded by "--hints" */ + char *HierarchyFileName; /* the file preceded by "--types" */ +} OptionInfo; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Return the options provided on the command line + */ +OptionInfo *vtkParse_GetCommandLineOptions(); + +/** + * The main function, parses the file and returns the result. + */ +FileInfo *vtkParse_Main(int argc, char *argv[]); + +/** + * A main function that can take multiple input files. + * It does not parse the files. It will exit on error. + */ +void vtkParse_MainMulti(int argc, char *argv[]); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkParsePreprocess.c b/src/VTKWrapping/ParaView/vtkParsePreprocess.c new file mode 100644 index 00000000..8107e37a --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParsePreprocess.c @@ -0,0 +1,3360 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParsePreprocess.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in June 2010 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +#include "vtkParsePreprocess.h" +#include +#include +#include +#include +#include + +/** + This file handles preprocessor directives via a simple + recursive-descent parser that only evaluates integers. +*/ + +#define PREPROC_DEBUG 0 + +/** Block size for reading files */ +#define FILE_BUFFER_SIZE 8192 + +/** Size of hash table must be a power of two */ +#define PREPROC_HASH_TABLE_SIZE 1024u + +/** Hashes for preprocessor keywords */ +#define HASH_IFDEF 0x0fa4b283u +#define HASH_IFNDEF 0x04407ab1u +#define HASH_IF 0x00597834u +#define HASH_ELIF 0x7c964b25u +#define HASH_ELSE 0x7c964c6eu +#define HASH_ENDIF 0x0f60b40bu +#define HASH_DEFINED 0x088998d4u +#define HASH_DEFINE 0xf8804a70u +#define HASH_UNDEF 0x10823b97u +#define HASH_INCLUDE 0x9e36af89u +#define HASH_ERROR 0x0f6321efu +#define HASH_LINE 0x7c9a15adu +#define HASH_PRAGMA 0x1566a9fdu + +/** Various possible char types */ +#define CPRE_ID 0x01 /* A-Z a-z and _ */ +#define CPRE_DIGIT 0x02 /* 0-9 */ +#define CPRE_IDGIT 0x03 /* 0-9 A-Z a-z and _ */ +#define CPRE_HEX 0x04 /* 0-9A-Fa-f */ +#define CPRE_EXP 0x08 /* EPep (exponents for floats) */ +#define CPRE_SIGN 0x10 /* +- (sign for floats) */ +#define CPRE_QUOTE 0x20 /* " and ' */ +#define CPRE_HSPACE 0x40 /* space, tab, carriage return */ +#define CPRE_VSPACE 0x80 /* newline, vertical tab, form feed */ +#define CPRE_WHITE 0xC0 /* all whitespace characters */ + +/** Whitespace types. + * WS_NO_EOL treats newline as end-of-line, instead of whitespace. + * WS_ALL treats newlines as regular whitespace. + * WS_COMMENT does not treat comments as whitespace, allowing + * comments blocks to be returned as tokens. */ +typedef enum _preproc_space_t +{ + WS_NO_EOL = CPRE_HSPACE, /* skip horizontal whitespace only */ + WS_ALL = CPRE_WHITE, /* skip all whitespace */ + WS_COMMENT = (CPRE_WHITE | 0x100), /* comments as tokens */ +} preproc_space_t; + +/** Preprocessor tokens. */ +typedef enum _preproc_token_t +{ + TOK_OTHER = 257, + TOK_ID, /* any id */ + TOK_CHAR, /* char literal */ + TOK_STRING, /* string literal */ + TOK_NUMBER, /* any numeric literal */ + TOK_COMMENT, /* C or C++ comment */ + TOK_DBLHASH, /* ## */ + TOK_SCOPE, /* :: */ + TOK_INCR, /* ++ */ + TOK_DECR, /* -- */ + TOK_RSHIFT, /* >> */ + TOK_LSHIFT, /* << */ + TOK_AND, /* && */ + TOK_OR, /* || */ + TOK_EQ, /* == */ + TOK_NE, /* != */ + TOK_GE, /* >= */ + TOK_LE, /* <= */ + TOK_ADD_EQ, /* += */ + TOK_SUB_EQ, /* -= */ + TOK_MUL_EQ, /* *= */ + TOK_DIV_EQ, /* /= */ + TOK_MOD_EQ, /* %= */ + TOK_AND_EQ, /* &= */ + TOK_OR_EQ, /* |= */ + TOK_XOR_EQ, /* ^= */ + TOK_ARROW, /* -> */ + TOK_DOT_STAR, /* .* */ + TOK_ARROW_STAR,/* ->* */ + TOK_RSHIFT_EQ, /* >>= */ + TOK_LSHIFT_EQ, /* <<= */ + TOK_ELLIPSIS, /* ... */ +} preproc_token_t; + +/** A struct for going through the input one token at a time. */ +typedef struct _preproc_tokenizer +{ + int tok; + unsigned int hash; + const char *text; + size_t len; +} preproc_tokenizer; + +/** Extend dynamic arrays in a progression of powers of two. + * Whenever "n" reaches a power of two, then the array size is + * doubled so that "n" can be safely incremented. */ +static void *preproc_array_check( + void *arraymem, size_t size, int n) +{ + /* if empty, alloc for the first time */ + if (n == 0) + { + return malloc(size); + } + /* if count is power of two, reallocate with double size */ + else if ((n & (n-1)) == 0) + { + return realloc(arraymem, (n << 1)*size); + } + + /* no reallocation, just return the original array */ + return arraymem; +} + +/** Convert string to int. */ +static preproc_int_t string_to_preproc_int(const char *cp, int base) +{ +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) + return _strtoi64(cp, NULL, base); +#else + return strtoll(cp, NULL, base); +#endif +} + +/** Convert string to unsigned int. */ +static preproc_uint_t string_to_preproc_uint(const char *cp, int base) +{ +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) + return _strtoui64(cp, NULL, base); +#else + return strtoull(cp, NULL, base); +#endif +} + +/** Array for quick lookup of char types */ +static unsigned char preproc_charbits[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + CPRE_HSPACE, /* tab */ + CPRE_VSPACE, CPRE_VSPACE, CPRE_VSPACE, /* newline, vtab, form feed */ + CPRE_HSPACE, /* carriage return */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + CPRE_HSPACE, /* ' ' */ + 0, CPRE_QUOTE, 0, 0, 0, 0, CPRE_QUOTE, 0, 0, /* !"#$%&'() */ + 0, CPRE_SIGN, 0, CPRE_SIGN, 0, 0, /* *+,-./ */ + CPRE_DIGIT|CPRE_HEX, /* 0 */ + CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, + CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, + CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, + CPRE_DIGIT|CPRE_HEX, CPRE_DIGIT|CPRE_HEX, + CPRE_DIGIT|CPRE_HEX, /* 9 */ + 0, 0, 0, 0, 0, 0, 0, /* :;<=>?@ */ + CPRE_ID|CPRE_HEX, /* A */ + CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, /* BCD */ + CPRE_ID|CPRE_HEX|CPRE_EXP, /* E */ + CPRE_ID|CPRE_HEX, CPRE_ID, CPRE_ID, CPRE_ID, /* FGHI */ + CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* JKLM */ + CPRE_ID, CPRE_ID, CPRE_ID|CPRE_EXP, CPRE_ID, /* NOPQ */ + CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* RSTU */ + CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* VWXY */ + CPRE_ID, /* Z */ + 0, 0, 0, 0, /* [\\]^ */ + CPRE_ID, /* _ */ + 0, /* ` */ + CPRE_ID|CPRE_HEX, /* a */ + CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, CPRE_ID|CPRE_HEX, /* bcd */ + CPRE_ID|CPRE_HEX|CPRE_EXP, /* e */ + CPRE_ID|CPRE_HEX, CPRE_ID, CPRE_ID, CPRE_ID, /* fghi */ + CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* jklm */ + CPRE_ID, CPRE_ID, CPRE_ID|CPRE_EXP, CPRE_ID, /* nopq */ + CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* rstu */ + CPRE_ID, CPRE_ID, CPRE_ID, CPRE_ID, /* vwxy */ + CPRE_ID, /* z */ + 0, 0, 0, 0, /* {|}~ */ + 0, /* '\x7f' */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +/** Macro to get char type */ +#define preproc_chartype(c, bits) \ + ((preproc_charbits[(unsigned char)(c)] & bits) != 0) + +/** Skip over a comment. */ +static void preproc_skip_comment(const char **cpp) +{ + const char *cp = *cpp; + + if (cp[0] == '/') + { + if (cp[1] == '/') + { + cp += 2; + while (*cp != '\n' && *cp != '\0') + { + if (cp[0] == '\\') + { + if (cp[1] == '\n') { cp++; } + else if (cp[1] == '\r' && cp[2] == '\n') { cp += 2; } + } + cp++; + } + } + else if (cp[1] == '*') + { + cp += 2; + while (*cp != '\0') + { + if (cp[0] == '*' && cp[1] == '/') { cp += 2; break; } + cp++; + } + } + } + + *cpp = cp; +} + +/** Skip over whitespace, but not newlines unless preceded by backlash. */ +static void preproc_skip_whitespace( + const char **cpp, preproc_space_t spacetype) +{ + const char *cp = *cpp; + + for (;;) + { + if (preproc_chartype(*cp, spacetype)) + { + do + { + cp++; + } + while (preproc_chartype(*cp, spacetype)); + } + if (cp[0] == '\\') + { + if (cp[1] == '\n') + { + cp += 2; + } + else if (cp[1] == '\r' && cp[2] == '\n') + { + cp += 3; + } + else + { + break; + } + } + else if (cp[0] == '/' && (spacetype & WS_COMMENT) != WS_COMMENT) + { + if (cp[1] == '/' || cp[1] == '*') + { + preproc_skip_comment(&cp); + } + else + { + break; + } + } + else + { + break; + } + } + + *cpp = cp; +} + +/** Skip over string and char literals. */ +static void preproc_skip_quotes(const char **cpp) +{ + const char *cp = *cpp; + const char qc = *cp; + + if (preproc_chartype(*cp, CPRE_QUOTE)) + { + cp++; + while (*cp != qc && *cp != '\n' && *cp != '\0') + { + if (*cp++ == '\\') + { + if (cp[0] == '\r' && cp[1] == '\n') { cp += 2; } + else if (*cp != '\0') { cp++; } + } + } + } + if (*cp == qc) + { + cp++; + } + + *cpp = cp; +} + +/** Skip over a name. */ +static void preproc_skip_name(const char **cpp) +{ + const char *cp = *cpp; + + if (preproc_chartype(*cp, CPRE_ID)) + { + do + { + cp++; + } + while (preproc_chartype(*cp, CPRE_IDGIT)); + } + + *cpp = cp; +} + +/** A simple 32-bit hash function based on "djb2". */ +static unsigned int preproc_hash_name(const char **cpp) +{ + const char *cp = (*cpp); + int h = 5381; + + if (preproc_chartype(*cp, CPRE_ID)) + { + do { h = (h << 5) + h + (unsigned char)*cp++; } + while (preproc_chartype(*cp, CPRE_IDGIT)); + } + + *cpp = cp; + return h; +} + +/** Skip over a number. */ +static void preproc_skip_number(const char **cpp) +{ + const char *cp = *cpp; + + if (preproc_chartype(cp[0], CPRE_DIGIT) || + (cp[0] == '.' && preproc_chartype(cp[1], CPRE_DIGIT))) + { + do + { + char c = *cp++; + if (preproc_chartype(c, CPRE_EXP) && + preproc_chartype(*cp, CPRE_SIGN)) + { + cp++; + } + } + while (preproc_chartype(*cp, CPRE_IDGIT) || *cp == '.'); + } + + *cpp = cp; +} + +/** Return the next preprocessor token, or '0' if none left. */ +static int preproc_next(preproc_tokenizer *tokens) +{ + const char *cp = tokens->text + tokens->len; + preproc_skip_whitespace(&cp, WS_NO_EOL); + + if (preproc_chartype(*cp, CPRE_ID)) + { + const char *ep = cp; + unsigned int h = preproc_hash_name(&ep); + tokens->tok = TOK_ID; + tokens->hash = h; + tokens->text = cp; + tokens->len = ep - cp; + } + else if (preproc_chartype(*cp, CPRE_QUOTE)) + { + const char *ep = cp; + preproc_skip_quotes(&ep); + tokens->tok = (*cp == '\"' ? TOK_STRING : TOK_CHAR); + tokens->hash = 0; + tokens->text = cp; + tokens->len = ep - cp; + } + else if (preproc_chartype(*cp, CPRE_DIGIT) || + (cp[0] == '.' && preproc_chartype(cp[1], CPRE_DIGIT))) + { + const char *ep = cp; + preproc_skip_number(&ep); + tokens->tok = TOK_NUMBER; + tokens->hash = 0; + tokens->text = cp; + tokens->len = ep - cp; + } + else if (cp[0] == '/' && (cp[1] == '/' || cp[1] == '*')) + { + const char *ep = cp; + preproc_skip_comment(&ep); + tokens->tok = TOK_COMMENT; + tokens->hash = 0; + tokens->text = cp; + tokens->len = ep - cp; + } + else + { + int t = cp[0]; + size_t l = 1; + + switch (cp[0]) + { + case ':': + if (cp[1] == ':') { l = 2; t = TOK_SCOPE; } + break; + case '.': + if (cp[1] == '.' && cp[2] == '.') { l = 3; t = TOK_ELLIPSIS; } + else if (cp[1] == '*') { l = 2; t = TOK_DOT_STAR; } + break; + case '=': + if (cp[1] == '=') { l = 2; t = TOK_EQ; } + break; + case '!': + if (cp[1] == '=') { l = 2; t = TOK_NE; } + break; + case '<': + if (cp[1] == '<' && cp[2] == '=') { l = 3; t = TOK_LSHIFT_EQ; } + else if (cp[1] == '<') { l = 2; t = TOK_LSHIFT; } + else if (cp[1] == '=') { l = 2; t = TOK_LE; } + break; + case '>': + if (cp[1] == '>' && cp[2] == '=') { l = 3; t = TOK_RSHIFT_EQ; } + else if (cp[1] == '>') { l = 2; t = TOK_RSHIFT; } + else if (cp[1] == '=') { l = 2; t = TOK_GE; } + break; + case '&': + if (cp[1] == '=') { l = 2; t = TOK_AND_EQ; } + else if (cp[1] == '&') { l = 2; t = TOK_AND; } + break; + case '|': + if (cp[1] == '=') { l = 2; t = TOK_OR_EQ; } + else if (cp[1] == '|') { l = 2; t = TOK_OR; } + break; + case '^': + if (cp[1] == '=') { l = 2; t = TOK_XOR_EQ; } + break; + case '*': + if (cp[1] == '=') { l = 2; t = TOK_MUL_EQ; } + break; + case '/': + if (cp[1] == '=') { l = 2; t = TOK_DIV_EQ; } + break; + case '%': + if (cp[1] == '=') { l = 2; t = TOK_MOD_EQ; } + break; + case '+': + if (cp[1] == '+') { l = 2; t = TOK_INCR; } + else if (cp[1] == '=') { l = 2; t = TOK_ADD_EQ; } + break; + case '-': + if (cp[1] == '>' && cp[2] == '*') { l = 3; t = TOK_ARROW_STAR; } + else if (cp[1] == '>') { l = 2; t = TOK_ARROW; } + else if (cp[1] == '-') { l = 2; t = TOK_DECR; } + else if (cp[1] == '=') { l = 2; t = TOK_SUB_EQ; } + break; + case '#': + if (cp[1] == '#') { l = 2; t = TOK_DBLHASH; } + break; + case '\n': + case '\0': + { l = 0; t = 0; } + break; + } + + tokens->tok = t; + tokens->hash = 0; + tokens->text = cp; + tokens->len = l; + } + + return tokens->tok; +} + +/** Initialize the tokenizer. */ +static void preproc_init(preproc_tokenizer *tokens, const char *text) +{ + tokens->tok = 0; + tokens->hash = 0; + tokens->text = text; + tokens->len = 0; + preproc_next(tokens); +} + +/** Tokenize and compare two strings */ +static int preproc_identical(const char *text1, const char *text2) +{ + int result = 1; + + if (text1 != text2) + { + result = 0; + + if (text1 && text2) + { + preproc_tokenizer t1; + preproc_tokenizer t2; + + preproc_init(&t1, text1); + preproc_init(&t2, text2); + + do + { + if (t1.tok != t2.tok || + t1.hash != t2.hash || + t1.len != t2.len || + strncmp(t1.text, t2.text, t1.len) != 0) + { + break; + } + preproc_next(&t1); + preproc_next(&t2); + } + while (t1.tok && t2.tok); + + result = (t1.tok == 0 && t2.tok == 0); + } + } + + return result; +} + +/** Duplicate the first n bytes of a string. */ +static const char *preproc_strndup(const char *in, size_t n) +{ + char *res = NULL; + + res = (char *)malloc(n+1); + strncpy(res, in, n); + res[n] = '\0'; + + return res; +} + +/** Create a new preprocessor macro. */ +static MacroInfo *preproc_new_macro( + PreprocessInfo *info, const char *name, const char *definition) +{ + MacroInfo *macro = (MacroInfo *)malloc(sizeof(MacroInfo)); + vtkParsePreprocess_InitMacro(macro); + + if (name) + { + size_t n; + const char *cp = name; + preproc_skip_name(&cp); + n = cp - name; + macro->Name = preproc_strndup(name, n); + } + + if (definition) + { + size_t n; + const char *cp = definition; + preproc_tokenizer tokens; + preproc_init(&tokens, cp); + + do + { + cp = tokens.text + tokens.len; + } + while (preproc_next(&tokens)); + + n = cp - definition; + macro->Definition = preproc_strndup(definition, n); + } + + macro->IsExternal = info->IsExternal; + + return macro; +} + +/** Free a preprocessor macro struct. */ +static void preproc_free_macro(MacroInfo *info) +{ + free(info); +} + +/** Find a preprocessor macro, return 0 if not found. */ +static MacroInfo *preproc_find_macro( + PreprocessInfo *info, preproc_tokenizer *token) +{ + unsigned int m = PREPROC_HASH_TABLE_SIZE - 1; + unsigned int i = (token->hash & m); + const char *name = token->text; + size_t l = token->len; + MacroInfo ***htable = info->MacroHashTable; + MacroInfo **hptr; + const char *mname; + + if (htable && ((hptr = htable[i]) != NULL) && *hptr) + { + do + { + mname = (*hptr)->Name; + if (mname[0] == name[0] && + strncmp(mname, name, l) == 0 && + mname[l] == '\0') + { + return *hptr; + } + hptr++; + } + while (*hptr); + } + + return NULL; +} + +/** Return the address of the macro within the hash table. + * If "insert" is nonzero, add a new location if macro not found. */ +static MacroInfo **preproc_macro_location( + PreprocessInfo *info, preproc_tokenizer *token, int insert) +{ + MacroInfo ***htable = info->MacroHashTable; + unsigned int m = PREPROC_HASH_TABLE_SIZE - 1; + unsigned int i = (token->hash & m); + const char *name = token->text; + size_t l = token->len; + size_t n; + MacroInfo **hptr; + const char *mname; + + if (htable == NULL) + { + if (!insert) + { + return NULL; + } + + m = PREPROC_HASH_TABLE_SIZE; + htable = (MacroInfo ***)malloc(m*sizeof(MacroInfo **)); + info->MacroHashTable = htable; + do { *htable++ = NULL; } while (--m); + htable = info->MacroHashTable; + } + + hptr = htable[i]; + + if (hptr == NULL) + { + if (!insert) + { + return NULL; + } + + hptr = (MacroInfo **)malloc(2*sizeof(MacroInfo *)); + hptr[0] = NULL; + hptr[1] = NULL; + htable[i] = hptr; + } + else if (*hptr) + { + /* see if macro is already there */ + n = 0; + do + { + mname = (*hptr)->Name; + if (mname[0] == name[0] && + strncmp(mname, name, l) == 0 && + mname[l] == '\0') + { + break; + } + n++; + hptr++; + } + while (*hptr); + + if (*hptr == NULL) + { + if (!insert) + { + return NULL; + } + + /* if n+1 is a power of two, double allocated space */ + if (n > 0 && (n & (n+1)) == 0) + { + hptr = htable[i]; + hptr = (MacroInfo **)realloc(hptr, (2*(n+1))*sizeof(MacroInfo *)); + htable[i] = hptr; + hptr += n; + } + + /* add a terminating null */ + hptr[1] = NULL; + } + } + + return hptr; +} + +/** Remove a preprocessor macro. Returns 0 if macro not found. */ +static int preproc_remove_macro( + PreprocessInfo *info, preproc_tokenizer *token) +{ + MacroInfo **hptr; + + hptr = preproc_macro_location(info, token, 0); + + if (hptr && *hptr) + { + preproc_free_macro(*hptr); + + do + { + hptr[0] = hptr[1]; + hptr++; + } + while (*hptr); + + return 1; + } + + return 0; +} + +/** A simple way to add a preprocessor macro definition. */ +static MacroInfo *preproc_add_macro_definition( + PreprocessInfo *info, const char *name, const char *definition) +{ + preproc_tokenizer token; + MacroInfo *macro; + MacroInfo **macro_p; + + preproc_init(&token, name); + + macro = preproc_new_macro(info, name, definition); + macro_p = preproc_macro_location(info, &token, 1); +#if PREPROC_DEBUG + if (*macro_p) + { + fprintf(stderr, "duplicate macro definition %s\n", name); + } +#endif + *macro_p = macro; + + return macro; +} + +/** Skip over parentheses, return nonzero if not closed. */ +static int preproc_skip_parentheses(preproc_tokenizer *tokens) +{ + int depth = 0; + + if (tokens->tok == '(') + { + depth = 1; + + while (depth > 0 && preproc_next(tokens)) + { + if (tokens->tok == '(') + { + depth++; + } + else if (tokens->tok == ')') + { + depth--; + } + } + } + + if (tokens->tok == ')') + { + preproc_next(tokens); + return VTK_PARSE_OK; + } + +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; +} + + +/** Evaluate a char literal to an integer value. */ +static int preproc_evaluate_char( + const char *cp, preproc_int_t *val, int *is_unsigned) +{ + if (cp[0] == '\'') + { + cp++; + if (*cp != '\\') + { + *val = *cp; + } + else if (*cp != '\'' && *cp != '\n' && *cp != '\0') + { + cp++; + if (*cp == 'a') { *val = '\a'; } + else if (*cp == 'b') { *val = '\b'; } + else if (*cp == 'f') { *val = '\f'; } + else if (*cp == 'n') { *val = '\n'; } + else if (*cp == 'r') { *val = '\r'; } + else if (*cp == 'b') { *val = '\b'; } + else if (*cp == 't') { *val = '\t'; } + else if (*cp == 'v') { *val = '\v'; } + else if (*cp == '\'') { *val = '\''; } + else if (*cp == '\"') { *val = '\"'; } + else if (*cp == '\\') { *val = '\\'; } + else if (*cp == '\?') { *val = '\?'; } + else if (*cp == '0') + { + *val = string_to_preproc_int(cp, 8); + do { cp++; } while (*cp >= '0' && *cp <= '7'); + } + else if (*cp == 'x') + { + *val = string_to_preproc_int(cp+1, 16); + do { cp++; } while (preproc_chartype(*cp, CPRE_HEX)); + } + } + if (*cp != '\'') + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + cp++; + *is_unsigned = 0; + return VTK_PARSE_OK; + } + +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; +} + +/* Evaluate an integer, ignoring any suffixes except 'u'. */ +static int preproc_evaluate_integer( + const char *cp, preproc_int_t *val, int *is_unsigned) +{ + const char *ep; + int base = 0; + ep = cp; + + if (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) + { + cp += 2; + base = 16; + *is_unsigned = 1; + ep = cp; + while (preproc_chartype(*ep, CPRE_HEX)) + { + ep++; + } + } + else if (cp[0] == '0' && preproc_chartype(cp[1], CPRE_DIGIT)) + { + cp += 1; + base = 8; + *is_unsigned = 1; + ep = cp; + while (*ep >= '0' && *ep <= '7') + { + ep++; + } + } + else + { + base = 10; + *is_unsigned = 0; + while (preproc_chartype(*ep, CPRE_DIGIT)) + { + ep++; + } + } + + for (;;) + { + if (ep[0] == 'i' && ep[1] == '6' && ep[2] == '4') { ep += 3; } + else if (*ep == 'u') { *is_unsigned = 1; ep++; } + else if (*ep == 'l' || *ep == 'L') { ep++; } + else { break; } + } + + if (*is_unsigned) + { + *val = (preproc_int_t)string_to_preproc_uint(cp, base); + } + else + { + *val = string_to_preproc_int(cp, base); + } + + if (*ep == '.' || *ep == 'e' || *ep == 'E') + { + return VTK_PARSE_PREPROC_DOUBLE; + } + + return VTK_PARSE_OK; +} + +/* forward declaration */ +static int preproc_evaluate_expression( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned); + +/** Evaluate a single item in an expression. */ +static int preproc_evaluate_single( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int result = VTK_PARSE_OK; + + while (tokens->tok == TOK_ID) + { + /* handle the "defined" keyword */ + if (tokens->hash == HASH_DEFINED && tokens->len == 7 && + strncmp("defined", tokens->text, tokens->len) == 0) + { + int paren = 0; + preproc_next(tokens); + + if (tokens->tok == '(') + { + paren = 1; + preproc_next(tokens); + } + if (tokens->tok != TOK_ID) + { + *val = 0; + *is_unsigned = 0; +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + + /* do the name lookup */ + *is_unsigned = 0; + *val = (preproc_find_macro(info, tokens) != 0); + + preproc_next(tokens); + if (paren) + { + if (tokens->tok != ')') + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + preproc_next(tokens); + } + + return result; + } + else + { + /* look up and evaluate the macro */ + MacroInfo *macro = preproc_find_macro(info, tokens); + const char *args = NULL; + const char *expansion = NULL; + const char *cp; + preproc_next(tokens); + *val = 0; + *is_unsigned = 0; + + if (macro == NULL || macro->IsExcluded) + { + return VTK_PARSE_MACRO_UNDEFINED; + } + else if (macro->IsFunction) + { + /* expand function macros using the arguments */ + args = tokens->text; + if (tokens->tok != '(' || + preproc_skip_parentheses(tokens) != VTK_PARSE_OK) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + } + expansion = vtkParsePreprocess_ExpandMacro(info, macro, args); + if (expansion == NULL) + { + free((char *)args); +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return (args ? VTK_PARSE_MACRO_NUMARGS : VTK_PARSE_SYNTAX_ERROR); + } + cp = expansion; + preproc_skip_whitespace(&cp, WS_NO_EOL); + if (*cp != '\0') + { + macro->IsExcluded = 1; + result = vtkParsePreprocess_EvaluateExpression( + info, expansion, val, is_unsigned); + macro->IsExcluded = 0; + vtkParsePreprocess_FreeMacroExpansion( + info, macro, expansion); + return result; + } + vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); + } + /* if macro expansion was empty, continue */ + } + + if (tokens->tok == '(') + { + preproc_next(tokens); + result = preproc_evaluate_expression(info, tokens, val, is_unsigned); + if ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok == ')') + { + preproc_next(tokens); + return result; + } +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + return result; + } + else if (tokens->tok == TOK_NUMBER) + { + result = preproc_evaluate_integer(tokens->text, val, is_unsigned); + if (tokens->text[tokens->len-1] == 'f' || + tokens->text[tokens->len-1] == 'F') + { + result = VTK_PARSE_PREPROC_FLOAT; + } + preproc_next(tokens); + return result; + } + else if (tokens->tok == TOK_CHAR) + { + result = preproc_evaluate_char(tokens->text, val, is_unsigned); + preproc_next(tokens); + return result; + } + else if (tokens->tok == TOK_STRING) + { + *val = 0; + *is_unsigned = 0; + preproc_next(tokens); + while (tokens->tok == TOK_STRING) + { + preproc_next(tokens); + } + return VTK_PARSE_PREPROC_STRING; + } + + *val = 0; + *is_unsigned = 0; +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d \"%*.*s\"\n", __LINE__, + (int)tokens->len, (int)tokens->len, tokens->text); +#endif + return VTK_PARSE_SYNTAX_ERROR; +} + +static int preproc_evaluate_unary( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int op = tokens->tok; + int result = VTK_PARSE_OK; + + if (op != '+' && op != '-' && op != '~' && op != '!') + { + return preproc_evaluate_single(info, tokens, val, is_unsigned); + } + + preproc_next(tokens); + + result = preproc_evaluate_unary(info, tokens, val, is_unsigned); + if ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (op == '~') { *val = ~(*val); } + else if (op == '!') { *val = !(*val); *is_unsigned = 0; } + else if (op == '-') { *val = -(*val); } + return result; + } + + return result; +} + +static int preproc_evaluate_multiply( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int op; + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_unary(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + op = tokens->tok; + if (op != '*' && op != '/' && op != '%') + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_unary(info, tokens, &rval, &rtype); + + *is_unsigned = (*is_unsigned || rtype); + + if (*is_unsigned) + { + if (op == '*') + { + *val = (preproc_int_t)((preproc_uint_t)*val * + (preproc_uint_t)rval); + } + else if (op == '/') + { + if (rval != 0) + { + *val = (preproc_int_t)((preproc_uint_t)*val / + (preproc_uint_t)rval); + } + else + { + *val = 2147483647; + } + } + else if (op == '%') + { + if (rval != 0) + { + *val = (preproc_int_t)((preproc_uint_t)*val % + (preproc_uint_t)rval); + } + else + { + *val = 2147483647; + } + } + } + else + { + if (op == '*') + { + *val = *val * rval; + } + else if (op == '/') + { + if (rval != 0) + { + *val = *val / rval; + } + else if (*val < 0) + { + *val = -2147483647; + } + else + { + *val = 2147483647; + } + } + else if (op == '%') + { + if (rval != 0) + { + *val = *val % rval; + } + else if (*val < 0) + { + *val = -2147483647; + } + else + { + *val = 2147483647; + } + } + } + } + + return result; +} + +static int preproc_evaluate_add( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int op; + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_multiply(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + op = tokens->tok; + if (op != '+' && op != '-') + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_multiply(info, tokens, &rval, &rtype); + + *is_unsigned = (*is_unsigned || rtype); + + if (op == '+') + { + *val = *val + rval; + } + else if (op == '-') + { + *val = *val - rval; + } + } + + return result; +} + +static int preproc_evaluate_bitshift( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int op; + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_add(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + op = tokens->tok; + + if (op != TOK_LSHIFT && op != TOK_RSHIFT) + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_add(info, tokens, &rval, &rtype); + + if (*is_unsigned) + { + if (op == TOK_LSHIFT) + { + *val = (preproc_int_t)((preproc_uint_t)*val << rval); + } + else if (op == TOK_RSHIFT) + { + *val = (preproc_int_t)((preproc_uint_t)*val >> rval); + } + } + else + { + if (op == TOK_LSHIFT) + { + *val = *val << rval; + } + else if (op == TOK_RSHIFT) + { + *val = *val >> rval; + } + } + } + + return result; +} + +static int preproc_evaluate_compare( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int op; + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_bitshift(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + op = tokens->tok; + if (op != '<' && op != '>' && op != TOK_LE && op != TOK_GE) + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_bitshift(info, tokens, &rval, &rtype); + + *is_unsigned = (*is_unsigned || rtype); + + if (*is_unsigned) + { + if (op == TOK_LE) + { + *val = ((preproc_uint_t)*val <= (preproc_uint_t)rval); + } + else if (op == '<') + { + *val = ((preproc_uint_t)*val < (preproc_uint_t)rval); + } + else if (op == TOK_GE) + { + *val = ((preproc_uint_t)*val >= (preproc_uint_t)rval); + } + else if (op == '>') + { + *val = ((preproc_uint_t)*val > (preproc_uint_t)rval); + } + } + else + { + if (op == TOK_LE) + { + *val = (*val <= rval); + } + else if (op == '<') + { + *val = (*val < rval); + } + else if (op == TOK_GE) + { + *val = (*val >= rval); + } + else if (op == '>') + { + *val = (*val > rval); + } + } + *is_unsigned = 0; + } + + return result; +} + +static int preproc_evaluate_equal( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + int op; + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_compare(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + op = tokens->tok; + if (op != TOK_EQ && op != TOK_NE) + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_compare(info, tokens, &rval, &rtype); + + if (op == TOK_EQ) + { + *val = (*val == rval); + } + else if (op == TOK_NE) + { + *val = (*val != rval); + } + *is_unsigned = 0; + } + + return result; +} + +static int preproc_evaluate_and( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_equal(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != '&') + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_equal(info, tokens, &rval, &rtype); + + *is_unsigned = (*is_unsigned || rtype); + *val = (*val & rval); + } + + return result; +} + +static int preproc_evaluate_xor( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_and(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != '^') + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_and(info, tokens, &rval, &rtype); + + *is_unsigned = (*is_unsigned || rtype); + *val = (*val ^ rval); + } + + return result; +} + +static int preproc_evaluate_or( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_xor(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != '|') + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_xor(info, tokens, &rval, &rtype); + + *is_unsigned = (*is_unsigned || rtype); + *val = (*val | rval); + } + + return result; +} + +static int preproc_evaluate_logic_and( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_or(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != TOK_AND) + { + return result; + } + + preproc_next(tokens); + + if (*val == 0) + { + /* short circuit */ + while (tokens->tok != 0 && tokens->tok != ')' && + tokens->tok != ':' && tokens->tok != '?' && + tokens->tok != ',' && tokens->tok != TOK_OR) + { + if (tokens->tok == '(') + { + if (preproc_skip_parentheses(tokens) != VTK_PARSE_OK) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + result = VTK_PARSE_SYNTAX_ERROR; + } + } + else + { + preproc_next(tokens); + } + } + + *is_unsigned = 0; + + return result; + } + + result = preproc_evaluate_or(info, tokens, &rval, &rtype); + + *is_unsigned = 0; + *val = (rval != 0); + } + + return result; +} + +static int preproc_evaluate_logic_or( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_logic_and(info, tokens, val, is_unsigned); + while ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != TOK_OR) + { + return result; + } + + preproc_next(tokens); + + if (*val != 0) + { + /* short circuit */ + while (tokens->tok != 0 && tokens->tok != ')' && + tokens->tok != ':' && tokens->tok != '?' && + tokens->tok != ',') + { + if (tokens->tok == '(') + { + if (preproc_skip_parentheses(tokens) != VTK_PARSE_OK) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + result = VTK_PARSE_SYNTAX_ERROR; + } + } + else + { + preproc_next(tokens); + } + } + + *is_unsigned = 0; + + return result; + } + + result = preproc_evaluate_logic_and(info, tokens, &rval, &rtype); + + *is_unsigned = 0; + *val = (rval != 0); + } + + return result; +} + +/** Evaluate an arimetic *expression. */ +int preproc_evaluate_expression( + PreprocessInfo *info, preproc_tokenizer *tokens, + preproc_int_t *val, int *is_unsigned) +{ + preproc_int_t rval, sval; + int rtype, stype; + int result; + + result = preproc_evaluate_logic_or(info, tokens, val, is_unsigned); + if ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != '?') + { + return result; + } + + preproc_next(tokens); + + result = preproc_evaluate_expression(info, tokens, &rval, &rtype); + if ((result & VTK_PARSE_FATAL_ERROR) != 0) + { + return result; + } + + if (tokens->tok != ':') + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + + preproc_next(tokens); + + result = preproc_evaluate_expression(info, tokens, &sval, &stype); + if ((result & VTK_PARSE_FATAL_ERROR) != 0) + { + return result; + } + + if (*val != 0) + { + *val = rval; + *is_unsigned = rtype; + } + else + { + *val = sval; + *is_unsigned = stype; + } + } + + return result; +} + +/** Evaluate a conditional *expression. + * Returns VTK_PARSE_OK if the expression is true, + * or VTK_PARSE_SKIP of the expression is false. */ +int preproc_evaluate_conditional( + PreprocessInfo *info, preproc_tokenizer *tokens) +{ + preproc_int_t rval; + int rtype; + int result; + + result = preproc_evaluate_expression(info, tokens, &rval, &rtype); + if ((result & VTK_PARSE_FATAL_ERROR) == 0) + { + if (tokens->tok != 0) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + return (rval == 0 ? VTK_PARSE_SKIP : VTK_PARSE_OK); + } + + return result; +} + +/** + * Handle any of the following directives: + * #if, #ifdef, #ifndef, #elif, #else, #endif + * A return value of VTK_PARSE_SKIP means that + * the following code block should be skipped. + */ +static int preproc_evaluate_if( + PreprocessInfo *info, preproc_tokenizer *tokens) +{ + MacroInfo *macro; + int v1, v2; + int result = VTK_PARSE_OK; + + if (tokens->hash == HASH_IF || + tokens->hash == HASH_IFDEF || + tokens->hash == HASH_IFNDEF) + { + if (info->ConditionalDepth == 0) + { + if (tokens->hash == HASH_IF) + { + preproc_next(tokens); + result = preproc_evaluate_conditional(info, tokens); + } + else + { + v1 = (tokens->hash != HASH_IFNDEF); + preproc_next(tokens); + if (tokens->tok != TOK_ID) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + macro = preproc_find_macro(info, tokens); + v2 = (macro && !macro->IsExcluded); + preproc_next(tokens); + result = ( (v1 ^ v2) ? VTK_PARSE_SKIP : VTK_PARSE_OK); + } + + if (result != VTK_PARSE_SKIP) + { + /* mark as done, so that the "else" clause is skipped */ + info->ConditionalDone = 1; + } + else + { + /* mark as not done, so that "else" clause is not skipped */ + info->ConditionalDone = 0; + /* skip the "if" clause */ + info->ConditionalDepth = 1; + } + } + else + { + /* increase the skip depth */ + info->ConditionalDepth++; + } + } + else if (tokens->hash == HASH_ELIF || + tokens->hash == HASH_ELSE) + { + if (info->ConditionalDepth == 0) + { + /* preceding clause was not skipped, so must skip this one */ + info->ConditionalDepth = 1; + } + else if (info->ConditionalDepth == 1 && + info->ConditionalDone == 0) + { + if (tokens->hash == HASH_ELIF) + { + preproc_next(tokens); + result = preproc_evaluate_conditional(info, tokens); + } + else + { + preproc_next(tokens); + } + if (result != VTK_PARSE_SKIP) + { + /* do not skip this clause */ + info->ConditionalDepth = 0; + /* make sure remaining else/elif clauses are skipped */ + info->ConditionalDone = 1; + } + } + } + else if (tokens->hash == HASH_ENDIF) + { + preproc_next(tokens); + if (info->ConditionalDepth > 0) + { + /* decrease the skip depth */ + info->ConditionalDepth--; + } + if (info->ConditionalDepth == 0) + { + /* set "done" flag for the context that is being returned to */ + info->ConditionalDone = 1; + } + } + + return result; +} + +/** + * Handle the #define and #undef directives. + */ +static int preproc_evaluate_define( + PreprocessInfo *info, preproc_tokenizer *tokens) +{ + MacroInfo **macro_p; + MacroInfo *macro; + int is_function; + const char *name; + size_t namelen; + const char *definition = 0; + int n = 0; + const char **params = NULL; + + if (tokens->hash == HASH_DEFINE) + { + preproc_next(tokens); + if (tokens->tok != TOK_ID) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + + macro_p = preproc_macro_location(info, tokens, 1); + name = tokens->text; + namelen = tokens->len; + preproc_next(tokens); + + is_function = 0; + if (name[namelen] == '(') + { + is_function = 1; + preproc_next(tokens); + while (tokens->tok != 0 && tokens->tok != ')') + { + if (tokens->tok != TOK_ID && tokens->tok != TOK_ELLIPSIS) + { + if (params) { free((char **)params); } +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + + /* add to the arg list */ + params = (const char **)preproc_array_check( + (char **)params, sizeof(char *), n); + params[n++] = preproc_strndup(tokens->text, tokens->len); + + preproc_next(tokens); + if (tokens->tok == ',') + { + preproc_next(tokens); + } + else if (tokens->tok != ')') + { + if (params) { free((char **)params); } +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + } + preproc_next(tokens); + } + + if (tokens->tok) + { + definition = tokens->text; + } + + macro = *macro_p; + if (macro) + { + if (preproc_identical(macro->Definition, definition)) + { + return VTK_PARSE_OK; + } + if (params) { free((char **)params); } +#if PREPROC_DEBUG + fprintf(stderr, "macro redefined %d\n", __LINE__); +#endif + return VTK_PARSE_MACRO_REDEFINED; + } + + macro = preproc_new_macro(info, name, definition); + macro->IsFunction = is_function; + macro->NumberOfParameters = n; + macro->Parameters = params; + *macro_p = macro; + + return VTK_PARSE_OK; + } + else if (tokens->hash == HASH_UNDEF) + { + preproc_next(tokens); + if (tokens->tok != TOK_ID) + { +#if PREPROC_DEBUG + fprintf(stderr, "syntax error %d\n", __LINE__); +#endif + return VTK_PARSE_SYNTAX_ERROR; + } + preproc_remove_macro(info, tokens); + return VTK_PARSE_OK; + } + + return VTK_PARSE_OK; +} + +/** + * Add an include file to the list. Return 0 if it is already there. + */ +static int preproc_add_include_file(PreprocessInfo *info, const char *name) +{ + int i, n; + char *dp; + + n = info->NumberOfIncludeFiles; + for (i = 0; i < n; i++) + { + if (strcmp(info->IncludeFiles[i], name) == 0) + { + return 0; + } + } + + dp = (char *)malloc(strlen(name)+1); + strcpy(dp, name); + + info->IncludeFiles = (const char **)preproc_array_check( + (char **)info->IncludeFiles, sizeof(char *), info->NumberOfIncludeFiles); + info->IncludeFiles[info->NumberOfIncludeFiles++] = dp; + + return 1; +} + +/** + * Find an include file. If "cache_only" is set, then do a check to + * see if the file was previously found without going to the filesystem. + */ +const char *preproc_find_include_file( + PreprocessInfo *info, const char *filename, int system_first, + int cache_only) +{ + int i, n, ii, nn; + size_t j, m; + struct stat fs; + const char *directory; + char *output; + size_t outputsize = 16; + int count; + + /* allow filename to be terminated by quote or bracket */ + m = 0; + while (filename[m] != '\"' && filename[m] != '>' && + filename[m] != '\n' && filename[m] != '\0') { m++; } + + /* search file system for the file */ + output = (char *)malloc(outputsize); + + if (system_first != 0) + { + system_first = 1; + } + + if (cache_only != 0) + { + cache_only = 1; + } + + /* check for absolute path of form DRIVE: or /path/to/file */ + j = 0; + while (preproc_chartype(filename[j], CPRE_IDGIT)) { j++; } + + if (filename[j] == ':' || filename[0] == '/' || filename[0] == '\\') + { + if (m+1 > outputsize) + { + outputsize += m+1; + output = (char *)realloc(output, outputsize); + } + strncpy(output, filename, m); + output[m] = '\0'; + + nn = info->NumberOfIncludeFiles; + for (ii = 0; ii < nn; ii++) + { + if (strcmp(output, info->IncludeFiles[ii]) == 0) + { + free(output); + return info->IncludeFiles[ii]; + } + } + + if (cache_only) + { + free(output); + return NULL; + } + + info->IncludeFiles = (const char **)preproc_array_check( + (char **)info->IncludeFiles, sizeof(char *), + info->NumberOfIncludeFiles); + info->IncludeFiles[info->NumberOfIncludeFiles++] = output; + + return output; + } + + /* Make sure the current filename is already added */ + if (info->FileName) + { + preproc_add_include_file(info, info->FileName); + } + + /* Check twice. First check the cache, then stat the files. */ + for (count = 0; count < (2-cache_only); count++) + { + n = info->NumberOfIncludeDirectories; + for (i = 0; i < (n+1-system_first); i++) + { + /* search the directory of the file being processed */ + if (i == 0 && system_first == 0) + { + if (info->FileName) + { + j = strlen(info->FileName); + while (j > 0) + { + if (info->FileName[j-1] == '/') { break; } + j--; + } + if (m+j+1 > outputsize) + { + outputsize += m+j+1; + output = (char *)realloc(output, outputsize); + } + if (j > 0) + { + strncpy(output, info->FileName, j); + } + strncpy(&output[j], filename, m); + output[j+m] = '\0'; + } + else + { + if (m+1 > outputsize) + { + outputsize += m+1; + output = (char *)realloc(output, outputsize); + } + strncpy(output, filename, m); + output[m] = '\0'; + } + } + /* check all the search paths */ + else + { + directory = info->IncludeDirectories[i-1+system_first]; + j = strlen(directory); + if (j + m + 2 > outputsize) + { + outputsize += j+m+2; + output = (char *)realloc(output, outputsize); + } + + strncpy(output, directory, j); + if (directory[j-1] != '/') { output[j++] = '/'; } + strncpy(&output[j], filename, m); + output[j+m] = '\0'; + } + + if (count == 0) + { + nn = info->NumberOfIncludeFiles; + for (ii = 0; ii < nn; ii++) + { + if (strcmp(output, info->IncludeFiles[ii]) == 0) + { + free(output); + return info->IncludeFiles[ii]; + } + } + } + else if (stat(output, &fs) == 0) + { + info->IncludeFiles = (const char **)preproc_array_check( + (char **)info->IncludeFiles, sizeof(char *), + info->NumberOfIncludeFiles); + info->IncludeFiles[info->NumberOfIncludeFiles++] = output; + + return output; + } + } + } + + free(output); + return NULL; +} + +/** + * Include a file. All macros defined in the included file + * will have their IsExternal flag set. + */ +static int preproc_include_file( + PreprocessInfo *info, const char *filename, int system_first) +{ + char *tbuf; + size_t tbuflen = FILE_BUFFER_SIZE; + char *line; + size_t linelen = 80; + size_t i, j, n, r; + int in_comment = 0; + int in_quote = 0; + int result = VTK_PARSE_OK; + FILE *fp = NULL; + const char *path = NULL; + const char *save_filename; + int save_external; + + /* check to see if the file has aleady been included */ + path = preproc_find_include_file(info, filename, system_first, 1); + if (path != 0) + { +#if PREPROC_DEBUG + int k = 0; + while (filename[k] != '>' && filename[k] != '\"' && + filename[k] != '\n' && filename[k] != '\0') { k++; } + if (filename[k] == '>') + fprintf(stderr, "already loaded file <%*.*s>\n", k, k, filename); + else + fprintf(stderr, "already loaded file \"%*.*s\"\n", k, k, filename); +#endif + + return VTK_PARSE_OK; + } + /* go to the filesystem */ + path = preproc_find_include_file(info, filename, system_first, 0); + if (path == NULL) + { +#if PREPROC_DEBUG + int k = 0; + while (filename[k] != '>' && filename[k] != '\"' && + filename[k] != '\n' && filename[k] != '\0') { k++; } + if (filename[k] == '>') + fprintf(stderr, "couldn't find file <%*.*s>\n", k, k, filename); + else + fprintf(stderr, "couldn't find file \"%*.*s\"\n", k, k, filename); +#endif + return VTK_PARSE_FILE_NOT_FOUND; + } + +#if PREPROC_DEBUG + fprintf(stderr, "including file %s\n", path); +#endif + fp = fopen(path, "r"); + + if (fp == NULL) + { +#if PREPROC_DEBUG + fprintf(stderr, "couldn't open file %s\n", path); +#endif + return VTK_PARSE_FILE_OPEN_ERROR; + } + + save_external = info->IsExternal; + save_filename = info->FileName; + info->IsExternal = 1; + info->FileName = path; + + tbuf = (char *)malloc(tbuflen+4); + line = (char *)malloc(linelen); + + /* the buffer must hold a whole line for it to be processed */ + j = 0; + i = 0; + n = 0; + r = 0; + + do + { + if (i >= n) + { + /* recycle unused lookahead chars */ + if (r) + { + r = n + 2 - i; + if (r == 2) + { + tbuf[0] = tbuf[tbuflen-2]; + tbuf[1] = tbuf[tbuflen-1]; + } + else if (r == 1) + { + tbuf[0] = tbuf[tbuflen-1]; + } + } + + /* read the next chunk of the file */ + i = 0; + if (feof(fp)) + { + /* still have the lookahead chars left */ + n = r; + r = 0; + } + else + { + /* fill the remainder of the buffer */ + errno = 0; + tbuflen = r + FILE_BUFFER_SIZE; + while ((n = fread(&tbuf[r], 1, tbuflen-r, fp)) == 0 && ferror(fp)) + { + if (errno != EINTR) + { + fclose(fp); + free(tbuf); + free(line); + info->IsExternal = save_external; + return VTK_PARSE_FILE_READ_ERROR; + } + errno = 0; + clearerr(fp); + } + + if (n + r < tbuflen) + { + /* this only occurs if the final fread does not fill the buffer */ + n += r; + r = 0; + } + else + { + /* set a lookahead reserve of two chars */ + n -= (2 - r); + r = 2; + } + + /* guard against lookahead past last char in file */ + tbuf[n + r] = '\0'; + } + } + + /* copy the characters until end of line is found */ + while (i < n) + { + /* expand line buffer as necessary */ + while (j+4 > linelen) + { + linelen *= 2; + line = (char *)realloc(line, linelen); + } + + if (in_comment) + { + if (tbuf[i] == '*' && tbuf[i+1] == '/') + { + line[j++] = tbuf[i++]; + line[j++] = tbuf[i++]; + in_comment = 0; + } + else + { + line[j++] = tbuf[i++]; + } + } + else if (in_quote) + { + if (tbuf[i] == '\"') + { + line[j++] = tbuf[i++]; + in_quote = 0; + } + else if (tbuf[i] == '\\' && tbuf[i+1] != '\0') + { + line[j++] = tbuf[i++]; + line[j++] = tbuf[i++]; + } + else + { + line[j++] = tbuf[i++]; + } + } + else if (tbuf[i] == '/' && tbuf[i+1] == '*') + { + line[j++] = tbuf[i++]; + line[j++] = tbuf[i++]; + in_comment = 1; + } + else if (tbuf[i] == '\"') + { + line[j++] = tbuf[i++]; + in_quote = 1; + } + else if (tbuf[i] == '\\' && tbuf[i+1] == '\n') + { + line[j++] = tbuf[i++]; + line[j++] = tbuf[i++]; + } + else if (tbuf[i] == '\\' && tbuf[i+1] == '\r' && tbuf[i+2] == '\n') + { + line[j++] = tbuf[i++]; + line[j++] = tbuf[i++]; + line[j++] = tbuf[i++]; + } + else if (tbuf[i] != '\n' && tbuf[i] != '\0') + { + line[j++] = tbuf[i++]; + } + else + { + line[j++] = tbuf[i++]; + break; + } + } + + if (i < n || n == 0) + { + const char *cp = line; + line[j] = '\0'; + j = 0; + preproc_skip_whitespace(&cp, WS_NO_EOL); + if (*cp == '#') + { + vtkParsePreprocess_HandleDirective(info, line); + } + } + } + while (n > 0); + + free(tbuf); + free(line); + fclose(fp); + + info->IsExternal = save_external; + info->FileName = save_filename; + + return result; +} + +/** + * Handle the #include directive. The header file will + * only go through the preprocessor. + */ +static int preproc_evaluate_include( + PreprocessInfo *info, preproc_tokenizer *tokens) +{ + const char *cp; + const char *filename; + + if (tokens->hash == HASH_INCLUDE) + { + preproc_next(tokens); + + cp = tokens->text; + + if (tokens->tok == TOK_ID) + { + MacroInfo *macro = preproc_find_macro(info, tokens); + if (macro && !macro->IsExcluded && macro->Definition) + { + cp = macro->Definition; + } + else + { +#if PREPROC_DEBUG + fprintf(stderr, "couldn't find macro %*.*s.\n", + (int)tokens->len, (int)tokens->len, tokens->text); +#endif + return VTK_PARSE_MACRO_UNDEFINED; + } + } + + if (*cp == '\"') + { + filename = cp + 1; + preproc_skip_quotes(&cp); + if (cp <= filename + 1 || *(cp-1) != '\"') + { + return VTK_PARSE_SYNTAX_ERROR; + } + + return preproc_include_file(info, filename, 0); + } + else if (*cp == '<') + { + cp++; + filename = cp; + while (*cp != '>' && *cp != '\n' && *cp != '\0') { cp++; } + if (*cp != '>') + { + return VTK_PARSE_SYNTAX_ERROR; + } + + return preproc_include_file(info, filename, 1); + } + } + + return VTK_PARSE_OK; +} + +/** + * Handle any recognized directive. + * Unrecognized directives are ignored. + */ +int vtkParsePreprocess_HandleDirective( + PreprocessInfo *info, const char *directive) +{ + int result = VTK_PARSE_OK; + preproc_tokenizer tokens; + + preproc_init(&tokens, directive); + + if (tokens.tok != '#') + { + return VTK_PARSE_SYNTAX_ERROR; + } + + preproc_next(&tokens); + + if (tokens.tok == TOK_ID) + { + if ((tokens.hash == HASH_IFDEF && tokens.len == 5 && + strncmp("ifdef", tokens.text, tokens.len) == 0) || + (tokens.hash == HASH_IFNDEF && tokens.len == 6 && + strncmp("ifndef", tokens.text, tokens.len) == 0) || + (tokens.hash == HASH_IF && tokens.len == 2 && + strncmp("if", tokens.text, tokens.len) == 0) || + (tokens.hash == HASH_ELIF && tokens.len == 4 && + strncmp("elif", tokens.text, tokens.len) == 0) || + (tokens.hash == HASH_ELSE && tokens.len == 4 && + strncmp("else", tokens.text, tokens.len) == 0) || + (tokens.hash == HASH_ENDIF && tokens.len == 5 && + strncmp("endif", tokens.text, tokens.len) == 0)) + { + result = preproc_evaluate_if(info, &tokens); + while (tokens.tok) { preproc_next(&tokens); } +#if PREPROC_DEBUG + { + size_t n = tokens.text - directive; + + if (result == VTK_PARSE_SKIP) + { + fprintf(stderr, "SKIP: "); + } + else if (result == VTK_PARSE_OK) + { + fprintf(stderr, "READ: "); + } + else + { + fprintf(stderr, "ERR%-2.2d ", result); + } + fprintf(stderr, "%*.*s\n", (int)n, (int)n, directive); + } +#endif + } + else if (info->ConditionalDepth == 0) + { + if ((tokens.hash == HASH_DEFINE && tokens.len == 6 && + strncmp("define", tokens.text, tokens.len) == 0) || + (tokens.hash == HASH_UNDEF && tokens.len == 5 && + strncmp("undef", tokens.text, tokens.len) == 0)) + { + result = preproc_evaluate_define(info, &tokens); + } + else if (tokens.hash == HASH_INCLUDE && tokens.len == 7 && + strncmp("include", tokens.text, tokens.len) == 0) + { + result = preproc_evaluate_include(info, &tokens); + } + } + } + + if (info->ConditionalDepth > 0) + { + return VTK_PARSE_SKIP; + } + + return result; +} + +/** + * Evaluate a preprocessor expression. + * If no errors occurred, the result will be VTK_PARSE_OK. + */ +int vtkParsePreprocess_EvaluateExpression( + PreprocessInfo *info, const char *text, + preproc_int_t *val, int *is_unsigned) +{ + preproc_tokenizer tokens; + preproc_init(&tokens, text); + + return preproc_evaluate_expression(info, &tokens, val, is_unsigned); +} + +/** Add a macro for defining a macro */ +#define PREPROC_MACRO_TO_STRING2(x) #x +#define PREPROC_MACRO_TO_STRING(x) PREPROC_MACRO_TO_STRING2(x) +#define PREPROC_ADD_MACRO(info, x) \ +preproc_add_macro_definition(info, #x, PREPROC_MACRO_TO_STRING2(x)) + +/** + * Add all standard preprocessory macros. Specify the platform. + */ +void vtkParsePreprocess_AddStandardMacros( + PreprocessInfo *info, int platform) +{ + int save_external = info->IsExternal; + info->IsExternal = 1; + + /* a special macro to indicate that this is the wrapper */ + preproc_add_macro_definition(info, "__WRAP__", "1"); + + /* language macros - assume that we are wrapping C++ code */ + preproc_add_macro_definition(info, "__cplusplus", "1"); + + /* stdc version macros */ +#ifdef __STDC__ + PREPROC_ADD_MACRO(info, __STDC__); +#endif +#ifdef __STDC_VERSION__ + PREPROC_ADD_MACRO(info, __STDC_VERSION__); +#endif +#ifdef __STDC_HOSTED__ + PREPROC_ADD_MACRO(info, __STDC_HOSTED__); +#endif + + if (platform == VTK_PARSE_NATIVE) + { +#ifdef WIN32 + PREPROC_ADD_MACRO(info, WIN32); +#endif +#ifdef _WIN32 + PREPROC_ADD_MACRO(info, _WIN32); +#endif +#ifdef _MSC_VER + PREPROC_ADD_MACRO(info, _MSC_VER); +#endif + +#ifdef __BORLAND__ + PREPROC_ADD_MACRO(info, __BORLAND__); +#endif + +#ifdef __CYGWIN__ + PREPROC_ADD_MACRO(info, __CYGWIN__); +#endif +#ifdef MINGW + PREPROC_ADD_MACRO(info, MINGW); +#endif +#ifdef __MINGW32__ + PREPROC_ADD_MACRO(info, __MINGW32__); +#endif + +#ifdef __linux__ + PREPROC_ADD_MACRO(info, __linux__); +#endif +#ifdef __LINUX__ + PREPROC_ADD_MACRO(info, __LINUX__); +#endif + +#ifdef __APPLE__ + PREPROC_ADD_MACRO(info, __APPLE__); +#endif +#ifdef __MACH__ + PREPROC_ADD_MACRO(info, __MACH__); +#endif +#ifdef __DARWIN__ + PREPROC_ADD_MACRO(info, __DARWIN__); +#endif + +#ifdef __GNUC__ + PREPROC_ADD_MACRO(info, __GNUC__); +#endif +#ifdef __LP64__ + PREPROC_ADD_MACRO(info, __LP64__); +#endif +#ifdef __BIG_ENDIAN__ + PREPROC_ADD_MACRO(info, __BIG_ENDIAN__); +#endif +#ifdef __LITTLE_ENDIAN__ + PREPROC_ADD_MACRO(info, __LITTLE_ENDIAN__); +#endif + } + + info->IsExternal = save_external; +} + +/** + * Add a preprocessor macro, including a definition. + */ +int vtkParsePreprocess_AddMacro( + PreprocessInfo *info, const char *name, const char *definition) +{ + preproc_tokenizer token; + MacroInfo **macro_p; + MacroInfo *macro; + + preproc_init(&token, name); + macro_p = preproc_macro_location(info, &token, 1); + if (*macro_p) + { + macro = *macro_p; + if (preproc_identical(macro->Definition, definition)) + { + return VTK_PARSE_OK; + } + else + { + return VTK_PARSE_MACRO_REDEFINED; + } + } + + macro = preproc_new_macro(info, name, definition); + macro->IsExternal = 1; + *macro_p = macro; + + return VTK_PARSE_OK; +} + +/** + * Return a preprocessor macro struct, or NULL if not found. + */ +MacroInfo *vtkParsePreprocess_GetMacro( + PreprocessInfo *info, const char *name) +{ + preproc_tokenizer token; + MacroInfo *macro; + + preproc_init(&token, name); + macro = preproc_find_macro(info, &token); + + if (macro && !macro->IsExcluded) + { + return macro; + } + + return NULL; +} + +/** + * Remove a preprocessor macro. + */ +int vtkParsePreprocess_RemoveMacro( + PreprocessInfo *info, const char *name) +{ + preproc_tokenizer token; + + preproc_init(&token, name); + + if (preproc_remove_macro(info, &token)) + { + return VTK_PARSE_OK; + } + + return VTK_PARSE_MACRO_UNDEFINED; +} + +/** + * Expand a macro, argstring is ignored if not a function macro + */ +const char *vtkParsePreprocess_ExpandMacro( + PreprocessInfo *info, MacroInfo *macro, const char *argstring) +{ + const char *cp = argstring; + int n = 0; + int j = 0; + const char *stack_values[8]; + const char **values = NULL; + const char *pp = NULL; + const char *dp = NULL; + const char *wp = NULL; + char stack_rp[128]; + char *rp = NULL; + size_t rs = 0; + size_t i = 0; + size_t l = 0; + size_t k = 0; + int stringify = 0; + int noexpand = 0; + int depth = 1; + int c; + + if (macro->IsFunction) + { + if (argstring == NULL || *cp != '(') + { + return NULL; + } + + /* break the string into individual argument values */ + values = stack_values; + + cp++; + values[n++] = cp; + while (depth > 0 && *cp != '\0') + { + while (*cp != '\0') + { + if (*cp == '\"' || *cp == '\'') + { + preproc_skip_quotes(&cp); + } + else if (cp[0] == '/' && (cp[1] == '*' || cp[1] == '/')) + { + preproc_skip_comment(&cp); + } + else if (*cp == '(') + { + cp++; + depth++; + } + else if (*cp == ')') + { + cp++; + if (--depth == 0) + { + break; + } + } + else if (*cp == ',') + { + cp++; + if (depth == 1) + { + break; + } + } + else if (*cp != '\0') + { + cp++; + } + } + if (n >= 8 && (n & (n-1)) == 0) + { + if (values != stack_values) + { + values = (const char **)realloc( + (char **)values, 2*n*sizeof(const char **)); + } + else + { + values = (const char **)malloc(2*n*sizeof(const char **)); + memcpy((char **)values, stack_values, 8*sizeof(const char **)); + } + } + + values[n++] = cp; + } + --n; + + /* diagnostic: print out the values */ +#if PREPROC_DEBUG + for (j = 0; j < n; j++) + { + size_t m = values[j+1] - values[j] - 1; + fprintf(stderr, "arg %i: %*.*s\n", + (int)j, (int)m, (int)m, values[j]); + } +#endif + + if (macro->NumberOfParameters == 0 && n == 1) + { + const char *tp = values[0]; + preproc_skip_whitespace(&tp, WS_NO_EOL); + if (tp + 1 >= values[1]) + { + n = 0; + } + } + + if (n != macro->NumberOfParameters) + { + if (values != stack_values) { free((char **)values); } +#if PREPROC_DEBUG + fprintf(stderr, "wrong number of macro args to %s, %lu != %lu\n", + macro->Name, n, macro->NumberOfParameters); +#endif + return NULL; + } + } + + cp = macro->Definition; + cp = (cp ? cp : ""); + dp = cp; + rp = stack_rp; + rp[0] = '\0'; + rs = 128; + + while (*cp != '\0') + { + pp = cp; + wp = cp; + stringify = 0; + noexpand = 0; + /* skip all chars that aren't part of a name */ + while (!preproc_chartype(*cp, CPRE_ID) && *cp != '\0') + { + dp = cp; + preproc_skip_whitespace(&cp, WS_NO_EOL); + if (cp > dp) + { + dp = cp; + } + else if (preproc_chartype(*cp, CPRE_QUOTE)) + { + preproc_skip_quotes(&cp); + dp = cp; + wp = cp; + noexpand = 0; + } + else if (preproc_chartype(*cp, CPRE_DIGIT)) + { + preproc_skip_number(&cp); + dp = cp; + wp = cp; + noexpand = 0; + } + else if (cp[0] == '#' && cp[1] == '#') + { + noexpand = 1; + dp = wp; + cp += 2; + wp = cp; + preproc_skip_whitespace(&cp, WS_NO_EOL); + break; + } + else if (*cp == '#') + { + stringify = 1; + dp = cp; + wp = cp; + cp++; + preproc_skip_whitespace(&cp, WS_NO_EOL); + break; + } + else + { + cp++; + dp = cp; + wp = cp; + } + } + l = dp - pp; + if (l > 0) + { + if (i + l + 1 >= rs) + { + rs += rs + i + l + 1; + if (rp != stack_rp) + { + rp = (char *)realloc(rp, rs); + } + else + { + rp = (char *)malloc(rs); + memcpy(rp, stack_rp, i); + } + } + strncpy(&rp[i], pp, l); + i += l; + rp[i] = '\0'; + } + + /* get the name */ + pp = cp; + preproc_skip_name(&cp); + l = cp - pp; + if (l > 0) + { + for (j = 0; j < n; j++) + { + /* check whether the name matches a parameter */ + if (strncmp(pp, macro->Parameters[j], l) == 0 && + macro->Parameters[j][l] == '\0') + { + /* substitute the argument value */ + l = values[j+1] - values[j] - 1; + pp = values[j]; + /* remove leading whitespace from argument */ + c = *pp; + while (preproc_chartype(c, CPRE_WHITE)) + { + c = *(++pp); + l--; + } + /* remove trailing whitespace from argument */ + if (l > 0) + { + c = pp[l - 1]; + while (preproc_chartype(c, CPRE_WHITE)) + { + if (--l == 0) + { + break; + } + c = pp[l-1]; + } + } + /* check if followed by "##" */ + wp = cp; + preproc_skip_whitespace(&wp, WS_NO_EOL); + if (wp[0] == '#' && wp[1] == '#') + { + noexpand = 1; + } + break; + } + } + if (stringify) + { + /* compute number of chars that will be added */ + stringify = 2; + for (k = 0; k < l; k++) + { + c = pp[k]; + if (c == '\\' || c == '\"') + { + stringify++; + } + } + } + if (i + l + stringify + 1 >= rs) + { + rs += rs + i + l + 1; + if (rp != stack_rp) + { + rp = (char *)realloc(rp, rs); + } + else + { + rp = (char *)malloc(rs); + memcpy(rp, stack_rp, i); + } + } + if (stringify) + { + rp[i++] = '\"'; + for (k = 0; k < l; k++) + { + c = pp[k]; + if (c == '\\' || c == '\"') + { + rp[i++] = '\\'; + } + rp[i++] = c; + } + rp[i++] = '\"'; + } + else if (noexpand) + { + strncpy(&rp[i], pp, l); + i += l; + } + else + { + /* process the arguments before substituting them */ + const char *text; + int is_excluded = macro->IsExcluded; + macro->IsExcluded = 1; + strncpy(&rp[i], pp, l); + rp[i + l] = '\0'; + text = vtkParsePreprocess_ProcessString(info, &rp[i]); + if (text) + { + l = strlen(text); + if (text != &rp[i]) + { + char *tp = NULL; + if (i + l + 1 >= rs) + { + rs += rs + i + l + 1; + tp = rp; + rp = (char *)malloc(rs); + memcpy(rp, tp, i); + } + strncpy(&rp[i], text, l); + vtkParsePreprocess_FreeProcessedString(info, text); + if (tp && tp != stack_rp) + { + free(tp); + } + } + } + macro->IsExcluded = is_excluded; + i += l; + } + rp[i] = '\0'; + } + } + + if (values != stack_values) { free((char **)values); } + + if (!macro->IsFunction && macro->Definition && + strcmp(rp, macro->Definition) == 0) + { + if (rp != stack_rp) { free(rp); } + return macro->Definition; + } + + if (rp == stack_rp) + { + rp = (char *)malloc(strlen(stack_rp) + 1); + strcpy(rp, stack_rp); + } + + return rp; +} + +/** + * Process a string + */ +const char *vtkParsePreprocess_ProcessString( + PreprocessInfo *info, const char *text) +{ + char stack_rp[128]; + char *rp; + char *ep; + size_t i = 0; + size_t rs = 128; + int last_tok = 0; + preproc_tokenizer tokens; + preproc_init(&tokens, text); + + rp = stack_rp; + rp[0] = '\0'; + + while (tokens.tok) + { + size_t l = tokens.len; + size_t j; + const char *cp = tokens.text; + const char *dp; + + if (tokens.tok == TOK_STRING && last_tok == TOK_STRING) + { + if (i > 0) + { + do { --i; } while (i > 0 && rp[i] != '\"'); + } + cp++; + } + + if (i + l + 2 >= rs) + { + rs += rs + i + l + 2; + if (rp == stack_rp) + { + rp = (char *)malloc(rs); + memcpy(rp, stack_rp, i); + } + else + { + rp = (char *)realloc(rp, rs); + } + } + + /* copy the token, removing backslash-newline */ + dp = cp; + ep = &rp[i]; + for (j = 0; j < l; j++) + { + if (*dp == '\\') + { + if (dp[1] == '\n') { dp += 2; } + else if (dp[1] == '\r' && dp[2] == '\n') { dp += 3; } + else { *ep++ = *dp++; } + } + else + { + *ep++ = *dp++; + } + } + l = ep - &rp[i]; + + if (tokens.tok == TOK_ID) + { + MacroInfo *macro = preproc_find_macro(info, &tokens); + if (macro && !macro->IsExcluded) + { + const char *args = NULL; + int expand = 1; + + if (macro->IsFunction) + { + /* expand function macros using the arguments */ + preproc_next(&tokens); + if (tokens.tok == '(') + { + int depth = 1; + args = tokens.text; + while (depth > 0 && preproc_next(&tokens)) + { + if (tokens.tok == '(') + { + depth++; + } + else if (tokens.tok == ')') + { + depth--; + } + } + if (tokens.tok != ')') + { + if (rp != stack_rp) { free(rp); } + return NULL; + } + } + else + { + /* unput the last token if it isn't "(" */ + tokens.len = l; + tokens.text = cp; + expand = 0; + } + } + if (expand) + { + const char *expansion; + const char *processed; + expansion = vtkParsePreprocess_ExpandMacro(info, macro, args); + if (expansion == NULL) + { + if (rp != stack_rp) { free(rp); } + return NULL; + } + macro->IsExcluded = 1; + processed = vtkParsePreprocess_ProcessString(info, expansion); + macro->IsExcluded = 0; + if (processed == NULL) + { + vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); + if (rp != stack_rp) { free(rp); } + return NULL; + } + l = strlen(processed); + if (l > 0) + { + if (i + l + 2 >= rs) + { + rs += rs + i + l + 2; + if (rp == stack_rp) + { + rp = (char *)malloc(rs); + memcpy(rp, stack_rp, i); + } + else + { + rp = (char *)realloc(rp, rs); + } + } + strncpy(&rp[i], processed, l); + } + if (processed != expansion) + { + vtkParsePreprocess_FreeProcessedString(info, processed); + } + vtkParsePreprocess_FreeMacroExpansion(info, macro, expansion); + } + } + } + + i += l; + + last_tok = tokens.tok; + l = tokens.len; + cp = tokens.text; + if (preproc_next(&tokens) && tokens.text > cp + l) + { + rp[i++] = ' '; + } + } + rp[i] = '\0'; + + if (strcmp(rp, text) == 0) + { + /* no change, return */ + if (rp != stack_rp) { free(rp); } + return text; + } + else + { + /* string changed, recursively reprocess */ + const char *tp = vtkParsePreprocess_ProcessString(info, rp); + if (rp != tp) + { + if (rp != stack_rp) { free(rp); } + return tp; + } + if (rp == stack_rp) + { + rp = (char *)malloc(strlen(stack_rp) + 1); + strcpy(rp, stack_rp); + } + } + + return rp; +} + +/** + * Free a string returned by ExpandMacro + */ +void vtkParsePreprocess_FreeMacroExpansion( + PreprocessInfo *info, MacroInfo *macro, const char *text) +{ + /* only free expansion if it is different from definition */ + if (info && text != macro->Definition) + { + free((char *)text); + } +} + +/** + * Free a string returned by ProcessString + */ +void vtkParsePreprocess_FreeProcessedString( + PreprocessInfo *info, const char *text) +{ + if (info) + { + free((char *)text); + } +} + +/** + * Add an include directory. + */ +void vtkParsePreprocess_IncludeDirectory( + PreprocessInfo *info, const char *name) +{ + int i, n; + + n = info->NumberOfIncludeDirectories; + for (i = 0; i < n; i++) + { + if (strcmp(name, info->IncludeDirectories[i]) == 0) + { + return; + } + } + + info->IncludeDirectories = (const char **)preproc_array_check( + (char **)info->IncludeDirectories, sizeof(char *), + info->NumberOfIncludeDirectories); + info->IncludeDirectories[info->NumberOfIncludeDirectories++] = + preproc_strndup(name, strlen(name)); +} + +/** + * Find an include file in the path. If system_first is set, + * then the current directory is not searched. + */ +const char *vtkParsePreprocess_FindIncludeFile( + PreprocessInfo *info, const char *filename, int system_first, + int *already_loaded) +{ + const char *cp; + cp = preproc_find_include_file(info, filename, system_first, 1); + if (cp) + { + *already_loaded = 1; + return cp; + } + + *already_loaded = 0; + return preproc_find_include_file(info, filename, system_first, 0); +} + +/** + * Initialize a preprocessor macro struct + */ +void vtkParsePreprocess_InitMacro(MacroInfo *macro) +{ + macro->Name = NULL; + macro->Definition = NULL; + macro->Comment = NULL; + macro->NumberOfParameters = 0; + macro->Parameters = NULL; + macro->IsFunction = 0; + macro->IsExternal = 0; + macro->IsExcluded = 0; +} + +/** + * Free a preprocessor macro struct + */ +void vtkParsePreprocess_FreeMacro(MacroInfo *macro) +{ + int i, n; + + free((char *)macro->Name); + free((char *)macro->Definition); + free((char *)macro->Comment); + + n = macro->NumberOfParameters; + for (i = 0; i < n; i++) + { + free((char *)macro->Parameters[i]); + } + free((char **)macro->Parameters); + + free(macro); +} + +/** + * Initialize a preprocessor struct + */ +void vtkParsePreprocess_Init( + PreprocessInfo *info, const char *filename) +{ + info->FileName = NULL; + info->MacroHashTable = NULL; + info->NumberOfIncludeDirectories = 0; + info->IncludeDirectories = NULL; + info->NumberOfIncludeFiles = 0; + info->IncludeFiles = NULL; + info->IsExternal = 0; + info->ConditionalDepth = 0; + info->ConditionalDone = 0; + + if (filename) + { + info->FileName = preproc_strndup(filename, strlen(filename)); + } +} + +/** + * Free a preprocessor struct and its contents + */ +void vtkParsePreprocess_Free(PreprocessInfo *info) +{ + int i, n; + MacroInfo **mptr; + + free((char *)info->FileName); + + if (info->MacroHashTable) + { + n = PREPROC_HASH_TABLE_SIZE; + for (i = 0; i < n; i++) + { + mptr = info->MacroHashTable[i]; + if (mptr) + { + while (*mptr) + { + vtkParsePreprocess_FreeMacro(*mptr++); + } + } + free(info->MacroHashTable[i]); + } + free(info->MacroHashTable); + } + + n = info->NumberOfIncludeDirectories; + for (i = 0; i < n; i++) + { + free((char *)info->IncludeDirectories[i]); + } + free((char **)info->IncludeDirectories); + + n = info->NumberOfIncludeFiles; + for (i = 0; i < n; i++) + { + free((char *)info->IncludeFiles[i]); + } + free((char **)info->IncludeFiles); + + free(info); +} diff --git a/src/VTKWrapping/ParaView/vtkParsePreprocess.h b/src/VTKWrapping/ParaView/vtkParsePreprocess.h new file mode 100644 index 00000000..9a4010b2 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParsePreprocess.h @@ -0,0 +1,250 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParsePreprocess.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in June 2010 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +/** + This file provides subroutines to assist in preprocessing + C/C++ header files. It evaluates preprocessor directives + and stores a list of all preprocessor macros. + + The preprocessing is done in-line while the file is being + parsed. Macros that are defined in the file are stored but + are not automatically expanded. The parser can query the + macro definitions, expand them into plain text, or ask the + preprocessor to evaluate them and return an integer result. + + The typical usage of this preprocessor is that the main + parser will pass any lines that begin with '#' to the + vtkParsePreprocess_HandleDirective() function, which will + evaluate the line and provide a return code. The return + code will tell the main parser if a syntax error or macro + lookup error occurred, and will also let the parser know + if an #if or #else directive requires that the next block + of code be skipped. +*/ + +#ifndef VTK_PARSE_PREPROCESS_H +#define VTK_PARSE_PREPROCESS_H + +/** + * The preprocessor int type. Use the compiler's longest int type. + */ +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) +typedef __int64 preproc_int_t; +typedef unsigned __int64 preproc_uint_t; +#else +typedef long long preproc_int_t; +typedef unsigned long long preproc_uint_t; +#endif + +/** + * Struct to describe a preprocessor symbol. + */ +typedef struct _MacroInfo +{ + const char *Name; + const char *Definition; + const char *Comment; /* unused */ + int NumberOfParameters; /* only if IsFunction == 1 */ + const char **Parameters; /* symbols for parameters */ + int IsFunction; /* this macro requires arguments */ + int IsExternal; /* this macro is from an included file */ + int IsExcluded; /* do not expand this macro */ +} MacroInfo; + +/** + * Contains all symbols defined thus far (including those defined + * in any included header files). + */ +typedef struct _PreprocessInfo +{ + const char *FileName; /* the file that is being parsed */ + MacroInfo ***MacroHashTable; /* hash table for macro lookup */ + int NumberOfIncludeDirectories; + const char **IncludeDirectories; + int NumberOfIncludeFiles; /* all included files */ + const char **IncludeFiles; + int IsExternal; /* label all macros as "external" */ + int ConditionalDepth; /* internal state variable */ + int ConditionalDone; /* internal state variable */ +} PreprocessInfo; + +/** + * Platforms. Always choose native unless crosscompiling. + */ +enum _preproc_platform_t { + VTK_PARSE_NATIVE = 0, +}; + +/** + * Directive return values. + */ +enum _preproc_return_t { + VTK_PARSE_OK = 0, + VTK_PARSE_SKIP = 1, /* skip next block */ + VTK_PARSE_PREPROC_DOUBLE = 2, /* encountered a double */ + VTK_PARSE_PREPROC_FLOAT = 3, /* encountered a float */ + VTK_PARSE_PREPROC_STRING = 4, /* encountered a string */ + VTK_PARSE_MACRO_UNDEFINED = 5, /* macro lookup failed */ + VTK_PARSE_MACRO_REDEFINED = 6, /* attempt to redefine a macro */ + VTK_PARSE_FILE_NOT_FOUND = 7, /* include file not found */ + VTK_PARSE_FILE_OPEN_ERROR = 8, /* include file not readable */ + VTK_PARSE_FILE_READ_ERROR = 9, /* error during read */ + VTK_PARSE_MACRO_NUMARGS = 10, /* wrong number of args to func macro */ + VTK_PARSE_SYNTAX_ERROR = 11 /* any and all syntax errors */ +}; + +/** + * Bitfield for fatal errors. + */ +#define VTK_PARSE_FATAL_ERROR 0xF8 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Handle a preprocessor directive. Return value VTK_PARSE_OK + * means that no errors occurred, while VTK_PARSE_SKIP means that + * a conditional directive was encountered and the next code + * block should be skipped. The preprocessor has an internal state + * machine that keeps track of conditional if/else/endif directives. + * All other return values indicate errors, and it is up to the + * parser to decide which errors are fatal. The preprocessor + * only considers syntax errors and I/O errors to be fatal. + */ +int vtkParsePreprocess_HandleDirective( + PreprocessInfo *info, const char *directive); + +/** + * Evaluate a preprocessor expression, providing an integer result + * in "val", and whether it is unsigned in "is_unsigned". A return + * value of VTK_PARSE_OK means that no errors occurred, while + * VTK_PREPROC_DOUBLE, VTK_PREPROC_FLOAT, and VTK_PREPROC_STRING + * indicate that the preprocessor encountered a non-integer value. + * Error return values are VTK_PARSE_MACRO_UNDEFINED and + * VTK_PARSE_SYNTAX_ERRORS. Undefined macros evaluate to zero. + */ +int vtkParsePreprocess_EvaluateExpression( + PreprocessInfo *info, const char *text, + preproc_int_t *val, int *is_unsigned); + +/** + * Add all standard preprocessor symbols. Use VTK_PARSE_NATIVE + * as the platform. In the future, other platform specifiers + * might be added to allow crosscompiling. + */ +void vtkParsePreprocess_AddStandardMacros( + PreprocessInfo *info, int platform); + +/** + * Add a preprocessor symbol, including a definition. Return + * values are VTK_PARSE_OK and VTK_PARSE_MACRO_REDEFINED. + */ +int vtkParsePreprocess_AddMacro( + PreprocessInfo *info, const char *name, const char *definition); + +/** + * Remove a preprocessor symbol. Return values are VTK_PARSE_OK + * and VTK_PARSE_MACRO_UNDEFINED. + */ +int vtkParsePreprocess_RemoveMacro( + PreprocessInfo *info, const char *name); + +/** + * Return a preprocessor symbol struct, or NULL if not found. + */ +MacroInfo *vtkParsePreprocess_GetMacro( + PreprocessInfo *info, const char *name); + +/** + * Expand a macro. A function macro must be given an argstring + * with args in parentheses, otherwise the argstring can be NULL. + * returns NULL if the wrong number of arguments were given. + */ +const char *vtkParsePreprocess_ExpandMacro( + PreprocessInfo *info, MacroInfo *macro, const char *argstring); + +/** + * Free an expanded macro + */ +void vtkParsePreprocess_FreeMacroExpansion( + PreprocessInfo *info, MacroInfo *macro, const char *text); + +/** + * Fully process a string with the preprocessor, and + * return a new string or NULL if a fatal error occurred. + */ +const char *vtkParsePreprocess_ProcessString( + PreprocessInfo *info, const char *text); + +/** + * Free a processed string. Only call this method if + * the string returned by ProcessString is different from + * the original string, because ProcessString will just + * return the original string if no processing was needed. + */ +void vtkParsePreprocess_FreeProcessedString( + PreprocessInfo *info, const char *text); + +/** + * Add an include directory. The directories that were added + * first will be searched first. + */ +void vtkParsePreprocess_IncludeDirectory( + PreprocessInfo *info, const char *name); + +/** + * Find an include file in the path. If system_first is set, then + * the current directory is ignored unless it is explicitly in the + * path. A null return value indicates that the file was not found. + * If already_loaded is set, then the file was already loaded. This + * preprocessor never loads the same file twice. + */ +const char *vtkParsePreprocess_FindIncludeFile( + PreprocessInfo *info, const char *filename, int system_first, + int *already_loaded); + +/** + * Initialize a preprocessor symbol struct. + */ +void vtkParsePreprocess_InitMacro(MacroInfo *symbol); + +/** + * Free a preprocessor macro struct + */ +void vtkParsePreprocess_FreeMacro(MacroInfo *macro); + +/** + * Initialize a preprocessor struct. + */ +void vtkParsePreprocess_Init( + PreprocessInfo *info, const char *filename); + +/** + * Free a preprocessor struct and its contents; + */ +void vtkParsePreprocess_Free(PreprocessInfo *info); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkParseString.c b/src/VTKWrapping/ParaView/vtkParseString.c new file mode 100644 index 00000000..f1863c02 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseString.c @@ -0,0 +1,119 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseString.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2012 David Gobbi. + + Contributed to the VisualizationToolkit by the author in April 2012 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +#include "vtkParseString.h" +#include +#include + +/*---------------------------------------------------------------- + * String utility methods + * + * Strings are centrally allocated and are const. They should not + * be freed until the parse is complete and all the data structures + * generated by the parse have been freed. + */ + +/* allocate a string of n+1 bytes */ +void vtkParse_InitStringCache(StringCache *cache) +{ + cache->NumberOfChunks = 0; + cache->Chunks = NULL; + cache->ChunkSize = 0; + cache->Position = 0; +} + +/* allocate a string of n+1 bytes */ +char *vtkParse_NewString(StringCache *cache, size_t n) +{ + size_t nextPosition; + char *cp; + + if (cache->ChunkSize == 0) + { + cache->ChunkSize = 8176; + } + + // align next start position on an 8-byte boundary + nextPosition = (((cache->Position + n + 8) | 7 ) - 7); + + if (cache->NumberOfChunks == 0 || nextPosition > cache->ChunkSize) + { + if (n + 1 > cache->ChunkSize) + { + cache->ChunkSize = n + 1; + } + cp = (char *)malloc(cache->ChunkSize); + + /* if empty, alloc for the first time */ + if (cache->NumberOfChunks == 0) + { + cache->Chunks = (char **)malloc(sizeof(char *)); + } + /* if count is power of two, reallocate with double size */ + else if ((cache->NumberOfChunks & (cache->NumberOfChunks-1)) == 0) + { + cache->Chunks = (char **)realloc( + cache->Chunks, (2*cache->NumberOfChunks)*sizeof(char *)); + } + + cache->Chunks[cache->NumberOfChunks++] = cp; + + cache->Position = 0; + nextPosition = (((n + 8) | 7) - 7); + } + + cp = &cache->Chunks[cache->NumberOfChunks-1][cache->Position]; + cp[0] = '\0'; + + cache->Position = nextPosition; + + return cp; +} + +/* free all allocated strings */ +void vtkParse_FreeStringCache(StringCache *cache) +{ + unsigned long i; + + for (i = 0; i < cache->NumberOfChunks; i++) + { + free(cache->Chunks[i]); + } + if (cache->Chunks) + { + free(cache->Chunks); + } + + cache->Chunks = NULL; + cache->NumberOfChunks = 0; +} + +/* duplicate the first n bytes of a string and terminate it */ +const char *vtkParse_CacheString(StringCache *cache, const char *in, size_t n) +{ + char *res = NULL; + + res = vtkParse_NewString(cache, n); + strncpy(res, in, n); + res[n] = '\0'; + + return res; +} diff --git a/src/VTKWrapping/ParaView/vtkParseString.h b/src/VTKWrapping/ParaView/vtkParseString.h new file mode 100644 index 00000000..11430827 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkParseString.h @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkParseString.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +/* + String allocation routines used by vtkParse. + + The parser uses "const char *" as its string object type, and expects + all string objects to persist and be constant for the entire lifetime + of the data generated by the parse (usually this means until the parser + executable has exited). All strings that are stored in the parser's + data objects should either be statically allocated, or allocated with + the vtkParse_NewString() or vtkParse_CacheString() methods declared here. +*/ + +#ifndef VTK_PARSE_STRING_H +#define VTK_PARSE_STRING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * StringCache provides a simple way of allocating strings centrally. + * It eliminates the need to allocate and free each individual strings, + * which makes the code simpler and more efficient. + */ +typedef struct _StringCache +{ + unsigned long NumberOfChunks; + char **Chunks; + size_t ChunkSize; + size_t Position; +} StringCache; + +/** + * Initialize the string cache. + */ +void vtkParse_InitStringCache(StringCache *cache); + +/** + * Alocate a new string from the cache. + * A total of n+1 bytes will be allocated, to leave room for null. + */ +char *vtkParse_NewString(StringCache *cache, size_t n); + +/** + * Cache a string so that it can then be used in the vtkParse data + * structures. The string will last until the application exits. + * At most 'n' chars will be copied, and the string will be terminated. + * If a null pointer is provided, then a null pointer will be returned. + */ +const char *vtkParse_CacheString(StringCache *cache, const char *cp, size_t n); + +/** + * Free all strings that were created with vtkParse_NewString() or + * with vtkParse_CacheString(). + */ +void vtkParse_FreeStringCache(StringCache *cache); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkWrap.c b/src/VTKWrapping/ParaView/vtkWrap.c new file mode 100644 index 00000000..25ede98b --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkWrap.c @@ -0,0 +1,1032 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkWrap.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#include "vtkWrap.h" +#include "vtkParseData.h" +#include "vtkParseExtras.h" +#include "vtkParseString.h" +#include +#include +#include + +/* -------------------------------------------------------------------- */ +/* Common types. */ + +int vtkWrap_IsVoid(ValueInfo *val) +{ + if (val == 0) + { + return 1; + } + + return ((val->Type & VTK_PARSE_UNQUALIFIED_TYPE) == VTK_PARSE_VOID); +} + +int vtkWrap_IsVoidFunction(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); + + if (t == VTK_PARSE_FUNCTION_PTR || t == VTK_PARSE_FUNCTION) + { + /* check for signature "void (*func)(void *)" */ + if (val->Function->NumberOfParameters == 1 && + val->Function->Parameters[0]->Type == VTK_PARSE_VOID_PTR && + val->Function->Parameters[0]->NumberOfDimensions == 0 && + val->Function->ReturnValue->Type == VTK_PARSE_VOID) + { + return 1; + } + } + + return 0; +} + +int vtkWrap_IsVoidPointer(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_VOID && vtkWrap_IsPointer(val)); +} + +int vtkWrap_IsCharPointer(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_CHAR && vtkWrap_IsPointer(val)); +} + +int vtkWrap_IsVTKObject(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); + return (t == VTK_PARSE_OBJECT_PTR && + val->Class[0] == 'v' && strncmp(val->Class, "vtk", 3) == 0); +} + +int vtkWrap_IsSpecialObject(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); + return ((t == VTK_PARSE_OBJECT || + t == VTK_PARSE_OBJECT_REF) && + val->Class[0] == 'v' && strncmp(val->Class, "vtk", 3) == 0); +} + +int vtkWrap_IsQtObject(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + if (t == VTK_PARSE_QOBJECT && + val->Class[0] == 'Q' && isupper(val->Class[1])) + { + return 1; + } + return 0; +} + +int vtkWrap_IsQtEnum(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); + if ((t == VTK_PARSE_QOBJECT || t == VTK_PARSE_QOBJECT_REF) && + val->Class[0] == 'Q' && strncmp("Qt::", val->Class, 4) == 0) + { + return 1; + } + return 0; +} + + +/* -------------------------------------------------------------------- */ +/* The base types, all are mutually exclusive. */ + +int vtkWrap_IsObject(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_OBJECT || + t == VTK_PARSE_QOBJECT); +} + +int vtkWrap_IsFunction(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_FUNCTION); +} + +int vtkWrap_IsStream(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_ISTREAM || + t == VTK_PARSE_OSTREAM); +} + +int vtkWrap_IsNumeric(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + + t = (t & ~VTK_PARSE_UNSIGNED); + switch (t) + { + case VTK_PARSE_FLOAT: + case VTK_PARSE_DOUBLE: + case VTK_PARSE_CHAR: + case VTK_PARSE_SHORT: + case VTK_PARSE_INT: + case VTK_PARSE_LONG: + case VTK_PARSE_ID_TYPE: + case VTK_PARSE_LONG_LONG: + case VTK_PARSE___INT64: + case VTK_PARSE_SIGNED_CHAR: + case VTK_PARSE_SSIZE_T: + case VTK_PARSE_BOOL: + return 1; + } + + return 0; +} + +int vtkWrap_IsString(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_STRING || + t == VTK_PARSE_UNICODE_STRING); +} + +/* -------------------------------------------------------------------- */ +/* Subcategories */ + +int vtkWrap_IsBool(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_BOOL); +} + +int vtkWrap_IsChar(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_CHAR); +} + +int vtkWrap_IsInteger(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + + if (t != VTK_PARSE_UNSIGNED_CHAR) + { + t = (t & ~VTK_PARSE_UNSIGNED); + } + switch (t) + { + case VTK_PARSE_SHORT: + case VTK_PARSE_INT: + case VTK_PARSE_LONG: + case VTK_PARSE_ID_TYPE: + case VTK_PARSE_LONG_LONG: + case VTK_PARSE___INT64: + case VTK_PARSE_UNSIGNED_CHAR: + case VTK_PARSE_SIGNED_CHAR: + case VTK_PARSE_SSIZE_T: + return 1; + } + + return 0; +} + +int vtkWrap_IsRealNumber(ValueInfo *val) +{ + unsigned int t = (val->Type & VTK_PARSE_BASE_TYPE); + return (t == VTK_PARSE_FLOAT || t == VTK_PARSE_DOUBLE); +} + +/* -------------------------------------------------------------------- */ +/* These are mutually exclusive, as well. */ + +int vtkWrap_IsScalar(ValueInfo *val) +{ + unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); + return (i == 0); +} + +int vtkWrap_IsPointer(ValueInfo *val) +{ + unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); + return (i == VTK_PARSE_POINTER && val->Count == 0 && + val->CountHint == 0 && val->NumberOfDimensions <= 1); +} + +int vtkWrap_IsArray(ValueInfo *val) +{ + unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); + return (i == VTK_PARSE_POINTER && val->NumberOfDimensions <= 1 && + (val->Count != 0 || val->CountHint != 0)); +} + +int vtkWrap_IsNArray(ValueInfo *val) +{ + int j = 0; + unsigned int i = (val->Type & VTK_PARSE_POINTER_MASK); + if (i != VTK_PARSE_ARRAY || val->NumberOfDimensions <= 1) + { + return 0; + } + for (j = 0; j < val->NumberOfDimensions; j++) + { + if (val->Dimensions[j] == NULL || val->Dimensions[j][0] == '\0') + { + return 0; + } + } + return 1; +} + + +/* -------------------------------------------------------------------- */ +/* Other type properties, not mutually exclusive. */ + +int vtkWrap_IsNonConstRef(ValueInfo *val) +{ + return ((val->Type & VTK_PARSE_REF) != 0 && + (val->Type & VTK_PARSE_CONST) == 0); +} + +int vtkWrap_IsConstRef(ValueInfo *val) +{ + return ((val->Type & VTK_PARSE_REF) != 0 && + (val->Type & VTK_PARSE_CONST) != 0); +} + +int vtkWrap_IsRef(ValueInfo *val) +{ + return ((val->Type & VTK_PARSE_REF) != 0); +} + +int vtkWrap_IsConst(ValueInfo *val) +{ + return ((val->Type & VTK_PARSE_CONST) != 0); +} + +/* -------------------------------------------------------------------- */ +/* Hints */ + +int vtkWrap_IsNewInstance(ValueInfo *val) +{ + return ((val->Type & VTK_PARSE_NEWINSTANCE) != 0); +} + +/* -------------------------------------------------------------------- */ +/* Constructor/Destructor checks */ + +int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f) + +{ + size_t i, m; + const char *cp = c->Name; + + if (cp && f->Name && !vtkWrap_IsDestructor(c, f)) + { + /* remove namespaces and template parameters from the name */ + m = vtkParse_UnscopedNameLength(cp); + while (cp[m] == ':' && cp[m+1] == ':') + { + cp += m + 2; + m = vtkParse_UnscopedNameLength(cp); + } + for (i = 0; i < m; i++) + { + if (cp[i] == '<') + { + break; + } + } + + return (i == strlen(f->Name) && strncmp(cp, f->Name, i) == 0); + } + + return 0; +} + +int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f) +{ + size_t i; + const char *cp; + + if (c->Name && f->Name) + { + cp = f->Signature; + for (i = 0; cp[i] != '\0' && cp[i] != '('; i++) + { + if (cp[i] == '~') + { + return 1; + } + } + } + + return 0; +} + +int vtkWrap_IsSetVectorMethod(FunctionInfo *f) +{ + if (f->Macro && strncmp(f->Macro, "vtkSetVector", 12) == 0) + { + return 1; + } + + return 0; +} + +int vtkWrap_IsGetVectorMethod(FunctionInfo *f) +{ + if (f->Macro && strncmp(f->Macro, "vtkGetVector", 12) == 0) + { + return 1; + } + + return 0; +} + +/* -------------------------------------------------------------------- */ +/* Argument counting */ + +int vtkWrap_CountWrappedParameters(FunctionInfo *f) +{ + int totalArgs = f->NumberOfParameters; + + if (totalArgs > 0 && + (f->Parameters[0]->Type & VTK_PARSE_BASE_TYPE) + == VTK_PARSE_FUNCTION) + { + totalArgs = 1; + } + else if (totalArgs == 1 && + (f->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) + == VTK_PARSE_VOID) + { + totalArgs = 0; + } + + return totalArgs; +} + +int vtkWrap_CountRequiredArguments(FunctionInfo *f) +{ + int requiredArgs = 0; + int totalArgs; + int i; + + totalArgs = vtkWrap_CountWrappedParameters(f); + + for (i = 0; i < totalArgs; i++) + { + if (f->Parameters[i]->Value == NULL || + vtkWrap_IsArray(f->Parameters[i]) || + vtkWrap_IsNArray(f->Parameters[i])) + { + requiredArgs = i+1; + } + } + + return requiredArgs; +} + +/* -------------------------------------------------------------------- */ +/* Check whether the class is derived from vtkObjectBase. */ + +int vtkWrap_IsVTKObjectBaseType( + HierarchyInfo *hinfo, const char *classname) +{ + HierarchyEntry *entry; + + if (hinfo) + { + entry = vtkParseHierarchy_FindEntry(hinfo, classname); + if (entry) + { + if (vtkParseHierarchy_IsTypeOf(hinfo, entry, "vtkObjectBase")) + { + return 1; + } + return 0; + } + } + + /* fallback if no HierarchyInfo */ + if (strncmp("vtk", classname, 3) == 0) + { + return 1; + } + + return 0; +} + +/* -------------------------------------------------------------------- */ +/* Check if the WRAP_SPECIAL flag is set for the class. */ + +int vtkWrap_IsSpecialType( + HierarchyInfo *hinfo, const char *classname) +{ + HierarchyEntry *entry; + + if (hinfo) + { + entry = vtkParseHierarchy_FindEntry(hinfo, classname); + if (entry && vtkParseHierarchy_GetProperty(entry, "WRAP_SPECIAL")) + { + return 1; + } + return 0; + } + + /* fallback if no HierarchyInfo */ + if (strncmp("vtk", classname, 3) == 0) + { + return -1; + } + + return 0; +} + +/* -------------------------------------------------------------------- */ +/* Check if the class is derived from superclass */ + +int vtkWrap_IsTypeOf( + HierarchyInfo *hinfo, const char *classname, const char *superclass) +{ + HierarchyEntry *entry; + + if (strcmp(classname, superclass) == 0) + { + return 1; + } + + if (hinfo) + { + entry = vtkParseHierarchy_FindEntry(hinfo, classname); + if (entry && vtkParseHierarchy_IsTypeOf(hinfo, entry, superclass)) + { + return 1; + } + } + + return 0; +} + +/* -------------------------------------------------------------------- */ +/* Make a guess about whether a class is wrapped */ + +int vtkWrap_IsClassWrapped( + HierarchyInfo *hinfo, const char *classname) +{ + if (hinfo) + { + HierarchyEntry *entry; + entry = vtkParseHierarchy_FindEntry(hinfo, classname); + + if (entry) + { + if (!vtkParseHierarchy_GetProperty(entry, "WRAP_EXCLUDE") || + vtkParseHierarchy_GetProperty(entry, "WRAP_SPECIAL")) + { + return 1; + } + } + } + else if (strncmp("vtk", classname, 3) == 0) + { + return 1; + } + + return 0; +} + +/* -------------------------------------------------------------------- */ +/* Check whether the destructor is public */ +int vtkWrap_HasPublicDestructor(ClassInfo *data) +{ + FunctionInfo *func; + int i; + + for (i = 0; i < data->NumberOfFunctions; i++) + { + func = data->Functions[i]; + + if (vtkWrap_IsDestructor(data, func) && + func->Access != VTK_ACCESS_PUBLIC) + { + return 0; + } + } + + return 1; +} + +/* -------------------------------------------------------------------- */ +/* Check whether the copy constructor is public */ +int vtkWrap_HasPublicCopyConstructor(ClassInfo *data) +{ + FunctionInfo *func; + int i; + + for (i = 0; i < data->NumberOfFunctions; i++) + { + func = data->Functions[i]; + + if (vtkWrap_IsConstructor(data, func) && + func->NumberOfParameters == 1 && + func->Parameters[0]->Class && + strcmp(func->Parameters[0]->Class, data->Name) == 0 && + func->Access != VTK_ACCESS_PUBLIC) + { + return 0; + } + } + + return 1; +} + +/* -------------------------------------------------------------------- */ +/* Get the size for subclasses of vtkTuple */ +int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo) +{ + HierarchyEntry *entry; + const char *classname = NULL; + size_t m; + int size = 0; + + entry = vtkParseHierarchy_FindEntry(hinfo, data->Name); + if (entry && vtkParseHierarchy_IsTypeOfTemplated( + hinfo, entry, data->Name, "vtkTuple", &classname)) + { + /* attempt to get count from template parameter */ + if (classname) + { + m = strlen(classname); + if (m > 2 && classname[m - 1] == '>' && + isdigit(classname[m-2]) && (classname[m-3] == ' ' || + classname[m-3] == ',' || classname[m-3] == '<')) + { + size = classname[m-2] - '0'; + } + free((char *)classname); + } + } + + return size; +} + +/* -------------------------------------------------------------------- */ +/* This sets the CountHint for vtkDataArray methods where the + * tuple size is equal to GetNumberOfComponents. */ +void vtkWrap_FindCountHints( + ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) +{ + int i; + int count; + const char *countMethod; + FunctionInfo *theFunc; + + /* add hints for vtkInformation get methods */ + if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkInformation")) + { + countMethod = "Length(temp0)"; + + for (i = 0; i < data->NumberOfFunctions; i++) + { + theFunc = data->Functions[i]; + + if (strcmp(theFunc->Name, "Get") == 0 && + theFunc->NumberOfParameters >= 1 && + theFunc->Parameters[0]->Type == VTK_PARSE_OBJECT_PTR && + (strcmp(theFunc->Parameters[0]->Class, + "vtkInformationIntegerVectorKey") == 0 || + strcmp(theFunc->Parameters[0]->Class, + "vtkInformationDoubleVectorKey") == 0)) + { + if (theFunc->ReturnValue && theFunc->ReturnValue->Count == 0 && + theFunc->NumberOfParameters == 1) + { + theFunc->ReturnValue->CountHint = countMethod; + } + } + } + } + + /* add hints for array GetTuple methods */ + if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkDataArray")) + { + countMethod = "GetNumberOfComponents()"; + + for (i = 0; i < data->NumberOfFunctions; i++) + { + theFunc = data->Functions[i]; + + if ((strcmp(theFunc->Name, "GetTuple") == 0 || + strcmp(theFunc->Name, "GetTupleValue") == 0) && + theFunc->ReturnValue && theFunc->ReturnValue->Count == 0 && + theFunc->NumberOfParameters == 1 && + theFunc->Parameters[0]->Type == VTK_PARSE_ID_TYPE) + { + theFunc->ReturnValue->CountHint = countMethod; + } + else if ((strcmp(theFunc->Name, "SetTuple") == 0 || + strcmp(theFunc->Name, "SetTupleValue") == 0 || + strcmp(theFunc->Name, "GetTuple") == 0 || + strcmp(theFunc->Name, "GetTupleValue") == 0 || + strcmp(theFunc->Name, "InsertTuple") == 0 || + strcmp(theFunc->Name, "InsertTupleValue") == 0) && + theFunc->NumberOfParameters == 2 && + theFunc->Parameters[0]->Type == VTK_PARSE_ID_TYPE && + theFunc->Parameters[1]->Count == 0) + { + theFunc->Parameters[1]->CountHint = countMethod; + } + else if ((strcmp(theFunc->Name, "InsertNextTuple") == 0 || + strcmp(theFunc->Name, "InsertNextTupleValue") == 0) && + theFunc->NumberOfParameters == 1 && + theFunc->Parameters[0]->Count == 0) + { + theFunc->Parameters[0]->CountHint = countMethod; + } + } + } + + /* add hints for interpolator Interpolate methods */ + if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractImageInterpolator")) + { + countMethod = "GetNumberOfComponents()"; + + for (i = 0; i < data->NumberOfFunctions; i++) + { + theFunc = data->Functions[i]; + + if (strcmp(theFunc->Name, "Interpolate") == 0 && + theFunc->NumberOfParameters == 2 && + theFunc->Parameters[0]->Type == (VTK_PARSE_DOUBLE_PTR|VTK_PARSE_CONST) && + theFunc->Parameters[0]->Count == 3 && + theFunc->Parameters[1]->Type == VTK_PARSE_DOUBLE_PTR && + theFunc->Parameters[1]->Count == 0) + { + theFunc->Parameters[1]->CountHint = countMethod; + } + } + } + + for (i = 0; i < data->NumberOfFunctions; i++) + { + theFunc = data->Functions[i]; + + /* hints for constructors that take arrays */ + if (vtkWrap_IsConstructor(data, theFunc) && + theFunc->NumberOfParameters == 1 && + vtkWrap_IsPointer(theFunc->Parameters[0]) && + vtkWrap_IsNumeric(theFunc->Parameters[0]) && + theFunc->Parameters[0]->Count == 0 && + hinfo) + { + count = vtkWrap_GetTupleSize(data, hinfo); + if (count) + { + char counttext[24]; + sprintf(counttext, "%d", count); + theFunc->Parameters[0]->Count = count; + vtkParse_AddStringToArray( + &theFunc->Parameters[0]->Dimensions, + &theFunc->Parameters[0]->NumberOfDimensions, + vtkParse_CacheString(finfo->Strings, counttext, strlen(counttext))); + } + } + + /* hints for operator[] index range */ + if (theFunc->IsOperator && theFunc->Name && + strcmp(theFunc->Name, "operator[]") == 0) + { + if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkTuple")) + { + theFunc->SizeHint = "GetSize()"; + } + else if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayCoordinates") || + vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayExtents") || + vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArraySort")) + { + theFunc->SizeHint = "GetDimensions()"; + } + else if (vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayExtentsList") || + vtkWrap_IsTypeOf(hinfo, data->Name, "vtkArrayWeights")) + { + theFunc->SizeHint = "GetCount()"; + } + } + } +} + +/* -------------------------------------------------------------------- */ +/* This sets the NewInstance hint for generator methods. */ +void vtkWrap_FindNewInstanceMethods( + ClassInfo *data, HierarchyInfo *hinfo) +{ + int i; + FunctionInfo *theFunc; + + for (i = 0; i < data->NumberOfFunctions; i++) + { + theFunc = data->Functions[i]; + if (theFunc->Name && theFunc->ReturnValue && + vtkWrap_IsVTKObject(theFunc->ReturnValue) && + vtkWrap_IsVTKObjectBaseType(hinfo, theFunc->ReturnValue->Class)) + { + if (strcmp(theFunc->Name, "NewInstance") == 0 || + strcmp(theFunc->Name, "CreateInstance") == 0 || + (strcmp(theFunc->Name, "CreateLookupTable") == 0 && + strcmp(data->Name, "vtkColorSeries") == 0) || + (strcmp(theFunc->Name, "CreateImageReader2") == 0 && + strcmp(data->Name, "vtkImageReader2Factory") == 0) || + (strcmp(theFunc->Name, "CreateDataArray") == 0 && + strcmp(data->Name, "vtkDataArray") == 0) || + (strcmp(theFunc->Name, "CreateArray") == 0 && + strcmp(data->Name, "vtkAbstractArray") == 0) || + (strcmp(theFunc->Name, "CreateArray") == 0 && + strcmp(data->Name, "vtkArray") == 0) || + (strcmp(theFunc->Name, "GetQueryInstance") == 0 && + strcmp(data->Name, "vtkSQLDatabase") == 0) || + (strcmp(theFunc->Name, "CreateFromURL") == 0 && + strcmp(data->Name, "vtkSQLDatabase") == 0) || + (strcmp(theFunc->Name, "MakeTransform") == 0 && + vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractTransform"))) + { + theFunc->ReturnValue->Type |= VTK_PARSE_NEWINSTANCE; + } + } + } +} + + +/* -------------------------------------------------------------------- */ +/* Expand all typedef types that are used in function arguments */ +void vtkWrap_ExpandTypedefs( + ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) +{ + int i, j, n; + FunctionInfo *funcInfo; + const char *newclass; + + n = data->NumberOfSuperClasses; + for (i = 0; i < n; i++) + { + newclass = vtkParseHierarchy_ExpandTypedefsInName( + hinfo, data->SuperClasses[i], NULL); + if (newclass != data->SuperClasses[i]) + { + data->SuperClasses[i] = + vtkParse_CacheString(finfo->Strings, newclass, strlen(newclass)); + free((char *)newclass); + } + } + + n = data->NumberOfFunctions; + for (i = 0; i < n; i++) + { + funcInfo = data->Functions[i]; + if (funcInfo->Access == VTK_ACCESS_PUBLIC) + { + for (j = 0; j < funcInfo->NumberOfParameters; j++) + { + vtkParseHierarchy_ExpandTypedefsInValue( + hinfo, funcInfo->Parameters[j], finfo->Strings, data->Name); + } + if (funcInfo->ReturnValue) + { + vtkParseHierarchy_ExpandTypedefsInValue( + hinfo, funcInfo->ReturnValue, finfo->Strings, data->Name); + } + } + } +} + + +/* -------------------------------------------------------------------- */ +/* get the type name */ + +const char *vtkWrap_GetTypeName(ValueInfo *val) +{ + unsigned int aType = val->Type; + const char *aClass = val->Class; + + /* print the type itself */ + switch (aType & VTK_PARSE_BASE_TYPE) + { + case VTK_PARSE_FLOAT: return "float"; + case VTK_PARSE_DOUBLE: return "double"; + case VTK_PARSE_INT: return "int"; + case VTK_PARSE_SHORT: return "short"; + case VTK_PARSE_LONG: return "long"; + case VTK_PARSE_VOID: return "void "; + case VTK_PARSE_CHAR: return "char"; + case VTK_PARSE_UNSIGNED_INT: return "unsigned int"; + case VTK_PARSE_UNSIGNED_SHORT: return "unsigned short"; + case VTK_PARSE_UNSIGNED_LONG: return "unsigned long"; + case VTK_PARSE_UNSIGNED_CHAR: return "unsigned char"; + case VTK_PARSE_ID_TYPE: return "vtkIdType"; + case VTK_PARSE_LONG_LONG: return "long long"; + case VTK_PARSE___INT64: return "__int64"; + case VTK_PARSE_UNSIGNED_LONG_LONG: return "unsigned long long"; + case VTK_PARSE_UNSIGNED___INT64: return "unsigned __int64"; + case VTK_PARSE_SIGNED_CHAR: return "signed char"; + case VTK_PARSE_BOOL: return "bool"; + case VTK_PARSE_UNICODE_STRING: return "vtkUnicodeString"; + case VTK_PARSE_SSIZE_T: return "ssize_t"; + case VTK_PARSE_SIZE_T: return "size_t"; + } + + return aClass; +} + +/* -------------------------------------------------------------------- */ +/* variable declarations */ + +void vtkWrap_DeclareVariable( + FILE *fp, ValueInfo *val, const char *name, int i, int flags) +{ + unsigned int aType; + int j; + + if (val == NULL) + { + return; + } + + aType = (val->Type & VTK_PARSE_UNQUALIFIED_TYPE); + + /* do nothing for void */ + if (aType == VTK_PARSE_VOID || + (aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FUNCTION) + { + return; + } + + /* add a couple spaces */ + fprintf(fp," "); + + /* for const * return types, prepend with const */ + if ((flags & VTK_WRAP_RETURN) != 0) + { + if ((val->Type & VTK_PARSE_CONST) != 0 && + (aType & VTK_PARSE_INDIRECT) != 0) + { + fprintf(fp,"const "); + } + } + /* do the same for "const char *" with initializer */ + else + { + if ((val->Type & VTK_PARSE_CONST) != 0 && + aType == VTK_PARSE_CHAR_PTR && + val->Value && + strcmp(val->Value, "0") != 0 && + strcmp(val->Value, "NULL") != 0) + { + fprintf(fp,"const "); + } + } + + /* print the type name */ + fprintf(fp, "%s ", vtkWrap_GetTypeName(val)); + + /* indirection */ + if ((flags & VTK_WRAP_RETURN) != 0) + { + /* ref and pointer return values are stored as pointers */ + if ((aType & VTK_PARSE_INDIRECT) == VTK_PARSE_POINTER || + (aType & VTK_PARSE_INDIRECT) == VTK_PARSE_REF) + { + fprintf(fp, "*"); + } + } + else + { + /* objects refs and pointers are always handled via pointers, + * other refs are passed by value */ + if (aType == VTK_PARSE_CHAR_PTR || + aType == VTK_PARSE_VOID_PTR || + aType == VTK_PARSE_OBJECT_PTR || + aType == VTK_PARSE_OBJECT_REF || + aType == VTK_PARSE_OBJECT || + vtkWrap_IsQtObject(val)) + { + fprintf(fp, "*"); + } + /* arrays of unknown size are handled via pointers */ + else if (val->CountHint) + { + fprintf(fp, "*"); + } + } + + /* the variable name */ + if (i >= 0) + { + fprintf(fp,"%s%i", name, i); + } + else + { + fprintf(fp,"%s", name); + } + + if ((flags & VTK_WRAP_ARG) != 0) + { + /* print the array decorators */ + if (((aType & VTK_PARSE_POINTER_MASK) != 0) && + aType != VTK_PARSE_CHAR_PTR && + aType != VTK_PARSE_VOID_PTR && + aType != VTK_PARSE_OBJECT_PTR && + !vtkWrap_IsQtObject(val) && + val->CountHint == NULL) + { + if (val->NumberOfDimensions == 1 && val->Count > 0) + { + fprintf(fp, "[%d]", val->Count); + } + else + { + for (j = 0; j < val->NumberOfDimensions; j++) + { + fprintf(fp, "[%s]", val->Dimensions[j]); + } + } + } + + /* add a default value */ + else if (val->Value) + { + fprintf(fp, " = %s", val->Value); + } + else if (aType == VTK_PARSE_CHAR_PTR || + aType == VTK_PARSE_VOID_PTR || + aType == VTK_PARSE_OBJECT_PTR || + aType == VTK_PARSE_OBJECT_REF || + aType == VTK_PARSE_OBJECT || + vtkWrap_IsQtObject(val)) + { + fprintf(fp, " = NULL"); + } + else if (val->CountHint) + { + fprintf(fp, " = NULL"); + } + else if (aType == VTK_PARSE_BOOL) + { + fprintf(fp, " = false"); + } + } + + /* finish off with a semicolon */ + if ((flags & VTK_WRAP_NOSEMI) == 0) + { + fprintf(fp, ";\n"); + } +} + +void vtkWrap_DeclareVariableSize( + FILE *fp, ValueInfo *val, const char *name, int i) +{ + char idx[32]; + int j; + + idx[0] = '\0'; + if (i >= 0) + { + sprintf(idx, "%d", i); + } + + if (val->NumberOfDimensions > 1) + { + fprintf(fp, + " static int %s%s[%d] = ", + name, idx, val->NumberOfDimensions); + + for (j = 0; j < val->NumberOfDimensions; j++) + { + fprintf(fp, "%c %s", ((j == 0) ? '{' : ','), val->Dimensions[j]); + } + + fprintf(fp, " };\n"); + } + else if (val->Count != 0 || val->CountHint) + { + fprintf(fp, + " %sint %s%s = %d;\n", + (val->CountHint ? "" : "const "), name, idx, + (val->CountHint ? 0 : val->Count)); + } + else if (val->NumberOfDimensions == 1) + { + fprintf(fp, + " const int %s%s = %s;\n", + name, idx, val->Dimensions[0]); + } +} diff --git a/src/VTKWrapping/ParaView/vtkWrap.h b/src/VTKWrapping/ParaView/vtkWrap.h new file mode 100644 index 00000000..8b385eb1 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkWrap.h @@ -0,0 +1,248 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkWrap.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +/** + * vtkWrap provides useful functions for generating wrapping code. +*/ + +#ifndef VTK_WRAP_H +#define VTK_WRAP_H + +#include "vtkParse.h" +#include "vtkParseHierarchy.h" + +/** + * For use with vtkWrap_DeclareVariable. + */ +/*@{*/ +#define VTK_WRAP_RETURN 1 +#define VTK_WRAP_ARG 2 +#define VTK_WRAP_NOSEMI 4 +/*@}*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Check for common types. + */ +/*@{*/ +int vtkWrap_IsVoid(ValueInfo *val); +int vtkWrap_IsVoidFunction(ValueInfo *val); +int vtkWrap_IsVoidPointer(ValueInfo *val); +int vtkWrap_IsCharPointer(ValueInfo *val); +int vtkWrap_IsVTKObject(ValueInfo *val); +int vtkWrap_IsSpecialObject(ValueInfo *val); +int vtkWrap_IsQtObject(ValueInfo *val); +int vtkWrap_IsQtEnum(ValueInfo *val); +/*@}*/ + +/** + * The basic types, all are mutually exclusive. + * Note that enums are considered to be objects, + * bool and char are considered to be numeric. + */ +/*@{*/ +int vtkWrap_IsObject(ValueInfo *val); +int vtkWrap_IsFunction(ValueInfo *val); +int vtkWrap_IsStream(ValueInfo *val); +int vtkWrap_IsNumeric(ValueInfo *val); +int vtkWrap_IsString(ValueInfo *val); +/*@}*/ + +/** + * Subcategories of numeric types. In this categorization, + * bool and char are not considered to be integers. + */ +/*@{*/ +int vtkWrap_IsBool(ValueInfo *val); +int vtkWrap_IsChar(ValueInfo *val); +int vtkWrap_IsInteger(ValueInfo *val); +int vtkWrap_IsRealNumber(ValueInfo *val); +/*@}*/ + +/** + * Arrays and pointers. These are mutually exclusive. + * IsPointer() does not include pointers to pointers. + * IsArray() and IsNArray() do not include unsized arrays. + * Arrays of pointers are not included in any of these. + */ +/*@{*/ +int vtkWrap_IsScalar(ValueInfo *val); +int vtkWrap_IsPointer(ValueInfo *val); +int vtkWrap_IsArray(ValueInfo *val); +int vtkWrap_IsNArray(ValueInfo *val); +/*@}*/ + +/** + * Properties that can combine with other properties. + */ +/*@{*/ +int vtkWrap_IsNonConstRef(ValueInfo *val); +int vtkWrap_IsConstRef(ValueInfo *val); +int vtkWrap_IsRef(ValueInfo *val); +int vtkWrap_IsConst(ValueInfo *val); +/*@}*/ + +/** + * Hints. + * NewInstance objects must be freed by the caller. + */ +/*@{*/ +int vtkWrap_IsNewInstance(ValueInfo *val); +/*@}*/ + + +/** + * Check whether the class is derived from vtkObjectBase. + * If "hinfo" is NULL, this just checks that the class + * name starts with "vtk". + */ +int vtkWrap_IsVTKObjectBaseType( + HierarchyInfo *hinfo, const char *classname); + +/** + * Check if the WRAP_SPECIAL flag is set for the class. + * If "hinfo" is NULL, it defaults to just checking if + * the class starts with "vtk" and returns -1 if so. + */ +int vtkWrap_IsSpecialType( + HierarchyInfo *hinfo, const char *classname); + +/** + * Check if the class is derived from superclass. + * If "hinfo" is NULL, then only an exact match to the + * superclass will succeed. + */ +int vtkWrap_IsTypeOf( + HierarchyInfo *hinfo, const char *classname, const char *superclass); + +/** + * Check whether a class is wrapped. If "hinfo" is NULL, + * it just checks that the class starts with "vtk". + */ +int vtkWrap_IsClassWrapped( + HierarchyInfo *hinfo, const char *classname); + +/** + * Check whether the destructor is public + */ +int vtkWrap_HasPublicDestructor(ClassInfo *data); + +/** + * Check whether the copy constructor is public + */ +int vtkWrap_HasPublicCopyConstructor(ClassInfo *data); + +/** + * Expand all typedef types that are used in function arguments. + * This should be done before any wrapping is done, to make sure + * that the wrappers see the real types. + */ +void vtkWrap_ExpandTypedefs( + ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo); + +/** + * Apply any hints about array sizes, e.g. hint that the + * GetNumberOfComponents() method gives the tuple size. + */ +void vtkWrap_FindCountHints( + ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo); + +/** + * Get the size of a fixed-size tuple + */ +int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo); + +/** + * Apply any hints about methods that return a new object instance, + * i.e. factory methods and the like. Reference counts must be + * handled differently for such returned objects. + */ +void vtkWrap_FindNewInstanceMethods( + ClassInfo *data, HierarchyInfo *hinfo); + +/** + * Get the name of a type. The name will not include "const". + */ +const char *vtkWrap_GetTypeName(ValueInfo *val); + +/** + * True if the method a constructor of the class. + */ +int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f); + +/** + * True if the method a destructor of the class. + */ +int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f); + +/** + * Check if a method is from a SetVector method. + */ +int vtkWrap_IsSetVectorMethod(FunctionInfo *f); + +/** + * Check if a method is from a GetVector method. + */ +int vtkWrap_IsGetVectorMethod(FunctionInfo *f); + +/** + * Count the number of parameters that are wrapped. + * This skips the "void *" parameter that follows + * wrapped function pointer parameters. + */ +int vtkWrap_CountWrappedParameters(FunctionInfo *f); + +/** + * Count the number of args that are required. + * This counts to the last argument that does not + * have a default value. Array args are not allowed + * to have default values. + */ +int vtkWrap_CountRequiredArguments(FunctionInfo *f); + +/** + * Write a variable declaration to a file. + * Void is automatically ignored, and nothing is written for + * function pointers + * Set "idx" to -1 to avoid writing an idx. + * Set "flags" to VTK_WRAP_RETURN to write a return value, + * or to VTK_WRAP_ARG to write a temp argument variable. + * The following rules apply: + * - if VTK_WRAP_NOSEMI is set, then no semicolon/newline is printed + * - if VTK_WRAP_RETURN is set, then "&" becomes "*" + * - if VTK_WRAP_ARG is set, "&" becomes "*" only for object + * types, and is removed for all other types. + * - "const" is removed except for return values with "&" or "*". + */ +void vtkWrap_DeclareVariable( + FILE *fp, ValueInfo *v, const char *name, int idx, int flags); + +/** + * Write an "int" size variable for arrays, initialized to + * the array size if the size is greater than zero. + * For N-dimensional arrays, write a static array of ints. + */ +void vtkWrap_DeclareVariableSize( + FILE *fp, ValueInfo *v, const char *name, int idx); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/VTKWrapping/ParaView/vtkWrapHierarchy.c b/src/VTKWrapping/ParaView/vtkWrapHierarchy.c new file mode 100644 index 00000000..f53fec9d --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkWrapHierarchy.c @@ -0,0 +1,977 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkWrapHierarchy.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/*------------------------------------------------------------------------- + Copyright (c) 2010 David Gobbi. + + Contributed to the VisualizationToolkit by the author in June 2010 + under the terms of the Visualization Toolkit 2008 copyright. +-------------------------------------------------------------------------*/ + +/** + The vtkWrapHierarchy program builds a text file that describes the + class hierarchy. + For each class, the output file will have a line in the following + format: + + classname [ : superclass ] ; header.h ; kit [; flags] + + For each enum type, + + enumname : enum ; header.h ; kit [; flags] + + For each typedef, + + name = [2][3]* const int ; header.h ; kit [; flags] + +*/ + +#include "vtkParse.h" +#include "vtkParseData.h" +#include "vtkParseMain.h" +#include "vtkParsePreprocess.h" +#include +#include +#include +#include +#ifdef _WIN32 +# include +#else +# include +#endif + +/** + * Helper to append a text line to an array of lines + */ +static char **append_unique_line(char **lines, char *line, size_t *np) +{ + size_t l, n; + + n = *np; + + /* check to make sure this line isn't a duplicate */ + for (l = 0; l < n; l++) + { + if (strcmp(line, lines[l]) == 0) + { + break; + } + } + if (l == n) + { + /* allocate more memory if n+1 is a power of two */ + if (((n+1) & n) == 0) + { + lines = (char **)realloc(lines, (n+1)*2*sizeof(char *)); + } + + lines[n] = (char *)malloc(strlen(line)+1); + strcpy(lines[n++], line); + lines[n] = NULL; + } + + *np = n; + return lines; +} + +/** + * Helper to append to a line, given the end marker + */ +static char *append_to_line( + char *line, const char *text, size_t *pos, size_t *maxlen) +{ + size_t n; + + n = strlen(text); + + if ((*pos) + n + 1 > (*maxlen)) + { + *maxlen = ((*pos) + n + 1 + 2*(*maxlen)); + line = (char *)realloc(line, (*maxlen)); + } + + strcpy(&line[*pos], text); + *pos = (*pos) + n; + + return line; +} + +/** + * Append scope to line + */ +static char *append_scope_to_line( + char *line, size_t *m, size_t *maxlen, const char *scope) +{ + if (scope && scope[0] != '\0') + { + line = append_to_line(line, scope, m, maxlen); + line = append_to_line(line, "::", m, maxlen); + } + + return line; +} + +/** + * Append template info + */ +static char *append_template_to_line( + char *line, size_t *m, size_t *maxlen, TemplateInfo *template_args) +{ + ValueInfo *arg; + int j; + + line = append_to_line(line, "<", m, maxlen); + + for (j = 0; j < template_args->NumberOfParameters; j++) + { + arg = template_args->Parameters[j]; + if (arg->Name) + { + line = append_to_line(line, arg->Name, m, maxlen); + } + if (arg->Value && arg->Value[0] != '\n') + { + line = append_to_line(line, "=", m, maxlen); + line = append_to_line(line, arg->Value, m, maxlen); + } + if (j+1 < template_args->NumberOfParameters) + { + line = append_to_line(line, ",", m, maxlen); + } + } + + line = append_to_line(line, ">", m, maxlen); + + return line; +} + +/** + * Append class info + */ +static char *append_class_to_line( + char *line, size_t *m, size_t *maxlen, ClassInfo *class_info) +{ + int j; + + line = append_to_line(line, class_info->Name, m, maxlen); + + if (class_info->Template) + { + line = append_template_to_line(line, m, maxlen, class_info->Template); + } + + line = append_to_line(line, " ", m, maxlen); + + if (class_info->NumberOfSuperClasses) + { + line = append_to_line(line, ": ", m, maxlen); + } + + for (j = 0; j < class_info->NumberOfSuperClasses; j++) + { + line = append_to_line(line, class_info->SuperClasses[j], m, maxlen); + line = append_to_line(line, " ", m, maxlen); + if (j+1 < class_info->NumberOfSuperClasses) + { + line = append_to_line(line, ", ", m, maxlen); + } + } + + return line; +} + +/** + * Append enum info + */ +static char *append_enum_to_line( + char *line, size_t *m, size_t *maxlen, EnumInfo *enum_info) +{ + line = append_to_line(line, enum_info->Name, m, maxlen); + line = append_to_line(line, " : enum ", m, maxlen); + + return line; +} + +/** + * Append the trailer, i.e. the filename and flags + */ +static char *append_trailer( + char *line, size_t *m, size_t *maxlen, + const char *header_file, const char *module_name, const char *flags) +{ + line = append_to_line(line, "; ", m, maxlen); + line = append_to_line(line, header_file, m, maxlen); + + line = append_to_line(line, " ; ", m, maxlen); + line = append_to_line(line, module_name, m, maxlen); + + if (flags && flags[0] != '\0') + { + line = append_to_line(line, " ; ", m, maxlen); + line = append_to_line(line, flags, m, maxlen); + } + + return line; +} + +/** + * Append typedef info + */ +static char *append_typedef_to_line( + char *line, size_t *m, size_t *maxlen, ValueInfo *typedef_info) +{ + unsigned int type; + int ndims; + int dim; + + line = append_to_line(line, typedef_info->Name, m, maxlen); + line = append_to_line(line, " = ", m, maxlen); + + type = typedef_info->Type; + + if ((type & VTK_PARSE_REF) != 0) + { + line = append_to_line(line, "&", m, maxlen); + } + + ndims = typedef_info->NumberOfDimensions; + + for (dim = 0; dim < ndims; dim++) + { + line = append_to_line(line, "[", m, maxlen); + line = append_to_line(line, typedef_info->Dimensions[dim], + m, maxlen); + line = append_to_line(line, "]", m, maxlen); + } + + type = (type & VTK_PARSE_POINTER_MASK); + if (ndims > 0 && (type & VTK_PARSE_POINTER_LOWMASK) == VTK_PARSE_ARRAY) + { + type = ((type >> 2) & VTK_PARSE_POINTER_MASK); + } + else if (ndims == 1) + { + type = ((type >> 2) & VTK_PARSE_POINTER_MASK); + } + + /* pointers are printed after brackets, and are intentionally + * printed in reverse order as compared to C++ declarations */ + while (type) + { + unsigned int bits = (type & VTK_PARSE_POINTER_LOWMASK); + type = ((type >> 2) & VTK_PARSE_POINTER_MASK); + + if (bits == VTK_PARSE_POINTER) + { + line = append_to_line(line, "*", m, maxlen); + } + else if (bits == VTK_PARSE_CONST_POINTER) + { + line = append_to_line(line, "const*", m, maxlen); + } + else + { + line = append_to_line(line, "[]", m, maxlen); + } + } + + if (line[*m-1] != ' ') + { + line = append_to_line(line, " ", m, maxlen); + } + + if ((type & VTK_PARSE_CONST) != 0) + { + line = append_to_line(line, "const ", m, maxlen); + } + + line = append_to_line(line, typedef_info->Class, m, maxlen); + line = append_to_line(line, " ", m, maxlen); + + return line; +} + +/** + * Append all types in a class + */ +static char **append_class_contents( + char **lines, size_t *np, ClassInfo *data, + const char *scope, const char *header_file, const char *module_name) +{ + int i; + const char *tmpflags; + char *new_scope; + char *line; + size_t m, n, maxlen; + size_t scope_m, scope_maxlen; + + /* append the name to the scope */ + new_scope = 0; + n = 0; + m = 0; + if (scope) + { + n = strlen(scope); + } + if (data->Name) + { + m = strlen(data->Name); + } + if (m && (n || data->Template)) + { + scope_maxlen = n + m + 3; + scope_m = 0; + new_scope = (char *)malloc(scope_maxlen); + new_scope[0] = '\0'; + if (n) + { + new_scope = append_to_line(new_scope, scope, &scope_m, &scope_maxlen); + new_scope = append_to_line(new_scope, "::", &scope_m, &scope_maxlen); + } + new_scope = append_to_line(new_scope, data->Name, &scope_m, &scope_maxlen); + if (data->Template) + { + new_scope = append_template_to_line( + new_scope, &scope_m, &scope_maxlen, data->Template); + } + scope = new_scope; + } + else if (m) + { + scope = data->Name; + } + + /* start with a buffer of 15 chars and grow from there */ + maxlen = 15; + m = 0; + line = (char *)malloc(maxlen); + + /* add a line for each type that is found */ + for (i = 0; i < data->NumberOfItems; i++) + { + m = 0; + line[m] = '\0'; + + tmpflags = 0; + + if (data->Items[i].Type == VTK_CLASS_INFO || + data->Items[i].Type == VTK_STRUCT_INFO) + { + ClassInfo *class_info = + data->Classes[data->Items[i].Index]; + + line = append_scope_to_line(line, &m, &maxlen, scope); + line = append_class_to_line(line, &m, &maxlen, class_info); + tmpflags = "WRAP_EXCLUDE"; + } + else if (data->Items[i].Type == VTK_ENUM_INFO) + { + line = append_scope_to_line(line, &m, &maxlen, scope); + line = append_enum_to_line(line, &m, &maxlen, + data->Enums[data->Items[i].Index]); + } + else if (data->Items[i].Type == VTK_TYPEDEF_INFO) + { + line = append_scope_to_line(line, &m, &maxlen, scope); + line = append_typedef_to_line(line, &m, &maxlen, + data->Typedefs[data->Items[i].Index]); + } + else + { + /* unhandled file element */ + continue; + } + + /* append filename and flags */ + line = append_trailer( + line, &m, &maxlen, header_file, module_name, tmpflags); + + /* append the line to the file */ + lines = append_unique_line(lines, line, np); + + /* for classes, add all typed defined within the class */ + if ((data->Items[i].Type == VTK_CLASS_INFO || + data->Items[i].Type == VTK_STRUCT_INFO) && + data->Classes[data->Items[i].Index]->Name) + { + lines = append_class_contents(lines, np, + data->Classes[data->Items[i].Index], + scope, header_file, module_name); + } + } + + free(line); + + if (new_scope != 0) + { + free(new_scope); + } + + return lines; +} + + +/** + * Append all types in a namespace + */ +static char **append_namespace_contents( + char **lines, size_t *np, NamespaceInfo *data, ClassInfo *main_class, + const char *scope, const char *header_file, const char *module_name, + const char *flags) +{ + int i; + const char *tmpflags; + char *line; + char *new_scope; + size_t n, m, maxlen; + + /* append the name to the scope */ + new_scope = 0; + n = 0; + m = 0; + if (scope) + { + n = strlen(scope); + } + if (data->Name) + { + m = strlen(data->Name); + } + if (m && n) + { + new_scope = (char *)malloc(m + n + 3); + if (n) + { + strncpy(new_scope, scope, n); + new_scope[n++] = ':'; + new_scope[n++] = ':'; + } + strncpy(&new_scope[n], data->Name, m); + new_scope[n+m] = '\0'; + scope = new_scope; + } + else if (m) + { + scope = data->Name; + } + + /* start with a buffer of 15 chars and grow from there */ + maxlen = 15; + m = 0; + line = (char *)malloc(maxlen); + + /* add a line for each type that is found */ + for (i = 0; i < data->NumberOfItems; i++) + { + tmpflags = 0; + m = 0; + line[m] = '\0'; + + if (data->Items[i].Type == VTK_CLASS_INFO || + data->Items[i].Type == VTK_STRUCT_INFO) + { + ClassInfo *class_info = + data->Classes[data->Items[i].Index]; + + /* all but the main class in each file is excluded from wrapping */ + tmpflags = "WRAP_EXCLUDE"; + if (class_info == main_class) + { + tmpflags = flags; + } + + line = append_scope_to_line(line, &m, &maxlen, scope); + line = append_class_to_line(line, &m, &maxlen, class_info); + } + else if (data->Items[i].Type == VTK_ENUM_INFO) + { + line = append_scope_to_line(line, &m, &maxlen, scope); + line = append_enum_to_line(line, &m, &maxlen, + data->Enums[data->Items[i].Index]); + } + else if (data->Items[i].Type == VTK_TYPEDEF_INFO) + { + line = append_scope_to_line(line, &m, &maxlen, scope); + line = append_typedef_to_line(line, &m, &maxlen, + data->Typedefs[data->Items[i].Index]); + } + else if (data->Items[i].Type != VTK_NAMESPACE_INFO) + { + /* unhandled file element */ + continue; + } + + if (data->Items[i].Type != VTK_NAMESPACE_INFO) + { + /* append filename and flags */ + line = append_trailer( + line, &m, &maxlen, header_file, module_name, tmpflags); + + /* append the line to the file */ + lines = append_unique_line(lines, line, np); + } + + /* for classes, add all typed defined within the class */ + if ((data->Items[i].Type == VTK_CLASS_INFO || + data->Items[i].Type == VTK_STRUCT_INFO) && + data->Classes[data->Items[i].Index]->Name) + { + lines = append_class_contents(lines, np, + data->Classes[data->Items[i].Index], + scope, header_file, module_name); + } + + /* for namespaces, add all types in the namespace */ + if (data->Items[i].Type == VTK_NAMESPACE_INFO && + data->Namespaces[data->Items[i].Index]->Name) + { + lines = append_namespace_contents(lines, np, + data->Namespaces[data->Items[i].Index], 0, + scope, header_file, module_name, "WRAP_EXCLUDE"); + } + } + + free(line); + + if (new_scope != 0) + { + free(new_scope); + } + + return lines; +} + +/** + * Read a header file with vtkParse.tab.c + * + * If "lines" is provided, the file contents + * will be appended to them. + */ +static char **vtkWrapHierarchy_ParseHeaderFile( + FILE *fp, const char *filename, const char *module_name, + const char *flags, char **lines) +{ + FileInfo *data; + const char *header_file; + size_t k, n; + + /* start with just a single output line and grow from there */ + if (lines == NULL) + { + lines = (char **)malloc(sizeof(char *)); + lines[0] = NULL; + } + + /* always ignore BTX markers when building hierarchy files */ + vtkParse_SetIgnoreBTX(1); + + /* the "concrete" flag doesn't matter, just set to zero */ + data = vtkParse_ParseFile(filename, fp, stderr); + + if (!data) + { + free(lines); + return 0; + } + + /* find the last line in "lines" */ + n = 0; + while (lines[n] != NULL) + { + n++; + } + + k = strlen(data->FileName) - 1; + while (k > 0 && data->FileName[k-1] != '/' && data->FileName[k-1] != '\\') + { + k--; + } + header_file = &data->FileName[k]; + + /* append the file contents to the output */ + lines = append_namespace_contents( + lines, &n, data->Contents, data->MainClass, 0, + header_file, module_name, flags); + + vtkParse_Free(data); + + return lines; +} + +/** + * Read a hierarchy file into "lines" without duplicating lines + */ +static char **vtkWrapHierarchy_ReadHierarchyFile(FILE *fp, char **lines) +{ + char *line; + size_t maxlen = 15; + size_t i, n; + + line = (char *)malloc(maxlen); + + if (lines == NULL) + { + lines = (char **)malloc(sizeof(char *)); + lines[0] = NULL; + } + + while (fgets(line, (int)maxlen, fp)) + { + n = strlen(line); + + /* if buffer not long enough, increase it */ + while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) + { + maxlen *= 2; + line = (char *)realloc(line, maxlen); + if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } + n += strlen(&line[n]); + } + + while (n > 0 && isspace(line[n-1])) + { + n--; + } + line[n] = '\0'; + + if (line[0] == '\0') + { + continue; + } + + for (i = 0; lines[i] != NULL; i++) + { + if (strcmp(line, lines[i]) == 0) + { + break; + } + } + + if (lines[i] == NULL) + { + /* allocate more memory if n+1 is a power of two */ + if (((i+1) & i) == 0) + { + lines = (char **)realloc(lines, (i+1)*2*sizeof(char *)); + } + + lines[i] = (char *)malloc(n+1); + strcpy(lines[i], line); + lines[i+1] = NULL; + } + } + + free(line); + + if (!feof(fp)) + { + free(lines); + return 0; + } + + return lines; +} + +/** + * Compare a file to "lines", return 0 if they are different + */ +static int vtkWrapHierarchy_CompareHierarchyFile(FILE *fp, char *lines[]) +{ + unsigned char *matched; + char *line; + size_t maxlen = 15; + size_t i, n; + + line = (char *)malloc(maxlen); + + for (i = 0; lines[i] != NULL; i++) { ; }; + matched = (unsigned char *)malloc(i); + memset(matched, 0, i); + + while (fgets(line, (int)maxlen, fp)) + { + n = strlen(line); + + /* if buffer not long enough, increase it */ + while (n == maxlen-1 && line[n-1] != '\n' && !feof(fp)) + { + maxlen *= 2; + line = (char *)realloc(line, maxlen); + if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; } + n += strlen(&line[n]); + } + + while (n > 0 && isspace(line[n-1])) + { + n--; + } + line[n] = '\0'; + + if (line[0] == '\0') + { + continue; + } + + for (i = 0; lines[i] != NULL; i++) + { + if (strcmp(line, lines[i]) == 0) + { + break; + } + } + + if (lines[i] == NULL) + { + free(matched); + return 0; + } + + matched[i] = 1; + } + + for (i = 0; lines[i] != NULL; i++) + { + if (matched[i] == 0) + { + free(matched); + return 0; + } + } + + free(line); + free(matched); + + if (!feof(fp)) + { + return 0; + } + + return 1; +} + +/** + * Write "lines" to a hierarchy file + */ +static int vtkWrapHierarchy_WriteHierarchyFile(FILE *fp, char *lines[]) +{ + size_t i; + + for (i = 0; lines[i] != NULL; i++) + { + if (fprintf(fp, "%s\n", lines[i]) < 0) + { + return 0; + } + } + + return 1; +} + +/** + * Try to parse a header file, print error and exit if fail + */ +static char **vtkWrapHierarchy_TryParseHeaderFile( + const char *file_name, const char *module_name, + const char *flags, char **lines) +{ + FILE *input_file; + + input_file = fopen(file_name, "r"); + + if (!input_file) + { + fprintf(stderr, "vtkWrapHierarchy: couldn't open file %s\n", + file_name); + exit(1); + } + + lines = vtkWrapHierarchy_ParseHeaderFile( + input_file, file_name, module_name, flags, lines); + + if (!lines) + { + fclose(input_file); + exit(1); + } + fclose(input_file); + + return lines; +} + +/** + * Try to read a file, print error and exit if fail + */ +static char **vtkWrapHierarchy_TryReadHierarchyFile( + const char *file_name, char **lines) +{ + FILE *input_file; + + input_file = fopen(file_name, "r"); + if (!input_file) + { + fprintf(stderr, "vtkWrapHierarchy: couldn't open file %s\n", + file_name); + exit(1); + } + + lines = vtkWrapHierarchy_ReadHierarchyFile(input_file, lines); + if (!lines) + { + fclose(input_file); + fprintf(stderr, "vtkWrapHierarchy: error reading file %s\n", + file_name); + exit(1); + } + fclose(input_file); + + return lines; +} + +/** + * Try to write a file, print error and exit if fail + */ +static int vtkWrapHierarchy_TryWriteHierarchyFile( + const char *file_name, char *lines[]) +{ + FILE *output_file; + int matched = 0; + + output_file = fopen(file_name, "r"); + if (output_file && vtkWrapHierarchy_CompareHierarchyFile(output_file, lines)) + { + matched = 1; + } + if (output_file) + { + fclose(output_file); + } + + if (!matched) + { + int tries = 1; + output_file = fopen(file_name, "w"); + while (!output_file && tries < 5) + { + /* There are two CMAKE_CUSTOM_COMMANDS for vtkWrapHierarchy, + * make sure they do not collide. */ + tries++; +#ifdef _WIN32 + Sleep(1000); +#else + sleep(1); +#endif + output_file = fopen(file_name, "r+"); + if (output_file && + vtkWrapHierarchy_CompareHierarchyFile(output_file, lines)) + { + /* if the contents match, no need to write it */ + fclose(output_file); + return 0; + } + if (output_file) + { + /* close and open in order to truncate the file */ + fclose(output_file); + output_file = fopen(file_name, "w"); + } + } + if (!output_file) + { + fprintf(stderr, "vtkWrapHierarchy: tried %i times to write %s\n", + tries, file_name); + exit(1); + } + if (!vtkWrapHierarchy_WriteHierarchyFile(output_file, lines)) + { + fclose(output_file); + fprintf(stderr, "vtkWrapHierarchy: error writing file %s\n", + file_name); + exit(1); + } + fclose(output_file); + } + + return 0; +} + +static int string_compare(const void *vp1, const void *vp2) +{ + return strcmp(*(const char **)vp1, *(const char **)vp2); +} + +int main(int argc, char *argv[]) +{ + OptionInfo *options; + int i; + size_t j, n; + char **lines = 0; + char **files = 0; + char *flags; + char *module_name; + + /* parse command-line options */ + vtkParse_MainMulti(argc, argv); + options = vtkParse_GetCommandLineOptions(); + + /* make sure than an output file was given on the command line */ + if (options->OutputFileName == NULL) + { + fprintf(stderr, "No output file was specified\n"); + exit(1); + } + + /* read the data file */ + files = vtkWrapHierarchy_TryReadHierarchyFile( + options->InputFileName, files); + + /* read in all the prior files */ + for (i = 1; i < options->NumberOfFiles; i++) + { + lines = vtkWrapHierarchy_TryReadHierarchyFile( + options->Files[i], lines); + } + + /* merge the files listed in the data file */ + for (i = 0; files[i] != NULL; i++) + { + /* look for semicolon that marks the module name */ + module_name = files[i]; + while(*module_name != ';' && *module_name != '\0') { module_name++; }; + if (*module_name == ';') { *module_name++ = '\0'; } + + /* look for semicolon that marks start of flags */ + flags = module_name; + while(*flags != ';' && *flags != '\0') { flags++; }; + if (*flags == ';') { *flags++ = '\0'; } + + lines = vtkWrapHierarchy_TryParseHeaderFile( + files[i], module_name, flags, lines); + } + + /* sort the lines to ease lookups in the file */ + for (n = 0; lines[n]; n++) { ; }; + qsort(lines, n, sizeof(char *), &string_compare); + + /* write the file, if it has changed */ + vtkWrapHierarchy_TryWriteHierarchyFile(options->OutputFileName, lines); + + for (j = 0; j < n; j++) + { + free(lines[j]); + } + + free(files); + free(lines); + return 0; +} diff --git a/src/VTKWrapping/ParaView/vtkWrapText.c b/src/VTKWrapping/ParaView/vtkWrapText.c new file mode 100644 index 00000000..df65aba4 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkWrapText.c @@ -0,0 +1,988 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkWrapText.c + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#include "vtkWrapText.h" +#include "vtkWrap.h" +#include +#include +#include +#include + +/* -------------------------------------------------------------------- */ +/* Convert special characters in a string into their escape codes + * so that the string can be quoted in a source file. The specified + * maxlen must be at least 32 chars, and should not be over 2047 since + * that is the maximum length of a string literal on some systems */ + +const char *vtkWrapText_QuoteString( + const char *comment, size_t maxlen) +{ + static char *result = 0; + static size_t oldmaxlen = 0; + size_t i, j, n; + + if (maxlen > oldmaxlen) + { + if (result) + { + free(result); + } + result = (char *)malloc((size_t)(maxlen+1)); + oldmaxlen = maxlen; + } + + if (comment == NULL) + { + return ""; + } + + j = 0; + + n = strlen(comment); + for (i = 0; i < n; i++) + { + if (comment[i] == '\"') + { + strcpy(&result[j],"\\\""); + j += 2; + } + else if (comment[i] == '\\') + { + strcpy(&result[j],"\\\\"); + j += 2; + } + else if (comment[i] == '\n') + { + strcpy(&result[j],"\\n"); + j += 2; + } + else if ((comment[i] & 0x80) != 0 || isprint(comment[i])) + { + // all characters in extended-ASCII set are printable. Some compilers (VS + // 2010, in debug mode) asserts when isprint() is passed a negative value. + // Hence, we simply skip the check. + result[j] = comment[i]; + j++; + } + else + { + sprintf(&result[j],"\\%3.3o",comment[i]); + j += 4; + } + if (j >= maxlen - 21) + { + sprintf(&result[j]," ...\\n [Truncated]\\n"); + j += (int)strlen(" ...\\n [Truncated]\\n"); + break; + } + } + result[j] = '\0'; + + return result; +} + +/* -------------------------------------------------------------------- */ +/* A simple string that grows as necessary. */ + +struct vtkWPString +{ + char *str; + size_t len; + size_t maxlen; +}; + +/* -- append ---------- */ +static void vtkWPString_Append( + struct vtkWPString *str, const char *text) +{ + size_t n = strlen(text); + + if (str->len + n + 1 > str->maxlen) + { + str->maxlen = (str->len + n + 1 + 2*str->maxlen); + str->str = (char *)realloc(str->str, str->maxlen); + } + + strncpy(&str->str[str->len], text, n); + str->len += n; + str->str[str->len] = '\0'; +} + +/* -- add a char ---------- */ +static void vtkWPString_PushChar( + struct vtkWPString *str, char c) +{ + if (str->len + 2 > str->maxlen) + { + str->maxlen = (str->len + 2 + 2*str->maxlen); + str->str = (char *)realloc(str->str, str->maxlen); + } + + str->str[str->len++] = c; + str->str[str->len] = '\0'; +} + +/* -- strip any of the given chars from the end ---------- */ +static void vtkWPString_Strip( + struct vtkWPString *str, const char *trailers) +{ + size_t k = str->len; + char *cp = str->str; + size_t j = 0; + size_t n; + + if (cp) + { + n = strlen(trailers); + + while (k > 0 && j < n) + { + for (j = 0; j < n; j++) + { + if (cp[k-1] == trailers[j]) + { + k--; + break; + } + } + } + + str->len = k; + str->str[k] = '\0'; + } +} + +/* -- Return the last char ---------- */ +static char vtkWPString_LastChar( + struct vtkWPString *str) +{ + if (str->str && str->len > 0) + { + return str->str[str->len-1]; + } + return '\0'; +} + +/* -- do a linebreak on a method declaration ---------- */ +static void vtkWPString_BreakSignatureLine( + struct vtkWPString *str, size_t *linestart, size_t indentation) +{ + size_t i = 0; + size_t m = 0; + size_t j = *linestart; + size_t l = str->len; + size_t k = str->len; + char *text = str->str; + char delim; + + if (!text) + { + return; + } + + while (l > j && text[l-1] != '\n' && text[l-1] != ',' && + text[l-1] != '(' && text[l-1] != ')') + { + /* treat each string as a unit */ + if (l > 4 && (text[l-1] == '\'' || text[l-1] == '\"')) + { + delim = text[l-1]; + l -= 2; + while (l > 3 && (text[l-1] != delim || text[l-3] == '\\')) + { + l--; + if (text[l-1] == '\\') + { + l--; + } + } + l -= 2; + } + else + { + l--; + } + } + + /* if none of these chars was found, split is impossible */ + if (text[l-1] != ',' && text[l-1] != '(' && + text[l-1] != ')' && text[l-1] != '\n') + { + j++; + } + + else + { + /* Append some chars to guarantee size */ + vtkWPString_PushChar(str, '\n'); + vtkWPString_PushChar(str, '\n'); + for (i = 0; i < indentation; i++) + { + vtkWPString_PushChar(str, ' '); + } + /* re-get the char pointer, it may have been reallocated */ + text = str->str; + + if (k > l) + { + m = 0; + while (m < indentation+2 && text[l+m] == ' ') + { + m++; + } + memmove(&text[l+indentation+2-m], &text[l], k-l); + k += indentation+2-m; + } + else + { + k += indentation+2; + } + text[l++] = '\\'; text[l++] = 'n'; + j = l; + for (i = 0; i < indentation; i++) + { + text[l++] = ' '; + } + } + + str->len = k; + + /* return the new line start position */ + *linestart = j; +} + +/* -- do a linebreak on regular text ---------- */ +static void vtkWPString_BreakCommentLine( + struct vtkWPString *str, size_t *linestart, size_t indent) +{ + size_t i = 0; + size_t j = *linestart; + size_t l = str->len; + char *text = str->str; + + if (!text) + { + return; + } + + /* try to break the line at a word */ + while (l > 0 && text[l-1] != ' ' && text[l-1] != '\n') + { + l--; + } + if (l > 0 && text[l-1] != '\n' && l-j > indent) + { + /* replace space with newline */ + text[l-1] = '\n'; + j = l; + + /* Append some chars to guarantee size */ + vtkWPString_PushChar(str, '\n'); + vtkWPString_PushChar(str, '\n'); + for (i = 0; i < indent; i++) + { + vtkWPString_PushChar(str, ' '); + } + /* re-get the char pointer, it may have been reallocated */ + text = str->str; + str->len -= indent+2; + + if (str->len > l && indent > 0) + { + memmove(&text[l+indent], &text[l], str->len-l); + memset(&text[l], ' ', indent); + str->len += indent; + } + } + else + { + /* long word, just split the word */ + vtkWPString_PushChar(str, '\n'); + j = str->len; + for (i = 0; i < indent; i++) + { + vtkWPString_PushChar(str, ' '); + } + } + + /* return the new line start position */ + *linestart = j; +} + +/* -------------------------------------------------------------------- */ +/* Format a signature to a 70 char linewidth and char limit */ +const char *vtkWrapText_FormatSignature( + const char *signature, size_t width, size_t maxlen) +{ + static struct vtkWPString staticString = { NULL, 0, 0 }; + struct vtkWPString *text; + size_t i, j, n; + const char *cp = signature; + char delim; + size_t lastSigStart = 0; + size_t sigCount = 0; + + text = &staticString; + text->len = 0; + + if (signature == 0) + { + return ""; + } + + i = 0; + j = 0; + + while (cp[i] != '\0') + { + while (text->len - j < width && cp[i] != '\n' && cp[i] != '\0') + { + /* escape quotes */ + if (cp[i] == '\"' || cp[i] == '\'') + { + delim = cp[i]; + vtkWPString_PushChar(text, '\\'); + vtkWPString_PushChar(text, cp[i++]); + while (cp[i] != delim && cp[i] != '\0') + { + if (cp[i] == '\\') + { + vtkWPString_PushChar(text, '\\'); + } + vtkWPString_PushChar(text, cp[i++]); + } + if (cp[i] == delim) + { + vtkWPString_PushChar(text, '\\'); + vtkWPString_PushChar(text, cp[i++]); + } + } + /* remove items that trail the closing parenthesis */ + else if (cp[i] == ')') + { + vtkWPString_PushChar(text, cp[i++]); + if (strncmp(&cp[i], " const", 6) == 0) + { + i += 6; + } + if (strncmp(&cp[i], " = 0", 4) == 0) + { + i += 4; + } + if (cp[i] == ';') + { + i++; + } + } + /* anything else */ + else + { + vtkWPString_PushChar(text, cp[i++]); + } + } + + /* break the line (try to break after a comma) */ + if (cp[i] != '\n' && cp[i] != '\0') + { + vtkWPString_BreakSignatureLine(text, &j, 4); + } + /* reached end of line: do next signature */ + else + { + vtkWPString_Strip(text, " \r\t"); + if (cp[i] != '\0') + { + sigCount++; + /* if sig count is even, check length against maxlen */ + if ((sigCount & 1) == 0) + { + n = strlen(text->str); + if (n >= maxlen) + { + break; + } + lastSigStart = n; + } + + i++; + vtkWPString_PushChar(text, '\\'); + vtkWPString_PushChar(text, 'n'); + } + /* mark the position of the start of the line */ + j = text->len; + } + } + + vtkWPString_Strip(text, " \r\t"); + + if (strlen(text->str) >= maxlen) + { + /* terminate before the current signature */ + text->str[lastSigStart] = '\0'; + } + + return text->str; +} + +/* -------------------------------------------------------------------- */ +/* Format a comment to a 70 char linewidth, in several steps: + * 1) remove html tags, convert

and
into breaks + * 2) remove doxygen tags like \em + * 3) remove extra whitespace (except paragraph breaks) + * 4) re-break the lines + */ + +const char *vtkWrapText_FormatComment( + const char *comment, size_t width) +{ + static struct vtkWPString staticString = { NULL, 0, 0 }; + struct vtkWPString *text; + const char *cp; + size_t i, j, l; + size_t indent = 0; + int nojoin = 0; + int start; + + text = &staticString; + text->len = 0; + + if (comment == 0) + { + return ""; + } + + i = 0; j = 0; l = 0; + start = 1; + cp = comment; + + /* skip any leading whitespace */ + while (cp[i] == '\n' || cp[i] == '\r' || + cp[i] == '\t' || cp[i] == ' ') + { + i++; + } + + while (cp[i] != '\0') + { + /* Add characters until the output line is complete */ + while (cp[i] != '\0' && text->len-j < width) + { + /* if the end of the line was found, see how next line begins */ + if (start) + { + /* eat the leading space */ + if (cp[i] == ' ') + { + i++; + } + + /* skip ahead to find any interesting first characters */ + l = i; + while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') + { + l++; + } + + /* check for new section */ + if (cp[l] == '.' && strncmp(&cp[l], ".SECTION", 8) == 0) + { + vtkWPString_Strip(text, "\n"); + if (text->len > 0) + { + vtkWPString_PushChar(text, '\n'); + vtkWPString_PushChar(text, '\n'); + } + i = l+8; + while (cp[i] == '\r' || cp[i] == '\t' || cp[i] == ' ') + { + i++; + } + while (cp[i] != '\n' && cp[i] != '\0') + { + vtkWPString_PushChar(text, cp[i++]); + } + vtkWPString_Strip(text, " \t\r"); + + if (vtkWPString_LastChar(text) != ':') + { + vtkWPString_PushChar(text, ':'); + } + vtkWPString_PushChar(text, '\n'); + vtkWPString_PushChar(text, '\n'); + j = text->len; + indent = 0; + if (cp[i] == '\n') + { + i++; + } + start = 1; + continue; + } + + /* handle doxygen tags that appear at start of line */ + if (cp[l] == '\\' || cp[l] == '@') + { + if (strncmp(&cp[l+1], "brief", 5) == 0 || + strncmp(&cp[l+1], "short", 5) == 0 || + strncmp(&cp[l+1], "pre", 3) == 0 || + strncmp(&cp[l+1], "post", 4) == 0 || + strncmp(&cp[l+1], "param", 5) == 0 || + strncmp(&cp[l+1], "tparam", 6) == 0 || + strncmp(&cp[l+1], "cmdparam", 8) == 0 || + strncmp(&cp[l+1], "exception", 9) == 0 || + strncmp(&cp[l+1], "return", 6) == 0 || + strncmp(&cp[l+1], "li", 2) == 0) + { + nojoin = 2; + indent = 4; + if (text->len > 0 && vtkWPString_LastChar(text) != '\n') + { + vtkWPString_PushChar(text, '\n'); + } + j = text->len; + i = l; + } + } + + /* handle bullets and numbering */ + else if (cp[l] == '-' || cp[l] == '*' || cp[l] == '#' || + (cp[l] >= '0' && cp[l] <= '9' && + (cp[l+1] == ')' || cp[l+1] == '.') && cp[l+2] == ' ')) + { + indent = 0; + while (indent < 3 && cp[l+indent] != ' ') + { + indent++; + } + indent++; + if (text->len > 0 && vtkWPString_LastChar(text) != '\n') + { + vtkWPString_PushChar(text, '\n'); + } + j = text->len; + i = l; + } + + /* keep paragraph breaks */ + else if (cp[l] == '\n') + { + i = l+1; + vtkWPString_Strip(text, "\n"); + if (text->len > 0) + { + vtkWPString_PushChar(text, '\n'); + vtkWPString_PushChar(text, '\n'); + } + nojoin = 0; + indent = 0; + j = text->len; + start = 1; + continue; + } + + /* add newline if nojoin is not set */ + else if (nojoin || + (cp[i] == ' ' && !indent)) + { + if (nojoin == 2) + { + nojoin = 0; + indent = 0; + } + vtkWPString_PushChar(text, '\n'); + j = text->len; + } + + /* do line joining */ + else if (text->len > 0 && vtkWPString_LastChar(text) != '\n') + { + i = l; + vtkWPString_PushChar(text, ' '); + } + } + + /* handle quotes */ + if (cp[i] == '\"') + { + size_t q = i; + size_t r = text->len; + + /* try to keep the quote whole */ + vtkWPString_PushChar(text, cp[i++]); + while (cp[i] != '\"' && cp[i] != '\r' && + cp[i] != '\n' && cp[i] != '\0') + { + vtkWPString_PushChar(text, cp[i++]); + } + /* if line ended before quote did, then reset */ + if (cp[i] != '\"') + { + i = q; + text->len = r; + } + } + else if (cp[i] == '\'') + { + size_t q = i; + size_t r = text->len; + + /* try to keep the quote whole */ + vtkWPString_PushChar(text, cp[i++]); + while (cp[i] != '\'' && cp[i] != '\r' && + cp[i] != '\n' && cp[i] != '\0') + { + vtkWPString_PushChar(text, cp[i++]); + } + /* if line ended before quote did, then reset */ + if (cp[i] != '\'') + { + i = q; + text->len = r; + } + } + + /* handle simple html tags */ + else if (cp[i] == '<') + { + l = i+1; + if (cp[l] == '/') { l++; } + while ((cp[l] >= 'a' && cp[l] <= 'z') || + (cp[l] >= 'a' && cp[l] <= 'z')) { l++; } + if (cp[l] == '>') + { + if (cp[i+1] == 'p' || cp[i+1] == 'P' || + (cp[i+1] == 'b' && cp[i+2] == 'r') || + (cp[i+1] == 'B' && cp[i+2] == 'R')) + { + vtkWPString_Strip(text, " \n"); + vtkWPString_PushChar(text, '\n'); + vtkWPString_PushChar(text, '\n'); + j = text->len; + indent = 0; + } + i = l+1; + while (cp[i] == '\r' || cp[i] == '\t' || cp[i] == ' ') + { + i++; + } + } + } + else if (cp[i] == '\\' || cp[i] == '@') + { + /* handle simple doxygen tags */ + if (strncmp(&cp[i+1], "em ", 3) == 0) + { + i += 4; + } + else if (strncmp(&cp[i+1], "a ", 2) == 0 || + strncmp(&cp[i+1], "e ", 2) == 0 || + strncmp(&cp[i+1], "c ", 2) == 0 || + strncmp(&cp[i+1], "b ", 2) == 0 || + strncmp(&cp[i+1], "p ", 2) == 0 || + strncmp(&cp[i+1], "f$", 2) == 0 || + strncmp(&cp[i+1], "f[", 2) == 0 || + strncmp(&cp[i+1], "f]", 2) == 0) + { + if (i > 0 && cp[i-1] != ' ') + { + vtkWPString_PushChar(text, ' '); + } + if (cp[i+1] == 'f') + { + if (cp[i+2] == '$') + { + vtkWPString_PushChar(text, '$'); + } + else + { + vtkWPString_PushChar(text, '\\'); + vtkWPString_PushChar(text, cp[i+2]); + } + } + i += 3; + } + else if (cp[i+1] == '&' || cp[i+1] == '$' || cp[i+1] == '#' || + cp[i+1] == '<' || cp[i+1] == '>' || cp[i+1] == '%' || + cp[i+1] == '@' || cp[i+1] == '\\' || cp[i+1] == '\"') + { + i++; + } + else if (cp[i+1] == 'n') + { + vtkWPString_Strip(text, " \n"); + vtkWPString_PushChar(text, '\n'); + vtkWPString_PushChar(text, '\n'); + indent = 0; + i += 2; + j = text->len; + } + else if (strncmp(&cp[i+1], "code", 4) == 0) + { + nojoin = 1; + i += 5; + while (cp[i] == ' ' || cp[i] == '\r' || + cp[i] == '\t' || cp[i] == '\n') + { + i++; + } + } + else if (strncmp(&cp[i+1], "endcode", 7) == 0) + { + nojoin = 0; + i += 8; + l = i; + while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') + { + l++; + } + if (cp[l] == '\n') + { + i = l; + vtkWPString_PushChar(text, '\n'); + j = text->len; + } + } + else if (strncmp(&cp[i+1], "verbatim", 8) == 0) + { + i += 9; + while (cp[i] != '\0' && ((cp[i] != '@' && cp[i] != '\\') || + strncmp(&cp[i+1], "endverbatim", 11) != 0)) + { + if (cp[i] != '\r') + { + vtkWPString_PushChar(text, cp[i]); + } + if (cp[i] == '\n') + { + j = text->len; + } + i++; + } + if (cp[i] != '\0') + { + i += 12; + } + } + } + + /* search for newline */ + start = 0; + l = i; + while (cp[l] == ' ' || cp[l] == '\t' || cp[l] == '\r') + { + l++; + } + if (cp[l] == '\n') + { + i = l+1; + start = 1; + } + + /* append */ + else if (cp[i] != '\0') + { + vtkWPString_PushChar(text, cp[i++]); + } + + } /* while (cp[i] != '\0' && text->len-j < width) */ + + if (cp[i] == '\0') + { + break; + } + + vtkWPString_BreakCommentLine(text, &j, indent); + } + + /* remove any trailing blank lines */ + vtkWPString_Strip(text, "\n"); + vtkWPString_PushChar(text, '\n'); + + return text->str; +} + +/* -------------------------------------------------------------------- */ +/* Create a signature for the python version of a method. */ + +static void vtkWrapText_PythonTypeSignature( + struct vtkWPString *result, const char *delims[2], ValueInfo *arg); + +static void vtkWrapText_PythonArraySignature( + struct vtkWPString *result, const char *classname, + const char *delims[2], int ndim, const char **dims); + +const char *vtkWrapText_PythonSignature( + FunctionInfo *currentFunction) +{ + /* string is intentionally not freed until the program exits */ + static struct vtkWPString staticString = { NULL, 0, 0 }; + struct vtkWPString *result; + ValueInfo *arg, *ret; + const char *parens[2] = { "(", ")" }; + const char *braces[2] = { "[", "]" }; + const char **delims; + int i, n; + + n = vtkWrap_CountWrappedArgs(currentFunction); + + result = &staticString; + result->len = 0; + + /* print out the name of the method */ + vtkWPString_Append(result, "V."); + vtkWPString_Append(result, currentFunction->Name); + + /* print the arg list */ + vtkWPString_Append(result, "("); + + for (i = 0; i < n; i++) + { + arg = currentFunction->Arguments[i]; + + if (i != 0) + { + vtkWPString_Append(result, ", "); + } + + delims = parens; + if (!vtkWrap_IsConst(arg) && + !vtkWrap_IsSetVectorMethod(currentFunction)) + { + delims = braces; + } + + vtkWrapText_PythonTypeSignature(result, delims, arg); + } + + vtkWPString_Append(result, ")"); + + /* if this is a void method, we are finished */ + /* otherwise, print "->" and the return type */ + ret = currentFunction->ReturnValue; + if (ret && (ret->Type & VTK_PARSE_UNQUALIFIED_TYPE) != VTK_PARSE_VOID) + { + vtkWPString_Append(result, " -> "); + + vtkWrapText_PythonTypeSignature(result, parens, ret); + } + + if (currentFunction->Signature) + { + vtkWPString_Append(result, "\nC++: "); + vtkWPString_Append(result, currentFunction->Signature); + } + + return result->str; +} + +static void vtkWrapText_PythonTypeSignature( + struct vtkWPString *result, const char *braces[2], ValueInfo *arg) +{ + char text[32]; + const char *dimension; + const char *classname = ""; + + if (vtkWrap_IsVoid(arg)) + { + classname = "void"; + } + else if (vtkWrap_IsObject(arg)) + { + classname = arg->Class; + } + else if (vtkWrap_IsFunction(arg)) + { + classname = "function"; + } + else if (vtkWrap_IsString(arg) || vtkWrap_IsCharPointer(arg)) + { + classname = "string"; + if ((arg->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) + { + classname = "unicode"; + } + } + else if (vtkWrap_IsChar(arg)) + { + classname = "char"; + } + else if (vtkWrap_IsBool(arg)) + { + classname = "bool"; + } + else if (vtkWrap_IsRealNumber(arg)) + { + classname = "float"; + } + else if (vtkWrap_IsInteger(arg)) + { + classname = "int"; + } + + if (vtkWrap_IsArray(arg)) + { + if (arg->CountHint) + { + vtkWPString_Append(result, braces[0]); + vtkWPString_Append(result, classname); + vtkWPString_Append(result, ", ..."); + vtkWPString_Append(result, braces[1]); + } + else + { + sprintf(text, "%d", arg->Count); + dimension = text; + vtkWrapText_PythonArraySignature(result, classname, braces, + 1, &dimension); + } + } + else if (vtkWrap_IsNArray(arg)) + { + vtkWrapText_PythonArraySignature(result, classname, braces, + arg->NumberOfDimensions, arg->Dimensions); + } + else + { + vtkWPString_Append(result, classname); + } +} + +static void vtkWrapText_PythonArraySignature( + struct vtkWPString *result, const char *classname, + const char *braces[2], int ndim, const char **dims) +{ + int j, n; + + vtkWPString_Append(result, braces[0]); + n = (int)strtoul(dims[0], 0, 0); + if (ndim > 1) + { + for (j = 0; j < n; j++) + { + if (j != 0) { vtkWPString_Append(result, ", "); } + vtkWrapText_PythonArraySignature(result, classname, + braces, ndim-1, dims+1); + } + } + else + { + for (j = 0; j < n; j++) + { + if (j != 0) { vtkWPString_Append(result, ", "); } + vtkWPString_Append(result, classname); + } + } + vtkWPString_Append(result, braces[1]); +} diff --git a/src/VTKWrapping/ParaView/vtkWrapText.h b/src/VTKWrapping/ParaView/vtkWrapText.h new file mode 100644 index 00000000..bc3a7f15 --- /dev/null +++ b/src/VTKWrapping/ParaView/vtkWrapText.h @@ -0,0 +1,61 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: vtkWrapText.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +/** + * vtkWrap provides useful functions for generating wrapping code. +*/ + +#ifndef VTK_WRAP_TEXT_H +#define VTK_WRAP_TEXT_H + +#include "vtkParse.h" +#include "vtkParseHierarchy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Quote a string for inclusion in a C string literal. The "maxlen" + * should be set to a value between 32 and 2047. Values over 2047 + * will result in string literals too long for some compilers. If + * the string is truncated, a "..." will be appended. + */ +const char *vtkWrapText_QuoteString(const char *comment, size_t maxlen); + +/** + * Format a doxygen comment for plain text, and word-wrap at + * the specified width. A 70-char width is recommended. + */ +const char *vtkWrapText_FormatComment(const char *comment, size_t width); + +/** + * Format a method signature by applying word-wrap at the specified + * width and taking special care not to split any literals or names. + * A width of 70 chars is recommended. + */ +const char *vtkWrapText_FormatSignature( + const char *signature, size_t width, size_t maxlen); + +/** + * Produce a python signature for a method, for use in documentation. + */ +const char *vtkWrapText_PythonSignature(FunctionInfo *currentFunction); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/VTKWrapping/create_class.py b/src/VTKWrapping/create_class.py new file mode 100755 index 00000000..4532eda0 --- /dev/null +++ b/src/VTKWrapping/create_class.py @@ -0,0 +1,62 @@ +#!/bin/bash +# Copyright (C) 2010-2013 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import sys +import os + +ffile = "PARAVIS_CreateClass.cxx" +wfile = os.path.join(sys.argv[1], "wrapfiles.txt") + +ffile_stream = open(ffile, "w") + +ffile_stream.write('#include ' + '\n') +ffile_stream.write('#include ' + '\n') +ffile_stream.write('#include "PARAVIS_Gen_i.hh"' + '\n') +wfile_stream = open(wfile) +for line in wfile_stream: + if line.split()[0] == "vtkWebGLExporter" : + ffile_stream.write('#ifdef WIN32\n') + ffile_stream.write(' #ifdef GetObject\n') + ffile_stream.write(' #undef GetObject\n') + ffile_stream.write(' #endif\n') + ffile_stream.write('#endif\n') + pass + ffile_stream.write('#include "PARAVIS_Gen_%s_i.hh"'%(line.split()[0]) + '\n') + pass +wfile_stream.close() +ffile_stream.write('' + '\n') +ffile_stream.write('PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' + '\n') +ffile_stream.write('{' + '\n') +wfile_stream = open(wfile) +lst = [] +for line in wfile_stream: + lst.append(line.split()[0]) + pass +wfile_stream.close() +lst.reverse() +for item in lst: + ffile_stream.write(' if(theClassName == "%s" || (Inst != NULL && Inst->IsA("%s")))'%(item, item) + '\n') + ffile_stream.write(' return new PARAVIS::%s_i();'%(item) + '\n') + pass +ffile_stream.write('' + '\n') +ffile_stream.write(' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' + '\n') +ffile_stream.write(' return new PARAVIS::PARAVIS_Base_i();' + '\n') +ffile_stream.write('}' + '\n') +ffile_stream.close() diff --git a/src/VTKWrapping/create_class.sh b/src/VTKWrapping/create_class.sh new file mode 100755 index 00000000..8c2b8e01 --- /dev/null +++ b/src/VTKWrapping/create_class.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright (C) 2010-2013 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +file=PARAVIS_CreateClass.cxx +wfile=$1/wrapfiles.txt + +echo '#include ' > $file +echo '#include ' >> $file +echo '#include "PARAVIS_Gen_i.hh"' >> $file +awk '{print "#include \"PARAVIS_Gen_"$1"_i.hh\"";}' $wfile >> $file +echo '' >> $file +echo 'PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' >> $file +echo '{' >> $file +awk 'BEGIN {lst="";} {lst=lst" "$1;} END{i=split(lst,arr);for(j=i;j>0;j--) {print " if(theClassName == \""arr[j]"\" || (Inst != NULL && Inst->IsA(\""arr[j]"\")))";print " return new PARAVIS::"arr[j]"_i();"}}' $wfile >> $file +echo '' >> $file +echo ' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' >> $file +echo ' return new PARAVIS::PARAVIS_Base_i();' >> $file +echo '}' >> $file diff --git a/src/VTKWrapping/getwrapclasses.py b/src/VTKWrapping/getwrapclasses.py new file mode 100644 index 00000000..5981372c --- /dev/null +++ b/src/VTKWrapping/getwrapclasses.py @@ -0,0 +1,158 @@ +# Copyright (C) 2010-2013 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import paraview, os, sys +import string +import re + +classeslistsm = [] +classeslistvtk = [] + +from vtkPVCommonPython import * +from vtkPVClientServerCoreCorePython import * +from vtkPVClientServerCoreDefaultPython import * +from vtkPVClientServerCoreRenderingPython import * +from vtkPVServerImplementationCorePython import * +from vtkPVServerImplementationDefaultPython import * +from vtkPVServerImplementationRenderingPython import * +from vtkPVServerManagerApplicationPython import * +from vtkPVServerManagerCorePython import * +from vtkPVServerManagerDefaultPython import * +from vtkPVServerManagerRenderingPython import * +try: + from vtkPVVTKExtensionsCorePython import * +except: + pass +try: + from vtkPVVTKExtensionsDefaultPython import * +except: + pass +try: + from vtkPVVTKExtensionsRenderingPython import * +except: + pass +try: + from vtkPVVTKExtensionsWebGLExporterPython import * +except: + pass + +l1 = dir() +for a in l1: + if a.startswith("vtk") and (len(a) > 3): + classeslistsm.append(a) + +from paraview.vtk import * +l2 = dir() + +for a in l2: + if (a not in l1) and a.startswith("vtk"): + classeslistvtk.append(a) + +dic=dict() + +non_wrap_list = ["vtkVariant", "vtkTimeStamp"] + +pv_classes_new=classeslistsm +while len(pv_classes_new): + pv_classes_cur=pv_classes_new + pv_classes_new=[] + for c in pv_classes_cur: + ## ignore non wrappable classes + if c in non_wrap_list: + continue + filename=sys.argv[1]+"/"+c+".h" + if os.path.isfile(filename): + c_new=[] + f=open(filename) + for line in f: + if re.match('\s*/',line) is None: + if re.match('\s*public\s*:',line): + continue + + m=re.match('\s*class\s+(vtk\w+)\s*;',line) + if m is not None: + cn=m.group(1) + if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): + pv_classes_new.append(cn) + continue + + m=re.match('\s*struct\s+(vtk\w+)\s*;',line) + if m is not None: + cn=m.group(1) + if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): + pv_classes_new.append(cn) + continue + + m=re.match('\s*#include\s+"(vtk\w+)\.h"',line) + if m is not None: + cn=m.group(1) + if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): + pv_classes_new.append(cn) + continue + + cm=re.findall('public\s+(vtk\w+)',line) + if len(cm) == 0: + continue + for cn in cm: + ## do not extract Call Back classes + if cn.count('vtkClassMemberCallback'): + continue + if cn not in dic.keys() and cn not in pv_classes_new: + pv_classes_new.append(cn) + if cn not in c_new: + c_new.append(cn) + f.close() + dic[c]=[0, c_new] + + +pv_classes_sort=[] + +def collect_dic(cc): + ret=[] + for c in cc: + if c not in dic.keys(): + continue + if len(dic[c][1]) and dic[c][0] == 0: + ret+=collect_dic(dic[c][1]) + if dic[c][0] == 0: + ret.append(c) + dic[c][0]=1 + return ret + +pv_classes_sort=collect_dic(dic.keys()) + +wf_str="" +if(os.path.exists('wrapfiles.txt')): + wf_txt=open('wrapfiles.txt','r') + strs=wf_txt.readlines() + wf_txt.close() + for s in strs: + wf_str+=s +str="" + +for c in pv_classes_sort: + str+=c + for cc in dic[c][1]: + str+=' '+cc + str+='\n' + +if(str!=wf_str): + wf_txt=open('wrapfiles.txt','w') + wf_txt.write(str) + wf_txt.close() diff --git a/src/VTKWrapping/readme.txt b/src/VTKWrapping/readme.txt new file mode 100644 index 00000000..cdceac2c --- /dev/null +++ b/src/VTKWrapping/readme.txt @@ -0,0 +1,3 @@ +The files under the ParaView directory are pure copy from Paraview sources. +They need for extractor building. +Them has to be updated if the corresponded files in paraview will be changed \ No newline at end of file diff --git a/src/VTKWrapping/wrap.cmake b/src/VTKWrapping/wrap.cmake new file mode 100755 index 00000000..daf5d126 --- /dev/null +++ b/src/VTKWrapping/wrap.cmake @@ -0,0 +1,88 @@ +# Copyright (C) 2010-2013 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0) + +SET(WRAP_IDL_I_HH) +SET(WRAP_IDL_I_CC) + +IF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c "f = open('${CMAKE_BINARY_DIR}/wrapfiles.txt') ; print f.read(), ; f.close()" + OUTPUT_VARIABLE WRAP_LIST_FULL + ) + + STRING(REGEX MATCHALL "[^\n]+" WRAP_LIST_REG ${WRAP_LIST_FULL}) + FOREACH(_str ${WRAP_LIST_REG}) + + SEPARATE_ARGUMENTS(_str) + LIST(LENGTH _str WRAP_LEN) + SET(DEP_HH) + SET(DEP_CC) + + LIST(GET _str 0 VAL) + + IF(WRAP_LEN GREATER 1) + MATH(EXPR WRAP_LEN1 "${WRAP_LEN} - 1" ) + + FOREACH(IND RANGE 1 ${WRAP_LEN1}) + LIST(GET _str ${IND} DEP_VAL) + SET(DEP_HH ${DEP_HH} PARAVIS_Gen_${DEP_VAL}_i.hh) + SET(DEP_CC ${DEP_CC} PARAVIS_Gen_${DEP_VAL}_i.cc) + ENDFOREACH(IND RANGE 1 ${WRAP_LEN1}) + + ENDIF(WRAP_LEN GREATER 1) + + LIST(APPEND WRAP_IDL_I_HH PARAVIS_Gen_${VAL}_i.hh) + LIST(APPEND WRAP_IDL_I_CC PARAVIS_Gen_${VAL}_i.cc) + + SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_HH) + IF(WINDOWS) + IF(CMAKE_BUILD_TOOL STREQUAL nmake) + SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_HH.exe) + ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) + SET(vtkWrapIDL_HH_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/vtkWrapIDL_HH.exe) + ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) + ENDIF(WINDOWS) + + ADD_CUSTOM_COMMAND( + OUTPUT PARAVIS_Gen_${VAL}_i.hh + COMMAND ${vtkWrapIDL_HH_EXEFILE} -o PARAVIS_Gen_${VAL}_i.hh --hints ${CMAKE_BINARY_DIR}/idl/hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h + DEPENDS vtkWrapIDL_HH ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h ${CMAKE_BINARY_DIR}/idl/hints ${DEP_HH} + ) + + SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_CC) + IF(WINDOWS) + IF(CMAKE_BUILD_TOOL STREQUAL nmake) + SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL_CC.exe) + ELSE(CMAKE_BUILD_TOOL STREQUAL nmake) + SET(vtkWrapIDL_CC_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/vtkWrapIDL_CC.exe) + ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake) + ENDIF(WINDOWS) + + ADD_CUSTOM_COMMAND( + OUTPUT PARAVIS_Gen_${VAL}_i.cc + COMMAND ${vtkWrapIDL_CC_EXEFILE} -o PARAVIS_Gen_${VAL}_i.cc --hints ${CMAKE_BINARY_DIR}/idl/hints ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h + DEPENDS PARAVIS_Gen_${VAL}_i.hh vtkWrapIDL_CC ${PARAVIEW_INCLUDE_DIR0}/${VAL}.h ${CMAKE_BINARY_DIR}/idl/hints ${DEP_CC} + ) + + ENDFOREACH(_str ${WRAP_LIST_REG}) +ENDIF(EXISTS ${CMAKE_BINARY_DIR}/wrapfiles.txt) + +ADD_CUSTOM_TARGET(generate_implements ALL DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt ${WRAP_IDL_I_HH} ${WRAP_IDL_I_CC})