diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt index 6b184d5102..635b5d79d6 100644 --- a/ncdump/CMakeLists.txt +++ b/ncdump/CMakeLists.txt @@ -307,11 +307,18 @@ ENDIF(MSVC) add_sh_test(ncdump tst_ctests) +<<<<<<< HEAD IF(ENABLE_UNFIXED_MEMORY_LEAKS) SET_TESTS_PROPERTIES(ncdump_run_ncgen_nc4_tests.sh ncdump_tst_nccopy4.sh ncdump_tst_ncgen_shared.sh ncdump_tst_netcdf4.sh PROPERTIES ENVIRONMENT NC_VLEN_NOTEST=1) ENDIF() +======= + IF(USE_CDF5) + add_sh_test(ncdump test_keywords) + ENDIF() + +>>>>>>> 90b912b7e8675f857b618a440610ada3327f4190 ENDIF() ENDIF() diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am index ba75fcd065..ecc168a3eb 100644 --- a/ncdump/Makefile.am +++ b/ncdump/Makefile.am @@ -4,7 +4,6 @@ # Ed Hartnett, Dennis Heimbigner, Ward Fisher - #SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose #sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose #LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose @@ -130,6 +129,11 @@ if USE_HDF5 TESTS += tst_ctests.sh endif +if ENABLE_CDF5 +# Test for keywords as identifiers +TESTS += test_keywords.sh +endif + endif BUILD_TESTSETS # These files all have to be included with the distribution. @@ -169,7 +173,9 @@ ref_null_byte_padding_test.nc ref_tst_irish_rover.nc \ ref_provenance_v1.nc ref_tst_radix.cdl tst_radix.cdl test_radix.sh \ ref_nccopy_w.cdl tst_nccopy_w3.sh tst_nccopy_w4.sh \ ref_no_ncproperty.nc test_unicode_directory.sh \ -ref_roman_szip_simple.cdl ref_roman_szip_unlim.cdl ref_tst_perdimspecs.cdl +ref_roman_szip_simple.cdl ref_roman_szip_unlim.cdl ref_tst_perdimspecs.cdl \ +test_keywords.sh ref_keyword1.cdl ref_keyword2.cdl + # The L512.bin file is file containing exactly 512 bytes each of value 0. # It is used for creating hdf5 files with varying offsets for testing. @@ -205,4 +211,5 @@ tst_ncf199.cdl tst_tst_gattenum.cdl tst_tst_usuffix.cdl ctest.c \ ctest64.c nccopy3_subset_out.nc camrun.c tst_ncf213.cdl tst_ncf213.nc \ tst_radix.nc tmp_radix.cdl ctest_small_3.c ctest_small_4.c \ ctest_special_atts_4.c tst_roman_szip_simple.cdl \ -tst_roman_szip_unlim.cdl tst_perdimpspecs.nc tmppds.* +tst_roman_szip_unlim.cdl tst_perdimpspecs.nc tmppds.* \ +keyword1.nc keyword2.nc tmp_keyword1.cdl tmp_keyword2.cdl diff --git a/ncdump/nccopy.c b/ncdump/nccopy.c index 59528885c5..f315ff02cd 100644 --- a/ncdump/nccopy.c +++ b/ncdump/nccopy.c @@ -34,6 +34,7 @@ #include "ncpathmgr.h" #undef DEBUGFILTER +#undef DEBUGCHUNK /* default bytes of memory we are willing to allocate for variable * values during copy */ @@ -307,7 +308,7 @@ parsefilterspec(const char* optarg0, List* speclist) } /* Parse the variable list */ if((vlist = listnew()) == NULL) {stat = NC_ENOMEM; goto done;} - if((stat=parsevarlist(optarg,vlist))) goto done; + if((stat=parsevarlist(optarg,vlist))) goto done; if(strcasecmp(remainder,"none") != 0) { /* Collect the id+parameters */ @@ -324,7 +325,7 @@ parsefilterspec(const char* optarg0, List* speclist) filters[0] = nilspec; nilspec = NULL; } } - + /* Construct a spec entry for each element in vlist */ for(i=0;i 0) { NC_CHECK(nc_get_vara(igrp, varid, start, count, buf)); +#ifdef DEBUGCHUNK + report(iterp->rank,start,count,buf); +#endif NC_CHECK(nc_put_vara(ogrp, ovarid, start, count, buf)); #ifdef USE_NETCDF4 /* we have to explicitly free values for strings and vlens */ diff --git a/ncdump/ref_keyword1.cdl b/ncdump/ref_keyword1.cdl new file mode 100644 index 0000000000..8988aa88ff --- /dev/null +++ b/ncdump/ref_keyword1.cdl @@ -0,0 +1,8 @@ +netcdf keyword1 { +dimensions: + string = 128; + int64 = 64; +variables: + int string(string); + int int64(int64); +} diff --git a/ncdump/ref_keyword2.cdl b/ncdump/ref_keyword2.cdl new file mode 100644 index 0000000000..99462d6820 --- /dev/null +++ b/ncdump/ref_keyword2.cdl @@ -0,0 +1,6 @@ +netcdf keyword2 { +dimensions: +string = 128; +variables: +int string(string); +} diff --git a/ncdump/test_keywords.sh b/ncdump/test_keywords.sh new file mode 100755 index 0000000000..3db79c4f9f --- /dev/null +++ b/ncdump/test_keywords.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +if test "x$srcdir" = x ; then srcdir=`pwd`; fi +. ../test_common.sh + +set -e + +echo "*** Test use of keywords for formats where the keyword is not defined" +echo "*** classic: creating keyword1.nc from ref_keyword1.cdl..." +${NCGEN} -3 -lb -o keyword1.nc $srcdir/ref_keyword1.cdl +echo "*** creating tmp_keyword1.cdl from keyword1.nc..." +${NCDUMP} -h keyword1.nc > tmp_keyword1.cdl +echo "*** comparing tmp_keyword1.cdl to ref_keyword1.cdl..." +diff -b -w tmp_keyword1.cdl $srcdir/ref_keyword1.cdl + +echo "*** cdf5: creating keyword2.nc from ref_keyword2.cdl..." +${NCGEN} -5 -lb -o keyword2.nc $srcdir/ref_keyword2.cdl +echo "*** creating tmp_keyword2.cdl from keyword2.nc..." +${NCDUMP} -h keyword2.nc > tmp_keyword2.cdl +echo "*** comparing tmp_keyword2.cdl to ref_keyword2.cdl..." +diff -b -w tmp_keyword2.cdl $srcdir/ref_keyword2.cdl + +exit 0 diff --git a/ncgen/ncgen.l b/ncgen/ncgen.l index 895f60a444..7c376044ca 100644 --- a/ncgen/ncgen.l +++ b/ncgen/ncgen.l @@ -140,6 +140,35 @@ struct Specialtoken specials[] = { {NULL,0} /* null terminate */ }; +/* Track keywords that may be identifiers depending on + format being produced */ +/* Define the possible format classes */ +#define KWALL (1< R) break; + m = (L + R) / 2; + p = &kwident[m]; + cmp = (p->token - token); + if(cmp == 0) {found = 1; break;} + if(cmp < 0) + L = (m + 1); + else /*cmp > 0*/ + R = (m - 1); + } + if(!found) return token; /* Not a keyword of interest */ + /* See if the format applies */ + if(p->formats & ((int)1< typeref %type varref -%type type_var_ref +%type ambiguous_ref %type enumidlist fieldlist fields varlist dimspec dimlist field fielddimspec fielddimlist %type dataitem constdata constint conststring constbool @@ -666,7 +666,7 @@ fielddim: /* Use this when referencing defined objects */ varref: - type_var_ref + ambiguous_ref {Symbol* vsym = $1; if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); @@ -677,7 +677,7 @@ varref: ; typeref: - type_var_ref + ambiguous_ref {Symbol* tsym = $1; if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); @@ -687,7 +687,7 @@ typeref: } ; -type_var_ref: +ambiguous_ref: path {Symbol* tvsym = $1; Symbol* sym; /* disambiguate*/ @@ -725,7 +725,7 @@ attrdecl: {$$ = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)$4,ISCONST);} | ':' ident '=' datalist { $$=makeattribute($2,NULL,NULL,$4,ATTRGLOBAL);} - | typeref type_var_ref ':' ident '=' datalist + | typeref ambiguous_ref ':' ident '=' datalist {Symbol* tsym = $1; Symbol* vsym = $2; Symbol* asym = $4; if(vsym->objectclass == NC_VAR) { $$=makeattribute(asym,vsym,tsym,$6,ATTRVAR); @@ -734,7 +734,7 @@ attrdecl: YYABORT; } } - | type_var_ref ':' ident '=' datalist + | ambiguous_ref ':' ident '=' datalist {Symbol* sym = $1; Symbol* asym = $3; if(sym->objectclass == NC_VAR) { $$=makeattribute(asym,sym,NULL,$5,ATTRVAR); @@ -745,25 +745,25 @@ attrdecl: YYABORT; } } - | type_var_ref ':' _FILLVALUE '=' datalist + | ambiguous_ref ':' _FILLVALUE '=' datalist {$$ = makespecial(_FILLVALUE_FLAG,$1,NULL,(void*)$5,ISLIST);} - | typeref type_var_ref ':' _FILLVALUE '=' datalist + | typeref ambiguous_ref ':' _FILLVALUE '=' datalist {$$ = makespecial(_FILLVALUE_FLAG,$2,$1,(void*)$6,ISLIST);} - | type_var_ref ':' _STORAGE '=' conststring + | ambiguous_ref ':' _STORAGE '=' conststring {$$ = makespecial(_STORAGE_FLAG,$1,NULL,(void*)$5,ISCONST);} - | type_var_ref ':' _CHUNKSIZES '=' intlist + | ambiguous_ref ':' _CHUNKSIZES '=' intlist {$$ = makespecial(_CHUNKSIZES_FLAG,$1,NULL,(void*)$5,ISLIST);} - | type_var_ref ':' _FLETCHER32 '=' constbool + | ambiguous_ref ':' _FLETCHER32 '=' constbool {$$ = makespecial(_FLETCHER32_FLAG,$1,NULL,(void*)$5,ISCONST);} - | type_var_ref ':' _DEFLATELEVEL '=' constint + | ambiguous_ref ':' _DEFLATELEVEL '=' constint {$$ = makespecial(_DEFLATE_FLAG,$1,NULL,(void*)$5,ISCONST);} - | type_var_ref ':' _SHUFFLE '=' constbool + | ambiguous_ref ':' _SHUFFLE '=' constbool {$$ = makespecial(_SHUFFLE_FLAG,$1,NULL,(void*)$5,ISCONST);} - | type_var_ref ':' _ENDIANNESS '=' conststring + | ambiguous_ref ':' _ENDIANNESS '=' conststring {$$ = makespecial(_ENDIAN_FLAG,$1,NULL,(void*)$5,ISCONST);} - | type_var_ref ':' _FILTER '=' conststring + | ambiguous_ref ':' _FILTER '=' conststring {$$ = makespecial(_FILTER_FLAG,$1,NULL,(void*)$5,ISCONST);} - | type_var_ref ':' _NOFILL '=' constbool + | ambiguous_ref ':' _NOFILL '=' constbool {$$ = makespecial(_NOFILL_FLAG,$1,NULL,(void*)$5,ISCONST);} | ':' _FORMAT '=' conststring {$$ = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)$4,ISCONST);} diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c index 6849c4f693..178448362d 100644 --- a/ncgen/ncgenl.c +++ b/ncgen/ncgenl.c @@ -1,5 +1,5 @@ -#line 2 "ncgenl.c" +#line 3 "ncgenl.c" #define YY_INT_ALIGNED short int @@ -7,17 +7,11 @@ #define yy_create_buffer ncg_create_buffer #define yy_delete_buffer ncg_delete_buffer -#define yy_scan_buffer ncg_scan_buffer -#define yy_scan_string ncg_scan_string -#define yy_scan_bytes ncg_scan_bytes +#define yy_flex_debug ncg_flex_debug #define yy_init_buffer ncg_init_buffer #define yy_flush_buffer ncg_flush_buffer #define yy_load_buffer_state ncg_load_buffer_state #define yy_switch_to_buffer ncg_switch_to_buffer -#define yypush_buffer_state ncgpush_buffer_state -#define yypop_buffer_state ncgpop_buffer_state -#define yyensure_buffer_stack ncgensure_buffer_stack -#define yy_flex_debug ncg_flex_debug #define yyin ncgin #define yyleng ncgleng #define yylex ncglex @@ -32,246 +26,12 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif -#ifdef yy_create_buffer -#define ncg_create_buffer_ALREADY_DEFINED -#else -#define yy_create_buffer ncg_create_buffer -#endif - -#ifdef yy_delete_buffer -#define ncg_delete_buffer_ALREADY_DEFINED -#else -#define yy_delete_buffer ncg_delete_buffer -#endif - -#ifdef yy_scan_buffer -#define ncg_scan_buffer_ALREADY_DEFINED -#else -#define yy_scan_buffer ncg_scan_buffer -#endif - -#ifdef yy_scan_string -#define ncg_scan_string_ALREADY_DEFINED -#else -#define yy_scan_string ncg_scan_string -#endif - -#ifdef yy_scan_bytes -#define ncg_scan_bytes_ALREADY_DEFINED -#else -#define yy_scan_bytes ncg_scan_bytes -#endif - -#ifdef yy_init_buffer -#define ncg_init_buffer_ALREADY_DEFINED -#else -#define yy_init_buffer ncg_init_buffer -#endif - -#ifdef yy_flush_buffer -#define ncg_flush_buffer_ALREADY_DEFINED -#else -#define yy_flush_buffer ncg_flush_buffer -#endif - -#ifdef yy_load_buffer_state -#define ncg_load_buffer_state_ALREADY_DEFINED -#else -#define yy_load_buffer_state ncg_load_buffer_state -#endif - -#ifdef yy_switch_to_buffer -#define ncg_switch_to_buffer_ALREADY_DEFINED -#else -#define yy_switch_to_buffer ncg_switch_to_buffer -#endif - -#ifdef yypush_buffer_state -#define ncgpush_buffer_state_ALREADY_DEFINED -#else -#define yypush_buffer_state ncgpush_buffer_state -#endif - -#ifdef yypop_buffer_state -#define ncgpop_buffer_state_ALREADY_DEFINED -#else -#define yypop_buffer_state ncgpop_buffer_state -#endif - -#ifdef yyensure_buffer_stack -#define ncgensure_buffer_stack_ALREADY_DEFINED -#else -#define yyensure_buffer_stack ncgensure_buffer_stack -#endif - -#ifdef yylex -#define ncglex_ALREADY_DEFINED -#else -#define yylex ncglex -#endif - -#ifdef yyrestart -#define ncgrestart_ALREADY_DEFINED -#else -#define yyrestart ncgrestart -#endif - -#ifdef yylex_init -#define ncglex_init_ALREADY_DEFINED -#else -#define yylex_init ncglex_init -#endif - -#ifdef yylex_init_extra -#define ncglex_init_extra_ALREADY_DEFINED -#else -#define yylex_init_extra ncglex_init_extra -#endif - -#ifdef yylex_destroy -#define ncglex_destroy_ALREADY_DEFINED -#else -#define yylex_destroy ncglex_destroy -#endif - -#ifdef yyget_debug -#define ncgget_debug_ALREADY_DEFINED -#else -#define yyget_debug ncgget_debug -#endif - -#ifdef yyset_debug -#define ncgset_debug_ALREADY_DEFINED -#else -#define yyset_debug ncgset_debug -#endif - -#ifdef yyget_extra -#define ncgget_extra_ALREADY_DEFINED -#else -#define yyget_extra ncgget_extra -#endif - -#ifdef yyset_extra -#define ncgset_extra_ALREADY_DEFINED -#else -#define yyset_extra ncgset_extra -#endif - -#ifdef yyget_in -#define ncgget_in_ALREADY_DEFINED -#else -#define yyget_in ncgget_in -#endif - -#ifdef yyset_in -#define ncgset_in_ALREADY_DEFINED -#else -#define yyset_in ncgset_in -#endif - -#ifdef yyget_out -#define ncgget_out_ALREADY_DEFINED -#else -#define yyget_out ncgget_out -#endif - -#ifdef yyset_out -#define ncgset_out_ALREADY_DEFINED -#else -#define yyset_out ncgset_out -#endif - -#ifdef yyget_leng -#define ncgget_leng_ALREADY_DEFINED -#else -#define yyget_leng ncgget_leng -#endif - -#ifdef yyget_text -#define ncgget_text_ALREADY_DEFINED -#else -#define yyget_text ncgget_text -#endif - -#ifdef yyget_lineno -#define ncgget_lineno_ALREADY_DEFINED -#else -#define yyget_lineno ncgget_lineno -#endif - -#ifdef yyset_lineno -#define ncgset_lineno_ALREADY_DEFINED -#else -#define yyset_lineno ncgset_lineno -#endif - -#ifdef yywrap -#define ncgwrap_ALREADY_DEFINED -#else -#define yywrap ncgwrap -#endif - -#ifdef yyalloc -#define ncgalloc_ALREADY_DEFINED -#else -#define yyalloc ncgalloc -#endif - -#ifdef yyrealloc -#define ncgrealloc_ALREADY_DEFINED -#else -#define yyrealloc ncgrealloc -#endif - -#ifdef yyfree -#define ncgfree_ALREADY_DEFINED -#else -#define yyfree ncgfree -#endif - -#ifdef yytext -#define ncgtext_ALREADY_DEFINED -#else -#define yytext ncgtext -#endif - -#ifdef yyleng -#define ncgleng_ALREADY_DEFINED -#else -#define yyleng ncgleng -#endif - -#ifdef yyin -#define ncgin_ALREADY_DEFINED -#else -#define yyin ncgin -#endif - -#ifdef yyout -#define ncgout_ALREADY_DEFINED -#else -#define yyout ncgout -#endif - -#ifdef yy_flex_debug -#define ncg_flex_debug_ALREADY_DEFINED -#else -#define yy_flex_debug ncg_flex_debug -#endif - -#ifdef yylineno -#define ncglineno_ALREADY_DEFINED -#else -#define yylineno ncglineno -#endif - /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -305,6 +65,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -312,6 +73,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -342,61 +104,63 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif +#endif /* ! FLEXINT_H */ -#endif /* ! C99 */ +#ifdef __cplusplus -#endif /* ! FLEXINT_H */ +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST -/* begin standard C++ headers. */ +#else /* ! __cplusplus */ -/* TODO: this is always defined, so inline it */ -#define yyconst const +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const #else -#define yynoreturn +#define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. +/* 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) ((YY_CHAR) (c)) +#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_NEW_FILE ncgrestart(ncgin ) + #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. @@ -413,30 +177,30 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern int yyleng; +extern yy_size_t ncgleng; -extern FILE *yyin, *yyout; +extern FILE *ncgin, *ncgout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ + /* Undo effects of setting up ncgtext. */ \ 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 */ \ + YY_DO_BEFORE_ACTION; /* set up ncgtext again */ \ } \ while ( 0 ) + #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -451,12 +215,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - int yy_buf_size; + yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -479,7 +243,7 @@ struct yy_buffer_state 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. */ @@ -496,8 +260,8 @@ struct yy_buffer_state * 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. + * (via ncgrestart()), so that the user can continue scanning by + * just pointing ncgin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -507,7 +271,7 @@ 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 = NULL; /**< Stack as an array. */ +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 @@ -518,98 +282,103 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #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. */ +/* yy_hold_char holds the character lost when ncgtext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t ncgleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; +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 ... +/* Flag which is used to allow ncgwrap()'s to do buffer switches + * instead of setting up a fresh ncgin. 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 ); +void ncgrestart (FILE *input_file ); +void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE ncg_create_buffer (FILE *file,int size ); +void ncg_delete_buffer (YY_BUFFER_STATE b ); +void ncg_flush_buffer (YY_BUFFER_STATE b ); +void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ); +void ncgpop_buffer_state (void ); + +static void ncgensure_buffer_stack (void ); +static void ncg_load_buffer_state (void ); +static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file ); -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 ) +#define YY_FLUSH_BUFFER ncg_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); +YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len ); -void *yyalloc ( yy_size_t ); -void *yyrealloc ( void *, yy_size_t ); -void yyfree ( void * ); +void *ncgalloc (yy_size_t ); +void *ncgrealloc (void *,yy_size_t ); +void ncgfree (void * ); + +#define yy_new_buffer ncg_create_buffer -#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ + ncgensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + ncg_create_buffer(ncgin,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 (); \ + ncgensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + ncg_create_buffer(ncgin,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 flex_uint8_t YY_CHAR; -FILE *yyin = NULL, *yyout = NULL; +typedef unsigned char YY_CHAR; + +FILE *ncgin = (FILE *) 0, *ncgout = (FILE *) 0; typedef int yy_state_type; -extern int yylineno; -int yylineno = 1; +extern int ncglineno; -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext +int ncglineno = 1; + +extern char *ncgtext; +#define yytext_ptr ncgtext -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 yynoreturn yy_fatal_error ( const char* msg ); +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. + * corresponding action - sets up ncgtext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ + ncgleng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; + #define YY_NUM_RULES 49 #define YY_END_OF_BUFFER 50 /* This struct is not used in this scanner, @@ -619,7 +388,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[422] = +static yyconst flex_int16_t yy_accept[422] = { 0, 0, 0, 46, 46, 0, 0, 50, 48, 1, 44, 48, 48, 48, 48, 38, 32, 36, 36, 35, 35, @@ -670,7 +439,7 @@ static const flex_int16_t yy_accept[422] = 0 } ; -static const YY_CHAR yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -702,7 +471,7 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[69] = +static yyconst flex_int32_t yy_meta[69] = { 0, 1, 1, 2, 1, 1, 1, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 1, @@ -713,7 +482,7 @@ static const YY_CHAR yy_meta[69] = 11, 11, 11, 14, 1, 11, 11, 11 } ; -static const flex_int16_t yy_base[440] = +static yyconst flex_int16_t yy_base[440] = { 0, 0, 0, 325, 321, 264, 255, 318, 2387, 67, 2387, 64, 269, 61, 62, 95, 77, 136, 259, 51, 61, @@ -765,7 +534,7 @@ static const flex_int16_t yy_base[440] = 2315, 2329, 2339, 2345, 2353, 2355, 2361, 2367, 2373 } ; -static const flex_int16_t yy_def[440] = +static yyconst flex_int16_t yy_def[440] = { 0, 421, 1, 422, 422, 423, 423, 421, 421, 421, 421, 424, 425, 421, 426, 421, 427, 421, 17, 428, 428, @@ -817,7 +586,7 @@ static const flex_int16_t yy_def[440] = 421, 421, 421, 421, 421, 421, 421, 421, 421 } ; -static const flex_int16_t yy_nxt[2456] = +static yyconst flex_int16_t yy_nxt[2456] = { 0, 8, 9, 10, 9, 8, 11, 12, 8, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 8, @@ -1091,7 +860,7 @@ static const flex_int16_t yy_nxt[2456] = 421, 421, 421, 421, 421 } ; -static const flex_int16_t yy_chk[2456] = +static yyconst flex_int16_t yy_chk[2456] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1368,8 +1137,8 @@ static const flex_int16_t yy_chk[2456] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 0; +extern int ncg_flex_debug; +int ncg_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -1378,7 +1147,7 @@ int yy_flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *ncgtext; #line 1 "ncgen.l" #line 2 "ncgen.l" /********************************************************************* @@ -1522,7 +1291,36 @@ struct Specialtoken specials[] = { {NULL,0} /* null terminate */ }; -#line 1525 "ncgenl.c" +/* Track keywords that may be identifiers depending on + format being produced */ +/* Define the possible format classes */ +#define KWALL (1<yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( ncgin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, ncgin))==0 && ferror(ncgin)) \ { \ if( errno != EINTR) \ { \ @@ -1696,7 +1486,7 @@ static int input ( void ); break; \ } \ errno=0; \ - clearerr(yyin); \ + clearerr(ncgin); \ } \ }\ \ @@ -1729,12 +1519,12 @@ static int input ( void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex (void); +extern int ncglex (void); -#define YY_DECL int yylex (void) +#define YY_DECL int ncglex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after yytext and yyleng +/* Code executed at the beginning of each rule, after ncgtext and ncgleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1743,7 +1533,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK break; #endif #define YY_RULE_SETUP \ @@ -1753,10 +1543,14 @@ extern int yylex (void); */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; +#line 251 "ncgen.l" + +#line 1553 "ncgenl.c" + if ( !(yy_init) ) { (yy_init) = 1; @@ -1768,31 +1562,26 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! ncgin ) + ncgin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! ncgout ) + ncgout = stdout; if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); + ncgensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + ncg_create_buffer(ncgin,YY_BUF_SIZE ); } - yy_load_buffer_state( ); + ncg_load_buffer_state( ); } - { -#line 222 "ncgen.l" - -#line 1789 "ncgenl.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of yytext. */ + /* Support of ncgtext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1804,7 +1593,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1814,9 +1603,9 @@ YY_DECL { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 2387 ); @@ -1845,14 +1634,14 @@ YY_DECL case 1: YY_RULE_SETUP -#line 223 "ncgen.l" +#line 252 "ncgen.l" { /* whitespace */ break; } YY_BREAK case 2: YY_RULE_SETUP -#line 227 "ncgen.l" +#line 256 "ncgen.l" { /* comment */ break; } @@ -1860,19 +1649,19 @@ YY_RULE_SETUP case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 231 "ncgen.l" +#line 260 "ncgen.l" {int len; char* s = NULL; /* In netcdf4, this will be used in a variety of places, so only remove escapes */ /* -if(yyleng > MAXTRST) { +if(ncgleng > MAXTRST) { yyerror("string too long, truncated\n"); -yytext[MAXTRST-1] = '\0'; +ncgtext[MAXTRST-1] = '\0'; } */ - len = unescape((char *)yytext+1,yyleng-2,!ISIDENT,&s); + len = unescape((char *)ncgtext+1,ncgleng-2,!ISIDENT,&s); if(len < 0) { - sprintf(errstr,"Illegal character: %s",yytext); + sprintf(errstr,"Illegal character: %s",ncgtext); yyerror(errstr); } bbClear(lextext); @@ -1884,10 +1673,10 @@ yytext[MAXTRST-1] = '\0'; YY_BREAK case 4: YY_RULE_SETUP -#line 252 "ncgen.l" +#line 281 "ncgen.l" { /* drop leading 0x; pad to even number of chars */ - char* p = yytext+2; - int len = yyleng - 2; + char* p = ncgtext+2; + int len = ncgleng - 2; bbClear(lextext); bbAppendn(lextext,p,len); if((len % 2) == 1) bbAppend(lextext,'0'); @@ -1899,120 +1688,121 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 264 "ncgen.l" -{return lexdebug(COMPOUND);} +#line 293 "ncgen.l" +{return lexdebug(identorkw(COMPOUND));} YY_BREAK case 6: YY_RULE_SETUP -#line 265 "ncgen.l" -{return lexdebug(ENUM);} +#line 294 "ncgen.l" +{return lexdebug(identorkw(ENUM));} YY_BREAK case 7: YY_RULE_SETUP -#line 266 "ncgen.l" +#line 295 "ncgen.l" {return lexdebug(OPAQUE_);} YY_BREAK case 8: YY_RULE_SETUP -#line 268 "ncgen.l" -{return lexdebug(FLOAT_K);} +#line 297 "ncgen.l" +{return lexdebug(identorkw(FLOAT_K));} YY_BREAK case 9: YY_RULE_SETUP -#line 269 "ncgen.l" -{return lexdebug(CHAR_K);} +#line 298 "ncgen.l" +{return lexdebug(identorkw(CHAR_K));} YY_BREAK case 10: YY_RULE_SETUP -#line 270 "ncgen.l" -{return lexdebug(BYTE_K);} +#line 299 "ncgen.l" +{return lexdebug(identorkw(BYTE_K));} YY_BREAK case 11: YY_RULE_SETUP -#line 271 "ncgen.l" -{return lexdebug(UBYTE_K);} +#line 300 "ncgen.l" +{return lexdebug(identorkw(UBYTE_K));} YY_BREAK case 12: YY_RULE_SETUP -#line 272 "ncgen.l" -{return lexdebug(SHORT_K);} +#line 301 "ncgen.l" +{return lexdebug(identorkw(SHORT_K));} YY_BREAK case 13: YY_RULE_SETUP -#line 273 "ncgen.l" -{return lexdebug(USHORT_K);} +#line 302 "ncgen.l" +{return lexdebug(identorkw(USHORT_K));} YY_BREAK case 14: YY_RULE_SETUP -#line 274 "ncgen.l" -{return lexdebug(INT_K);} +#line 303 "ncgen.l" +{return lexdebug(identorkw(INT_K));} YY_BREAK case 15: YY_RULE_SETUP -#line 275 "ncgen.l" -{return lexdebug(UINT_K);} +#line 304 "ncgen.l" +{return lexdebug(identorkw(UINT_K));} YY_BREAK case 16: YY_RULE_SETUP -#line 276 "ncgen.l" -{return lexdebug(INT64_K);} +#line 305 "ncgen.l" +{return lexdebug(identorkw(INT64_K));} YY_BREAK case 17: YY_RULE_SETUP -#line 277 "ncgen.l" -{return lexdebug(UINT64_K);} +#line 306 "ncgen.l" +{return lexdebug(identorkw(UINT64_K));} YY_BREAK case 18: YY_RULE_SETUP -#line 278 "ncgen.l" -{return lexdebug(DOUBLE_K);} +#line 307 "ncgen.l" +{return lexdebug(identorkw(DOUBLE_K));} YY_BREAK case 19: YY_RULE_SETUP -#line 279 "ncgen.l" -{return lexdebug(STRING_K);} +#line 308 "ncgen.l" +{return lexdebug(identorkw(STRING_K));} YY_BREAK case 20: YY_RULE_SETUP -#line 281 "ncgen.l" +#line 310 "ncgen.l" {int32_val = -1; - return lexdebug(NC_UNLIMITED_K);} + return lexdebug(identorkw(NC_UNLIMITED_K));} YY_BREAK +/* These are currently only keywords */ case 21: YY_RULE_SETUP -#line 284 "ncgen.l" +#line 314 "ncgen.l" {return lexdebug(TYPES);} YY_BREAK case 22: YY_RULE_SETUP -#line 285 "ncgen.l" +#line 315 "ncgen.l" {return lexdebug(DIMENSIONS);} YY_BREAK case 23: YY_RULE_SETUP -#line 286 "ncgen.l" +#line 316 "ncgen.l" {return lexdebug(VARIABLES);} YY_BREAK case 24: YY_RULE_SETUP -#line 287 "ncgen.l" +#line 317 "ncgen.l" {return lexdebug(DATA);} YY_BREAK case 25: YY_RULE_SETUP -#line 288 "ncgen.l" +#line 318 "ncgen.l" {return lexdebug(GROUP);} YY_BREAK case 26: YY_RULE_SETUP -#line 290 "ncgen.l" +#line 320 "ncgen.l" {BEGIN(TEXT);return lexdebug(NETCDF);} YY_BREAK case 27: YY_RULE_SETUP -#line 292 "ncgen.l" +#line 322 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ - if (yytext[0] == '-') { + if (ncgtext[0] == '-') { double_val = -INFINITY; } else { double_val = INFINITY; @@ -2023,7 +1813,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 301 "ncgen.l" +#line 331 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ double_val = NAN; specialconstants = 1; @@ -2032,9 +1822,9 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 307 "ncgen.l" +#line 337 "ncgen.l" {/* missing value (pre-2.4 backward compatibility)*/ - if (yytext[0] == '-') { + if (ncgtext[0] == '-') { float_val = -INFINITYF; } else { float_val = INFINITYF; @@ -2045,7 +1835,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 316 "ncgen.l" +#line 346 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ float_val = NANF; specialconstants = 1; @@ -2054,7 +1844,7 @@ YY_RULE_SETUP YY_BREAK case 31: YY_RULE_SETUP -#line 322 "ncgen.l" +#line 352 "ncgen.l" { #ifdef USE_NETCDF4 if(l_flag == L_C || l_flag == L_BINARY) @@ -2067,10 +1857,10 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 332 "ncgen.l" +#line 362 "ncgen.l" { bbClear(lextext); - bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ + bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ bbNull(lextext); yylval.sym = makepath(bbContents(lextext)); return lexdebug(PATH); @@ -2078,10 +1868,10 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 341 "ncgen.l" +#line 371 "ncgen.l" {struct Specialtoken* st; bbClear(lextext); - bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ + bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ bbNull(lextext); for(st=specials;st->name;st++) { if(strcmp(bbContents(lextext),st->name)==0) {return lexdebug(st->token);} @@ -2092,13 +1882,13 @@ YY_RULE_SETUP case 34: /* rule 34 can match eol */ YY_RULE_SETUP -#line 351 "ncgen.l" +#line 381 "ncgen.l" { int c; char* p; char* q; /* copy the trimmed name */ bbClear(lextext); - bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ + bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ bbNull(lextext); p = bbContents(lextext); q = p; @@ -2112,10 +1902,10 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 368 "ncgen.l" +#line 398 "ncgen.l" { char* id = NULL; int len; - len = strlen(yytext); - len = unescape(yytext,len,ISIDENT,&id); + len = strlen(ncgtext); + len = unescape(ncgtext,len,ISIDENT,&id); if(NCSTREQ(id, FILL_STRING)) { efree(id); return lexdebug(FILLMARKER); @@ -2127,7 +1917,7 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 380 "ncgen.l" +#line 410 "ncgen.l" { /* We need to try to see what size of integer ((u)int). @@ -2208,25 +1998,25 @@ done: return 0; YY_BREAK case 37: YY_RULE_SETUP -#line 458 "ncgen.l" +#line 488 "ncgen.l" { int c; int token = 0; - int slen = strlen(yytext); + int slen = strlen(ncgtext); char* stag = NULL; int tag = NC_NAT; - char* hex = yytext+2; /* point to first true hex digit */ + char* hex = ncgtext+2; /* point to first true hex digit */ int xlen = (slen - 3); /* true hex length */ - yytext[slen-1] = '\0'; + ncgtext[slen-1] = '\0'; /* capture the tag string */ - tag = collecttag(yytext,&stag); + tag = collecttag(ncgtext,&stag); if(tag == NC_NAT) { sprintf(errstr,"Illegal integer suffix: %s",stag); yyerror(errstr); goto done; } - yytext[slen - strlen(stag)] = '\0'; + ncgtext[slen - strlen(stag)] = '\0'; if(xlen > 16) { /* truncate hi order digits */ hex += (xlen - 16); } @@ -2248,8 +2038,8 @@ YY_RULE_SETUP token = UINT64_CONST; break; default: /* should never happen */ - if (sscanf((char*)yytext, "%i", &uint32_val) != 1) { - sprintf(errstr,"bad unsigned int constant: %s",(char*)yytext); + if (sscanf((char*)ncgtext, "%i", &uint32_val) != 1) { + sprintf(errstr,"bad unsigned int constant: %s",(char*)ncgtext); yyerror(errstr); } token = UINT_CONST; @@ -2259,10 +2049,10 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 505 "ncgen.l" +#line 535 "ncgen.l" { - if (sscanf((char*)yytext, "%le", &double_val) != 1) { - sprintf(errstr,"bad long or double constant: %s",(char*)yytext); + if (sscanf((char*)ncgtext, "%le", &double_val) != 1) { + sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext); yyerror(errstr); } return lexdebug(DOUBLE_CONST); @@ -2270,10 +2060,10 @@ YY_RULE_SETUP YY_BREAK case 39: YY_RULE_SETUP -#line 512 "ncgen.l" +#line 542 "ncgen.l" { - if (sscanf((char*)yytext, "%e", &float_val) != 1) { - sprintf(errstr,"bad float constant: %s",(char*)yytext); + if (sscanf((char*)ncgtext, "%e", &float_val) != 1) { + sprintf(errstr,"bad float constant: %s",(char*)ncgtext); yyerror(errstr); } return lexdebug(FLOAT_CONST); @@ -2282,19 +2072,19 @@ YY_RULE_SETUP case 40: /* rule 40 can match eol */ YY_RULE_SETUP -#line 519 "ncgen.l" +#line 549 "ncgen.l" { - (void) sscanf((char*)&yytext[1],"%c",&byte_val); + (void) sscanf((char*)&ncgtext[1],"%c",&byte_val); return lexdebug(BYTE_CONST); } YY_BREAK case 41: YY_RULE_SETUP -#line 523 "ncgen.l" +#line 553 "ncgen.l" { - int oct = unescapeoct(&yytext[2]); + int oct = unescapeoct(&ncgtext[2]); if(oct < 0) { - sprintf(errstr,"bad octal character constant: %s",(char*)yytext); + sprintf(errstr,"bad octal character constant: %s",(char*)ncgtext); yyerror(errstr); } byte_val = (unsigned int)oct; @@ -2303,11 +2093,11 @@ YY_RULE_SETUP YY_BREAK case 42: YY_RULE_SETUP -#line 532 "ncgen.l" +#line 562 "ncgen.l" { - int hex = unescapehex(&yytext[3]); + int hex = unescapehex(&ncgtext[3]); if(byte_val < 0) { - sprintf(errstr,"bad hex character constant: %s",(char*)yytext); + sprintf(errstr,"bad hex character constant: %s",(char*)ncgtext); yyerror(errstr); } byte_val = (unsigned int)hex; @@ -2316,9 +2106,9 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 541 "ncgen.l" +#line 571 "ncgen.l" { - switch ((char)yytext[2]) { + switch ((char)ncgtext[2]) { case 'a': byte_val = '\007'; break; /* not everyone under- * stands '\a' yet */ case 'b': byte_val = '\b'; break; @@ -2330,7 +2120,7 @@ YY_RULE_SETUP case '\\': byte_val = '\\'; break; case '?': byte_val = '\177'; break; case '\'': byte_val = '\''; break; - default: byte_val = (char)yytext[2]; + default: byte_val = (char)ncgtext[2]; } return lexdebug(BYTE_CONST); } @@ -2338,7 +2128,7 @@ YY_RULE_SETUP case 44: /* rule 44 can match eol */ YY_RULE_SETUP -#line 559 "ncgen.l" +#line 589 "ncgen.l" { lineno++ ; break; @@ -2346,7 +2136,7 @@ YY_RULE_SETUP YY_BREAK case 45: YY_RULE_SETUP -#line 564 "ncgen.l" +#line 594 "ncgen.l" {/*initial*/ BEGIN(ST_C_COMMENT); break; @@ -2355,21 +2145,21 @@ YY_RULE_SETUP case 46: /* rule 46 can match eol */ YY_RULE_SETUP -#line 569 "ncgen.l" +#line 599 "ncgen.l" {/* continuation */ break; } YY_BREAK case 47: YY_RULE_SETUP -#line 573 "ncgen.l" +#line 603 "ncgen.l" {/* final */ BEGIN(INITIAL); break; } YY_BREAK case YY_STATE_EOF(ST_C_COMMENT): -#line 578 "ncgen.l" +#line 608 "ncgen.l" {/* final, error */ fprintf(stderr,"unterminated /**/ comment"); BEGIN(INITIAL); @@ -2378,17 +2168,17 @@ case YY_STATE_EOF(ST_C_COMMENT): YY_BREAK case 48: YY_RULE_SETUP -#line 584 "ncgen.l" +#line 614 "ncgen.l" {/* Note: this next rule will not work for UTF8 characters */ - return lexdebug(yytext[0]) ; + return lexdebug(ncgtext[0]) ; } YY_BREAK case 49: YY_RULE_SETUP -#line 587 "ncgen.l" +#line 617 "ncgen.l" ECHO; YY_BREAK -#line 2391 "ncgenl.c" +#line 2182 "ncgenl.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TEXT): yyterminate(); @@ -2406,15 +2196,15 @@ case YY_STATE_EOF(TEXT): { /* 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 + * just pointed ncgin at a new source and called + * ncglex(). 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_input_file = ncgin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -2467,11 +2257,11 @@ case YY_STATE_EOF(TEXT): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( ncgwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * ncgtext, 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 @@ -2520,8 +2310,7 @@ case YY_STATE_EOF(TEXT): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ +} /* end of ncglex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2532,9 +2321,9 @@ case YY_STATE_EOF(TEXT): */ 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; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2563,7 +2352,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2576,21 +2365,21 @@ static int yy_get_next_buffer (void) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + 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; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2599,12 +2388,11 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) ); + ncgrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; + b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2632,7 +2420,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + ncgrestart(ncgin ); } else @@ -2646,15 +2434,12 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + 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. */ - int 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, (yy_size_t) new_size ); + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((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()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -2670,14 +2455,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2687,9 +2472,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -2702,10 +2487,10 @@ static int yy_get_next_buffer (void) */ 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); + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2715,32 +2500,30 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 421); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) + static void yyunput (int c, register char * yy_bp ) { - char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up yytext */ + /* undo effects of setting up ncgtext */ *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[ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = + register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -2749,7 +2532,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (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" ); @@ -2762,8 +2545,6 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } -#endif - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2788,7 +2569,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2805,13 +2586,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart( yyin ); + ncgrestart(ncgin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) + if ( ncgwrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -2831,7 +2612,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ + *(yy_c_buf_p) = '\0'; /* preserve ncgtext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -2843,32 +2624,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void yyrestart (FILE * input_file ) + void ncgrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); + ncgensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + ncg_create_buffer(ncgin,YY_BUF_SIZE ); } - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); + ncg_init_buffer(YY_CURRENT_BUFFER,input_file ); + ncg_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 ) + void ncg_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); + * ncgpop_buffer_state(); + * ncgpush_buffer_state(new_buffer); */ - yyensure_buffer_stack (); + ncgensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2881,21 +2662,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + ncg_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 + * EOF (ncgwrap()) processing, but the only time this flag + * is looked at is after ncgwrap() 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) +static void ncg_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; + ncgin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2905,35 +2686,35 @@ static void yy_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE ncg_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_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( (yy_size_t) (b->yy_buf_size + 2) ); + b->yy_ch_buf = (char *) ncgalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + ncg_init_buffer(b,file ); return b; } /** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() + * @param b a buffer created with ncg_create_buffer() * */ - void yy_delete_buffer (YY_BUFFER_STATE b ) + void ncg_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2943,27 +2724,31 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf ); + ncgfree((void *) b->yy_ch_buf ); - yyfree( (void *) b ); + ncgfree((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. + * such as during a ncgrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void ncg_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - yy_flush_buffer( b ); + ncg_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. + /* If b is the current buffer, then ncg_init_buffer was _probably_ + * called from ncgrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2980,7 +2765,7 @@ static void yy_load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void yy_flush_buffer (YY_BUFFER_STATE b ) + void ncg_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -3000,7 +2785,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + ncg_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -3009,14 +2794,14 @@ static void yy_load_buffer_state (void) * @param new_buffer The new state. * */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - yyensure_buffer_stack(); + ncgensure_buffer_stack(); - /* This block is copied from yy_switch_to_buffer. */ + /* This block is copied from ncg_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -3030,8 +2815,8 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + /* copied from ncg_switch_to_buffer. */ + ncg_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -3039,18 +2824,18 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void yypop_buffer_state (void) +void ncgpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - yy_delete_buffer(YY_CURRENT_BUFFER ); + ncg_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( ); + ncg_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -3058,7 +2843,7 @@ void yypop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void yyensure_buffer_stack (void) +static void ncgensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -3068,15 +2853,15 @@ static void yyensure_buffer_stack (void) * 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; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in ncgensure_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; @@ -3085,15 +2870,15 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; + 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) = (struct yy_buffer_state**)ncgrealloc ((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()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -3105,9 +2890,9 @@ static void yyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -3115,69 +2900,68 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 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 NULL; + return 0; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_buffer()" ); - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + 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 = NULL; + 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 ); + ncg_switch_to_buffer(b ); return b; } -/** Setup the input buffer state to scan a string. The next call to yylex() will +/** Setup the input buffer state to scan a string. The next call to ncglex() 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. + * ncg_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (const char * yystr ) +YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr ) { - return yy_scan_bytes( yystr, (int) strlen(yystr) ); + return ncg_scan_bytes(yystr,strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to ncglex() 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. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - int i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n ); + n = _yybytes_len + 2; + buf = (char *) ncgalloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_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 ); + b = ncg_scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in ncg_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -3191,9 +2975,9 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (const char* msg ) +static void yy_fatal_error (yyconst char* msg ) { - fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -3203,14 +2987,14 @@ static void yynoreturn yy_fatal_error (const char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ + /* Undo effects of setting up ncgtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ + ncgtext[ncgleng] = (yy_hold_char); \ + (yy_c_buf_p) = ncgtext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ + ncgleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -3219,126 +3003,126 @@ static void yynoreturn yy_fatal_error (const char* msg ) /** Get the current line number. * */ -int yyget_lineno (void) +int ncgget_lineno (void) { - - return yylineno; + + return ncglineno; } /** Get the input stream. * */ -FILE *yyget_in (void) +FILE *ncgget_in (void) { - return yyin; + return ncgin; } /** Get the output stream. * */ -FILE *yyget_out (void) +FILE *ncgget_out (void) { - return yyout; + return ncgout; } /** Get the length of the current token. * */ -int yyget_leng (void) +yy_size_t ncgget_leng (void) { - return yyleng; + return ncgleng; } /** Get the current token. * */ -char *yyget_text (void) +char *ncgget_text (void) { - return yytext; + return ncgtext; } /** Set the current line number. - * @param _line_number line number + * @param line_number * */ -void yyset_lineno (int _line_number ) +void ncgset_lineno (int line_number ) { - yylineno = _line_number; + ncglineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param _in_str A readable stream. + * @param in_str A readable stream. * - * @see yy_switch_to_buffer + * @see ncg_switch_to_buffer */ -void yyset_in (FILE * _in_str ) +void ncgset_in (FILE * in_str ) { - yyin = _in_str ; + ncgin = in_str ; } -void yyset_out (FILE * _out_str ) +void ncgset_out (FILE * out_str ) { - yyout = _out_str ; + ncgout = out_str ; } -int yyget_debug (void) +int ncgget_debug (void) { - return yy_flex_debug; + return ncg_flex_debug; } -void yyset_debug (int _bdebug ) +void ncgset_debug (int bdebug ) { - yy_flex_debug = _bdebug ; + ncg_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. + * This function is called from ncglex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = NULL; + (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = NULL; + (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + ncgin = stdin; + ncgout = stdout; #else - yyin = NULL; - yyout = NULL; + ncgin = (FILE *) 0; + ncgout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by - * yylex_init() + * ncglex_init() */ return 0; } -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) +/* ncglex_destroy is for both reentrant and non-reentrant scanners. */ +int ncglex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER ); + ncg_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); + ncgpop_buffer_state(); } /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); + ncgfree((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. */ + * ncglex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -3349,19 +3133,18 @@ int yylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n ) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s ) +static int yy_flex_strlen (yyconst char * s ) { - int n; + register int n; for ( n = 0; s[n]; ++n ) ; @@ -3369,14 +3152,13 @@ static int yy_flex_strlen (const char * s ) } #endif -void *yyalloc (yy_size_t size ) +void *ncgalloc (yy_size_t size ) { - return malloc(size); + return (void *) malloc( size ); } -void *yyrealloc (void * ptr, yy_size_t size ) +void *ncgrealloc (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 @@ -3384,25 +3166,26 @@ void *yyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return realloc(ptr, size); + return (void *) realloc( (char *) ptr, size ); } -void yyfree (void * ptr ) +void ncgfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 587 "ncgen.l" +#line 617 "ncgen.l" + static int lexdebug(int token) { if(debug >= 2) { - char* text = yytext; - text[yyleng] = 0; + char* text = ncgtext; + text[ncgleng] = 0; fprintf(stderr,"Token=%d |%s| line=%d\n",token,text,lineno); } return token; @@ -3688,3 +3471,39 @@ collecttag(char* text, char** stagp) return tag; } +/* Depending on the format, a name may be a keword or an ident */ +static int +identorkw(int token) +{ + /* Binary search for ncgtext */ + int n = NKWIDENT; + int L = 0; + int R = (n - 1); + int m, cmp; + struct KWIDENT* p; + int found = 0; + size_t len; + char* id = NULL; + + for(;;) { + if(L > R) break; + m = (L + R) / 2; + p = &kwident[m]; + cmp = (p->token - token); + if(cmp == 0) {found = 1; break;} + if(cmp < 0) + L = (m + 1); + else /*cmp > 0*/ + R = (m - 1); + } + if(!found) return token; /* Not a keyword of interest */ + /* See if the format applies */ + if(p->formats & ((int)1<. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -44,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -52,25 +55,140 @@ /* Pure parsers. */ #define YYPURE 0 -/* Push parsers. */ -#define YYPUSH 0 +/* Using locations. */ +#define YYLSP_NEEDED 0 -/* Pull parsers. */ -#define YYPULL 1 +/* Substitute the variable and function names. */ +#define yyparse ncgparse +#define yylex ncglex +#define yyerror ncgerror +#define yylval ncglval +#define yychar ncgchar +#define yydebug ncgdebug +#define yynerrs ncgnerrs + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NC_UNLIMITED_K = 258, + CHAR_K = 259, + BYTE_K = 260, + SHORT_K = 261, + INT_K = 262, + FLOAT_K = 263, + DOUBLE_K = 264, + UBYTE_K = 265, + USHORT_K = 266, + UINT_K = 267, + INT64_K = 268, + UINT64_K = 269, + STRING_K = 270, + IDENT = 271, + TERMSTRING = 272, + CHAR_CONST = 273, + BYTE_CONST = 274, + SHORT_CONST = 275, + INT_CONST = 276, + INT64_CONST = 277, + UBYTE_CONST = 278, + USHORT_CONST = 279, + UINT_CONST = 280, + UINT64_CONST = 281, + FLOAT_CONST = 282, + DOUBLE_CONST = 283, + DIMENSIONS = 284, + VARIABLES = 285, + NETCDF = 286, + DATA = 287, + TYPES = 288, + COMPOUND = 289, + ENUM = 290, + OPAQUE_ = 291, + OPAQUESTRING = 292, + GROUP = 293, + PATH = 294, + FILLMARKER = 295, + NIL = 296, + _FILLVALUE = 297, + _FORMAT = 298, + _STORAGE = 299, + _CHUNKSIZES = 300, + _DEFLATELEVEL = 301, + _SHUFFLE = 302, + _ENDIANNESS = 303, + _NOFILL = 304, + _FLETCHER32 = 305, + _NCPROPS = 306, + _ISNETCDF4 = 307, + _SUPERBLOCK = 308, + _FILTER = 309, + DATASETID = 310 + }; +#endif +/* Tokens. */ +#define NC_UNLIMITED_K 258 +#define CHAR_K 259 +#define BYTE_K 260 +#define SHORT_K 261 +#define INT_K 262 +#define FLOAT_K 263 +#define DOUBLE_K 264 +#define UBYTE_K 265 +#define USHORT_K 266 +#define UINT_K 267 +#define INT64_K 268 +#define UINT64_K 269 +#define STRING_K 270 +#define IDENT 271 +#define TERMSTRING 272 +#define CHAR_CONST 273 +#define BYTE_CONST 274 +#define SHORT_CONST 275 +#define INT_CONST 276 +#define INT64_CONST 277 +#define UBYTE_CONST 278 +#define USHORT_CONST 279 +#define UINT_CONST 280 +#define UINT64_CONST 281 +#define FLOAT_CONST 282 +#define DOUBLE_CONST 283 +#define DIMENSIONS 284 +#define VARIABLES 285 +#define NETCDF 286 +#define DATA 287 +#define TYPES 288 +#define COMPOUND 289 +#define ENUM 290 +#define OPAQUE_ 291 +#define OPAQUESTRING 292 +#define GROUP 293 +#define PATH 294 +#define FILLMARKER 295 +#define NIL 296 +#define _FILLVALUE 297 +#define _FORMAT 298 +#define _STORAGE 299 +#define _CHUNKSIZES 300 +#define _DEFLATELEVEL 301 +#define _SHUFFLE 302 +#define _ENDIANNESS 303 +#define _NOFILL 304 +#define _FLETCHER32 305 +#define _NCPROPS 306 +#define _ISNETCDF4 307 +#define _SUPERBLOCK 308 +#define _FILTER 309 +#define DATASETID 310 -/* Substitute the variable and function names. */ -#define yyparse ncgparse -#define yylex ncglex -#define yyerror ncgerror -#define yydebug ncgdebug -#define yynerrs ncgnerrs -#define yylval ncglval -#define yychar ncgchar /* Copy the first part of user declarations. */ -#line 11 "ncgen.y" /* yacc.c:339 */ +#line 11 "ncgen.y" /* static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $"; @@ -208,15 +326,11 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl; extern int lex_init(void); -#line 212 "ncgeny.c" /* yacc.c:339 */ -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -226,111 +340,37 @@ extern int lex_init(void); # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "ncgeny.h". */ -#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED -# define YY_NCG_NCGEN_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int ncgdebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - STRING_K = 270, - IDENT = 271, - TERMSTRING = 272, - CHAR_CONST = 273, - BYTE_CONST = 274, - SHORT_CONST = 275, - INT_CONST = 276, - INT64_CONST = 277, - UBYTE_CONST = 278, - USHORT_CONST = 279, - UINT_CONST = 280, - UINT64_CONST = 281, - FLOAT_CONST = 282, - DOUBLE_CONST = 283, - DIMENSIONS = 284, - VARIABLES = 285, - NETCDF = 286, - DATA = 287, - TYPES = 288, - COMPOUND = 289, - ENUM = 290, - OPAQUE_ = 291, - OPAQUESTRING = 292, - GROUP = 293, - PATH = 294, - FILLMARKER = 295, - NIL = 296, - _FILLVALUE = 297, - _FORMAT = 298, - _STORAGE = 299, - _CHUNKSIZES = 300, - _DEFLATELEVEL = 301, - _SHUFFLE = 302, - _ENDIANNESS = 303, - _NOFILL = 304, - _FLETCHER32 = 305, - _NCPROPS = 306, - _ISNETCDF4 = 307, - _SUPERBLOCK = 308, - _FILTER = 309, - DATASETID = 310 - }; -#endif - -/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +typedef union YYSTYPE +#line 151 "ncgen.y" { -#line 151 "ncgen.y" /* yacc.c:355 */ - Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ long mark; /* track indices into the sequence*/ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant* constant; - -#line 317 "ncgeny.c" /* yacc.c:355 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 193 of yacc.c. */ +#line 361 "ncgeny.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif -extern YYSTYPE ncglval; - -int ncgparse (void); - -#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */ /* Copy the second part of user declarations. */ -#line 334 "ncgeny.c" /* yacc.c:358 */ + +/* Line 216 of yacc.c. */ +#line 374 "ncgeny.c" #ifdef short # undef short @@ -344,8 +384,11 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#else +#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 @@ -365,7 +408,8 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -379,68 +423,39 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) #else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; #endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ +{ + return i; +} #endif - #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -458,11 +473,11 @@ typedef short int yytype_int16; # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # endif @@ -470,8 +485,8 @@ typedef short int yytype_int16; # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* 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 @@ -485,23 +500,25 @@ typedef short int yytype_int16; # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ +# if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS +# 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 EXIT_SUCCESS +# 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 @@ -511,14 +528,14 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (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; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -529,46 +546,42 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -# define YYCOPY_NEEDED 1 +/* 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 (0) +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) #endif -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ @@ -580,19 +593,17 @@ union yyalloc #define YYNNTS 67 /* YYNRULES -- Number of rules. */ #define YYNRULES 153 -/* YYNSTATES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 262 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 310 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -630,7 +641,80 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 7, 9, 14, 20, 21, 24, 25, + 26, 36, 37, 39, 42, 44, 47, 49, 51, 54, + 57, 60, 63, 66, 67, 69, 76, 78, 82, 86, + 92, 98, 104, 107, 111, 114, 116, 118, 120, 122, + 124, 126, 128, 130, 132, 134, 136, 138, 139, 141, + 144, 147, 151, 153, 155, 157, 161, 165, 169, 171, + 172, 174, 177, 180, 184, 186, 188, 191, 193, 197, + 200, 201, 205, 207, 211, 213, 215, 219, 222, 223, + 227, 229, 233, 235, 237, 239, 241, 243, 245, 246, + 250, 255, 260, 265, 270, 277, 283, 289, 296, 302, + 308, 314, 320, 326, 332, 338, 344, 349, 351, 353, + 354, 356, 359, 362, 366, 370, 372, 374, 375, 377, + 381, 383, 387, 389, 391, 393, 395, 397, 399, 401, + 406, 408, 412, 414, 416, 418, 420, 422, 424, 426, + 428, 430, 432, 434, 436, 438, 442, 444, 446, 448, + 450, 452, 454, 456 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 66, 0, -1, 31, 67, 68, -1, 55, -1, 56, + 69, 70, 57, -1, 112, 74, 89, 95, 115, -1, + -1, 70, 71, -1, -1, -1, 38, 131, 56, 72, + 69, 70, 73, 57, 112, -1, -1, 33, -1, 33, + 75, -1, 77, -1, 75, 77, -1, 131, -1, 78, + -1, 113, 58, -1, 80, 79, -1, 85, 79, -1, + 84, 79, -1, 83, 79, -1, -1, 58, -1, 88, + 35, 76, 56, 81, 57, -1, 82, -1, 81, 59, + 82, -1, 131, 60, 128, -1, 36, 61, 21, 62, + 76, -1, 110, 61, 63, 62, 76, -1, 34, 76, + 56, 86, 57, -1, 87, 58, -1, 86, 87, 58, + -1, 110, 104, -1, 4, -1, 5, -1, 6, -1, + 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, + 12, -1, 13, -1, 14, -1, 15, -1, -1, 29, + -1, 29, 90, -1, 91, 58, -1, 90, 91, 58, + -1, 92, -1, 113, -1, 93, -1, 92, 59, 93, + -1, 94, 60, 128, -1, 94, 60, 3, -1, 131, + -1, -1, 30, -1, 30, 96, -1, 97, 58, -1, + 96, 97, 58, -1, 98, -1, 113, -1, 110, 99, + -1, 100, -1, 99, 59, 100, -1, 131, 101, -1, + -1, 61, 102, 62, -1, 103, -1, 102, 59, 103, + -1, 114, -1, 105, -1, 104, 59, 105, -1, 131, + 106, -1, -1, 61, 107, 62, -1, 108, -1, 107, + 59, 108, -1, 25, -1, 21, -1, 111, -1, 111, + -1, 114, -1, 88, -1, -1, 113, 58, 112, -1, + 64, 51, 60, 129, -1, 64, 52, 60, 130, -1, + 64, 53, 60, 128, -1, 64, 131, 60, 118, -1, + 110, 111, 64, 131, 60, 118, -1, 111, 64, 131, + 60, 118, -1, 111, 64, 42, 60, 118, -1, 110, + 111, 64, 42, 60, 118, -1, 111, 64, 44, 60, + 129, -1, 111, 64, 45, 60, 127, -1, 111, 64, + 50, 60, 130, -1, 111, 64, 46, 60, 128, -1, + 111, 64, 47, 60, 130, -1, 111, 64, 48, 60, + 129, -1, 111, 64, 54, 60, 129, -1, 111, 64, + 49, 60, 130, -1, 64, 43, 60, 129, -1, 131, + -1, 39, -1, -1, 32, -1, 32, 116, -1, 117, + 58, -1, 116, 117, 58, -1, 109, 60, 118, -1, + 119, -1, 120, -1, -1, 121, -1, 118, 59, 121, + -1, 122, -1, 56, 118, 57, -1, 126, -1, 37, + -1, 40, -1, 41, -1, 123, -1, 124, -1, 114, + -1, 131, 61, 125, 62, -1, 126, -1, 125, 59, + 126, -1, 18, -1, 19, -1, 20, -1, 21, -1, + 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, + 27, -1, 28, -1, 17, -1, 128, -1, 127, 59, + 128, -1, 21, -1, 25, -1, 22, -1, 26, -1, + 17, -1, 129, -1, 128, -1, 16, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 233, 233, 239, 241, 248, 255, 255, 258, 267, @@ -652,7 +736,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +#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[] = @@ -669,24 +753,24 @@ static const char *const yytname[] = "_FLETCHER32", "_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", "_FILTER", "DATASETID", "'{'", "'}'", "';'", "','", "'='", "'('", "')'", "'*'", "':'", "$accept", "ncdesc", "datasetid", "rootgroup", "groupbody", - "subgrouplist", "namedgroup", "$@1", "$@2", "typesection", "typedecls", + "subgrouplist", "namedgroup", "@1", "@2", "typesection", "typedecls", "typename", "type_or_attr_decl", "typedecl", "optsemicolon", "enumdecl", "enumidlist", "enumid", "opaquedecl", "vlendecl", "compounddecl", "fields", "field", "primtype", "dimsection", "dimdecls", "dim_or_attr_decl", "dimdeclist", "dimdecl", "dimd", "vasection", "vadecls", "vadecl_or_attr", "vardecl", "varlist", "varspec", "dimspec", "dimlist", "dimref", "fieldlist", "fieldspec", "fielddimspec", - "fielddimlist", "fielddim", "varref", "typeref", "type_var_ref", + "fielddimlist", "fielddim", "varref", "typeref", "ambiguous_ref", "attrdecllist", "attrdecl", "path", "datasection", "datadecls", "datadecl", "datalist", "datalist0", "datalist1", "dataitem", "constdata", "econstref", "function", "arglist", "simpleconstant", - "intlist", "constint", "conststring", "constbool", "ident", YY_NULLPTR + "intlist", "constint", "conststring", "constbool", "ident", 0 }; #endif # ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ +/* 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, @@ -699,52 +783,51 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -145 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-145))) - -#define YYTABLE_NINF -108 - -#define yytable_value_is_error(Yytable_value) \ - 0 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 65, 66, 67, 68, 69, 70, 70, 72, 73, + 71, 74, 74, 74, 75, 75, 76, 77, 77, 78, + 78, 78, 78, 79, 79, 80, 81, 81, 82, 83, + 84, 85, 86, 86, 87, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, + 90, 90, 91, 91, 92, 92, 93, 93, 94, 95, + 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, + 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, + 107, 107, 108, 108, 109, 110, 111, 111, 112, 112, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 114, 114, 115, + 115, 115, 116, 116, 117, 118, 118, 119, 120, 120, + 121, 121, 122, 122, 122, 122, 122, 122, 123, 124, + 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 127, 127, 128, 128, 128, 128, + 129, 130, 130, 131 +}; - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = { - -10, -19, 54, -145, 12, -145, 219, -145, -145, -145, - -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, - -145, -145, -8, -145, -145, 354, -9, 26, 11, -145, - -145, 15, 28, 31, 32, 36, -11, 34, 130, 183, - 70, 219, 83, 83, 45, 52, 301, 85, -145, -145, - -1, 42, 46, 49, 50, 51, 57, 58, 59, 60, - 61, 85, 53, 183, -145, -145, 64, 64, 64, 64, - 88, 255, 66, 219, 95, -145, -145, -145, -145, -145, - -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, - -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, - -145, -145, 301, -145, 68, -145, -145, -145, -145, -145, - -145, -145, 71, 75, 73, 77, 301, 83, 52, 52, - 45, 83, 45, 45, 83, 301, 79, -145, 117, -145, - -145, -145, -145, -145, -145, 85, 78, -145, 219, 82, - 86, -145, 84, -145, 87, 219, 118, 30, 301, 355, - -145, 301, 301, 68, -145, 90, -145, -145, -145, -145, - -145, -145, -145, 68, 354, 93, 96, 97, 100, -145, - 85, 35, 219, 102, -145, 354, -145, 354, -145, -145, - -145, -28, -145, 219, 68, 68, 52, 291, 103, 85, - -145, 85, 85, 85, -145, -145, -145, -145, -145, 104, - -145, 105, -145, -32, 108, -145, 354, 107, 355, -145, - -145, -145, -145, 115, -145, 123, -145, 125, -145, 38, - -145, 140, -145, -145, 85, 3, -145, 301, 143, -145, - -145, 166, -145, 85, -7, -145, -145, 85, 52, -145, - 145, 17, -145, -145, 68, -145, 106, -145, -145, -145, - 23, -145, -145, -145, 3, -145, 219, -7, -145, -145, - -145, -145 + 0, 2, 3, 1, 4, 5, 0, 2, 0, 0, + 9, 0, 1, 2, 1, 2, 1, 1, 2, 2, + 2, 2, 2, 0, 1, 6, 1, 3, 3, 5, + 5, 5, 2, 3, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, + 2, 3, 1, 1, 1, 3, 3, 3, 1, 0, + 1, 2, 2, 3, 1, 1, 2, 1, 3, 2, + 0, 3, 1, 3, 1, 1, 3, 2, 0, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 0, 3, + 4, 4, 4, 4, 6, 5, 5, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 4, 1, 1, 0, + 1, 2, 2, 3, 3, 1, 1, 0, 1, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, + 1, 1, 1, 1 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ +/* 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_uint8 yydefact[] = { 0, 0, 0, 3, 0, 1, 88, 2, 35, 36, @@ -776,19 +859,7 @@ static const yytype_uint8 yydefact[] = 10, 81 }; - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -145, -145, -145, -145, 24, -2, -145, -145, -145, -145, - -145, -128, 146, -145, -20, -145, -145, -25, -145, -145, - -145, -145, 27, -26, -145, -145, 80, -145, 43, -145, - -145, -145, 48, -145, -145, -3, -145, -145, -18, -145, - 4, -145, -145, -17, -145, -30, -21, -40, -33, -44, - -145, -145, 33, -99, -145, -145, 94, -145, -145, -145, - -145, -144, -145, -35, -31, -100, -22 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 2, 4, 7, 23, 36, 49, 183, 246, 40, @@ -800,9 +871,57 @@ static const yytype_int16 yydefgoto[] = 181, 111, 155, 83, 84, 85, 30 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -145 +static const yytype_int16 yypact[] = +{ + -10, -19, 54, -145, 12, -145, 219, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -8, -145, -145, 354, -9, 26, 11, -145, + -145, 15, 28, 31, 32, 36, -11, 34, 130, 183, + 70, 219, 83, 83, 45, 52, 301, 85, -145, -145, + -1, 42, 46, 49, 50, 51, 57, 58, 59, 60, + 61, 85, 53, 183, -145, -145, 64, 64, 64, 64, + 88, 255, 66, 219, 95, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, 301, -145, 68, -145, -145, -145, -145, -145, + -145, -145, 71, 75, 73, 77, 301, 83, 52, 52, + 45, 83, 45, 45, 83, 301, 79, -145, 117, -145, + -145, -145, -145, -145, -145, 85, 78, -145, 219, 82, + 86, -145, 84, -145, 87, 219, 118, 30, 301, 355, + -145, 301, 301, 68, -145, 90, -145, -145, -145, -145, + -145, -145, -145, 68, 354, 93, 96, 97, 100, -145, + 85, 35, 219, 102, -145, 354, -145, 354, -145, -145, + -145, -28, -145, 219, 68, 68, 52, 291, 103, 85, + -145, 85, 85, 85, -145, -145, -145, -145, -145, 104, + -145, 105, -145, -32, 108, -145, 354, 107, 355, -145, + -145, -145, -145, 115, -145, 123, -145, 125, -145, 38, + -145, 140, -145, -145, 85, 3, -145, 301, 143, -145, + -145, 166, -145, 85, -7, -145, -145, 85, 52, -145, + 145, 17, -145, -145, 68, -145, 106, -145, -145, -145, + 23, -145, -145, -145, 3, -145, 219, -7, -145, -145, + -145, -145 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -145, -145, -145, -145, 24, -2, -145, -145, -145, -145, + -145, -128, 146, -145, -20, -145, -145, -25, -145, -145, + -145, -145, 27, -26, -145, -145, 80, -145, 43, -145, + -145, -145, 48, -145, -145, -3, -145, -145, -18, -145, + 4, -145, -145, -17, -145, -30, -21, -40, -33, -44, + -145, -145, 33, -99, -145, -145, 94, -145, -145, -145, + -145, -144, -145, -35, -31, -100, -22 +}; + +/* 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 -108 static const yytype_int16 yytable[] = { 35, 75, 103, 147, 37, 182, 72, 166, 20, 71, @@ -891,8 +1010,8 @@ static const yytype_int16 yycheck[] = -1, -1, -1, 39 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 31, 66, 55, 67, 0, 56, 68, 4, 5, @@ -924,83 +1043,95 @@ static const yytype_uint8 yystos[] = 112, 108 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 65, 66, 67, 68, 69, 70, 70, 72, 73, - 71, 74, 74, 74, 75, 75, 76, 77, 77, 78, - 78, 78, 78, 79, 79, 80, 81, 81, 82, 83, - 84, 85, 86, 86, 87, 88, 88, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, - 90, 90, 91, 91, 92, 92, 93, 93, 94, 95, - 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, - 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, - 107, 107, 108, 108, 109, 110, 111, 111, 112, 112, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 114, 114, 115, - 115, 115, 116, 116, 117, 118, 118, 119, 120, 120, - 121, 121, 122, 122, 122, 122, 122, 122, 123, 124, - 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 127, 127, 128, 128, 128, 128, - 129, 130, 130, 131 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 3, 1, 4, 5, 0, 2, 0, 0, - 9, 0, 1, 2, 1, 2, 1, 1, 2, 2, - 2, 2, 2, 0, 1, 6, 1, 3, 3, 5, - 5, 5, 2, 3, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, - 2, 3, 1, 1, 1, 3, 3, 3, 1, 0, - 1, 2, 2, 3, 1, 1, 2, 1, 3, 2, - 0, 3, 1, 3, 1, 1, 3, 2, 0, 3, - 1, 3, 1, 1, 1, 1, 1, 1, 0, 3, - 4, 4, 4, 4, 6, 5, 5, 6, 5, 5, - 5, 5, 5, 5, 5, 5, 4, 1, 1, 0, - 1, 2, 2, 3, 3, 1, 1, 0, 1, 3, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 1 -}; +#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 -#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) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#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 (0) + 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 -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +/* 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 defined YYLTYPE_IS_TRIVIAL && 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 @@ -1010,46 +1141,54 @@ while (0) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#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)) -# 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 (0) +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ -/*----------------------------------------. -| Print this symbol's value 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 { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); # endif - YYUSE (yytype); + switch (yytype) + { + default: + break; + } } @@ -1057,11 +1196,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue | 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 { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + 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, ")"); @@ -1072,54 +1222,66 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) +# 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 (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif { - unsigned long int yylno = yyrline[yyrule]; 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); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) +# 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. */ @@ -1133,7 +1295,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1148,6 +1310,7 @@ int yydebug; # define YYMAXDEPTH 10000 #endif + #if YYERROR_VERBOSE @@ -1156,8 +1319,15 @@ int yydebug; # 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++) @@ -1173,8 +1343,16 @@ yystrlen (const char *yystr) # 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; @@ -1204,27 +1382,27 @@ yytnamerr (char *yyres, const char *yystr) 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; - } + 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: ; } @@ -1235,209 +1413,211 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +/* 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) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - 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 yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } + int yyn = yypact[yystate]; - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; + 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; } - - /* 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 = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; } #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); - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END + 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. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; + /* Number of syntax errors so far. */ int yynerrs; + /*----------. | yyparse. | `----------*/ +#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) -{ - 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 through 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; +#else +int +yyparse () +#endif +#endif +{ + + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; - /* 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]; @@ -1445,22 +1625,54 @@ yyparse (void) YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; /*------------------------------------------------------------. @@ -1481,23 +1693,25 @@ yyparse (void) #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; + /* 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 @@ -1505,22 +1719,23 @@ yyparse (void) # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + 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); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1528,18 +1743,16 @@ yyparse (void) yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1548,20 +1761,20 @@ yyparse (void) yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); + yychar = YYLEX; } if (yychar <= YYEOF) @@ -1583,27 +1796,29 @@ yyparse (void) yyn = yytable[yyn]; if (yyn <= 0) { - if (yytable_value_is_error (yyn)) - goto yyerrlab; + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; yyn = -yyn; goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1626,7 +1841,7 @@ yyparse (void) yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. + `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1640,84 +1855,75 @@ yyparse (void) switch (yyn) { case 2: -#line 236 "ncgen.y" /* yacc.c:1646 */ - {if (error_count > 0) YYABORT;} -#line 1646 "ncgeny.c" /* yacc.c:1646 */ +#line 236 "ncgen.y" + {if (error_count > 0) YYABORT;;} break; case 3: -#line 239 "ncgen.y" /* yacc.c:1646 */ - {createrootgroup(datasetname);} -#line 1652 "ncgeny.c" /* yacc.c:1646 */ +#line 239 "ncgen.y" + {createrootgroup(datasetname);;} break; case 8: -#line 258 "ncgen.y" /* yacc.c:1646 */ +#line 258 "ncgen.y" { - Symbol* id = (yyvsp[-1].sym); + Symbol* id = (yyvsp[(2) - (3)].sym); markcdf4("Group specification"); if(creategroup(id) == NULL) yyerror("duplicate group declaration within parent group for %s", id->name); - } -#line 1664 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 9: -#line 267 "ncgen.y" /* yacc.c:1646 */ - {listpop(groupstack);} -#line 1670 "ncgeny.c" /* yacc.c:1646 */ +#line 267 "ncgen.y" + {listpop(groupstack);;} break; case 12: -#line 273 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1676 "ncgeny.c" /* yacc.c:1646 */ +#line 273 "ncgen.y" + {;} break; case 13: -#line 275 "ncgen.y" /* yacc.c:1646 */ - {markcdf4("Type specification");} -#line 1682 "ncgeny.c" /* yacc.c:1646 */ +#line 275 "ncgen.y" + {markcdf4("Type specification");;} break; case 16: -#line 281 "ncgen.y" /* yacc.c:1646 */ +#line 281 "ncgen.y" { /* Use when defining a type */ - (yyvsp[0].sym)->objectclass = NC_TYPE; - if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym))) + (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE; + if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym))) yyerror("duplicate type declaration for %s", - (yyvsp[0].sym)->name); - listpush(typdefs,(void*)(yyvsp[0].sym)); - } -#line 1694 "ncgeny.c" /* yacc.c:1646 */ + (yyvsp[(1) - (1)].sym)->name); + listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym)); + ;} break; case 17: -#line 290 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1700 "ncgeny.c" /* yacc.c:1646 */ +#line 290 "ncgen.y" + {;} break; case 18: -#line 290 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1706 "ncgeny.c" /* yacc.c:1646 */ +#line 290 "ncgen.y" + {;} break; case 25: -#line 304 "ncgen.y" /* yacc.c:1646 */ +#line 304 "ncgen.y" { int i; - addtogroup((yyvsp[-3].sym)); /* sets prefix*/ - (yyvsp[-3].sym)->objectclass=NC_TYPE; - (yyvsp[-3].sym)->subclass=NC_ENUM; - (yyvsp[-3].sym)->typ.basetype=(yyvsp[-5].sym); - (yyvsp[-3].sym)->typ.size = (yyvsp[-5].sym)->typ.size; - (yyvsp[-3].sym)->typ.alignment = (yyvsp[-5].sym)->typ.alignment; - stackbase=(yyvsp[-1].mark); + addtogroup((yyvsp[(3) - (6)].sym)); /* sets prefix*/ + (yyvsp[(3) - (6)].sym)->objectclass=NC_TYPE; + (yyvsp[(3) - (6)].sym)->subclass=NC_ENUM; + (yyvsp[(3) - (6)].sym)->typ.basetype=(yyvsp[(1) - (6)].sym); + (yyvsp[(3) - (6)].sym)->typ.size = (yyvsp[(1) - (6)].sym)->typ.size; + (yyvsp[(3) - (6)].sym)->typ.alignment = (yyvsp[(1) - (6)].sym)->typ.alignment; + stackbase=(yyvsp[(5) - (6)].mark); stacklen=listlength(stack); - (yyvsp[-3].sym)->subnodes = listnew(); + (yyvsp[(3) - (6)].sym)->subnodes = listnew(); /* Variety of field fixups*/ /* 1. add in the enum values*/ /* 2. make this type be their container*/ @@ -1727,89 +1933,83 @@ yyparse (void) Symbol* eid = (Symbol*)listget(stack,i); assert(eid->subclass == NC_ECONST); addtogroup(eid); - listpush((yyvsp[-3].sym)->subnodes,(void*)eid); - eid->container = (yyvsp[-3].sym); - eid->typ.basetype = (yyvsp[-3].sym)->typ.basetype; + listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid); + eid->container = (yyvsp[(3) - (6)].sym); + eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype; } listsetlength(stack,stackbase);/* remove stack nodes*/ - } -#line 1737 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 26: -#line 333 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 1743 "ncgeny.c" /* yacc.c:1646 */ +#line 333 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} break; case 27: -#line 335 "ncgen.y" /* yacc.c:1646 */ +#line 335 "ncgen.y" { int i; - (yyval.mark)=(yyvsp[-2].mark); + (yyval.mark)=(yyvsp[(1) - (3)].mark); /* check for duplicates*/ - stackbase=(yyvsp[-2].mark); + stackbase=(yyvsp[(1) - (3)].mark); stacklen=listlength(stack); for(i=stackbase;iname,elem->name)==0) + if(strcmp((yyvsp[(3) - (3)].sym)->name,elem->name)==0) yyerror("duplicate enum declaration for %s", elem->name); } - listpush(stack,(void*)(yyvsp[0].sym)); - } -#line 1762 "ncgeny.c" /* yacc.c:1646 */ + listpush(stack,(void*)(yyvsp[(3) - (3)].sym)); + ;} break; case 28: -#line 352 "ncgen.y" /* yacc.c:1646 */ +#line 352 "ncgen.y" { - (yyvsp[-2].sym)->objectclass=NC_TYPE; - (yyvsp[-2].sym)->subclass=NC_ECONST; - (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant); - (yyval.sym)=(yyvsp[-2].sym); - } -#line 1773 "ncgeny.c" /* yacc.c:1646 */ + (yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE; + (yyvsp[(1) - (3)].sym)->subclass=NC_ECONST; + (yyvsp[(1) - (3)].sym)->typ.econst=(yyvsp[(3) - (3)].constant); + (yyval.sym)=(yyvsp[(1) - (3)].sym); + ;} break; case 29: -#line 361 "ncgen.y" /* yacc.c:1646 */ +#line 361 "ncgen.y" { vercheck(NC_OPAQUE); - addtogroup((yyvsp[0].sym)); /*sets prefix*/ - (yyvsp[0].sym)->objectclass=NC_TYPE; - (yyvsp[0].sym)->subclass=NC_OPAQUE; - (yyvsp[0].sym)->typ.typecode=NC_OPAQUE; - (yyvsp[0].sym)->typ.size=int32_val; - (yyvsp[0].sym)->typ.alignment=ncaux_class_alignment(NC_OPAQUE); - } -#line 1787 "ncgeny.c" /* yacc.c:1646 */ + addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/ + (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE; + (yyvsp[(5) - (5)].sym)->subclass=NC_OPAQUE; + (yyvsp[(5) - (5)].sym)->typ.typecode=NC_OPAQUE; + (yyvsp[(5) - (5)].sym)->typ.size=int32_val; + (yyvsp[(5) - (5)].sym)->typ.alignment=ncaux_class_alignment(NC_OPAQUE); + ;} break; case 30: -#line 373 "ncgen.y" /* yacc.c:1646 */ +#line 373 "ncgen.y" { - Symbol* basetype = (yyvsp[-4].sym); + Symbol* basetype = (yyvsp[(1) - (5)].sym); vercheck(NC_VLEN); - addtogroup((yyvsp[0].sym)); /*sets prefix*/ - (yyvsp[0].sym)->objectclass=NC_TYPE; - (yyvsp[0].sym)->subclass=NC_VLEN; - (yyvsp[0].sym)->typ.basetype=basetype; - (yyvsp[0].sym)->typ.typecode=NC_VLEN; - (yyvsp[0].sym)->typ.size=VLENSIZE; - (yyvsp[0].sym)->typ.alignment=ncaux_class_alignment(NC_VLEN); - } -#line 1803 "ncgeny.c" /* yacc.c:1646 */ + addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/ + (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE; + (yyvsp[(5) - (5)].sym)->subclass=NC_VLEN; + (yyvsp[(5) - (5)].sym)->typ.basetype=basetype; + (yyvsp[(5) - (5)].sym)->typ.typecode=NC_VLEN; + (yyvsp[(5) - (5)].sym)->typ.size=VLENSIZE; + (yyvsp[(5) - (5)].sym)->typ.alignment=ncaux_class_alignment(NC_VLEN); + ;} break; case 31: -#line 387 "ncgen.y" /* yacc.c:1646 */ +#line 387 "ncgen.y" { int i,j; vercheck(NC_COMPOUND); - addtogroup((yyvsp[-3].sym)); + addtogroup((yyvsp[(2) - (5)].sym)); /* check for duplicate field names*/ - stackbase=(yyvsp[-1].mark); + stackbase=(yyvsp[(4) - (5)].mark); stacklen=listlength(stack); for(i=stackbase;iobjectclass=NC_TYPE; - (yyvsp[-3].sym)->subclass=NC_COMPOUND; - (yyvsp[-3].sym)->typ.basetype=NULL; - (yyvsp[-3].sym)->typ.typecode=NC_COMPOUND; - (yyvsp[-3].sym)->subnodes = listnew(); + (yyvsp[(2) - (5)].sym)->objectclass=NC_TYPE; + (yyvsp[(2) - (5)].sym)->subclass=NC_COMPOUND; + (yyvsp[(2) - (5)].sym)->typ.basetype=NULL; + (yyvsp[(2) - (5)].sym)->typ.typecode=NC_COMPOUND; + (yyvsp[(2) - (5)].sym)->subnodes = listnew(); /* Add in the fields*/ for(i=stackbase;icontainer = (yyvsp[-3].sym); - listpush((yyvsp[-3].sym)->subnodes,(void*)fsym); + fsym->container = (yyvsp[(2) - (5)].sym); + listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym); } listsetlength(stack,stackbase);/* remove stack nodes*/ - } -#line 1837 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 32: -#line 419 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 1843 "ncgeny.c" /* yacc.c:1646 */ +#line 419 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (2)].mark);;} break; case 33: -#line 420 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark);} -#line 1849 "ncgeny.c" /* yacc.c:1646 */ +#line 420 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark);;} break; case 34: -#line 424 "ncgen.y" /* yacc.c:1646 */ +#line 424 "ncgen.y" { int i; - (yyval.mark)=(yyvsp[0].mark); - stackbase=(yyvsp[0].mark); + (yyval.mark)=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[(2) - (2)].mark); stacklen=listlength(stack); /* process each field in the fieldlist*/ for(i=stackbase;ityp.basetype = (yyvsp[-1].sym); + f->typ.basetype = (yyvsp[(1) - (2)].sym); } - } -#line 1865 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 35: -#line 437 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_CHAR]; } -#line 1871 "ncgeny.c" /* yacc.c:1646 */ +#line 437 "ncgen.y" + { (yyval.sym) = primsymbols[NC_CHAR]; ;} break; case 36: -#line 438 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_BYTE]; } -#line 1877 "ncgeny.c" /* yacc.c:1646 */ +#line 438 "ncgen.y" + { (yyval.sym) = primsymbols[NC_BYTE]; ;} break; case 37: -#line 439 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_SHORT]; } -#line 1883 "ncgeny.c" /* yacc.c:1646 */ +#line 439 "ncgen.y" + { (yyval.sym) = primsymbols[NC_SHORT]; ;} break; case 38: -#line 440 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_INT]; } -#line 1889 "ncgeny.c" /* yacc.c:1646 */ +#line 440 "ncgen.y" + { (yyval.sym) = primsymbols[NC_INT]; ;} break; case 39: -#line 441 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_FLOAT]; } -#line 1895 "ncgeny.c" /* yacc.c:1646 */ +#line 441 "ncgen.y" + { (yyval.sym) = primsymbols[NC_FLOAT]; ;} break; case 40: -#line 442 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_DOUBLE]; } -#line 1901 "ncgeny.c" /* yacc.c:1646 */ +#line 442 "ncgen.y" + { (yyval.sym) = primsymbols[NC_DOUBLE]; ;} break; case 41: -#line 443 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } -#line 1907 "ncgeny.c" /* yacc.c:1646 */ +#line 443 "ncgen.y" + { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; ;} break; case 42: -#line 444 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } -#line 1913 "ncgeny.c" /* yacc.c:1646 */ +#line 444 "ncgen.y" + { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; ;} break; case 43: -#line 445 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } -#line 1919 "ncgeny.c" /* yacc.c:1646 */ +#line 445 "ncgen.y" + { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; ;} break; case 44: -#line 446 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } -#line 1925 "ncgeny.c" /* yacc.c:1646 */ +#line 446 "ncgen.y" + { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; ;} break; case 45: -#line 447 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } -#line 1931 "ncgeny.c" /* yacc.c:1646 */ +#line 447 "ncgen.y" + { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; ;} break; case 46: -#line 448 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; } -#line 1937 "ncgeny.c" /* yacc.c:1646 */ +#line 448 "ncgen.y" + { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; ;} break; case 48: -#line 452 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1943 "ncgeny.c" /* yacc.c:1646 */ +#line 452 "ncgen.y" + {;} break; case 49: -#line 453 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1949 "ncgeny.c" /* yacc.c:1646 */ +#line 453 "ncgen.y" + {;} break; case 52: -#line 460 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1955 "ncgeny.c" /* yacc.c:1646 */ +#line 460 "ncgen.y" + {;} break; case 53: -#line 460 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1961 "ncgeny.c" /* yacc.c:1646 */ +#line 460 "ncgen.y" + {;} break; case 56: -#line 468 "ncgen.y" /* yacc.c:1646 */ +#line 468 "ncgen.y" { - (yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant)); + (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)extractint((yyvsp[(3) - (3)].constant)); #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize); +fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long long)(yyvsp[(1) - (3)].sym)->dim.declsize); #endif - reclaimconstant((yyvsp[0].constant)); - } -#line 1973 "ncgeny.c" /* yacc.c:1646 */ + reclaimconstant((yyvsp[(3) - (3)].constant)); + ;} break; case 57: -#line 476 "ncgen.y" /* yacc.c:1646 */ +#line 476 "ncgen.y" { - (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED; - (yyvsp[-2].sym)->dim.isunlimited = 1; + (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED; + (yyvsp[(1) - (3)].sym)->dim.isunlimited = 1; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); +fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); #endif - } -#line 1985 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 58: -#line 486 "ncgen.y" /* yacc.c:1646 */ +#line 486 "ncgen.y" { - (yyvsp[0].sym)->objectclass=NC_DIM; - if(dupobjectcheck(NC_DIM,(yyvsp[0].sym))) + (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM; + if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym))) yyerror( "Duplicate dimension declaration for %s", - (yyvsp[0].sym)->name); - addtogroup((yyvsp[0].sym)); - (yyval.sym)=(yyvsp[0].sym); - listpush(dimdefs,(void*)(yyvsp[0].sym)); - } -#line 1999 "ncgeny.c" /* yacc.c:1646 */ + (yyvsp[(1) - (1)].sym)->name); + addtogroup((yyvsp[(1) - (1)].sym)); + (yyval.sym)=(yyvsp[(1) - (1)].sym); + listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym)); + ;} break; case 60: -#line 498 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2005 "ncgeny.c" /* yacc.c:1646 */ +#line 498 "ncgen.y" + {;} break; case 61: -#line 499 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2011 "ncgeny.c" /* yacc.c:1646 */ +#line 499 "ncgen.y" + {;} break; case 64: -#line 506 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2017 "ncgeny.c" /* yacc.c:1646 */ +#line 506 "ncgen.y" + {;} break; case 65: -#line 506 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2023 "ncgeny.c" /* yacc.c:1646 */ +#line 506 "ncgen.y" + {;} break; case 66: -#line 509 "ncgen.y" /* yacc.c:1646 */ +#line 509 "ncgen.y" { int i; - stackbase=(yyvsp[0].mark); + stackbase=(yyvsp[(2) - (2)].mark); stacklen=listlength(stack); /* process each variable in the varlist*/ for(i=stackbase;iname); yyerror("Duplicate variable declaration for %s", sym->name); } else { - sym->typ.basetype = (yyvsp[-1].sym); + sym->typ.basetype = (yyvsp[(1) - (2)].sym); addtogroup(sym); listpush(vardefs,(void*)sym); } } listsetlength(stack,stackbase);/* remove stack nodes*/ - } -#line 2047 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 67: -#line 531 "ncgen.y" /* yacc.c:1646 */ +#line 531 "ncgen.y" {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[0].sym)); - } -#line 2055 "ncgeny.c" /* yacc.c:1646 */ + listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); + ;} break; case 68: -#line 535 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2061 "ncgeny.c" /* yacc.c:1646 */ +#line 535 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} break; case 69: -#line 539 "ncgen.y" /* yacc.c:1646 */ +#line 539 "ncgen.y" { int i; Dimset dimset; - Symbol* var = (yyvsp[-1].sym); /* for debugging */ + Symbol* var = (yyvsp[(1) - (2)].sym); /* for debugging */ stacklen=listlength(stack); - stackbase=(yyvsp[0].mark); + stackbase=(yyvsp[(2) - (2)].mark); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2087,73 +2257,65 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); var->objectclass=NC_VAR; listsetlength(stack,stackbase);/* remove stack nodes*/ (yyval.sym) = var; - } -#line 2092 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 70: -#line 567 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack);} -#line 2098 "ncgeny.c" /* yacc.c:1646 */ +#line 567 "ncgen.y" + {(yyval.mark)=listlength(stack);;} break; case 71: -#line 568 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 2104 "ncgeny.c" /* yacc.c:1646 */ +#line 568 "ncgen.y" + {(yyval.mark)=(yyvsp[(2) - (3)].mark);;} break; case 72: -#line 571 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2110 "ncgeny.c" /* yacc.c:1646 */ +#line 571 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} break; case 73: -#line 573 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2116 "ncgeny.c" /* yacc.c:1646 */ +#line 573 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} break; case 74: -#line 577 "ncgen.y" /* yacc.c:1646 */ - {Symbol* dimsym = (yyvsp[0].sym); +#line 577 "ncgen.y" + {Symbol* dimsym = (yyvsp[(1) - (1)].sym); dimsym->objectclass = NC_DIM; /* Find the actual dimension*/ dimsym = locate(dimsym); if(dimsym == NULL) { - derror("Undefined or forward referenced dimension: %s",(yyvsp[0].sym)->name); + derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name); YYABORT; } (yyval.sym)=dimsym; - } -#line 2131 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 75: -#line 591 "ncgen.y" /* yacc.c:1646 */ +#line 591 "ncgen.y" {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[0].sym)); - } -#line 2139 "ncgeny.c" /* yacc.c:1646 */ + listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); + ;} break; case 76: -#line 595 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2145 "ncgeny.c" /* yacc.c:1646 */ +#line 595 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} break; case 77: -#line 600 "ncgen.y" /* yacc.c:1646 */ +#line 600 "ncgen.y" { int i; Dimset dimset; - stackbase=(yyvsp[0].mark); + stackbase=(yyvsp[(2) - (2)].mark); stacklen=listlength(stack); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2164,43 +2326,38 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); Symbol* dsym = (Symbol*)listget(stack,stackbase+i); dimset.dimsyms[i] = dsym; } - (yyvsp[-1].sym)->typ.dimset = dimset; + (yyvsp[(1) - (2)].sym)->typ.dimset = dimset; } - (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/ - (yyvsp[-1].sym)->objectclass=NC_TYPE; - (yyvsp[-1].sym)->subclass=NC_FIELD; + (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/ + (yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE; + (yyvsp[(1) - (2)].sym)->subclass=NC_FIELD; listsetlength(stack,stackbase);/* remove stack nodes*/ - (yyval.sym) = (yyvsp[-1].sym); - } -#line 2176 "ncgeny.c" /* yacc.c:1646 */ + (yyval.sym) = (yyvsp[(1) - (2)].sym); + ;} break; case 78: -#line 628 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack);} -#line 2182 "ncgeny.c" /* yacc.c:1646 */ +#line 628 "ncgen.y" + {(yyval.mark)=listlength(stack);;} break; case 79: -#line 629 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 2188 "ncgeny.c" /* yacc.c:1646 */ +#line 629 "ncgen.y" + {(yyval.mark)=(yyvsp[(2) - (3)].mark);;} break; case 80: -#line 633 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2194 "ncgeny.c" /* yacc.c:1646 */ +#line 633 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} break; case 81: -#line 635 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2200 "ncgeny.c" /* yacc.c:1646 */ +#line 635 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} break; case 82: -#line 640 "ncgen.y" /* yacc.c:1646 */ +#line 640 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2209,12 +2366,11 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)->objectclass = NC_DIM; (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = uint32_val; - } -#line 2214 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 83: -#line 650 "ncgen.y" /* yacc.c:1646 */ +#line 650 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2227,37 +2383,34 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)->objectclass = NC_DIM; (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = int32_val; - } -#line 2232 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 84: -#line 670 "ncgen.y" /* yacc.c:1646 */ - {Symbol* vsym = (yyvsp[0].sym); +#line 670 "ncgen.y" + {Symbol* vsym = (yyvsp[(1) - (1)].sym); if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); YYABORT; } (yyval.sym)=vsym; - } -#line 2244 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 85: -#line 681 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tsym = (yyvsp[0].sym); +#line 681 "ncgen.y" + {Symbol* tsym = (yyvsp[(1) - (1)].sym); if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); YYABORT; } (yyval.sym)=tsym; - } -#line 2256 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 86: -#line 692 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; +#line 692 "ncgen.y" + {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym; /* disambiguate*/ tvsym->objectclass = NC_VAR; sym = locate(tvsym); @@ -2265,438 +2418,364 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); tvsym->objectclass = NC_TYPE; sym = locate(tvsym); if(tvsym == NULL) { - derror("Undefined or forward referenced name: %s",(yyvsp[0].sym)->name); + derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name); YYABORT; } else tvsym = sym; } else tvsym = sym; if(tvsym == NULL) { - derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name); + derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name); YYABORT; } (yyval.sym)=tvsym; - } -#line 2279 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 87: -#line 710 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2285 "ncgeny.c" /* yacc.c:1646 */ +#line 710 "ncgen.y" + {(yyval.sym)=(yyvsp[(1) - (1)].sym);;} break; case 88: -#line 717 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2291 "ncgeny.c" /* yacc.c:1646 */ +#line 717 "ncgen.y" + {;} break; case 89: -#line 717 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2297 "ncgeny.c" /* yacc.c:1646 */ +#line 717 "ncgen.y" + {;} break; case 90: -#line 721 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2303 "ncgeny.c" /* yacc.c:1646 */ +#line 721 "ncgen.y" + {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} break; case 91: -#line 723 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2309 "ncgeny.c" /* yacc.c:1646 */ +#line 723 "ncgen.y" + {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} break; case 92: -#line 725 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2315 "ncgeny.c" /* yacc.c:1646 */ +#line 725 "ncgen.y" + {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} break; case 93: -#line 727 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} -#line 2321 "ncgeny.c" /* yacc.c:1646 */ +#line 727 "ncgen.y" + { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);;} break; case 94: -#line 729 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); +#line 729 "ncgen.y" + {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym); if(vsym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR); } else { derror("Doubly typed attribute: %s",asym->name); YYABORT; } - } -#line 2334 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 95: -#line 738 "ncgen.y" /* yacc.c:1646 */ - {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); +#line 738 "ncgen.y" + {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym); if(sym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR); } else if(sym->objectclass == NC_TYPE) { - (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[0].datalist),ATTRGLOBAL); + (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL); } else { derror("Attribute prefix not a variable or type: %s",asym->name); YYABORT; } - } -#line 2349 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 96: -#line 749 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} -#line 2355 "ncgeny.c" /* yacc.c:1646 */ +#line 749 "ncgen.y" + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),ISLIST);;} break; case 97: -#line 751 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),ISLIST);} -#line 2361 "ncgeny.c" /* yacc.c:1646 */ +#line 751 "ncgen.y" + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),ISLIST);;} break; case 98: -#line 753 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2367 "ncgeny.c" /* yacc.c:1646 */ +#line 753 "ncgen.y" + {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 99: -#line 755 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} -#line 2373 "ncgeny.c" /* yacc.c:1646 */ +#line 755 "ncgen.y" + {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),ISLIST);;} break; case 100: -#line 757 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2379 "ncgeny.c" /* yacc.c:1646 */ +#line 757 "ncgen.y" + {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 101: -#line 759 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2385 "ncgeny.c" /* yacc.c:1646 */ +#line 759 "ncgen.y" + {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 102: -#line 761 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2391 "ncgeny.c" /* yacc.c:1646 */ +#line 761 "ncgen.y" + {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 103: -#line 763 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2397 "ncgeny.c" /* yacc.c:1646 */ +#line 763 "ncgen.y" + {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 104: -#line 765 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2403 "ncgeny.c" /* yacc.c:1646 */ +#line 765 "ncgen.y" + {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 105: -#line 767 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2409 "ncgeny.c" /* yacc.c:1646 */ +#line 767 "ncgen.y" + {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].constant),ISCONST);;} break; case 106: -#line 769 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2415 "ncgeny.c" /* yacc.c:1646 */ +#line 769 "ncgen.y" + {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[(4) - (4)].constant),ISCONST);;} break; case 107: -#line 774 "ncgen.y" /* yacc.c:1646 */ +#line 774 "ncgen.y" { - (yyval.sym)=(yyvsp[0].sym); - (yyvsp[0].sym)->ref.is_ref=1; - (yyvsp[0].sym)->is_prefixed=0; - setpathcurrent((yyvsp[0].sym)); - } -#line 2426 "ncgeny.c" /* yacc.c:1646 */ + (yyval.sym)=(yyvsp[(1) - (1)].sym); + (yyvsp[(1) - (1)].sym)->ref.is_ref=1; + (yyvsp[(1) - (1)].sym)->is_prefixed=0; + setpathcurrent((yyvsp[(1) - (1)].sym)); + ;} break; case 108: -#line 781 "ncgen.y" /* yacc.c:1646 */ +#line 781 "ncgen.y" { - (yyval.sym)=(yyvsp[0].sym); - (yyvsp[0].sym)->ref.is_ref=1; - (yyvsp[0].sym)->is_prefixed=1; + (yyval.sym)=(yyvsp[(1) - (1)].sym); + (yyvsp[(1) - (1)].sym)->ref.is_ref=1; + (yyvsp[(1) - (1)].sym)->is_prefixed=1; /* path is set in ncgen.l*/ - } -#line 2437 "ncgeny.c" /* yacc.c:1646 */ + ;} break; case 110: -#line 790 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2443 "ncgeny.c" /* yacc.c:1646 */ +#line 790 "ncgen.y" + {;} break; case 111: -#line 791 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2449 "ncgeny.c" /* yacc.c:1646 */ +#line 791 "ncgen.y" + {;} break; case 114: -#line 799 "ncgen.y" /* yacc.c:1646 */ - {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} -#line 2455 "ncgeny.c" /* yacc.c:1646 */ +#line 799 "ncgen.y" + {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);;} break; case 115: -#line 802 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = (yyvsp[0].datalist);} -#line 2461 "ncgeny.c" /* yacc.c:1646 */ +#line 802 "ncgen.y" + {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;} break; case 116: -#line 803 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = (yyvsp[0].datalist);} -#line 2467 "ncgeny.c" /* yacc.c:1646 */ +#line 803 "ncgen.y" + {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;} break; case 117: -#line 807 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = builddatalist(0);} -#line 2473 "ncgeny.c" /* yacc.c:1646 */ +#line 807 "ncgen.y" + {(yyval.datalist) = builddatalist(0);;} break; case 118: -#line 811 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = const2list((yyvsp[0].constant));} -#line 2479 "ncgeny.c" /* yacc.c:1646 */ +#line 811 "ncgen.y" + {(yyval.datalist) = const2list((yyvsp[(1) - (1)].constant));;} break; case 119: -#line 813 "ncgen.y" /* yacc.c:1646 */ - {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist); } -#line 2485 "ncgeny.c" /* yacc.c:1646 */ +#line 813 "ncgen.y" + {dlappend((yyvsp[(1) - (3)].datalist),((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist); ;} break; case 120: -#line 817 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2491 "ncgeny.c" /* yacc.c:1646 */ +#line 817 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} break; case 121: -#line 818 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} -#line 2497 "ncgeny.c" /* yacc.c:1646 */ +#line 818 "ncgen.y" + {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));;} break; case 122: -#line 822 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2503 "ncgeny.c" /* yacc.c:1646 */ +#line 822 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} break; case 123: -#line 823 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_OPAQUE);} -#line 2509 "ncgeny.c" /* yacc.c:1646 */ +#line 823 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_OPAQUE);;} break; case 124: -#line 824 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_FILLVALUE);} -#line 2515 "ncgeny.c" /* yacc.c:1646 */ +#line 824 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_FILLVALUE);;} break; case 125: -#line 825 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_NIL);} -#line 2521 "ncgeny.c" /* yacc.c:1646 */ +#line 825 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_NIL);;} break; case 126: -#line 826 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2527 "ncgeny.c" /* yacc.c:1646 */ +#line 826 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} break; case 128: -#line 831 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} -#line 2533 "ncgeny.c" /* yacc.c:1646 */ +#line 831 "ncgen.y" + {(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));;} break; case 129: -#line 835 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} -#line 2539 "ncgeny.c" /* yacc.c:1646 */ +#line 835 "ncgen.y" + {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));;} break; case 130: -#line 840 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = const2list((yyvsp[0].constant));} -#line 2545 "ncgeny.c" /* yacc.c:1646 */ +#line 840 "ncgen.y" + {(yyval.datalist) = const2list((yyvsp[(1) - (1)].constant));;} break; case 131: -#line 842 "ncgen.y" /* yacc.c:1646 */ - {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} -#line 2551 "ncgeny.c" /* yacc.c:1646 */ +#line 842 "ncgen.y" + {dlappend((yyvsp[(1) - (3)].datalist),((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;} break; case 132: -#line 846 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_CHAR);} -#line 2557 "ncgeny.c" /* yacc.c:1646 */ +#line 846 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_CHAR);;} break; case 133: -#line 847 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_BYTE);} -#line 2563 "ncgeny.c" /* yacc.c:1646 */ +#line 847 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_BYTE);;} break; case 134: -#line 848 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_SHORT);} -#line 2569 "ncgeny.c" /* yacc.c:1646 */ +#line 848 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_SHORT);;} break; case 135: -#line 849 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT);} -#line 2575 "ncgeny.c" /* yacc.c:1646 */ +#line 849 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT);;} break; case 136: -#line 850 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT64);} -#line 2581 "ncgeny.c" /* yacc.c:1646 */ +#line 850 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT64);;} break; case 137: -#line 851 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UBYTE);} -#line 2587 "ncgeny.c" /* yacc.c:1646 */ +#line 851 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UBYTE);;} break; case 138: -#line 852 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_USHORT);} -#line 2593 "ncgeny.c" /* yacc.c:1646 */ +#line 852 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_USHORT);;} break; case 139: -#line 853 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT);} -#line 2599 "ncgeny.c" /* yacc.c:1646 */ +#line 853 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT);;} break; case 140: -#line 854 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT64);} -#line 2605 "ncgeny.c" /* yacc.c:1646 */ +#line 854 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT64);;} break; case 141: -#line 855 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_FLOAT);} -#line 2611 "ncgeny.c" /* yacc.c:1646 */ +#line 855 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_FLOAT);;} break; case 142: -#line 856 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_DOUBLE);} -#line 2617 "ncgeny.c" /* yacc.c:1646 */ +#line 856 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_DOUBLE);;} break; case 143: -#line 857 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_STRING);} -#line 2623 "ncgeny.c" /* yacc.c:1646 */ +#line 857 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_STRING);;} break; case 144: -#line 861 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = const2list((yyvsp[0].constant));} -#line 2629 "ncgeny.c" /* yacc.c:1646 */ +#line 861 "ncgen.y" + {(yyval.datalist) = const2list((yyvsp[(1) - (1)].constant));;} break; case 145: -#line 862 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist)=(yyvsp[-2].datalist); dlappend((yyvsp[-2].datalist),((yyvsp[0].constant)));} -#line 2635 "ncgeny.c" /* yacc.c:1646 */ +#line 862 "ncgen.y" + {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); dlappend((yyvsp[(1) - (3)].datalist),((yyvsp[(3) - (3)].constant)));;} break; case 146: -#line 867 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT);} -#line 2641 "ncgeny.c" /* yacc.c:1646 */ +#line 867 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT);;} break; case 147: -#line 869 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT);} -#line 2647 "ncgeny.c" /* yacc.c:1646 */ +#line 869 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT);;} break; case 148: -#line 871 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT64);} -#line 2653 "ncgeny.c" /* yacc.c:1646 */ +#line 871 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT64);;} break; case 149: -#line 873 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT64);} -#line 2659 "ncgeny.c" /* yacc.c:1646 */ +#line 873 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT64);;} break; case 150: -#line 877 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_STRING);} -#line 2665 "ncgeny.c" /* yacc.c:1646 */ +#line 877 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_STRING);;} break; case 151: -#line 881 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2671 "ncgeny.c" /* yacc.c:1646 */ +#line 881 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} break; case 152: -#line 882 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2677 "ncgeny.c" /* yacc.c:1646 */ +#line 882 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} break; case 153: -#line 888 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2683 "ncgeny.c" /* yacc.c:1646 */ +#line 888 "ncgen.y" + {(yyval.sym)=(yyvsp[(1) - (1)].sym);;} break; -#line 2687 "ncgeny.c" /* yacc.c:1646 */ +/* Line 1267 of yacc.c. */ +#line 2777 "ncgeny.c" default: break; } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2705,7 +2784,8 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); *++yyvsp = yyval; - /* Now 'shift' the result of the reduction. Determine what state + + /* 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. */ @@ -2720,14 +2800,10 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); goto yynewstate; -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2735,36 +2811,37 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; + 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; + } } -# undef YYSYNTAX_ERROR #endif } @@ -2772,24 +2849,24 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -2805,7 +2882,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule whose action triggered + /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2818,37 +2895,38 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + 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; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2872,7 +2950,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2883,22 +2961,17 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); #endif yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered + if (yychar != YYEOF && 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); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2909,9 +2982,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - return yyresult; + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 891 "ncgen.y" /* yacc.c:1906 */ + + +#line 891 "ncgen.y" #ifndef NO_STDARG @@ -3618,3 +3694,4 @@ printfilters(int nfilters, NC_Filterspec** filters) fflush(stderr); } #endif + diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h index 73e1a5a94b..9f092f3308 100644 --- a/ncgen/ncgeny.h +++ b/ncgen/ncgeny.h @@ -1,13 +1,14 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Bison interface for Yacc-like parsers in C +/* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + 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 + 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. + the Free Software Foundation; either version 2, or (at your option) + any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,7 +16,9 @@ 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 . */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -30,102 +33,143 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED -# define YY_NCG_NCGEN_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int ncgdebug; -#endif - -/* Token type. */ +/* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - enum yytokentype - { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - STRING_K = 270, - IDENT = 271, - TERMSTRING = 272, - CHAR_CONST = 273, - BYTE_CONST = 274, - SHORT_CONST = 275, - INT_CONST = 276, - INT64_CONST = 277, - UBYTE_CONST = 278, - USHORT_CONST = 279, - UINT_CONST = 280, - UINT64_CONST = 281, - FLOAT_CONST = 282, - DOUBLE_CONST = 283, - DIMENSIONS = 284, - VARIABLES = 285, - NETCDF = 286, - DATA = 287, - TYPES = 288, - COMPOUND = 289, - ENUM = 290, - OPAQUE_ = 291, - OPAQUESTRING = 292, - GROUP = 293, - PATH = 294, - FILLMARKER = 295, - NIL = 296, - _FILLVALUE = 297, - _FORMAT = 298, - _STORAGE = 299, - _CHUNKSIZES = 300, - _DEFLATELEVEL = 301, - _SHUFFLE = 302, - _ENDIANNESS = 303, - _NOFILL = 304, - _FLETCHER32 = 305, - _NCPROPS = 306, - _ISNETCDF4 = 307, - _SUPERBLOCK = 308, - _FILTER = 309, - DATASETID = 310 - }; + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NC_UNLIMITED_K = 258, + CHAR_K = 259, + BYTE_K = 260, + SHORT_K = 261, + INT_K = 262, + FLOAT_K = 263, + DOUBLE_K = 264, + UBYTE_K = 265, + USHORT_K = 266, + UINT_K = 267, + INT64_K = 268, + UINT64_K = 269, + STRING_K = 270, + IDENT = 271, + TERMSTRING = 272, + CHAR_CONST = 273, + BYTE_CONST = 274, + SHORT_CONST = 275, + INT_CONST = 276, + INT64_CONST = 277, + UBYTE_CONST = 278, + USHORT_CONST = 279, + UINT_CONST = 280, + UINT64_CONST = 281, + FLOAT_CONST = 282, + DOUBLE_CONST = 283, + DIMENSIONS = 284, + VARIABLES = 285, + NETCDF = 286, + DATA = 287, + TYPES = 288, + COMPOUND = 289, + ENUM = 290, + OPAQUE_ = 291, + OPAQUESTRING = 292, + GROUP = 293, + PATH = 294, + FILLMARKER = 295, + NIL = 296, + _FILLVALUE = 297, + _FORMAT = 298, + _STORAGE = 299, + _CHUNKSIZES = 300, + _DEFLATELEVEL = 301, + _SHUFFLE = 302, + _ENDIANNESS = 303, + _NOFILL = 304, + _FLETCHER32 = 305, + _NCPROPS = 306, + _ISNETCDF4 = 307, + _SUPERBLOCK = 308, + _FILTER = 309, + DATASETID = 310 + }; #endif +/* Tokens. */ +#define NC_UNLIMITED_K 258 +#define CHAR_K 259 +#define BYTE_K 260 +#define SHORT_K 261 +#define INT_K 262 +#define FLOAT_K 263 +#define DOUBLE_K 264 +#define UBYTE_K 265 +#define USHORT_K 266 +#define UINT_K 267 +#define INT64_K 268 +#define UINT64_K 269 +#define STRING_K 270 +#define IDENT 271 +#define TERMSTRING 272 +#define CHAR_CONST 273 +#define BYTE_CONST 274 +#define SHORT_CONST 275 +#define INT_CONST 276 +#define INT64_CONST 277 +#define UBYTE_CONST 278 +#define USHORT_CONST 279 +#define UINT_CONST 280 +#define UINT64_CONST 281 +#define FLOAT_CONST 282 +#define DOUBLE_CONST 283 +#define DIMENSIONS 284 +#define VARIABLES 285 +#define NETCDF 286 +#define DATA 287 +#define TYPES 288 +#define COMPOUND 289 +#define ENUM 290 +#define OPAQUE_ 291 +#define OPAQUESTRING 292 +#define GROUP 293 +#define PATH 294 +#define FILLMARKER 295 +#define NIL 296 +#define _FILLVALUE 297 +#define _FORMAT 298 +#define _STORAGE 299 +#define _CHUNKSIZES 300 +#define _DEFLATELEVEL 301 +#define _SHUFFLE 302 +#define _ENDIANNESS 303 +#define _NOFILL 304 +#define _FLETCHER32 305 +#define _NCPROPS 306 +#define _ISNETCDF4 307 +#define _SUPERBLOCK 308 +#define _FILTER 309 +#define DATASETID 310 + -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -union YYSTYPE -{ -#line 151 "ncgen.y" /* yacc.c:1909 */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 151 "ncgen.y" +{ Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ long mark; /* track indices into the sequence*/ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant* constant; - -#line 119 "ncgeny.h" /* yacc.c:1909 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 1529 of yacc.c. */ +#line 168 "ncgeny.h" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - extern YYSTYPE ncglval; -int ncgparse (void); - -#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */