diff options
-rw-r--r-- | sipgen/lexer.c | 3499 | ||||
-rw-r--r-- | sipgen/parser.c | 9975 | ||||
-rw-r--r-- | sipgen/parser.h | 309 | ||||
-rw-r--r-- | siputils.py | 8 |
4 files changed, 8 insertions, 13783 deletions
diff --git a/sipgen/lexer.c b/sipgen/lexer.c deleted file mode 100644 index e9041f8..0000000 --- a/sipgen/lexer.c +++ /dev/null @@ -1,3499 +0,0 @@ - -#line 3 "<stdout>" - -#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 <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have <inttypes.h>. 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 <inttypes.h> -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; - -/* 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 /* ! C99 */ - -#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 -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#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 - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* 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_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#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. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - 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 int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 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,int 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 125 -#define YY_END_OF_BUFFER 126 -/* 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[859] = - { 0, - 0, 0, 0, 0, 0, 0, 126, 124, 74, 75, - 124, 124, 124, 78, 124, 77, 77, 124, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 124, 74, 124, - 123, 122, 123, 87, 85, 87, 0, 82, 0, 83, - 78, 77, 0, 81, 78, 81, 81, 78, 84, 76, - 78, 0, 56, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 57, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 86, 78, 0, 73, 0, - 0, 78, 76, 79, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 36, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 78, 49, 80, 80, 80, - - 34, 32, 80, 80, 80, 42, 80, 80, 80, 37, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 47, 80, 80, 80, 40, 80, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 115, 20, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 121, 80, 80, 80, 80, 80, 80, 80, 21, 45, - 80, 80, 48, 38, 80, 80, 80, 80, 80, 35, - 80, 80, 29, 80, 80, 80, 53, 80, 80, 80, - - 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 31, 80, 80, 80, 80, 80, 80, 39, 80, - 80, 80, 80, 80, 23, 80, 43, 46, 22, 80, - 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 80, 30, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 25, - 80, 26, 80, 50, 80, 41, 33, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 0, 7, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 28, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 66, 54, 80, 52, 80, 55, 44, 7, - 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, - - 0, 88, 0, 0, 0, 0, 13, 0, 0, 119, - 4, 0, 14, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, - 0, 27, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 51, 24, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 117, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 11, 100, - 0, 98, 0, 80, 80, 61, 60, 80, 80, 80, - 64, 80, 80, 65, 80, 80, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 114, 16, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 0, 0, 0, 113, 0, 0, - 67, 80, 80, 63, 59, 72, 80, 80, 80, 80, - 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 15, 101, 99, 0, 0, 111, 0, 0, 0, 0, - 0, 80, 58, 80, 80, 70, 71, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 116, 0, 104, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 80, 68, 69, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 103, 0, 0, 0, 0, 0, 94, 0, 105, 0, - 0, 0, 0, 0, 10, 0, 0, 0, 0, 2, - 18, 0, 0, 0, 0, 5, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, - 0, 93, 0, 0, 0, 0, 0, 109, 0, 0, - 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 0, 0, 92, 96, 0, 0, - 102, 110, 107, 0, 106, 89, 0, 0, 0, 108, - 0, 0, 0, 91, 0, 95, 97, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 5, 1, 1, 6, 1, 7, 1, - 1, 8, 9, 1, 10, 11, 12, 13, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 15, 1, 1, - 1, 1, 1, 1, 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, 26, - 1, 1, 1, 1, 41, 1, 42, 43, 44, 45, - - 46, 47, 48, 49, 50, 26, 51, 52, 53, 54, - 55, 56, 26, 57, 58, 59, 60, 61, 62, 63, - 64, 26, 1, 65, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 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[66] = - { 0, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, - 3, 3, 4, 4, 1, 4, 4, 4, 4, 4, - 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 1 - } ; - -static yyconst flex_int16_t yy_base[867] = - { 0, - 0, 64, 1770, 65, 64, 66, 1772, 1774, 1774, 1774, - 70, 73, 68, 73, 80, 84, 88, 1756, 79, 96, - 100, 103, 106, 111, 114, 118, 126, 132, 138, 141, - 144, 147, 163, 177, 184, 180, 187, 1705, 94, 226, - 1774, 1774, 1749, 1774, 1774, 1756, 159, 1774, 164, 1774, - 219, 256, 167, 191, 261, 170, 196, 204, 1774, 0, - 1774, 0, 1774, 207, 268, 217, 273, 276, 279, 282, - 286, 289, 299, 302, 305, 308, 315, 318, 322, 325, - 331, 334, 340, 343, 350, 354, 357, 368, 372, 377, - 382, 387, 391, 396, 1774, 218, 430, 102, 1743, 49, - - 130, 195, 1720, 218, 362, 1715, 358, 1708, 362, 1721, - 1716, 120, 1707, 1710, 1705, 1774, 409, 425, 408, 126, - 414, 454, 0, 0, 459, 466, 462, 469, 472, 477, - 484, 487, 494, 497, 500, 503, 506, 512, 515, 521, - 526, 529, 540, 543, 552, 555, 558, 561, 564, 569, - 572, 579, 583, 586, 591, 597, 1727, 197, 1711, 284, - 389, 213, 1704, 1705, 1730, 1709, 112, 1697, 490, 1704, - 1706, 1704, 329, 1706, 287, 1688, 1774, 1690, 326, 1701, - 396, 1685, 1698, 1683, 1697, 460, 1682, 1693, 1688, 1678, - 1683, 1679, 1684, 1676, 1687, 591, 616, 619, 632, 636, - - 639, 643, 646, 649, 653, 661, 664, 667, 670, 673, - 676, 679, 682, 685, 688, 691, 699, 705, 708, 715, - 725, 732, 736, 741, 744, 750, 754, 757, 409, 1687, - 1686, 1673, 1683, 1774, 1681, 1680, 1679, 1679, 1667, 498, - 1658, 1679, 1662, 1774, 1673, 1663, 1658, 1664, 1658, 1696, - 1658, 1660, 1652, 1664, 1663, 1652, 1658, 1646, 1655, 1653, - 1644, 1654, 1642, 461, 1642, 1681, 1652, 1651, 1637, 1636, - 1774, 760, 763, 768, 771, 789, 792, 796, 805, 814, - 817, 822, 825, 828, 831, 834, 837, 840, 844, 847, - 850, 858, 861, 864, 867, 870, 879, 887, 894, 899, - - 903, 1636, 1633, 1634, 1632, 1638, 1629, 1633, 1632, 1640, - 1635, 1624, 1624, 1626, 1624, 1620, 1633, 1636, 1622, 1619, - 1615, 1624, 1619, 1625, 1625, 1615, 1617, 1613, 1615, 1619, - 1615, 1640, 1609, 1598, 1615, 1605, 1607, 592, 1640, 1597, - 906, 909, 913, 920, 917, 946, 949, 952, 925, 955, - 958, 962, 967, 973, 976, 979, 982, 985, 991, 996, - 999, 1004, 1008, 1011, 1604, 1597, 1007, 1608, 1601, 1594, - 1599, 1593, 1595, 1596, 1590, 1587, 1586, 1587, 1601, 1581, - 1596, 1581, 1594, 1596, 1579, 1586, 1590, 1589, 1587, 1578, - 1585, 1575, 1575, 1574, 1577, 1567, 1607, 1579, 1573, 1567, - - 1575, 1565, 1577, 1016, 1019, 1023, 1037, 1051, 1054, 1057, - 1061, 1069, 1072, 1075, 1079, 1083, 1088, 1091, 1100, 1103, - 1109, 1112, 1115, 1118, 1121, 1126, 1129, 1572, 1599, 1556, - 1566, 1568, 1567, 1555, 1569, 1564, 1559, 1558, 1548, 1558, - 1546, 1554, 1553, 1556, 1555, 1543, 1553, 1552, 1774, 1551, - 1544, 1549, 1542, 1558, 1574, 593, 1549, 1572, 1532, 1774, - 1538, 1528, 1537, 1530, 1538, 1529, 1537, 1539, 1535, 1527, - 1133, 1138, 1141, 1152, 1148, 1161, 1164, 1167, 1173, 1179, - 1182, 1185, 1198, 1201, 1204, 1207, 1210, 1213, 1216, 1774, - 1523, 1530, 1534, 1533, 1526, 1523, 1514, 1774, 1512, 1525, - - 513, 1774, 756, 1515, 1513, 1522, 1774, 1548, 1508, 1774, - 1774, 1514, 1774, 1517, 1498, 1506, 1505, 1513, 1506, 1502, - 1503, 1496, 1504, 1498, 1507, 1774, 1505, 1504, 1504, 1502, - 1529, 1219, 1222, 1226, 1230, 1233, 1236, 1248, 1251, 1259, - 1262, 1265, 1271, 1274, 1277, 1284, 1501, 1498, 1487, 1498, - 1524, 1482, 1494, 1493, 1496, 1480, 1481, 1481, 1488, 1473, - 1484, 1477, 253, 1475, 1471, 1470, 1774, 1471, 1481, 1480, - 1482, 1499, 1477, 1463, 1470, 1477, 1464, 1471, 1774, 1774, - 1470, 1774, 1473, 1289, 1292, 1299, 1302, 1305, 1308, 1315, - 1319, 1322, 1326, 1329, 1336, 1339, 1468, 1467, 1495, 1494, - - 1455, 1463, 1491, 1479, 1447, 1450, 551, 1460, 1444, 1446, - 1774, 1774, 1446, 1454, 1454, 1452, 1455, 1450, 1449, 1448, - 1448, 1438, 1445, 1774, 1448, 1437, 1470, 1774, 1430, 1427, - 1342, 1348, 1357, 1360, 1363, 1366, 1369, 1372, 1375, 1378, - 1774, 1428, 1424, 1423, 1422, 1464, 1420, 1424, 1432, 1424, - 1416, 1411, 1419, 1431, 1426, 1427, 1428, 1423, 1450, 1408, - 1774, 1774, 1774, 1420, 1421, 1774, 1410, 1386, 1379, 1405, - 1378, 1383, 1390, 1395, 1403, 1406, 1409, 1393, 1362, 1361, - 1349, 1338, 1350, 1346, 1319, 1327, 1318, 1300, 1310, 1284, - 1285, 1774, 1277, 1774, 1266, 1257, 1248, 1245, 1241, 1232, - - 1222, 1209, 1208, 1415, 1418, 1421, 1199, 1204, 1202, 1176, - 1159, 1158, 1143, 1174, 1136, 1169, 1135, 1130, 1105, 1097, - 1108, 1101, 1087, 1116, 1057, 1058, 1065, 1060, 1059, 1050, - 1428, 1032, 1030, 1013, 1040, 1009, 1008, 1000, 996, 988, - 990, 1021, 984, 980, 948, 947, 953, 944, 926, 935, - 933, 893, 1774, 905, 892, 900, 888, 885, 885, 861, - 844, 854, 850, 848, 850, 831, 837, 837, 811, 847, - 1774, 846, 808, 784, 763, 771, 1774, 800, 1774, 795, - 794, 764, 748, 778, 1774, 735, 775, 733, 743, 1774, - 1774, 741, 730, 702, 703, 1774, 690, 684, 678, 677, - - 675, 682, 705, 667, 660, 652, 648, 620, 1774, 595, - 592, 1774, 580, 580, 587, 578, 577, 1774, 564, 568, - 553, 532, 539, 1774, 482, 473, 446, 473, 413, 407, - 391, 386, 375, 1774, 344, 301, 1774, 1774, 330, 284, - 1774, 1774, 1774, 277, 1774, 1774, 261, 247, 192, 1774, - 175, 166, 119, 1774, 57, 1774, 1774, 1774, 1440, 1444, - 1448, 1452, 1454, 1456, 1460, 74 - } ; - -static yyconst flex_int16_t yy_def[867] = - { 0, - 858, 1, 859, 859, 860, 860, 858, 858, 858, 858, - 861, 862, 858, 863, 858, 858, 858, 858, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 861, 858, 862, 858, - 858, 858, 863, 863, 863, 863, 863, 863, 858, 865, - 858, 866, 858, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 863, 858, - 863, 863, 865, 866, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 864, 864, 864, 864, - - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - - 864, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 864, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 864, 864, 858, 858, 858, 858, - - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 864, 864, 864, 864, 864, 864, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 864, 864, 864, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 864, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 0, 858, 858, - 858, 858, 858, 858, 858, 858 - } ; - -static yyconst flex_int16_t yy_nxt[1840] = - { 0, - 8, 9, 10, 9, 11, 8, 12, 8, 8, 13, - 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 20, 19, - 19, 21, 19, 22, 19, 19, 19, 19, 19, 19, - 19, 19, 23, 24, 25, 26, 27, 19, 19, 28, - 19, 29, 19, 30, 31, 32, 19, 33, 34, 35, - 36, 37, 19, 19, 38, 39, 45, 42, 45, 40, - 43, 46, 48, 46, 48, 50, 168, 124, 51, 50, - 52, 52, 53, 54, 53, 55, 55, 59, 53, 56, - 53, 60, 57, 58, 51, 96, 52, 52, 51, 97, - - 52, 52, 857, 169, 61, 53, 56, 53, 61, 53, - 56, 53, 53, 56, 53, 53, 56, 53, 57, 58, - 53, 56, 53, 53, 56, 53, 67, 53, 56, 53, - 61, 65, 165, 236, 61, 53, 56, 53, 196, 196, - 66, 53, 56, 53, 237, 166, 62, 53, 56, 53, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 69, - 68, 48, 70, 48, 856, 71, 50, 75, 72, 191, - 50, 73, 53, 56, 53, 170, 53, 76, 53, 53, - 74, 53, 79, 192, 171, 77, 53, 56, 53, 53, - 56, 53, 78, 53, 56, 53, 53, 56, 53, 80, - - 53, 119, 53, 81, 120, 121, 82, 53, 122, 122, - 855, 83, 84, 53, 85, 53, 53, 56, 53, 96, - 854, 86, 87, 97, 168, 88, 53, 56, 53, 92, - 94, 117, 117, 89, 93, 175, 853, 91, 118, 61, - 90, 98, 99, 100, 101, 102, 103, 104, 172, 105, - 126, 229, 106, 107, 232, 108, 109, 173, 110, 111, - 112, 113, 114, 176, 118, 61, 51, 233, 52, 52, - 53, 613, 53, 55, 55, 614, 61, 53, 56, 53, - 57, 58, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 125, 53, 56, 53, 53, 56, - - 53, 852, 61, 127, 248, 851, 57, 58, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 129, 249, 850, 130, 53, 56, 53, 53, 56, 53, - 128, 53, 56, 53, 53, 56, 53, 172, 849, 131, - 53, 56, 53, 53, 56, 53, 230, 848, 132, 53, - 56, 53, 53, 56, 53, 847, 135, 134, 133, 53, - 56, 53, 136, 53, 56, 53, 53, 56, 53, 252, - 140, 138, 245, 137, 139, 253, 143, 53, 56, 53, - 141, 53, 56, 53, 246, 142, 53, 56, 53, 846, - 145, 53, 56, 53, 144, 147, 53, 56, 53, 181, - - 53, 56, 53, 182, 146, 53, 56, 53, 177, 149, - 148, 185, 183, 186, 178, 179, 187, 53, 188, 53, - 845, 117, 117, 53, 150, 53, 122, 122, 118, 61, - 844, 151, 152, 120, 120, 177, 843, 196, 196, 153, - 155, 178, 231, 154, 156, 157, 255, 158, 159, 160, - 103, 256, 842, 161, 118, 61, 106, 162, 841, 108, - 163, 239, 302, 53, 164, 53, 122, 122, 53, 56, - 53, 53, 56, 53, 58, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 333, 197, 53, 56, 53, 198, - 840, 334, 199, 53, 56, 53, 53, 56, 53, 839, - - 58, 261, 200, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 53, 56, 53, 53, 56, 53, 838, 262, - 201, 53, 56, 53, 53, 56, 53, 837, 202, 205, - 53, 56, 53, 556, 203, 53, 56, 53, 53, 56, - 53, 204, 239, 240, 209, 241, 206, 557, 207, 53, - 56, 53, 53, 56, 53, 309, 836, 208, 310, 210, - 211, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 53, 56, 53, 53, 56, 53, 835, 212, 53, 56, - 53, 53, 56, 53, 651, 652, 213, 214, 53, 56, - 53, 215, 53, 56, 53, 53, 56, 53, 834, 216, - - 53, 56, 53, 196, 196, 217, 53, 56, 53, 400, - 517, 61, 833, 218, 401, 518, 219, 223, 832, 221, - 220, 831, 830, 222, 224, 53, 56, 53, 53, 56, - 53, 829, 225, 828, 827, 227, 826, 61, 228, 825, - 272, 53, 56, 53, 226, 53, 56, 53, 53, 56, - 53, 274, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 273, 53, 56, 53, 824, 275, 276, 277, 278, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 53, 56, 53, - - 53, 56, 53, 279, 281, 823, 822, 280, 53, 56, - 53, 821, 283, 282, 53, 56, 53, 53, 56, 53, - 286, 820, 819, 287, 53, 56, 53, 818, 284, 817, - 288, 816, 815, 285, 53, 56, 53, 289, 814, 813, - 291, 53, 56, 53, 292, 53, 56, 53, 812, 290, - 53, 56, 53, 53, 56, 53, 811, 294, 295, 53, - 56, 53, 293, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 53, 56, 53, 558, 296, 53, 56, 53, - 53, 56, 53, 559, 810, 298, 809, 808, 341, 560, - 807, 299, 806, 297, 805, 804, 343, 342, 53, 56, - - 53, 53, 56, 53, 803, 53, 56, 53, 802, 300, - 344, 801, 800, 301, 53, 56, 53, 799, 345, 347, - 798, 797, 348, 53, 56, 53, 53, 56, 53, 796, - 346, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 795, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 349, 794, 793, 350, 792, 53, 56, 53, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 791, 354, 790, 789, 351, 355, 53, 56, - 53, 788, 352, 787, 786, 353, 53, 56, 53, 785, - - 784, 356, 357, 53, 56, 53, 783, 358, 53, 56, - 53, 360, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 404, 53, 56, 53, 359, 53, 56, 53, 53, - 56, 53, 361, 413, 53, 56, 53, 407, 408, 782, - 363, 781, 405, 364, 780, 779, 409, 362, 778, 410, - 777, 776, 406, 411, 412, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 415, 53, 56, 53, 775, 414, 53, 56, 53, 774, - 773, 416, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 772, 771, 418, - - 53, 56, 53, 770, 417, 53, 56, 53, 53, 56, - 53, 769, 420, 53, 56, 53, 419, 53, 56, 53, - 53, 56, 53, 430, 431, 53, 56, 53, 53, 56, - 53, 421, 53, 56, 53, 768, 422, 767, 766, 432, - 433, 765, 471, 764, 434, 424, 53, 56, 53, 425, - 763, 762, 473, 761, 423, 760, 472, 759, 758, 426, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 427, - 53, 56, 53, 476, 474, 757, 756, 475, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 477, 53, 56, - 53, 481, 53, 56, 53, 755, 480, 53, 56, 53, - - 53, 56, 53, 754, 478, 753, 752, 482, 479, 53, - 56, 53, 53, 56, 53, 751, 750, 483, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 53, 56, 53, 749, 485, 53, 56, 53, 53, 56, - 53, 748, 53, 56, 53, 747, 484, 53, 56, 53, - 53, 56, 53, 746, 487, 745, 486, 53, 56, 53, - 488, 53, 56, 53, 533, 489, 532, 534, 744, 535, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 743, - 742, 536, 53, 56, 53, 537, 741, 538, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 539, 541, 740, - - 543, 739, 738, 540, 737, 736, 542, 53, 56, 53, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 53, - 56, 53, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 735, 53, 56, 53, 544, 53, - 56, 53, 53, 56, 53, 53, 56, 53, 734, 545, - 733, 584, 585, 732, 546, 588, 730, 53, 56, 53, - 53, 56, 53, 729, 586, 589, 728, 587, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 590, 591, 592, - 53, 56, 53, 53, 56, 53, 53, 56, 53, 727, - 726, 595, 596, 53, 56, 53, 725, 594, 53, 56, - - 53, 53, 56, 53, 724, 593, 723, 632, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 722, 721, 633, 631, 53, 56, 53, 634, 53, 56, - 53, 53, 56, 53, 635, 53, 56, 53, 53, 56, - 53, 720, 719, 637, 638, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 718, 717, 636, 53, 56, 53, - 716, 715, 640, 714, 672, 639, 53, 56, 53, 53, - 56, 53, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 53, 56, 53, 53, 56, 53, 53, 56, 53, - 713, 673, 53, 56, 53, 675, 712, 711, 674, 53, - - 56, 53, 710, 676, 53, 56, 53, 709, 708, 704, - 707, 677, 53, 56, 53, 53, 56, 53, 53, 56, - 53, 703, 702, 705, 53, 56, 53, 53, 56, 53, - 53, 56, 53, 701, 731, 700, 706, 53, 56, 53, - 41, 41, 41, 41, 44, 44, 44, 44, 47, 47, - 47, 47, 49, 49, 49, 49, 56, 56, 64, 64, - 123, 699, 123, 123, 698, 697, 696, 695, 694, 693, - 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, - 682, 681, 680, 679, 678, 671, 670, 669, 668, 667, - 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, - - 656, 655, 654, 653, 650, 649, 648, 647, 646, 645, - 644, 643, 642, 641, 630, 629, 628, 627, 626, 625, - 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, - 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, - 602, 601, 600, 599, 598, 597, 583, 582, 581, 580, - 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, - 569, 568, 567, 566, 565, 564, 563, 562, 561, 555, - 554, 553, 552, 551, 550, 549, 548, 547, 531, 530, - 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, - 519, 516, 515, 514, 513, 512, 511, 510, 509, 508, - - 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, - 497, 496, 495, 494, 493, 492, 491, 490, 470, 469, - 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, - 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, - 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, - 438, 437, 436, 435, 429, 428, 403, 402, 399, 398, - 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, - 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, - 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, - 367, 366, 365, 309, 340, 339, 338, 337, 336, 335, - - 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, - 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, - 312, 311, 308, 307, 306, 305, 304, 303, 256, 252, - 245, 271, 270, 269, 268, 267, 266, 265, 264, 263, - 260, 259, 258, 257, 254, 251, 250, 247, 244, 243, - 242, 238, 235, 234, 191, 186, 170, 165, 195, 194, - 193, 190, 189, 184, 180, 174, 167, 116, 115, 95, - 63, 858, 42, 7, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858 - } ; - -static yyconst flex_int16_t yy_chk[1840] = - { 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, 2, 5, 4, 6, 2, - 4, 5, 11, 6, 11, 12, 100, 866, 13, 12, - 13, 13, 14, 14, 14, 14, 14, 15, 19, 19, - 19, 15, 14, 14, 16, 39, 16, 16, 17, 39, - - 17, 17, 855, 100, 16, 20, 20, 20, 17, 21, - 21, 21, 22, 22, 22, 23, 23, 23, 14, 14, - 24, 24, 24, 25, 25, 25, 22, 26, 26, 26, - 16, 20, 98, 167, 17, 27, 27, 27, 120, 120, - 21, 28, 28, 28, 167, 98, 16, 29, 29, 29, - 30, 30, 30, 31, 31, 31, 32, 32, 32, 24, - 23, 47, 24, 47, 853, 24, 49, 27, 25, 112, - 49, 26, 33, 33, 33, 101, 53, 27, 53, 56, - 26, 56, 30, 112, 101, 28, 34, 34, 34, 36, - 36, 36, 29, 35, 35, 35, 37, 37, 37, 31, - - 54, 54, 54, 32, 57, 57, 32, 57, 57, 57, - 852, 33, 33, 58, 33, 58, 64, 64, 64, 96, - 851, 33, 34, 96, 158, 34, 66, 66, 66, 36, - 37, 51, 51, 34, 36, 104, 849, 35, 51, 51, - 34, 40, 40, 40, 40, 40, 40, 40, 102, 40, - 66, 158, 40, 40, 162, 40, 40, 102, 40, 40, - 40, 40, 40, 104, 51, 51, 52, 162, 52, 52, - 55, 563, 55, 55, 55, 563, 52, 65, 65, 65, - 55, 55, 67, 67, 67, 68, 68, 68, 69, 69, - 69, 70, 70, 70, 65, 71, 71, 71, 72, 72, - - 72, 848, 52, 67, 175, 847, 55, 55, 73, 73, - 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, - 69, 175, 844, 70, 77, 77, 77, 78, 78, 78, - 68, 79, 79, 79, 80, 80, 80, 160, 840, 71, - 81, 81, 81, 82, 82, 82, 160, 839, 72, 83, - 83, 83, 84, 84, 84, 836, 75, 74, 73, 85, - 85, 85, 76, 86, 86, 86, 87, 87, 87, 179, - 80, 78, 173, 77, 79, 179, 82, 88, 88, 88, - 81, 89, 89, 89, 173, 81, 90, 90, 90, 835, - 84, 91, 91, 91, 83, 86, 92, 92, 92, 107, - - 93, 93, 93, 107, 85, 94, 94, 94, 105, 87, - 86, 109, 107, 109, 105, 105, 109, 119, 109, 119, - 833, 117, 117, 121, 88, 121, 121, 121, 117, 117, - 832, 89, 90, 118, 118, 161, 831, 118, 118, 91, - 93, 161, 161, 92, 94, 97, 181, 97, 97, 97, - 97, 181, 830, 97, 117, 117, 97, 97, 829, 97, - 97, 229, 229, 122, 97, 122, 122, 122, 125, 125, - 125, 127, 127, 127, 122, 126, 126, 126, 128, 128, - 128, 129, 129, 129, 264, 125, 130, 130, 130, 126, - 828, 264, 126, 131, 131, 131, 132, 132, 132, 827, - - 122, 186, 127, 133, 133, 133, 134, 134, 134, 135, - 135, 135, 136, 136, 136, 137, 137, 137, 826, 186, - 128, 138, 138, 138, 139, 139, 139, 825, 129, 132, - 140, 140, 140, 501, 130, 141, 141, 141, 142, 142, - 142, 131, 169, 169, 136, 169, 133, 501, 134, 143, - 143, 143, 144, 144, 144, 240, 823, 135, 240, 138, - 139, 145, 145, 145, 146, 146, 146, 147, 147, 147, - 148, 148, 148, 149, 149, 149, 822, 140, 150, 150, - 150, 151, 151, 151, 607, 607, 141, 142, 152, 152, - 152, 143, 153, 153, 153, 154, 154, 154, 821, 144, - - 155, 155, 155, 196, 196, 145, 156, 156, 156, 338, - 456, 196, 820, 146, 338, 456, 147, 151, 819, 149, - 148, 817, 816, 150, 152, 197, 197, 197, 198, 198, - 198, 815, 153, 814, 813, 155, 811, 196, 156, 810, - 198, 199, 199, 199, 154, 200, 200, 200, 201, 201, - 201, 200, 202, 202, 202, 203, 203, 203, 204, 204, - 204, 199, 205, 205, 205, 808, 200, 200, 200, 200, - 206, 206, 206, 207, 207, 207, 208, 208, 208, 209, - 209, 209, 210, 210, 210, 211, 211, 211, 212, 212, - 212, 213, 213, 213, 214, 214, 214, 215, 215, 215, - - 216, 216, 216, 203, 205, 807, 806, 204, 217, 217, - 217, 805, 208, 207, 218, 218, 218, 219, 219, 219, - 212, 804, 803, 213, 220, 220, 220, 802, 209, 801, - 214, 800, 799, 211, 221, 221, 221, 215, 798, 797, - 217, 222, 222, 222, 217, 223, 223, 223, 795, 216, - 224, 224, 224, 225, 225, 225, 794, 219, 220, 226, - 226, 226, 218, 227, 227, 227, 228, 228, 228, 272, - 272, 272, 273, 273, 273, 503, 221, 274, 274, 274, - 275, 275, 275, 503, 793, 224, 792, 789, 272, 503, - 788, 225, 787, 222, 786, 784, 274, 273, 276, 276, - - 276, 277, 277, 277, 783, 278, 278, 278, 782, 226, - 275, 781, 780, 228, 279, 279, 279, 778, 276, 278, - 776, 775, 278, 280, 280, 280, 281, 281, 281, 774, - 277, 282, 282, 282, 283, 283, 283, 284, 284, 284, - 285, 285, 285, 286, 286, 286, 287, 287, 287, 288, - 288, 288, 773, 289, 289, 289, 290, 290, 290, 291, - 291, 291, 281, 772, 770, 282, 769, 292, 292, 292, - 293, 293, 293, 294, 294, 294, 295, 295, 295, 296, - 296, 296, 768, 288, 767, 766, 285, 289, 297, 297, - 297, 765, 286, 764, 763, 287, 298, 298, 298, 762, - - 761, 291, 292, 299, 299, 299, 760, 294, 300, 300, - 300, 296, 301, 301, 301, 341, 341, 341, 342, 342, - 342, 341, 343, 343, 343, 295, 345, 345, 345, 344, - 344, 344, 298, 345, 349, 349, 349, 344, 344, 759, - 300, 758, 342, 301, 757, 756, 344, 299, 755, 344, - 754, 752, 343, 344, 344, 346, 346, 346, 347, 347, - 347, 348, 348, 348, 350, 350, 350, 351, 351, 351, - 347, 352, 352, 352, 751, 346, 353, 353, 353, 750, - 749, 348, 354, 354, 354, 355, 355, 355, 356, 356, - 356, 357, 357, 357, 358, 358, 358, 748, 747, 351, - - 359, 359, 359, 746, 350, 360, 360, 360, 361, 361, - 361, 745, 353, 362, 362, 362, 352, 363, 363, 363, - 364, 364, 364, 367, 367, 404, 404, 404, 405, 405, - 405, 354, 406, 406, 406, 744, 356, 743, 742, 367, - 367, 741, 404, 740, 367, 361, 407, 407, 407, 362, - 739, 738, 407, 737, 360, 736, 406, 735, 734, 363, - 408, 408, 408, 409, 409, 409, 410, 410, 410, 364, - 411, 411, 411, 410, 408, 733, 732, 409, 412, 412, - 412, 413, 413, 413, 414, 414, 414, 411, 415, 415, - 415, 414, 416, 416, 416, 730, 413, 417, 417, 417, - - 418, 418, 418, 729, 412, 728, 727, 415, 412, 419, - 419, 419, 420, 420, 420, 726, 725, 416, 421, 421, - 421, 422, 422, 422, 423, 423, 423, 424, 424, 424, - 425, 425, 425, 724, 418, 426, 426, 426, 427, 427, - 427, 723, 471, 471, 471, 722, 417, 472, 472, 472, - 473, 473, 473, 721, 421, 720, 419, 475, 475, 475, - 423, 474, 474, 474, 472, 425, 471, 473, 719, 474, - 476, 476, 476, 477, 477, 477, 478, 478, 478, 718, - 717, 475, 479, 479, 479, 476, 716, 477, 480, 480, - 480, 481, 481, 481, 482, 482, 482, 478, 480, 715, - - 482, 714, 713, 479, 712, 711, 481, 483, 483, 483, - 484, 484, 484, 485, 485, 485, 486, 486, 486, 487, - 487, 487, 488, 488, 488, 489, 489, 489, 532, 532, - 532, 533, 533, 533, 710, 534, 534, 534, 483, 535, - 535, 535, 536, 536, 536, 537, 537, 537, 709, 485, - 708, 533, 534, 707, 487, 537, 703, 538, 538, 538, - 539, 539, 539, 702, 535, 538, 701, 536, 540, 540, - 540, 541, 541, 541, 542, 542, 542, 539, 540, 541, - 543, 543, 543, 544, 544, 544, 545, 545, 545, 700, - 699, 544, 544, 546, 546, 546, 698, 543, 584, 584, - - 584, 585, 585, 585, 697, 542, 696, 585, 586, 586, - 586, 587, 587, 587, 588, 588, 588, 589, 589, 589, - 695, 693, 588, 584, 590, 590, 590, 589, 591, 591, - 591, 592, 592, 592, 590, 593, 593, 593, 594, 594, - 594, 691, 690, 593, 593, 595, 595, 595, 596, 596, - 596, 631, 631, 631, 689, 688, 592, 632, 632, 632, - 687, 686, 596, 685, 632, 595, 633, 633, 633, 634, - 634, 634, 635, 635, 635, 636, 636, 636, 637, 637, - 637, 638, 638, 638, 639, 639, 639, 640, 640, 640, - 684, 633, 672, 672, 672, 638, 683, 682, 637, 673, - - 673, 673, 681, 639, 674, 674, 674, 680, 679, 672, - 678, 640, 675, 675, 675, 676, 676, 676, 677, 677, - 677, 671, 670, 674, 704, 704, 704, 705, 705, 705, - 706, 706, 706, 669, 704, 668, 675, 731, 731, 731, - 859, 859, 859, 859, 860, 860, 860, 860, 861, 861, - 861, 861, 862, 862, 862, 862, 863, 863, 864, 864, - 865, 667, 865, 865, 665, 664, 660, 659, 658, 657, - 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, - 646, 645, 644, 643, 642, 630, 629, 627, 626, 625, - 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, - - 613, 610, 609, 608, 606, 605, 604, 603, 602, 601, - 600, 599, 598, 597, 583, 581, 578, 577, 576, 575, - 574, 573, 572, 571, 570, 569, 568, 566, 565, 564, - 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, - 552, 551, 550, 549, 548, 547, 531, 530, 529, 528, - 527, 525, 524, 523, 522, 521, 520, 519, 518, 517, - 516, 515, 514, 512, 509, 508, 506, 505, 504, 500, - 499, 497, 496, 495, 494, 493, 492, 491, 470, 469, - 468, 467, 466, 465, 464, 463, 462, 461, 459, 458, - 457, 455, 454, 453, 452, 451, 450, 448, 447, 446, - - 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, - 435, 434, 433, 432, 431, 430, 429, 428, 403, 402, - 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, - 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, - 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, - 371, 370, 369, 368, 366, 365, 340, 339, 337, 336, - 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, - 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, - 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, - 305, 304, 303, 302, 270, 269, 268, 267, 266, 265, - - 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, - 253, 252, 251, 250, 249, 248, 247, 246, 245, 243, - 242, 241, 239, 238, 237, 236, 235, 233, 232, 231, - 230, 195, 194, 193, 192, 191, 190, 189, 188, 187, - 185, 184, 183, 182, 180, 178, 176, 174, 172, 171, - 170, 168, 166, 165, 164, 163, 159, 157, 115, 114, - 113, 111, 110, 108, 106, 103, 99, 46, 43, 38, - 18, 7, 3, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858 - } ; - -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 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -/* - * The SIP lexer. - * - * Copyright (c) 2010 Riverbank Computing Limited <info@riverbankcomputing.com> - * - * This file is part of SIP. - * - * This copy of SIP is licensed for use under the terms of the SIP License - * Agreement. See the file LICENSE for more details. - * - * This copy of SIP may also used under the terms of the GNU General Public - * License v2 or v3 as published by the Free Software Foundation which can be - * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. - * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ -#line 20 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#include "sip.h" -#include "parser.h" - - -#ifndef FLEX_SCANNER -#error "Only flex is supported at the moment" -#endif - - -#define YY_NO_UNISTD_H -#define YY_FATAL_ERROR(s) fatallex(s) - -#define MAX_INCLUDE_DEPTH 10 -#define MAX_CODE_LINE_LENGTH 1000 - - -static struct inputFile { - int lineno; /* The line number. */ - YY_BUFFER_STATE bs; /* The flex buffer state handle. */ - char *name; /* The file name. */ - char *cwd; /* The path part of the file name. */ - parserContext pc; /* The parser context. */ -} inputFileStack[MAX_INCLUDE_DEPTH]; - -static int currentFile = -1; /* Index of the current input file. */ -static char codeLine[MAX_CODE_LINE_LENGTH + 2]; /* The current code line. */ -static int codeIdx = -1; /* Index of next code character. */ - -static FILE *openFile(const char *); -static void fatallex(char *); - - -#line 1202 "<stdout>" - -#define INITIAL 0 -#define code 1 -#define ccomment 2 - -#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 <unistd.h> -#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 ); - -int 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 -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#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 do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#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 = '*'; \ - 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 -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - -#line 60 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" - - -#line 1397 "<stdout>" - - 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 - { - 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 >= 859 ) - 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] != 1774 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 62 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_API;} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 63 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_DEFENCODING;} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 64 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PLUGIN;} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 65 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_INCLUDE;} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 66 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_OPTINCLUDE;} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 67 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_IMPORT;} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 68 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_MODULE;} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 69 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_CMODULE;} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 70 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_CONSMODULE;} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 71 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_COMPOMODULE;} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 72 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_TIMELINE;} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 73 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PLATFORMS;} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 74 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_FEATURE;} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 75 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_LICENSE;} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 76 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_MAPPEDTYPE;} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 77 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_EXCEPTION;} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 78 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_IF;} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 79 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_DEFMETATYPE;} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 80 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_DEFSUPERTYPE;} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 81 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_END;} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 82 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_CLASS;} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 83 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_STRUCT;} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 84 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PUBLIC;} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 85 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PROTECTED;} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 86 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PRIVATE;} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 87 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIGNALS;} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 88 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIGNALS;} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 89 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIGNAL_METHOD;} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 90 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SLOTS;} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 91 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SLOTS;} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 92 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SLOT_METHOD;} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 93 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_CHAR;} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 94 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_WCHAR_T;} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 95 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_BOOL;} - YY_BREAK -case 35: -YY_RULE_SETUP -#line 96 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SHORT;} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 97 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_INT;} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 98 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_LONG;} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 99 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_FLOAT;} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 100 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_DOUBLE;} - YY_BREAK -case 40: -YY_RULE_SETUP -#line 101 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_VOID;} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 102 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_VIRTUAL;} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 103 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_ENUM;} - YY_BREAK -case 43: -YY_RULE_SETUP -#line 104 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIGNED;} - YY_BREAK -case 44: -YY_RULE_SETUP -#line 105 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_UNSIGNED;} - YY_BREAK -case 45: -YY_RULE_SETUP -#line 106 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_CONST;} - YY_BREAK -case 46: -YY_RULE_SETUP -#line 107 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_STATIC;} - YY_BREAK -case 47: -YY_RULE_SETUP -#line 108 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_TRUE;} - YY_BREAK -case 48: -YY_RULE_SETUP -#line 109 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_FALSE;} - YY_BREAK -case 49: -YY_RULE_SETUP -#line 110 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_NULL;} - YY_BREAK -case 50: -YY_RULE_SETUP -#line 111 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_TYPEDEF;} - YY_BREAK -case 51: -YY_RULE_SETUP -#line 112 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_NAMESPACE;} - YY_BREAK -case 52: -YY_RULE_SETUP -#line 113 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_OPERATOR;} - YY_BREAK -case 53: -YY_RULE_SETUP -#line 114 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_THROW;} - YY_BREAK -case 54: -YY_RULE_SETUP -#line 115 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_EXPLICIT;} - YY_BREAK -case 55: -YY_RULE_SETUP -#line 116 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_TEMPLATE;} - YY_BREAK -case 56: -YY_RULE_SETUP -#line 117 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SCOPE;} - YY_BREAK -case 57: -YY_RULE_SETUP -#line 118 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_LOGICAL_OR;} - YY_BREAK -case 58: -YY_RULE_SETUP -#line 119 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYOBJECT;} - YY_BREAK -case 59: -YY_RULE_SETUP -#line 120 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYTUPLE;} - YY_BREAK -case 60: -YY_RULE_SETUP -#line 121 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYLIST;} - YY_BREAK -case 61: -YY_RULE_SETUP -#line 122 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYDICT;} - YY_BREAK -case 62: -YY_RULE_SETUP -#line 123 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYCALLABLE;} - YY_BREAK -case 63: -YY_RULE_SETUP -#line 124 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYSLICE;} - YY_BREAK -case 64: -YY_RULE_SETUP -#line 125 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_PYTYPE;} - YY_BREAK -case 65: -YY_RULE_SETUP -#line 126 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPSIGNAL;} - YY_BREAK -case 66: -YY_RULE_SETUP -#line 127 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPSLOT;} - YY_BREAK -case 67: -YY_RULE_SETUP -#line 128 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPANYSLOT;} - YY_BREAK -case 68: -YY_RULE_SETUP -#line 129 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPRXCON;} - YY_BREAK -case 69: -YY_RULE_SETUP -#line 130 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPRXDIS;} - YY_BREAK -case 70: -YY_RULE_SETUP -#line 131 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPSLOTCON;} - YY_BREAK -case 71: -YY_RULE_SETUP -#line 132 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_SIPSLOTDIS;} - YY_BREAK -case 72: -YY_RULE_SETUP -#line 133 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_TQOBJECT;} - YY_BREAK -case 73: -YY_RULE_SETUP -#line 134 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{return TK_ELLIPSIS;} - YY_BREAK -case 74: -YY_RULE_SETUP -#line 137 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* Ignore whitespace. */ - ; -} - YY_BREAK -case 75: -/* rule 75 can match eol */ -YY_RULE_SETUP -#line 141 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* Maintain the line number. */ - ++inputFileStack[currentFile].lineno; - - if (codeIdx == 0) - { - BEGIN code; - } -} - YY_BREAK -case 76: -YY_RULE_SETUP -#line 150 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* Ignore C++ style comments. */ - ; -} - YY_BREAK -case 77: -YY_RULE_SETUP -#line 155 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* A signed decimal number. */ - yylval.number = strtol(yytext,NULL,0); - return TK_NUMBER; -} - YY_BREAK -case 78: -YY_RULE_SETUP -#line 161 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{/* A floating point number. */ - yylval.real = strtod(yytext,NULL); - return TK_REAL; -} - YY_BREAK -case 79: -YY_RULE_SETUP -#line 167 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* An unsigned hexadecimal number. */ - yylval.number = strtol(yytext,NULL,16); - return TK_NUMBER; -} - YY_BREAK -case 80: -YY_RULE_SETUP -#line 173 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* An identifier name. */ - yylval.text = sipStrdup(yytext); - return TK_NAME; -} - YY_BREAK -case 81: -YY_RULE_SETUP -#line 179 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* A relative pathname. */ - yylval.text = sipStrdup(yytext); - return TK_PATHNAME; -} - YY_BREAK -case 82: -/* rule 82 can match eol */ -YY_RULE_SETUP -#line 185 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* A double-quoted string. */ - char *dp, *sp; - - /* Copy the string without the quotes. */ - - yylval.text = sipMalloc(strlen(yytext) + 1); - - dp = yylval.text; - sp = yytext; - - while (*sp != '\0') - { - if (*sp != '"') - *dp++ = *sp; - - ++sp; - } - - *dp = '\0'; - - return TK_STRING; -} - YY_BREAK -case 83: -/* rule 83 can match eol */ -YY_RULE_SETUP -#line 209 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* A single-quoted character. */ - if (strlen(yytext) != 3) - fatallex("Exactly one character expected between single quotes"); - - yylval.qchar = yytext[1]; - - return TK_TQCHAR; -} - YY_BREAK -case 84: -YY_RULE_SETUP -#line 219 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* Ignore C-style comments. */ - BEGIN ccomment; -} - YY_BREAK -case 85: -/* rule 85 can match eol */ -YY_RULE_SETUP -#line 222 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ - ++inputFileStack[currentFile].lineno; -} - YY_BREAK -case 86: -YY_RULE_SETUP -#line 225 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ - BEGIN INITIAL; -} - YY_BREAK -case 87: -YY_RULE_SETUP -#line 228 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ - ; -} - YY_BREAK -case 88: -YY_RULE_SETUP -#line 233 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The software license. */ - codeIdx = 0; - return TK_COPYING; -} - YY_BREAK -case 89: -YY_RULE_SETUP -#line 238 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a from-type code block. */ - codeIdx = 0; - return TK_FROMTYPE; -} - YY_BREAK -case 90: -YY_RULE_SETUP -#line 243 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a to-type code block. */ - codeIdx = 0; - return TK_TOTYPE; -} - YY_BREAK -case 91: -YY_RULE_SETUP -#line 248 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a to-sub-class code block. */ - codeIdx = 0; - return TK_TOSUBCLASS; -} - YY_BREAK -case 92: -YY_RULE_SETUP -#line 253 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of an exported header code block. */ - codeIdx = 0; - return TK_EXPHEADERCODE; -} - YY_BREAK -case 93: -YY_RULE_SETUP -#line 258 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a module header code block. */ - codeIdx = 0; - return TK_MODHEADERCODE; -} - YY_BREAK -case 94: -YY_RULE_SETUP -#line 263 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a type header code block. */ - codeIdx = 0; - return TK_TYPEHEADERCODE; -} - YY_BREAK -case 95: -YY_RULE_SETUP -#line 268 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a pre-initialisation code block. */ - codeIdx = 0; - return TK_PREINITCODE; -} - YY_BREAK -case 96: -YY_RULE_SETUP -#line 273 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of an initialisation code block. */ - codeIdx = 0; - return TK_INITCODE; -} - YY_BREAK -case 97: -YY_RULE_SETUP -#line 278 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a post-initialisation code block. */ - codeIdx = 0; - return TK_POSTINITCODE; -} - YY_BREAK -case 98: -YY_RULE_SETUP -#line 283 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a unit code block. */ - codeIdx = 0; - return TK_UNITCODE; -} - YY_BREAK -case 99: -YY_RULE_SETUP -#line 288 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a module code block. */ - codeIdx = 0; - return TK_MODCODE; -} - YY_BREAK -case 100: -YY_RULE_SETUP -#line 293 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a type code block. */ - codeIdx = 0; - return TK_TYPECODE; -} - YY_BREAK -case 101: -YY_RULE_SETUP -#line 298 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a C++ method code block. */ - codeIdx = 0; - return TK_METHODCODE; -} - YY_BREAK -case 102: -YY_RULE_SETUP -#line 303 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a C++ virtual code block. */ - codeIdx = 0; - return TK_VIRTUALCATCHERCODE; -} - YY_BREAK -case 103: -YY_RULE_SETUP -#line 308 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a traverse code block. */ - codeIdx = 0; - return TK_TRAVERSECODE; -} - YY_BREAK -case 104: -YY_RULE_SETUP -#line 313 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a clear code block. */ - codeIdx = 0; - return TK_CLEARCODE; -} - YY_BREAK -case 105: -YY_RULE_SETUP -#line 318 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a get buffer code block. */ - codeIdx = 0; - return TK_GETBUFFERCODE; -} - YY_BREAK -case 106: -YY_RULE_SETUP -#line 323 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a release buffer code block. */ - codeIdx = 0; - return TK_RELEASEBUFFERCODE; -} - YY_BREAK -case 107: -YY_RULE_SETUP -#line 328 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a read buffer code block. */ - codeIdx = 0; - return TK_READBUFFERCODE; -} - YY_BREAK -case 108: -YY_RULE_SETUP -#line 333 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a write buffer code block. */ - codeIdx = 0; - return TK_WRITEBUFFERCODE; -} - YY_BREAK -case 109: -YY_RULE_SETUP -#line 338 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a segment count code block. */ - codeIdx = 0; - return TK_SEGCOUNTCODE; -} - YY_BREAK -case 110: -YY_RULE_SETUP -#line 343 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a char buffer code block. */ - codeIdx = 0; - return TK_CHARBUFFERCODE; -} - YY_BREAK -case 111: -YY_RULE_SETUP -#line 348 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a pickle code block. */ - codeIdx = 0; - return TK_PICKLECODE; -} - YY_BREAK -case 112: -YY_RULE_SETUP -#line 353 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a pre-Python code block. */ - codeIdx = 0; - return TK_PREPYCODE; -} - YY_BREAK -case 113: -YY_RULE_SETUP -#line 358 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a raise exception code block. */ - codeIdx = 0; - return TK_RAISECODE; -} - YY_BREAK -case 114: -YY_RULE_SETUP -#line 363 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a docstring block. */ - codeIdx = 0; - return TK_DOCSTRING; -} - YY_BREAK -case 115: -YY_RULE_SETUP -#line 368 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a documentation block. */ - codeIdx = 0; - return TK_DOC; -} - YY_BREAK -case 116: -YY_RULE_SETUP -#line 373 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of an exported documentation block. */ - codeIdx = 0; - return TK_EXPORTEDDOC; -} - YY_BREAK -case 117: -YY_RULE_SETUP -#line 378 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a Makefile code block. */ - codeIdx = 0; - return TK_MAKEFILE; -} - YY_BREAK -case 118: -YY_RULE_SETUP -#line 383 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of an access code block. */ - codeIdx = 0; - return TK_ACCESSCODE; -} - YY_BREAK -case 119: -YY_RULE_SETUP -#line 388 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a get code block. */ - codeIdx = 0; - return TK_GETCODE; -} - YY_BREAK -case 120: -YY_RULE_SETUP -#line 393 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The start of a set code block. */ - codeIdx = 0; - return TK_SETCODE; -} - YY_BREAK -case 121: -YY_RULE_SETUP -#line 398 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The end of a code block. */ - BEGIN INITIAL; - codeIdx = -1; - return TK_END; -} - YY_BREAK -case 122: -/* rule 122 can match eol */ -YY_RULE_SETUP -#line 404 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The end of a code line . */ - struct inputFile *ifp; - - codeLine[codeIdx] = '\n'; - codeLine[codeIdx + 1] = '\0'; - codeIdx = 0; - - ifp = &inputFileStack[currentFile]; - - yylval.codeb = sipMalloc(sizeof (codeBlock)); - - yylval.codeb -> frag = sipStrdup(codeLine); - yylval.codeb -> linenr = ifp -> lineno++; - yylval.codeb -> filename = sipStrdup(ifp -> name); - yylval.codeb -> next = NULL; - - return TK_CODELINE; -} - YY_BREAK -case 123: -YY_RULE_SETUP -#line 423 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* The contents of a code line. */ - if (codeIdx == MAX_CODE_LINE_LENGTH) - fatallex("Line is too long"); - - codeLine[codeIdx++] = yytext[0]; -} - YY_BREAK -case 124: -YY_RULE_SETUP -#line 430 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -{ /* Anything else is returned as is. */ - return yytext[0]; -} - YY_BREAK -case 125: -YY_RULE_SETUP -#line 434 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" -ECHO; - YY_BREAK -#line 2300 "<stdout>" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(code): -case YY_STATE_EOF(ccomment): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - 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) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - 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 - { - int 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 ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - 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), (size_t) 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) -{ - yy_state_type yy_current_state; - 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 ) - { - 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 >= 859 ) - 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 ) -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - 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 >= 859 ) - 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 == 858); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, char * yy_bp ) -{ - 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. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - 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; - - (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 */ - int 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 EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + 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'); - - 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) -{ - int 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 yybytes the byte buffer to scan - * @param _yybytes_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, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int 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. - * - */ -int 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. - */ - - (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 ) -{ - 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 ) -{ - 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 434 "/TEMP2/sip4-tqt-3.5.14/sipgen/lexer.l" - - - -/* - * Hook into EOF handling. Return 0 if there is more to process. - */ - -int yywrap() -{ - char *cwd; - struct inputFile *ifp; - - if ((cwd = inputFileStack[currentFile].cwd) != NULL) - free(cwd); - - ifp = &inputFileStack[currentFile--]; - - /* Tell the parser if this is the end of a file. */ - - parserEOF(ifp -> name, &ifp -> pc); - - /* Tidy up this file. */ - - fclose(yyin); - free(ifp -> name); - - /* See if this was the original file. */ - - if (currentFile < 0) - return 1; - - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(ifp -> bs); - - return 0; -} - - -/* - * Set up an input file to be read by the lexer, opening it if necessary. TRUE - * is returned if the file has not already been read. - */ -int setInputFile(FILE *open_fp, parserContext *pc, int optional) -{ - static stringList *all = NULL; - char *cwd, *fullname = NULL; - FILE *fp = open_fp; - - if (currentFile >= MAX_INCLUDE_DEPTH - 1) - fatal("Too many nested %%Include, %%OptionalInclude or %%Import statements\n"); - - if (fp != NULL || (fp = openFile(pc->filename)) != NULL) - fullname = sipStrdup(pc->filename); - else - { - char *cwd; - - /* Try the directory that contains the current file. */ - if (currentFile >= 0 && (cwd = inputFileStack[currentFile].cwd) != NULL) - { - fullname = concat(cwd, "/", pc->filename, NULL); - - if ((fp = openFile(fullname)) == NULL) - { - free(fullname); - fullname = NULL; - } - } - } - - /* Try the include path if we haven't found anything yet. */ - if (fullname == NULL) - { - stringList *sl; - - fullname = NULL; - - for (sl = includeDirList; sl != NULL; sl = sl -> next) - { - if (fullname != NULL) - free(fullname); - - fullname = concat(sl->s, "/", pc->filename, NULL); - - if ((fp = openFile(fullname)) != NULL) - break; - } - - if (fp == NULL) - { - if (optional) - return FALSE; - - fatal("Unable to find file \"%s\"\n", pc->filename); - } - } - - /* - * If we have just opened the file, make sure that we haven't already read - * it. While it should never happen with normal modules (if the user - * doesn't specify recursive %Imports or %Includes) it is likely to happen - * with consolidated modules. - */ - if (open_fp == NULL) - { - stringList *sl; - - for (sl = all; sl != NULL; sl = sl->next) - if (strcmp(sl->s, fullname) == 0) - { - fclose(fp); - return FALSE; - } - } - - /* Remember the filename. */ - appendString(&all, sipStrdup(fullname)); - - yyin = fp; - - ++currentFile; - - /* Remember the directory containing the new file and make it "current". */ - if ((cwd = strchr(fullname, '/')) != NULL) - { - cwd = sipStrdup(fullname); - *strrchr(cwd,'/') = '\0'; - } - - inputFileStack[currentFile].lineno = 1; - inputFileStack[currentFile].name = fullname; - inputFileStack[currentFile].pc = *pc; - inputFileStack[currentFile].cwd = cwd; - - if (currentFile > 0) - { - inputFileStack[currentFile].bs = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); - } - - return TRUE; -} - - -/* - * Open a file for reading or return NULL if it doesn't exist. Any other error - * is fatal. - */ -static FILE *openFile(const char *name) -{ - FILE *fp; - - if ((fp = fopen(name,"r")) == NULL && errno != ENOENT) - fatal("Error in opening file %s\n",name); - - return fp; -} - - -/* - * Handle fatal yacc errors. - */ -void yyerror(char *s) -{ - if (currentFile < 0) - fatal("%s\n", s); - - fatal("%s:%d: %s\n", - inputFileStack[currentFile].name, - inputFileStack[currentFile].lineno, - s); -} - - -/* - * Handle warnings while parsing. - */ -void yywarning(char *s) -{ - warning("%s:%d: %s\n", - inputFileStack[currentFile].name, - inputFileStack[currentFile].lineno, - s); -} - - -/* - * Handle fatal lex errors. - */ -static void fatallex(char *s) -{ - fatal("%s:%d: Lexical analyser error: %s\n", - inputFileStack[currentFile].name, - inputFileStack[currentFile].lineno, - s); -} - diff --git a/sipgen/parser.c b/sipgen/parser.c deleted file mode 100644 index 91febd7..0000000 --- a/sipgen/parser.c +++ /dev/null @@ -1,9975 +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 <http://www.gnu.org/licenses/>. */ - -/* 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 19 "/TEMP/sip4-tqt/sipgen/parser.y" - -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -#include "sip.h" - - -#define MAX_NESTED_IF 10 -#define MAX_NESTED_SCOPE 10 - -#define inMainModule() (currentSpec->module == currentModule || currentModule->container != NULL) - - -static sipSpec *currentSpec; /* The current spec being parsed. */ -static stringList *neededQualifiers; /* The list of required qualifiers. */ -static stringList *excludedQualifiers; /* The list of excluded qualifiers. */ -static moduleDef *currentModule; /* The current module being parsed. */ -static mappedTypeDef *currentMappedType; /* The current mapped type. */ -static enumDef *currentEnum; /* The current enum being parsed. */ -static int sectionFlags; /* The current section flags. */ -static int currentOverIsVirt; /* Set if the overload is virtual. */ -static int currentCtorIsExplicit; /* Set if the ctor is explicit. */ -static int currentIsStatic; /* Set if the current is static. */ -static int currentIsSignal; /* Set if the current is Q_SIGNAL. */ -static int currentIsSlot; /* Set if the current is Q_SLOT. */ -static int currentIsTemplate; /* Set if the current is a template. */ -static char *previousFile; /* The file just parsed. */ -static parserContext currentContext; /* The current context. */ -static int skipStackPtr; /* The skip stack pointer. */ -static int skipStack[MAX_NESTED_IF]; /* Stack of skip flags. */ -static classDef *scopeStack[MAX_NESTED_SCOPE]; /* The scope stack. */ -static int sectFlagsStack[MAX_NESTED_SCOPE]; /* The section flags stack. */ -static int currentScopeIdx; /* The scope stack index. */ -static int currentTimelineOrder; /* The current timeline order. */ -static classList *currentSupers; /* The current super-class list. */ -static int defaultKwdArgs; /* Support keyword arguments by default. */ -static int makeProtPublic; /* Treat protected items as public. */ - - -static const char *getPythonName(optFlags *optflgs, const char *cname); -static classDef *findClass(sipSpec *pt, ifaceFileType iftype, - apiVersionRangeDef *api_range, scopedNameDef *fqname); -static classDef *findClassWithInterface(sipSpec *pt, ifaceFileDef *iff); -static classDef *newClass(sipSpec *pt, ifaceFileType iftype, - apiVersionRangeDef *api_range, scopedNameDef *snd); -static void finishClass(sipSpec *, moduleDef *, classDef *, optFlags *); -static exceptionDef *findException(sipSpec *pt, scopedNameDef *fqname, int new); -static mappedTypeDef *newMappedType(sipSpec *,argDef *, optFlags *); -static enumDef *newEnum(sipSpec *pt, moduleDef *mod, mappedTypeDef *mt_scope, - char *name, optFlags *of, int flags); -static void instantiateClassTemplate(sipSpec *pt, moduleDef *mod, classDef *scope, scopedNameDef *fqname, classTmplDef *tcd, templateDef *td); -static void newTypedef(sipSpec *, moduleDef *, char *, argDef *, optFlags *); -static void newVar(sipSpec *, moduleDef *, char *, int, argDef *, optFlags *, - codeBlock *, codeBlock *, codeBlock *); -static void newCtor(char *, int, signatureDef *, optFlags *, codeBlock *, - throwArgs *, signatureDef *, int, codeBlock *); -static void newFunction(sipSpec *, moduleDef *, classDef *, mappedTypeDef *, - int, int, int, int, int, char *, signatureDef *, int, int, optFlags *, - codeBlock *, codeBlock *, throwArgs *, signatureDef *, codeBlock *); -static optFlag *findOptFlag(optFlags *,char *,flagType); -static memberDef *findFunction(sipSpec *, moduleDef *, classDef *, - mappedTypeDef *, const char *, int, int, int); -static void checkAttributes(sipSpec *, moduleDef *, classDef *, - mappedTypeDef *, const char *, int); -static void newModule(FILE *fp, char *filename); -static moduleDef *allocModule(); -static void parseFile(FILE *fp, char *name, moduleDef *prevmod, int optional); -static void handleEOF(void); -static void handleEOM(void); -static qualDef *findQualifier(const char *name); -static scopedNameDef *text2scopedName(ifaceFileDef *scope, char *text); -static scopedNameDef *scopeScopedName(ifaceFileDef *scope, - scopedNameDef *name); -static void pushScope(classDef *); -static void popScope(void); -static classDef *currentScope(void); -static void newQualifier(moduleDef *,int,int,char *,qualType); -static void newImport(char *filename); -static int timePeriod(char *,char *); -static int platOrFeature(char *,int); -static int isNeeded(qualDef *); -static int notSkipping(void); -static void getHooks(optFlags *,char **,char **); -static int getTransfer(optFlags *optflgs); -static int getReleaseGIL(optFlags *optflgs); -static int getHoldGIL(optFlags *optflgs); -static int getDeprecated(optFlags *optflgs); -static int getAllowNone(optFlags *optflgs); -static const char *getDocType(optFlags *optflgs); -static const char *getDocValue(optFlags *optflgs); -static void templateSignature(signatureDef *sd, int result, classTmplDef *tcd, templateDef *td, classDef *ncd); -static void templateType(argDef *ad, classTmplDef *tcd, templateDef *td, classDef *ncd); -static int search_back(const char *end, const char *start, const char *target); -static char *type2string(argDef *ad); -static char *scopedNameToString(scopedNameDef *name); -static void addUsedFromCode(sipSpec *pt, ifaceFileList **used, const char *sname); -static int sameName(scopedNameDef *snd, const char *sname); -static int stringFind(stringList *sl, const char *s); -static void setModuleName(sipSpec *pt, moduleDef *mod, const char *fullname); -static int foundInScope(scopedNameDef *fq_name, scopedNameDef *rel_name); -static void defineClass(scopedNameDef *snd, classList *supers, optFlags *of); -static classDef *completeClass(scopedNameDef *snd, optFlags *of, int has_def); -static memberDef *instantiateTemplateMethods(memberDef *tmd, moduleDef *mod); -static void instantiateTemplateEnums(sipSpec *pt, classTmplDef *tcd, - templateDef *td, classDef *cd, ifaceFileList **used, - scopedNameDef *type_names, scopedNameDef *type_values); -static void instantiateTemplateVars(sipSpec *pt, classTmplDef *tcd, - templateDef *td, classDef *cd, ifaceFileList **used, - scopedNameDef *type_names, scopedNameDef *type_values); -static overDef *instantiateTemplateOverloads(sipSpec *pt, overDef *tod, - memberDef *tmethods, memberDef *methods, classTmplDef *tcd, - templateDef *td, classDef *cd, ifaceFileList **used, - scopedNameDef *type_names, scopedNameDef *type_values); -static void resolveAnyTypedef(sipSpec *pt, argDef *ad); -static void addVariable(sipSpec *pt, varDef *vd); -static void applyTypeFlags(moduleDef *mod, argDef *ad, optFlags *flags); -static argType convertEncoding(const char *encoding); -static apiVersionRangeDef *getAPIRange(optFlags *optflgs); -static apiVersionRangeDef *convertAPIRange(moduleDef *mod, nameDef *name, - int from, int to); -static char *convertFeaturedString(char *fs); -static scopedNameDef *text2scopePart(char *text); -static int usesKeywordArgs(optFlags *optflgs, signatureDef *sd); -static char *strip(char *s); -static int isEnabledFeature(const char *name); - - -/* Line 189 of yacc.c */ -#line 202 "y.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 { - TK_API = 258, - TK_DEFENCODING = 259, - TK_PLUGIN = 260, - TK_DOCSTRING = 261, - TK_DOC = 262, - TK_EXPORTEDDOC = 263, - TK_MAKEFILE = 264, - TK_ACCESSCODE = 265, - TK_GETCODE = 266, - TK_SETCODE = 267, - TK_PREINITCODE = 268, - TK_INITCODE = 269, - TK_POSTINITCODE = 270, - TK_UNITCODE = 271, - TK_MODCODE = 272, - TK_TYPECODE = 273, - TK_PREPYCODE = 274, - TK_COPYING = 275, - TK_MAPPEDTYPE = 276, - TK_CODELINE = 277, - TK_IF = 278, - TK_END = 279, - TK_NAME = 280, - TK_PATHNAME = 281, - TK_STRING = 282, - TK_VIRTUALCATCHERCODE = 283, - TK_TRAVERSECODE = 284, - TK_CLEARCODE = 285, - TK_GETBUFFERCODE = 286, - TK_RELEASEBUFFERCODE = 287, - TK_READBUFFERCODE = 288, - TK_WRITEBUFFERCODE = 289, - TK_SEGCOUNTCODE = 290, - TK_CHARBUFFERCODE = 291, - TK_PICKLECODE = 292, - TK_METHODCODE = 293, - TK_FROMTYPE = 294, - TK_TOTYPE = 295, - TK_TOSUBCLASS = 296, - TK_INCLUDE = 297, - TK_OPTINCLUDE = 298, - TK_IMPORT = 299, - TK_EXPHEADERCODE = 300, - TK_MODHEADERCODE = 301, - TK_TYPEHEADERCODE = 302, - TK_MODULE = 303, - TK_CMODULE = 304, - TK_CONSMODULE = 305, - TK_COMPOMODULE = 306, - TK_CLASS = 307, - TK_STRUCT = 308, - TK_PUBLIC = 309, - TK_PROTECTED = 310, - TK_PRIVATE = 311, - TK_SIGNALS = 312, - TK_SIGNAL_METHOD = 313, - TK_SLOTS = 314, - TK_SLOT_METHOD = 315, - TK_BOOL = 316, - TK_SHORT = 317, - TK_INT = 318, - TK_LONG = 319, - TK_FLOAT = 320, - TK_DOUBLE = 321, - TK_CHAR = 322, - TK_WCHAR_T = 323, - TK_VOID = 324, - TK_PYOBJECT = 325, - TK_PYTUPLE = 326, - TK_PYLIST = 327, - TK_PYDICT = 328, - TK_PYCALLABLE = 329, - TK_PYSLICE = 330, - TK_PYTYPE = 331, - TK_VIRTUAL = 332, - TK_ENUM = 333, - TK_SIGNED = 334, - TK_UNSIGNED = 335, - TK_SCOPE = 336, - TK_LOGICAL_OR = 337, - TK_CONST = 338, - TK_STATIC = 339, - TK_SIPSIGNAL = 340, - TK_SIPSLOT = 341, - TK_SIPANYSLOT = 342, - TK_SIPRXCON = 343, - TK_SIPRXDIS = 344, - TK_SIPSLOTCON = 345, - TK_SIPSLOTDIS = 346, - TK_NUMBER = 347, - TK_REAL = 348, - TK_TYPEDEF = 349, - TK_NAMESPACE = 350, - TK_TIMELINE = 351, - TK_PLATFORMS = 352, - TK_FEATURE = 353, - TK_LICENSE = 354, - TK_QCHAR = 355, - TK_TRUE = 356, - TK_FALSE = 357, - TK_NULL = 358, - TK_OPERATOR = 359, - TK_THROW = 360, - TK_QOBJECT = 361, - TK_EXCEPTION = 362, - TK_RAISECODE = 363, - TK_EXPLICIT = 364, - TK_TEMPLATE = 365, - TK_ELLIPSIS = 366, - TK_DEFMETATYPE = 367, - TK_DEFSUPERTYPE = 368 - }; -#endif -/* Tokens. */ -#define TK_API 258 -#define TK_DEFENCODING 259 -#define TK_PLUGIN 260 -#define TK_DOCSTRING 261 -#define TK_DOC 262 -#define TK_EXPORTEDDOC 263 -#define TK_MAKEFILE 264 -#define TK_ACCESSCODE 265 -#define TK_GETCODE 266 -#define TK_SETCODE 267 -#define TK_PREINITCODE 268 -#define TK_INITCODE 269 -#define TK_POSTINITCODE 270 -#define TK_UNITCODE 271 -#define TK_MODCODE 272 -#define TK_TYPECODE 273 -#define TK_PREPYCODE 274 -#define TK_COPYING 275 -#define TK_MAPPEDTYPE 276 -#define TK_CODELINE 277 -#define TK_IF 278 -#define TK_END 279 -#define TK_NAME 280 -#define TK_PATHNAME 281 -#define TK_STRING 282 -#define TK_VIRTUALCATCHERCODE 283 -#define TK_TRAVERSECODE 284 -#define TK_CLEARCODE 285 -#define TK_GETBUFFERCODE 286 -#define TK_RELEASEBUFFERCODE 287 -#define TK_READBUFFERCODE 288 -#define TK_WRITEBUFFERCODE 289 -#define TK_SEGCOUNTCODE 290 -#define TK_CHARBUFFERCODE 291 -#define TK_PICKLECODE 292 -#define TK_METHODCODE 293 -#define TK_FROMTYPE 294 -#define TK_TOTYPE 295 -#define TK_TOSUBCLASS 296 -#define TK_INCLUDE 297 -#define TK_OPTINCLUDE 298 -#define TK_IMPORT 299 -#define TK_EXPHEADERCODE 300 -#define TK_MODHEADERCODE 301 -#define TK_TYPEHEADERCODE 302 -#define TK_MODULE 303 -#define TK_CMODULE 304 -#define TK_CONSMODULE 305 -#define TK_COMPOMODULE 306 -#define TK_CLASS 307 -#define TK_STRUCT 308 -#define TK_PUBLIC 309 -#define TK_PROTECTED 310 -#define TK_PRIVATE 311 -#define TK_SIGNALS 312 -#define TK_SIGNAL_METHOD 313 -#define TK_SLOTS 314 -#define TK_SLOT_METHOD 315 -#define TK_BOOL 316 -#define TK_SHORT 317 -#define TK_INT 318 -#define TK_LONG 319 -#define TK_FLOAT 320 -#define TK_DOUBLE 321 -#define TK_CHAR 322 -#define TK_WCHAR_T 323 -#define TK_VOID 324 -#define TK_PYOBJECT 325 -#define TK_PYTUPLE 326 -#define TK_PYLIST 327 -#define TK_PYDICT 328 -#define TK_PYCALLABLE 329 -#define TK_PYSLICE 330 -#define TK_PYTYPE 331 -#define TK_VIRTUAL 332 -#define TK_ENUM 333 -#define TK_SIGNED 334 -#define TK_UNSIGNED 335 -#define TK_SCOPE 336 -#define TK_LOGICAL_OR 337 -#define TK_CONST 338 -#define TK_STATIC 339 -#define TK_SIPSIGNAL 340 -#define TK_SIPSLOT 341 -#define TK_SIPANYSLOT 342 -#define TK_SIPRXCON 343 -#define TK_SIPRXDIS 344 -#define TK_SIPSLOTCON 345 -#define TK_SIPSLOTDIS 346 -#define TK_NUMBER 347 -#define TK_REAL 348 -#define TK_TYPEDEF 349 -#define TK_NAMESPACE 350 -#define TK_TIMELINE 351 -#define TK_PLATFORMS 352 -#define TK_FEATURE 353 -#define TK_LICENSE 354 -#define TK_QCHAR 355 -#define TK_TRUE 356 -#define TK_FALSE 357 -#define TK_NULL 358 -#define TK_OPERATOR 359 -#define TK_THROW 360 -#define TK_QOBJECT 361 -#define TK_EXCEPTION 362 -#define TK_RAISECODE 363 -#define TK_EXPLICIT 364 -#define TK_TEMPLATE 365 -#define TK_ELLIPSIS 366 -#define TK_DEFMETATYPE 367 -#define TK_DEFSUPERTYPE 368 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 214 of yacc.c */ -#line 147 "/TEMP/sip4-tqt/sipgen/parser.y" - - char qchar; - char *text; - long number; - double real; - argDef memArg; - signatureDef signature; - signatureDef *optsignature; - throwArgs *throwlist; - codeBlock *codeb; - valueDef value; - valueDef *valp; - optFlags optflags; - optFlag flag; - scopedNameDef *scpvalp; - fcallDef fcall; - int boolean; - exceptionDef exceptionbase; - classDef *klass; - - - -/* Line 214 of yacc.c */ -#line 487 "y.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 499 "y.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 <stddef.h> /* 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 <libintl.h> /* 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 <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* 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 <stdlib.h> /* 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 <stdlib.h> /* 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 4 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1193 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 136 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 151 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 372 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 637 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 368 - -#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, 119, 2, 2, 2, 134, 126, 2, - 117, 118, 124, 123, 121, 120, 2, 125, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 131, 116, - 129, 122, 130, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 132, 2, 133, 135, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 114, 127, 115, 128, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 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 -}; - -#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, 8, 9, 12, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, - 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, - 80, 82, 84, 86, 88, 90, 92, 94, 96, 99, - 102, 106, 116, 117, 121, 124, 125, 131, 132, 139, - 144, 146, 149, 151, 154, 157, 159, 161, 175, 176, - 184, 186, 189, 190, 196, 198, 201, 203, 206, 207, - 213, 215, 218, 220, 225, 227, 230, 234, 239, 241, - 245, 247, 250, 253, 256, 259, 262, 266, 268, 270, - 272, 274, 275, 277, 280, 283, 286, 287, 290, 291, - 294, 295, 298, 301, 304, 307, 310, 311, 313, 316, - 319, 322, 325, 328, 331, 334, 337, 340, 343, 346, - 349, 352, 355, 358, 361, 364, 367, 372, 375, 377, - 380, 381, 390, 391, 393, 394, 396, 397, 399, 401, - 404, 406, 408, 413, 414, 416, 417, 420, 421, 424, - 426, 430, 432, 434, 436, 438, 440, 442, 443, 445, - 447, 449, 451, 454, 456, 460, 462, 464, 469, 471, - 473, 475, 477, 479, 481, 483, 484, 486, 490, 496, - 508, 509, 510, 519, 520, 524, 529, 530, 531, 540, - 541, 544, 546, 550, 552, 553, 557, 559, 562, 564, - 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, - 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, - 606, 608, 611, 614, 618, 622, 626, 629, 630, 632, - 644, 645, 649, 651, 662, 663, 669, 670, 677, 678, - 680, 695, 703, 718, 732, 734, 736, 738, 740, 742, - 744, 746, 748, 751, 754, 757, 760, 763, 766, 769, - 772, 775, 778, 782, 786, 788, 791, 794, 796, 799, - 802, 805, 807, 810, 811, 813, 814, 817, 818, 822, - 824, 828, 830, 834, 836, 842, 844, 846, 849, 850, - 852, 853, 856, 857, 860, 862, 863, 865, 869, 874, - 879, 884, 888, 892, 899, 906, 910, 913, 914, 918, - 919, 923, 925, 926, 930, 932, 934, 936, 937, 941, - 943, 951, 956, 960, 964, 965, 967, 968, 971, 973, - 978, 981, 984, 986, 988, 991, 993, 995, 998, 1001, - 1005, 1007, 1009, 1011, 1014, 1017, 1019, 1021, 1023, 1025, - 1027, 1029, 1031, 1033, 1035, 1037, 1039, 1041, 1045, 1046, - 1051, 1052, 1054 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 137, 0, -1, 138, -1, 137, 138, -1, -1, 139, - 140, -1, 177, -1, 175, -1, 176, -1, 143, -1, - 187, -1, 181, -1, 182, -1, 183, -1, 144, -1, - 164, -1, 159, -1, 163, -1, 172, -1, 142, -1, - 173, -1, 174, -1, 188, -1, 189, -1, 201, -1, - 203, -1, 204, -1, 205, -1, 206, -1, 207, -1, - 208, -1, 209, -1, 210, -1, 148, -1, 150, -1, - 141, -1, 168, -1, 171, -1, 156, -1, 232, -1, - 238, -1, 235, -1, 145, -1, 231, -1, 213, -1, - 255, -1, 278, -1, 190, -1, 4, 27, -1, 5, - 25, -1, 3, 25, 92, -1, 107, 227, 146, 259, - 114, 191, 147, 115, 116, -1, -1, 117, 227, 118, - -1, 108, 211, -1, -1, 21, 283, 259, 149, 152, - -1, -1, 237, 21, 283, 259, 151, 152, -1, 114, - 153, 115, 116, -1, 154, -1, 153, 154, -1, 190, - -1, 39, 211, -1, 40, 211, -1, 213, -1, 155, - -1, 84, 279, 25, 117, 267, 118, 257, 285, 259, - 253, 116, 264, 265, -1, -1, 95, 25, 157, 114, - 158, 115, 116, -1, 141, -1, 158, 141, -1, -1, - 97, 160, 114, 161, 115, -1, 162, -1, 161, 162, - -1, 25, -1, 98, 25, -1, -1, 96, 165, 114, - 166, 115, -1, 167, -1, 166, 167, -1, 25, -1, - 23, 117, 170, 118, -1, 25, -1, 119, 25, -1, - 169, 82, 25, -1, 169, 82, 119, 25, -1, 169, - -1, 216, 120, 216, -1, 24, -1, 99, 259, -1, - 112, 179, -1, 113, 179, -1, 50, 179, -1, 51, - 179, -1, 178, 179, 180, -1, 48, -1, 49, -1, - 25, -1, 26, -1, -1, 92, -1, 42, 26, -1, - 43, 26, -1, 44, 26, -1, -1, 10, 211, -1, - -1, 11, 211, -1, -1, 12, 211, -1, 20, 211, - -1, 45, 211, -1, 46, 211, -1, 47, 211, -1, - -1, 190, -1, 29, 211, -1, 30, 211, -1, 31, - 211, -1, 32, 211, -1, 33, 211, -1, 34, 211, - -1, 35, 211, -1, 36, 211, -1, 37, 211, -1, - 17, 211, -1, 18, 211, -1, 13, 211, -1, 14, - 211, -1, 15, 211, -1, 16, 211, -1, 19, 211, - -1, 7, 211, -1, 8, 211, -1, 9, 26, 215, - 211, -1, 212, 24, -1, 22, -1, 212, 22, -1, - -1, 78, 216, 259, 214, 114, 217, 115, 116, -1, - -1, 26, -1, -1, 25, -1, -1, 218, -1, 219, - -1, 218, 219, -1, 168, -1, 171, -1, 25, 221, - 259, 220, -1, -1, 121, -1, -1, 122, 226, -1, - -1, 122, 223, -1, 226, -1, 223, 224, 226, -1, - 120, -1, 123, -1, 124, -1, 125, -1, 126, -1, - 127, -1, -1, 119, -1, 128, -1, 120, -1, 123, - -1, 225, 229, -1, 228, -1, 227, 81, 228, -1, - 25, -1, 227, -1, 283, 117, 230, 118, -1, 93, - -1, 92, -1, 101, -1, 102, -1, 103, -1, 27, - -1, 100, -1, -1, 223, -1, 230, 121, 223, -1, - 94, 279, 25, 259, 116, -1, 94, 279, 117, 282, - 25, 118, 117, 284, 118, 259, 116, -1, -1, -1, - 53, 227, 233, 241, 259, 234, 244, 116, -1, -1, - 237, 236, 238, -1, 110, 129, 284, 130, -1, -1, - -1, 52, 227, 239, 241, 259, 240, 244, 116, -1, - -1, 131, 242, -1, 243, -1, 242, 121, 243, -1, - 227, -1, -1, 114, 245, 115, -1, 246, -1, 245, - 246, -1, 168, -1, 171, -1, 156, -1, 232, -1, - 238, -1, 145, -1, 231, -1, 213, -1, 263, -1, - 202, -1, 190, -1, 192, -1, 193, -1, 194, -1, - 195, -1, 196, -1, 197, -1, 198, -1, 199, -1, - 200, -1, 249, -1, 248, -1, 270, -1, 41, 211, - -1, 40, 211, -1, 54, 247, 131, -1, 55, 247, - 131, -1, 56, 247, 131, -1, 57, 131, -1, -1, - 59, -1, 254, 128, 25, 117, 118, 285, 258, 259, - 116, 265, 266, -1, -1, 109, 250, 251, -1, 251, - -1, 25, 117, 267, 118, 285, 259, 252, 116, 264, - 265, -1, -1, 132, 117, 267, 118, 133, -1, -1, - 132, 279, 117, 267, 118, 133, -1, -1, 77, -1, - 279, 25, 117, 267, 118, 257, 285, 258, 259, 253, - 116, 264, 265, 266, -1, 279, 104, 122, 117, 279, - 118, 116, -1, 279, 104, 256, 117, 267, 118, 257, - 285, 258, 259, 253, 116, 265, 266, -1, 104, 279, - 117, 267, 118, 257, 285, 258, 259, 253, 116, 265, - 266, -1, 123, -1, 120, -1, 124, -1, 125, -1, - 134, -1, 126, -1, 127, -1, 135, -1, 129, 129, - -1, 130, 130, -1, 123, 122, -1, 120, 122, -1, - 124, 122, -1, 125, 122, -1, 134, 122, -1, 126, - 122, -1, 127, 122, -1, 135, 122, -1, 129, 129, - 122, -1, 130, 130, 122, -1, 128, -1, 117, 118, - -1, 132, 133, -1, 129, -1, 129, 122, -1, 122, - 122, -1, 119, 122, -1, 130, -1, 130, 122, -1, - -1, 83, -1, -1, 122, 92, -1, -1, 125, 260, - 125, -1, 261, -1, 260, 121, 261, -1, 25, -1, - 25, 122, 262, -1, 179, -1, 25, 131, 180, 120, - 180, -1, 27, -1, 92, -1, 6, 211, -1, -1, - 263, -1, -1, 38, 211, -1, -1, 28, 211, -1, - 268, -1, -1, 269, -1, 268, 121, 269, -1, 85, - 216, 259, 222, -1, 86, 216, 259, 222, -1, 87, - 216, 259, 222, -1, 88, 216, 259, -1, 89, 216, - 259, -1, 90, 117, 267, 118, 216, 259, -1, 91, - 117, 267, 118, 216, 259, -1, 106, 216, 259, -1, - 280, 222, -1, -1, 58, 271, 273, -1, -1, 60, - 272, 273, -1, 273, -1, -1, 84, 274, 275, -1, - 275, -1, 276, -1, 278, -1, -1, 77, 277, 255, - -1, 255, -1, 279, 25, 259, 116, 184, 185, 186, - -1, 83, 283, 282, 281, -1, 283, 282, 281, -1, - 279, 216, 259, -1, -1, 126, -1, -1, 282, 124, - -1, 227, -1, 227, 129, 284, 130, -1, 53, 227, - -1, 80, 62, -1, 62, -1, 80, -1, 80, 63, - -1, 63, -1, 64, -1, 80, 64, -1, 64, 64, - -1, 80, 64, 64, -1, 65, -1, 66, -1, 61, - -1, 79, 67, -1, 80, 67, -1, 67, -1, 68, - -1, 69, -1, 70, -1, 71, -1, 72, -1, 73, - -1, 74, -1, 75, -1, 76, -1, 111, -1, 279, - -1, 284, 121, 279, -1, -1, 105, 117, 286, 118, - -1, -1, 227, -1, 286, 121, 227, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 350, 350, 351, 354, 354, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 393, 397, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 438, 447, - 452, 478, 517, 521, 595, 600, 600, 606, 606, 656, - 670, 671, 674, 678, 687, 696, 697, 700, 714, 714, - 751, 752, 755, 755, 782, 783, 786, 791, 796, 796, - 821, 822, 825, 830, 843, 846, 849, 852, 857, 858, - 863, 869, 896, 907, 918, 931, 944, 977, 980, 985, - 986, 1002, 1005, 1008, 1013, 1018, 1023, 1026, 1031, 1034, - 1039, 1042, 1047, 1052, 1057, 1062, 1067, 1070, 1073, 1078, - 1083, 1088, 1093, 1098, 1103, 1108, 1113, 1118, 1123, 1128, - 1134, 1140, 1146, 1152, 1161, 1167, 1172, 1178, 1181, 1182, - 1193, 1193, 1205, 1208, 1213, 1216, 1221, 1222, 1225, 1226, - 1229, 1230, 1231, 1259, 1260, 1263, 1264, 1267, 1270, 1275, - 1276, 1294, 1297, 1300, 1303, 1306, 1309, 1314, 1317, 1320, - 1323, 1326, 1331, 1349, 1350, 1358, 1363, 1372, 1382, 1386, - 1390, 1394, 1398, 1402, 1406, 1412, 1417, 1423, 1441, 1448, - 1473, 1479, 1473, 1494, 1494, 1520, 1525, 1531, 1525, 1543, - 1544, 1547, 1548, 1551, 1590, 1593, 1598, 1599, 1602, 1603, - 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1620, 1624, 1628, - 1639, 1650, 1661, 1672, 1683, 1694, 1705, 1716, 1727, 1728, - 1729, 1730, 1741, 1752, 1759, 1766, 1773, 1782, 1785, 1790, - 1844, 1844, 1845, 1848, 1875, 1878, 1885, 1888, 1896, 1899, - 1904, 1922, 1942, 1971, 2049, 2050, 2051, 2052, 2053, 2054, - 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, - 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, - 2075, 2076, 2077, 2080, 2083, 2088, 2091, 2099, 2102, 2108, - 2112, 2124, 2128, 2134, 2138, 2161, 2165, 2171, 2176, 2179, - 2182, 2185, 2190, 2193, 2198, 2246, 2251, 2257, 2284, 2293, - 2302, 2311, 2322, 2330, 2344, 2358, 2364, 2371, 2371, 2372, - 2372, 2373, 2377, 2377, 2378, 2382, 2383, 2387, 2387, 2388, - 2391, 2426, 2431, 2438, 2510, 2513, 2521, 2524, 2529, 2537, - 2548, 2563, 2567, 2571, 2575, 2579, 2583, 2587, 2591, 2595, - 2599, 2603, 2607, 2611, 2615, 2619, 2623, 2627, 2631, 2635, - 2639, 2643, 2647, 2651, 2655, 2659, 2665, 2671, 2687, 2690, - 2698, 2704, 2711 -}; -#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", "TK_API", "TK_DEFENCODING", "TK_PLUGIN", - "TK_DOCSTRING", "TK_DOC", "TK_EXPORTEDDOC", "TK_MAKEFILE", - "TK_ACCESSCODE", "TK_GETCODE", "TK_SETCODE", "TK_PREINITCODE", - "TK_INITCODE", "TK_POSTINITCODE", "TK_UNITCODE", "TK_MODCODE", - "TK_TYPECODE", "TK_PREPYCODE", "TK_COPYING", "TK_MAPPEDTYPE", - "TK_CODELINE", "TK_IF", "TK_END", "TK_NAME", "TK_PATHNAME", "TK_STRING", - "TK_VIRTUALCATCHERCODE", "TK_TRAVERSECODE", "TK_CLEARCODE", - "TK_GETBUFFERCODE", "TK_RELEASEBUFFERCODE", "TK_READBUFFERCODE", - "TK_WRITEBUFFERCODE", "TK_SEGCOUNTCODE", "TK_CHARBUFFERCODE", - "TK_PICKLECODE", "TK_METHODCODE", "TK_FROMTYPE", "TK_TOTYPE", - "TK_TOSUBCLASS", "TK_INCLUDE", "TK_OPTINCLUDE", "TK_IMPORT", - "TK_EXPHEADERCODE", "TK_MODHEADERCODE", "TK_TYPEHEADERCODE", "TK_MODULE", - "TK_CMODULE", "TK_CONSMODULE", "TK_COMPOMODULE", "TK_CLASS", "TK_STRUCT", - "TK_PUBLIC", "TK_PROTECTED", "TK_PRIVATE", "TK_SIGNALS", - "TK_SIGNAL_METHOD", "TK_SLOTS", "TK_SLOT_METHOD", "TK_BOOL", "TK_SHORT", - "TK_INT", "TK_LONG", "TK_FLOAT", "TK_DOUBLE", "TK_CHAR", "TK_WCHAR_T", - "TK_VOID", "TK_PYOBJECT", "TK_PYTUPLE", "TK_PYLIST", "TK_PYDICT", - "TK_PYCALLABLE", "TK_PYSLICE", "TK_PYTYPE", "TK_VIRTUAL", "TK_ENUM", - "TK_SIGNED", "TK_UNSIGNED", "TK_SCOPE", "TK_LOGICAL_OR", "TK_CONST", - "TK_STATIC", "TK_SIPSIGNAL", "TK_SIPSLOT", "TK_SIPANYSLOT", - "TK_SIPRXCON", "TK_SIPRXDIS", "TK_SIPSLOTCON", "TK_SIPSLOTDIS", - "TK_NUMBER", "TK_REAL", "TK_TYPEDEF", "TK_NAMESPACE", "TK_TIMELINE", - "TK_PLATFORMS", "TK_FEATURE", "TK_LICENSE", "TK_QCHAR", "TK_TRUE", - "TK_FALSE", "TK_NULL", "TK_OPERATOR", "TK_THROW", "TK_QOBJECT", - "TK_EXCEPTION", "TK_RAISECODE", "TK_EXPLICIT", "TK_TEMPLATE", - "TK_ELLIPSIS", "TK_DEFMETATYPE", "TK_DEFSUPERTYPE", "'{'", "'}'", "';'", - "'('", "')'", "'!'", "'-'", "','", "'='", "'+'", "'*'", "'/'", "'&'", - "'|'", "'~'", "'<'", "'>'", "':'", "'['", "']'", "'%'", "'^'", "$accept", - "specification", "statement", "$@1", "modstatement", "nsstatement", - "defencoding", "plugin", "api", "exception", "baseexception", - "raisecode", "mappedtype", "$@2", "mappedtypetmpl", "$@3", - "mtdefinition", "mtbody", "mtline", "mtfunction", "namespace", "$@4", - "nsbody", "platforms", "$@5", "platformlist", "platform", "feature", - "timeline", "$@6", "qualifierlist", "qualifiername", "ifstart", - "oredqualifiers", "qualifiers", "ifend", "license", "defmetatype", - "defsupertype", "consmodule", "compmodule", "module", "modlang", - "dottedname", "optnumber", "include", "optinclude", "import", - "optaccesscode", "optgetcode", "optsetcode", "copying", "exphdrcode", - "modhdrcode", "typehdrcode", "opttypehdrcode", "travcode", "clearcode", - "getbufcode", "releasebufcode", "readbufcode", "writebufcode", - "segcountcode", "charbufcode", "picklecode", "modcode", "typecode", - "preinitcode", "initcode", "postinitcode", "unitcode", "prepycode", - "doc", "exporteddoc", "makefile", "codeblock", "codelines", "enum", - "$@7", "optfilename", "optname", "optenumbody", "enumbody", "enumline", - "optcomma", "optenumassign", "optassign", "expr", "binop", "optunop", - "value", "scopedname", "scopepart", "simplevalue", "exprlist", "typedef", - "struct", "$@8", "$@9", "classtmpl", "$@10", "template", "class", "$@11", - "$@12", "superclasses", "superlist", "superclass", "optclassbody", - "classbody", "classline", "optslot", "dtor", "ctor", "$@13", - "simplector", "optctorsig", "optsig", "optvirtual", "function", - "operatorname", "optconst", "optabstract", "optflags", "flaglist", - "flag", "flagvalue", "docstring", "optdocstring", "methodcode", - "virtualcatchercode", "arglist", "rawarglist", "argvalue", "varmember", - "$@14", "$@15", "simple_varmem", "$@16", "varmem", "member", "$@17", - "variable", "cpptype", "argtype", "optref", "deref", "basetype", - "cpptypelist", "optexceptions", "exceptionlist", 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, 123, 125, 59, 40, 41, 33, - 45, 44, 61, 43, 42, 47, 38, 124, 126, 60, - 62, 58, 91, 93, 37, 94 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint16 yyr1[] = -{ - 0, 136, 137, 137, 139, 138, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, - 141, 141, 141, 141, 141, 141, 141, 141, 142, 143, - 144, 145, 146, 146, 147, 149, 148, 151, 150, 152, - 153, 153, 154, 154, 154, 154, 154, 155, 157, 156, - 158, 158, 160, 159, 161, 161, 162, 163, 165, 164, - 166, 166, 167, 168, 169, 169, 169, 169, 170, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 178, 179, - 179, 180, 180, 181, 182, 183, 184, 184, 185, 185, - 186, 186, 187, 188, 189, 190, 191, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 212, - 214, 213, 215, 215, 216, 216, 217, 217, 218, 218, - 219, 219, 219, 220, 220, 221, 221, 222, 222, 223, - 223, 224, 224, 224, 224, 224, 224, 225, 225, 225, - 225, 225, 226, 227, 227, 228, 229, 229, 229, 229, - 229, 229, 229, 229, 229, 230, 230, 230, 231, 231, - 233, 234, 232, 236, 235, 237, 239, 240, 238, 241, - 241, 242, 242, 243, 244, 244, 245, 245, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 247, 247, 248, - 250, 249, 249, 251, 252, 252, 253, 253, 254, 254, - 255, 255, 255, 255, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 257, 257, 258, 258, 259, 259, 260, - 260, 261, 261, 262, 262, 262, 262, 263, 264, 264, - 265, 265, 266, 266, 267, 268, 268, 268, 269, 269, - 269, 269, 269, 269, 269, 269, 269, 271, 270, 272, - 270, 270, 274, 273, 273, 275, 275, 277, 276, 276, - 278, 279, 279, 280, 281, 281, 282, 282, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 284, 284, 285, 285, - 286, 286, 286 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 2, 0, 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, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 3, 9, 0, 3, 2, 0, 5, 0, 6, 4, - 1, 2, 1, 2, 2, 1, 1, 13, 0, 7, - 1, 2, 0, 5, 1, 2, 1, 2, 0, 5, - 1, 2, 1, 4, 1, 2, 3, 4, 1, 3, - 1, 2, 2, 2, 2, 2, 3, 1, 1, 1, - 1, 0, 1, 2, 2, 2, 0, 2, 0, 2, - 0, 2, 2, 2, 2, 2, 0, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 4, 2, 1, 2, - 0, 8, 0, 1, 0, 1, 0, 1, 1, 2, - 1, 1, 4, 0, 1, 0, 2, 0, 2, 1, - 3, 1, 1, 1, 1, 1, 1, 0, 1, 1, - 1, 1, 2, 1, 3, 1, 1, 4, 1, 1, - 1, 1, 1, 1, 1, 0, 1, 3, 5, 11, - 0, 0, 8, 0, 3, 4, 0, 0, 8, 0, - 2, 1, 3, 1, 0, 3, 1, 2, 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, 3, 3, 3, 2, 0, 1, 11, - 0, 3, 1, 10, 0, 5, 0, 6, 0, 1, - 14, 7, 14, 13, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 3, 3, 1, 2, 2, 1, 2, 2, - 2, 1, 2, 0, 1, 0, 2, 0, 3, 1, - 3, 1, 3, 1, 5, 1, 1, 2, 0, 1, - 0, 2, 0, 2, 1, 0, 1, 3, 4, 4, - 4, 3, 3, 6, 6, 3, 2, 0, 3, 0, - 3, 1, 0, 3, 1, 1, 1, 0, 3, 1, - 7, 4, 3, 3, 0, 1, 0, 2, 1, 4, - 2, 2, 1, 1, 2, 1, 1, 2, 2, 3, - 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 0, 4, - 0, 1, 3 -}; - -/* 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[] = -{ - 4, 4, 2, 0, 1, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 90, 175, 0, 0, 0, 0, 0, 0, 97, - 98, 0, 0, 0, 0, 352, 342, 345, 346, 350, - 351, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, 144, 0, 343, 0, 0, 0, 78, 72, 0, - 287, 0, 0, 0, 365, 0, 0, 5, 35, 19, - 9, 14, 42, 33, 34, 38, 16, 17, 15, 36, - 37, 18, 20, 21, 7, 8, 6, 0, 11, 12, - 13, 10, 22, 23, 47, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 44, 338, 173, 43, 39, 41, - 193, 40, 45, 46, 0, 336, 0, 48, 49, 138, - 134, 0, 135, 142, 129, 130, 131, 132, 127, 133, - 112, 0, 287, 144, 103, 104, 105, 113, 114, 115, - 99, 100, 94, 95, 196, 190, 348, 145, 287, 353, - 341, 344, 347, 354, 336, 0, 68, 0, 0, 77, - 0, 91, 0, 52, 0, 92, 93, 101, 0, 0, - 0, 0, 287, 0, 334, 50, 139, 137, 143, 0, - 340, 55, 84, 0, 88, 0, 0, 199, 199, 140, - 349, 334, 287, 336, 0, 0, 0, 291, 0, 289, - 305, 0, 287, 366, 0, 102, 96, 174, 0, 287, - 194, 305, 0, 0, 0, 255, 0, 254, 256, 257, - 259, 260, 274, 277, 281, 0, 258, 261, 0, 337, - 335, 332, 136, 0, 85, 0, 83, 144, 0, 287, - 287, 0, 331, 0, 0, 0, 82, 0, 80, 76, - 0, 74, 0, 0, 288, 144, 144, 144, 144, 144, - 0, 0, 144, 0, 304, 306, 144, 157, 0, 0, - 0, 195, 339, 57, 0, 106, 275, 280, 265, 0, - 279, 264, 266, 267, 269, 270, 278, 262, 282, 263, - 276, 268, 271, 305, 0, 56, 86, 0, 89, 203, - 200, 201, 197, 191, 146, 188, 0, 70, 0, 193, - 79, 81, 73, 75, 99, 295, 296, 293, 292, 290, - 287, 287, 287, 287, 287, 305, 305, 287, 283, 0, - 287, 167, 316, 53, 116, 367, 0, 283, 0, 108, - 0, 272, 273, 0, 0, 0, 0, 0, 60, 66, - 62, 65, 87, 0, 204, 204, 155, 150, 151, 0, - 147, 148, 0, 0, 71, 101, 157, 157, 157, 311, - 312, 0, 0, 315, 284, 368, 307, 333, 168, 170, - 171, 169, 158, 0, 159, 117, 0, 58, 368, 107, - 0, 110, 0, 283, 63, 64, 0, 0, 61, 202, - 248, 0, 0, 167, 287, 0, 149, 0, 69, 0, - 308, 309, 310, 144, 144, 0, 285, 161, 162, 163, - 164, 165, 166, 167, 183, 179, 178, 184, 180, 181, - 182, 176, 172, 0, 0, 0, 285, 109, 0, 330, - 251, 368, 0, 59, 0, 0, 175, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 237, 237, - 237, 0, 317, 319, 327, 322, 240, 213, 210, 208, - 209, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 217, 215, 214, 211, 212, 248, 206, 229, 228, - 242, 0, 329, 216, 230, 321, 324, 325, 326, 198, - 192, 156, 153, 141, 0, 101, 287, 287, 370, 0, - 287, 160, 167, 54, 0, 287, 111, 285, 305, 297, - 128, 305, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 232, 231, 238, 0, 0, 0, 236, 0, 0, - 0, 0, 0, 205, 207, 0, 154, 152, 287, 294, - 313, 314, 371, 0, 286, 246, 186, 0, 51, 246, - 287, 0, 0, 233, 234, 235, 327, 318, 320, 328, - 0, 323, 0, 241, 0, 0, 369, 0, 0, 0, - 177, 167, 0, 246, 283, 368, 0, 0, 189, 372, - 0, 300, 187, 298, 0, 368, 287, 368, 305, 0, - 302, 299, 300, 300, 287, 244, 285, 0, 301, 0, - 253, 302, 302, 246, 0, 0, 287, 0, 303, 250, - 252, 0, 305, 298, 0, 247, 298, 0, 300, 300, - 300, 0, 243, 302, 67, 245, 239 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 1, 2, 3, 67, 68, 69, 70, 71, 72, - 202, 435, 73, 233, 74, 336, 295, 347, 348, 349, - 75, 194, 308, 76, 158, 250, 251, 77, 78, 157, - 247, 248, 79, 184, 185, 80, 81, 82, 83, 84, - 85, 86, 87, 142, 206, 88, 89, 90, 339, 391, - 439, 91, 92, 93, 94, 386, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 95, 481, 96, 97, 98, - 99, 100, 101, 102, 103, 120, 121, 104, 241, 179, - 148, 359, 360, 361, 547, 404, 332, 382, 423, 383, - 384, 105, 106, 432, 557, 107, 108, 188, 355, 109, - 171, 309, 111, 187, 354, 239, 300, 301, 401, 486, - 487, 534, 488, 489, 542, 490, 615, 579, 491, 492, - 228, 375, 510, 161, 198, 199, 318, 601, 602, 600, - 610, 263, 264, 265, 494, 538, 539, 495, 541, 496, - 497, 540, 498, 266, 267, 231, 174, 115, 204, 416, - 553 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -544 -static const yytype_int16 yypact[] = -{ - -544, 62, -544, 558, -544, -544, 76, 88, 126, 144, - 144, 150, 144, 144, 144, 144, 144, 144, 144, 1082, - 87, -544, -544, 159, 183, 190, 144, 144, 144, -544, - -544, 165, 165, 189, 189, -544, -544, -544, 154, -544, - -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, - -544, 203, 169, 97, 1082, 321, 212, -544, -544, 213, - 114, 321, 189, 111, -544, 165, 165, -544, -544, -544, - -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -544, -544, -544, 165, -544, -544, - -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -544, -26, -544, -544, -544, -544, - 220, -544, -544, -544, 9, -544, 153, -544, -544, -544, - -544, 63, -544, 216, -544, -544, -544, -544, -544, -544, - -544, 189, 114, 2, -544, -544, -544, -544, -544, -544, - -544, -544, -544, -544, 167, 8, -544, -544, 114, -544, - -544, -544, 182, -544, -544, 12, -544, 135, 138, -544, - 228, -544, 137, -18, 321, -544, -544, 164, 189, 321, - 1082, 205, -11, 395, 81, -544, -544, -544, -544, 144, - 167, -544, 139, 235, 179, 145, 146, 133, 133, -544, - -544, 81, 114, -544, 151, 242, 244, 148, -65, -544, - 924, 189, 114, -544, -54, -544, -544, -544, -44, 114, - -544, 924, 155, 156, 157, 158, -6, 160, 181, 185, - 186, 187, -544, -56, -12, 140, 191, 193, 161, -544, - -544, -544, -544, 162, -544, 11, -544, 203, 189, 114, - 114, 196, -544, 195, 4, 872, -544, 18, -544, -544, - 20, -544, 71, 228, -544, 203, 203, 203, 203, 203, - 199, 200, 203, 163, 202, -544, 203, 198, -27, 207, - 321, -544, -544, -544, 194, 262, -544, -544, -544, 321, - -544, -544, -544, -544, -544, -544, -544, 209, -544, 210, - -544, -544, -544, 924, 110, -544, -544, 299, -544, 167, - 204, -544, -544, -544, 188, -544, 211, -544, 811, -544, - -544, -544, -544, -544, 206, -544, -544, -544, -544, -544, - 114, 114, 114, 114, 114, 924, 924, 114, 255, 924, - 114, 64, -544, -544, 280, -544, 162, 255, 144, 328, - 223, -544, -544, 224, 144, 144, 321, 41, -544, -544, - -544, -544, -544, 189, 226, 226, 221, -544, -544, 230, - 188, -544, 231, 233, -544, 164, 198, 198, 198, -544, - -544, 229, 232, -544, -544, 246, -544, -544, -544, -544, - -544, -544, 75, 400, -544, -544, 245, -544, 246, -544, - 144, 340, 238, 255, -544, -544, 330, 240, -544, -544, - 748, 241, 243, 64, 114, 247, -544, 321, -544, 248, - -544, -544, -544, 203, 203, 249, 236, -544, -544, -544, - -544, -544, -544, 64, -544, -544, -544, -544, -544, -544, - -544, -34, -544, 250, 144, 254, 236, -544, 144, -544, - -544, 246, 253, -544, 144, 144, 256, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 302, 302, - 302, 234, -544, -544, 251, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -544, -544, 654, -544, -544, -544, - -544, 274, -544, -544, -544, -544, -544, -544, -544, -544, - -544, -544, 260, -544, 37, 164, 114, 114, 189, 270, - 114, -544, 54, -544, 259, 114, -544, 236, 924, -544, - -544, 924, -544, -544, -544, -544, -544, -544, -544, -544, - -544, -544, -544, -544, 272, 277, 278, -544, 976, 976, - 222, 1029, 339, -544, -544, 346, -544, -544, 114, -544, - -544, -544, 167, 50, -544, 279, 75, 68, -544, 279, - 114, 258, 294, -544, -544, -544, -544, -544, -544, -544, - 16, -544, 256, -544, 296, 261, -544, 189, 321, 298, - -544, 64, 300, 279, 255, 246, 301, 303, -544, 167, - 305, 334, 75, 411, 304, 246, 114, 246, 924, 144, - 391, -544, 334, 334, 114, 297, 236, 308, -544, 144, - -544, 391, 391, 279, 313, 315, 114, 316, -544, -544, - -544, 317, 924, 411, 320, -544, 411, 332, 334, 334, - 334, 318, -544, 391, -544, -544, -544 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -544, -544, 451, -544, -544, -203, -544, -544, -544, -369, - -544, -544, -544, -544, -544, -544, 118, -544, 108, -544, - -350, -544, -544, -544, -544, -544, 208, -544, -544, -544, - -544, 239, -278, -544, -544, -276, -544, -544, -544, -544, - -544, -544, -544, -8, -335, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -269, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, - -544, -544, -544, -544, -544, -10, -544, -254, -544, -544, - -114, -544, -544, 96, -544, -544, -133, -474, -544, -544, - -359, -23, 289, -544, -544, -349, -348, -544, -544, -544, - -544, 456, -150, -544, -544, 290, -544, 124, 127, -544, - -3, -263, -544, -544, -544, -61, -544, -513, -544, 6, - -544, -322, -413, -100, -544, 237, -544, -339, -420, -449, - -543, -199, -544, 166, -544, -544, -544, -313, -544, -53, - -544, -544, 10, -2, -544, 306, -119, -5, -149, -366, - -544 -}; - -/* 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 -341 -static const yytype_int16 yytable[] = -{ - 122, 114, 124, 125, 126, 127, 128, 129, 130, 112, - 144, 145, 274, 113, 132, 388, 137, 138, 139, 186, - 208, 210, 436, 515, 143, 350, 357, 182, 358, 306, - 409, 467, 181, -340, 172, 191, 296, 192, 556, 163, - 351, 586, 307, 246, 501, 249, 582, 168, 189, 154, - 468, 483, 484, 155, 168, 168, 253, 165, 166, 162, - 254, 493, 4, 168, 511, 385, 286, 270, 619, 620, - 594, 441, 212, 287, 244, 517, 271, 270, 350, 167, - 344, 345, 357, -338, 358, 176, 272, 177, 28, 168, - 636, 333, 243, 351, 343, 169, 314, 141, 315, 201, - 621, 116, 269, 169, 560, 364, 211, 592, 180, 273, - 288, 279, -340, 173, 160, 117, 280, 467, 289, 51, - 173, 183, 469, 298, 470, 346, 371, 372, 229, 193, - 297, 471, -340, 310, -340, 312, 468, 483, 484, 302, - 303, 320, 321, 322, 323, 324, 482, 493, 327, 344, - 345, 118, 330, 611, 612, 548, 397, 28, 270, 150, - 151, 152, 203, 316, 153, 209, 119, 203, 576, 232, - 549, 577, -185, 378, 379, -185, 123, 380, 268, 632, - 633, 634, 381, 378, 379, 134, 580, 380, 51, 581, - 140, 141, 381, 616, 346, 417, 535, 536, 418, 419, - 420, 421, 422, 628, 133, 229, 630, 230, 469, 135, - 470, 20, 21, 356, 22, 299, 136, 471, 146, 596, - 366, 367, 368, 369, 370, 567, 568, 373, 147, 604, - 377, 606, 482, 410, 411, 412, 149, 156, 159, 160, - 164, 170, 178, 114, 317, 175, 190, 22, 168, 195, - 485, 112, 196, 197, 200, 113, 205, 33, 504, -145, - 234, 235, 595, 236, 238, 245, 237, 246, 335, 249, - 252, 275, 338, 290, 276, 131, 294, 340, 293, 277, - 278, 328, 281, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 506, - 507, 52, 53, 282, 502, 54, 114, 283, 284, 285, - 304, 305, 337, 291, 112, 292, 325, 326, 113, 561, - 331, 334, 562, 329, 352, 353, 61, 28, 389, 362, - 299, 341, 342, 64, 394, 395, 485, 365, 374, 390, - 400, 392, 393, 403, 396, 405, 22, 413, 407, 408, - 414, 415, 438, 434, 440, 442, 443, 499, 509, 500, - 431, 533, 554, 503, 572, 537, 508, 512, 505, 514, - 518, 574, 599, 521, 131, 558, 584, 588, 433, -249, - 437, 546, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 114, 607, - 52, 53, 545, 563, 54, 203, 550, 551, 564, 565, - 555, 578, 585, 587, 591, 559, 593, 444, 211, 609, - 603, 597, 598, 627, 513, 22, 617, 424, 516, 614, - 622, 623, 64, 626, 519, 520, 629, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 532, 575, 625, - 631, 635, 5, 131, 387, 398, 406, 207, 313, 110, - 583, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 399, 240, 52, - 53, 573, 402, 544, 114, 552, 311, 0, 571, 0, - 319, 0, 425, 426, 0, 376, 605, 242, 0, 0, - 427, 428, 429, 430, 613, 0, 0, 0, 0, 0, - 0, 64, 213, 0, 214, 215, 624, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 0, 225, 0, 226, - 227, 0, 0, 0, 0, 0, 114, 114, 570, 114, - 0, 0, 0, 0, 0, 0, 569, 0, 0, 0, - 0, 0, 0, 0, 589, 0, 0, 0, 0, 0, - 0, 6, 7, 8, 0, 9, 10, 11, 0, 0, - 0, 12, 13, 14, 15, 16, 590, 17, 18, 19, - 0, 20, 21, 22, 0, 0, 0, 0, 0, 608, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 618, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 0, 0, 0, 0, 0, 0, 0, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 0, 51, 52, 53, 0, - 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 55, 56, 57, 58, 59, 60, 0, 0, - 444, 0, 61, 0, 0, 62, 0, 0, 63, 64, - 65, 66, 445, 0, 0, 0, 0, 20, 21, 446, - 0, 0, 0, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 0, 0, 456, 457, 0, 0, 0, 0, - 0, 28, 0, 0, 0, 0, 33, 34, 458, 459, - 460, 461, 462, 0, 463, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 464, 51, 52, 53, 0, 0, 54, 465, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, - 0, 0, 0, 0, 444, 0, 0, 0, 61, 0, - 0, 62, 0, 466, 0, 64, 445, 0, 0, 543, - 0, 20, 21, 446, 0, 0, 0, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 0, 0, 456, 457, - 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, - 33, 34, 458, 459, 460, 461, 462, 0, 463, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 464, 51, 52, 53, 0, - 0, 54, 465, 0, 20, 21, 22, 0, 0, 0, - 0, 0, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 0, 61, 0, 0, 62, 0, 466, 28, 64, - 0, 0, 0, 33, 34, 0, 0, 0, 0, 0, - 0, 0, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 0, 51, - 52, 53, 0, 0, 54, 20, 21, 22, 0, 0, - 0, 0, 0, 0, 0, 55, 56, 0, 0, 0, - 0, 0, 0, 0, 0, 61, 0, 0, 62, 28, - 0, 63, 64, 0, 33, 34, 363, 0, 0, 0, - 0, 0, 0, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 22, - 51, 52, 53, 0, 0, 54, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 55, 56, 0, 0, - 0, 0, 0, 0, 0, 0, 61, 131, 0, 62, - 0, 0, 63, 64, 0, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 22, 0, 52, 53, 0, 0, 54, 0, 255, - 256, 257, 258, 259, 260, 261, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, - 262, 0, 0, 0, 0, 64, 0, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 566, 22, 52, 53, 0, 0, 54, - 465, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 61, 0, 131, 0, 0, 0, 0, 64, 0, 0, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 566, 22, 52, 53, - 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 61, 0, 131, 0, 0, 0, 0, - 64, 0, 0, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, - 0, 52, 53, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 64 -}; - -static const yytype_int16 yycheck[] = -{ - 10, 3, 12, 13, 14, 15, 16, 17, 18, 3, - 33, 34, 211, 3, 19, 337, 26, 27, 28, 133, - 169, 171, 388, 436, 32, 294, 304, 25, 304, 25, - 365, 400, 132, 25, 25, 154, 25, 25, 512, 62, - 294, 25, 245, 25, 403, 25, 559, 81, 148, 54, - 400, 400, 400, 55, 81, 81, 121, 65, 66, 61, - 125, 400, 0, 81, 423, 334, 122, 121, 611, 612, - 583, 393, 172, 129, 193, 441, 130, 121, 347, 87, - 39, 40, 360, 117, 360, 22, 130, 24, 47, 81, - 633, 118, 192, 347, 293, 129, 25, 26, 27, 117, - 613, 25, 202, 129, 517, 308, 117, 581, 131, 209, - 122, 117, 104, 104, 125, 27, 122, 486, 130, 78, - 104, 119, 400, 237, 400, 84, 325, 326, 124, 117, - 119, 400, 124, 115, 126, 115, 486, 486, 486, 239, - 240, 255, 256, 257, 258, 259, 400, 486, 262, 39, - 40, 25, 266, 602, 603, 118, 115, 47, 121, 62, - 63, 64, 164, 92, 67, 170, 22, 169, 118, 179, - 505, 121, 118, 119, 120, 121, 26, 123, 201, 628, - 629, 630, 128, 119, 120, 26, 118, 123, 78, 121, - 25, 26, 128, 606, 84, 120, 459, 460, 123, 124, - 125, 126, 127, 623, 117, 124, 626, 126, 486, 26, - 486, 23, 24, 25, 25, 238, 26, 486, 64, 585, - 320, 321, 322, 323, 324, 538, 539, 327, 25, 595, - 330, 597, 486, 366, 367, 368, 67, 25, 25, 125, - 129, 21, 26, 245, 252, 92, 64, 25, 81, 114, - 400, 245, 114, 25, 117, 245, 92, 52, 407, 120, - 25, 82, 584, 118, 131, 114, 120, 25, 270, 25, - 122, 116, 10, 133, 118, 53, 114, 279, 117, 122, - 122, 118, 122, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 413, - 414, 79, 80, 122, 404, 83, 308, 122, 122, 122, - 114, 116, 118, 122, 308, 122, 117, 117, 308, 518, - 122, 114, 521, 121, 25, 121, 104, 47, 338, 118, - 353, 122, 122, 111, 344, 345, 486, 131, 83, 11, - 114, 118, 118, 122, 346, 115, 25, 118, 117, 116, - 118, 105, 12, 108, 116, 25, 116, 116, 122, 116, - 383, 59, 92, 116, 25, 131, 117, 117, 120, 115, - 117, 25, 38, 117, 53, 116, 118, 116, 383, 128, - 390, 121, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 400, 598, - 79, 80, 128, 131, 83, 407, 506, 507, 131, 131, - 510, 132, 118, 117, 116, 515, 116, 6, 117, 28, - 116, 118, 117, 622, 434, 25, 118, 27, 438, 132, - 117, 116, 111, 116, 444, 445, 116, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 548, 133, - 118, 133, 1, 53, 336, 347, 360, 168, 250, 3, - 560, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 353, 188, 79, - 80, 542, 355, 486, 486, 508, 247, -1, 541, -1, - 253, -1, 92, 93, -1, 329, 596, 191, -1, -1, - 100, 101, 102, 103, 604, -1, -1, -1, -1, -1, - -1, 111, 117, -1, 119, 120, 616, 122, 123, 124, - 125, 126, 127, 128, 129, 130, -1, 132, -1, 134, - 135, -1, -1, -1, -1, -1, 538, 539, 540, 541, - -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, - -1, -1, -1, -1, 577, -1, -1, -1, -1, -1, - -1, 3, 4, 5, -1, 7, 8, 9, -1, -1, - -1, 13, 14, 15, 16, 17, 578, 19, 20, 21, - -1, 23, 24, 25, -1, -1, -1, -1, -1, 599, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 609, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, -1, -1, -1, -1, -1, -1, -1, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, -1, 78, 79, 80, -1, - -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 94, 95, 96, 97, 98, 99, -1, -1, - 6, -1, 104, -1, -1, 107, -1, -1, 110, 111, - 112, 113, 18, -1, -1, -1, -1, 23, 24, 25, - -1, -1, -1, 29, 30, 31, 32, 33, 34, 35, - 36, 37, -1, -1, 40, 41, -1, -1, -1, -1, - -1, 47, -1, -1, -1, -1, 52, 53, 54, 55, - 56, 57, 58, -1, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, -1, -1, 83, 84, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 94, 95, - -1, -1, -1, -1, 6, -1, -1, -1, 104, -1, - -1, 107, -1, 109, -1, 111, 18, -1, -1, 115, - -1, 23, 24, 25, -1, -1, -1, 29, 30, 31, - 32, 33, 34, 35, 36, 37, -1, -1, 40, 41, - -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, - 52, 53, 54, 55, 56, 57, 58, -1, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, -1, - -1, 83, 84, -1, 23, 24, 25, -1, -1, -1, - -1, -1, 94, 95, -1, -1, -1, -1, -1, -1, - -1, -1, 104, -1, -1, 107, -1, 109, 47, 111, - -1, -1, -1, 52, 53, -1, -1, -1, -1, -1, - -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, -1, 78, - 79, 80, -1, -1, 83, 23, 24, 25, -1, -1, - -1, -1, -1, -1, -1, 94, 95, -1, -1, -1, - -1, -1, -1, -1, -1, 104, -1, -1, 107, 47, - -1, 110, 111, -1, 52, 53, 115, -1, -1, -1, - -1, -1, -1, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 25, - 78, 79, 80, -1, -1, 83, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 94, 95, -1, -1, - -1, -1, -1, -1, -1, -1, 104, 53, -1, 107, - -1, -1, 110, 111, -1, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 25, -1, 79, 80, -1, -1, 83, -1, 85, - 86, 87, 88, 89, 90, 91, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, - 106, -1, -1, -1, -1, 111, -1, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 25, 79, 80, -1, -1, 83, - 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 104, -1, 53, -1, -1, -1, -1, 111, -1, -1, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 25, 79, 80, - -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 104, -1, 53, -1, -1, -1, -1, - 111, -1, -1, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, -1, - -1, 79, 80, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 111 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint16 yystos[] = -{ - 0, 137, 138, 139, 0, 138, 3, 4, 5, 7, - 8, 9, 13, 14, 15, 16, 17, 19, 20, 21, - 23, 24, 25, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 78, 79, 80, 83, 94, 95, 96, 97, 98, - 99, 104, 107, 110, 111, 112, 113, 140, 141, 142, - 143, 144, 145, 148, 150, 156, 159, 163, 164, 168, - 171, 172, 173, 174, 175, 176, 177, 178, 181, 182, - 183, 187, 188, 189, 190, 201, 203, 204, 205, 206, - 207, 208, 209, 210, 213, 227, 228, 231, 232, 235, - 237, 238, 255, 278, 279, 283, 25, 27, 25, 22, - 211, 212, 211, 26, 211, 211, 211, 211, 211, 211, - 211, 53, 283, 117, 26, 26, 26, 211, 211, 211, - 25, 26, 179, 179, 227, 227, 64, 25, 216, 67, - 62, 63, 64, 67, 283, 279, 25, 165, 160, 25, - 125, 259, 279, 227, 129, 179, 179, 179, 81, 129, - 21, 236, 25, 104, 282, 92, 22, 24, 26, 215, - 227, 259, 25, 119, 169, 170, 216, 239, 233, 259, - 64, 282, 25, 117, 157, 114, 114, 25, 260, 261, - 117, 117, 146, 279, 284, 92, 180, 228, 284, 283, - 238, 117, 259, 117, 119, 120, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 132, 134, 135, 256, 124, - 126, 281, 211, 149, 25, 82, 118, 120, 131, 241, - 241, 214, 281, 259, 282, 114, 25, 166, 167, 25, - 161, 162, 122, 121, 125, 85, 86, 87, 88, 89, - 90, 91, 106, 267, 268, 269, 279, 280, 227, 259, - 121, 130, 130, 259, 267, 116, 118, 122, 122, 117, - 122, 122, 122, 122, 122, 122, 122, 129, 122, 130, - 133, 122, 122, 117, 114, 152, 25, 119, 216, 227, - 242, 243, 259, 259, 114, 116, 25, 141, 158, 237, - 115, 167, 115, 162, 25, 27, 92, 179, 262, 261, - 216, 216, 216, 216, 216, 117, 117, 216, 118, 121, - 216, 122, 222, 118, 114, 279, 151, 118, 10, 184, - 279, 122, 122, 267, 39, 40, 84, 153, 154, 155, - 190, 213, 25, 121, 240, 234, 25, 168, 171, 217, - 218, 219, 118, 115, 141, 131, 259, 259, 259, 259, - 259, 267, 267, 259, 83, 257, 269, 259, 119, 120, - 123, 128, 223, 225, 226, 190, 191, 152, 257, 211, - 11, 185, 118, 118, 211, 211, 279, 115, 154, 243, - 114, 244, 244, 122, 221, 115, 219, 117, 116, 180, - 222, 222, 222, 118, 118, 105, 285, 120, 123, 124, - 125, 126, 127, 224, 27, 92, 93, 100, 101, 102, - 103, 227, 229, 283, 108, 147, 285, 211, 12, 186, - 116, 257, 25, 116, 6, 18, 25, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 40, 41, 54, 55, - 56, 57, 58, 60, 77, 84, 109, 145, 156, 168, - 171, 190, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 202, 213, 231, 232, 238, 245, 246, 248, 249, - 251, 254, 255, 263, 270, 273, 275, 276, 278, 116, - 116, 226, 259, 116, 284, 120, 216, 216, 117, 122, - 258, 226, 117, 211, 115, 258, 211, 285, 117, 211, - 211, 117, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 59, 247, 247, 247, 131, 271, 272, - 277, 274, 250, 115, 246, 128, 121, 220, 118, 180, - 259, 259, 227, 286, 92, 259, 223, 230, 116, 259, - 258, 267, 267, 131, 131, 131, 77, 273, 273, 255, - 279, 275, 25, 251, 25, 259, 118, 121, 132, 253, - 118, 121, 253, 259, 118, 118, 25, 117, 116, 227, - 279, 116, 223, 116, 253, 257, 285, 118, 117, 38, - 265, 263, 264, 116, 285, 259, 285, 267, 211, 28, - 266, 265, 265, 259, 132, 252, 258, 118, 211, 266, - 266, 253, 117, 116, 259, 133, 116, 267, 264, 116, - 264, 118, 265, 265, 265, 133, 266 -}; - -#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 <stdio.h> /* 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 354 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* - * We don't do these in parserEOF() because the parser is reading - * ahead and that would be too early. - */ - - if (previousFile != NULL) - { - handleEOF(); - - if (currentContext.prevmod != NULL) - handleEOM(); - - free(previousFile); - previousFile = NULL; - } - } - break; - - case 22: - -/* Line 1455 of yacc.c */ -#line 389 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tSpec->exphdrcode, (yyvsp[(1) - (1)].codeb)); - } - break; - - case 23: - -/* Line 1455 of yacc.c */ -#line 393 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tModule->hdrcode, (yyvsp[(1) - (1)].codeb)); - } - break; - - case 24: - -/* Line 1455 of yacc.c */ -#line 397 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tModule->cppcode, (yyvsp[(1) - (1)].codeb)); - } - break; - - case 47: - -/* Line 1455 of yacc.c */ -#line 425 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope == NULL) - yyerror("%TypeHeaderCode can only be used in a namespace, class or mapped type"); - - appendCodeBlock(&scope->iff->hdrcode, (yyvsp[(1) - (1)].codeb)); - } - } - break; - - case 48: - -/* Line 1455 of yacc.c */ -#line 438 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if ((currentModule->encoding = convertEncoding((yyvsp[(2) - (2)].text))) == no_type) - yyerror("The value of %DefaultEncoding must be one of \"ASCII\", \"Latin-1\", \"UTF-8\" or \"None\""); - } - } - break; - - case 49: - -/* Line 1455 of yacc.c */ -#line 447 "/TEMP/sip4-tqt/sipgen/parser.y" - { - appendString(¤tSpec->plugins, (yyvsp[(2) - (2)].text)); - } - break; - - case 50: - -/* Line 1455 of yacc.c */ -#line 452 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - apiVersionRangeDef *avd; - - if (findAPI(currentSpec, (yyvsp[(2) - (3)].text)) != NULL) - yyerror("The API name in the %API directive has already been defined"); - - if ((yyvsp[(3) - (3)].number) < 1) - yyerror("The version number in the %API directive must be greater than or equal to 1"); - - avd = sipMalloc(sizeof (apiVersionRangeDef)); - - avd->api_name = cacheName(currentSpec, (yyvsp[(2) - (3)].text)); - avd->from = (yyvsp[(3) - (3)].number); - avd->to = -1; - - avd->next = currentModule->api_versions; - currentModule->api_versions = avd; - - if (inMainModule()) - setIsUsedName(avd->api_name); - } - } - break; - - case 51: - -/* Line 1455 of yacc.c */ -#line 478 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - exceptionDef *xd; - const char *pyname; - - if (currentSpec->genc) - yyerror("%Exception not allowed in a C module"); - - pyname = getPythonName(&(yyvsp[(4) - (9)].optflags), scopedNameTail((yyvsp[(2) - (9)].scpvalp))); - - checkAttributes(currentSpec, currentModule, NULL, NULL, - pyname, FALSE); - - xd = findException(currentSpec, (yyvsp[(2) - (9)].scpvalp), TRUE); - - if (xd->cd != NULL) - yyerror("%Exception name has already been seen as a class name - it must be defined before being used"); - - if (xd->iff->module != NULL) - yyerror("The %Exception has already been defined"); - - /* Complete the definition. */ - xd->iff->module = currentModule; - xd->iff->hdrcode = (yyvsp[(6) - (9)].codeb); - xd->pyname = pyname; - xd->bibase = (yyvsp[(3) - (9)].exceptionbase).bibase; - xd->base = (yyvsp[(3) - (9)].exceptionbase).base; - xd->raisecode = (yyvsp[(7) - (9)].codeb); - - if (findOptFlag(&(yyvsp[(4) - (9)].optflags), "Default", bool_flag) != NULL) - currentModule->defexception = xd; - - if (xd->bibase != NULL || xd->base != NULL) - xd->exceptionnr = currentModule->nrexceptions++; - } - } - break; - - case 52: - -/* Line 1455 of yacc.c */ -#line 517 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.exceptionbase).bibase = NULL; - (yyval.exceptionbase).base = NULL; - } - break; - - case 53: - -/* Line 1455 of yacc.c */ -#line 521 "/TEMP/sip4-tqt/sipgen/parser.y" - { - exceptionDef *xd; - - (yyval.exceptionbase).bibase = NULL; - (yyval.exceptionbase).base = NULL; - - /* See if it is a defined exception. */ - for (xd = currentSpec->exceptions; xd != NULL; xd = xd->next) - if (compareScopedNames(xd->iff->fqcname, (yyvsp[(2) - (3)].scpvalp)) == 0) - { - (yyval.exceptionbase).base = xd; - break; - } - - if (xd == NULL && (yyvsp[(2) - (3)].scpvalp)->next == NULL && strncmp((yyvsp[(2) - (3)].scpvalp)->name, "SIP_", 4) == 0) - { - /* See if it is a builtin exception. */ - - static char *builtins[] = { - "Exception", - "StopIteration", - "StandardError", - "ArithmeticError", - "LookupError", - "AssertionError", - "AttributeError", - "EOFError", - "FloatingPointError", - "EnvironmentError", - "IOError", - "OSError", - "ImportError", - "IndexError", - "KeyError", - "KeyboardInterrupt", - "MemoryError", - "NameError", - "OverflowError", - "RuntimeError", - "NotImplementedError", - "SyntaxError", - "IndentationError", - "TabError", - "ReferenceError", - "SystemError", - "SystemExit", - "TypeError", - "UnboundLocalError", - "UnicodeError", - "UnicodeEncodeError", - "UnicodeDecodeError", - "UnicodeTranslateError", - "ValueError", - "ZeroDivisionError", - "WindowsError", - "VMSError", - NULL - }; - - char **cp; - - for (cp = builtins; *cp != NULL; ++cp) - if (strcmp((yyvsp[(2) - (3)].scpvalp)->name + 4, *cp) == 0) - { - (yyval.exceptionbase).bibase = *cp; - break; - } - } - - if ((yyval.exceptionbase).bibase == NULL && (yyval.exceptionbase).base == NULL) - yyerror("Unknown exception base type"); - } - break; - - case 54: - -/* Line 1455 of yacc.c */ -#line 595 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 55: - -/* Line 1455 of yacc.c */ -#line 600 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - currentMappedType = newMappedType(currentSpec, &(yyvsp[(2) - (3)].memArg), &(yyvsp[(3) - (3)].optflags)); - } - break; - - case 57: - -/* Line 1455 of yacc.c */ -#line 606 "/TEMP/sip4-tqt/sipgen/parser.y" - { - int a; - - if (currentSpec->genc) - yyerror("%MappedType templates not allowed in a C module"); - - /* Check the template arguments are basic types or simple names. */ - for (a = 0; a < (yyvsp[(1) - (4)].signature).nrArgs; ++a) - { - argDef *ad = &(yyvsp[(1) - (4)].signature).args[a]; - - if (ad->atype == defined_type && ad->u.snd->next != NULL) - yyerror("%MappedType template arguments must be simple names"); - } - - if ((yyvsp[(3) - (4)].memArg).atype != template_type) - yyerror("%MappedType template must map a template type"); - - if (notSkipping()) - { - mappedTypeTmplDef *mtt; - ifaceFileDef *iff; - - /* Check a template hasn't already been provided. */ - for (mtt = currentSpec->mappedtypetemplates; mtt != NULL; mtt = mtt->next) - if (compareScopedNames(mtt->mt->type.u.td->fqname, (yyvsp[(3) - (4)].memArg).u.td->fqname) == 0 && sameTemplateSignature(&mtt->mt->type.u.td->types, &(yyvsp[(3) - (4)].memArg).u.td->types, TRUE)) - yyerror("%MappedType template for this type has already been defined"); - - (yyvsp[(3) - (4)].memArg).nrderefs = 0; - (yyvsp[(3) - (4)].memArg).argflags = 0; - - mtt = sipMalloc(sizeof (mappedTypeTmplDef)); - - mtt->sig = (yyvsp[(1) - (4)].signature); - mtt->mt = allocMappedType(currentSpec, &(yyvsp[(3) - (4)].memArg)); - mtt->mt->doctype = getDocType(&(yyvsp[(4) - (4)].optflags)); - mtt->next = currentSpec->mappedtypetemplates; - - currentSpec->mappedtypetemplates = mtt; - - currentMappedType = mtt->mt; - - /* Create a dummy interface file. */ - iff = sipMalloc(sizeof (ifaceFileDef)); - iff->hdrcode = NULL; - mtt->mt->iff = iff; - } - } - break; - - case 59: - -/* Line 1455 of yacc.c */ -#line 656 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (currentMappedType->convfromcode == NULL) - yyerror("%MappedType must have a %ConvertFromTypeCode directive"); - - if (currentMappedType->convtocode == NULL) - yyerror("%MappedType must have a %ConvertToTypeCode directive"); - - currentMappedType = NULL; - } - } - break; - - case 62: - -/* Line 1455 of yacc.c */ -#line 674 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tMappedType->iff->hdrcode, (yyvsp[(1) - (1)].codeb)); - } - break; - - case 63: - -/* Line 1455 of yacc.c */ -#line 678 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (currentMappedType -> convfromcode != NULL) - yyerror("%MappedType has more than one %ConvertFromTypeCode directive"); - - currentMappedType -> convfromcode = (yyvsp[(2) - (2)].codeb); - } - } - break; - - case 64: - -/* Line 1455 of yacc.c */ -#line 687 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (currentMappedType -> convtocode != NULL) - yyerror("%MappedType has more than one %ConvertToTypeCode directive"); - - currentMappedType -> convtocode = (yyvsp[(2) - (2)].codeb); - } - } - break; - - case 67: - -/* Line 1455 of yacc.c */ -#line 700 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - applyTypeFlags(currentModule, &(yyvsp[(2) - (13)].memArg), &(yyvsp[(9) - (13)].optflags)); - - (yyvsp[(5) - (13)].signature).result = (yyvsp[(2) - (13)].memArg); - - newFunction(currentSpec, currentModule, NULL, - currentMappedType, 0, TRUE, FALSE, FALSE, FALSE, (yyvsp[(3) - (13)].text), - &(yyvsp[(5) - (13)].signature), (yyvsp[(7) - (13)].number), FALSE, &(yyvsp[(9) - (13)].optflags), (yyvsp[(13) - (13)].codeb), NULL, (yyvsp[(8) - (13)].throwlist), (yyvsp[(10) - (13)].optsignature), (yyvsp[(12) - (13)].codeb)); - } - } - break; - - case 68: - -/* Line 1455 of yacc.c */ -#line 714 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("namespace definition not allowed in a C module"); - - if (notSkipping()) - { - classDef *ns, *c_scope; - ifaceFileDef *scope; - - if ((c_scope = currentScope()) != NULL) - scope = c_scope->iff; - else - scope = NULL; - - ns = newClass(currentSpec, namespace_iface, NULL, - text2scopedName(scope, (yyvsp[(2) - (2)].text))); - - pushScope(ns); - - sectionFlags = 0; - } - } - break; - - case 69: - -/* Line 1455 of yacc.c */ -#line 735 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (inMainModule()) - { - classDef *ns = currentScope(); - - setIsUsedName(ns->iff->name); - setIsUsedName(ns->pyname); - } - - popScope(); - } - } - break; - - case 72: - -/* Line 1455 of yacc.c */ -#line 755 "/TEMP/sip4-tqt/sipgen/parser.y" - { - qualDef *qd; - - for (qd = currentModule -> qualifiers; qd != NULL; qd = qd -> next) - if (qd -> qtype == platform_qualifier) - yyerror("%Platforms has already been defined for this module"); - } - break; - - case 73: - -/* Line 1455 of yacc.c */ -#line 762 "/TEMP/sip4-tqt/sipgen/parser.y" - { - qualDef *qd; - int nrneeded; - - /* - * Check that exactly one platform in the set was - * requested. - */ - - nrneeded = 0; - - for (qd = currentModule -> qualifiers; qd != NULL; qd = qd -> next) - if (qd -> qtype == platform_qualifier && isNeeded(qd)) - ++nrneeded; - - if (nrneeded > 1) - yyerror("No more than one of these %Platforms must be specified with the -t flag"); - } - break; - - case 76: - -/* Line 1455 of yacc.c */ -#line 786 "/TEMP/sip4-tqt/sipgen/parser.y" - { - newQualifier(currentModule,-1,-1,(yyvsp[(1) - (1)].text),platform_qualifier); - } - break; - - case 77: - -/* Line 1455 of yacc.c */ -#line 791 "/TEMP/sip4-tqt/sipgen/parser.y" - { - newQualifier(currentModule,-1,-1,(yyvsp[(2) - (2)].text),feature_qualifier); - } - break; - - case 78: - -/* Line 1455 of yacc.c */ -#line 796 "/TEMP/sip4-tqt/sipgen/parser.y" - { - currentTimelineOrder = 0; - } - break; - - case 79: - -/* Line 1455 of yacc.c */ -#line 799 "/TEMP/sip4-tqt/sipgen/parser.y" - { - qualDef *qd; - int nrneeded; - - /* - * Check that exactly one time slot in the set was - * requested. - */ - - nrneeded = 0; - - for (qd = currentModule -> qualifiers; qd != NULL; qd = qd -> next) - if (qd -> qtype == time_qualifier && isNeeded(qd)) - ++nrneeded; - - if (nrneeded > 1) - yyerror("At most one of this %Timeline must be specified with the -t flag"); - - currentModule -> nrtimelines++; - } - break; - - case 82: - -/* Line 1455 of yacc.c */ -#line 825 "/TEMP/sip4-tqt/sipgen/parser.y" - { - newQualifier(currentModule,currentModule -> nrtimelines,currentTimelineOrder++,(yyvsp[(1) - (1)].text),time_qualifier); - } - break; - - case 83: - -/* Line 1455 of yacc.c */ -#line 830 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (skipStackPtr >= MAX_NESTED_IF) - yyerror("Internal error: increase the value of MAX_NESTED_IF"); - - /* Nested %Ifs are implicit logical ands. */ - - if (skipStackPtr > 0) - (yyvsp[(3) - (4)].boolean) = ((yyvsp[(3) - (4)].boolean) && skipStack[skipStackPtr - 1]); - - skipStack[skipStackPtr++] = (yyvsp[(3) - (4)].boolean); - } - break; - - case 84: - -/* Line 1455 of yacc.c */ -#line 843 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = platOrFeature((yyvsp[(1) - (1)].text),FALSE); - } - break; - - case 85: - -/* Line 1455 of yacc.c */ -#line 846 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = platOrFeature((yyvsp[(2) - (2)].text),TRUE); - } - break; - - case 86: - -/* Line 1455 of yacc.c */ -#line 849 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = (platOrFeature((yyvsp[(3) - (3)].text),FALSE) || (yyvsp[(1) - (3)].boolean)); - } - break; - - case 87: - -/* Line 1455 of yacc.c */ -#line 852 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = (platOrFeature((yyvsp[(4) - (4)].text),TRUE) || (yyvsp[(1) - (4)].boolean)); - } - break; - - case 89: - -/* Line 1455 of yacc.c */ -#line 858 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = timePeriod((yyvsp[(1) - (3)].text),(yyvsp[(3) - (3)].text)); - } - break; - - case 90: - -/* Line 1455 of yacc.c */ -#line 863 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (skipStackPtr-- <= 0) - yyerror("Too many %End directives"); - } - break; - - case 91: - -/* Line 1455 of yacc.c */ -#line 869 "/TEMP/sip4-tqt/sipgen/parser.y" - { - optFlag *of; - - if ((yyvsp[(2) - (2)].optflags).nrFlags == 0) - yyerror("%License details not specified"); - - if ((of = findOptFlag(&(yyvsp[(2) - (2)].optflags),"Type",string_flag)) == NULL) - yyerror("%License type not specified"); - - currentModule -> license = sipMalloc(sizeof (licenseDef)); - - currentModule -> license -> type = of -> fvalue.sval; - - currentModule -> license -> licensee = - ((of = findOptFlag(&(yyvsp[(2) - (2)].optflags),"Licensee",string_flag)) != NULL) - ? of -> fvalue.sval : NULL; - - currentModule -> license -> timestamp = - ((of = findOptFlag(&(yyvsp[(2) - (2)].optflags),"Timestamp",string_flag)) != NULL) - ? of -> fvalue.sval : NULL; - - currentModule -> license -> sig = - ((of = findOptFlag(&(yyvsp[(2) - (2)].optflags),"Signature",string_flag)) != NULL) - ? of -> fvalue.sval : NULL; - } - break; - - case 92: - -/* Line 1455 of yacc.c */ -#line 896 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (currentModule->defmetatype != NULL) - yyerror("%DefaultMetatype has already been defined for this module"); - - currentModule->defmetatype = cacheName(currentSpec, (yyvsp[(2) - (2)].text)); - } - } - break; - - case 93: - -/* Line 1455 of yacc.c */ -#line 907 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (currentModule->defsupertype != NULL) - yyerror("%DefaultSupertype has already been defined for this module"); - - currentModule->defsupertype = cacheName(currentSpec, (yyvsp[(2) - (2)].text)); - } - } - break; - - case 94: - -/* Line 1455 of yacc.c */ -#line 918 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Make sure this is the first mention of a module. */ - if (currentSpec->module != currentModule) - yyerror("A %ConsolidatedModule cannot be %Imported"); - - if (currentModule->fullname != NULL) - yyerror("%ConsolidatedModule must appear before any %Module or %CModule directive"); - - setModuleName(currentSpec, currentModule, (yyvsp[(2) - (2)].text)); - setIsConsolidated(currentModule); - } - break; - - case 95: - -/* Line 1455 of yacc.c */ -#line 931 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Make sure this is the first mention of a module. */ - if (currentSpec->module != currentModule) - yyerror("A %CompositeModule cannot be %Imported"); - - if (currentModule->fullname != NULL) - yyerror("%CompositeModule must appear before any %Module or %CModule directive"); - - setModuleName(currentSpec, currentModule, (yyvsp[(2) - (2)].text)); - setIsComposite(currentModule); - } - break; - - case 96: - -/* Line 1455 of yacc.c */ -#line 944 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Check the module hasn't already been defined. */ - - moduleDef *mod; - - for (mod = currentSpec->modules; mod != NULL; mod = mod->next) - if (mod->fullname != NULL && strcmp(mod->fullname->text, (yyvsp[(2) - (3)].text)) == 0) - yyerror("Module is already defined"); - - /* - * If we are in a container module then create a component module - * and make it current. - */ - if (isContainer(currentModule) || currentModule->container != NULL) - { - mod = allocModule(); - - mod->file = currentContext.filename; - mod->container = (isContainer(currentModule) ? currentModule : currentModule->container); - - currentModule = mod; - } - - setModuleName(currentSpec, currentModule, (yyvsp[(2) - (3)].text)); - currentModule->version = (yyvsp[(3) - (3)].number); - - if (currentSpec->genc < 0) - currentSpec->genc = (yyvsp[(1) - (3)].boolean); - else if (currentSpec->genc != (yyvsp[(1) - (3)].boolean)) - yyerror("Cannot mix C and C++ modules"); - } - break; - - case 97: - -/* Line 1455 of yacc.c */ -#line 977 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = FALSE; - } - break; - - case 98: - -/* Line 1455 of yacc.c */ -#line 980 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = TRUE; - } - break; - - case 100: - -/* Line 1455 of yacc.c */ -#line 986 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* - * The grammar design is a bit broken and this is the easiest way - * to allow periods in names. - */ - - char *cp; - - for (cp = (yyvsp[(1) - (1)].text); *cp != '\0'; ++cp) - if (*cp != '.' && *cp != '_' && !isalnum(*cp)) - yyerror("Invalid character in name"); - - (yyval.text) = (yyvsp[(1) - (1)].text); - } - break; - - case 101: - -/* Line 1455 of yacc.c */ -#line 1002 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = -1; - } - break; - - case 103: - -/* Line 1455 of yacc.c */ -#line 1008 "/TEMP/sip4-tqt/sipgen/parser.y" - { - parseFile(NULL, (yyvsp[(2) - (2)].text), NULL, FALSE); - } - break; - - case 104: - -/* Line 1455 of yacc.c */ -#line 1013 "/TEMP/sip4-tqt/sipgen/parser.y" - { - parseFile(NULL, (yyvsp[(2) - (2)].text), NULL, TRUE); - } - break; - - case 105: - -/* Line 1455 of yacc.c */ -#line 1018 "/TEMP/sip4-tqt/sipgen/parser.y" - { - newImport((yyvsp[(2) - (2)].text)); - } - break; - - case 106: - -/* Line 1455 of yacc.c */ -#line 1023 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 107: - -/* Line 1455 of yacc.c */ -#line 1026 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 108: - -/* Line 1455 of yacc.c */ -#line 1031 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 109: - -/* Line 1455 of yacc.c */ -#line 1034 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 110: - -/* Line 1455 of yacc.c */ -#line 1039 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 111: - -/* Line 1455 of yacc.c */ -#line 1042 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 112: - -/* Line 1455 of yacc.c */ -#line 1047 "/TEMP/sip4-tqt/sipgen/parser.y" - { - appendCodeBlock(¤tModule->copying, (yyvsp[(2) - (2)].codeb)); - } - break; - - case 113: - -/* Line 1455 of yacc.c */ -#line 1052 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 114: - -/* Line 1455 of yacc.c */ -#line 1057 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 115: - -/* Line 1455 of yacc.c */ -#line 1062 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 116: - -/* Line 1455 of yacc.c */ -#line 1067 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 118: - -/* Line 1455 of yacc.c */ -#line 1073 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 119: - -/* Line 1455 of yacc.c */ -#line 1078 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 120: - -/* Line 1455 of yacc.c */ -#line 1083 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 121: - -/* Line 1455 of yacc.c */ -#line 1088 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 122: - -/* Line 1455 of yacc.c */ -#line 1093 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 123: - -/* Line 1455 of yacc.c */ -#line 1098 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 124: - -/* Line 1455 of yacc.c */ -#line 1103 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 125: - -/* Line 1455 of yacc.c */ -#line 1108 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 126: - -/* Line 1455 of yacc.c */ -#line 1113 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 127: - -/* Line 1455 of yacc.c */ -#line 1118 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 128: - -/* Line 1455 of yacc.c */ -#line 1123 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 129: - -/* Line 1455 of yacc.c */ -#line 1128 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tModule->preinitcode, (yyvsp[(2) - (2)].codeb)); - } - break; - - case 130: - -/* Line 1455 of yacc.c */ -#line 1134 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tModule->initcode, (yyvsp[(2) - (2)].codeb)); - } - break; - - case 131: - -/* Line 1455 of yacc.c */ -#line 1140 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tModule->postinitcode, (yyvsp[(2) - (2)].codeb)); - } - break; - - case 132: - -/* Line 1455 of yacc.c */ -#line 1146 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tModule->unitcode, (yyvsp[(2) - (2)].codeb)); - } - break; - - case 133: - -/* Line 1455 of yacc.c */ -#line 1152 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* - * This is a no-op and is retained for compatibility - * until the last use of it (by SIP v3) can be removed - * from PyQt. - */ - } - break; - - case 134: - -/* Line 1455 of yacc.c */ -#line 1161 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (inMainModule()) - appendCodeBlock(¤tSpec -> docs,(yyvsp[(2) - (2)].codeb)); - } - break; - - case 135: - -/* Line 1455 of yacc.c */ -#line 1167 "/TEMP/sip4-tqt/sipgen/parser.y" - { - appendCodeBlock(¤tSpec -> docs,(yyvsp[(2) - (2)].codeb)); - } - break; - - case 136: - -/* Line 1455 of yacc.c */ -#line 1172 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (inMainModule()) - yywarning("%Makefile is ignored, please use the -b flag instead"); - } - break; - - case 139: - -/* Line 1455 of yacc.c */ -#line 1182 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(1) - (2)].codeb); - - append(&(yyval.codeb)->frag, (yyvsp[(2) - (2)].codeb)->frag); - - free((yyvsp[(2) - (2)].codeb)->frag); - free((char *)(yyvsp[(2) - (2)].codeb)->filename); - free((yyvsp[(2) - (2)].codeb)); - } - break; - - case 140: - -/* Line 1455 of yacc.c */ -#line 1193 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (sectionFlags != 0 && (sectionFlags & ~(SECT_IS_PUBLIC | SECT_IS_PROT)) != 0) - yyerror("Class enums must be in the public or protected sections"); - - currentEnum = newEnum(currentSpec, currentModule, - currentMappedType, (yyvsp[(2) - (3)].text), &(yyvsp[(3) - (3)].optflags), sectionFlags); - } - } - break; - - case 142: - -/* Line 1455 of yacc.c */ -#line 1205 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.text) = NULL; - } - break; - - case 143: - -/* Line 1455 of yacc.c */ -#line 1208 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.text) = (yyvsp[(1) - (1)].text); - } - break; - - case 144: - -/* Line 1455 of yacc.c */ -#line 1213 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.text) = NULL; - } - break; - - case 145: - -/* Line 1455 of yacc.c */ -#line 1216 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.text) = (yyvsp[(1) - (1)].text); - } - break; - - case 152: - -/* Line 1455 of yacc.c */ -#line 1231 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - enumMemberDef *emd, **tail; - - /* Note that we don't use the assigned value. */ - emd = sipMalloc(sizeof (enumMemberDef)); - - emd -> pyname = cacheName(currentSpec, getPythonName(&(yyvsp[(3) - (4)].optflags), (yyvsp[(1) - (4)].text))); - emd -> cname = (yyvsp[(1) - (4)].text); - emd -> ed = currentEnum; - emd -> next = NULL; - - checkAttributes(currentSpec, currentModule, emd->ed->ecd, - emd->ed->emtd, emd->pyname->text, FALSE); - - /* Append to preserve the order. */ - for (tail = ¤tEnum->members; *tail != NULL; tail = &(*tail)->next) - ; - - *tail = emd; - - if (inMainModule()) - setIsUsedName(emd -> pyname); - } - } - break; - - case 157: - -/* Line 1455 of yacc.c */ -#line 1267 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.valp) = NULL; - } - break; - - case 158: - -/* Line 1455 of yacc.c */ -#line 1270 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.valp) = (yyvsp[(2) - (2)].valp); - } - break; - - case 160: - -/* Line 1455 of yacc.c */ -#line 1276 "/TEMP/sip4-tqt/sipgen/parser.y" - { - valueDef *vd; - - if ((yyvsp[(1) - (3)].valp) -> vtype == string_value || (yyvsp[(3) - (3)].valp) -> vtype == string_value) - yyerror("Invalid binary operator for string"); - - /* Find the last value in the existing expression. */ - - for (vd = (yyvsp[(1) - (3)].valp); vd -> next != NULL; vd = vd -> next) - ; - - vd -> vbinop = (yyvsp[(2) - (3)].qchar); - vd -> next = (yyvsp[(3) - (3)].valp); - - (yyval.valp) = (yyvsp[(1) - (3)].valp); - } - break; - - case 161: - -/* Line 1455 of yacc.c */ -#line 1294 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '-'; - } - break; - - case 162: - -/* Line 1455 of yacc.c */ -#line 1297 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '+'; - } - break; - - case 163: - -/* Line 1455 of yacc.c */ -#line 1300 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '*'; - } - break; - - case 164: - -/* Line 1455 of yacc.c */ -#line 1303 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '/'; - } - break; - - case 165: - -/* Line 1455 of yacc.c */ -#line 1306 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '&'; - } - break; - - case 166: - -/* Line 1455 of yacc.c */ -#line 1309 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '|'; - } - break; - - case 167: - -/* Line 1455 of yacc.c */ -#line 1314 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '\0'; - } - break; - - case 168: - -/* Line 1455 of yacc.c */ -#line 1317 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '!'; - } - break; - - case 169: - -/* Line 1455 of yacc.c */ -#line 1320 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '~'; - } - break; - - case 170: - -/* Line 1455 of yacc.c */ -#line 1323 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '-'; - } - break; - - case 171: - -/* Line 1455 of yacc.c */ -#line 1326 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.qchar) = '+'; - } - break; - - case 172: - -/* Line 1455 of yacc.c */ -#line 1331 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if ((yyvsp[(1) - (2)].qchar) != '\0' && (yyvsp[(2) - (2)].value).vtype == string_value) - yyerror("Invalid unary operator for string"); - - /* - * Convert the value to a simple expression on the - * heap. - */ - - (yyval.valp) = sipMalloc(sizeof (valueDef)); - - *(yyval.valp) = (yyvsp[(2) - (2)].value); - (yyval.valp) -> vunop = (yyvsp[(1) - (2)].qchar); - (yyval.valp) -> vbinop = '\0'; - (yyval.valp) -> next = NULL; - } - break; - - case 174: - -/* Line 1455 of yacc.c */ -#line 1350 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("Scoped names are not allowed in a C module"); - - appendScopedName(&(yyvsp[(1) - (3)].scpvalp),(yyvsp[(3) - (3)].scpvalp)); - } - break; - - case 175: - -/* Line 1455 of yacc.c */ -#line 1358 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.scpvalp) = text2scopePart((yyvsp[(1) - (1)].text)); - } - break; - - case 176: - -/* Line 1455 of yacc.c */ -#line 1363 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* - * We let the C++ compiler decide if the value is a valid one - no - * point in building a full C++ parser here. - */ - - (yyval.value).vtype = scoped_value; - (yyval.value).u.vscp = (yyvsp[(1) - (1)].scpvalp); - } - break; - - case 177: - -/* Line 1455 of yacc.c */ -#line 1372 "/TEMP/sip4-tqt/sipgen/parser.y" - { - fcallDef *fcd; - - fcd = sipMalloc(sizeof (fcallDef)); - *fcd = (yyvsp[(3) - (4)].fcall); - fcd -> type = (yyvsp[(1) - (4)].memArg); - - (yyval.value).vtype = fcall_value; - (yyval.value).u.fcd = fcd; - } - break; - - case 178: - -/* Line 1455 of yacc.c */ -#line 1382 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = real_value; - (yyval.value).u.vreal = (yyvsp[(1) - (1)].real); - } - break; - - case 179: - -/* Line 1455 of yacc.c */ -#line 1386 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = numeric_value; - (yyval.value).u.vnum = (yyvsp[(1) - (1)].number); - } - break; - - case 180: - -/* Line 1455 of yacc.c */ -#line 1390 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = numeric_value; - (yyval.value).u.vnum = 1; - } - break; - - case 181: - -/* Line 1455 of yacc.c */ -#line 1394 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = numeric_value; - (yyval.value).u.vnum = 0; - } - break; - - case 182: - -/* Line 1455 of yacc.c */ -#line 1398 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = numeric_value; - (yyval.value).u.vnum = 0; - } - break; - - case 183: - -/* Line 1455 of yacc.c */ -#line 1402 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = string_value; - (yyval.value).u.vstr = (yyvsp[(1) - (1)].text); - } - break; - - case 184: - -/* Line 1455 of yacc.c */ -#line 1406 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.value).vtype = qchar_value; - (yyval.value).u.vqchar = (yyvsp[(1) - (1)].qchar); - } - break; - - case 185: - -/* Line 1455 of yacc.c */ -#line 1412 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* No values. */ - - (yyval.fcall).nrArgs = 0; - } - break; - - case 186: - -/* Line 1455 of yacc.c */ -#line 1417 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* The single or first expression. */ - - (yyval.fcall).args[0] = (yyvsp[(1) - (1)].valp); - (yyval.fcall).nrArgs = 1; - } - break; - - case 187: - -/* Line 1455 of yacc.c */ -#line 1423 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Check that it wasn't ...(,expression...). */ - - if ((yyval.fcall).nrArgs == 0) - yyerror("First argument to function call is missing"); - - /* Check there is room. */ - - if ((yyvsp[(1) - (3)].fcall).nrArgs == MAX_NR_ARGS) - yyerror("Too many arguments to function call"); - - (yyval.fcall) = (yyvsp[(1) - (3)].fcall); - - (yyval.fcall).args[(yyval.fcall).nrArgs] = (yyvsp[(3) - (3)].valp); - (yyval.fcall).nrArgs++; - } - break; - - case 188: - -/* Line 1455 of yacc.c */ -#line 1441 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - applyTypeFlags(currentModule, &(yyvsp[(2) - (5)].memArg), &(yyvsp[(4) - (5)].optflags)); - newTypedef(currentSpec, currentModule, (yyvsp[(3) - (5)].text), &(yyvsp[(2) - (5)].memArg), &(yyvsp[(4) - (5)].optflags)); - } - } - break; - - case 189: - -/* Line 1455 of yacc.c */ -#line 1448 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - signatureDef *sig; - argDef ftype; - - applyTypeFlags(currentModule, &(yyvsp[(2) - (11)].memArg), &(yyvsp[(10) - (11)].optflags)); - - memset(&ftype, 0, sizeof (argDef)); - - /* Create the full signature on the heap. */ - sig = sipMalloc(sizeof (signatureDef)); - *sig = (yyvsp[(8) - (11)].signature); - sig->result = (yyvsp[(2) - (11)].memArg); - - /* Create the full type. */ - ftype.atype = function_type; - ftype.nrderefs = (yyvsp[(4) - (11)].number); - ftype.u.sa = sig; - - newTypedef(currentSpec, currentModule, (yyvsp[(5) - (11)].text), &ftype, &(yyvsp[(10) - (11)].optflags)); - } - } - break; - - case 190: - -/* Line 1455 of yacc.c */ -#line 1473 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc && (yyvsp[(2) - (2)].scpvalp)->next != NULL) - yyerror("Namespaces not allowed in a C module"); - - if (notSkipping()) - currentSupers = NULL; - } - break; - - case 191: - -/* Line 1455 of yacc.c */ -#line 1479 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - if (currentSpec->genc && currentSupers != NULL) - yyerror("Super-classes not allowed in a C module struct"); - - defineClass((yyvsp[(2) - (5)].scpvalp), currentSupers, &(yyvsp[(5) - (5)].optflags)); - sectionFlags = SECT_IS_PUBLIC; - } - } - break; - - case 192: - -/* Line 1455 of yacc.c */ -#line 1488 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - completeClass((yyvsp[(2) - (8)].scpvalp), &(yyvsp[(5) - (8)].optflags), (yyvsp[(7) - (8)].boolean)); - } - break; - - case 193: - -/* Line 1455 of yacc.c */ -#line 1494 "/TEMP/sip4-tqt/sipgen/parser.y" - {currentIsTemplate = TRUE;} - break; - - case 194: - -/* Line 1455 of yacc.c */ -#line 1494 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec->genc) - yyerror("Class templates not allowed in a C module"); - - if (notSkipping()) - { - classTmplDef *tcd; - - /* - * Make sure there is room for the extra class name argument. - */ - if ((yyvsp[(1) - (3)].signature).nrArgs == MAX_NR_ARGS) - yyerror("Internal error - increase the value of MAX_NR_ARGS"); - - tcd = sipMalloc(sizeof (classTmplDef)); - tcd->sig = (yyvsp[(1) - (3)].signature); - tcd->cd = (yyvsp[(3) - (3)].klass); - tcd->next = currentSpec->classtemplates; - - currentSpec->classtemplates = tcd; - } - - currentIsTemplate = FALSE; - } - break; - - case 195: - -/* Line 1455 of yacc.c */ -#line 1520 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.signature) = (yyvsp[(3) - (4)].signature); - } - break; - - case 196: - -/* Line 1455 of yacc.c */ -#line 1525 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec->genc) - yyerror("Class definition not allowed in a C module"); - - if (notSkipping()) - currentSupers = NULL; - } - break; - - case 197: - -/* Line 1455 of yacc.c */ -#line 1531 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - defineClass((yyvsp[(2) - (5)].scpvalp), currentSupers, &(yyvsp[(5) - (5)].optflags)); - sectionFlags = SECT_IS_PRIVATE; - } - } - break; - - case 198: - -/* Line 1455 of yacc.c */ -#line 1537 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - (yyval.klass) = completeClass((yyvsp[(2) - (8)].scpvalp), &(yyvsp[(5) - (8)].optflags), (yyvsp[(7) - (8)].boolean)); - } - break; - - case 203: - -/* Line 1455 of yacc.c */ -#line 1551 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - argDef ad; - classDef *super; - scopedNameDef *snd = (yyvsp[(1) - (1)].scpvalp); - - /* - * This is a hack to allow typedef'ed classes to be used before - * we have resolved the typedef definitions. Unlike elsewhere, - * we require that the typedef is defined before being used. - */ - for (;;) - { - ad.atype = no_type; - ad.argflags = 0; - ad.nrderefs = 0; - ad.original_type = NULL; - - searchTypedefs(currentSpec, snd, &ad); - - if (ad.atype != defined_type) - break; - - if (ad.nrderefs != 0 || isConstArg(&ad) || isReference(&ad)) - break; - - snd = ad.u.snd; - } - - if (ad.atype != no_type) - yyerror("Super-class list contains an invalid type"); - - super = findClass(currentSpec, class_iface, NULL, snd); - appendToClassList(¤tSupers, super); - } - } - break; - - case 204: - -/* Line 1455 of yacc.c */ -#line 1590 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = FALSE; - } - break; - - case 205: - -/* Line 1455 of yacc.c */ -#line 1593 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.boolean) = TRUE; - } - break; - - case 216: - -/* Line 1455 of yacc.c */ -#line 1610 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - /* Make sure this is before any ctor docstrings. */ - (yyvsp[(1) - (1)].codeb)->next = scope->docstring; - scope->docstring = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 217: - -/* Line 1455 of yacc.c */ -#line 1620 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tScope()->cppcode, (yyvsp[(1) - (1)].codeb)); - } - break; - - case 218: - -/* Line 1455 of yacc.c */ -#line 1624 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - appendCodeBlock(¤tScope()->iff->hdrcode, (yyvsp[(1) - (1)].codeb)); - } - break; - - case 219: - -/* Line 1455 of yacc.c */ -#line 1628 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->travcode != NULL) - yyerror("%GCTraverseCode already given for class"); - - scope->travcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 220: - -/* Line 1455 of yacc.c */ -#line 1639 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->clearcode != NULL) - yyerror("%GCClearCode already given for class"); - - scope->clearcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 221: - -/* Line 1455 of yacc.c */ -#line 1650 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->getbufcode != NULL) - yyerror("%BIGetBufferCode already given for class"); - - scope->getbufcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 222: - -/* Line 1455 of yacc.c */ -#line 1661 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->releasebufcode != NULL) - yyerror("%BIReleaseBufferCode already given for class"); - - scope->releasebufcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 223: - -/* Line 1455 of yacc.c */ -#line 1672 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->readbufcode != NULL) - yyerror("%BIGetReadBufferCode already given for class"); - - scope->readbufcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 224: - -/* Line 1455 of yacc.c */ -#line 1683 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->writebufcode != NULL) - yyerror("%BIGetWriteBufferCode already given for class"); - - scope->writebufcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 225: - -/* Line 1455 of yacc.c */ -#line 1694 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->segcountcode != NULL) - yyerror("%BIGetSegCountCode already given for class"); - - scope->segcountcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 226: - -/* Line 1455 of yacc.c */ -#line 1705 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->charbufcode != NULL) - yyerror("%BIGetCharBufferCode already given for class"); - - scope->charbufcode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 227: - -/* Line 1455 of yacc.c */ -#line 1716 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->picklecode != NULL) - yyerror("%PickleCode already given for class"); - - scope->picklecode = (yyvsp[(1) - (1)].codeb); - } - } - break; - - case 231: - -/* Line 1455 of yacc.c */ -#line 1730 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->convtosubcode != NULL) - yyerror("Class has more than one %ConvertToSubClassCode directive"); - - scope->convtosubcode = (yyvsp[(2) - (2)].codeb); - } - } - break; - - case 232: - -/* Line 1455 of yacc.c */ -#line 1741 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *scope = currentScope(); - - if (scope->convtocode != NULL) - yyerror("Class has more than one %ConvertToTypeCode directive"); - - scope->convtocode = (yyvsp[(2) - (2)].codeb); - } - } - break; - - case 233: - -/* Line 1455 of yacc.c */ -#line 1752 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("public section not allowed in a C module"); - - if (notSkipping()) - sectionFlags = SECT_IS_PUBLIC | (yyvsp[(2) - (3)].number); - } - break; - - case 234: - -/* Line 1455 of yacc.c */ -#line 1759 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("protected section not allowed in a C module"); - - if (notSkipping()) - sectionFlags = SECT_IS_PROT | (yyvsp[(2) - (3)].number); - } - break; - - case 235: - -/* Line 1455 of yacc.c */ -#line 1766 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("private section not allowed in a C module"); - - if (notSkipping()) - sectionFlags = SECT_IS_PRIVATE | (yyvsp[(2) - (3)].number); - } - break; - - case 236: - -/* Line 1455 of yacc.c */ -#line 1773 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("signals section not allowed in a C module"); - - if (notSkipping()) - sectionFlags = SECT_IS_SIGNAL; - } - break; - - case 237: - -/* Line 1455 of yacc.c */ -#line 1782 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = 0; - } - break; - - case 238: - -/* Line 1455 of yacc.c */ -#line 1785 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = SECT_IS_SLOT; - } - break; - - case 239: - -/* Line 1455 of yacc.c */ -#line 1790 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Note that we allow non-virtual dtors in C modules. */ - - if (notSkipping()) - { - classDef *cd = currentScope(); - - if (strcmp(classBaseName(cd),(yyvsp[(3) - (11)].text)) != 0) - yyerror("Destructor doesn't have the same name as its class"); - - if (isDtor(cd)) - yyerror("Destructor has already been defined"); - - if (currentSpec -> genc && (yyvsp[(10) - (11)].codeb) == NULL) - yyerror("Destructor in C modules must include %MethodCode"); - - cd -> dealloccode = (yyvsp[(10) - (11)].codeb); - cd -> dtorcode = (yyvsp[(11) - (11)].codeb); - cd -> dtorexceptions = (yyvsp[(6) - (11)].throwlist); - - /* - * Note that we don't apply the protected/public hack to dtors - * as it (I think) may change the behaviour of the wrapped API. - */ - cd->classflags |= sectionFlags; - - if ((yyvsp[(7) - (11)].number)) - { - if (!(yyvsp[(1) - (11)].number)) - yyerror("Abstract destructor must be virtual"); - - setIsAbstractClass(cd); - } - - /* - * The class has a shadow if we have a virtual dtor or some - * dtor code. - */ - if ((yyvsp[(1) - (11)].number) || (yyvsp[(11) - (11)].codeb) != NULL) - { - if (currentSpec -> genc) - yyerror("Virtual destructor or %VirtualCatcherCode not allowed in a C module"); - - setHasShadow(cd); - } - - if (getReleaseGIL(&(yyvsp[(8) - (11)].optflags))) - setIsReleaseGILDtor(cd); - else if (getHoldGIL(&(yyvsp[(8) - (11)].optflags))) - setIsHoldGILDtor(cd); - } - } - break; - - case 240: - -/* Line 1455 of yacc.c */ -#line 1844 "/TEMP/sip4-tqt/sipgen/parser.y" - {currentCtorIsExplicit = TRUE;} - break; - - case 243: - -/* Line 1455 of yacc.c */ -#line 1848 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Note that we allow ctors in C modules. */ - - if (notSkipping()) - { - if (currentSpec -> genc) - { - if ((yyvsp[(10) - (10)].codeb) == NULL && (yyvsp[(3) - (10)].signature).nrArgs != 0) - yyerror("Constructors with arguments in C modules must include %MethodCode"); - - if (currentCtorIsExplicit) - yyerror("Explicit constructors not allowed in a C module"); - } - - if ((sectionFlags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE)) == 0) - yyerror("Constructor must be in the public, private or protected sections"); - - newCtor((yyvsp[(1) - (10)].text), sectionFlags, &(yyvsp[(3) - (10)].signature), &(yyvsp[(6) - (10)].optflags), (yyvsp[(10) - (10)].codeb), (yyvsp[(5) - (10)].throwlist), (yyvsp[(7) - (10)].optsignature), - currentCtorIsExplicit, (yyvsp[(9) - (10)].codeb)); - } - - free((yyvsp[(1) - (10)].text)); - - currentCtorIsExplicit = FALSE; - } - break; - - case 244: - -/* Line 1455 of yacc.c */ -#line 1875 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optsignature) = NULL; - } - break; - - case 245: - -/* Line 1455 of yacc.c */ -#line 1878 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optsignature) = sipMalloc(sizeof (signatureDef)); - - *(yyval.optsignature) = (yyvsp[(3) - (5)].signature); - } - break; - - case 246: - -/* Line 1455 of yacc.c */ -#line 1885 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optsignature) = NULL; - } - break; - - case 247: - -/* Line 1455 of yacc.c */ -#line 1888 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optsignature) = sipMalloc(sizeof (signatureDef)); - - *(yyval.optsignature) = (yyvsp[(4) - (6)].signature); - (yyval.optsignature) -> result = (yyvsp[(2) - (6)].memArg); - } - break; - - case 248: - -/* Line 1455 of yacc.c */ -#line 1896 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = FALSE; - } - break; - - case 249: - -/* Line 1455 of yacc.c */ -#line 1899 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = TRUE; - } - break; - - case 250: - -/* Line 1455 of yacc.c */ -#line 1904 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - applyTypeFlags(currentModule, &(yyvsp[(1) - (14)].memArg), &(yyvsp[(9) - (14)].optflags)); - - (yyvsp[(4) - (14)].signature).result = (yyvsp[(1) - (14)].memArg); - - newFunction(currentSpec, currentModule, currentScope(), NULL, - sectionFlags, currentIsStatic, currentIsSignal, - currentIsSlot, currentOverIsVirt, (yyvsp[(2) - (14)].text), &(yyvsp[(4) - (14)].signature), (yyvsp[(6) - (14)].number), (yyvsp[(8) - (14)].number), &(yyvsp[(9) - (14)].optflags), - (yyvsp[(13) - (14)].codeb), (yyvsp[(14) - (14)].codeb), (yyvsp[(7) - (14)].throwlist), (yyvsp[(10) - (14)].optsignature), (yyvsp[(12) - (14)].codeb)); - } - - currentIsStatic = FALSE; - currentIsSignal = FALSE; - currentIsSlot = FALSE; - currentOverIsVirt = FALSE; - } - break; - - case 251: - -/* Line 1455 of yacc.c */ -#line 1922 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* - * It looks like an assignment operator (though we don't bother to - * check the types) so make sure it is private. - */ - if (notSkipping()) - { - classDef *cd = currentScope(); - - if (cd == NULL || !(sectionFlags & SECT_IS_PRIVATE)) - yyerror("Assignment operators may only be defined as private"); - - setCannotAssign(cd); - } - - currentIsStatic = FALSE; - currentIsSignal = FALSE; - currentIsSlot = FALSE; - currentOverIsVirt = FALSE; - } - break; - - case 252: - -/* Line 1455 of yacc.c */ -#line 1942 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - classDef *cd = currentScope(); - - applyTypeFlags(currentModule, &(yyvsp[(1) - (14)].memArg), &(yyvsp[(10) - (14)].optflags)); - - /* Handle the unary '+' and '-' operators. */ - if ((cd != NULL && (yyvsp[(5) - (14)].signature).nrArgs == 0) || (cd == NULL && (yyvsp[(5) - (14)].signature).nrArgs == 1)) - { - if (strcmp((yyvsp[(3) - (14)].text), "__add__") == 0) - (yyvsp[(3) - (14)].text) = "__pos__"; - else if (strcmp((yyvsp[(3) - (14)].text), "__sub__") == 0) - (yyvsp[(3) - (14)].text) = "__neg__"; - } - - (yyvsp[(5) - (14)].signature).result = (yyvsp[(1) - (14)].memArg); - - newFunction(currentSpec, currentModule, cd, NULL, - sectionFlags, currentIsStatic, currentIsSignal, - currentIsSlot, currentOverIsVirt, (yyvsp[(3) - (14)].text), &(yyvsp[(5) - (14)].signature), (yyvsp[(7) - (14)].number), (yyvsp[(9) - (14)].number), - &(yyvsp[(10) - (14)].optflags), (yyvsp[(13) - (14)].codeb), (yyvsp[(14) - (14)].codeb), (yyvsp[(8) - (14)].throwlist), (yyvsp[(11) - (14)].optsignature), NULL); - } - - currentIsStatic = FALSE; - currentIsSignal = FALSE; - currentIsSlot = FALSE; - currentOverIsVirt = FALSE; - } - break; - - case 253: - -/* Line 1455 of yacc.c */ -#line 1971 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - char *sname; - classDef *scope = currentScope(); - - if (scope == NULL || (yyvsp[(4) - (13)].signature).nrArgs != 0) - yyerror("Operator casts must be specified in a class and have no arguments"); - - applyTypeFlags(currentModule, &(yyvsp[(2) - (13)].memArg), &(yyvsp[(9) - (13)].optflags)); - - switch ((yyvsp[(2) - (13)].memArg).atype) - { - case defined_type: - sname = NULL; - break; - - case bool_type: - case cbool_type: - case short_type: - case ushort_type: - case int_type: - case cint_type: - case uint_type: - sname = "__int__"; - break; - - case long_type: - case ulong_type: - case longlong_type: - case ulonglong_type: - sname = "__long__"; - break; - - case float_type: - case cfloat_type: - case double_type: - case cdouble_type: - sname = "__float__"; - break; - - default: - yyerror("Unsupported operator cast"); - } - - if (sname != NULL) - { - (yyvsp[(4) - (13)].signature).result = (yyvsp[(2) - (13)].memArg); - - newFunction(currentSpec, currentModule, scope, NULL, - sectionFlags, currentIsStatic, currentIsSignal, - currentIsSlot, currentOverIsVirt, sname, &(yyvsp[(4) - (13)].signature), (yyvsp[(6) - (13)].number), - (yyvsp[(8) - (13)].number), &(yyvsp[(9) - (13)].optflags), (yyvsp[(12) - (13)].codeb), (yyvsp[(13) - (13)].codeb), (yyvsp[(7) - (13)].throwlist), (yyvsp[(10) - (13)].optsignature), NULL); - } - else - { - argList *al; - - /* Check it doesn't already exist. */ - for (al = scope->casts; al != NULL; al = al->next) - if (compareScopedNames((yyvsp[(2) - (13)].memArg).u.snd, al->arg.u.snd) == 0) - yyerror("This operator cast has already been specified in this class"); - - al = sipMalloc(sizeof (argList)); - al->arg = (yyvsp[(2) - (13)].memArg); - al->next = scope->casts; - - scope->casts = al; - } - } - - currentIsStatic = FALSE; - currentIsSignal = FALSE; - currentIsSlot = FALSE; - currentOverIsVirt = FALSE; - } - break; - - case 254: - -/* Line 1455 of yacc.c */ -#line 2049 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__add__";} - break; - - case 255: - -/* Line 1455 of yacc.c */ -#line 2050 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__sub__";} - break; - - case 256: - -/* Line 1455 of yacc.c */ -#line 2051 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__mul__";} - break; - - case 257: - -/* Line 1455 of yacc.c */ -#line 2052 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__div__";} - break; - - case 258: - -/* Line 1455 of yacc.c */ -#line 2053 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__mod__";} - break; - - case 259: - -/* Line 1455 of yacc.c */ -#line 2054 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__and__";} - break; - - case 260: - -/* Line 1455 of yacc.c */ -#line 2055 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__or__";} - break; - - case 261: - -/* Line 1455 of yacc.c */ -#line 2056 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__xor__";} - break; - - case 262: - -/* Line 1455 of yacc.c */ -#line 2057 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__lshift__";} - break; - - case 263: - -/* Line 1455 of yacc.c */ -#line 2058 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__rshift__";} - break; - - case 264: - -/* Line 1455 of yacc.c */ -#line 2059 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__iadd__";} - break; - - case 265: - -/* Line 1455 of yacc.c */ -#line 2060 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__isub__";} - break; - - case 266: - -/* Line 1455 of yacc.c */ -#line 2061 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__imul__";} - break; - - case 267: - -/* Line 1455 of yacc.c */ -#line 2062 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__idiv__";} - break; - - case 268: - -/* Line 1455 of yacc.c */ -#line 2063 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__imod__";} - break; - - case 269: - -/* Line 1455 of yacc.c */ -#line 2064 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__iand__";} - break; - - case 270: - -/* Line 1455 of yacc.c */ -#line 2065 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__ior__";} - break; - - case 271: - -/* Line 1455 of yacc.c */ -#line 2066 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__ixor__";} - break; - - case 272: - -/* Line 1455 of yacc.c */ -#line 2067 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__ilshift__";} - break; - - case 273: - -/* Line 1455 of yacc.c */ -#line 2068 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__irshift__";} - break; - - case 274: - -/* Line 1455 of yacc.c */ -#line 2069 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__invert__";} - break; - - case 275: - -/* Line 1455 of yacc.c */ -#line 2070 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__call__";} - break; - - case 276: - -/* Line 1455 of yacc.c */ -#line 2071 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__getitem__";} - break; - - case 277: - -/* Line 1455 of yacc.c */ -#line 2072 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__lt__";} - break; - - case 278: - -/* Line 1455 of yacc.c */ -#line 2073 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__le__";} - break; - - case 279: - -/* Line 1455 of yacc.c */ -#line 2074 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__eq__";} - break; - - case 280: - -/* Line 1455 of yacc.c */ -#line 2075 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__ne__";} - break; - - case 281: - -/* Line 1455 of yacc.c */ -#line 2076 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__gt__";} - break; - - case 282: - -/* Line 1455 of yacc.c */ -#line 2077 "/TEMP/sip4-tqt/sipgen/parser.y" - {(yyval.text) = "__ge__";} - break; - - case 283: - -/* Line 1455 of yacc.c */ -#line 2080 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = FALSE; - } - break; - - case 284: - -/* Line 1455 of yacc.c */ -#line 2083 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = TRUE; - } - break; - - case 285: - -/* Line 1455 of yacc.c */ -#line 2088 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = 0; - } - break; - - case 286: - -/* Line 1455 of yacc.c */ -#line 2091 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if ((yyvsp[(2) - (2)].number) != 0) - yyerror("Abstract virtual function '= 0' expected"); - - (yyval.number) = TRUE; - } - break; - - case 287: - -/* Line 1455 of yacc.c */ -#line 2099 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optflags).nrFlags = 0; - } - break; - - case 288: - -/* Line 1455 of yacc.c */ -#line 2102 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optflags) = (yyvsp[(2) - (3)].optflags); - } - break; - - case 289: - -/* Line 1455 of yacc.c */ -#line 2108 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.optflags).flags[0] = (yyvsp[(1) - (1)].flag); - (yyval.optflags).nrFlags = 1; - } - break; - - case 290: - -/* Line 1455 of yacc.c */ -#line 2112 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Check there is room. */ - - if ((yyvsp[(1) - (3)].optflags).nrFlags == MAX_NR_FLAGS) - yyerror("Too many optional flags"); - - (yyval.optflags) = (yyvsp[(1) - (3)].optflags); - - (yyval.optflags).flags[(yyval.optflags).nrFlags++] = (yyvsp[(3) - (3)].flag); - } - break; - - case 291: - -/* Line 1455 of yacc.c */ -#line 2124 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.flag).ftype = bool_flag; - (yyval.flag).fname = (yyvsp[(1) - (1)].text); - } - break; - - case 292: - -/* Line 1455 of yacc.c */ -#line 2128 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.flag) = (yyvsp[(3) - (3)].flag); - (yyval.flag).fname = (yyvsp[(1) - (3)].text); - } - break; - - case 293: - -/* Line 1455 of yacc.c */ -#line 2134 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.flag).ftype = (strchr((yyvsp[(1) - (1)].text), '.') != NULL) ? dotted_name_flag : name_flag; - (yyval.flag).fvalue.sval = (yyvsp[(1) - (1)].text); - } - break; - - case 294: - -/* Line 1455 of yacc.c */ -#line 2138 "/TEMP/sip4-tqt/sipgen/parser.y" - { - apiVersionRangeDef *avd; - int from, to; - - (yyval.flag).ftype = api_range_flag; - - /* Check that the API is known. */ - if ((avd = findAPI(currentSpec, (yyvsp[(1) - (5)].text))) == NULL) - yyerror("unknown API name in API annotation"); - - if (inMainModule()) - setIsUsedName(avd->api_name); - - /* Unbounded values are represented by 0. */ - if ((from = (yyvsp[(3) - (5)].number)) < 0) - from = 0; - - if ((to = (yyvsp[(5) - (5)].number)) < 0) - to = 0; - - (yyval.flag).fvalue.aval = convertAPIRange(currentModule, avd->api_name, - from, to); - } - break; - - case 295: - -/* Line 1455 of yacc.c */ -#line 2161 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.flag).ftype = string_flag; - (yyval.flag).fvalue.sval = convertFeaturedString((yyvsp[(1) - (1)].text)); - } - break; - - case 296: - -/* Line 1455 of yacc.c */ -#line 2165 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.flag).ftype = integer_flag; - (yyval.flag).fvalue.ival = (yyvsp[(1) - (1)].number); - } - break; - - case 297: - -/* Line 1455 of yacc.c */ -#line 2171 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 298: - -/* Line 1455 of yacc.c */ -#line 2176 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 300: - -/* Line 1455 of yacc.c */ -#line 2182 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 301: - -/* Line 1455 of yacc.c */ -#line 2185 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 302: - -/* Line 1455 of yacc.c */ -#line 2190 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = NULL; - } - break; - - case 303: - -/* Line 1455 of yacc.c */ -#line 2193 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.codeb) = (yyvsp[(2) - (2)].codeb); - } - break; - - case 304: - -/* Line 1455 of yacc.c */ -#line 2198 "/TEMP/sip4-tqt/sipgen/parser.y" - { - int a, nrrxcon, nrrxdis, nrslotcon, nrslotdis, nrarray, nrarraysize; - - nrrxcon = nrrxdis = nrslotcon = nrslotdis = nrarray = nrarraysize = 0; - - for (a = 0; a < (yyvsp[(1) - (1)].signature).nrArgs; ++a) - { - argDef *ad = &(yyvsp[(1) - (1)].signature).args[a]; - - switch (ad -> atype) - { - case rxcon_type: - ++nrrxcon; - break; - - case rxdis_type: - ++nrrxdis; - break; - - case slotcon_type: - ++nrslotcon; - break; - - case slotdis_type: - ++nrslotdis; - break; - } - - if (isArray(ad)) - ++nrarray; - - if (isArraySize(ad)) - ++nrarraysize; - } - - if (nrrxcon != nrslotcon || nrrxcon > 1) - yyerror("SIP_RXOBJ_CON and SIP_SLOT_CON must both be given and at most once"); - - if (nrrxdis != nrslotdis || nrrxdis > 1) - yyerror("SIP_RXOBJ_DIS and SIP_SLOT_DIS must both be given and at most once"); - - if (nrarray != nrarraysize || nrarray > 1) - yyerror("/Array/ and /ArraySize/ must both be given and at most once"); - - (yyval.signature) = (yyvsp[(1) - (1)].signature); - } - break; - - case 305: - -/* Line 1455 of yacc.c */ -#line 2246 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* No arguments. */ - - (yyval.signature).nrArgs = 0; - } - break; - - case 306: - -/* Line 1455 of yacc.c */ -#line 2251 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* The single or first argument. */ - - (yyval.signature).args[0] = (yyvsp[(1) - (1)].memArg); - (yyval.signature).nrArgs = 1; - } - break; - - case 307: - -/* Line 1455 of yacc.c */ -#line 2257 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Check that it wasn't ...(,arg...). */ - if ((yyvsp[(1) - (3)].signature).nrArgs == 0) - yyerror("First argument of the list is missing"); - - /* Check there is nothing after an ellipsis. */ - if ((yyvsp[(1) - (3)].signature).args[(yyvsp[(1) - (3)].signature).nrArgs - 1].atype == ellipsis_type) - yyerror("An ellipsis must be at the end of the argument list"); - - /* - * If this argument has no default value, then the - * previous one mustn't either. - */ - if ((yyvsp[(3) - (3)].memArg).defval == NULL && (yyvsp[(1) - (3)].signature).args[(yyvsp[(1) - (3)].signature).nrArgs - 1].defval != NULL) - yyerror("Compulsory argument given after optional argument"); - - /* Check there is room. */ - if ((yyvsp[(1) - (3)].signature).nrArgs == MAX_NR_ARGS) - yyerror("Internal error - increase the value of MAX_NR_ARGS"); - - (yyval.signature) = (yyvsp[(1) - (3)].signature); - - (yyval.signature).args[(yyval.signature).nrArgs] = (yyvsp[(3) - (3)].memArg); - (yyval.signature).nrArgs++; - } - break; - - case 308: - -/* Line 1455 of yacc.c */ -#line 2284 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = signal_type; - (yyval.memArg).argflags = ARG_IS_CONST; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (4)].text)); - (yyval.memArg).defval = (yyvsp[(4) - (4)].valp); - - currentSpec -> sigslots = TRUE; - } - break; - - case 309: - -/* Line 1455 of yacc.c */ -#line 2293 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = slot_type; - (yyval.memArg).argflags = ARG_IS_CONST; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (4)].text)); - (yyval.memArg).defval = (yyvsp[(4) - (4)].valp); - - currentSpec -> sigslots = TRUE; - } - break; - - case 310: - -/* Line 1455 of yacc.c */ -#line 2302 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = anyslot_type; - (yyval.memArg).argflags = ARG_IS_CONST; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (4)].text)); - (yyval.memArg).defval = (yyvsp[(4) - (4)].valp); - - currentSpec -> sigslots = TRUE; - } - break; - - case 311: - -/* Line 1455 of yacc.c */ -#line 2311 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = rxcon_type; - (yyval.memArg).argflags = 0; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (3)].text)); - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags), "SingleShot", bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_SINGLE_SHOT; - - currentSpec -> sigslots = TRUE; - } - break; - - case 312: - -/* Line 1455 of yacc.c */ -#line 2322 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = rxdis_type; - (yyval.memArg).argflags = 0; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (3)].text)); - - currentSpec -> sigslots = TRUE; - } - break; - - case 313: - -/* Line 1455 of yacc.c */ -#line 2330 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = slotcon_type; - (yyval.memArg).argflags = ARG_IS_CONST; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(5) - (6)].text)); - - memset(&(yyvsp[(3) - (6)].signature).result, 0, sizeof (argDef)); - (yyvsp[(3) - (6)].signature).result.atype = void_type; - - (yyval.memArg).u.sa = sipMalloc(sizeof (signatureDef)); - *(yyval.memArg).u.sa = (yyvsp[(3) - (6)].signature); - - currentSpec -> sigslots = TRUE; - } - break; - - case 314: - -/* Line 1455 of yacc.c */ -#line 2344 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = slotdis_type; - (yyval.memArg).argflags = ARG_IS_CONST; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(5) - (6)].text)); - - memset(&(yyvsp[(3) - (6)].signature).result, 0, sizeof (argDef)); - (yyvsp[(3) - (6)].signature).result.atype = void_type; - - (yyval.memArg).u.sa = sipMalloc(sizeof (signatureDef)); - *(yyval.memArg).u.sa = (yyvsp[(3) - (6)].signature); - - currentSpec -> sigslots = TRUE; - } - break; - - case 315: - -/* Line 1455 of yacc.c */ -#line 2358 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg).atype = qobject_type; - (yyval.memArg).argflags = 0; - (yyval.memArg).nrderefs = 0; - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (3)].text)); - } - break; - - case 316: - -/* Line 1455 of yacc.c */ -#line 2364 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg) = (yyvsp[(1) - (2)].memArg); - (yyval.memArg).defval = (yyvsp[(2) - (2)].valp); - } - break; - - case 317: - -/* Line 1455 of yacc.c */ -#line 2371 "/TEMP/sip4-tqt/sipgen/parser.y" - {currentIsSignal = TRUE;} - break; - - case 319: - -/* Line 1455 of yacc.c */ -#line 2372 "/TEMP/sip4-tqt/sipgen/parser.y" - {currentIsSlot = TRUE;} - break; - - case 322: - -/* Line 1455 of yacc.c */ -#line 2377 "/TEMP/sip4-tqt/sipgen/parser.y" - {currentIsStatic = TRUE;} - break; - - case 327: - -/* Line 1455 of yacc.c */ -#line 2387 "/TEMP/sip4-tqt/sipgen/parser.y" - {currentOverIsVirt = TRUE;} - break; - - case 330: - -/* Line 1455 of yacc.c */ -#line 2391 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (notSkipping()) - { - /* Check the section. */ - - if (sectionFlags != 0) - { - if ((sectionFlags & SECT_IS_PUBLIC) == 0) - yyerror("Class variables must be in the public section"); - - if (!currentIsStatic && (yyvsp[(5) - (7)].codeb) != NULL) - yyerror("%AccessCode cannot be specified for non-static class variables"); - } - - if (currentIsStatic && currentSpec -> genc) - yyerror("Cannot have static members in a C structure"); - - applyTypeFlags(currentModule, &(yyvsp[(1) - (7)].memArg), &(yyvsp[(3) - (7)].optflags)); - - if ((yyvsp[(6) - (7)].codeb) != NULL || (yyvsp[(7) - (7)].codeb) != NULL) - { - if ((yyvsp[(5) - (7)].codeb) != NULL) - yyerror("Cannot mix %AccessCode and %GetCode or %SetCode"); - - if (currentScope() == NULL) - yyerror("Cannot specify %GetCode or %SetCode for global variables"); - } - - newVar(currentSpec,currentModule,(yyvsp[(2) - (7)].text),currentIsStatic,&(yyvsp[(1) - (7)].memArg),&(yyvsp[(3) - (7)].optflags),(yyvsp[(5) - (7)].codeb),(yyvsp[(6) - (7)].codeb),(yyvsp[(7) - (7)].codeb)); - } - - currentIsStatic = FALSE; - } - break; - - case 331: - -/* Line 1455 of yacc.c */ -#line 2426 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg) = (yyvsp[(2) - (4)].memArg); - (yyval.memArg).nrderefs += (yyvsp[(3) - (4)].number); - (yyval.memArg).argflags |= ARG_IS_CONST | (yyvsp[(4) - (4)].number); - } - break; - - case 332: - -/* Line 1455 of yacc.c */ -#line 2431 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg) = (yyvsp[(1) - (3)].memArg); - (yyval.memArg).nrderefs += (yyvsp[(2) - (3)].number); - (yyval.memArg).argflags |= (yyvsp[(3) - (3)].number); - } - break; - - case 333: - -/* Line 1455 of yacc.c */ -#line 2438 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.memArg) = (yyvsp[(1) - (3)].memArg); - (yyval.memArg).name = cacheName(currentSpec, (yyvsp[(2) - (3)].text)); - - if (getAllowNone(&(yyvsp[(3) - (3)].optflags))) - (yyval.memArg).argflags |= ARG_ALLOW_NONE; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"GetWrapper",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_GET_WRAPPER; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"Array",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_ARRAY; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"ArraySize",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_ARRAY_SIZE; - - if (getTransfer(&(yyvsp[(3) - (3)].optflags))) - (yyval.memArg).argflags |= ARG_XFERRED; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"TransferThis",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_THIS_XFERRED; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"TransferBack",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_XFERRED_BACK; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags), "KeepReference", bool_flag) != NULL) - { - (yyval.memArg).argflags |= ARG_KEEP_REF; - (yyval.memArg).key = currentModule->next_key++; - } - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"In",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_IN; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"Out",bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_OUT; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags), "ResultSize", bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_RESULT_SIZE; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags), "NoCopy", bool_flag) != NULL) - (yyval.memArg).argflags |= ARG_NO_COPY; - - if (findOptFlag(&(yyvsp[(3) - (3)].optflags),"Constrained",bool_flag) != NULL) - { - (yyval.memArg).argflags |= ARG_CONSTRAINED; - - switch ((yyval.memArg).atype) - { - case bool_type: - (yyval.memArg).atype = cbool_type; - break; - - case int_type: - (yyval.memArg).atype = cint_type; - break; - - case float_type: - (yyval.memArg).atype = cfloat_type; - break; - - case double_type: - (yyval.memArg).atype = cdouble_type; - break; - } - } - - applyTypeFlags(currentModule, &(yyval.memArg), &(yyvsp[(3) - (3)].optflags)); - (yyval.memArg).docval = getDocValue(&(yyvsp[(3) - (3)].optflags)); - } - break; - - case 334: - -/* Line 1455 of yacc.c */ -#line 2510 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = 0; - } - break; - - case 335: - -/* Line 1455 of yacc.c */ -#line 2513 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec -> genc) - yyerror("References not allowed in a C module"); - - (yyval.number) = ARG_IS_REF; - } - break; - - case 336: - -/* Line 1455 of yacc.c */ -#line 2521 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = 0; - } - break; - - case 337: - -/* Line 1455 of yacc.c */ -#line 2524 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.number) = (yyvsp[(1) - (2)].number) + 1; - } - break; - - case 338: - -/* Line 1455 of yacc.c */ -#line 2529 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = defined_type; - (yyval.memArg).u.snd = (yyvsp[(1) - (1)].scpvalp); - - /* Try and resolve typedefs as early as possible. */ - resolveAnyTypedef(currentSpec, &(yyval.memArg)); - } - break; - - case 339: - -/* Line 1455 of yacc.c */ -#line 2537 "/TEMP/sip4-tqt/sipgen/parser.y" - { - templateDef *td; - - td = sipMalloc(sizeof(templateDef)); - td->fqname = (yyvsp[(1) - (4)].scpvalp); - td->types = (yyvsp[(3) - (4)].signature); - - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = template_type; - (yyval.memArg).u.td = td; - } - break; - - case 340: - -/* Line 1455 of yacc.c */ -#line 2548 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - - /* In a C module all structures must be defined. */ - if (currentSpec -> genc) - { - (yyval.memArg).atype = defined_type; - (yyval.memArg).u.snd = (yyvsp[(2) - (2)].scpvalp); - } - else - { - (yyval.memArg).atype = struct_type; - (yyval.memArg).u.sname = (yyvsp[(2) - (2)].scpvalp); - } - } - break; - - case 341: - -/* Line 1455 of yacc.c */ -#line 2563 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = ushort_type; - } - break; - - case 342: - -/* Line 1455 of yacc.c */ -#line 2567 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = short_type; - } - break; - - case 343: - -/* Line 1455 of yacc.c */ -#line 2571 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = uint_type; - } - break; - - case 344: - -/* Line 1455 of yacc.c */ -#line 2575 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = uint_type; - } - break; - - case 345: - -/* Line 1455 of yacc.c */ -#line 2579 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = int_type; - } - break; - - case 346: - -/* Line 1455 of yacc.c */ -#line 2583 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = long_type; - } - break; - - case 347: - -/* Line 1455 of yacc.c */ -#line 2587 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = ulong_type; - } - break; - - case 348: - -/* Line 1455 of yacc.c */ -#line 2591 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = longlong_type; - } - break; - - case 349: - -/* Line 1455 of yacc.c */ -#line 2595 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = ulonglong_type; - } - break; - - case 350: - -/* Line 1455 of yacc.c */ -#line 2599 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = float_type; - } - break; - - case 351: - -/* Line 1455 of yacc.c */ -#line 2603 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = double_type; - } - break; - - case 352: - -/* Line 1455 of yacc.c */ -#line 2607 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = bool_type; - } - break; - - case 353: - -/* Line 1455 of yacc.c */ -#line 2611 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = sstring_type; - } - break; - - case 354: - -/* Line 1455 of yacc.c */ -#line 2615 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = ustring_type; - } - break; - - case 355: - -/* Line 1455 of yacc.c */ -#line 2619 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = string_type; - } - break; - - case 356: - -/* Line 1455 of yacc.c */ -#line 2623 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = wstring_type; - } - break; - - case 357: - -/* Line 1455 of yacc.c */ -#line 2627 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = void_type; - } - break; - - case 358: - -/* Line 1455 of yacc.c */ -#line 2631 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pyobject_type; - } - break; - - case 359: - -/* Line 1455 of yacc.c */ -#line 2635 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pytuple_type; - } - break; - - case 360: - -/* Line 1455 of yacc.c */ -#line 2639 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pylist_type; - } - break; - - case 361: - -/* Line 1455 of yacc.c */ -#line 2643 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pydict_type; - } - break; - - case 362: - -/* Line 1455 of yacc.c */ -#line 2647 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pycallable_type; - } - break; - - case 363: - -/* Line 1455 of yacc.c */ -#line 2651 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pyslice_type; - } - break; - - case 364: - -/* Line 1455 of yacc.c */ -#line 2655 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = pytype_type; - } - break; - - case 365: - -/* Line 1455 of yacc.c */ -#line 2659 "/TEMP/sip4-tqt/sipgen/parser.y" - { - memset(&(yyval.memArg), 0, sizeof (argDef)); - (yyval.memArg).atype = ellipsis_type; - } - break; - - case 366: - -/* Line 1455 of yacc.c */ -#line 2665 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* The single or first type. */ - - (yyval.signature).args[0] = (yyvsp[(1) - (1)].memArg); - (yyval.signature).nrArgs = 1; - } - break; - - case 367: - -/* Line 1455 of yacc.c */ -#line 2671 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Check there is nothing after an ellipsis. */ - if ((yyvsp[(1) - (3)].signature).args[(yyvsp[(1) - (3)].signature).nrArgs - 1].atype == ellipsis_type) - yyerror("An ellipsis must be at the end of the argument list"); - - /* Check there is room. */ - if ((yyvsp[(1) - (3)].signature).nrArgs == MAX_NR_ARGS) - yyerror("Internal error - increase the value of MAX_NR_ARGS"); - - (yyval.signature) = (yyvsp[(1) - (3)].signature); - - (yyval.signature).args[(yyval.signature).nrArgs] = (yyvsp[(3) - (3)].memArg); - (yyval.signature).nrArgs++; - } - break; - - case 368: - -/* Line 1455 of yacc.c */ -#line 2687 "/TEMP/sip4-tqt/sipgen/parser.y" - { - (yyval.throwlist) = NULL; - } - break; - - case 369: - -/* Line 1455 of yacc.c */ -#line 2690 "/TEMP/sip4-tqt/sipgen/parser.y" - { - if (currentSpec->genc) - yyerror("Exceptions not allowed in a C module"); - - (yyval.throwlist) = (yyvsp[(3) - (4)].throwlist); - } - break; - - case 370: - -/* Line 1455 of yacc.c */ -#line 2698 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Empty list so use a blank. */ - - (yyval.throwlist) = sipMalloc(sizeof (throwArgs)); - (yyval.throwlist) -> nrArgs = 0; - } - break; - - case 371: - -/* Line 1455 of yacc.c */ -#line 2704 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* The only or first exception. */ - - (yyval.throwlist) = sipMalloc(sizeof (throwArgs)); - (yyval.throwlist) -> nrArgs = 1; - (yyval.throwlist) -> args[0] = findException(currentSpec, (yyvsp[(1) - (1)].scpvalp), FALSE); - } - break; - - case 372: - -/* Line 1455 of yacc.c */ -#line 2711 "/TEMP/sip4-tqt/sipgen/parser.y" - { - /* Check that it wasn't ...(,arg...). */ - - if ((yyvsp[(1) - (3)].throwlist) -> nrArgs == 0) - yyerror("First exception of throw specifier is missing"); - - /* Check there is room. */ - - if ((yyvsp[(1) - (3)].throwlist) -> nrArgs == MAX_NR_ARGS) - yyerror("Internal error - increase the value of MAX_NR_ARGS"); - - (yyval.throwlist) = (yyvsp[(1) - (3)].throwlist); - (yyval.throwlist) -> args[(yyval.throwlist) -> nrArgs++] = findException(currentSpec, (yyvsp[(3) - (3)].scpvalp), FALSE); - } - break; - - - -/* Line 1455 of yacc.c */ -#line 6104 "y.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; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| 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 2727 "/TEMP/sip4-tqt/sipgen/parser.y" - - - -/* - * Parse the specification. - */ -void parse(sipSpec *spec, FILE *fp, char *filename, stringList *tsl, - stringList *xfl, int kwdArgs, int protHack) -{ - classTmplDef *tcd; - - /* Initialise the spec. */ - - spec->modules = NULL; - spec->namecache = NULL; - spec->ifacefiles = NULL; - spec->classes = NULL; - spec->classtemplates = NULL; - spec->exceptions = NULL; - spec->mappedtypes = NULL; - spec->mappedtypetemplates = NULL; - spec->enums = NULL; - spec->vars = NULL; - spec->typedefs = NULL; - spec->exphdrcode = NULL; - spec->docs = NULL; - spec->sigslots = FALSE; - spec->genc = -1; - spec->plugins = NULL; - - currentSpec = spec; - neededQualifiers = tsl; - excludedQualifiers = xfl; - currentModule = NULL; - currentMappedType = NULL; - currentOverIsVirt = FALSE; - currentCtorIsExplicit = FALSE; - currentIsStatic = FALSE; - currentIsSignal = FALSE; - currentIsSlot = FALSE; - currentIsTemplate = FALSE; - previousFile = NULL; - skipStackPtr = 0; - currentScopeIdx = 0; - sectionFlags = 0; - defaultKwdArgs = kwdArgs; - makeProtPublic = protHack; - - newModule(fp, filename); - spec->module = currentModule; - - yyparse(); - - handleEOF(); - handleEOM(); - - /* - * Go through each template class and remove it from the list of classes. - */ - for (tcd = spec->classtemplates; tcd != NULL; tcd = tcd->next) - { - classDef **cdp; - - for (cdp = &spec->classes; *cdp != NULL; cdp = &(*cdp)->next) - if (*cdp == tcd->cd) - { - ifaceFileDef **ifdp; - - /* Remove the interface file as well. */ - for (ifdp = &spec->ifacefiles; *ifdp != NULL; ifdp = &(*ifdp)->next) - if (*ifdp == tcd->cd->iff) - { - *ifdp = (*ifdp)->next; - break; - } - - *cdp = (*cdp)->next; - break; - } - } -} - - -/* - * Tell the parser that a complete file has now been read. - */ -void parserEOF(char *name, parserContext *pc) -{ - previousFile = sipStrdup(name); - currentContext = *pc; -} - - -/* - * Append a class definition to a class list if it doesn't already appear. - * Append is needed specifically for the list of super-classes because the - * order is important to Python. - */ -void appendToClassList(classList **clp,classDef *cd) -{ - classList *new; - - /* Find the end of the list. */ - - while (*clp != NULL) - { - if ((*clp) -> cd == cd) - return; - - clp = &(*clp) -> next; - } - - new = sipMalloc(sizeof (classList)); - - new -> cd = cd; - new -> next = NULL; - - *clp = new; -} - - -/* - * Create a new module for the current specification and make it current. - */ -static void newModule(FILE *fp, char *filename) -{ - moduleDef *mod; - - parseFile(fp, filename, currentModule, FALSE); - - mod = allocModule(); - mod->file = filename; - - if (currentModule != NULL) - mod->defexception = currentModule->defexception; - - currentModule = mod; -} - - -/* - * Allocate and initialise the memory for a new module. - */ -static moduleDef *allocModule() -{ - moduleDef *newmod, **tailp; - - newmod = sipMalloc(sizeof (moduleDef)); - - newmod->version = -1; - newmod->encoding = no_type; - newmod->qobjclass = -1; - newmod->nrvirthandlers = -1; - newmod->next_key = 1; - - /* - * The consolidated module support needs these to be in order that they - * appeared. - */ - for (tailp = ¤tSpec->modules; *tailp != NULL; tailp = &(*tailp)->next) - ; - - *tailp = newmod; - - return newmod; -} - - -/* - * Switch to parsing a new file. - */ -static void parseFile(FILE *fp, char *name, moduleDef *prevmod, int optional) -{ - parserContext pc; - - pc.filename = name; - pc.ifdepth = skipStackPtr; - pc.prevmod = prevmod; - - if (setInputFile(fp, &pc, optional)) - currentContext = pc; -} - - -/* - * Find an interface file, or create a new one. - */ -ifaceFileDef *findIfaceFile(sipSpec *pt, moduleDef *mod, scopedNameDef *fqname, - ifaceFileType iftype, apiVersionRangeDef *api_range, argDef *ad) -{ - ifaceFileDef *iff, *first_alt = NULL; - - /* See if the name is already used. */ - - for (iff = pt->ifacefiles; iff != NULL; iff = iff->next) - { - if (compareScopedNames(iff->fqcname, fqname) != 0) - continue; - - /* - * If they are both versioned then assume the user knows what they are - * doing. - */ - if (iff->api_range != NULL && api_range != NULL && iff->module == mod) - { - /* Remember the first of the alternate APIs. */ - if ((first_alt = iff->first_alt) == NULL) - first_alt = iff; - - break; - } - - /* - * They must be the same type except that we allow a class if we want - * an exception. This is because we allow classes to be used before - * they are defined. - */ - if (iff->type != iftype) - if (iftype != exception_iface || iff->type != class_iface) - yyerror("A class, exception, namespace or mapped type has already been defined with the same name"); - - /* Ignore an external class declared in another module. */ - if (iftype == class_iface && iff->module != mod) - { - classDef *cd; - - for (cd = pt->classes; cd != NULL; cd = cd->next) - if (cd->iff == iff) - break; - - if (cd != NULL && iff->module != NULL && isExternal(cd)) - continue; - } - - /* - * If this is a mapped type with the same name defined in a different - * module, then check that this type isn't the same as any of the - * mapped types defined in that module. - */ - if (iftype == mappedtype_iface && iff->module != mod) - { - mappedTypeDef *mtd; - - /* - * This is a bit of a cheat. With consolidated modules it's - * possible to have two implementations of a mapped type in - * different branches of the module hierarchy. We assume that, if - * there really are multiple implementations in the same branch, - * then it will be picked up in a non-consolidated build. - */ - if (isConsolidated(pt->module)) - continue; - - for (mtd = pt->mappedtypes; mtd != NULL; mtd = mtd->next) - { - if (mtd->iff != iff) - continue; - - if (ad->atype != template_type || - mtd->type.atype != template_type || - sameBaseType(ad, &mtd->type)) - yyerror("Mapped type has already been defined in another module"); - } - - /* - * If we got here then we have a mapped type based on an existing - * template, but with unique parameters. We don't want to use - * interface files from other modules, so skip this one. - */ - - continue; - } - - /* Ignore a namespace defined in another module. */ - if (iftype == namespace_iface && iff->module != mod) - continue; - - return iff; - } - - iff = sipMalloc(sizeof (ifaceFileDef)); - - iff->name = cacheName(pt, scopedNameToString(fqname)); - iff->api_range = api_range; - - if (first_alt != NULL) - { - iff->first_alt = first_alt; - iff->next_alt = first_alt->next_alt; - - first_alt->next_alt = iff; - } - else - { - /* This is the first alternate so point to itself. */ - iff->first_alt = iff; - } - - iff->type = iftype; - iff->ifacenr = -1; - iff->fqcname = fqname; - iff->module = NULL; - iff->hdrcode = NULL; - iff->used = NULL; - iff->next = pt->ifacefiles; - - pt->ifacefiles = iff; - - return iff; -} - - -/* - * Find a class definition in a parse tree. - */ -static classDef *findClass(sipSpec *pt, ifaceFileType iftype, - apiVersionRangeDef *api_range, scopedNameDef *fqname) -{ - return findClassWithInterface(pt, findIfaceFile(pt, currentModule, fqname, iftype, api_range, NULL)); -} - - -/* - * Find a class definition given an existing interface file. - */ -static classDef *findClassWithInterface(sipSpec *pt, ifaceFileDef *iff) -{ - classDef *cd; - - for (cd = pt -> classes; cd != NULL; cd = cd -> next) - if (cd -> iff == iff) - return cd; - - /* Create a new one. */ - cd = sipMalloc(sizeof (classDef)); - - cd->iff = iff; - cd->pyname = cacheName(pt, classBaseName(cd)); - cd->next = pt->classes; - - pt->classes = cd; - - return cd; -} - - -/* - * Add an interface file to an interface file list if it isn't already there. - */ -void addToUsedList(ifaceFileList **ifflp, ifaceFileDef *iff) -{ - /* Make sure we don't try to add an interface file to its own list. */ - if (&iff->used != ifflp) - { - ifaceFileList *iffl; - - while ((iffl = *ifflp) != NULL) - { - /* Don't bother if it is already there. */ - if (iffl->iff == iff) - return; - - ifflp = &iffl -> next; - } - - iffl = sipMalloc(sizeof (ifaceFileList)); - - iffl->iff = iff; - iffl->next = NULL; - - *ifflp = iffl; - } -} - - -/* - * Find an undefined (or create a new) exception definition in a parse tree. - */ -static exceptionDef *findException(sipSpec *pt, scopedNameDef *fqname, int new) -{ - exceptionDef *xd, **tail; - ifaceFileDef *iff; - classDef *cd; - - iff = findIfaceFile(pt, currentModule, fqname, exception_iface, NULL, NULL); - - /* See if it is an existing one. */ - for (xd = pt->exceptions; xd != NULL; xd = xd->next) - if (xd->iff == iff) - return xd; - - /* - * If it is an exception interface file then we have never seen this - * name before. We require that exceptions are defined before being - * used, but don't make the same requirement of classes (for reasons of - * backwards compatibility). Therefore the name must be reinterpreted - * as a (as yet undefined) class. - */ - if (new) - { - if (iff->type == exception_iface) - cd = NULL; - else - yyerror("There is already a class with the same name or the exception has been used before being defined"); - } - else - { - if (iff->type == exception_iface) - iff->type = class_iface; - - cd = findClassWithInterface(pt, iff); - } - - /* Create a new one. */ - xd = sipMalloc(sizeof (exceptionDef)); - - xd->exceptionnr = -1; - xd->iff = iff; - xd->pyname = NULL; - xd->cd = cd; - xd->bibase = NULL; - xd->base = NULL; - xd->raisecode = NULL; - xd->next = NULL; - - /* Append it to the list. */ - for (tail = &pt->exceptions; *tail != NULL; tail = &(*tail)->next) - ; - - *tail = xd; - - return xd; -} - - -/* - * Find an undefined (or create a new) class definition in a parse tree. - */ -static classDef *newClass(sipSpec *pt, ifaceFileType iftype, - apiVersionRangeDef *api_range, scopedNameDef *fqname) -{ - int flags; - classDef *cd, *scope; - codeBlock *hdrcode; - - if (sectionFlags & SECT_IS_PRIVATE) - yyerror("Classes, structs and namespaces must be in the public or protected sections"); - - flags = 0; - - if ((scope = currentScope()) != NULL) - { - if (sectionFlags & SECT_IS_PROT && !makeProtPublic) - { - flags = CLASS_IS_PROTECTED; - - if (scope->iff->type == class_iface) - setHasShadow(scope); - } - - /* Header code from outer scopes is also included. */ - hdrcode = scope->iff->hdrcode; - } - else - hdrcode = NULL; - - if (pt -> genc) - { - /* C structs are always global types. */ - while (fqname -> next != NULL) - fqname = fqname -> next; - - scope = NULL; - } - - cd = findClass(pt, iftype, api_range, fqname); - - /* Check it hasn't already been defined. */ - if (iftype != namespace_iface && cd->iff->module != NULL) - yyerror("The struct/class has already been defined"); - - /* Complete the initialisation. */ - cd->classflags |= flags; - cd->ecd = scope; - cd->iff->module = currentModule; - - if (currentIsTemplate) - setIsTemplateClass(cd); - - appendCodeBlock(&cd->iff->hdrcode, hdrcode); - - /* See if it is a namespace extender. */ - if (iftype == namespace_iface) - { - classDef *ns; - - for (ns = pt->classes; ns != NULL; ns = ns->next) - { - if (ns == cd) - continue; - - if (ns->iff->type != namespace_iface) - continue; - - if (compareScopedNames(ns->iff->fqcname, fqname) != 0) - continue; - - cd->real = ns; - break; - } - } - - return cd; -} - - -/* - * Tidy up after finishing a class definition. - */ -static void finishClass(sipSpec *pt, moduleDef *mod, classDef *cd, - optFlags *of) -{ - const char *pyname; - optFlag *flg; - - /* Get the Python name and see if it is different to the C++ name. */ - pyname = getPythonName(of, classBaseName(cd)); - - cd->pyname = NULL; - checkAttributes(pt, mod, cd->ecd, NULL, pyname, FALSE); - cd->pyname = cacheName(pt, pyname); - - if ((flg = findOptFlag(of, "Metatype", dotted_name_flag)) != NULL) - cd->metatype = cacheName(pt, flg->fvalue.sval); - - if ((flg = findOptFlag(of, "Supertype", dotted_name_flag)) != NULL) - cd->supertype = cacheName(pt, flg->fvalue.sval); - - if ((flg = findOptFlag(of, "PyQt4Flags", integer_flag)) != NULL) - cd->pyqt4_flags = flg->fvalue.ival; - - if (findOptFlag(of, "PyQt4NoQMetaObject", bool_flag) != NULL) - setPyTQt4NoTQMetaObject(cd); - - if (isOpaque(cd)) - { - if (findOptFlag(of, "External", bool_flag) != NULL) - setIsExternal(cd); - } - else - { - int seq_might, seq_not; - memberDef *md; - - if (findOptFlag(of, "NoDefaultCtors", bool_flag) != NULL) - setNoDefaultCtors(cd); - - if (cd -> ctors == NULL) - { - if (!noDefaultCtors(cd)) - { - /* Provide a default ctor. */ - - cd->ctors = sipMalloc(sizeof (ctorDef)); - - cd->ctors->ctorflags = SECT_IS_PUBLIC; - cd->ctors->pysig.result.atype = void_type; - cd->ctors->cppsig = &cd->ctors->pysig; - - cd->defctor = cd->ctors; - - setCanCreate(cd); - } - } - else if (cd -> defctor == NULL) - { - ctorDef *ct, *last = NULL; - - for (ct = cd -> ctors; ct != NULL; ct = ct -> next) - { - if (!isPublicCtor(ct)) - continue; - - if (ct -> pysig.nrArgs == 0 || ct -> pysig.args[0].defval != NULL) - { - cd -> defctor = ct; - break; - } - - if (last == NULL) - last = ct; - } - - /* The last resort is the first public ctor. */ - if (cd->defctor == NULL) - cd->defctor = last; - } - - if (getDeprecated(of)) - setIsDeprecatedClass(cd); - - if (cd->convtocode != NULL && getAllowNone(of)) - setClassHandlesNone(cd); - - if (findOptFlag(of,"Abstract",bool_flag) != NULL) - { - setIsAbstractClass(cd); - setIsIncomplete(cd); - resetCanCreate(cd); - } - - /* We assume a public dtor if nothing specific was provided. */ - if (!isDtor(cd)) - setIsPublicDtor(cd); - - if (findOptFlag(of, "DelayDtor", bool_flag) != NULL) - { - setIsDelayedDtor(cd); - setHasDelayedDtors(mod); - } - - /* - * There are subtle differences between the add and concat methods and - * the multiply and repeat methods. The number versions can have their - * operands swapped and may return NotImplemented. If the user has - * used the /Numeric/ annotation or there are other numeric operators - * then we use add/multiply. Otherwise, if there are indexing - * operators then we use concat/repeat. - */ - seq_might = seq_not = FALSE; - - for (md = cd -> members; md != NULL; md = md -> next) - switch (md -> slot) - { - case getitem_slot: - case setitem_slot: - case delitem_slot: - /* This might be a sequence. */ - seq_might = TRUE; - break; - - case sub_slot: - case isub_slot: - case div_slot: - case idiv_slot: - case mod_slot: - case imod_slot: - case floordiv_slot: - case ifloordiv_slot: - case truediv_slot: - case itruediv_slot: - case pos_slot: - case neg_slot: - /* This is definately not a sequence. */ - seq_not = TRUE; - break; - } - - if (!seq_not && seq_might) - for (md = cd -> members; md != NULL; md = md -> next) - { - /* Ignore if the user has been explicit. */ - if (isNumeric(md)) - continue; - - switch (md -> slot) - { - case add_slot: - md -> slot = concat_slot; - break; - - case iadd_slot: - md -> slot = iconcat_slot; - break; - - case mul_slot: - md -> slot = repeat_slot; - break; - - case imul_slot: - md -> slot = irepeat_slot; - break; - } - } - } - - if (inMainModule()) - { - setIsUsedName(cd->iff->name); - setIsUsedName(cd->pyname); - } -} - - -/* - * Return the encoded name of a template (ie. including its argument types) as - * a scoped name. - */ -scopedNameDef *encodedTemplateName(templateDef *td) -{ - int a; - scopedNameDef *snd; - - snd = copyScopedName(td->fqname); - - for (a = 0; a < td->types.nrArgs; ++a) - { - char buf[50]; - int flgs; - scopedNameDef *arg_snd; - argDef *ad = &td->types.args[a]; - - flgs = 0; - - if (isConstArg(ad)) - flgs += 1; - - if (isReference(ad)) - flgs += 2; - - /* We use numbers so they don't conflict with names. */ - sprintf(buf, "%02d%d%d", ad->atype, flgs, ad->nrderefs); - - switch (ad->atype) - { - case defined_type: - arg_snd = copyScopedName(ad->u.snd); - break; - - case template_type: - arg_snd = encodedTemplateName(ad->u.td); - break; - - case struct_type: - arg_snd = copyScopedName(ad->u.sname); - break; - - default: - arg_snd = NULL; - } - - /* - * Replace the first element of the argument name with a copy with the - * encoding prepended. - */ - if (arg_snd != NULL) - arg_snd->name = concat(buf, arg_snd->name, NULL); - else - arg_snd = text2scopePart(sipStrdup(buf)); - - appendScopedName(&snd, arg_snd); - } - - return snd; -} - - -/* - * Create a new mapped type. - */ -static mappedTypeDef *newMappedType(sipSpec *pt, argDef *ad, optFlags *of) -{ - mappedTypeDef *mtd; - scopedNameDef *snd; - ifaceFileDef *iff; - const char *cname; - - /* Check that the type is one we want to map. */ - switch (ad->atype) - { - case defined_type: - snd = ad->u.snd; - cname = scopedNameTail(snd); - break; - - case template_type: - snd = encodedTemplateName(ad->u.td); - cname = NULL; - break; - - case struct_type: - snd = ad->u.sname; - cname = scopedNameTail(snd); - break; - - default: - yyerror("Invalid type for %MappedType"); - } - - iff = findIfaceFile(pt, currentModule, snd, mappedtype_iface, - getAPIRange(of), ad); - - /* Check it hasn't already been defined. */ - for (mtd = pt->mappedtypes; mtd != NULL; mtd = mtd->next) - if (mtd->iff == iff) - { - /* - * We allow types based on the same template but with different - * arguments. - */ - if (ad->atype != template_type || sameBaseType(ad, &mtd->type)) - yyerror("Mapped type has already been defined in this module"); - } - - /* The module may not have been set yet. */ - iff->module = currentModule; - - /* Create a new mapped type. */ - mtd = allocMappedType(pt, ad); - - if (cname != NULL) - mtd->pyname = cacheName(pt, getPythonName(of, cname)); - - if (findOptFlag(of, "NoRelease", bool_flag) != NULL) - setNoRelease(mtd); - - if (getAllowNone(of)) - setHandlesNone(mtd); - - mtd->doctype = getDocType(of); - - mtd->iff = iff; - mtd->next = pt->mappedtypes; - - pt->mappedtypes = mtd; - - if (inMainModule()) - { - setIsUsedName(mtd->cname); - - if (mtd->pyname) - setIsUsedName(mtd->pyname); - } - - return mtd; -} - - -/* - * Allocate, intialise and return a mapped type structure. - */ -mappedTypeDef *allocMappedType(sipSpec *pt, argDef *type) -{ - mappedTypeDef *mtd; - - mtd = sipMalloc(sizeof (mappedTypeDef)); - - mtd->type = *type; - mtd->type.argflags = 0; - mtd->type.nrderefs = 0; - - mtd->cname = cacheName(pt, type2string(&mtd->type)); - - return mtd; -} - - -/* - * Create a new enum. - */ -static enumDef *newEnum(sipSpec *pt, moduleDef *mod, mappedTypeDef *mt_scope, - char *name, optFlags *of, int flags) -{ - enumDef *ed, *first_alt, *next_alt; - classDef *c_scope; - ifaceFileDef *scope; - - if (mt_scope != NULL) - { - scope = mt_scope->iff; - c_scope = NULL; - } - else - { - if ((c_scope = currentScope()) != NULL) - scope = c_scope->iff; - else - scope = NULL; - } - - ed = sipMalloc(sizeof (enumDef)); - - /* Assume the enum isn't versioned. */ - first_alt = ed; - next_alt = NULL; - - if (name != NULL) - { - ed->pyname = cacheName(pt, getPythonName(of, name)); - checkAttributes(pt, mod, c_scope, mt_scope, ed->pyname->text, FALSE); - - ed->fqcname = text2scopedName(scope, name); - ed->cname = cacheName(pt, scopedNameToString(ed->fqcname)); - - if (inMainModule()) - { - setIsUsedName(ed->pyname); - setIsUsedName(ed->cname); - } - - /* If the scope is versioned then look for any alternate. */ - if (scope != NULL && scope->api_range != NULL) - { - enumDef *alt; - - for (alt = pt->enums; alt != NULL; alt = alt->next) - { - if (alt->module != mod || alt->fqcname == NULL) - continue; - - if (compareScopedNames(alt->fqcname, ed->fqcname) == 0) - { - first_alt = alt->first_alt; - next_alt = first_alt->next_alt; - first_alt->next_alt = ed; - - break; - } - } - } - } - else - { - ed->pyname = NULL; - ed->fqcname = NULL; - ed->cname = NULL; - } - - if (flags & SECT_IS_PROT && makeProtPublic) - { - flags &= ~SECT_IS_PROT; - flags |= SECT_IS_PUBLIC; - } - - ed->enumflags = flags; - ed->enumnr = -1; - ed->ecd = c_scope; - ed->emtd = mt_scope; - ed->first_alt = first_alt; - ed->next_alt = next_alt; - ed->module = mod; - ed->members = NULL; - ed->slots = NULL; - ed->overs = NULL; - ed->next = pt -> enums; - - pt->enums = ed; - - return ed; -} - - -/* - * Get the type values and (optionally) the type names for substitution in - * handwritten code. - */ -void appendTypeStrings(scopedNameDef *ename, signatureDef *patt, signatureDef *src, signatureDef *known, scopedNameDef **names, scopedNameDef **values) -{ - int a; - - for (a = 0; a < patt->nrArgs; ++a) - { - argDef *pad = &patt->args[a]; - - if (pad->atype == defined_type) - { - char *nam = NULL, *val; - argDef *sad; - - /* - * If the type names are already known then check that this is one - * of them. - */ - if (known == NULL) - nam = scopedNameTail(pad->u.snd); - else if (pad->u.snd->next == NULL) - { - int k; - - for (k = 0; k < known->nrArgs; ++k) - { - /* Skip base types. */ - if (known->args[k].atype != defined_type) - continue; - - if (strcmp(pad->u.snd->name, known->args[k].u.snd->name) == 0) - { - nam = pad->u.snd->name; - break; - } - } - } - - if (nam == NULL) - continue; - - /* Add the name. */ - appendScopedName(names, text2scopePart(nam)); - - /* - * Add the corresponding value. For defined types we don't want - * any indirection or references. - */ - sad = &src->args[a]; - - if (sad->atype == defined_type) - val = scopedNameToString(sad->u.snd); - else - val = type2string(sad); - - appendScopedName(values, text2scopePart(val)); - } - else if (pad->atype == template_type) - { - argDef *sad = &src->args[a]; - - /* These checks shouldn't be necessary, but... */ - if (sad->atype == template_type && pad->u.td->types.nrArgs == sad->u.td->types.nrArgs) - appendTypeStrings(ename, &pad->u.td->types, &sad->u.td->types, known, names, values); - } - } -} - - -/* - * Convert a type to a string on the heap. The string will use the minimum - * whitespace while still remaining valid C++. - */ -static char *type2string(argDef *ad) -{ - int i, on_heap = FALSE; - int nr_derefs = ad->nrderefs; - int is_reference = isReference(ad); - char *s; - - /* Use the original type if possible. */ - if (ad->original_type != NULL && !noTypeName(ad->original_type)) - { - s = scopedNameToString(ad->original_type->fqname); - on_heap = TRUE; - - nr_derefs -= ad->original_type->type.nrderefs; - - if (isReference(&ad->original_type->type)) - is_reference = FALSE; - } - else - switch (ad->atype) - { - case template_type: - { - templateDef *td = ad->u.td; - - s = scopedNameToString(td->fqname); - append(&s, "<"); - - for (i = 0; i < td->types.nrArgs; ++i) - { - char *sub_type = type2string(&td->types.args[i]); - - if (i > 0) - append(&s, ","); - - append(&s, sub_type); - free(sub_type); - } - - if (s[strlen(s) - 1] == '>') - append(&s, " >"); - else - append(&s, ">"); - - on_heap = TRUE; - break; - } - - case struct_type: - s = scopedNameToString(ad->u.sname); - on_heap = TRUE; - break; - - case defined_type: - s = scopedNameToString(ad->u.snd); - on_heap = TRUE; - break; - - case ustring_type: - s = "unsigned char"; - break; - - case ascii_string_type: - case latin1_string_type: - case utf8_string_type: - case string_type: - s = "char"; - break; - - case sstring_type: - s = "signed char"; - break; - - case wstring_type: - s = "wchar_t"; - break; - - case ushort_type: - s = "unsigned short"; - break; - - case short_type: - s = "short"; - break; - - case uint_type: - s = "unsigned int"; - break; - - case int_type: - case cint_type: - s = "int"; - break; - - case ulong_type: - s = "unsigned long"; - break; - - case long_type: - s = "long"; - break; - - case ulonglong_type: - s = "unsigned long long"; - break; - - case longlong_type: - s = "long long"; - break; - - case float_type: - case cfloat_type: - s = "float"; - break; - - case double_type: - case cdouble_type: - s = "double"; - break; - - case bool_type: - case cbool_type: - s = "bool"; - break; - - default: - fatal("Unsupported type argument to type2string(): %d\n", ad->atype); - } - - /* Make sure the string is on the heap. */ - if (!on_heap) - s = sipStrdup(s); - - while (nr_derefs-- > 0) - append(&s, "*"); - - if (is_reference) - append(&s, "&"); - - return s; -} - - -/* - * Convert a scoped name to a string on the heap. - */ -static char *scopedNameToString(scopedNameDef *name) -{ - static const char scope_string[] = "::"; - size_t len; - scopedNameDef *snd; - char *s, *dp; - - /* Work out the length of buffer needed. */ - len = 0; - - for (snd = name; snd != NULL; snd = snd->next) - { - len += strlen(snd->name); - - if (snd->next != NULL) - { - /* Ignore the encoded part of template names. */ - if (isdigit(snd->next->name[0])) - break; - - len += strlen(scope_string); - } - } - - /* Allocate and populate the buffer. */ - dp = s = sipMalloc(len + 1); - - for (snd = name; snd != NULL; snd = snd->next) - { - strcpy(dp, snd->name); - dp += strlen(snd->name); - - if (snd->next != NULL) - { - /* Ignore the encoded part of template names. */ - if (isdigit(snd->next->name[0])) - break; - - strcpy(dp, scope_string); - dp += strlen(scope_string); - } - } - - return s; -} - - -/* - * Instantiate a class template. - */ -static void instantiateClassTemplate(sipSpec *pt, moduleDef *mod, - classDef *scope, scopedNameDef *fqname, classTmplDef *tcd, - templateDef *td) -{ - scopedNameDef *type_names, *type_values; - classDef *cd; - ctorDef *oct, **cttail; - argDef *ad; - ifaceFileList *iffl, **used; - - type_names = type_values = NULL; - appendTypeStrings(classFTQCName(tcd->cd), &tcd->sig, &td->types, NULL, &type_names, &type_values); - - /* - * Add a mapping from the template name to the instantiated name. If we - * have got this far we know there is room for it. - */ - ad = &tcd->sig.args[tcd->sig.nrArgs++]; - memset(ad, 0, sizeof (argDef)); - ad->atype = defined_type; - ad->u.snd = classFTQCName(tcd->cd); - - appendScopedName(&type_names, text2scopePart(scopedNameTail(classFTQCName(tcd->cd)))); - appendScopedName(&type_values, text2scopePart(scopedNameToString(fqname))); - - /* Create the new class. */ - cd = sipMalloc(sizeof (classDef)); - - /* Start with a shallow copy. */ - *cd = *tcd->cd; - - resetIsTemplateClass(cd); - cd->pyname = cacheName(pt, scopedNameTail(fqname)); - cd->td = td; - - /* Handle the interface file. */ - cd->iff = findIfaceFile(pt, mod, fqname, class_iface, - (scope != NULL ? scope->iff->api_range : NULL), NULL); - cd->iff->module = mod; - - /* Make a copy of the used list and add the enclosing scope. */ - used = &cd->iff->used; - - for (iffl = tcd->cd->iff->used; iffl != NULL; iffl = iffl->next) - addToUsedList(used, iffl->iff); - - /* Include any scope header code. */ - if (scope != NULL) - appendCodeBlock(&cd->iff->hdrcode, scope->iff->hdrcode); - - if (inMainModule()) - { - setIsUsedName(cd->iff->name); - setIsUsedName(cd->pyname); - } - - cd->ecd = currentScope(); - - /* Handle the enums. */ - instantiateTemplateEnums(pt, tcd, td, cd, used, type_names, type_values); - - /* Handle the variables. */ - instantiateTemplateVars(pt, tcd, td, cd, used, type_names, type_values); - - /* Handle the ctors. */ - cd->ctors = NULL; - cttail = &cd->ctors; - - for (oct = tcd->cd->ctors; oct != NULL; oct = oct->next) - { - ctorDef *nct = sipMalloc(sizeof (ctorDef)); - - /* Start with a shallow copy. */ - *nct = *oct; - - templateSignature(&nct->pysig, FALSE, tcd, td, cd); - - if (oct->cppsig == NULL) - nct->cppsig = NULL; - else if (oct->cppsig == &oct->pysig) - nct->cppsig = &nct->pysig; - else - { - nct->cppsig = sipMalloc(sizeof (signatureDef)); - - *nct->cppsig = *oct->cppsig; - - templateSignature(nct->cppsig, FALSE, tcd, td, cd); - } - - nct->methodcode = templateCode(pt, used, nct->methodcode, type_names, type_values); - - nct->next = NULL; - *cttail = nct; - cttail = &nct->next; - - /* Handle the default ctor. */ - if (tcd->cd->defctor == oct) - cd->defctor = nct; - } - - cd->dealloccode = templateCode(pt, used, cd->dealloccode, type_names, type_values); - cd->dtorcode = templateCode(pt, used, cd->dtorcode, type_names, type_values); - - /* Handle the methods. */ - cd->members = instantiateTemplateMethods(tcd->cd->members, mod); - cd->overs = instantiateTemplateOverloads(pt, tcd->cd->overs, - tcd->cd->members, cd->members, tcd, td, cd, used, type_names, - type_values); - - cd->cppcode = templateCode(pt, used, cd->cppcode, type_names, type_values); - cd->iff->hdrcode = templateCode(pt, used, cd->iff->hdrcode, type_names, type_values); - cd->convtosubcode = templateCode(pt, used, cd->convtosubcode, type_names, type_values); - cd->convtocode = templateCode(pt, used, cd->convtocode, type_names, type_values); - cd->travcode = templateCode(pt, used, cd->travcode, type_names, type_values); - cd->clearcode = templateCode(pt, used, cd->clearcode, type_names, type_values); - cd->getbufcode = templateCode(pt, used, cd->getbufcode, type_names, type_values); - cd->releasebufcode = templateCode(pt, used, cd->releasebufcode, type_names, type_values); - cd->readbufcode = templateCode(pt, used, cd->readbufcode, type_names, type_values); - cd->writebufcode = templateCode(pt, used, cd->writebufcode, type_names, type_values); - cd->segcountcode = templateCode(pt, used, cd->segcountcode, type_names, type_values); - cd->charbufcode = templateCode(pt, used, cd->charbufcode, type_names, type_values); - cd->picklecode = templateCode(pt, used, cd->picklecode, type_names, type_values); - cd->next = pt->classes; - - pt->classes = cd; - - tcd->sig.nrArgs--; - - freeScopedName(type_names); - freeScopedName(type_values); -} - - -/* - * Instantiate the methods of a template class. - */ -static memberDef *instantiateTemplateMethods(memberDef *tmd, moduleDef *mod) -{ - memberDef *md, *methods, **mdtail; - - methods = NULL; - mdtail = &methods; - - for (md = tmd; md != NULL; md = md->next) - { - memberDef *nmd = sipMalloc(sizeof (memberDef)); - - /* Start with a shallow copy. */ - *nmd = *md; - - nmd->module = mod; - - if (inMainModule()) - setIsUsedName(nmd->pyname); - - nmd->next = NULL; - *mdtail = nmd; - mdtail = &nmd->next; - } - - return methods; -} - - -/* - * Instantiate the overloads of a template class. - */ -static overDef *instantiateTemplateOverloads(sipSpec *pt, overDef *tod, - memberDef *tmethods, memberDef *methods, classTmplDef *tcd, - templateDef *td, classDef *cd, ifaceFileList **used, - scopedNameDef *type_names, scopedNameDef *type_values) -{ - overDef *od, *overloads, **odtail; - - overloads = NULL; - odtail = &overloads; - - for (od = tod; od != NULL; od = od->next) - { - overDef *nod = sipMalloc(sizeof (overDef)); - memberDef *nmd, *omd; - - /* Start with a shallow copy. */ - *nod = *od; - - for (nmd = methods, omd = tmethods; omd != NULL; omd = omd->next, nmd = nmd->next) - if (omd == od->common) - { - nod->common = nmd; - break; - } - - templateSignature(&nod->pysig, TRUE, tcd, td, cd); - - if (od->cppsig == &od->pysig) - nod->cppsig = &nod->pysig; - else - { - nod->cppsig = sipMalloc(sizeof (signatureDef)); - - *nod->cppsig = *od->cppsig; - - templateSignature(nod->cppsig, TRUE, tcd, td, cd); - } - - nod->methodcode = templateCode(pt, used, nod->methodcode, type_names, type_values); - - /* Handle any virtual handler. */ - if (od->virthandler != NULL) - { - moduleDef *mod = cd->iff->module; - - nod->virthandler = sipMalloc(sizeof (virtHandlerDef)); - - /* Start with a shallow copy. */ - *nod->virthandler = *od->virthandler; - - if (od->virthandler->cppsig == &od->pysig) - nod->virthandler->cppsig = &nod->pysig; - else - { - nod->virthandler->cppsig = sipMalloc(sizeof (signatureDef)); - - *nod->virthandler->cppsig = *od->virthandler->cppsig; - - templateSignature(nod->virthandler->cppsig, TRUE, tcd, td, cd); - } - - nod->virthandler->module = mod; - nod->virthandler->virtcode = templateCode(pt, used, nod->virthandler->virtcode, type_names, type_values); - nod->virthandler->next = mod->virthandlers; - - mod->virthandlers = nod->virthandler; - } - - nod->next = NULL; - *odtail = nod; - odtail = &nod->next; - } - - return overloads; -} - - -/* - * Instantiate the enums of a template class. - */ -static void instantiateTemplateEnums(sipSpec *pt, classTmplDef *tcd, - templateDef *td, classDef *cd, ifaceFileList **used, - scopedNameDef *type_names, scopedNameDef *type_values) -{ - enumDef *ted; - moduleDef *mod = cd->iff->module; - - for (ted = pt->enums; ted != NULL; ted = ted->next) - if (ted->ecd == tcd->cd) - { - enumDef *ed; - enumMemberDef *temd; - - ed = sipMalloc(sizeof (enumDef)); - - /* Start with a shallow copy. */ - *ed = *ted; - - if (ed->fqcname != NULL) - { - ed->fqcname = text2scopedName(cd->iff, - scopedNameTail(ed->fqcname)); - ed->cname = cacheName(pt, scopedNameToString(ed->fqcname)); - } - - if (inMainModule()) - { - if (ed->pyname != NULL) - setIsUsedName(ed->pyname); - - if (ed->cname != NULL) - setIsUsedName(ed->cname); - } - - ed->ecd = cd; - ed->first_alt = ed; - ed->module = mod; - ed->members = NULL; - - for (temd = ted->members; temd != NULL; temd = temd->next) - { - enumMemberDef *emd; - - emd = sipMalloc(sizeof (enumMemberDef)); - - /* Start with a shallow copy. */ - *emd = *temd; - emd->ed = ed; - - emd->next = ed->members; - ed->members = emd; - } - - ed->slots = instantiateTemplateMethods(ted->slots, mod); - ed->overs = instantiateTemplateOverloads(pt, ted->overs, - ted->slots, ed->slots, tcd, td, cd, used, type_names, - type_values); - - ed->next = pt->enums; - pt->enums = ed; - } -} - - -/* - * Instantiate the variables of a template class. - */ -static void instantiateTemplateVars(sipSpec *pt, classTmplDef *tcd, - templateDef *td, classDef *cd, ifaceFileList **used, - scopedNameDef *type_names, scopedNameDef *type_values) -{ - varDef *tvd; - - for (tvd = pt->vars; tvd != NULL; tvd = tvd->next) - if (tvd->ecd == tcd->cd) - { - varDef *vd; - - vd = sipMalloc(sizeof (varDef)); - - /* Start with a shallow copy. */ - *vd = *tvd; - - if (inMainModule()) - setIsUsedName(vd->pyname); - - vd->fqcname = text2scopedName(cd->iff, - scopedNameTail(vd->fqcname)); - vd->ecd = cd; - vd->module = cd->iff->module; - - templateType(&vd->type, tcd, td, cd); - - vd->accessfunc = templateCode(pt, used, vd->accessfunc, type_names, type_values); - vd->getcode = templateCode(pt, used, vd->getcode, type_names, type_values); - vd->setcode = templateCode(pt, used, vd->setcode, type_names, type_values); - - addVariable(pt, vd); - } -} - - -/* - * Replace any template arguments in a signature. - */ -static void templateSignature(signatureDef *sd, int result, classTmplDef *tcd, templateDef *td, classDef *ncd) -{ - int a; - - if (result) - templateType(&sd->result, tcd, td, ncd); - - for (a = 0; a < sd->nrArgs; ++a) - templateType(&sd->args[a], tcd, td, ncd); -} - - -/* - * Replace any template arguments in a type. - */ -static void templateType(argDef *ad, classTmplDef *tcd, templateDef *td, classDef *ncd) -{ - int a; - char *name; - - /* Descend into any sub-templates. */ - if (ad->atype == template_type) - { - templateDef *new_td = sipMalloc(sizeof (templateDef)); - - /* Make a deep copy of the template definition. */ - *new_td = *ad->u.td; - ad->u.td = new_td; - - templateSignature(&ad->u.td->types, FALSE, tcd, td, ncd); - - return; - } - - /* Ignore if it isn't an unscoped name. */ - if (ad->atype != defined_type || ad->u.snd->next != NULL) - return; - - name = ad->u.snd->name; - - for (a = 0; a < tcd->sig.nrArgs - 1; ++a) - if (strcmp(name, scopedNameTail(tcd->sig.args[a].u.snd)) == 0) - { - argDef *tad = &td->types.args[a]; - - ad->atype = tad->atype; - - /* We take the constrained flag from the real type. */ - resetIsConstrained(ad); - - if (isConstrained(tad)) - setIsConstrained(ad); - - ad->u = tad->u; - - return; - } - - /* Handle the class name itself. */ - if (strcmp(name, scopedNameTail(classFTQCName(tcd->cd))) == 0) - { - ad->atype = class_type; - ad->u.cd = ncd; - ad->original_type = NULL; - } -} - - -/* - * Replace any template arguments in a literal code block. - */ -codeBlock *templateCode(sipSpec *pt, ifaceFileList **used, codeBlock *ocb, - scopedNameDef *names, scopedNameDef *values) -{ - codeBlock *ncb = NULL, **tail = &ncb; - - while (ocb != NULL) - { - char *at = ocb->frag; - - do - { - char *first = NULL; - codeBlock *cb; - scopedNameDef *nam, *val, *nam_first, *val_first; - - /* - * Go through the rest of this fragment looking for each of the - * types and the name of the class itself. - */ - nam = names; - val = values; - - while (nam != NULL && val != NULL) - { - char *cp; - - if ((cp = strstr(at, nam->name)) != NULL) - if (first == NULL || first > cp) - { - nam_first = nam; - val_first = val; - first = cp; - } - - nam = nam->next; - val = val->next; - } - - /* Create the new fragment. */ - cb = sipMalloc(sizeof (codeBlock)); - - if (at == ocb->frag) - { - cb->filename = ocb->filename; - cb->linenr = ocb->linenr; - } - else - cb->filename = NULL; - - cb->next = NULL; - *tail = cb; - tail = &cb->next; - - /* See if anything was found. */ - if (first == NULL) - { - /* We can just point to this. */ - cb->frag = at; - - /* All done with this one. */ - at = NULL; - } - else - { - static char *gen_names[] = { - "sipType_", - "sipClass_", - "sipEnum_", - "sipException_", - NULL - }; - - char *dp, *sp, **gn; - int genname = FALSE; - - /* - * If the context in which the text is used is in the name of a - * SIP generated object then translate any "::" scoping to "_". - */ - for (gn = gen_names; *gn != NULL; ++gn) - if (search_back(first, at, *gn)) - { - addUsedFromCode(pt, used, val_first->name); - genname = TRUE; - break; - } - - /* Fragment the fragment. */ - cb->frag = sipMalloc(first - at + strlen(val_first->name) + 1); - - strncpy(cb->frag, at, first - at); - - dp = &cb->frag[first - at]; - sp = val_first->name; - - if (genname) - { - char gch; - - while ((gch = *sp++) != '\0') - if (gch == ':' && *sp == ':') - { - *dp++ = '_'; - ++sp; - } - else - *dp++ = gch; - - *dp = '\0'; - } - else - strcpy(dp, sp); - - /* Move past the replaced text. */ - at = first + strlen(nam_first->name); - } - } - while (at != NULL && *at != '\0'); - - ocb = ocb->next; - } - - return ncb; -} - - -/* - * Return TRUE if the text at the end of a string matches the target string. - */ -static int search_back(const char *end, const char *start, const char *target) -{ - size_t tlen = strlen(target); - - if (start + tlen >= end) - return FALSE; - - return (strncmp(end - tlen, target, tlen) == 0); -} - - -/* - * Add any needed interface files based on handwritten code. - */ -static void addUsedFromCode(sipSpec *pt, ifaceFileList **used, const char *sname) -{ - ifaceFileDef *iff; - enumDef *ed; - - for (iff = pt->ifacefiles; iff != NULL; iff = iff->next) - { - if (iff->type != class_iface && iff->type != exception_iface) - continue; - - if (sameName(iff->fqcname, sname)) - { - addToUsedList(used, iff); - return; - } - } - - for (ed = pt->enums; ed != NULL; ed = ed->next) - { - if (ed->ecd == NULL) - continue; - - if (sameName(ed->fqcname, sname)) - { - addToUsedList(used, ed->ecd->iff); - return; - } - } -} - - -/* - * Compare a scoped name with its string equivalent. - */ -static int sameName(scopedNameDef *snd, const char *sname) -{ - while (snd != NULL && *sname != '\0') - { - const char *sp = snd->name; - - while (*sp != '\0' && *sname != ':' && *sname != '\0') - if (*sp++ != *sname++) - return FALSE; - - if (*sp != '\0' || (*sname != ':' && *sname != '\0')) - return FALSE; - - snd = snd->next; - - if (*sname == ':') - sname += 2; - } - - return (snd == NULL && *sname == '\0'); -} - - -/* - * Compare a (possibly) relative scoped name with a fully qualified scoped name - * while taking the current scope into account. - */ -static int foundInScope(scopedNameDef *fq_name, scopedNameDef *rel_name) -{ - classDef *scope; - - for (scope = currentScope(); scope != NULL; scope = scope->ecd) - { - scopedNameDef *snd; - int found; - - snd = copyScopedName(classFTQCName(scope)); - appendScopedName(&snd, copyScopedName(rel_name)); - - found = (compareScopedNames(fq_name, snd) == 0); - - freeScopedName(snd); - - if (found) - return TRUE; - } - - return compareScopedNames(fq_name, rel_name) == 0; -} - - -/* - * Create a new typedef. - */ -static void newTypedef(sipSpec *pt, moduleDef *mod, char *name, argDef *type, - optFlags *optflgs) -{ - typedefDef *td, **tdp; - scopedNameDef *fqname; - classDef *scope; - - scope = currentScope(); - fqname = text2scopedName((scope != NULL ? scope->iff : NULL), name); - - /* See if we are instantiating a template class. */ - if (type->atype == template_type) - { - classTmplDef *tcd; - templateDef *td = type->u.td; - - for (tcd = pt->classtemplates; tcd != NULL; tcd = tcd->next) - if (foundInScope(tcd->cd->iff->fqcname, td->fqname) && - sameTemplateSignature(&tcd->sig, &td->types, FALSE)) - { - instantiateClassTemplate(pt, mod, scope, fqname, tcd, td); - - /* All done. */ - return; - } - } - - /* - * Check it doesn't already exist and find the position in the sorted list - * where it should be put. - */ - for (tdp = &pt->typedefs; *tdp != NULL; tdp = &(*tdp)->next) - { - int res = compareScopedNames((*tdp)->fqname, fqname); - - if (res == 0) - { - fatalScopedName(fqname); - fatal(" already defined\n"); - } - - if (res > 0) - break; - } - - td = sipMalloc(sizeof (typedefDef)); - - td->tdflags = 0; - td->fqname = fqname; - td->ecd = scope; - td->module = mod; - td->type = *type; - - td->next = *tdp; - *tdp = td; - - if (findOptFlag(optflgs, "NoTypeName", bool_flag) != NULL) - setNoTypeName(td); - - mod->nrtypedefs++; -} - - -/* - * Speculatively try and resolve any typedefs. In some cases (eg. when - * comparing template signatures) it helps to use the real type if it is known. - * Note that this wouldn't be necessary if we required that all types be known - * before they are used. - */ -static void resolveAnyTypedef(sipSpec *pt, argDef *ad) -{ - argDef orig = *ad; - - while (ad->atype == defined_type) - { - ad->atype = no_type; - searchTypedefs(pt, ad->u.snd, ad); - - /* - * Don't resolve to a template type as it may be superceded later on - * by a more specific mapped type. - */ - if (ad->atype == no_type || ad->atype == template_type) - { - *ad = orig; - break; - } - } -} - - -/* - * Return TRUE if the template signatures are the same. A deep comparison is - * used for mapped type templates where we want to recurse into any nested - * templates. - */ -int sameTemplateSignature(signatureDef *tmpl_sd, signatureDef *args_sd, - int deep) -{ - int a; - - if (tmpl_sd->nrArgs != args_sd->nrArgs) - return FALSE; - - for (a = 0; a < tmpl_sd->nrArgs; ++a) - { - argDef *tmpl_ad = &tmpl_sd->args[a]; - argDef *args_ad = &args_sd->args[a]; - - /* - * If we are doing a shallow comparision (ie. for class templates) then - * a type name in the template signature matches anything in the - * argument signature. - */ - if (tmpl_ad->atype == defined_type && !deep) - continue; - - /* - * For type names only compare the references and pointers, and do the - * same for any nested templates. - */ - if (tmpl_ad->atype == defined_type && args_ad->atype == defined_type) - { - if (isReference(tmpl_ad) != isReference(args_ad) || tmpl_ad->nrderefs != args_ad->nrderefs) - return FALSE; - } - else if (tmpl_ad->atype == template_type && args_ad->atype == template_type) - { - if (!sameTemplateSignature(&tmpl_ad->u.td->types, &args_ad->u.td->types, deep)) - return FALSE; - } - else if (!sameBaseType(tmpl_ad, args_ad)) - return FALSE; - } - - return TRUE; -} - - -/* - * Create a new variable. - */ -static void newVar(sipSpec *pt,moduleDef *mod,char *name,int isstatic, - argDef *type,optFlags *of,codeBlock *acode,codeBlock *gcode, - codeBlock *scode) -{ - varDef *var; - classDef *escope = currentScope(); - nameDef *nd = cacheName(pt,getPythonName(of,name)); - - if (inMainModule()) - setIsUsedName(nd); - - checkAttributes(pt, mod, escope, NULL, nd->text, FALSE); - - var = sipMalloc(sizeof (varDef)); - - var->pyname = nd; - var->fqcname = text2scopedName((escope != NULL ? escope->iff : NULL), - name); - var->ecd = escope; - var->module = mod; - var->varflags = 0; - var->type = *type; - var->accessfunc = acode; - var->getcode = gcode; - var->setcode = scode; - - if (isstatic || (escope != NULL && escope->iff->type == namespace_iface)) - setIsStaticVar(var); - - addVariable(pt, var); -} - - -/* - * Create a new ctor. - */ -static void newCtor(char *name, int sectFlags, signatureDef *args, - optFlags *optflgs, codeBlock *methodcode, throwArgs *exceptions, - signatureDef *cppsig, int explicit, codeBlock *docstring) -{ - ctorDef *ct, **ctp; - classDef *cd = currentScope(); - - /* Check the name of the constructor. */ - if (strcmp(classBaseName(cd), name) != 0) - yyerror("Constructor doesn't have the same name as its class"); - - if (docstring != NULL) - appendCodeBlock(&cd->docstring, docstring); - - /* Add to the list of constructors. */ - ct = sipMalloc(sizeof (ctorDef)); - - if (sectFlags & SECT_IS_PROT && makeProtPublic) - { - sectFlags &= ~SECT_IS_PROT; - sectFlags |= SECT_IS_PUBLIC; - } - - /* Allow the signature to be used like an function signature. */ - memset(&args->result, 0, sizeof (argDef)); - args->result.atype = void_type; - - ct->ctorflags = sectFlags; - ct->api_range = getAPIRange(optflgs); - ct->pysig = *args; - ct->cppsig = (cppsig != NULL ? cppsig : &ct->pysig); - ct->exceptions = exceptions; - ct->methodcode = methodcode; - - if (!isPrivateCtor(ct)) - setCanCreate(cd); - - if (isProtectedCtor(ct)) - setHasShadow(cd); - - if (explicit) - setIsExplicitCtor(ct); - - getHooks(optflgs, &ct->prehook, &ct->posthook); - - if (getReleaseGIL(optflgs)) - setIsReleaseGILCtor(ct); - else if (getHoldGIL(optflgs)) - setIsHoldGILCtor(ct); - - if (getTransfer(optflgs)) - setIsResultTransferredCtor(ct); - - if (getDeprecated(optflgs)) - setIsDeprecatedCtor(ct); - - if (!isPrivateCtor(ct) && usesKeywordArgs(optflgs, &ct->pysig)) - setUseKeywordArgsCtor(ct); - - if (findOptFlag(optflgs, "NoDerived", bool_flag) != NULL) - { - if (cppsig != NULL) - yyerror("The /NoDerived/ annotation cannot be used with a C++ signature"); - - if (methodcode == NULL) - yyerror("The /NoDerived/ annotation must be used with %MethodCode"); - - ct->cppsig = NULL; - } - - if (findOptFlag(optflgs, "Default", bool_flag) != NULL) - { - if (cd->defctor != NULL) - yyerror("A constructor with the /Default/ annotation has already been defined"); - - cd->defctor = ct; - } - - /* Append to the list. */ - for (ctp = &cd->ctors; *ctp != NULL; ctp = &(*ctp)->next) - ; - - *ctp = ct; -} - - -/* - * Create a new function. - */ -static void newFunction(sipSpec *pt, moduleDef *mod, classDef *c_scope, - mappedTypeDef *mt_scope, int sflags, int isstatic, int issignal, - int isslot, int isvirt, char *name, signatureDef *sig, int isconst, - int isabstract, optFlags *optflgs, codeBlock *methodcode, - codeBlock *vcode, throwArgs *exceptions, signatureDef *cppsig, - codeBlock *docstring) -{ - int factory, xferback, no_arg_parser; - overDef *od, **odp, **headp; - optFlag *of; - virtHandlerDef *vhd; - - /* Extra checks for a C module. */ - if (pt->genc) - { - if (c_scope != NULL) - yyerror("Function declaration not allowed in a struct in a C module"); - - if (isstatic) - yyerror("Static functions not allowed in a C module"); - - if (exceptions != NULL) - yyerror("Exceptions not allowed in a C module"); - } - - if (mt_scope != NULL) - headp = &mt_scope->overs; - else if (c_scope != NULL) - headp = &c_scope->overs; - else - headp = &mod->overs; - - /* See if it is a factory method. */ - if (findOptFlag(optflgs, "Factory", bool_flag) != NULL) - factory = TRUE; - else - { - int a; - - factory = FALSE; - - /* Check /TransferThis/ wasn't specified. */ - if (c_scope == NULL || isstatic) - for (a = 0; a < sig->nrArgs; ++a) - if (isThisTransferred(&sig->args[a])) - yyerror("/TransferThis/ may only be specified in constructors and class methods"); - } - - /* See if the result is to be returned to Python ownership. */ - xferback = (findOptFlag(optflgs, "TransferBack", bool_flag) != NULL); - - if (factory && xferback) - yyerror("/TransferBack/ and /Factory/ cannot both be specified"); - - /* Create a new overload definition. */ - - od = sipMalloc(sizeof (overDef)); - - /* Set the overload flags. */ - - if ((sflags & SECT_IS_PROT) && makeProtPublic) - { - sflags &= ~SECT_IS_PROT; - sflags |= SECT_IS_PUBLIC | OVER_REALLY_PROT; - } - - od->overflags = sflags; - - if (issignal) - { - resetIsSlot(od); - setIsSignal(od); - } - else if (isslot) - { - resetIsSignal(od); - setIsSlot(od); - } - - if (factory) - setIsFactory(od); - - if (xferback) - setIsResultTransferredBack(od); - - if (getTransfer(optflgs)) - setIsResultTransferred(od); - - if (findOptFlag(optflgs, "TransferThis", bool_flag) != NULL) - setIsThisTransferredMeth(od); - - if (isProtected(od)) - setHasShadow(c_scope); - - if ((isSlot(od) || isSignal(od)) && !isPrivate(od)) - { - if (isSignal(od)) - setHasShadow(c_scope); - - pt->sigslots = TRUE; - } - - if (isSignal(od) && (methodcode != NULL || vcode != NULL)) - yyerror("Cannot provide code for signals"); - - if (isstatic) - { - if (isSignal(od)) - yyerror("Static functions cannot be signals"); - - if (isvirt) - yyerror("Static functions cannot be virtual"); - - setIsStatic(od); - } - - if (isconst) - setIsConst(od); - - if (isabstract) - { - if (sflags == 0) - yyerror("Non-class function specified as abstract"); - - setIsAbstract(od); - } - - if ((of = findOptFlag(optflgs, "AutoGen", opt_name_flag)) != NULL) - { - if (of->fvalue.sval == NULL || isEnabledFeature(of->fvalue.sval)) - setIsAutoGen(od); - } - - if (isvirt) - { - if (isSignal(od) && pluginPyTQt3(pt)) - yyerror("Virtual signals aren't supported"); - - setIsVirtual(od); - setHasShadow(c_scope); - - vhd = sipMalloc(sizeof (virtHandlerDef)); - - vhd->virthandlernr = -1; - vhd->vhflags = 0; - vhd->pysig = &od->pysig; - vhd->cppsig = (cppsig != NULL ? cppsig : &od->pysig); - vhd->virtcode = vcode; - - if (factory || xferback) - setIsTransferVH(vhd); - - /* - * Only add it to the module's virtual handlers if we are not in a - * class template. - */ - if (!currentIsTemplate) - { - vhd->module = mod; - - vhd->next = mod->virthandlers; - mod->virthandlers = vhd; - } - } - else - { - if (vcode != NULL) - yyerror("%VirtualCatcherCode provided for non-virtual function"); - - vhd = NULL; - } - - od->cppname = name; - od->pysig = *sig; - od->cppsig = (cppsig != NULL ? cppsig : &od->pysig); - od->exceptions = exceptions; - od->methodcode = methodcode; - od->virthandler = vhd; - - no_arg_parser = (findOptFlag(optflgs, "NoArgParser", bool_flag) != NULL); - - if (no_arg_parser) - { - if (methodcode == NULL) - yyerror("%MethodCode must be supplied if /NoArgParser/ is specified"); - } - - if (findOptFlag(optflgs, "NoCopy", bool_flag) != NULL) - setNoCopy(&od->pysig.result); - - od->common = findFunction(pt, mod, c_scope, mt_scope, - getPythonName(optflgs, name), (methodcode != NULL), sig->nrArgs, - no_arg_parser); - - if (docstring != NULL) - appendCodeBlock(&od->common->docstring, docstring); - - od->api_range = getAPIRange(optflgs); - - if (od->api_range == NULL) - setNotVersioned(od->common); - - if (findOptFlag(optflgs, "Numeric", bool_flag) != NULL) - setIsNumeric(od->common); - - /* Methods that run in new threads must be virtual. */ - if (findOptFlag(optflgs, "NewThread", bool_flag) != NULL) - { - argDef *res; - - if (!isvirt) - yyerror("/NewThread/ may only be specified for virtual functions"); - - /* - * This is an arbitary limitation to make the code generator slightly - * easier - laziness on my part. - */ - res = &od->cppsig->result; - - if (res->atype != void_type || res->nrderefs != 0) - yyerror("/NewThread/ may only be specified for void functions"); - - setIsNewThread(od); - } - - getHooks(optflgs, &od->prehook, &od->posthook); - - if (getReleaseGIL(optflgs)) - setIsReleaseGIL(od); - else if (getHoldGIL(optflgs)) - setIsHoldGIL(od); - - if (getDeprecated(optflgs)) - setIsDeprecated(od); - - if (!isPrivate(od) && !isSignal(od) && od->common->slot == no_slot && usesKeywordArgs(optflgs, &od->pysig)) - { - setUseKeywordArgs(od); - setUseKeywordArgsFunction(od->common); - } - - /* See if we want to auto-generate a __len__() method. */ - if (findOptFlag(optflgs, "__len__", bool_flag) != NULL) - { - overDef *len; - - len = sipMalloc(sizeof (overDef)); - - len->cppname = "__len__"; - len->overflags = SECT_IS_PUBLIC; - len->pysig.result.atype = ssize_type; - len->pysig.nrArgs = 0; - len->cppsig = &len->pysig; - - len->common = findFunction(pt, mod, c_scope, mt_scope, len->cppname, - TRUE, 0, FALSE); - - if ((len->methodcode = od->methodcode) == NULL) - { - char *buf = sipStrdup(" sipRes = (SIP_SSIZE_T)sipCpp->"); - codeBlock *code; - - append(&buf, od->cppname); - append(&buf, "();\n"); - - code = sipMalloc(sizeof (codeBlock)); - - code->frag = buf; - code->filename = "Auto-generated"; - code->linenr = 0; - code->next = NULL; - - len->methodcode = code; - } - - len->next = NULL; - - od->next = len; - } - else - { - od->next = NULL; - } - - /* Append to the list. */ - for (odp = headp; *odp != NULL; odp = &(*odp)->next) - ; - - *odp = od; -} - - -/* - * Return the Python name based on the C/C++ name and any /PyName/ annotation. - */ -static const char *getPythonName(optFlags *optflgs, const char *cname) -{ - const char *pname; - optFlag *of; - - if ((of = findOptFlag(optflgs, "PyName", name_flag)) != NULL) - pname = of->fvalue.sval; - else - pname = cname; - - return pname; -} - - -/* - * Cache a name in a module. Entries in the cache are stored in order of - * decreasing length. - */ -nameDef *cacheName(sipSpec *pt, const char *name) -{ - nameDef *nd, **ndp; - size_t len; - - /* Allow callers to be lazy about checking if there is really a name. */ - if (name == NULL) - return NULL; - - /* Skip entries that are too large. */ - ndp = &pt->namecache; - len = strlen(name); - - while (*ndp != NULL && (*ndp)->len > len) - ndp = &(*ndp)->next; - - /* Check entries that are the right length. */ - for (nd = *ndp; nd != NULL && nd->len == len; nd = nd->next) - if (memcmp(nd->text, name, len) == 0) - return nd; - - /* Create a new one. */ - nd = sipMalloc(sizeof (nameDef)); - - nd->nameflags = 0; - nd->text = name; - nd->len = len; - nd->next = *ndp; - - *ndp = nd; - - return nd; -} - - -/* - * Find (or create) an overloaded function name. - */ -static memberDef *findFunction(sipSpec *pt, moduleDef *mod, classDef *c_scope, - mappedTypeDef *mt_scope, const char *pname, int hwcode, int nrargs, - int no_arg_parser) -{ - static struct slot_map { - const char *name; /* The slot name. */ - slotType type; /* The corresponding type. */ - int needs_hwcode; /* Set if handwritten code is required. */ - int nrargs; /* Nr. of arguments. */ - } slot_table[] = { - {"__str__", str_slot, TRUE, 0}, - {"__unicode__", unicode_slot, TRUE, 0}, - {"__int__", int_slot, FALSE, 0}, - {"__long__", long_slot, FALSE, 0}, - {"__float__", float_slot, FALSE, 0}, - {"__len__", len_slot, TRUE, 0}, - {"__contains__", contains_slot, TRUE, 1}, - {"__add__", add_slot, FALSE, 1}, - {"__sub__", sub_slot, FALSE, 1}, - {"__mul__", mul_slot, FALSE, 1}, - {"__div__", div_slot, FALSE, 1}, - {"__mod__", mod_slot, FALSE, 1}, - {"__floordiv__", floordiv_slot, TRUE, 1}, - {"__truediv__", truediv_slot, FALSE, 1}, - {"__and__", and_slot, FALSE, 1}, - {"__or__", or_slot, FALSE, 1}, - {"__xor__", xor_slot, FALSE, 1}, - {"__lshift__", lshift_slot, FALSE, 1}, - {"__rshift__", rshift_slot, FALSE, 1}, - {"__iadd__", iadd_slot, FALSE, 1}, - {"__isub__", isub_slot, FALSE, 1}, - {"__imul__", imul_slot, FALSE, 1}, - {"__idiv__", idiv_slot, FALSE, 1}, - {"__imod__", imod_slot, FALSE, 1}, - {"__ifloordiv__", ifloordiv_slot, TRUE, 1}, - {"__itruediv__", itruediv_slot, FALSE, 1}, - {"__iand__", iand_slot, FALSE, 1}, - {"__ior__", ior_slot, FALSE, 1}, - {"__ixor__", ixor_slot, FALSE, 1}, - {"__ilshift__", ilshift_slot, FALSE, 1}, - {"__irshift__", irshift_slot, FALSE, 1}, - {"__invert__", invert_slot, FALSE, 0}, - {"__call__", call_slot, FALSE, -1}, - {"__getitem__", getitem_slot, FALSE, 1}, - {"__setitem__", setitem_slot, TRUE, 2}, - {"__delitem__", delitem_slot, TRUE, 1}, - {"__lt__", lt_slot, FALSE, 1}, - {"__le__", le_slot, FALSE, 1}, - {"__eq__", eq_slot, FALSE, 1}, - {"__ne__", ne_slot, FALSE, 1}, - {"__gt__", gt_slot, FALSE, 1}, - {"__ge__", ge_slot, FALSE, 1}, - {"__cmp__", cmp_slot, FALSE, 1}, - {"__bool__", bool_slot, TRUE, 0}, - {"__nonzero__", bool_slot, TRUE, 0}, - {"__neg__", neg_slot, FALSE, 0}, - {"__pos__", pos_slot, FALSE, 0}, - {"__abs__", abs_slot, TRUE, 0}, - {"__repr__", repr_slot, TRUE, 0}, - {"__hash__", hash_slot, TRUE, 0}, - {"__index__", index_slot, TRUE, 0}, - {"__iter__", iter_slot, TRUE, 0}, - {"__next__", next_slot, TRUE, 0}, - {NULL} - }; - - memberDef *md, **flist; - struct slot_map *sm; - slotType st; - - /* Get the slot type. */ - st = no_slot; - - for (sm = slot_table; sm->name != NULL; ++sm) - if (strcmp(sm->name, pname) == 0) - { - if (sm->needs_hwcode && !hwcode) - yyerror("This Python slot requires %MethodCode"); - - if (sm->nrargs >= 0) - { - if (mt_scope == NULL && c_scope == NULL) - { - /* Global operators need one extra argument. */ - if (sm -> nrargs + 1 != nrargs) - yyerror("Incorrect number of arguments to global operator"); - } - else if (sm->nrargs != nrargs) - yyerror("Incorrect number of arguments to Python slot"); - } - - st = sm->type; - - break; - } - - /* Check there is no name clash. */ - checkAttributes(pt, mod, c_scope, mt_scope, pname, TRUE); - - /* See if it already exists. */ - if (mt_scope != NULL) - flist = &mt_scope->members; - else if (c_scope != NULL) - flist = &c_scope->members; - else - flist = &mod->othfuncs; - - for (md = *flist; md != NULL; md = md->next) - if (strcmp(md->pyname->text, pname) == 0 && md->module == mod) - break; - - if (md == NULL) - { - /* Create a new one. */ - md = sipMalloc(sizeof (memberDef)); - - md->pyname = cacheName(pt, pname); - md->memberflags = 0; - md->slot = st; - md->module = mod; - md->next = *flist; - - *flist = md; - - if (inMainModule()) - setIsUsedName(md->pyname); - - if (no_arg_parser) - setNoArgParser(md); - } - else if (noArgParser(md)) - yyerror("Another overload has already been defined that is annotated as /NoArgParser/"); - - /* Global operators are a subset. */ - if (mt_scope == NULL && c_scope == NULL && st != no_slot && st != neg_slot && st != pos_slot && !isNumberSlot(md) && !isRichCompareSlot(md)) - yyerror("Global operators must be either numeric or comparison operators"); - - return md; -} - - -/* - * Search a set of flags for a particular one and check its type. - */ -static optFlag *findOptFlag(optFlags *flgs,char *name,flagType ft) -{ - int f; - - for (f = 0; f < flgs -> nrFlags; ++f) - { - optFlag *of = &flgs -> flags[f]; - - if (strcmp(of -> fname,name) == 0) - { - /* - * An optional name can look like a boolean or a name. - */ - - if (ft == opt_name_flag) - { - if (of -> ftype == bool_flag) - { - of -> ftype = opt_name_flag; - of -> fvalue.sval = NULL; - } - else if (of -> ftype == name_flag) - of -> ftype = opt_name_flag; - } - - if (ft != of -> ftype) - yyerror("Optional flag has a value of the wrong type"); - - return of; - } - } - - return NULL; -} - - -/* - * A name is going to be used as a Python attribute name within a Python scope - * (ie. a Python dictionary), so check against what we already know is going in - * the same scope in case there is a clash. - */ -static void checkAttributes(sipSpec *pt, moduleDef *mod, classDef *py_c_scope, - mappedTypeDef *py_mt_scope, const char *attr, int isfunc) -{ - enumDef *ed; - varDef *vd; - classDef *cd; - - /* Check the enums. */ - - for (ed = pt->enums; ed != NULL; ed = ed->next) - { - enumMemberDef *emd; - - if (ed->pyname == NULL) - continue; - - if (py_c_scope != NULL) - { - if (ed->ecd != py_c_scope) - continue; - } - else if (py_mt_scope != NULL) - { - if (ed->emtd != py_mt_scope) - continue; - } - else if (ed->ecd != NULL || ed->emtd != NULL) - { - continue; - } - - if (strcmp(ed->pyname->text, attr) == 0) - yyerror("There is already an enum in scope with the same Python name"); - - for (emd = ed->members; emd != NULL; emd = emd->next) - if (strcmp(emd->pyname->text, attr) == 0) - yyerror("There is already an enum member in scope with the same Python name"); - } - - /* - * Only check the members if this attribute isn't a member because we - * can handle members with the same name in the same scope. - */ - if (!isfunc) - { - memberDef *md, *membs; - overDef *overs; - - if (py_mt_scope != NULL) - { - membs = py_mt_scope->members; - overs = py_mt_scope->overs; - } - else if (py_c_scope != NULL) - { - membs = py_c_scope->members; - overs = py_c_scope->overs; - } - else - { - membs = mod->othfuncs; - overs = mod->overs; - } - - for (md = membs; md != NULL; md = md->next) - { - overDef *od; - - if (strcmp(md->pyname->text, attr) != 0) - continue; - - /* Check for a conflict with all overloads. */ - for (od = overs; od != NULL; od = od->next) - { - if (od->common != md) - continue; - - yyerror("There is already a function in scope with the same Python name"); - } - } - } - - /* If the scope was a mapped type then that's all we have to check. */ - if (py_mt_scope != NULL) - return; - - /* Check the variables. */ - for (vd = pt->vars; vd != NULL; vd = vd->next) - { - if (vd->ecd != py_c_scope) - continue; - - if (strcmp(vd->pyname->text,attr) == 0) - yyerror("There is already a variable in scope with the same Python name"); - } - - /* Check the classes. */ - for (cd = pt->classes; cd != NULL; cd = cd->next) - { - if (cd->ecd != py_c_scope || cd->pyname == NULL) - continue; - - if (strcmp(cd->pyname->text, attr) == 0 && !isExternal(cd)) - yyerror("There is already a class or namespace in scope with the same Python name"); - } - - /* Check the exceptions. */ - if (py_c_scope == NULL) - { - exceptionDef *xd; - - for (xd = pt->exceptions; xd != NULL; xd = xd->next) - if (xd->pyname != NULL && strcmp(xd->pyname, attr) == 0) - yyerror("There is already an exception with the same Python name"); - } -} - - -/* - * Append a code block to a list of them. Append is needed to give the - * specifier easy control over the order of the documentation. - */ -void appendCodeBlock(codeBlock **headp, codeBlock *new) -{ - while (*headp != NULL) - headp = &(*headp)->next; - - *headp = new; -} - - -/* - * Handle the end of a fully parsed a file. - */ -static void handleEOF() -{ - /* - * Check that the number of nested if's is the same as when we started - * the file. - */ - - if (skipStackPtr > currentContext.ifdepth) - fatal("Too many %%If statements in %s\n", previousFile); - - if (skipStackPtr < currentContext.ifdepth) - fatal("Too many %%End statements in %s\n", previousFile); -} - - -/* - * Handle the end of a fully parsed a module. - */ -static void handleEOM() -{ - moduleDef *from; - - /* Check it has been named. */ - if (currentModule->name == NULL) - fatal("No %%Module has been specified for module defined in %s\n", - previousFile); - - from = currentContext.prevmod; - - if (from != NULL && from->encoding == no_type) - from->encoding = currentModule->encoding; - - /* The previous module is now current. */ - currentModule = from; -} - - -/* - * Find an existing qualifier. - */ -static qualDef *findQualifier(const char *name) -{ - moduleDef *mod; - - for (mod = currentSpec->modules; mod != NULL; mod = mod->next) - { - qualDef *qd; - - for (qd = mod->qualifiers; qd != NULL; qd = qd->next) - if (strcmp(qd->name, name) == 0) - return qd; - } - - return NULL; -} - - -/* - * Find an existing API. - */ -apiVersionRangeDef *findAPI(sipSpec *pt, const char *name) -{ - moduleDef *mod; - - for (mod = pt->modules; mod != NULL; mod = mod->next) - { - apiVersionRangeDef *avd; - - for (avd = mod->api_versions; avd != NULL; avd = avd->next) - if (strcmp(avd->api_name->text, name) == 0) - return avd; - } - - return NULL; -} - - -/* - * Return a copy of a scoped name. - */ -scopedNameDef *copyScopedName(scopedNameDef *snd) -{ - scopedNameDef *head; - - head = NULL; - - while (snd != NULL) - { - appendScopedName(&head,text2scopePart(snd -> name)); - snd = snd -> next; - } - - return head; -} - - -/* - * Append a name to a list of scopes. - */ -void appendScopedName(scopedNameDef **headp,scopedNameDef *newsnd) -{ - while (*headp != NULL) - headp = &(*headp) -> next; - - *headp = newsnd; -} - - -/* - * Free a scoped name - but not the text itself. - */ -void freeScopedName(scopedNameDef *snd) -{ - while (snd != NULL) - { - scopedNameDef *next = snd -> next; - - free(snd); - - snd = next; - } -} - - -/* - * Convert a text string to a scope part structure. - */ -static scopedNameDef *text2scopePart(char *text) -{ - scopedNameDef *snd; - - snd = sipMalloc(sizeof (scopedNameDef)); - - snd->name = text; - snd->next = NULL; - - return snd; -} - - -/* - * Convert a text string to a fully scoped name. - */ -static scopedNameDef *text2scopedName(ifaceFileDef *scope, char *text) -{ - return scopeScopedName(scope, text2scopePart(text)); -} - - -/* - * Prepend any current scope to a scoped name. - */ -static scopedNameDef *scopeScopedName(ifaceFileDef *scope, scopedNameDef *name) -{ - scopedNameDef *snd; - - snd = (scope != NULL ? copyScopedName(scope->fqcname) : NULL); - - appendScopedName(&snd, name); - - return snd; -} - - -/* - * Return a pointer to the tail part of a scoped name. - */ -char *scopedNameTail(scopedNameDef *snd) -{ - if (snd == NULL) - return NULL; - - while (snd -> next != NULL) - snd = snd -> next; - - return snd -> name; -} - - -/* - * Push the given scope onto the scope stack. - */ -static void pushScope(classDef *scope) -{ - if (currentScopeIdx >= MAX_NESTED_SCOPE) - fatal("Internal error: increase the value of MAX_NESTED_SCOPE\n"); - - scopeStack[currentScopeIdx] = scope; - sectFlagsStack[currentScopeIdx] = sectionFlags; - - ++currentScopeIdx; -} - - -/* - * Pop the scope stack. - */ -static void popScope(void) -{ - if (currentScopeIdx > 0) - sectionFlags = sectFlagsStack[--currentScopeIdx]; -} - - -/* - * Return non-zero if the current input should be parsed rather than be - * skipped. - */ -static int notSkipping() -{ - return (skipStackPtr == 0 ? TRUE : skipStack[skipStackPtr - 1]); -} - - -/* - * Return the value of an expression involving a time period. - */ -static int timePeriod(char *lname,char *uname) -{ - int this, line; - qualDef *qd, *lower, *upper; - moduleDef *mod; - - if (lname == NULL) - lower = NULL; - else if ((lower = findQualifier(lname)) == NULL || lower -> qtype != time_qualifier) - yyerror("Lower bound is not a time version"); - - if (uname == NULL) - upper = NULL; - else if ((upper = findQualifier(uname)) == NULL || upper -> qtype != time_qualifier) - yyerror("Upper bound is not a time version"); - - /* Sanity checks on the bounds. */ - - if (lower == NULL && upper == NULL) - yyerror("Lower and upper bounds cannot both be omitted"); - - if (lower != NULL && upper != NULL) - { - if (lower -> module != upper -> module || lower -> line != upper -> line) - yyerror("Lower and upper bounds are from different timelines"); - - if (lower == upper) - yyerror("Lower and upper bounds must be different"); - - if (lower -> order > upper -> order) - yyerror("Later version specified as lower bound"); - } - - /* Go through each slot in the relevant timeline. */ - - if (lower != NULL) - { - mod = lower -> module; - line = lower -> line; - } - else - { - mod = upper -> module; - line = upper -> line; - } - - this = FALSE; - - for (qd = mod -> qualifiers; qd != NULL; qd = qd -> next) - { - if (qd -> qtype != time_qualifier || qd -> line != line) - continue; - - if (lower != NULL && qd -> order < lower -> order) - continue; - - if (upper != NULL && qd -> order >= upper -> order) - continue; - - /* - * This is within the required range so if it is also needed - * then the expression is true. - */ - - if (isNeeded(qd)) - { - this = TRUE; - break; - } - } - - return this; -} - - -/* - * Return the value of an expression involving a single platform or feature. - */ -static int platOrFeature(char *name,int optnot) -{ - int this; - qualDef *qd; - - if ((qd = findQualifier(name)) == NULL || qd -> qtype == time_qualifier) - yyerror("No such platform or feature"); - - /* Assume this sub-expression is false. */ - - this = FALSE; - - if (qd -> qtype == feature_qualifier) - { - if (!excludedFeature(excludedQualifiers,qd)) - this = TRUE; - } - else if (isNeeded(qd)) - this = TRUE; - - if (optnot) - this = !this; - - return this; -} - - -/* - * Return TRUE if the given qualifier is excluded. - */ -int excludedFeature(stringList *xsl,qualDef *qd) -{ - while (xsl != NULL) - { - if (strcmp(qd -> name,xsl -> s) == 0) - return TRUE; - - xsl = xsl -> next; - } - - return FALSE; -} - - -/* - * Return TRUE if the given qualifier is needed. - */ -static int isNeeded(qualDef *qd) -{ - stringList *sl; - - for (sl = neededQualifiers; sl != NULL; sl = sl -> next) - if (strcmp(qd -> name,sl -> s) == 0) - return TRUE; - - return FALSE; -} - - -/* - * Return the current scope. currentScope() is only valid if notSkipping() - * returns non-zero. - */ -static classDef *currentScope(void) -{ - return (currentScopeIdx > 0 ? scopeStack[currentScopeIdx - 1] : NULL); -} - - -/* - * Create a new qualifier. - */ -static void newQualifier(moduleDef *mod, int line, int order, char *name, - qualType qt) -{ - qualDef *qd; - - /* Check it doesn't already exist. */ - - if (findQualifier(name) != NULL) - yyerror("Version is already defined"); - - qd = sipMalloc(sizeof (qualDef)); - qd->name = name; - qd->qtype = qt; - qd->module = mod; - qd->line = line; - qd->order = order; - qd->next = mod -> qualifiers; - mod->qualifiers = qd; -} - - -/* - * Create a new imported module. - */ -static void newImport(char *filename) -{ - moduleDef *from, *mod; - moduleListDef *mld; - - /* Create a new module if it has not already been defined. */ - for (mod = currentSpec->modules; mod != NULL; mod = mod->next) - if (strcmp(mod->file, filename) == 0) - break; - - from = currentModule; - - if (mod == NULL) - { - newModule(NULL, filename); - mod = currentModule; - } - else if (from->encoding == no_type) - { - /* Import any defaults from the already parsed module. */ - from->encoding = mod->encoding; - } - - /* Add the new import unless it has already been imported. */ - for (mld = from->imports; mld != NULL; mld = mld->next) - if (mld->module == mod) - return; - - mld = sipMalloc(sizeof (moduleListDef)); - mld->module = mod; - mld->next = from->imports; - - from->imports = mld; -} - - -/* - * Set up pointers to hook names. - */ -static void getHooks(optFlags *optflgs,char **pre,char **post) -{ - optFlag *of; - - if ((of = findOptFlag(optflgs,"PreHook",name_flag)) != NULL) - *pre = of -> fvalue.sval; - else - *pre = NULL; - - if ((of = findOptFlag(optflgs,"PostHook",name_flag)) != NULL) - *post = of -> fvalue.sval; - else - *post = NULL; -} - - -/* - * Get the /Transfer/ option flag. - */ -static int getTransfer(optFlags *optflgs) -{ - return (findOptFlag(optflgs, "Transfer", bool_flag) != NULL); -} - - -/* - * Get the /ReleaseGIL/ option flag. - */ -static int getReleaseGIL(optFlags *optflgs) -{ - return (findOptFlag(optflgs, "ReleaseGIL", bool_flag) != NULL); -} - - -/* - * Get the /HoldGIL/ option flag. - */ -static int getHoldGIL(optFlags *optflgs) -{ - return (findOptFlag(optflgs, "HoldGIL", bool_flag) != NULL); -} - - -/* - * Get the /Deprecated/ option flag. - */ -static int getDeprecated(optFlags *optflgs) -{ - return (findOptFlag(optflgs, "Deprecated", bool_flag) != NULL); -} - - -/* - * Get the /AllowNone/ option flag. - */ -static int getAllowNone(optFlags *optflgs) -{ - return (findOptFlag(optflgs, "AllowNone", bool_flag) != NULL); -} - - -/* - * Get the /DocType/ option flag. - */ -static const char *getDocType(optFlags *optflgs) -{ - optFlag *of = findOptFlag(optflgs, "DocType", string_flag); - - if (of == NULL) - return NULL; - - return of->fvalue.sval; -} - - -/* - * Get the /DocValue/ option flag. - */ -static const char *getDocValue(optFlags *optflgs) -{ - optFlag *of = findOptFlag(optflgs, "DocValue", string_flag); - - if (of == NULL) - return NULL; - - return of->fvalue.sval; -} - - -/* - * Return TRUE if the PyQt3 plugin was specified. - */ -int pluginPyTQt3(sipSpec *pt) -{ - return stringFind(pt->plugins, "PyQt3"); -} - - -/* - * Return TRUE if the PyQt4 plugin was specified. - */ -int pluginPyTQt4(sipSpec *pt) -{ - return stringFind(pt->plugins, "PyQt4"); -} - - -/* - * Return TRUE if a list of strings contains a given entry. - */ -static int stringFind(stringList *sl, const char *s) -{ - while (sl != NULL) - { - if (strcmp(sl->s, s) == 0) - return TRUE; - - sl = sl->next; - } - - return FALSE; -} - - -/* - * Set the name of a module. - */ -static void setModuleName(sipSpec *pt, moduleDef *mod, const char *fullname) -{ - mod->fullname = cacheName(pt, fullname); - - if (inMainModule()) - setIsUsedName(mod->fullname); - - if ((mod->name = strrchr(fullname, '.')) != NULL) - mod->name++; - else - mod->name = fullname; -} - - -/* - * Define a new class and set its name. - */ -static void defineClass(scopedNameDef *snd, classList *supers, optFlags *of) -{ - classDef *cd, *c_scope = currentScope(); - - cd = newClass(currentSpec, class_iface, getAPIRange(of), - scopeScopedName((c_scope != NULL ? c_scope->iff : NULL), snd)); - cd->supers = supers; - - pushScope(cd); -} - - -/* - * Complete the definition of a class. - */ -static classDef *completeClass(scopedNameDef *snd, optFlags *of, int has_def) -{ - classDef *cd = currentScope(); - - /* See if the class was defined or just declared. */ - if (has_def) - { - if (snd->next != NULL) - yyerror("A scoped name cannot be given in a class/struct definition"); - - } - else if (cd->supers != NULL) - yyerror("Class/struct has super-classes but no definition"); - else - setIsOpaque(cd); - - finishClass(currentSpec, currentModule, cd, of); - popScope(); - - /* - * Check that external classes have only been declared at the global scope. - */ - if (isExternal(cd) && currentScope() != NULL) - yyerror("External classes/structs can only be declared in the global scope"); - - return cd; -} - - -/* - * Add a variable to the list so that the list remains sorted. - */ -static void addVariable(sipSpec *pt, varDef *vd) -{ - varDef **at = &pt->vars; - - while (*at != NULL) - { - if (strcmp(vd->pyname->text, (*at)->pyname->text) < 0) - break; - - at = &(*at)->next; - } - - vd->next = *at; - *at = vd; -} - - -/* - * Update a type according to optional flags. - */ -static void applyTypeFlags(moduleDef *mod, argDef *ad, optFlags *flags) -{ - ad->doctype = getDocType(flags); - - if (ad->atype == string_type && !isArray(ad) && !isReference(ad)) - { - optFlag *of; - - if ((of = findOptFlag(flags, "Encoding", string_flag)) == NULL) - { - if (mod->encoding != no_type) - ad->atype = mod->encoding; - else - ad->atype = string_type; - } - else if ((ad->atype = convertEncoding(of->fvalue.sval)) == no_type) - yyerror("The value of the /Encoding/ annotation must be one of \"ASCII\", \"Latin-1\", \"UTF-8\" or \"None\""); - } -} - - -/* - * Return the argument type for a string with the given encoding or no_type if - * the encoding was invalid. - */ -static argType convertEncoding(const char *encoding) -{ - if (strcmp(encoding, "ASCII") == 0) - return ascii_string_type; - - if (strcmp(encoding, "Latin-1") == 0) - return latin1_string_type; - - if (strcmp(encoding, "UTF-8") == 0) - return utf8_string_type; - - if (strcmp(encoding, "None") == 0) - return string_type; - - return no_type; -} - - -/* - * Get the /API/ option flag. - */ -static apiVersionRangeDef *getAPIRange(optFlags *optflgs) -{ - optFlag *of; - - if ((of = findOptFlag(optflgs, "API", api_range_flag)) == NULL) - return NULL; - - return of->fvalue.aval; -} - - -/* - * Return the API range structure and version number corresponding to the - * given API range. - */ -static apiVersionRangeDef *convertAPIRange(moduleDef *mod, nameDef *name, - int from, int to) -{ - int index; - apiVersionRangeDef *avd, **avdp; - - /* Handle the trivial case. */ - if (from == 0 && to == 0) - return NULL; - - for (index = 0, avdp = &mod->api_ranges; (*avdp) != NULL; avdp = &(*avdp)->next, ++index) - { - avd = *avdp; - - if (avd->api_name == name && avd->from == from && avd->to == to) - return avd; - } - - /* The new one must be appended so that version numbers remain valid. */ - avd = sipMalloc(sizeof (apiVersionRangeDef)); - - avd->api_name = name; - avd->from = from; - avd->to = to; - avd->index = index; - - avd->next = NULL; - *avdp = avd; - - return avd; -} - - -/* - * Return TRUE if a signature with annotations uses keyword arguments. - */ -static int usesKeywordArgs(optFlags *optflgs, signatureDef *sd) -{ - int kwd_args_anno, no_kwd_args_anno; - - kwd_args_anno = (findOptFlag(optflgs, "KeywordArgs", bool_flag) != NULL); - no_kwd_args_anno = (findOptFlag(optflgs, "NoKeywordArgs", bool_flag) != NULL); - - /* - * An ellipsis cannot be used with keyword arguments. Only complain if it - * has been explicitly requested. - */ - if (kwd_args_anno && sd->nrArgs > 0 && sd->args[sd->nrArgs - 1].atype == ellipsis_type) - yyerror("/KeywordArgs/ cannot be specified for calls with a variable number of arguments"); - - if ((defaultKwdArgs || kwd_args_anno) && !no_kwd_args_anno) - { - int a, is_name = FALSE; - - /* - * Mark argument names as being used and check there is at least one. - */ - for (a = 0; a < sd->nrArgs; ++a) - { - nameDef *nd = sd->args[a].name; - - if (sd->args[a].name != NULL) - { - setIsUsedName(nd); - is_name = TRUE; - } - } - - return is_name; - } - - return FALSE; -} - - -/* - * Extract the version of a string value optionally associated with a - * particular feature. - */ -static char *convertFeaturedString(char *fs) -{ - while (fs != NULL) - { - char *next, *value; - - /* Individual values are ';' separated. */ - if ((next = strchr(fs, ';')) != NULL) - *next++ = '\0'; - - /* Features and values are ':' separated. */ - if ((value = strchr(fs, ':')) == NULL) - { - /* This is an unconditional value so just return it. */ - return strip(fs); - } - - *value++ = '\0'; - - if (isEnabledFeature(strip(fs))) - return strip(value); - - fs = next; - } - - /* No value was enabled. */ - return NULL; -} - - -/* - * Return the stripped version of a string. - */ -static char *strip(char *s) -{ - while (*s == ' ') - ++s; - - if (*s != '\0') - { - char *cp = &s[strlen(s) - 1]; - - while (*cp == ' ') - *cp-- = '\0'; - } - - return s; -} - - -/* - * Return TRUE if the given feature is enabled. - */ -static int isEnabledFeature(const char *name) -{ - qualDef *qd; - - if ((qd = findQualifier(name)) == NULL || qd->qtype != feature_qualifier) - yyerror("No such feature"); - - return !excludedFeature(excludedQualifiers, qd); -} - diff --git a/sipgen/parser.h b/sipgen/parser.h deleted file mode 100644 index c8a3608..0000000 --- a/sipgen/parser.h +++ /dev/null @@ -1,309 +0,0 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton interface 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 <http://www.gnu.org/licenses/>. */ - -/* 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. */ - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TK_API = 258, - TK_DEFENCODING = 259, - TK_PLUGIN = 260, - TK_DOCSTRING = 261, - TK_DOC = 262, - TK_EXPORTEDDOC = 263, - TK_MAKEFILE = 264, - TK_ACCESSCODE = 265, - TK_GETCODE = 266, - TK_SETCODE = 267, - TK_PREINITCODE = 268, - TK_INITCODE = 269, - TK_POSTINITCODE = 270, - TK_UNITCODE = 271, - TK_MODCODE = 272, - TK_TYPECODE = 273, - TK_PREPYCODE = 274, - TK_COPYING = 275, - TK_MAPPEDTYPE = 276, - TK_CODELINE = 277, - TK_IF = 278, - TK_END = 279, - TK_NAME = 280, - TK_PATHNAME = 281, - TK_STRING = 282, - TK_VIRTUALCATCHERCODE = 283, - TK_TRAVERSECODE = 284, - TK_CLEARCODE = 285, - TK_GETBUFFERCODE = 286, - TK_RELEASEBUFFERCODE = 287, - TK_READBUFFERCODE = 288, - TK_WRITEBUFFERCODE = 289, - TK_SEGCOUNTCODE = 290, - TK_CHARBUFFERCODE = 291, - TK_PICKLECODE = 292, - TK_METHODCODE = 293, - TK_FROMTYPE = 294, - TK_TOTYPE = 295, - TK_TOSUBCLASS = 296, - TK_INCLUDE = 297, - TK_OPTINCLUDE = 298, - TK_IMPORT = 299, - TK_EXPHEADERCODE = 300, - TK_MODHEADERCODE = 301, - TK_TYPEHEADERCODE = 302, - TK_MODULE = 303, - TK_CMODULE = 304, - TK_CONSMODULE = 305, - TK_COMPOMODULE = 306, - TK_CLASS = 307, - TK_STRUCT = 308, - TK_PUBLIC = 309, - TK_PROTECTED = 310, - TK_PRIVATE = 311, - TK_SIGNALS = 312, - TK_SIGNAL_METHOD = 313, - TK_SLOTS = 314, - TK_SLOT_METHOD = 315, - TK_BOOL = 316, - TK_SHORT = 317, - TK_INT = 318, - TK_LONG = 319, - TK_FLOAT = 320, - TK_DOUBLE = 321, - TK_CHAR = 322, - TK_WCHAR_T = 323, - TK_VOID = 324, - TK_PYOBJECT = 325, - TK_PYTUPLE = 326, - TK_PYLIST = 327, - TK_PYDICT = 328, - TK_PYCALLABLE = 329, - TK_PYSLICE = 330, - TK_PYTYPE = 331, - TK_VIRTUAL = 332, - TK_ENUM = 333, - TK_SIGNED = 334, - TK_UNSIGNED = 335, - TK_SCOPE = 336, - TK_LOGICAL_OR = 337, - TK_CONST = 338, - TK_STATIC = 339, - TK_SIPSIGNAL = 340, - TK_SIPSLOT = 341, - TK_SIPANYSLOT = 342, - TK_SIPRXCON = 343, - TK_SIPRXDIS = 344, - TK_SIPSLOTCON = 345, - TK_SIPSLOTDIS = 346, - TK_NUMBER = 347, - TK_REAL = 348, - TK_TYPEDEF = 349, - TK_NAMESPACE = 350, - TK_TIMELINE = 351, - TK_PLATFORMS = 352, - TK_FEATURE = 353, - TK_LICENSE = 354, - TK_TQCHAR = 355, - TK_TRUE = 356, - TK_FALSE = 357, - TK_NULL = 358, - TK_OPERATOR = 359, - TK_THROW = 360, - TK_TQOBJECT = 361, - TK_EXCEPTION = 362, - TK_RAISECODE = 363, - TK_EXPLICIT = 364, - TK_TEMPLATE = 365, - TK_ELLIPSIS = 366, - TK_DEFMETATYPE = 367, - TK_DEFSUPERTYPE = 368 - }; -#endif -/* Tokens. */ -#define TK_API 258 -#define TK_DEFENCODING 259 -#define TK_PLUGIN 260 -#define TK_DOCSTRING 261 -#define TK_DOC 262 -#define TK_EXPORTEDDOC 263 -#define TK_MAKEFILE 264 -#define TK_ACCESSCODE 265 -#define TK_GETCODE 266 -#define TK_SETCODE 267 -#define TK_PREINITCODE 268 -#define TK_INITCODE 269 -#define TK_POSTINITCODE 270 -#define TK_UNITCODE 271 -#define TK_MODCODE 272 -#define TK_TYPECODE 273 -#define TK_PREPYCODE 274 -#define TK_COPYING 275 -#define TK_MAPPEDTYPE 276 -#define TK_CODELINE 277 -#define TK_IF 278 -#define TK_END 279 -#define TK_NAME 280 -#define TK_PATHNAME 281 -#define TK_STRING 282 -#define TK_VIRTUALCATCHERCODE 283 -#define TK_TRAVERSECODE 284 -#define TK_CLEARCODE 285 -#define TK_GETBUFFERCODE 286 -#define TK_RELEASEBUFFERCODE 287 -#define TK_READBUFFERCODE 288 -#define TK_WRITEBUFFERCODE 289 -#define TK_SEGCOUNTCODE 290 -#define TK_CHARBUFFERCODE 291 -#define TK_PICKLECODE 292 -#define TK_METHODCODE 293 -#define TK_FROMTYPE 294 -#define TK_TOTYPE 295 -#define TK_TOSUBCLASS 296 -#define TK_INCLUDE 297 -#define TK_OPTINCLUDE 298 -#define TK_IMPORT 299 -#define TK_EXPHEADERCODE 300 -#define TK_MODHEADERCODE 301 -#define TK_TYPEHEADERCODE 302 -#define TK_MODULE 303 -#define TK_CMODULE 304 -#define TK_CONSMODULE 305 -#define TK_COMPOMODULE 306 -#define TK_CLASS 307 -#define TK_STRUCT 308 -#define TK_PUBLIC 309 -#define TK_PROTECTED 310 -#define TK_PRIVATE 311 -#define TK_SIGNALS 312 -#define TK_SIGNAL_METHOD 313 -#define TK_SLOTS 314 -#define TK_SLOT_METHOD 315 -#define TK_BOOL 316 -#define TK_SHORT 317 -#define TK_INT 318 -#define TK_LONG 319 -#define TK_FLOAT 320 -#define TK_DOUBLE 321 -#define TK_CHAR 322 -#define TK_WCHAR_T 323 -#define TK_VOID 324 -#define TK_PYOBJECT 325 -#define TK_PYTUPLE 326 -#define TK_PYLIST 327 -#define TK_PYDICT 328 -#define TK_PYCALLABLE 329 -#define TK_PYSLICE 330 -#define TK_PYTYPE 331 -#define TK_VIRTUAL 332 -#define TK_ENUM 333 -#define TK_SIGNED 334 -#define TK_UNSIGNED 335 -#define TK_SCOPE 336 -#define TK_LOGICAL_OR 337 -#define TK_CONST 338 -#define TK_STATIC 339 -#define TK_SIPSIGNAL 340 -#define TK_SIPSLOT 341 -#define TK_SIPANYSLOT 342 -#define TK_SIPRXCON 343 -#define TK_SIPRXDIS 344 -#define TK_SIPSLOTCON 345 -#define TK_SIPSLOTDIS 346 -#define TK_NUMBER 347 -#define TK_REAL 348 -#define TK_TYPEDEF 349 -#define TK_NAMESPACE 350 -#define TK_TIMELINE 351 -#define TK_PLATFORMS 352 -#define TK_FEATURE 353 -#define TK_LICENSE 354 -#define TK_TQCHAR 355 -#define TK_TRUE 356 -#define TK_FALSE 357 -#define TK_NULL 358 -#define TK_OPERATOR 359 -#define TK_THROW 360 -#define TK_TQOBJECT 361 -#define TK_EXCEPTION 362 -#define TK_RAISECODE 363 -#define TK_EXPLICIT 364 -#define TK_TEMPLATE 365 -#define TK_ELLIPSIS 366 -#define TK_DEFMETATYPE 367 -#define TK_DEFSUPERTYPE 368 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 1676 of yacc.c */ -#line 147 "/home/phil/hg/sip/sip-4.10.5/sipgen/parser.y" - - char qchar; - char *text; - long number; - double real; - argDef memArg; - signatureDef signature; - signatureDef *optsignature; - throwArgs *throwlist; - codeBlock *codeb; - valueDef value; - valueDef *valp; - optFlags optflags; - optFlag flag; - scopedNameDef *scpvalp; - fcallDef fcall; - int boolean; - exceptionDef exceptionbase; - classDef *klass; - - - -/* Line 1676 of yacc.c */ -#line 301 "/home/phil/hg/sip/sip-4.10.5/sipgen/parser.h" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE yylval; - - diff --git a/siputils.py b/siputils.py index fd48d94..ca3d92e 100644 --- a/siputils.py +++ b/siputils.py @@ -971,6 +971,10 @@ class Makefile: root, discard = os.path.splitext(f) mfile.write("\t-%s tqmoc_%s.cpp\n" % (self.rm, root)) + # Cleanup generated parser files + if os.path.exists("%s/parser.y" % self._src_dir): + mfile.write("\t-%s parser.h parser.c\n" % self.rm) + def ready(self): """The Makefile is now ready to be used. """ @@ -1062,6 +1066,10 @@ class Makefile: if self._src_dir != self.dir: mfile.write("VPATH = %s\n\n" % self._src_dir) + # Add rule to generate parser + if os.path.exists("%s/parser.y" % self._src_dir): + mfile.write("parser.c parser.h: parser.y\n\t$(YACC) $(YFLAGS) -d -o $@ $<\n\n") + # These probably don't matter. if self.generator == "MINGW": mfile.write(".SUFFIXES: .cpp .cxx .cc .C .c\n\n") |