diff --git a/cf b/cf index 967868beb0..6e66f166e5 100644 --- a/cf +++ b/cf @@ -54,8 +54,7 @@ MALLOC_CHECK="" CPPFLAGS="" LDFLAGS="" -#CFLAGS="-g -O0 $CFLAGS" -CFLAGS="-g $CFLAGS" +CFLAGS="-g -O0 $CFLAGS -Wno-undefined" MAKE=make IGNORE="test 0 = 1" diff --git a/cf.cmake b/cf.cmake index dcb842ba11..8820e0eb36 100644 --- a/cf.cmake +++ b/cf.cmake @@ -1,5 +1,5 @@ # Visual Studio -#VS=1 +VS=1 # Is netcdf-4 and/or DAP enabled? NC4=1 diff --git a/h5_test/tst_h_dimscales.c b/h5_test/tst_h_dimscales.c index b16a1aebfa..73c817d58a 100644 --- a/h5_test/tst_h_dimscales.c +++ b/h5_test/tst_h_dimscales.c @@ -16,7 +16,7 @@ #define STR_LEN 255 #define MAX_DIMS 255 -herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid, +herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid, void *visitor_data) { char name1[STR_LEN], name2[STR_LEN]; @@ -30,9 +30,9 @@ herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid, /* printf("name of dsid: %s\n", name2); */ if (H5Gget_objinfo(did, ".", 1, &statbuf) < 0) ERR; -/* printf("statbuf.fileno = %d statbuf.objno = %d\n", +/* printf("statbuf.fileno = %d statbuf.objno = %d\n", statbuf.fileno, statbuf.objno);*/ - + return 0; } @@ -47,7 +47,7 @@ rec_scan_group(hid_t grpid) int num_scales; hsize_t dims[MAX_DIMS], max_dims[MAX_DIMS]; int ndims, d; - + /* Loop through datasets to find variables. */ if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; for (i=0; i 0) ERR; if (strcmp(obj_name, VAR3_NAME) == 0 && num_scales != 1) ERR; - + /* There's also a label for dimension 0 of var1. */ if (strcmp(obj_name, VAR1_NAME) == 0) { @@ -292,15 +292,15 @@ main() int v; /* Open file and create group. */ - if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, + if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) ERR; if ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR; - + /* Create our dimension scale. Use the built-in NAME attribute * on the dimscale. */ - if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims, + if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims, dimscale_dims)) < 0) ERR; - if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, + if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, dimscale_spaceid, H5P_DEFAULT)) < 0) ERR; if (H5DSset_scale(dimscaleid, NAME_ATTRIBUTE) < 0) ERR; @@ -309,7 +309,7 @@ main() for (v = 0; v < NUM_DATASETS; v++) { sprintf(var_name, "var_%d", v); - if ((var1_datasetid[v] = H5Dcreate(grpid, var_name, H5T_NATIVE_INT, + if ((var1_datasetid[v] = H5Dcreate(grpid, var_name, H5T_NATIVE_INT, var1_spaceid, H5P_DEFAULT)) < 0) ERR; if (H5DSattach_scale(var1_datasetid[v], dimscaleid, 0) < 0) ERR; } @@ -332,7 +332,7 @@ main() hsize_t dims[1] = {1}, maxdims[1] = {H5S_UNLIMITED}; /* Create file and group. */ - if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, + if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) ERR; if ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR; @@ -343,12 +343,12 @@ main() if (H5Pset_chunk(cparmsid, 1, dims) < 0) ERR; /* Create our dimension scale, as an unlimited dataset. */ - if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, + if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, spaceid, cparmsid)) < 0) ERR; if (H5DSset_scale(dimscaleid, NAME_ATTRIBUTE) < 0) ERR; /* Create a variable which uses it. */ - if ((datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT, + if ((datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT, spaceid, cparmsid)) < 0) ERR; if (H5DSattach_scale(datasetid, dimscaleid, 0) < 0) ERR; if (H5DSset_label(datasetid, 0, "dimension label") < 0) ERR; @@ -367,7 +367,7 @@ main() { hid_t fileid, grpid, spaceid = 0, datasetid = 0; - hsize_t num_obj, i; + hsize_t volatile num_obj, i; int obj_class; char obj_name[STR_LEN + 1]; htri_t is_scale; @@ -377,7 +377,7 @@ main() /* Reopen the file and group. */ if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR; if ((grpid = H5Gopen(fileid, GRP_NAME)) < 0) ERR; - + /* Loop through datasets to find variables. */ if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; for (i=0; iocname,node->dodsspecial.dimname); } else node->dodsspecial.dimname = NULL; } else if(strcmp(ocname,"DODS.Unlimited_Dimension")==0 || strcmp(ocname,"DODS_EXTRA.Unlimited_Dimension")==0) { - if(values != NULL) { - if(nccomm->cdf.recorddimname != NULL) + char* val0 = NULL; + if(values != NULL) + val0 = values[0]; + if(val0 != NULL) { + if(nccomm->cdf.recorddimname != NULL) { + if(strcmp(nccomm->cdf.recorddimname,val0)!=0) nclog(NCLOGWARN,"Duplicate DODS_EXTRA:Unlimited_Dimension specifications"); - else + } else { nccomm->cdf.recorddimname = nulldup(values[0]); #ifdef DEBUG fprintf(stderr,"%s.Unlimited_Dimension=%s\n",node->ocname,nccomm->cdf.recorddimname); #endif + } } - } } /* clean up */ @@ -115,7 +119,13 @@ fprintf(stderr,"%s.Unlimited_Dimension=%s\n",node->ocname,nccomm->cdf.recorddimn return THROW(ncstat); } -/* Build an NCattribute */ +/* +Build an NCattribute +from a DAP attribute. +As of Jun 27, 2017, we modify +to suppress nul characters and terminate +the name at the first nul. +*/ static NCerror buildattribute(char* name, nc_type ptype, size_t nvalues, char** values, NCattribute** attp) @@ -130,9 +140,10 @@ buildattribute(char* name, nc_type ptype, att->etype = ptype; att->values = nclistnew(); - for(i=0;ivalues,(void*)nulldup(values[i])); - + for(i=0;ivalues,(void*)copy); + } if(attp) *attp = att; else free(att); @@ -399,14 +410,19 @@ fprintf(stderr,"%s.dimname=%s\n",dds->ocname,dds->dodsspecial.dimname); #endif } else dds->dodsspecial.dimname = NULL; } else if(strcmp(dodsname,"Unlimited_Dimension")==0) { - if(nccomm->cdf.recorddimname != NULL) { - nclog(NCLOGWARN,"Duplicate DODS_EXTRA:Unlimited_Dimension specifications"); - } else if(nclistlength(stringvalues) > 0) { - char* stringval = (char*)nclistget(stringvalues,0); - nccomm->cdf.recorddimname = nulldup(stringval); + char* stringval = NULL; + if(nclistlength(stringvalues) > 0) + stringval = (char*)nclistget(stringvalues,0); + if(stringval != NULL) { + if(nccomm->cdf.recorddimname != NULL) { + if(strcmp(stringval,nccomm->cdf.recorddimname) != 0) + nclog(NCLOGWARN,"Duplicate DODS_EXTRA:Unlimited_Dimension specifications"); + } else { + nccomm->cdf.recorddimname = nulldup(stringval); #ifdef DEBUG fprintf(stderr,"%s.Unlimited_Dimension=%s\n",dds->ocname,nccomm->cdf.recorddimname); #endif + } } } /* else ignore */ nullfree(dodsname); diff --git a/libdap2/dapdebug.c b/libdap2/dapdebug.c index 558b6533a3..e8e4760042 100644 --- a/libdap2/dapdebug.c +++ b/libdap2/dapdebug.c @@ -14,7 +14,10 @@ int ncdap3debug = 0; #ifdef CATCHERROR /* Place breakpoint here to catch errors close to where they occur*/ int -dapbreakpoint(int err) {return err;} +dapbreakpoint(int err) +{ + return err; +} int dapthrow(int err) diff --git a/libdap2/nccommon.h b/libdap2/nccommon.h index 2f123767ac..5fc5e6e584 100644 --- a/libdap2/nccommon.h +++ b/libdap2/nccommon.h @@ -112,6 +112,7 @@ typedef struct NCCDF { size_t smallsizelimit; /* what constitutes a small object? */ size_t totalestimatedsize; const char* separator; /* constant; do not free */ + /* Following fields should be set from the unconstrained dds only */ /* global string dimension */ struct CDFnode* globalstringdim; char* recorddimname; /* From DODS_EXTRA */ diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c index cfd50405fb..53ba6b2b49 100644 --- a/libdap2/ncd2dispatch.c +++ b/libdap2/ncd2dispatch.c @@ -6,6 +6,9 @@ #include "dapincludes.h" #include "ncd2dispatch.h" #include "ncoffsets.h" +#ifdef DEBUG2 +#include "dapdump.h" +#endif #ifdef _MSC_VER #include @@ -2020,7 +2023,7 @@ fetchpatternmetadata(NCDAPCOMMON* dapcomm) if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;} } -#ifdef DEBUG +#ifdef DEBUG2 fprintf(stderr,"full pattern:\n%s",dumptree(dapcomm->cdf.fullddsroot)); #endif @@ -2061,7 +2064,7 @@ fetchconstrainedmetadata(NCDAPCOMMON* dapcomm) if(ncstat) goto fail; } -#ifdef DEBUG +#ifdef DEBUG2 fprintf(stderr,"constrained:\n%s",dumptree(dapcomm->cdf.ddsroot)); #endif @@ -2071,7 +2074,6 @@ fprintf(stderr,"constrained:\n%s",dumptree(dapcomm->cdf.ddsroot)); dapcomm->oc.ocdasroot); if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto fail;} } - /* map the constrained DDS to the unconstrained DDS */ ncstat = mapnodes(dapcomm->cdf.ddsroot,dapcomm->cdf.fullddsroot); if(ncstat) goto fail; diff --git a/libdispatch/dutf8.c b/libdispatch/dutf8.c index 0ff99de489..08bea64ee3 100644 --- a/libdispatch/dutf8.c +++ b/libdispatch/dutf8.c @@ -4,6 +4,12 @@ */ #include "config.h" +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif #include "netcdf.h" #include "ncutf8.h" #include "utf8proc.h" @@ -23,13 +29,13 @@ int nc_utf8_validate(const unsigned char* name) { int ncstat = NC_NOERR; const nc_utf8proc_uint8_t *str; - nc_utf8proc_ssize_t strlen = -1; + nc_utf8proc_ssize_t nchars = -1; nc_utf8proc_int32_t codepoint; nc_utf8proc_ssize_t count; str = (const nc_utf8proc_uint8_t*)name; while(*str) { - count = nc_utf8proc_iterate(str,strlen,&codepoint); + count = nc_utf8proc_iterate(str,nchars,&codepoint); if(count < 0) { switch (count) { case UTF8PROC_ERROR_NOMEM: @@ -94,3 +100,73 @@ nc_utf8_normalize(const unsigned char* utf8, unsigned char** normalp) done: return ncstat; } + +/* + * Convert a normalized utf8 string to utf16. This is approximate + * because it just does the truncation version of conversion for + * each 32-bit codepoint to get the corresponding utf16. + * Return codes: + * NC_NOERR -- success + * NC_ENOMEM -- out of memory + * NC_EINVAL -- invalid argument or internal error + * NC_EBADNAME-- not valid utf16 + */ + +int nc_utf8_to_utf16(const unsigned char* s8, unsigned short** utf16p, size_t* len16p) +{ + int ncstat = NC_NOERR; + const nc_utf8proc_uint8_t *str; + nc_utf8proc_ssize_t nchars = -1; + nc_utf8proc_int32_t codepoint; + nc_utf8proc_ssize_t count; + size_t len8, len16; + unsigned short* utf16; + unsigned short* p16; + + len8 = strlen((char*)s8); + utf16 = (unsigned short*)malloc(sizeof(unsigned short)*(len8+1)); + if(utf16 == NULL) { + ncstat = NC_ENOMEM; + goto done; + } + str = (const nc_utf8proc_uint8_t*)s8; + /* Walk the string and convert each codepoint */ + p16 = utf16; + len16 = 0; + while(*str) { + count = nc_utf8proc_iterate(str,nchars,&codepoint); + if(count < 0) { + switch (count) { + case UTF8PROC_ERROR_NOMEM: + case UTF8PROC_ERROR_OVERFLOW: + ncstat = NC_ENOMEM; + break; + case UTF8PROC_ERROR_INVALIDOPTS: + ncstat = NC_EINVAL; + break; + case UTF8PROC_ERROR_INVALIDUTF8: + case UTF8PROC_ERROR_NOTASSIGNED: + default: + ncstat = NC_EBADNAME; + break; + } + goto done; + } else { /* move to next char */ + /* Complain if top 16 bits not zero */ + if((codepoint & 0x0000FFFF) != 0) { + ncstat = NC_EBADNAME; + goto done; + } + /* Truncate codepoint to 16 bits and store */ + *p16++ = (unsigned short)(codepoint & 0x0000FFFF); + str += count; + len16++; + } + } + *p16++ = (unsigned short)0; + if(utf16p) *utf16p = utf16; + if(len16p) *len16p = len16; +done: + if(ncstat) free(utf16); + return ncstat; +} diff --git a/libdispatch/utf8proc.h b/libdispatch/utf8proc.h index cee9882644..ceea425a73 100644 --- a/libdispatch/utf8proc.h +++ b/libdispatch/utf8proc.h @@ -77,6 +77,7 @@ /** @} */ #include +#include "ncexternl.h" #if defined(_MSC_VER) && _MSC_VER < 1800 // MSVC prior to 2013 lacked stdbool.h and inttypes.h @@ -120,20 +121,6 @@ typedef bool nc_utf8proc_bool; #endif #include -#ifndef UTF8PROC_EXPORTS -#ifdef _WIN32 -# ifdef UTF8PROC_EXPORTS -# define UTF8PROC_DLLEXPORT __declspec(dllexport) -# else -# define UTF8PROC_DLLEXPORT __declspec(dllimport) -# endif -#elif __GNUC__ >= 4 -# define UTF8PROC_DLLEXPORT __attribute__ ((visibility("default"))) -#else -# define UTF8PROC_DLLEXPORT -#endif -#endif - #ifdef __cplusplus extern "C" { #endif @@ -418,7 +405,7 @@ const char *nc_utf8proc_errmsg(nc_utf8proc_ssize_t errcode); * In case of success, the number of bytes read is returned; otherwise, a * negative error code is returned. */ -UTF8PROC_DLLEXPORT nc_utf8proc_ssize_t nc_utf8proc_iterate(const nc_utf8proc_uint8_t *str, nc_utf8proc_ssize_t strlen, nc_utf8proc_int32_t *codepoint_ref); +EXTERNL nc_utf8proc_ssize_t nc_utf8proc_iterate(const nc_utf8proc_uint8_t *str, nc_utf8proc_ssize_t strlen, nc_utf8proc_int32_t *codepoint_ref); /** * Check if a codepoint is valid (regardless of whether it has been @@ -685,13 +672,13 @@ nc_utf8proc_ssize_t nc_utf8proc_map_custom( */ /** @{ */ /** NFD normalization (@ref UTF8PROC_DECOMPOSE). */ -UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFD(const nc_utf8proc_uint8_t *str); +EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFD(const nc_utf8proc_uint8_t *str); /** NFC normalization (@ref UTF8PROC_COMPOSE). */ -UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFC(const nc_utf8proc_uint8_t *str); +EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFC(const nc_utf8proc_uint8_t *str); /** NFKD normalization (@ref UTF8PROC_DECOMPOSE and @ref UTF8PROC_COMPAT). */ -UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFKD(const nc_utf8proc_uint8_t *str); +EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFKD(const nc_utf8proc_uint8_t *str); /** NFKC normalization (@ref UTF8PROC_COMPOSE and @ref UTF8PROC_COMPAT). */ -UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFKC(const nc_utf8proc_uint8_t *str); +EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFKC(const nc_utf8proc_uint8_t *str); /** @} */ #ifdef __cplusplus diff --git a/libsrc/ncx.m4 b/libsrc/ncx.m4 index 219e145924..319cdb3e04 100644 --- a/libsrc/ncx.m4 +++ b/libsrc/ncx.m4 @@ -999,7 +999,11 @@ get_ix_int(const void *xp, ix_int *ip) { const uchar *cp = (const uchar *) xp; +#if INT_MAX >= X_INT_MAX + *ip = (ix_int)((unsigned)(*cp++) << 24); +#else *ip = *cp++ << 24; +#endif #if SIZEOF_IX_INT > X_SIZEOF_INT if (*ip & 0x80000000) { @@ -2196,7 +2200,7 @@ APIPrefix`x_get_size_t'(const void **xpp, size_t *ulp) /* similar to get_ix_int */ const uchar *cp = (const uchar *) *xpp; - *ulp = (unsigned)(*cp++ << 24); + *ulp = (unsigned)(*cp++) << 24; *ulp |= (*cp++ << 16); *ulp |= (*cp++ << 8); *ulp |= *cp; diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index 45c795b050..b6564f1fc1 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -172,6 +172,7 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) done: if(text != NULL) { free(text); + text = NULL; } if(attid >= 0) HCHECK((H5Aclose(attid))); diff --git a/ncdap_test/expected3/123.nc.dmp b/ncdap_test/expected3/123.nc.dmp index 84ba36a848..448818ae78 100644 --- a/ncdap_test/expected3/123.nc.dmp +++ b/ncdap_test/expected3/123.nc.dmp @@ -7,8 +7,7 @@ dimensions: variables: short l(l) ; char bears(i, j, maxStrlen64) ; - bears:act = "text string\n", - "\t123" ; + bears:act = "text string\\012\\011123" ; bears:acs = -40s ; bears:acl = 17000 ; bears:acf = -2.f, 1.f, 0.f ; @@ -20,9 +19,7 @@ variables: double cross(i, j) ; // global attributes: - :history = "This is an example of a multi-line global\n", - "attribute. It could be used for representing the\n", - "processing history of the data, for example." ; + :history = "This is an example of a multi-line global\\012attribute. It could be used for representing the\\012processing history of the data, for example." ; :DODS_EXTRA.Unlimited_Dimension = "k" ; data: diff --git a/ncdap_test/expected3/123bears.nc.dmp b/ncdap_test/expected3/123bears.nc.dmp index 9379de3e25..4611b98b8d 100644 --- a/ncdap_test/expected3/123bears.nc.dmp +++ b/ncdap_test/expected3/123bears.nc.dmp @@ -7,8 +7,7 @@ dimensions: variables: short l(l) ; char bears(i, j, maxStrlen64) ; - bears:act = "text string\n", - "\t123" ; + bears:act = "text string\\012\\011123" ; bears:acs = -40s ; bears:acl = 17000 ; bears:acf = -2.f, 1.f, 0.f ; @@ -20,9 +19,7 @@ variables: double cross(i, j) ; // global attributes: - :history = "This is an example of a multi-line global\n", - "attribute. It could be used for representing the\n", - "processing history of the data, for example." ; + :history = "This is an example of a multi-line global\\012attribute. It could be used for representing the\\012processing history of the data, for example." ; :DODS_EXTRA.Unlimited_Dimension = "k" ; data: diff --git a/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp b/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp index 05e6fc65b3..5b482dffa4 100644 --- a/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp +++ b/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp @@ -14,29 +14,284 @@ variables: NSCAT%20Rev%2017.WVC_Lat:valid_range = -6281s, 8051s ; // global attributes: - :Producer_Agency = "NASA" ; - :Producer_Institution = "JPL" ; - :Sensor_Name = "NSCAT" ; - :Project_ID = "NSCAT" ; - :SIS_ID = "697-512-23/1994-08-29" ; - :Build_ID = "SciSim 3.0" ; - :ADEOS_Data_Package_ID = "SIMULATED DATA PRODUCT TEST" ; - :ADEOS_Data_Package_Type = "S" ; - :Product_Creation_Time = "1995-278T23:30:04.000" ; - :Data_Type = "L17" ; - :Data_Status = "COMPLETE" ; + :Producer_Agency = "NASA\\000" ; + :Producer_Institution = "JPL\\000" ; + :Sensor_Name = "NSCAT\\000" ; + :Project_ID = "NSCAT\\000" ; + :SIS_ID = "697-512-23/1994-08-29\\000" ; + :Build_ID = "SciSim 3.0\\000" ; + :ADEOS_Data_Package_ID = "SIMULATED DATA PRODUCT TEST\\000" ; + :ADEOS_Data_Package_Type = "S\\000" ; + :Product_Creation_Time = "1995-278T23:30:04.000\\000" ; + :Data_Type = "L17\\000" ; + :Data_Status = "COMPLETE\\000" ; :First_Rev_Number = 101 ; - :First_Rev_Eq_Crossing_Time = "1996-215T01:31:07.223" ; + :First_Rev_Eq_Crossing_Time = "1996-215T01:31:07.223\\000" ; :First_Rev_Eq_Crossing_Lon = 54.952f ; - :First_Data_Time = "1996-215T01:13:28.456" ; - :Last_Data_Time = "1996-215T02:40:22.631" ; + :First_Data_Time = "1996-215T01:13:28.456\\000" ; + :Last_Data_Time = "1996-215T02:40:22.631\\000" ; :Num_Expected_Output_Records = 558 ; :Num_Actual_Output_Records = 558 ; - :HDF_Build_ID = "JPL D-xxxxx 12/15/94" ; - :HDF_SIS_ID = "JPL D-12059 12/15/94" ; - :HDF_Conversion_Organization = "JPL PO.DAAC" ; + :HDF_Build_ID = "JPL D-xxxxx 12/15/94\\000" ; + :HDF_SIS_ID = "JPL D-12059 12/15/94\\000" ; + :HDF_Conversion_Organization = "JPL PO.DAAC\\000" ; :HDF_Conversion_Time = "1996-047T11:13:05 " ; - :Data_Format_Type = "HDF" ; + :Data_Format_Type = "HDF\\000" ; + :WVC_Lat_dim_0.name = "row" ; + :WVC_Lat_dim_0.long_name = "WVC row index" ; + :WVC_Lat_dim_1.name = "WVC" ; + :WVC_Lat_dim_1.long_name = "WVC index within a row" ; + :WVC_Lon.long_name = "longitude" ; + :WVC_Lon.units = "deg" ; + :WVC_Lon.scale_factor = 0.01 ; + :WVC_Lon.scale_factor_err = 0. ; + :WVC_Lon.add_offset = 0. ; + :WVC_Lon.add_offset_err = 0. ; + :WVC_Lon.calibrated_nt = 22 ; + :WVC_Lon.valid_range = 0s, -29545s ; + :WVC_Lon_dim_0.name = "row" ; + :WVC_Lon_dim_0.long_name = "WVC row index" ; + :WVC_Lon_dim_1.name = "WVC" ; + :WVC_Lon_dim_1.long_name = "WVC index within a row" ; + :Num_Sigma0.long_name = "The total number of sigma-0 measurements" ; + :Num_Sigma0.units = "counts" ; + :Num_Sigma0.scale_factor = 1. ; + :Num_Sigma0.scale_factor_err = 0. ; + :Num_Sigma0.add_offset = 0. ; + :Num_Sigma0.add_offset_err = 0. ; + :Num_Sigma0.calibrated_nt = 21 ; + :Num_Sigma0.valid_range = 0, 21 ; + :Num_Sigma0_dim_0.name = "row" ; + :Num_Sigma0_dim_0.long_name = "WVC row index" ; + :Num_Sigma0_dim_1.name = "WVC" ; + :Num_Sigma0_dim_1.long_name = "WVC index within a row" ; + :Num_Good_Sigma0.long_name = "The number of good sigma-0 measurements" ; + :Num_Good_Sigma0.units = "counts" ; + :Num_Good_Sigma0.scale_factor = 1. ; + :Num_Good_Sigma0.scale_factor_err = 0. ; + :Num_Good_Sigma0.add_offset = 0. ; + :Num_Good_Sigma0.add_offset_err = 0. ; + :Num_Good_Sigma0.calibrated_nt = 21 ; + :Num_Good_Sigma0.valid_range = 0, 21 ; + :Num_Good_Sigma0_dim_0.name = "row" ; + :Num_Good_Sigma0_dim_0.long_name = "WVC row index" ; + :Num_Good_Sigma0_dim_1.name = "WVC" ; + :Num_Good_Sigma0_dim_1.long_name = "WVC index within a row" ; + :Num_Beam_12.long_name = "The total number of sigma-0s received from beam 1 or 2" ; + :Num_Beam_12.units = "counts" ; + :Num_Beam_12.scale_factor = 1. ; + :Num_Beam_12.scale_factor_err = 0. ; + :Num_Beam_12.add_offset = 0. ; + :Num_Beam_12.add_offset_err = 0. ; + :Num_Beam_12.calibrated_nt = 21 ; + :Num_Beam_12.valid_range = 0, 6 ; + :Num_Beam_12_dim_0.name = "row" ; + :Num_Beam_12_dim_0.long_name = "WVC row index" ; + :Num_Beam_12_dim_1.name = "WVC" ; + :Num_Beam_12_dim_1.long_name = "WVC index within a row" ; + :Num_Beam_34.long_name = "The total number of sigma-0s received from beam 3 or 4" ; + :Num_Beam_34.units = "counts" ; + :Num_Beam_34.scale_factor = 1. ; + :Num_Beam_34.scale_factor_err = 0. ; + :Num_Beam_34.add_offset = 0. ; + :Num_Beam_34.add_offset_err = 0. ; + :Num_Beam_34.calibrated_nt = 21 ; + :Num_Beam_34.valid_range = 0, 6 ; + :Num_Beam_34_dim_0.name = "row" ; + :Num_Beam_34_dim_0.long_name = "WVC row index" ; + :Num_Beam_34_dim_1.name = "WVC" ; + :Num_Beam_34_dim_1.long_name = "WVC index within a row" ; + :Num_Beam_56.long_name = "The total number of sigma-0s received from beam 5 or 6" ; + :Num_Beam_56.units = "counts" ; + :Num_Beam_56.scale_factor = 1. ; + :Num_Beam_56.scale_factor_err = 0. ; + :Num_Beam_56.add_offset = 0. ; + :Num_Beam_56.add_offset_err = 0. ; + :Num_Beam_56.calibrated_nt = 21 ; + :Num_Beam_56.valid_range = 0, 6 ; + :Num_Beam_56_dim_0.name = "row" ; + :Num_Beam_56_dim_0.long_name = "WVC row index" ; + :Num_Beam_56_dim_1.name = "WVC" ; + :Num_Beam_56_dim_1.long_name = "WVC index within a row" ; + :Num_Beam_78.long_name = "The total number of sigma-0s received from beam 7 or 8" ; + :Num_Beam_78.units = "counts" ; + :Num_Beam_78.scale_factor = 1. ; + :Num_Beam_78.scale_factor_err = 0. ; + :Num_Beam_78.add_offset = 0. ; + :Num_Beam_78.add_offset_err = 0. ; + :Num_Beam_78.calibrated_nt = 21 ; + :Num_Beam_78.valid_range = 0, 6 ; + :Num_Beam_78_dim_0.name = "row" ; + :Num_Beam_78_dim_0.long_name = "WVC row index" ; + :Num_Beam_78_dim_1.name = "WVC" ; + :Num_Beam_78_dim_1.long_name = "WVC index within a row" ; + :WVC_Quality_Flag.long_name = "WVC Quality Flag" ; + :WVC_Quality_Flag.scale_factor = 1. ; + :WVC_Quality_Flag.scale_factor_err = 0. ; + :WVC_Quality_Flag.add_offset = 0. ; + :WVC_Quality_Flag.add_offset_err = 0. ; + :WVC_Quality_Flag.calibrated_nt = 21 ; + :WVC_Quality_Flag.valid_range = 0, 3 ; + :WVC_Quality_Flag_dim_0.name = "row" ; + :WVC_Quality_Flag_dim_0.long_name = "WVC row index" ; + :WVC_Quality_Flag_dim_1.name = "WVC" ; + :WVC_Quality_Flag_dim_1.long_name = "WVC index within a row" ; + :Cen_Lat.long_name = "The center geodetic latitude of a sigma-0 cell" ; + :Cen_Lat.units = "deg" ; + :Cen_Lat.scale_factor = 0.001 ; + :Cen_Lat.scale_factor_err = 0. ; + :Cen_Lat.add_offset = 0. ; + :Cen_Lat.add_offset_err = 0. ; + :Cen_Lat.calibrated_nt = 24 ; + :Cen_Lat.valid_range = -62862, 80490 ; + :Cen_Lat_dim_0.name = "row" ; + :Cen_Lat_dim_0.long_name = "WVC row index" ; + :Cen_Lat_dim_1.name = "WVC" ; + :Cen_Lat_dim_1.long_name = "WVC index within a row" ; + :Cen_Lat_dim_2.name = "Sigma0-Dimension" ; + :Cen_Lat_dim_2.long_name = "Sigma0 position index" ; + :Cen_Lon.long_name = "The center longitude of a sigma-0 cell" ; + :Cen_Lon.units = "deg" ; + :Cen_Lon.scale_factor = 0.001 ; + :Cen_Lon.scale_factor_err = 0. ; + :Cen_Lon.add_offset = 0. ; + :Cen_Lon.add_offset_err = 0. ; + :Cen_Lon.calibrated_nt = 25 ; + :Cen_Lon.valid_range = 0, 359997 ; + :Cen_Lon_dim_0.name = "row" ; + :Cen_Lon_dim_0.long_name = "WVC row index" ; + :Cen_Lon_dim_1.name = "WVC" ; + :Cen_Lon_dim_1.long_name = "WVC index within a row" ; + :Cen_Lon_dim_2.name = "Sigma0-Dimension" ; + :Cen_Lon_dim_2.long_name = "Sigma0 position index" ; + :Cell_Azimuth.long_name = "The center longitude of a sigma-0 cell" ; + :Cell_Azimuth.units = "deg" ; + :Cell_Azimuth.scale_factor = 0.01 ; + :Cell_Azimuth.scale_factor_err = 0. ; + :Cell_Azimuth.add_offset = 0. ; + :Cell_Azimuth.add_offset_err = 0. ; + :Cell_Azimuth.calibrated_nt = 23 ; + :Cell_Azimuth.valid_range = 0s, -30784s ; + :Cell_Azimuth_dim_0.name = "row" ; + :Cell_Azimuth_dim_0.long_name = "WVC row index" ; + :Cell_Azimuth_dim_1.name = "WVC" ; + :Cell_Azimuth_dim_1.long_name = "WVC index within a row" ; + :Cell_Azimuth_dim_2.name = "Sigma0-Dimension" ; + :Cell_Azimuth_dim_2.long_name = "Sigma0 position index" ; + :Incidence_Angle.long_name = "The angle between the local normal vector and cell center direction vector" ; + :Incidence_Angle.units = "deg" ; + :Incidence_Angle.scale_factor = 0.01 ; + :Incidence_Angle.scale_factor_err = 0. ; + :Incidence_Angle.add_offset = 0. ; + :Incidence_Angle.add_offset_err = 0. ; + :Incidence_Angle.calibrated_nt = 23 ; + :Incidence_Angle.valid_range = 0s, 6259s ; + :Incidence_Angle_dim_0.name = "row" ; + :Incidence_Angle_dim_0.long_name = "WVC row index" ; + :Incidence_Angle_dim_1.name = "WVC" ; + :Incidence_Angle_dim_1.long_name = "WVC index within a row" ; + :Incidence_Angle_dim_2.name = "Sigma0-Dimension" ; + :Incidence_Angle_dim_2.long_name = "Sigma0 position index" ; + :Sigma0.long_name = "The sigma-0 measurement corresponding to each WVC" ; + :Sigma0.units = "dB" ; + :Sigma0.scale_factor = 0.01 ; + :Sigma0.scale_factor_err = 0. ; + :Sigma0.add_offset = 0. ; + :Sigma0.add_offset_err = 0. ; + :Sigma0.calibrated_nt = 22 ; + :Sigma0.valid_range = -6069s, 344s ; + :Sigma0_dim_0.name = "row" ; + :Sigma0_dim_0.long_name = "WVC row index" ; + :Sigma0_dim_1.name = "WVC" ; + :Sigma0_dim_1.long_name = "WVC index within a row" ; + :Sigma0_dim_2.name = "Sigma0-Dimension" ; + :Sigma0_dim_2.long_name = "Sigma0 position index" ; + :Coeff_A.long_name = "The coefficient (alpha) of sigma-0 squared in the sigma-0 variance equation" ; + :Coeff_A.scale_factor = 1.e-05 ; + :Coeff_A.scale_factor_err = 0. ; + :Coeff_A.add_offset = 0. ; + :Coeff_A.add_offset_err = 0. ; + :Coeff_A.calibrated_nt = 23 ; + :Coeff_A.valid_range = 0s, 5235s ; + :Coeff_A_dim_0.name = "row" ; + :Coeff_A_dim_0.long_name = "WVC row index" ; + :Coeff_A_dim_1.name = "WVC" ; + :Coeff_A_dim_1.long_name = "WVC index within a row" ; + :Coeff_A_dim_2.name = "Sigma0-Dimension" ; + :Coeff_A_dim_2.long_name = "Sigma0 position index" ; + :Coeff_B.long_name = "The coefficient (beta) of sigma-0 in the sigma-0 variance equation" ; + :Coeff_B.scale_factor = 1.e-07 ; + :Coeff_B.scale_factor_err = 0. ; + :Coeff_B.add_offset = 0. ; + :Coeff_B.add_offset_err = 0. ; + :Coeff_B.calibrated_nt = 23 ; + :Coeff_B.valid_range = 0s, 793s ; + :Coeff_B_dim_0.name = "row" ; + :Coeff_B_dim_0.long_name = "WVC row index" ; + :Coeff_B_dim_1.name = "WVC" ; + :Coeff_B_dim_1.long_name = "WVC index within a row" ; + :Coeff_B_dim_2.name = "Sigma0-Dimension" ; + :Coeff_B_dim_2.long_name = "Sigma0 position index" ; + :Coeff_C.long_name = "The coefficient (gamma) representing the constant term in the sigma-0 variance equation" ; + :Coeff_C.scale_factor = 1.e-09 ; + :Coeff_C.scale_factor_err = 0. ; + :Coeff_C.add_offset = 0. ; + :Coeff_C.add_offset_err = 0. ; + :Coeff_C.calibrated_nt = 23 ; + :Coeff_C.valid_range = 0s, 61s ; + :Coeff_C_dim_0.name = "row" ; + :Coeff_C_dim_0.long_name = "WVC row index" ; + :Coeff_C_dim_1.name = "WVC" ; + :Coeff_C_dim_1.long_name = "WVC index within a row" ; + :Coeff_C_dim_2.name = "Sigma0-Dimension" ; + :Coeff_C_dim_2.long_name = "Sigma0 position index" ; + :Sigma0_Quality_Flag.long_name = "Bit flags indicating the quality of sigma-0 measurements" ; + :Sigma0_Quality_Flag.valid_range = 0s, 1s ; + :Sigma0_Quality_Flag_dim_0.name = "row" ; + :Sigma0_Quality_Flag_dim_0.long_name = "WVC row index" ; + :Sigma0_Quality_Flag_dim_1.name = "WVC" ; + :Sigma0_Quality_Flag_dim_1.long_name = "WVC index within a row" ; + :Sigma0_Quality_Flag_dim_2.name = "Sigma0-Dimension" ; + :Sigma0_Quality_Flag_dim_2.long_name = "Sigma0 position index" ; + :K_Polar.long_name = "The polarization index to the model function table" ; + :K_Polar.scale_factor = 1. ; + :K_Polar.scale_factor_err = 0. ; + :K_Polar.add_offset = 0. ; + :K_Polar.add_offset_err = 0. ; + :K_Polar.calibrated_nt = 21 ; + :K_Polar.valid_range = 0, 2 ; + :K_Polar_dim_0.name = "row" ; + :K_Polar_dim_0.long_name = "WVC row index" ; + :K_Polar_dim_1.name = "WVC" ; + :K_Polar_dim_1.long_name = "WVC index within a row" ; + :K_Polar_dim_2.name = "Sigma0-Dimension" ; + :K_Polar_dim_2.long_name = "Sigma0 position index" ; + :Sigma0_Usable_Flag_1.long_name = "Eight bit flags indicating whether or not the first set of eight sigma-0 measurements is usable for wind retrieval" ; + :Sigma0_Usable_Flag_1.valid_range = 0, 0 ; + :Sigma0_Usable_Flag_1_dim_0.name = "row" ; + :Sigma0_Usable_Flag_1_dim_0.long_name = "WVC row index" ; + :Sigma0_Usable_Flag_1_dim_1.name = "WVC" ; + :Sigma0_Usable_Flag_1_dim_1.long_name = "WVC index within a row" ; + :Sigma0_Usable_Flag_2.long_name = "Eight bit flags indicating whether or not the second set of eight sigma-0 measurements is usable for wind retrieval" ; + :Sigma0_Usable_Flag_2.valid_range = 0, 0 ; + :Sigma0_Usable_Flag_2_dim_0.name = "row" ; + :Sigma0_Usable_Flag_2_dim_0.long_name = "WVC row index" ; + :Sigma0_Usable_Flag_2_dim_1.name = "WVC" ; + :Sigma0_Usable_Flag_2_dim_1.long_name = "WVC index within a row" ; + :Sigma0_Usable_Flag_3.long_name = "Eight bit flags indicating whether or not the third set of eight sigma-0 measurements is usable for wind retrieval" ; + :Sigma0_Usable_Flag_3.valid_range = 0, 0 ; + :Sigma0_Usable_Flag_3_dim_0.name = "row" ; + :Sigma0_Usable_Flag_3_dim_0.long_name = "WVC row index" ; + :Sigma0_Usable_Flag_3_dim_1.name = "WVC" ; + :Sigma0_Usable_Flag_3_dim_1.long_name = "WVC index within a row" ; + :Surface_Flag.long_name = "Bit flags indicating land and ice contamination of data" ; + :Surface_Flag.valid_range = 0, 0 ; + :Surface_Flag_dim_0.name = "row" ; + :Surface_Flag_dim_0.long_name = "WVC row index" ; + :Surface_Flag_dim_1.name = "WVC" ; + :Surface_Flag_dim_1.long_name = "WVC index within a row" ; + :Surface_Flag_dim_2.name = "Sigma0-Dimension" ; + :Surface_Flag_dim_2.long_name = "Sigma0 position index" ; data: NSCAT%20Rev%2017.WVC_Lat = diff --git a/ncdap_test/expected3/D1.dmp b/ncdap_test/expected3/D1.dmp index 3568ff9800..07c1e2a9fd 100644 --- a/ncdap_test/expected3/D1.dmp +++ b/ncdap_test/expected3/D1.dmp @@ -7,6 +7,9 @@ variables: char Drifters.location(Drifters, maxStrlen64) ; double Drifters.latitude(Drifters) ; double Drifters.longitude(Drifters) ; + +// global attributes: + :_location.Description = "String describing general location (southern ocean,oregon coast, etc.) of drifter deployment." ; data: Drifters.instrument_id = diff --git a/ncdap_test/expected3/Drifters.dmp b/ncdap_test/expected3/Drifters.dmp index c38354b683..5f89b318f5 100644 --- a/ncdap_test/expected3/Drifters.dmp +++ b/ncdap_test/expected3/Drifters.dmp @@ -63,6 +63,12 @@ variables: Drifters.Calibration_File:Description = "Path to the file on our file server of the calibration file for the drifter." ; char Drifters.Drifter_Type(Drifters, maxStrlen64) ; Drifters.Drifter_Type:Description = "Type of drifter." ; + +// global attributes: + :Facility.PrincipleInvestigator = "Mark Abbott\n", + "Ph.D" ; + :Facility.DataCenter = "COAS Environmental Computer Facility" ; + :Facility.DrifterType = "MetOcean WOCE/OCM" ; data: Drifters.Drifter_ID = diff --git a/ncdap_test/expected3/EOSDB.dmp b/ncdap_test/expected3/EOSDB.dmp index a804d9b0d5..5413b4f1f4 100644 --- a/ncdap_test/expected3/EOSDB.dmp +++ b/ncdap_test/expected3/EOSDB.dmp @@ -104,6 +104,23 @@ variables: // global attributes: :history = "FERRET V4.11 (debug/no GUI) 19-Nov-95FERRET V4.20 (debug/no GUI) 12-Mar-96" ; :title = "COADS Surface Marine Observations (1854-1993)" ; + :Facility.PrincipleInvestigator = "Mark Abbott" ; + :Facility.DataCenter = "COAS Environmental Computer Facility" ; + :LON.units = "degrees_east" ; + :LON.modulo = " " ; + :LON.point_spacing = "even" ; + :LAT.units = "degrees_north" ; + :LAT.point_spacing = "even" ; + :TIME.units = "days since 1700-01-01 00:00:00" ; + :TIME.time_origin = "1-JAN-1700" ; + :TIME.point_spacing = "uneven" ; + :TIME.edges = "TIMEedges" ; + :TIMEedges.edges = " " ; + :SST.missing_value = -9.9999998e+33 ; + :SST._FillValue = -9.9999998e+33 ; + :SST.long_name = "Sea Surface Temperature" ; + :SST.history = "From all_coads_grid" ; + :SST.units = "deg C" ; data: Abbott_Image_Data.Image_Name = diff --git a/ncdap_test/expected3/Makefile.am b/ncdap_test/expected3/Makefile.am index 9c920c6127..f1b4c22264 100644 --- a/ncdap_test/expected3/Makefile.am +++ b/ncdap_test/expected3/Makefile.am @@ -34,7 +34,7 @@ test.sds4.dmp test.sds5.dmp test.sds6.dmp \ test.sds7.dmp test.vs1.dmp test.vs2.dmp \ test.vs3.dmp test.vs4.dmp test.vs5.dmp \ text.nc.dmp whoi.dmp \ -testData.nc.dmp \ +testData.nc.dmp kwcase.nc.dmp \ CMakeLists.txt diff --git a/ncdap_test/expected3/OverideExample.dmp b/ncdap_test/expected3/OverideExample.dmp index 1dc27f3689..dec4ed68a2 100644 --- a/ncdap_test/expected3/OverideExample.dmp +++ b/ncdap_test/expected3/OverideExample.dmp @@ -11,6 +11,15 @@ variables: int exp.i(exp.i_0) ; int exp.data.i ; double exp.data.f(exp.data.f_0) ; + +// global attributes: + :GeneralInfo.Author = "Nathan\n", + "Potter" ; + :GeneralInfo.Facility = "Oregon State University\n", + "College of Oceanic and Atmospheric Sciences" ; + :GeneralInfo.Example = "This dataset is a simple example of how to use a .ovr file\n", + "in the INFO directory to override the default .info service output\n", + "of the OPeNDAP servlet." ; data: exp.ThreeD = diff --git a/ncdap_test/expected3/SimpleDrdsExample.dmp b/ncdap_test/expected3/SimpleDrdsExample.dmp index 861aecb06f..23b3f8ab24 100644 --- a/ncdap_test/expected3/SimpleDrdsExample.dmp +++ b/ncdap_test/expected3/SimpleDrdsExample.dmp @@ -157,6 +157,12 @@ variables: double Drifters.rellon3hr(Drifters) ; Drifters.rellon3hr:Description = "Relative Longitude: Change in longitude in the last 3 hours as determined by the GPS subsystem (Rlon3)" ; Drifters.rellon3hr:units = "degrees_east" ; + +// global attributes: + :Facility.PrincipleInvestigator = "Mark Abbott\n", + "Ph.D" ; + :Facility.DataCenter = "COAS Environmental Computer Facility" ; + :Facility.DrifterType = "MetOcean WOCE/OCM" ; data: Drifters.battery = 1000, 886.994922779284, 573.519986072456, diff --git a/ncdap_test/expected3/b31.dmp b/ncdap_test/expected3/b31.dmp index 67d94f278d..b5d4c962c8 100644 --- a/ncdap_test/expected3/b31.dmp +++ b/ncdap_test/expected3/b31.dmp @@ -11,6 +11,10 @@ variables: b31.class:long_name = "class is dismissed" ; char b31.text(b31, maxStrlen64) ; b31.text:long_name = "textually yours" ; + +// global attributes: + :b31.foo.long_name = "It is beyond all recognition" ; + :b31.foo.short_name = "foobar" ; data: b32 = 1 ; diff --git a/ncdap_test/expected3/bears.nc.dmp b/ncdap_test/expected3/bears.nc.dmp index a1679341cd..5ad2b9f50a 100644 --- a/ncdap_test/expected3/bears.nc.dmp +++ b/ncdap_test/expected3/bears.nc.dmp @@ -7,8 +7,7 @@ dimensions: variables: short l(l) ; char bears(i, j, maxStrlen64) ; - bears:act = "text string\n", - "\t123" ; + bears:act = "text string\\012\\011123" ; bears:acs = -40s ; bears:acl = 17000 ; bears:acf = -2.f, 1.f, 0.f ; @@ -20,10 +19,10 @@ variables: double cross(i, j) ; // global attributes: - :history = "This is an example of a multi-line global\n", - "attribute. It could be used for representing the\n", - "processing history of the data, for example." ; + :history = "This is an example of a multi-line global\\012attribute. It could be used for representing the\\012processing history of the data, for example." ; :DODS_EXTRA.Unlimited_Dimension = "k" ; + :i.i_1.attr3_1 = "17" ; + :i.i_1.attr3_2 = 19., 23., 27. ; data: l = 10, 9, 8 ; diff --git a/ncdap_test/expected3/ber-2002-10-01.nc.dmp b/ncdap_test/expected3/ber-2002-10-01.nc.dmp index da164462ed..9f56820402 100644 --- a/ncdap_test/expected3/ber-2002-10-01.nc.dmp +++ b/ncdap_test/expected3/ber-2002-10-01.nc.dmp @@ -21,6 +21,379 @@ variables: // global attributes: :Conventions = "CF-1.0" ; :Institution = "CSISS,GMU" ; + :Lineage.History = "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + "\t\t \n", + " This lineage information documents the source and processing performed by the WCS server in the CEOP satellite data server.\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t \n", + "\t\t\t\t SatelliteSwathToLatitudeLongitude\n", + "\t\t\t\t ForwardMapping\n", + "\t\t\t\t\n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t Perform georectification by transforming satellite swath coordinate system to Latitude-Longitude coordinate system. \n", + " \n", + " \n", + " \n", + " 2008-05-21T20:12:12.00000Z\n", + " \n", + " \n", + " \n", + " \n", + " Wenli Yang\n", + " \n", + " \n", + " NASA GES DISC\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " 301-614-5312\n", + " \n", + " \n", + " \n", + " \n", + " Wenli.Yang@nasa.gov\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t\t\n", + "\t\t\t\t Interpolation\n", + "\t\t\t\t NearestNeighbor Interpolation \n", + "\t\t\t\t\n", + " \n", + " \n", + " \n", + " Interpolatiion is needed for output cells containing no valid input values.\n", + " \n", + " \n", + " 2008-05-21T20:12:12.000000Z\n", + " \n", + " \n", + " \n", + " \n", + " Wenli Yang\n", + " \n", + " \n", + " NASA GES DISC\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " 301-614-5312\n", + " \n", + " \n", + " \n", + " \n", + " Wenli.Yang@nasa.gov\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t\t\n", + "\t\t\t\t QualityScreen\n", + "\t\t\t\t AIRSPerPixelQAFiltering\n", + "\t\t\t\t\n", + " \n", + " \n", + " \n", + " Input cells not meeting QA criteria must be excluded in the resultant coverage.\n", + " \n", + " \n", + " 2008-05-21T20:12:12.000000Z\n", + " \n", + " \n", + " \n", + " \n", + " Wenli Yang\n", + " \n", + " \n", + " NASA GES DISC\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " 301-614-5312\n", + " \n", + " \n", + " \n", + " \n", + " Wenli.Yang@nasa.gov\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " Input AIRS Release 5 Level 2 granule\n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\tOGC:Swath\n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\tOGC\n", + "\t\t\t\t\t\n", + "\t\t\t\t\n", + "\t\t\t \n", + "\t\t \n", + " \n", + " \n", + " \n", + " \n", + " <CharacterString>Input AIRS Release 5 Level 2 granule</CharacterString>\n", + " \n", + " \n", + " \n", + " \n", + " 2004-10-01\n", + " \n", + " \n", + " publication\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " NASA GES DISC\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " ftp://airspar1u.ecs.nasa.gov/data/s4pa/Aqua_AIRS_Level2/AIRX2RET.005/2002/274/AIRS.2002.10.01.097.L2.RetStd.v5.0.14.0.G07227014224.hdf\n", + " \n", + " \n", + " ftp\n", + " \n", + " \n", + " download\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " originator\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\t59.542054 -91.525519\n", + "\t\t\t\t\t\t\t\t\t\t64.006578 -122.761953\n", + "\t\t\t\t\t\t\t\t\t\t42.866636 -126.317500\n", + "\t\t\t\t\t\t\t\t\t\t40.097498 -106.352680\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\n", + " \n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\t2002-10-01T09:18:00.000000Z\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\t2002-10-01T09:23:59.999999Z\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " Input AIRS Release 5 Level 2 granule\n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\tOGC:Swath\n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\tOGC\n", + "\t\t\t\t\t\n", + "\t\t\t\t\n", + "\t\t\t \n", + "\t\t \n", + " \n", + " \n", + " \n", + " \n", + " <CharacterString>Input AIRS Release 5 Level 2 granule</CharacterString>\n", + " \n", + " \n", + " \n", + " \n", + " 2004-10-01\n", + " \n", + " \n", + " publication\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " NASA GES DISC\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " ftp://airspar1u.ecs.nasa.gov/data/s4pa/Aqua_AIRS_Level2/AIRX2RET.005/2002/274/AIRS.2002.10.01.193.L2.RetStd.v5.0.14.0.G07227072611.hdf\n", + " \n", + " \n", + " ftp\n", + " \n", + " \n", + " download\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " originator\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\t50.182469 -108.424849\n", + "\t\t\t\t\t\t\t\t\t\t53.793611 -84.244362\n", + "\t\t\t\t\t\t\t\t\t\t74.889234 -88.293173\n", + "\t\t\t\t\t\t\t\t\t\t68.007927 -132.994761\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\n", + " \n", + "\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\t2002-10-01T19:46:00.000000Z\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\t\t2002-10-01T19:51:59.999999Z\n", + "\t\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\t\n", + "\t\t\t\t\t\t\n", + "\t\t\t\t\t\n", + "\t\t\t\t\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " " ; data: TSurfAir = diff --git a/ncdap_test/expected3/in.nc.dmp b/ncdap_test/expected3/in.nc.dmp index 4cc005853b..0e5ddb6800 100644 --- a/ncdap_test/expected3/in.nc.dmp +++ b/ncdap_test/expected3/in.nc.dmp @@ -118,18 +118,14 @@ variables: float one_dmn_var(bnd) ; float att_var ; att_var:byte_att = 0b ; - att_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + att_var:char_att = "Sentence one.\\012Sentence two.\\012" ; att_var:short_att = 37s ; att_var:int_att = 73 ; att_var:float_att = 73.f, 72.f, 71.f ; att_var:double_att = 73. ; int bnd_var(lev, bnd) ; bnd_var:byte_att = 0b ; - bnd_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ; bnd_var:short_att = 37s ; bnd_var:int_att = 73 ; bnd_var:float_att = 73.f ; @@ -325,8 +321,7 @@ variables: // global attributes: :Conventions = "NCAR-CSM" ; - :history = "History global attribute.\n", - "" ; + :history = "History global attribute.\\012" ; :julian_day = 200000.04 ; :DODS_EXTRA.Unlimited_Dimension = "time" ; data: diff --git a/ncdap_test/expected3/in1.nc.dmp b/ncdap_test/expected3/in1.nc.dmp index d31d7d35c2..85e2b7402e 100644 --- a/ncdap_test/expected3/in1.nc.dmp +++ b/ncdap_test/expected3/in1.nc.dmp @@ -125,18 +125,14 @@ variables: float one_dmn_var(bnd) ; float att_var ; att_var:byte_att = 0b ; - att_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + att_var:char_att = "Sentence one.\\012Sentence two.\\012" ; att_var:short_att = 37s ; att_var:int_att = 73 ; att_var:float_att = 73.f, 72.f, 71.f ; att_var:double_att = 73. ; int bnd_var(lev, bnd) ; bnd_var:byte_att = 0b ; - bnd_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ; bnd_var:short_att = 37s ; bnd_var:int_att = 73 ; bnd_var:float_att = 73.f ; @@ -345,8 +341,7 @@ variables: // global attributes: :Conventions = "NCAR-CSM" ; - :history = "History global attribute.\n", - "" ; + :history = "History global attribute.\\012" ; :julian_day = 200000.04 ; :DODS_EXTRA.Unlimited_Dimension = "time" ; data: diff --git a/ncdap_test/expected3/in_2.nc.dmp b/ncdap_test/expected3/in_2.nc.dmp index 17c50837ea..6063823e96 100644 --- a/ncdap_test/expected3/in_2.nc.dmp +++ b/ncdap_test/expected3/in_2.nc.dmp @@ -119,18 +119,14 @@ variables: float one_dmn_var(bnd) ; float att_var ; att_var:byte_att = 0b ; - att_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + att_var:char_att = "Sentence one.\\012Sentence two.\\012" ; att_var:short_att = 37s ; att_var:int_att = 73 ; att_var:float_att = 73.f, 72.f, 71.f ; att_var:double_att = 73. ; int bnd_var(lev, bnd) ; bnd_var:byte_att = 0b ; - bnd_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ; bnd_var:short_att = 37s ; bnd_var:int_att = 73 ; bnd_var:float_att = 73.f ; @@ -327,8 +323,7 @@ variables: // global attributes: :Conventions = "NCAR-CSM" ; - :history = "History global attribute.\n", - "" ; + :history = "History global attribute.\\012" ; :julian_day = 200000.04 ; :DODS_EXTRA.Unlimited_Dimension = "time" ; data: diff --git a/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp b/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp index ca15ca58f2..4984abcf79 100644 --- a/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp +++ b/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp @@ -118,18 +118,14 @@ variables: float one_dmn_var(bnd) ; float att_var ; att_var:byte_att = 0b ; - att_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + att_var:char_att = "Sentence one.\\012Sentence two.\\012" ; att_var:short_att = 37s ; att_var:int_att = 73 ; att_var:float_att = 73.f, 72.f, 71.f ; att_var:double_att = 73. ; int bnd_var(lev, bnd) ; bnd_var:byte_att = 0b ; - bnd_var:char_att = "Sentence one.\n", - "Sentence two.\n", - "" ; + bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ; bnd_var:short_att = 37s ; bnd_var:int_att = 73 ; bnd_var:float_att = 73.f ; @@ -325,8 +321,7 @@ variables: // global attributes: :Conventions = "NCAR-CSM" ; - :history = "History global attribute.\n", - "" ; + :history = "History global attribute.\\012" ; :julian_day = 200000.04 ; :DODS_EXTRA.Unlimited_Dimension = "time" ; data: diff --git a/ncdap_test/expected3/in_v.nc.dmp b/ncdap_test/expected3/in_v.nc.dmp index 94a2e639e9..ee4d04c521 100644 --- a/ncdap_test/expected3/in_v.nc.dmp +++ b/ncdap_test/expected3/in_v.nc.dmp @@ -8,8 +8,7 @@ variables: // global attributes: :Conventions = "NCAR-CSM" ; - :history = "History global attribute.\n", - "" ; + :history = "History global attribute.\\012" ; :julian_day = 200000.04 ; :DODS_EXTRA.Unlimited_Dimension = "time" ; data: diff --git a/ncdap_test/expected3/kwcase.nc.dmp b/ncdap_test/expected3/kwcase.nc.dmp new file mode 100644 index 0000000000..a743e2edd6 --- /dev/null +++ b/ncdap_test/expected3/kwcase.nc.dmp @@ -0,0 +1,27 @@ +netcdf kwcase { +dimensions: + Grid = UNLIMITED ; // (12 currently) +variables: + double Grid(Grid) ; + Grid:units = "hour" ; + Grid:time_origin = "1-JAN-0000 00:00:00" ; + Grid:modulo = " " ; + float SST(Grid) ; + SST:missing_value = -1.e+34f ; + SST:_FillValue = -1.e+34f ; + SST:long_name = "SEA SURFACE TEMPERATURE" ; + SST:long_name_mod = "X=0E(360)@ITP, Y=0@ITP" ; + SST:history = "From coads-climatology" ; + SST:units = "Deg C" ; + +// global attributes: + :history = "FERRET V3.20 (development) 24-Jan-95" ; + :DODS_EXTRA.Unlimited_Dimension = "Grid" ; +data: + + Grid = 366, 1096.485, 1826.97, 2557.455, 3287.94, 4018.425, 4748.91, + 5479.395, 6209.88, 6940.365, 7670.85, 8401.335 ; + + SST = 27.54567, 28.3144, 28.61936, 28.66284, 27.93789, 25.67098, 24.74051, + 24.5248, 25.00667, 25.83214, 26.57257, 27.17107 ; +} diff --git a/ncdap_test/expected3/nestedDAS.dmp b/ncdap_test/expected3/nestedDAS.dmp index 36995a46a8..972365dfae 100644 --- a/ncdap_test/expected3/nestedDAS.dmp +++ b/ncdap_test/expected3/nestedDAS.dmp @@ -6,6 +6,20 @@ variables: char b32(maxStrlen64) ; b32:billy = "Bob is my real name" ; b32:Robert = "Really wants to be called Billy" ; + +// global attributes: + :humans.position = "There are too many humans." ; + :humans.offer = "Here are a few..." ; + :b31.class.text.long_name = "textually yours" ; + :b31.class.text.short_name = "ty" ; + :b31.class.long_name = "class is dismissed" ; + :b31.class.short_name = "cid\n", + "kid\n", + "bid\n", + "did" ; + :b31.foo.long_name = "It is beyond all recognition" ; + :b31.foo.short_name = "foobar" ; + :b31.foo.SS_number = "304-66-9876" ; data: b31 = 0 ; diff --git a/ncdap_test/expected3/pbug0001b.dmp b/ncdap_test/expected3/pbug0001b.dmp index c187bbb627..d2a47af216 100644 --- a/ncdap_test/expected3/pbug0001b.dmp +++ b/ncdap_test/expected3/pbug0001b.dmp @@ -8,8 +8,8 @@ variables: float \3H(ISTA, IZ) ; // global attributes: - :bs5 = "foo\foo\\" ; - :dsp_ing_tiros_ourid = "NO11****C”¸5>B\\" ; + :bs5 = "foo\\foo\\" ; + :dsp_ing_tiros_ourid = "NO11****C\\224\\2705>B\\217\\" ; :bung = 0.f, 1.f, 2.3f, -2.23456f ; data: diff --git a/ncdap_test/expected3/synth1.dmp b/ncdap_test/expected3/synth1.dmp index fd0dedbb30..f1128b7ede 100644 --- a/ncdap_test/expected3/synth1.dmp +++ b/ncdap_test/expected3/synth1.dmp @@ -3,7 +3,7 @@ dimensions: S1.v1_0 = 3 ; variables: int S1.v1(S1.v1_0) ; - S1.v1:a%201 = 32 ; + S1.v1:a%201 = 32 ; data: S1.v1 = 132, 232, 332 ; diff --git a/ncdap_test/expected3/synth4.dmp b/ncdap_test/expected3/synth4.dmp index 382416c61c..1d40a7dfd0 100644 --- a/ncdap_test/expected3/synth4.dmp +++ b/ncdap_test/expected3/synth4.dmp @@ -21,6 +21,7 @@ variables: // global attributes: :g1 = 3, 8, 16, 32 ; :s1 = "gvalue1" ; + :S2.lost1 = "value1" ; data: S1.v1 = diff --git a/ncdap_test/expected3/synth5.dmp b/ncdap_test/expected3/synth5.dmp index 98ec3e46a7..b544a4d44e 100644 --- a/ncdap_test/expected3/synth5.dmp +++ b/ncdap_test/expected3/synth5.dmp @@ -4,6 +4,9 @@ dimensions: long = 2 ; variables: float G1(lat, long) ; + +// global attributes: + :S1.v2.a1 = 32 ; data: G1 = diff --git a/ncdap_test/expected3/synth6.dmp b/ncdap_test/expected3/synth6.dmp index 3f263599d0..622e09ba27 100644 --- a/ncdap_test/expected3/synth6.dmp +++ b/ncdap_test/expected3/synth6.dmp @@ -12,9 +12,19 @@ dimensions: variables: byte S1.v1(S1.v1_0, S1.v1_1) ; int S1.v3(S1.v3_0, S1.v3_1) ; + S1.v3:a1 = 32 ; double S1.v5(S1.v5_0, S1.v5_1) ; short Q1.v2(Q1, Q1.v2_1) ; float Q1.v4(Q1, Q1.v4_1) ; + +// global attributes: + :globalattr = 177 ; + :CoreMetadata.OrbitNumber.Value = 375 ; + :CoreMetadata.OrbitNumber.Data_Location = "PGE" ; + :CoreMetadata.OrbitNumber.Mandatory = "FALSE" ; + :CoreMetadata.RangeBeginningDate.Value = "1997/12/21" ; + :CoreMetadata.RangeBeginningDate.Data_Location = "PGE" ; + :CoreMetadata.RangeBeginningDate.Mandatory = "FALSE" ; data: S1.v1 = diff --git a/ncdap_test/expected3/test.01.dmp b/ncdap_test/expected3/test.01.dmp index a8744060c0..e23844940c 100644 --- a/ncdap_test/expected3/test.01.dmp +++ b/ncdap_test/expected3/test.01.dmp @@ -15,6 +15,12 @@ variables: double f64 ; char s(maxStrlen64) ; char u(maxStrlen64) ; + +// global attributes: + :Facility.PrincipleInvestigator = "Mark Abbott\n", + "Ph.D" ; + :Facility.DataCenter = "COAS Environmental Computer Facility" ; + :Facility.DrifterType = "MetOcean WOCE/OCM" ; data: b = 0 ; diff --git a/ncdap_test/expected3/test.21.dmp b/ncdap_test/expected3/test.21.dmp index c0374329d9..3c374805c9 100644 --- a/ncdap_test/expected3/test.21.dmp +++ b/ncdap_test/expected3/test.21.dmp @@ -10,12 +10,6 @@ variables: int exp.i ; short exp.g(exp.g_0, exp.g_1, exp.g_2) ; short exp.f(exp.f_0, exp.f_1) ; - -// global attributes: - :Facility.PrincipleInvestigator = "Mark Abbott\n", - "Ph.D" ; - :Facility.DataCenter = "COAS Environmental Computer Facility" ; - :Facility.DrifterType = "MetOcean WOCE/OCM" ; data: exp.j = 1 ; diff --git a/ncdap_test/expected3/test.nc.dmp b/ncdap_test/expected3/test.nc.dmp index 464750abeb..775bd03ddd 100644 --- a/ncdap_test/expected3/test.nc.dmp +++ b/ncdap_test/expected3/test.nc.dmp @@ -19,7 +19,7 @@ variables: i:d = -1.79769313486232e+308, 1.79769313486232e+308, -1., 1., 660. ; float f ; double d ; - d:c = "€\177AZ$&" ; + d:c = "\\200\\177AZ$&" ; char cr(Dr, maxStrlen64) ; byte br(Dr) ; short sr(Dr) ; @@ -152,7 +152,7 @@ variables: int i444(D4, D4, D4) ; // global attributes: - :Gc = "€" ; + :Gc = "\\200" ; :Gb = -128b, 127b ; :Gs = -32768s, 32767s, 32767s ; :Gi = -2147483648, 2147483647, -2147483648, 2147483647 ; diff --git a/ncdap_test/expected3/text.nc.dmp b/ncdap_test/expected3/text.nc.dmp index cdc0ed2f2f..614aa67613 100644 --- a/ncdap_test/expected3/text.nc.dmp +++ b/ncdap_test/expected3/text.nc.dmp @@ -19,7 +19,7 @@ variables: i:d = -1.79769313486232e+308, 1.79769313486232e+308, -1., 1., 660. ; float f ; double d ; - d:c = "€\177AZ$&" ; + d:c = "\\200\\177AZ$&" ; char cr(Dr, maxStrlen64) ; byte br(Dr) ; short sr(Dr) ; @@ -152,7 +152,7 @@ variables: int i444(D4, D4, D4) ; // global attributes: - :Gc = "€" ; + :Gc = "\\200" ; :Gb = -128b, 127b ; :Gs = -32768s, 32767s, 32767s ; :Gi = -2147483648, 2147483647, -2147483648, 2147483647 ; diff --git a/ncdap_test/testdata3/Makefile.am b/ncdap_test/testdata3/Makefile.am index e3578bb6dc..2defd0d6de 100644 --- a/ncdap_test/testdata3/Makefile.am +++ b/ncdap_test/testdata3/Makefile.am @@ -93,6 +93,7 @@ test.vs4.das test.vs4.dds test.vs4.dods \ test.vs5.das test.vs5.dds test.vs5.dods \ text.nc.das text.nc.dds text.nc.dods \ whoi.das whoi.dds whoi.dods \ +kwcase.nc.das kwcase.nc.dds kwcase.nc.dods \ CMakeLists.txt # following are not legally convertible to dap2 diff --git a/ncdap_test/testdata3/kwcase.nc.das b/ncdap_test/testdata3/kwcase.nc.das new file mode 100644 index 0000000000..186df3d046 --- /dev/null +++ b/ncdap_test/testdata3/kwcase.nc.das @@ -0,0 +1,21 @@ +Attributes { + Grid { + String units "hour"; + String time_origin "1-JAN-0000 00:00:00"; + String modulo " "; + } + SST { + Float32 missing_value -9.999999790e+33; + Float32 _FillValue -9.999999790e+33; + String long_name "SEA SURFACE TEMPERATURE"; + String long_name_mod "X=0E(360)@ITP, Y=0@ITP"; + String history "From coads-climatology"; + String units "Deg C"; + } + NC_GLOBAL { + String history "FERRET V3.20 (development) 24-Jan-95"; + } + DODS_EXTRA { + String Unlimited_Dimension "Grid"; + } +} diff --git a/ncdap_test/testdata3/kwcase.nc.dds b/ncdap_test/testdata3/kwcase.nc.dds new file mode 100644 index 0000000000..77b856d4e0 --- /dev/null +++ b/ncdap_test/testdata3/kwcase.nc.dds @@ -0,0 +1,9 @@ +Dataset { + Float64 Grid[Grid = 12]; + Grid { + Array: + Float32 SST[Grid = 12]; + Maps: + Float64 Grid[Grid = 12]; + } SST; +} kwcase.nc; diff --git a/ncdap_test/testdata3/kwcase.nc.dods b/ncdap_test/testdata3/kwcase.nc.dods new file mode 100644 index 0000000000..ffd3a4861f Binary files /dev/null and b/ncdap_test/testdata3/kwcase.nc.dods differ diff --git a/ncdap_test/tst_ncdap.sh b/ncdap_test/tst_ncdap.sh index cc58538ca2..ca1c61dd9a 100755 --- a/ncdap_test/tst_ncdap.sh +++ b/ncdap_test/tst_ncdap.sh @@ -1,5 +1,7 @@ #!/bin/sh +if test "x$SETX" != x ; then set -x ; fi + quiet=0 leakcheck=0 @@ -17,26 +19,14 @@ mode="$3" # Locate the testdata and expected directory testdata3="${srcdir}/testdata3" expected3="${srcdir}/expected3" -expected4="${srcdir}/expected4" + +TITLE="DAP to netCDF-3 translation" +EXPECTED="$expected3" +PARAMS="${PARAMS}[cache]" # get the list of test files . ${srcdir}/tst_ncdap_shared.sh -FLAGS= - -case "$mode" in -*3) - EXPECTED="$expected3" - TITLE="DAP to netCDF-3 translation" - PARAMS="${PARAMS}[cache]" - ;; -*4) - EXPECTED="$expected4" - TITLE="DAP to netCDF-4 translation" - PARAMS="${PARAMS}[netcdf4][cache]" - ;; -esac - case "$mode" in file*) TESTURL="$FILEURL" @@ -55,8 +45,7 @@ remote*) esac RESULTSDIR="./results" -# Locate some tools -NCDUMP="${builddir}/ncdump/ncdump $FLAGS" +# if test "x$leakcheck" = "x1" ; then VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full" fi @@ -84,7 +73,8 @@ for x in ${TESTSET} ; do if test "x${t}" = "x${x}" ; then isxfail=1; fi done ok=1 - if ${VALGRIND} ${NCDUMP} "${url}" > ${x}.dmp ; then ok=$ok; else ok=0; fi + echo command: ${VALGRIND} ${NCDUMP} ${FLAGS} "${url}" + if ${VALGRIND} ${NCDUMP} ${FLAGS} "${url}" > ${x}.dmp ; then ok=$ok; else ok=0; fi # compare with expected if diff -w ${EXPECTED}/${x}.dmp ${x}.dmp ; then ok=$ok; else ok=0; fi if test "$ok" = 1 ; then @@ -120,7 +110,6 @@ echo "pwd=" `pwd` totalcount=`expr $passcount + $failcount + $xfailcount` okcount=`expr $passcount + $xfailcount` - echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures" #failcount=0 diff --git a/ncdap_test/tst_ncdap3.sh b/ncdap_test/tst_ncdap3.sh index 0f82ff7567..4b82159b61 100755 --- a/ncdap_test/tst_ncdap3.sh +++ b/ncdap_test/tst_ncdap3.sh @@ -8,6 +8,6 @@ set -e #X="-x" #grind="checkleaks" -#exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "file3" $grind -exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "dds3" $grind +exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "file" $grind +#exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "dds" $grind diff --git a/ncdap_test/tst_ncdap_shared.sh b/ncdap_test/tst_ncdap_shared.sh index 8fbbe7e411..79acd1ad96 100755 --- a/ncdap_test/tst_ncdap_shared.sh +++ b/ncdap_test/tst_ncdap_shared.sh @@ -1,9 +1,9 @@ -# $Id: tst_ncdap_shared.sh,v 1.9 2009/12/03 03:42:39 dmh Exp $ - ################################################## # Local test info ################################################## +if test "x$SETX" != x ; then set -x ; fi + # Define the complete URLS FILEURL="file://${testdata3}" @@ -38,7 +38,8 @@ ber-2002-10-01.nc ceopL2AIRS2-2.nc \ data.nc fnoc1.nc \ in1.nc in_2.nc in.nc \ in_no_three_double_dmn.nc in_v.nc saco1.nc \ -test.nc text.nc" +test.nc text.nc \ +kwcase.nc" # XFAIL tests should be a subset of the other tests; this is used # only to detect which are considered XFAIL tests. @@ -46,7 +47,7 @@ XFAILTESTS="" # For now, remove some tests from windows platform. if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then - XFAILTESTS="$XFAILTESTS EOSDB OverideExample SimpleDrdsExample test.67 test.gr5 123bears.nc 123.nc bears.nc ber-2002-10-01 data.nc in1.nc in_2.nc in_no_three_double_dmn.nc test.nc text.nc test.22 test.23 test.gr1 in.nc ber-2002-10-01.nc" + XFAILTESTS="$XFAILTESTS EOSDB OverideExample SimpleDrdsExample test.67 test.gr5 123bears.nc 123.nc bears.nc ber-2002-10-01 data.nc in1.nc in_2.nc in_no_three_double_dmn.nc test.nc text.nc test.22 test.23 test.gr1 in.nc ber-2002-10-01.nc kwcase.nc" fi FILETESTS="${SYNTHETICDATA} ${ACTUALDATA1} ${ACTUALDATA2}" diff --git a/ncdap_test/tst_remote.sh b/ncdap_test/tst_remote.sh index f232f81387..23042ff5c9 100755 --- a/ncdap_test/tst_remote.sh +++ b/ncdap_test/tst_remote.sh @@ -1,8 +1,6 @@ #!/bin/sh -if test "x$srcdir" = x ; then srcdir=`pwd`; fi -. ../test_common.sh - +if test "x$SETX" != x ; then set -x ; fi set -e quiet=0 @@ -29,7 +27,7 @@ OCLOGFILE="" ; export OCLOGFILE # Capture arguments srcdir="$1" builddir="$2" -mode="$3" +#ignored mode="$3" if test "x$4" = "x" ; then cache=1 ; else cache=0; fi longtests="$5" @@ -183,22 +181,11 @@ testfile.nc \ text.nc \ " -case "$mode" in -3) - EXPECTED="$expected3" - TITLE="DAP to netCDF-3 translation" - PARAMS="${PARAMS}[netcdf3]" - XFAILTESTS="$XFAILTESTS3" - SVCFAILTESTS="$SVCFAILTESTS3" - ;; -4) - EXPECTED="$expected4" - TITLE="DAP to netCDF-4 translation" - PARAMS="${PARAMS}[netcdf4]" - XFAILTESTS="$XFAILTESTS4" - SVCFAILTESTS="$SVCFAILTESTS4" - ;; -esac +TITLE="DAP to netCDF-3 translation" +EXPECTED="$expected3" +PARAMS="${PARAMS}[netcdf3]" +XFAILTESTS="$XFAILTESTS3" +SVCFAILTESTS="$SVCFAILTESTS3" RESULTSDIR="./results" # Locate some tools diff --git a/ncgen/CMakeLists.txt b/ncgen/CMakeLists.txt index 6feb4b9393..7314acef50 100644 --- a/ncgen/CMakeLists.txt +++ b/ncgen/CMakeLists.txt @@ -3,7 +3,7 @@ IF(BUILD_SHARED_LIBS AND WIN32) remove_definitions(-DDLL_NETCDF) ENDIF() -SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c ncgen.h) +SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ncgen.h) # don't add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH diff --git a/ncgen/ConvertUTF.c b/ncgen/ConvertUTF.c deleted file mode 100644 index 0be73c363b..0000000000 --- a/ncgen/ConvertUTF.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 2001-2004 Unicode, Inc. - * - * Disclaimer - * - * This source code is provided as is by Unicode, Inc. No claims are - * made as to fitness for any particular purpose. No warranties of any - * kind are expressed or implied. The recipient agrees to determine - * applicability of information provided. If this file has been - * purchased on magnetic or optical media from Unicode, Inc., the - * sole remedy for any claim will be exchange of defective media - * within 90 days of receipt. - * - * Limitations on Rights to Redistribute This Code - * - * Unicode, Inc. hereby grants the right to freely use the information - * supplied in this file in the creation of products supporting the - * Unicode Standard, and to make copies of this file in any form - * for internal or external distribution as long as this notice - * remains attached. - */ - -/* --------------------------------------------------------------------- - - Conversions between UTF32, UTF-16, and UTF-8. Source code file. - Author: Mark E. Davis, 1994. - Rev History: Rick McGowan, fixes & updates May 2001. - Sept 2001: fixed const & error conditions per - mods suggested by S. Parent & A. Lillich. - June 2002: Tim Dodd added detection and handling of incomplete - source sequences, enhanced error detection, added casts - to eliminate compiler warnings. - July 2003: slight mods to back out aggressive FFFE detection. - Jan 2004: updated switches in from-UTF8 conversions. - Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions. - - See the header file "ConvertUTF.h" for complete documentation. - ------------------------------------------------------------------------- */ - -#include "config.h" -#include "ConvertUTF.h" -#ifdef CVTUTF_DEBUG -#include -#endif - -static const int halfShift = 10; /* used for shifting by 10 bits */ - -static const UTF32 halfBase = 0x0010000UL; -static const UTF32 halfMask = 0x3FFUL; - -#define UNI_SUR_HIGH_START (UTF32)0xD800 -#define UNI_SUR_HIGH_END (UTF32)0xDBFF -#define UNI_SUR_LOW_START (UTF32)0xDC00 -#define UNI_SUR_LOW_END (UTF32)0xDFFF -#define false 0 -#define true 1 - -/* --------------------------------------------------------------------- */ - -ConversionResult ConvertUTF32toUTF16 ( - const UTF32** sourceStart, const UTF32* sourceEnd, - UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { - ConversionResult result = conversionOK; - const UTF32* source = *sourceStart; - UTF16* target = *targetStart; - while (source < sourceEnd) { - UTF32 ch; - if (target >= targetEnd) { - result = targetExhausted; break; - } - ch = *source++; - if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */ - /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */ - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { - if (flags == strictConversion) { - --source; /* return to the illegal value itself */ - result = sourceIllegal; - break; - } else { - *target++ = UNI_REPLACEMENT_CHAR; - } - } else { - *target++ = (UTF16)ch; /* normal case */ - } - } else if (ch > UNI_MAX_LEGAL_UTF32) { - if (flags == strictConversion) { - result = sourceIllegal; - } else { - *target++ = UNI_REPLACEMENT_CHAR; - } - } else { - /* target is a character in range 0xFFFF - 0x10FFFF. */ - if (target + 1 >= targetEnd) { - --source; /* Back up source pointer! */ - result = targetExhausted; break; - } - ch -= halfBase; - *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START); - *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START); - } - } - *sourceStart = source; - *targetStart = target; - return result; -} - -/* --------------------------------------------------------------------- */ - -ConversionResult ConvertUTF16toUTF32 ( - const UTF16** sourceStart, const UTF16* sourceEnd, - UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) { - ConversionResult result = conversionOK; - const UTF16* source = *sourceStart; - UTF32* target = *targetStart; - UTF32 ch, ch2; - while (source < sourceEnd) { - const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ - ch = *source++; - /* If we have a surrogate pair, convert to UTF32 first. */ - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { - /* If the 16 bits following the high surrogate are in the source buffer... */ - if (source < sourceEnd) { - ch2 = *source; - /* If it's a low surrogate, convert to UTF32. */ - if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { - ch = ((ch - UNI_SUR_HIGH_START) << halfShift) - + (ch2 - UNI_SUR_LOW_START) + halfBase; - ++source; - } else if (flags == strictConversion) { /* it's an unpaired high surrogate */ - --source; /* return to the illegal value itself */ - result = sourceIllegal; - break; - } - } else { /* We don't have the 16 bits following the high surrogate. */ - --source; /* return to the high surrogate */ - result = sourceExhausted; - break; - } - } else if (flags == strictConversion) { - /* UTF-16 surrogate values are illegal in UTF-32 */ - if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) { - --source; /* return to the illegal value itself */ - result = sourceIllegal; - break; - } - } - if (target >= targetEnd) { - source = oldSource; /* Back up source pointer! */ - result = targetExhausted; break; - } - *target++ = ch; - } - *sourceStart = source; - *targetStart = target; -#ifdef CVTUTF_DEBUG -if (result == sourceIllegal) { - fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2); - fflush(stderr); -} -#endif - return result; -} - -/* --------------------------------------------------------------------- */ - -/* - * Index into the table below with the first byte of a UTF-8 sequence to - * get the number of trailing bytes that are supposed to follow it. - * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is - * left as-is for anyone who may want to do such conversion, which was - * allowed in earlier algorithms. - */ -static const char trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; - -/* - * Magic values subtracted from a buffer value during UTF8 conversion. - * This table contains as many values as there might be trailing bytes - * in a UTF-8 sequence. - */ -static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, - 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; - -/* - * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed - * into the first byte, depending on how many bytes follow. There are - * as many entries in this table as there are UTF-8 sequence types. - * (I.e., one byte sequence, two byte... etc.). Remember that sequencs - * for *legal* UTF-8 will be 4 or fewer bytes total. - */ -static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - -/* --------------------------------------------------------------------- */ - -/* The interface converts a whole buffer to avoid function-call overhead. - * Constants have been gathered. Loops & conditionals have been removed as - * much as possible for efficiency, in favor of drop-through switches. - * (See "Note A" at the bottom of the file for equivalent code.) - * If your compiler supports it, the "isLegalUTF8" call can be turned - * into an inline function. - */ - -/* --------------------------------------------------------------------- */ - -ConversionResult ConvertUTF16toUTF8 ( - const UTF16** sourceStart, const UTF16* sourceEnd, - UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { - ConversionResult result = conversionOK; - const UTF16* source = *sourceStart; - UTF8* target = *targetStart; - while (source < sourceEnd) { - UTF32 ch; - unsigned short bytesToWrite = 0; - const UTF32 byteMask = 0xBF; - const UTF32 byteMark = 0x80; - const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ - ch = *source++; - /* If we have a surrogate pair, convert to UTF32 first. */ - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { - /* If the 16 bits following the high surrogate are in the source buffer... */ - if (source < sourceEnd) { - UTF32 ch2 = *source; - /* If it's a low surrogate, convert to UTF32. */ - if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { - ch = ((ch - UNI_SUR_HIGH_START) << halfShift) - + (ch2 - UNI_SUR_LOW_START) + halfBase; - ++source; - } else if (flags == strictConversion) { /* it's an unpaired high surrogate */ - --source; /* return to the illegal value itself */ - result = sourceIllegal; - break; - } - } else { /* We don't have the 16 bits following the high surrogate. */ - --source; /* return to the high surrogate */ - result = sourceExhausted; - break; - } - } else if (flags == strictConversion) { - /* UTF-16 surrogate values are illegal in UTF-32 */ - if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) { - --source; /* return to the illegal value itself */ - result = sourceIllegal; - break; - } - } - /* Figure out how many bytes the result will require */ - if (ch < (UTF32)0x80) { bytesToWrite = 1; - } else if (ch < (UTF32)0x800) { bytesToWrite = 2; - } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; - } else if (ch < (UTF32)0x110000) { bytesToWrite = 4; - } else { bytesToWrite = 3; - ch = UNI_REPLACEMENT_CHAR; - } - - target += bytesToWrite; - if (target > targetEnd) { - source = oldSource; /* Back up source pointer! */ - target -= bytesToWrite; result = targetExhausted; break; - } - switch (bytesToWrite) { /* note: everything falls through. */ - case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]); - } - target += bytesToWrite; - } - *sourceStart = source; - *targetStart = target; - return result; -} - -/* --------------------------------------------------------------------- */ - -/* - * Utility routine to tell whether a sequence of bytes is legal UTF-8. - * This must be called with the length pre-determined by the first byte. - * If not calling this from ConvertUTF8to*, then the length can be set by: - * length = trailingBytesForUTF8[*source]+1; - * and the sequence is illegal right away if there aren't that many bytes - * available. - * If presented with a length > 4, this returns false. The Unicode - * definition of UTF-8 goes up to 4-byte sequences. - */ - -static Boolean isLegalUTF8(const UTF8 *source, int length) { - UTF8 a; - const UTF8 *srcptr = source+length; - switch (length) { - default: return false; - /* Everything else falls through when "true"... */ - case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; - case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; - case 2: if ((a = (*--srcptr)) > 0xBF) return false; - - switch (*source) { - /* no fall-through in this inner switch */ - case 0xE0: if (a < 0xA0) return false; break; - case 0xED: if (a > 0x9F) return false; break; - case 0xF0: if (a < 0x90) return false; break; - case 0xF4: if (a > 0x8F) return false; break; - default: if (a < 0x80) return false; - } - - case 1: if (*source >= 0x80 && *source < 0xC2) return false; - } - if (*source > 0xF4) return false; - return true; -} - -/* --------------------------------------------------------------------- */ - -/* - * Exported function to return whether a UTF-8 sequence is legal or not. - * This is not used here; it's just exported. - */ -Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) { - int length = trailingBytesForUTF8[*source]+1; - if (source+length > sourceEnd) { - return false; - } - return isLegalUTF8(source, length); -} - -/* --------------------------------------------------------------------- */ - -ConversionResult ConvertUTF8toUTF16 ( - const UTF8** sourceStart, const UTF8* sourceEnd, - UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { - ConversionResult result = conversionOK; - const UTF8* source = *sourceStart; - UTF16* target = *targetStart; - while (source < sourceEnd) { - UTF32 ch = 0; - unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; - if (source + extraBytesToRead >= sourceEnd) { - result = sourceExhausted; break; - } - /* Do this check whether lenient or strict */ - if (! isLegalUTF8(source, extraBytesToRead+1)) { - result = sourceIllegal; - break; - } - /* - * The cases all fall through. See "Note A" below. - */ - switch (extraBytesToRead) { - case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ - case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ - case 3: ch += *source++; ch <<= 6; - case 2: ch += *source++; ch <<= 6; - case 1: ch += *source++; ch <<= 6; - case 0: ch += *source++; - } - ch -= offsetsFromUTF8[extraBytesToRead]; - - if (target >= targetEnd) { - source -= (extraBytesToRead+1); /* Back up source pointer! */ - result = targetExhausted; break; - } - if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */ - /* UTF-16 surrogate values are illegal in UTF-32 */ - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { - if (flags == strictConversion) { - source -= (extraBytesToRead+1); /* return to the illegal value itself */ - result = sourceIllegal; - break; - } else { - *target++ = UNI_REPLACEMENT_CHAR; - } - } else { - *target++ = (UTF16)ch; /* normal case */ - } - } else if (ch > UNI_MAX_UTF16) { - if (flags == strictConversion) { - result = sourceIllegal; - source -= (extraBytesToRead+1); /* return to the start */ - break; /* Bail out; shouldn't continue */ - } else { - *target++ = UNI_REPLACEMENT_CHAR; - } - } else { - /* target is a character in range 0xFFFF - 0x10FFFF. */ - if (target + 1 >= targetEnd) { - source -= (extraBytesToRead+1); /* Back up source pointer! */ - result = targetExhausted; break; - } - ch -= halfBase; - *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START); - *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START); - } - } - *sourceStart = source; - *targetStart = target; - return result; -} - -/* --------------------------------------------------------------------- */ - -ConversionResult ConvertUTF32toUTF8 ( - const UTF32** sourceStart, const UTF32* sourceEnd, - UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { - ConversionResult result = conversionOK; - const UTF32* source = *sourceStart; - UTF8* target = *targetStart; - while (source < sourceEnd) { - UTF32 ch; - unsigned short bytesToWrite = 0; - const UTF32 byteMask = 0xBF; - const UTF32 byteMark = 0x80; - ch = *source++; - if (flags == strictConversion ) { - /* UTF-16 surrogate values are illegal in UTF-32 */ - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { - --source; /* return to the illegal value itself */ - result = sourceIllegal; - break; - } - } - /* - * Figure out how many bytes the result will require. Turn any - * illegally large UTF32 things (> Plane 17) into replacement chars. - */ - if (ch < (UTF32)0x80) { bytesToWrite = 1; - } else if (ch < (UTF32)0x800) { bytesToWrite = 2; - } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; - } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4; - } else { bytesToWrite = 3; - ch = UNI_REPLACEMENT_CHAR; - result = sourceIllegal; - } - - target += bytesToWrite; - if (target > targetEnd) { - --source; /* Back up source pointer! */ - target -= bytesToWrite; result = targetExhausted; break; - } - switch (bytesToWrite) { /* note: everything falls through. */ - case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]); - } - target += bytesToWrite; - } - *sourceStart = source; - *targetStart = target; - return result; -} - -/* --------------------------------------------------------------------- */ - -ConversionResult ConvertUTF8toUTF32 ( - const UTF8** sourceStart, const UTF8* sourceEnd, - UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) { - ConversionResult result = conversionOK; - const UTF8* source = *sourceStart; - UTF32* target = *targetStart; - while (source < sourceEnd) { - UTF32 ch = 0; - unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; - if (source + extraBytesToRead >= sourceEnd) { - result = sourceExhausted; break; - } - /* Do this check whether lenient or strict */ - if (! isLegalUTF8(source, extraBytesToRead+1)) { - result = sourceIllegal; - break; - } - /* - * The cases all fall through. See "Note A" below. - */ - switch (extraBytesToRead) { - case 5: ch += *source++; ch <<= 6; - case 4: ch += *source++; ch <<= 6; - case 3: ch += *source++; ch <<= 6; - case 2: ch += *source++; ch <<= 6; - case 1: ch += *source++; ch <<= 6; - case 0: ch += *source++; - } - ch -= offsetsFromUTF8[extraBytesToRead]; - - if (target >= targetEnd) { - source -= (extraBytesToRead+1); /* Back up the source pointer! */ - result = targetExhausted; break; - } - if (ch <= UNI_MAX_LEGAL_UTF32) { - /* - * UTF-16 surrogate values are illegal in UTF-32, and anything - * over Plane 17 (> 0x10FFFF) is illegal. - */ - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { - if (flags == strictConversion) { - source -= (extraBytesToRead+1); /* return to the illegal value itself */ - result = sourceIllegal; - break; - } else { - *target++ = UNI_REPLACEMENT_CHAR; - } - } else { - *target++ = ch; - } - } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */ - result = sourceIllegal; - *target++ = UNI_REPLACEMENT_CHAR; - } - } - *sourceStart = source; - *targetStart = target; - return result; -} - -/* --------------------------------------------------------------------- - - Note A. - The fall-through switches in UTF-8 reading code save a - temp variable, some decrements & conditionals. The switches - are equivalent to the following loop: - { - int tmpBytesToRead = extraBytesToRead+1; - do { - ch += *source++; - --tmpBytesToRead; - if (tmpBytesToRead) ch <<= 6; - } while (tmpBytesToRead > 0); - } - In UTF-8 writing code, the switches on "bytesToWrite" are - similarly unrolled loops. - - --------------------------------------------------------------------- */ diff --git a/ncgen/ConvertUTF.h b/ncgen/ConvertUTF.h deleted file mode 100644 index e26e7c9789..0000000000 --- a/ncgen/ConvertUTF.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2001-2004 Unicode, Inc. - * - * Disclaimer - * - * This source code is provided as is by Unicode, Inc. No claims are - * made as to fitness for any particular purpose. No warranties of any - * kind are expressed or implied. The recipient agrees to determine - * applicability of information provided. If this file has been - * purchased on magnetic or optical media from Unicode, Inc., the - * sole remedy for any claim will be exchange of defective media - * within 90 days of receipt. - * - * Limitations on Rights to Redistribute This Code - * - * Unicode, Inc. hereby grants the right to freely use the information - * supplied in this file in the creation of products supporting the - * Unicode Standard, and to make copies of this file in any form - * for internal or external distribution as long as this notice - * remains attached. - */ - -/* --------------------------------------------------------------------- - - Conversions between UTF32, UTF-16, and UTF-8. Header file. - - Several functions are included here, forming a complete set of - conversions between the three formats. UTF-7 is not included - here, but is handled in a separate source file. - - Each of these routines takes pointers to input buffers and output - buffers. The input buffers are const. - - Each routine converts the text between *sourceStart and sourceEnd, - putting the result into the buffer between *targetStart and - targetEnd. Note: the end pointers are *after* the last item: e.g. - *(sourceEnd - 1) is the last item. - - The return result indicates whether the conversion was successful, - and if not, whether the problem was in the source or target buffers. - (Only the first encountered problem is indicated.) - - After the conversion, *sourceStart and *targetStart are both - updated to point to the end of last text successfully converted in - the respective buffers. - - Input parameters: - sourceStart - pointer to a pointer to the source buffer. - The contents of this are modified on return so that - it points at the next thing to be converted. - targetStart - similarly, pointer to pointer to the target buffer. - sourceEnd, targetEnd - respectively pointers to the ends of the - two buffers, for overflow checking only. - - These conversion functions take a ConversionFlags argument. When this - flag is set to strict, both irregular sequences and isolated surrogates - will cause an error. When the flag is set to lenient, both irregular - sequences and isolated surrogates are converted. - - Whether the flag is strict or lenient, all illegal sequences will cause - an error return. This includes sequences such as: , , - or in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code - must check for illegal sequences. - - When the flag is set to lenient, characters over 0x10FFFF are converted - to the replacement character; otherwise (when the flag is set to strict) - they constitute an error. - - Output parameters: - The value "sourceIllegal" is returned from some routines if the input - sequence is malformed. When "sourceIllegal" is returned, the source - value will point to the illegal value that caused the problem. E.g., - in UTF-8 when a sequence is malformed, it points to the start of the - malformed sequence. - - Author: Mark E. Davis, 1994. - Rev History: Rick McGowan, fixes & updates May 2001. - Fixes & updates, Sept 2001. - ------------------------------------------------------------------------- */ - -/* --------------------------------------------------------------------- - The following 4 definitions are compiler-specific. - The C standard does not guarantee that wchar_t has at least - 16 bits, so wchar_t is no less portable than unsigned short! - All should be unsigned values to avoid sign extension during - bit mask & shift operations. ------------------------------------------------------------------------- */ - -typedef unsigned long UTF32; /* at least 32 bits */ -typedef unsigned short UTF16; /* at least 16 bits */ -typedef unsigned char UTF8; /* typically 8 bits */ -typedef unsigned char Boolean; /* 0 or 1 */ - -/* Some fundamental constants */ -#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD -#define UNI_MAX_BMP (UTF32)0x0000FFFF -#define UNI_MAX_UTF16 (UTF32)0x0010FFFF -#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF -#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF - -typedef enum { - conversionOK, /* conversion successful */ - sourceExhausted, /* partial character in source, but hit end */ - targetExhausted, /* insuff. room in target for conversion */ - sourceIllegal /* source sequence is illegal/malformed */ -} ConversionResult; - -typedef enum { - strictConversion = 0, - lenientConversion -} ConversionFlags; - -/* This is for C++ and does no harm in C */ -#ifdef __cplusplus -extern "C" { -#endif - -ConversionResult ConvertUTF8toUTF16 ( - const UTF8** sourceStart, const UTF8* sourceEnd, - UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); - -ConversionResult ConvertUTF16toUTF8 ( - const UTF16** sourceStart, const UTF16* sourceEnd, - UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); - -ConversionResult ConvertUTF8toUTF32 ( - const UTF8** sourceStart, const UTF8* sourceEnd, - UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); - -ConversionResult ConvertUTF32toUTF8 ( - const UTF32** sourceStart, const UTF32* sourceEnd, - UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); - -ConversionResult ConvertUTF16toUTF32 ( - const UTF16** sourceStart, const UTF16* sourceEnd, - UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); - -ConversionResult ConvertUTF32toUTF16 ( - const UTF32** sourceStart, const UTF32* sourceEnd, - UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); - -Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); - -#ifdef __cplusplus -} -#endif - -/* --------------------------------------------------------------------- */ diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am index f7a8a05090..ee9ec3488d 100644 --- a/ncgen/Makefile.am +++ b/ncgen/Makefile.am @@ -14,7 +14,7 @@ escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c \ semantics.c dump.c util.c bytebuffer.c list.c data.h \ debug.h generr.h genlib.h includes.h ncgen.h odom.h dump.h \ util.h bytebuffer.h list.h genf77.c f77data.c genj.c jdata.c nc_iter.h \ -nc_iter.c ConvertUTF.c ConvertUTF.h \ +nc_iter.c \ ncgeny.c ncgeny.h # This is the man page. diff --git a/ncgen/escapes.c b/ncgen/escapes.c index 5f24fa9305..3211728b3d 100644 --- a/ncgen/escapes.c +++ b/ncgen/escapes.c @@ -5,7 +5,7 @@ *********************************************************************/ #include "includes.h" -#include "ConvertUTF.h" +#include "ncutf8.h" #define HEXCHARS "0123456789abcdefABCDEF" #define OCTCHARS "01234567" @@ -16,48 +16,6 @@ static char* ccodify(const char*); static char* f77codify(const char*); static char* jcodify(const char*); -#if 0 -/* - * Replace escaped chars in CDL representation of name such as - * 'abc\:def\ gh\\i' with unescaped version, such as 'abc:def gh\i'. - */ -/* ?? This seems redundant over expand_escapes*/ -void -deescapify(char* name) -{ - const char *cp = name; - char *sp; - size_t len = strlen(name); - char *newname; - - if(strchr(name, '\\') == NULL) - return; - - newname = (char *) emalloc(len + 1); - cp = name; - sp = newname; - while(*cp != '\0') { /* delete '\' chars, except change '\\' to '\' */ - switch (*cp) { - case '\\': - if(*(cp+1) == '\\') { - *sp++ = '\\'; - cp++; - } - break; - default: - *sp++ = *cp; - break; - } - cp++; - } - *sp = '\0'; - /* ASSERT(strlen(newname) <= strlen(name)); */ - strncpy(name, newname, len+1); /* watch out for trailing null*/ - efree(newname); - return; -} -#endif /*0*/ - /* Given a character c, fill s with the character suitably escaped. E.g. c = '\t' => s="\t" @@ -368,7 +326,7 @@ to suitably escape c for use with Java. */ static void -jescapifychar(UTF16 c, int quote, Bytebuffer* s) +jescapifychar(unsigned short c, int quote, Bytebuffer* s) { /* Separate out ascii from UTF16 */ if(c <= '\177') { @@ -422,25 +380,21 @@ jescapifychar(UTF16 c, int quote, Bytebuffer* s) char* jescapify(char* s0, int quote, size_t len) { + int stat = NC_NOERR; int i; - char* result; - UTF8* s8; - UTF16* s16; /* for storing the utf16 string */ - UTF16* tmp16; /* for storing the utf16 string */ - ConversionResult status; + char* result = NULL; + unsigned char* s8 = NULL; + unsigned short* s16 = NULL; /* for storing the utf16 string */ Bytebuffer* escaped = bbNew(); size_t len16; - s16 = emalloc((1+len)*sizeof(UTF16)); - s8 = (UTF8*)s0; - tmp16 = s16; - status = ConvertUTF8toUTF16((const UTF8**)&s8,s8+len,&tmp16,tmp16+len,lenientConversion); - if(status != conversionOK) { + s8 = (unsigned char*)s0; + stat = nc_utf8_to_utf16(s8, &s16, &len16); + if(stat != NC_NOERR) { derror("Cannot convert UTF8 string to UTF16: %s",s0); - return NULL; + if(s16) efree(s16); + return NULL; } - /* Get the length of the utf16 string */ - len16 = (tmp16 - s16); for(i=0;i 0 #define FLEX_BETA #endif @@ -65,7 +65,6 @@ 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; @@ -73,7 +72,6 @@ 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 @@ -104,6 +102,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -160,7 +160,15 @@ typedef unsigned int flex_uint32_t; /* 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. @@ -186,6 +194,7 @@ extern FILE *ncgin, *ncgout; #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) \ @@ -220,7 +229,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -290,7 +299,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when ncgtext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t ncgleng; /* Points to current character in buffer. */ @@ -362,11 +371,17 @@ extern int ncglineno; int ncglineno = 1; extern char *ncgtext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #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 ); +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__noreturn__)) +#endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the @@ -374,7 +389,7 @@ static void yy_fatal_error (yyconst char msg[] ); */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - ncgleng = (yy_size_t) (yy_cp - yy_bp); \ + ncgleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -438,7 +453,7 @@ static yyconst flex_int16_t yy_accept[417] = 34, 34, 34, 34, 34, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -470,7 +485,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[69] = +static yyconst YY_CHAR yy_meta[69] = { 0, 1, 1, 2, 1, 1, 1, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 1, @@ -481,7 +496,7 @@ static yyconst flex_int32_t yy_meta[69] = 11, 11, 11, 14, 1, 11, 11, 11 } ; -static yyconst flex_int16_t yy_base[435] = +static yyconst flex_uint16_t yy_base[435] = { 0, 0, 0, 325, 321, 264, 255, 318, 2347, 67, 2347, 64, 269, 61, 62, 95, 77, 136, 259, 51, 61, @@ -585,7 +600,7 @@ static yyconst flex_int16_t yy_def[435] = 416, 416, 416, 416 } ; -static yyconst flex_int16_t yy_nxt[2416] = +static yyconst flex_uint16_t yy_nxt[2416] = { 0, 8, 9, 10, 9, 8, 11, 12, 8, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 8, @@ -1320,7 +1335,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* /* Note: this definition of string will work for utf8 as well, although it is a very relaxed definition */ -#line 1324 "lex.ncg.c" +#line 1339 "ncgenl.c" #define INITIAL 0 #define ST_C_COMMENT 1 @@ -1355,11 +1370,11 @@ void ncgset_extra (YY_EXTRA_TYPE user_defined ); FILE *ncgget_in (void ); -void ncgset_in (FILE * in_str ); +void ncgset_in (FILE * _in_str ); FILE *ncgget_out (void ); -void ncgset_out (FILE * out_str ); +void ncgset_out (FILE * _out_str ); yy_size_t ncgget_leng (void ); @@ -1367,7 +1382,7 @@ char *ncgget_text (void ); int ncgget_lineno (void ); -void ncgset_lineno (int line_number ); +void ncgset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1381,8 +1396,12 @@ extern int ncgwrap (void ); #endif #endif +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ); +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -1403,7 +1422,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1411,7 +1435,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout ) +#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1422,7 +1446,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1490,7 +1514,7 @@ extern int ncglex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1500,14 +1524,10 @@ extern int ncglex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 217 "ncgen.l" - -#line 1510 "lex.ncg.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -1534,7 +1554,12 @@ YY_DECL ncg_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 217 "ncgen.l" + +#line 1561 "ncgenl.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -1550,7 +1575,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + 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; @@ -2119,7 +2144,7 @@ YY_RULE_SETUP #line 570 "ncgen.l" ECHO; YY_BREAK -#line 2123 "lex.ncg.c" +#line 2148 "ncgenl.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TEXT): yyterminate(); @@ -2251,6 +2276,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 ncglex */ /* yy_get_next_buffer - try to read in a new buffer @@ -2262,9 +2288,9 @@ case YY_STATE_EOF(TEXT): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + yy_size_t number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2293,7 +2319,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 = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2313,7 +2339,7 @@ static int yy_get_next_buffer (void) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -2375,9 +2401,9 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + int 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()" ); @@ -2396,14 +2422,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + 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; @@ -2428,10 +2454,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2446,12 +2472,14 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 416); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); @@ -2461,10 +2489,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + yy_size_t number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -2486,6 +2514,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2534,7 +2564,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( ncgwrap( ) ) - return 0; + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2635,7 +2665,7 @@ static void ncg_load_buffer_state (void) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)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. @@ -2670,10 +2700,6 @@ static void ncg_load_buffer_state (void) 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 ncgrestart() or at EOF. @@ -2794,7 +2820,7 @@ static void ncgensure_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; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); @@ -2811,7 +2837,7 @@ static void ncgensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc @@ -2878,8 +2904,8 @@ YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr ) /** 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 bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2887,7 +2913,8 @@ YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2918,7 +2945,7 @@ YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2984,29 +3011,29 @@ char *ncgget_text (void) } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void ncgset_lineno (int line_number ) +void ncgset_lineno (int _line_number ) { - ncglineno = 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 ncg_switch_to_buffer */ -void ncgset_in (FILE * in_str ) +void ncgset_in (FILE * _in_str ) { - ncgin = in_str ; + ncgin = _in_str ; } -void ncgset_out (FILE * out_str ) +void ncgset_out (FILE * _out_str ) { - ncgout = out_str ; + ncgout = _out_str ; } int ncgget_debug (void) @@ -3014,9 +3041,9 @@ int ncgget_debug (void) return ncg_flex_debug; } -void ncgset_debug (int bdebug ) +void ncgset_debug (int _bdebug ) { - ncg_flex_debug = bdebug ; + ncg_flex_debug = _bdebug ; } static int yy_init_globals (void) @@ -3076,7 +3103,8 @@ int ncglex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -3085,7 +3113,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -3095,11 +3123,12 @@ static int yy_flex_strlen (yyconst char * s ) void *ncgalloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( 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 @@ -3112,7 +3141,7 @@ void *ncgrealloc (void * ptr, yy_size_t size ) void ncgfree (void * ptr ) { - free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */ + free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" diff --git a/ncgen/ncgeny.c b/ncgen/ncgeny.c index 61ad4e38e6..da81d607a2 100644 --- a/ncgen/ncgeny.c +++ b/ncgen/ncgeny.c @@ -1,14 +1,13 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 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 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -47,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,136 +52,25 @@ /* Pure parsers. */ #define YYPURE 0 -/* Using locations. */ -#define YYLSP_NEEDED 0 +/* Push parsers. */ +#define YYPUSH 0 -/* 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, - IDENT = 270, - TERMSTRING = 271, - CHAR_CONST = 272, - BYTE_CONST = 273, - SHORT_CONST = 274, - INT_CONST = 275, - INT64_CONST = 276, - UBYTE_CONST = 277, - USHORT_CONST = 278, - UINT_CONST = 279, - UINT64_CONST = 280, - FLOAT_CONST = 281, - DOUBLE_CONST = 282, - DIMENSIONS = 283, - VARIABLES = 284, - NETCDF = 285, - DATA = 286, - TYPES = 287, - COMPOUND = 288, - ENUM = 289, - OPAQUE_ = 290, - OPAQUESTRING = 291, - GROUP = 292, - PATH = 293, - FILLMARKER = 294, - NIL = 295, - _FILLVALUE = 296, - _FORMAT = 297, - _STORAGE = 298, - _CHUNKSIZES = 299, - _DEFLATELEVEL = 300, - _SHUFFLE = 301, - _ENDIANNESS = 302, - _NOFILL = 303, - _FLETCHER32 = 304, - _NCPROPS = 305, - _ISNETCDF4 = 306, - _SUPERBLOCK = 307, - DATASETID = 308 - }; -#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 IDENT 270 -#define TERMSTRING 271 -#define CHAR_CONST 272 -#define BYTE_CONST 273 -#define SHORT_CONST 274 -#define INT_CONST 275 -#define INT64_CONST 276 -#define UBYTE_CONST 277 -#define USHORT_CONST 278 -#define UINT_CONST 279 -#define UINT64_CONST 280 -#define FLOAT_CONST 281 -#define DOUBLE_CONST 282 -#define DIMENSIONS 283 -#define VARIABLES 284 -#define NETCDF 285 -#define DATA 286 -#define TYPES 287 -#define COMPOUND 288 -#define ENUM 289 -#define OPAQUE_ 290 -#define OPAQUESTRING 291 -#define GROUP 292 -#define PATH 293 -#define FILLMARKER 294 -#define NIL 295 -#define _FILLVALUE 296 -#define _FORMAT 297 -#define _STORAGE 298 -#define _CHUNKSIZES 299 -#define _DEFLATELEVEL 300 -#define _SHUFFLE 301 -#define _ENDIANNESS 302 -#define _NOFILL 303 -#define _FLETCHER32 304 -#define _NCPROPS 305 -#define _ISNETCDF4 306 -#define _SUPERBLOCK 307 -#define DATASETID 308 +/* Pull parsers. */ +#define YYPULL 1 +/* 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" +#line 11 "ncgen.y" /* yacc.c:339 */ /* static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $"; @@ -309,11 +195,15 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl; extern int lex_init(void); +#line 199 "ncgeny.c" /* yacc.c:339 */ -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -323,37 +213,109 @@ extern int lex_init(void); # define YYERROR_VERBOSE 1 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* 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; #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, + IDENT = 270, + TERMSTRING = 271, + CHAR_CONST = 272, + BYTE_CONST = 273, + SHORT_CONST = 274, + INT_CONST = 275, + INT64_CONST = 276, + UBYTE_CONST = 277, + USHORT_CONST = 278, + UINT_CONST = 279, + UINT64_CONST = 280, + FLOAT_CONST = 281, + DOUBLE_CONST = 282, + DIMENSIONS = 283, + VARIABLES = 284, + NETCDF = 285, + DATA = 286, + TYPES = 287, + COMPOUND = 288, + ENUM = 289, + OPAQUE_ = 290, + OPAQUESTRING = 291, + GROUP = 292, + PATH = 293, + FILLMARKER = 294, + NIL = 295, + _FILLVALUE = 296, + _FORMAT = 297, + _STORAGE = 298, + _CHUNKSIZES = 299, + _DEFLATELEVEL = 300, + _SHUFFLE = 301, + _ENDIANNESS = 302, + _NOFILL = 303, + _FLETCHER32 = 304, + _NCPROPS = 305, + _ISNETCDF4 = 306, + _SUPERBLOCK = 307, + DATASETID = 308 + }; +#endif + +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 138 "ncgen.y" + +union YYSTYPE { +#line 138 "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 193 of yacc.c. */ -#line 344 "ncgen.tab.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 + +#line 302 "ncgeny.c" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif +extern YYSTYPE ncglval; -/* Copy the second part of user declarations. */ +int ncgparse (void); +#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */ -/* Line 216 of yacc.c. */ -#line 357 "ncgen.tab.c" +/* Copy the second part of user declarations. */ + +#line 319 "ncgeny.c" /* yacc.c:358 */ #ifdef short # undef short @@ -367,11 +329,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -391,8 +350,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -406,38 +364,67 @@ 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 +# 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__)) # 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 -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#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") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return i; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -456,11 +443,11 @@ YYID (i) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -468,8 +455,8 @@ YYID (i) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (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 @@ -483,25 +470,23 @@ YYID (i) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -511,14 +496,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; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -529,42 +514,46 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* 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) \ - 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)) +# 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) #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. */ @@ -576,17 +565,19 @@ union yyalloc #define YYNNTS 67 /* YYNRULES -- Number of rules. */ #define YYNRULES 151 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 258 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 308 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -623,79 +614,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* 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, 137, 139, 142, - 145, 149, 151, 153, 155, 159, 163, 167, 169, 170, - 172, 175, 178, 182, 184, 186, 189, 191, 195, 198, - 199, 203, 205, 209, 211, 213, 217, 220, 221, 225, - 227, 231, 233, 235, 237, 239, 241, 243, 244, 248, - 253, 258, 263, 268, 275, 281, 287, 294, 300, 306, - 312, 318, 324, 330, 336, 341, 343, 345, 346, 348, - 351, 354, 358, 362, 364, 366, 367, 369, 373, 375, - 379, 381, 383, 385, 387, 389, 391, 393, 398, 400, - 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, - 424, 426, 428, 430, 434, 436, 438, 440, 442, 444, - 446, 448 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 64, 0, -1, 30, 65, 66, -1, 53, -1, 54, - 67, 68, 55, -1, 110, 72, 87, 93, 113, -1, - -1, 68, 69, -1, -1, -1, 37, 129, 54, 70, - 67, 68, 71, 55, 110, -1, -1, 32, -1, 32, - 73, -1, 75, -1, 73, 75, -1, 129, -1, 76, - -1, 111, 56, -1, 78, 77, -1, 83, 77, -1, - 82, 77, -1, 81, 77, -1, -1, 56, -1, 86, - 34, 74, 54, 79, 55, -1, 80, -1, 79, 57, - 80, -1, 129, 58, 126, -1, 35, 59, 20, 60, - 74, -1, 108, 59, 61, 60, 74, -1, 33, 74, - 54, 84, 55, -1, 85, 56, -1, 84, 85, 56, - -1, 108, 102, -1, 4, -1, 5, -1, 6, -1, - 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, - 12, -1, 13, -1, 14, -1, -1, 28, -1, 28, - 88, -1, 89, 56, -1, 88, 89, 56, -1, 90, - -1, 111, -1, 91, -1, 90, 57, 91, -1, 92, - 58, 126, -1, 92, 58, 3, -1, 129, -1, -1, - 29, -1, 29, 94, -1, 95, 56, -1, 94, 95, - 56, -1, 96, -1, 111, -1, 108, 97, -1, 98, - -1, 97, 57, 98, -1, 129, 99, -1, -1, 59, - 100, 60, -1, 101, -1, 100, 57, 101, -1, 112, - -1, 103, -1, 102, 57, 103, -1, 129, 104, -1, - -1, 59, 105, 60, -1, 106, -1, 105, 57, 106, - -1, 24, -1, 20, -1, 109, -1, 109, -1, 112, - -1, 86, -1, -1, 111, 56, 110, -1, 62, 50, - 58, 127, -1, 62, 51, 58, 128, -1, 62, 52, - 58, 126, -1, 62, 129, 58, 116, -1, 108, 109, - 62, 129, 58, 116, -1, 109, 62, 129, 58, 116, - -1, 109, 62, 41, 58, 116, -1, 108, 109, 62, - 41, 58, 116, -1, 109, 62, 43, 58, 127, -1, - 109, 62, 44, 58, 125, -1, 109, 62, 49, 58, - 128, -1, 109, 62, 45, 58, 126, -1, 109, 62, - 46, 58, 128, -1, 109, 62, 47, 58, 127, -1, - 109, 62, 48, 58, 128, -1, 62, 42, 58, 127, - -1, 129, -1, 38, -1, -1, 31, -1, 31, 114, - -1, 115, 56, -1, 114, 115, 56, -1, 107, 58, - 116, -1, 117, -1, 118, -1, -1, 119, -1, 116, - 57, 119, -1, 120, -1, 54, 116, 55, -1, 124, - -1, 36, -1, 39, -1, 40, -1, 121, -1, 122, - -1, 112, -1, 129, 59, 123, 60, -1, 124, -1, - 123, 57, 124, -1, 17, -1, 18, -1, 19, -1, - 20, -1, 21, -1, 22, -1, 23, -1, 24, -1, - 25, -1, 26, -1, 27, -1, 16, -1, 126, -1, - 125, 57, 126, -1, 20, -1, 24, -1, 21, -1, - 25, -1, 16, -1, 127, -1, 126, -1, 15, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 218, 218, 224, 226, 233, 240, 240, 243, 252, @@ -717,7 +636,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -734,24 +653,24 @@ static const char *const yytname[] = "_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", "DATASETID", "'{'", "'}'", "';'", "','", "'='", "'('", "')'", "'*'", "':'", "$accept", "ncdesc", "datasetid", "rootgroup", "groupbody", "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", "attrdecllist", "attrdecl", "path", "datasection", - "datadecls", "datadecl", "datalist", "datalist0", "datalist1", - "dataitem", "constdata", "econstref", "function", "arglist", - "simpleconstant", "intlist", "constint", "conststring", "constbool", - "ident", 0 + "$@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", + "attrdecllist", "attrdecl", "path", "datasection", "datadecls", + "datadecl", "datalist", "datalist0", "datalist1", "dataitem", + "constdata", "econstref", "function", "arglist", "simpleconstant", + "intlist", "constint", "conststring", "constbool", "ident", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -764,96 +683,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 63, 64, 65, 66, 67, 68, 68, 70, 71, - 69, 72, 72, 72, 73, 73, 74, 75, 75, 76, - 76, 76, 76, 77, 77, 78, 79, 79, 80, 81, - 82, 83, 84, 84, 85, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 87, 87, 87, 88, - 88, 89, 89, 90, 90, 91, 91, 92, 93, 93, - 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, - 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, - 105, 106, 106, 107, 108, 109, 109, 110, 110, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 112, 112, 113, 113, 113, - 114, 114, 115, 116, 116, 117, 118, 118, 119, 119, - 120, 120, 120, 120, 120, 120, 121, 122, 123, 123, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 125, 125, 126, 126, 126, 126, 127, 128, - 128, 129 -}; +#define YYPACT_NINF -133 -/* YYR2[YYN] -- Number of symbols composing 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, 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, 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 yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-133))) -/* 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, 87, 2, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 151, - 106, 0, 6, 86, 0, 84, 11, 0, 85, 105, - 0, 0, 0, 0, 0, 0, 0, 0, 12, 46, - 87, 0, 0, 0, 0, 115, 0, 4, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 13, 14, 17, 23, 23, 23, 23, 86, 0, - 0, 47, 58, 88, 148, 104, 89, 144, 146, 145, - 147, 150, 149, 90, 91, 141, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 121, 122, 123, - 115, 126, 92, 113, 114, 116, 118, 124, 125, 120, - 105, 0, 0, 0, 115, 0, 0, 0, 0, 0, - 0, 0, 115, 0, 16, 0, 15, 24, 19, 22, - 21, 20, 0, 0, 18, 48, 0, 51, 53, 0, - 52, 105, 59, 107, 0, 0, 0, 8, 115, 115, - 95, 97, 98, 142, 100, 101, 102, 103, 99, 94, - 0, 0, 0, 0, 0, 49, 0, 0, 60, 0, - 63, 0, 64, 108, 5, 119, 117, 0, 128, 87, - 96, 93, 0, 0, 0, 0, 84, 0, 0, 0, - 50, 54, 57, 56, 55, 0, 61, 65, 66, 69, - 0, 83, 109, 0, 0, 127, 6, 143, 31, 0, - 32, 34, 74, 77, 29, 0, 26, 0, 30, 62, - 0, 0, 68, 115, 0, 110, 129, 9, 33, 0, - 0, 76, 25, 0, 0, 67, 69, 0, 71, 73, - 112, 111, 0, 75, 82, 81, 0, 79, 27, 28, - 0, 70, 87, 0, 78, 72, 10, 80 -}; +#define YYTABLE_NINF -106 -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 2, 4, 7, 22, 35, 48, 179, 242, 39, - 61, 123, 62, 63, 128, 64, 215, 216, 65, 66, - 67, 183, 184, 23, 72, 135, 136, 137, 138, 139, - 143, 168, 169, 170, 197, 198, 222, 237, 238, 211, - 212, 231, 246, 247, 200, 24, 25, 26, 27, 28, - 174, 202, 203, 102, 103, 104, 105, 106, 107, 108, - 177, 109, 152, 81, 82, 83, 29 -}; +#define yytable_value_is_error(Yytable_value) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -133 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { -11, -48, 20, -133, -19, -133, 210, -133, -133, -133, @@ -884,7 +725,40 @@ static const yytype_int16 yypact[] = -12, -133, 210, -2, -133, -133, -133, -133 }; -/* YYPGOTO[NTERM-NUM]. */ + /* 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. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 3, 0, 1, 87, 2, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 151, + 106, 0, 6, 86, 0, 84, 11, 0, 85, 105, + 0, 0, 0, 0, 0, 0, 0, 0, 12, 46, + 87, 0, 0, 0, 0, 115, 0, 4, 7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 13, 14, 17, 23, 23, 23, 23, 86, 0, + 0, 47, 58, 88, 148, 104, 89, 144, 146, 145, + 147, 150, 149, 90, 91, 141, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 121, 122, 123, + 115, 126, 92, 113, 114, 116, 118, 124, 125, 120, + 105, 0, 0, 0, 115, 0, 0, 0, 0, 0, + 0, 0, 115, 0, 16, 0, 15, 24, 19, 22, + 21, 20, 0, 0, 18, 48, 0, 51, 53, 0, + 52, 105, 59, 107, 0, 0, 0, 8, 115, 115, + 95, 97, 98, 142, 100, 101, 102, 103, 99, 94, + 0, 0, 0, 0, 0, 49, 0, 0, 60, 0, + 63, 0, 64, 108, 5, 119, 117, 0, 128, 87, + 96, 93, 0, 0, 0, 0, 84, 0, 0, 0, + 50, 54, 57, 56, 55, 0, 61, 65, 66, 69, + 0, 83, 109, 0, 0, 127, 6, 143, 31, 0, + 32, 34, 74, 77, 29, 0, 26, 0, 30, 62, + 0, 0, 68, 115, 0, 110, 129, 9, 33, 0, + 0, 76, 25, 0, 0, 67, 69, 0, 71, 73, + 112, 111, 0, 75, 82, 81, 0, 79, 27, 28, + 0, 70, 87, 0, 78, 72, 10, 80 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -133, -133, -133, -133, 28, 4, -133, -133, -133, -133, @@ -896,11 +770,21 @@ static const yytype_int16 yypgoto[] = -133, -132, -133, -42, -31, -76, -21 }; -/* 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 -106 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 4, 7, 22, 35, 48, 179, 242, 39, + 61, 123, 62, 63, 128, 64, 215, 216, 65, 66, + 67, 183, 184, 23, 72, 135, 136, 137, 138, 139, + 143, 168, 169, 170, 197, 198, 222, 237, 238, 211, + 212, 231, 246, 247, 200, 24, 25, 26, 27, 28, + 174, 202, 203, 102, 103, 104, 105, 106, 107, 108, + 177, 109, 152, 81, 82, 83, 29 +}; + + /* 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. */ static const yytype_int16 yytable[] = { 34, 73, 84, 19, 101, 3, 36, 144, 70, 69, @@ -985,8 +869,8 @@ static const yytype_int16 yycheck[] = 38 }; -/* 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, 30, 64, 53, 65, 0, 54, 66, 4, 5, @@ -1017,96 +901,84 @@ static const yytype_uint8 yystos[] = 57, 60, 55, 57, 60, 101, 110, 106 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 63, 64, 65, 66, 67, 68, 68, 70, 71, + 69, 72, 72, 72, 73, 73, 74, 75, 75, 76, + 76, 76, 76, 77, 77, 78, 79, 79, 80, 81, + 82, 83, 84, 84, 85, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 87, 87, 87, 88, + 88, 89, 89, 90, 90, 91, 91, 92, 93, 93, + 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, + 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, + 105, 106, 106, 107, 108, 109, 109, 110, 110, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 112, 112, 113, 113, 113, + 114, 114, 115, 116, 116, 117, 118, 118, 119, 119, + 120, 120, 120, 120, 120, 120, 121, 122, 123, 123, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 125, 125, 126, 126, 126, 126, 127, 128, + 128, 129 +}; + + /* 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, 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, 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 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 -/* 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 YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif + YYERROR; \ + } \ +while (0) +/* 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 @@ -1115,54 +987,46 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# 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 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 - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -1170,22 +1034,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -1196,66 +1049,54 @@ yy_symbol_print (yyoutput, yytype, 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 (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { + 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++) { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1269,7 +1110,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1284,7 +1125,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1293,15 +1133,8 @@ 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++) @@ -1317,16 +1150,8 @@ yystrlen (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; @@ -1356,27 +1181,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: ; } @@ -1387,211 +1212,209 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* 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) { - int yyn = yypact[yystate]; + 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; + } + } + } + } - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + switch (yycount) { - 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; +# 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) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* 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); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } - -/* 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 look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead 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) -#else -int -yyparse () - -#endif -#endif { - - int yystate; + 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; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ + /* Lookahead 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]; @@ -1599,54 +1422,22 @@ yyparse () 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. */ - - /* 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; - + yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. @@ -1667,25 +1458,23 @@ yyparse () #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 @@ -1693,23 +1482,22 @@ yyparse () # 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); - YYSTACK_RELOCATE (yyvs); - + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1717,16 +1505,18 @@ yyparse () 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; /*-----------. @@ -1735,20 +1525,20 @@ yyparse () yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (); } if (yychar <= YYEOF) @@ -1770,29 +1560,27 @@ yyparse () yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + 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 look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1815,7 +1603,7 @@ yyparse () 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 @@ -1829,75 +1617,84 @@ yyparse () switch (yyn) { case 2: -#line 221 "ncgen.y" - {if (error_count > 0) YYABORT;;} +#line 221 "ncgen.y" /* yacc.c:1646 */ + {if (error_count > 0) YYABORT;} +#line 1623 "ncgeny.c" /* yacc.c:1646 */ break; case 3: -#line 224 "ncgen.y" - {createrootgroup(datasetname);;} +#line 224 "ncgen.y" /* yacc.c:1646 */ + {createrootgroup(datasetname);} +#line 1629 "ncgeny.c" /* yacc.c:1646 */ break; case 8: -#line 243 "ncgen.y" +#line 243 "ncgen.y" /* yacc.c:1646 */ { - Symbol* id = (yyvsp[(2) - (3)].sym); + Symbol* id = (yyvsp[-1].sym); markcdf4("Group specification"); if(creategroup(id) == NULL) yyerror("duplicate group declaration within parent group for %s", id->name); - ;} + } +#line 1641 "ncgeny.c" /* yacc.c:1646 */ break; case 9: -#line 252 "ncgen.y" - {listpop(groupstack);;} +#line 252 "ncgen.y" /* yacc.c:1646 */ + {listpop(groupstack);} +#line 1647 "ncgeny.c" /* yacc.c:1646 */ break; case 12: -#line 258 "ncgen.y" - {;} +#line 258 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1653 "ncgeny.c" /* yacc.c:1646 */ break; case 13: -#line 260 "ncgen.y" - {markcdf4("Type specification");;} +#line 260 "ncgen.y" /* yacc.c:1646 */ + {markcdf4("Type specification");} +#line 1659 "ncgeny.c" /* yacc.c:1646 */ break; case 16: -#line 266 "ncgen.y" +#line 266 "ncgen.y" /* yacc.c:1646 */ { /* Use when defining a type */ - (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE; - if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym))) + (yyvsp[0].sym)->objectclass = NC_TYPE; + if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym))) yyerror("duplicate type declaration for %s", - (yyvsp[(1) - (1)].sym)->name); - listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym)); - ;} + (yyvsp[0].sym)->name); + listpush(typdefs,(void*)(yyvsp[0].sym)); + } +#line 1671 "ncgeny.c" /* yacc.c:1646 */ break; case 17: -#line 275 "ncgen.y" - {;} +#line 275 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1677 "ncgeny.c" /* yacc.c:1646 */ break; case 18: -#line 275 "ncgen.y" - {;} +#line 275 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1683 "ncgeny.c" /* yacc.c:1646 */ break; case 25: -#line 289 "ncgen.y" +#line 289 "ncgen.y" /* yacc.c:1646 */ { int i; - 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); + 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); stacklen=listlength(stack); - (yyvsp[(3) - (6)].sym)->subnodes = listnew(); + (yyvsp[-3].sym)->subnodes = listnew(); /* Variety of field fixups*/ /* 1. add in the enum values*/ /* 2. make this type be their container*/ @@ -1907,83 +1704,89 @@ yyparse () Symbol* eid = (Symbol*)listget(stack,i); assert(eid->subclass == NC_ECONST); addtogroup(eid); - listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid); - eid->container = (yyvsp[(3) - (6)].sym); - eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype; + listpush((yyvsp[-3].sym)->subnodes,(void*)eid); + eid->container = (yyvsp[-3].sym); + eid->typ.basetype = (yyvsp[-3].sym)->typ.basetype; } listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 1714 "ncgeny.c" /* yacc.c:1646 */ break; case 26: -#line 318 "ncgen.y" - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} +#line 318 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 1720 "ncgeny.c" /* yacc.c:1646 */ break; case 27: -#line 320 "ncgen.y" +#line 320 "ncgen.y" /* yacc.c:1646 */ { int i; - (yyval.mark)=(yyvsp[(1) - (3)].mark); + (yyval.mark)=(yyvsp[-2].mark); /* check for duplicates*/ - stackbase=(yyvsp[(1) - (3)].mark); + stackbase=(yyvsp[-2].mark); stacklen=listlength(stack); for(i=stackbase;iname,elem->name)==0) + if(strcmp((yyvsp[0].sym)->name,elem->name)==0) yyerror("duplicate enum declaration for %s", elem->name); } - listpush(stack,(void*)(yyvsp[(3) - (3)].sym)); - ;} + listpush(stack,(void*)(yyvsp[0].sym)); + } +#line 1739 "ncgeny.c" /* yacc.c:1646 */ break; case 28: -#line 337 "ncgen.y" +#line 337 "ncgen.y" /* 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); - ;} + (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 1750 "ncgeny.c" /* yacc.c:1646 */ break; case 29: -#line 346 "ncgen.y" +#line 346 "ncgen.y" /* yacc.c:1646 */ { vercheck(NC_OPAQUE); - 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=nctypealignment(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=nctypealignment(NC_OPAQUE); + } +#line 1764 "ncgeny.c" /* yacc.c:1646 */ break; case 30: -#line 358 "ncgen.y" +#line 358 "ncgen.y" /* yacc.c:1646 */ { - Symbol* basetype = (yyvsp[(1) - (5)].sym); + Symbol* basetype = (yyvsp[-4].sym); vercheck(NC_VLEN); - 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=nctypealignment(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=nctypealignment(NC_VLEN); + } +#line 1780 "ncgeny.c" /* yacc.c:1646 */ break; case 31: -#line 372 "ncgen.y" +#line 372 "ncgen.y" /* yacc.c:1646 */ { int i,j; vercheck(NC_COMPOUND); - addtogroup((yyvsp[(2) - (5)].sym)); + addtogroup((yyvsp[-3].sym)); /* check for duplicate field names*/ - stackbase=(yyvsp[(4) - (5)].mark); + stackbase=(yyvsp[-1].mark); stacklen=listlength(stack); for(i=stackbase;iobjectclass=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(); + (yyvsp[-3].sym)->objectclass=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(); /* Add in the fields*/ for(i=stackbase;icontainer = (yyvsp[(2) - (5)].sym); - listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym); + fsym->container = (yyvsp[-3].sym); + listpush((yyvsp[-3].sym)->subnodes,(void*)fsym); } listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 1814 "ncgeny.c" /* yacc.c:1646 */ break; case 32: -#line 404 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (2)].mark);;} +#line 404 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-1].mark);} +#line 1820 "ncgeny.c" /* yacc.c:1646 */ break; case 33: -#line 405 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark);;} +#line 405 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-2].mark);} +#line 1826 "ncgeny.c" /* yacc.c:1646 */ break; case 34: -#line 409 "ncgen.y" +#line 409 "ncgen.y" /* yacc.c:1646 */ { int i; - (yyval.mark)=(yyvsp[(2) - (2)].mark); - stackbase=(yyvsp[(2) - (2)].mark); + (yyval.mark)=(yyvsp[0].mark); + stackbase=(yyvsp[0].mark); stacklen=listlength(stack); /* process each field in the fieldlist*/ for(i=stackbase;ityp.basetype = (yyvsp[(1) - (2)].sym); + f->typ.basetype = (yyvsp[-1].sym); } - ;} + } +#line 1842 "ncgeny.c" /* yacc.c:1646 */ break; case 35: -#line 422 "ncgen.y" - { (yyval.sym) = primsymbols[NC_CHAR]; ;} +#line 422 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym) = primsymbols[NC_CHAR]; } +#line 1848 "ncgeny.c" /* yacc.c:1646 */ break; case 36: -#line 423 "ncgen.y" - { (yyval.sym) = primsymbols[NC_BYTE]; ;} +#line 423 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym) = primsymbols[NC_BYTE]; } +#line 1854 "ncgeny.c" /* yacc.c:1646 */ break; case 37: -#line 424 "ncgen.y" - { (yyval.sym) = primsymbols[NC_SHORT]; ;} +#line 424 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym) = primsymbols[NC_SHORT]; } +#line 1860 "ncgeny.c" /* yacc.c:1646 */ break; case 38: -#line 425 "ncgen.y" - { (yyval.sym) = primsymbols[NC_INT]; ;} +#line 425 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym) = primsymbols[NC_INT]; } +#line 1866 "ncgeny.c" /* yacc.c:1646 */ break; case 39: -#line 426 "ncgen.y" - { (yyval.sym) = primsymbols[NC_FLOAT]; ;} +#line 426 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym) = primsymbols[NC_FLOAT]; } +#line 1872 "ncgeny.c" /* yacc.c:1646 */ break; case 40: -#line 427 "ncgen.y" - { (yyval.sym) = primsymbols[NC_DOUBLE]; ;} +#line 427 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym) = primsymbols[NC_DOUBLE]; } +#line 1878 "ncgeny.c" /* yacc.c:1646 */ break; case 41: -#line 428 "ncgen.y" - { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; ;} +#line 428 "ncgen.y" /* yacc.c:1646 */ + { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } +#line 1884 "ncgeny.c" /* yacc.c:1646 */ break; case 42: -#line 429 "ncgen.y" - { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; ;} +#line 429 "ncgen.y" /* yacc.c:1646 */ + { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } +#line 1890 "ncgeny.c" /* yacc.c:1646 */ break; case 43: -#line 430 "ncgen.y" - { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; ;} +#line 430 "ncgen.y" /* yacc.c:1646 */ + { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } +#line 1896 "ncgeny.c" /* yacc.c:1646 */ break; case 44: -#line 431 "ncgen.y" - { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; ;} +#line 431 "ncgen.y" /* yacc.c:1646 */ + { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } +#line 1902 "ncgeny.c" /* yacc.c:1646 */ break; case 45: -#line 432 "ncgen.y" - { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; ;} +#line 432 "ncgen.y" /* yacc.c:1646 */ + { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } +#line 1908 "ncgeny.c" /* yacc.c:1646 */ break; case 47: -#line 436 "ncgen.y" - {;} +#line 436 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1914 "ncgeny.c" /* yacc.c:1646 */ break; case 48: -#line 437 "ncgen.y" - {;} +#line 437 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1920 "ncgeny.c" /* yacc.c:1646 */ break; case 51: -#line 444 "ncgen.y" - {;} +#line 444 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1926 "ncgeny.c" /* yacc.c:1646 */ break; case 52: -#line 444 "ncgen.y" - {;} +#line 444 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1932 "ncgeny.c" /* yacc.c:1646 */ break; case 55: -#line 452 "ncgen.y" +#line 452 "ncgen.y" /* yacc.c:1646 */ { - (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)extractint((yyvsp[(3) - (3)].constant)); + (yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant)); #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long long)(yyvsp[(1) - (3)].sym)->dim.declsize); +fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize); #endif - ;} + } +#line 1943 "ncgeny.c" /* yacc.c:1646 */ break; case 56: -#line 459 "ncgen.y" +#line 459 "ncgen.y" /* yacc.c:1646 */ { - (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED; - (yyvsp[(1) - (3)].sym)->dim.isunlimited = 1; + (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED; + (yyvsp[-2].sym)->dim.isunlimited = 1; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); +fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); #endif - ;} + } +#line 1955 "ncgeny.c" /* yacc.c:1646 */ break; case 57: -#line 469 "ncgen.y" +#line 469 "ncgen.y" /* yacc.c:1646 */ { - (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM; - if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym))) + (yyvsp[0].sym)->objectclass=NC_DIM; + if(dupobjectcheck(NC_DIM,(yyvsp[0].sym))) yyerror( "Duplicate dimension declaration for %s", - (yyvsp[(1) - (1)].sym)->name); - addtogroup((yyvsp[(1) - (1)].sym)); - (yyval.sym)=(yyvsp[(1) - (1)].sym); - listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym)); - ;} + (yyvsp[0].sym)->name); + addtogroup((yyvsp[0].sym)); + (yyval.sym)=(yyvsp[0].sym); + listpush(dimdefs,(void*)(yyvsp[0].sym)); + } +#line 1969 "ncgeny.c" /* yacc.c:1646 */ break; case 59: -#line 481 "ncgen.y" - {;} +#line 481 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1975 "ncgeny.c" /* yacc.c:1646 */ break; case 60: -#line 482 "ncgen.y" - {;} +#line 482 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1981 "ncgeny.c" /* yacc.c:1646 */ break; case 63: -#line 489 "ncgen.y" - {;} +#line 489 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1987 "ncgeny.c" /* yacc.c:1646 */ break; case 64: -#line 489 "ncgen.y" - {;} +#line 489 "ncgen.y" /* yacc.c:1646 */ + {} +#line 1993 "ncgeny.c" /* yacc.c:1646 */ break; case 65: -#line 492 "ncgen.y" +#line 492 "ncgen.y" /* yacc.c:1646 */ { int i; - stackbase=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[0].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) - (2)].sym); + sym->typ.basetype = (yyvsp[-1].sym); addtogroup(sym); listpush(vardefs,(void*)sym); } } listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 2017 "ncgeny.c" /* yacc.c:1646 */ break; case 66: -#line 514 "ncgen.y" +#line 514 "ncgen.y" /* yacc.c:1646 */ {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); - ;} + listpush(stack,(void*)(yyvsp[0].sym)); + } +#line 2025 "ncgeny.c" /* yacc.c:1646 */ break; case 67: -#line 518 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} +#line 518 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2031 "ncgeny.c" /* yacc.c:1646 */ break; case 68: -#line 522 "ncgen.y" +#line 522 "ncgen.y" /* yacc.c:1646 */ { int i; Dimset dimset; stacklen=listlength(stack); - stackbase=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[0].mark); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2218,70 +2050,78 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); Symbol* dsym = (Symbol*)listget(stack,stackbase+i); dimset.dimsyms[i] = dsym; } - (yyvsp[(1) - (2)].sym)->typ.dimset = dimset; + (yyvsp[-1].sym)->typ.dimset = dimset; } - (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/ - (yyvsp[(1) - (2)].sym)->objectclass=NC_VAR; + (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/ + (yyvsp[-1].sym)->objectclass=NC_VAR; listsetlength(stack,stackbase);/* remove stack nodes*/ - ;} + } +#line 2060 "ncgeny.c" /* yacc.c:1646 */ break; case 69: -#line 548 "ncgen.y" - {(yyval.mark)=listlength(stack);;} +#line 548 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=listlength(stack);} +#line 2066 "ncgeny.c" /* yacc.c:1646 */ break; case 70: -#line 549 "ncgen.y" - {(yyval.mark)=(yyvsp[(2) - (3)].mark);;} +#line 549 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2072 "ncgeny.c" /* yacc.c:1646 */ break; case 71: -#line 552 "ncgen.y" - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} +#line 552 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2078 "ncgeny.c" /* yacc.c:1646 */ break; case 72: -#line 554 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} +#line 554 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2084 "ncgeny.c" /* yacc.c:1646 */ break; case 73: -#line 558 "ncgen.y" - {Symbol* dimsym = (yyvsp[(1) - (1)].sym); +#line 558 "ncgen.y" /* yacc.c:1646 */ + {Symbol* dimsym = (yyvsp[0].sym); dimsym->objectclass = NC_DIM; /* Find the actual dimension*/ dimsym = locate(dimsym); if(dimsym == NULL) { - derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name); + derror("Undefined or forward referenced dimension: %s",(yyvsp[0].sym)->name); YYABORT; } (yyval.sym)=dimsym; - ;} + } +#line 2099 "ncgeny.c" /* yacc.c:1646 */ break; case 74: -#line 572 "ncgen.y" +#line 572 "ncgen.y" /* yacc.c:1646 */ {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); - ;} + listpush(stack,(void*)(yyvsp[0].sym)); + } +#line 2107 "ncgeny.c" /* yacc.c:1646 */ break; case 75: -#line 576 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} +#line 576 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2113 "ncgeny.c" /* yacc.c:1646 */ break; case 76: -#line 581 "ncgen.y" +#line 581 "ncgen.y" /* yacc.c:1646 */ { int i; Dimset dimset; - stackbase=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[0].mark); stacklen=listlength(stack); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2292,38 +2132,43 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); Symbol* dsym = (Symbol*)listget(stack,stackbase+i); dimset.dimsyms[i] = dsym; } - (yyvsp[(1) - (2)].sym)->typ.dimset = dimset; + (yyvsp[-1].sym)->typ.dimset = dimset; } - (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/ - (yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE; - (yyvsp[(1) - (2)].sym)->subclass=NC_FIELD; + (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/ + (yyvsp[-1].sym)->objectclass=NC_TYPE; + (yyvsp[-1].sym)->subclass=NC_FIELD; listsetlength(stack,stackbase);/* remove stack nodes*/ - (yyval.sym) = (yyvsp[(1) - (2)].sym); - ;} + (yyval.sym) = (yyvsp[-1].sym); + } +#line 2144 "ncgeny.c" /* yacc.c:1646 */ break; case 77: -#line 609 "ncgen.y" - {(yyval.mark)=listlength(stack);;} +#line 609 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=listlength(stack);} +#line 2150 "ncgeny.c" /* yacc.c:1646 */ break; case 78: -#line 610 "ncgen.y" - {(yyval.mark)=(yyvsp[(2) - (3)].mark);;} +#line 610 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2156 "ncgeny.c" /* yacc.c:1646 */ break; case 79: -#line 614 "ncgen.y" - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;} +#line 614 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2162 "ncgeny.c" /* yacc.c:1646 */ break; case 80: -#line 616 "ncgen.y" - {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;} +#line 616 "ncgen.y" /* yacc.c:1646 */ + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2168 "ncgeny.c" /* yacc.c:1646 */ break; case 81: -#line 621 "ncgen.y" +#line 621 "ncgen.y" /* yacc.c:1646 */ { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2332,11 +2177,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); (yyval.sym)->objectclass = NC_DIM; (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = uint32_val; - ;} + } +#line 2182 "ncgeny.c" /* yacc.c:1646 */ break; case 82: -#line 631 "ncgen.y" +#line 631 "ncgen.y" /* yacc.c:1646 */ { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2349,34 +2195,37 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); (yyval.sym)->objectclass = NC_DIM; (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = int32_val; - ;} + } +#line 2200 "ncgeny.c" /* yacc.c:1646 */ break; case 83: -#line 651 "ncgen.y" - {Symbol* vsym = (yyvsp[(1) - (1)].sym); +#line 651 "ncgen.y" /* yacc.c:1646 */ + {Symbol* vsym = (yyvsp[0].sym); if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); YYABORT; } (yyval.sym)=vsym; - ;} + } +#line 2212 "ncgeny.c" /* yacc.c:1646 */ break; case 84: -#line 662 "ncgen.y" - {Symbol* tsym = (yyvsp[(1) - (1)].sym); +#line 662 "ncgen.y" /* yacc.c:1646 */ + {Symbol* tsym = (yyvsp[0].sym); if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); YYABORT; } (yyval.sym)=tsym; - ;} + } +#line 2224 "ncgeny.c" /* yacc.c:1646 */ break; case 85: -#line 673 "ncgen.y" - {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym; +#line 673 "ncgen.y" /* yacc.c:1646 */ + {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; /* disambiguate*/ tvsym->objectclass = NC_VAR; sym = locate(tvsym); @@ -2384,359 +2233,432 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); tvsym->objectclass = NC_TYPE; sym = locate(tvsym); if(tvsym == NULL) { - derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name); + derror("Undefined or forward referenced name: %s",(yyvsp[0].sym)->name); YYABORT; } else tvsym = sym; } else tvsym = sym; if(tvsym == NULL) { - derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name); + derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name); YYABORT; } (yyval.sym)=tvsym; - ;} + } +#line 2247 "ncgeny.c" /* yacc.c:1646 */ break; case 86: -#line 691 "ncgen.y" - {(yyval.sym)=(yyvsp[(1) - (1)].sym);;} +#line 691 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym)=(yyvsp[0].sym);} +#line 2253 "ncgeny.c" /* yacc.c:1646 */ break; case 87: -#line 698 "ncgen.y" - {;} +#line 698 "ncgen.y" /* yacc.c:1646 */ + {} +#line 2259 "ncgeny.c" /* yacc.c:1646 */ break; case 88: -#line 698 "ncgen.y" - {;} +#line 698 "ncgen.y" /* yacc.c:1646 */ + {} +#line 2265 "ncgeny.c" /* yacc.c:1646 */ break; case 89: -#line 702 "ncgen.y" - {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;} +#line 702 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);} +#line 2271 "ncgeny.c" /* yacc.c:1646 */ break; case 90: -#line 704 "ncgen.y" - {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;} +#line 704 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);} +#line 2277 "ncgeny.c" /* yacc.c:1646 */ break; case 91: -#line 706 "ncgen.y" - {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;} +#line 706 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);} +#line 2283 "ncgeny.c" /* yacc.c:1646 */ break; case 92: -#line 708 "ncgen.y" - { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);;} +#line 708 "ncgen.y" /* yacc.c:1646 */ + { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} +#line 2289 "ncgeny.c" /* yacc.c:1646 */ break; case 93: -#line 710 "ncgen.y" - {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym); +#line 710 "ncgen.y" /* yacc.c:1646 */ + {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(vsym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR); } else { derror("Doubly typed attribute: %s",asym->name); YYABORT; } - ;} + } +#line 2302 "ncgeny.c" /* yacc.c:1646 */ break; case 94: -#line 719 "ncgen.y" - {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym); +#line 719 "ncgen.y" /* yacc.c:1646 */ + {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(sym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR); } else if(sym->objectclass == NC_TYPE) { - (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL); + (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[0].datalist),ATTRGLOBAL); } else { derror("Attribute prefix not a variable or type: %s",asym->name); YYABORT; } - ;} + } +#line 2317 "ncgeny.c" /* yacc.c:1646 */ break; case 95: -#line 730 "ncgen.y" - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);;} +#line 730 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);} +#line 2323 "ncgeny.c" /* yacc.c:1646 */ break; case 96: -#line 732 "ncgen.y" - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),0);;} +#line 732 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);} +#line 2329 "ncgeny.c" /* yacc.c:1646 */ break; case 97: -#line 734 "ncgen.y" - {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;} +#line 734 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} +#line 2335 "ncgeny.c" /* yacc.c:1646 */ break; case 98: -#line 736 "ncgen.y" - {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);;} +#line 736 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);} +#line 2341 "ncgeny.c" /* yacc.c:1646 */ break; case 99: -#line 738 "ncgen.y" - {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;} +#line 738 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} +#line 2347 "ncgeny.c" /* yacc.c:1646 */ break; case 100: -#line 740 "ncgen.y" - {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;} +#line 740 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} +#line 2353 "ncgeny.c" /* yacc.c:1646 */ break; case 101: -#line 742 "ncgen.y" - {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;} +#line 742 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} +#line 2359 "ncgeny.c" /* yacc.c:1646 */ break; case 102: -#line 744 "ncgen.y" - {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;} +#line 744 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} +#line 2365 "ncgeny.c" /* yacc.c:1646 */ break; case 103: -#line 746 "ncgen.y" - {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;} +#line 746 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} +#line 2371 "ncgeny.c" /* yacc.c:1646 */ break; case 104: -#line 748 "ncgen.y" - {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),1);;} +#line 748 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);} +#line 2377 "ncgeny.c" /* yacc.c:1646 */ break; case 105: -#line 753 "ncgen.y" +#line 753 "ncgen.y" /* 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)); - ;} + (yyval.sym)=(yyvsp[0].sym); + (yyvsp[0].sym)->ref.is_ref=1; + (yyvsp[0].sym)->is_prefixed=0; + setpathcurrent((yyvsp[0].sym)); + } +#line 2388 "ncgeny.c" /* yacc.c:1646 */ break; case 106: -#line 760 "ncgen.y" +#line 760 "ncgen.y" /* yacc.c:1646 */ { - (yyval.sym)=(yyvsp[(1) - (1)].sym); - (yyvsp[(1) - (1)].sym)->ref.is_ref=1; - (yyvsp[(1) - (1)].sym)->is_prefixed=1; + (yyval.sym)=(yyvsp[0].sym); + (yyvsp[0].sym)->ref.is_ref=1; + (yyvsp[0].sym)->is_prefixed=1; /* path is set in ncgen.l*/ - ;} + } +#line 2399 "ncgeny.c" /* yacc.c:1646 */ break; case 108: -#line 769 "ncgen.y" - {;} +#line 769 "ncgen.y" /* yacc.c:1646 */ + {} +#line 2405 "ncgeny.c" /* yacc.c:1646 */ break; case 109: -#line 770 "ncgen.y" - {;} +#line 770 "ncgen.y" /* yacc.c:1646 */ + {} +#line 2411 "ncgeny.c" /* yacc.c:1646 */ break; case 112: -#line 778 "ncgen.y" - {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);;} +#line 778 "ncgen.y" /* yacc.c:1646 */ + {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} +#line 2417 "ncgeny.c" /* yacc.c:1646 */ break; case 113: -#line 781 "ncgen.y" - {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;} +#line 781 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist) = (yyvsp[0].datalist);} +#line 2423 "ncgeny.c" /* yacc.c:1646 */ break; case 114: -#line 782 "ncgen.y" - {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;} +#line 782 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist) = (yyvsp[0].datalist);} +#line 2429 "ncgeny.c" /* yacc.c:1646 */ break; case 115: -#line 786 "ncgen.y" - {(yyval.datalist) = builddatalist(0);;} +#line 786 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist) = builddatalist(0);} +#line 2435 "ncgeny.c" /* yacc.c:1646 */ break; case 116: -#line 790 "ncgen.y" - {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;} +#line 790 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));} +#line 2441 "ncgeny.c" /* yacc.c:1646 */ break; case 117: -#line 792 "ncgen.y" - {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;} +#line 792 "ncgen.y" /* yacc.c:1646 */ + {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} +#line 2447 "ncgeny.c" /* yacc.c:1646 */ break; case 118: -#line 796 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} +#line 796 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=(yyvsp[0].constant);} +#line 2453 "ncgeny.c" /* yacc.c:1646 */ break; case 119: -#line 797 "ncgen.y" - {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));;} +#line 797 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} +#line 2459 "ncgeny.c" /* yacc.c:1646 */ break; case 120: -#line 801 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} +#line 801 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=(yyvsp[0].constant);} +#line 2465 "ncgeny.c" /* yacc.c:1646 */ break; case 121: -#line 802 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_OPAQUE);;} +#line 802 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_OPAQUE);} +#line 2471 "ncgeny.c" /* yacc.c:1646 */ break; case 122: -#line 803 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_FILLVALUE);;} +#line 803 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_FILLVALUE);} +#line 2477 "ncgeny.c" /* yacc.c:1646 */ break; case 123: -#line 804 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_NIL);;} +#line 804 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_NIL);} +#line 2483 "ncgeny.c" /* yacc.c:1646 */ break; case 124: -#line 805 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} +#line 805 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=(yyvsp[0].constant);} +#line 2489 "ncgeny.c" /* yacc.c:1646 */ break; case 126: -#line 810 "ncgen.y" - {(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));;} +#line 810 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} +#line 2495 "ncgeny.c" /* yacc.c:1646 */ break; case 127: -#line 814 "ncgen.y" - {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));;} +#line 814 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} +#line 2501 "ncgeny.c" /* yacc.c:1646 */ break; case 128: -#line 819 "ncgen.y" - {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;} +#line 819 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));} +#line 2507 "ncgeny.c" /* yacc.c:1646 */ break; case 129: -#line 821 "ncgen.y" - {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;} +#line 821 "ncgen.y" /* yacc.c:1646 */ + {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} +#line 2513 "ncgeny.c" /* yacc.c:1646 */ break; case 130: -#line 825 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_CHAR);;} +#line 825 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_CHAR);} +#line 2519 "ncgeny.c" /* yacc.c:1646 */ break; case 131: -#line 826 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_BYTE);;} +#line 826 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_BYTE);} +#line 2525 "ncgeny.c" /* yacc.c:1646 */ break; case 132: -#line 827 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_SHORT);;} +#line 827 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_SHORT);} +#line 2531 "ncgeny.c" /* yacc.c:1646 */ break; case 133: -#line 828 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT);;} +#line 828 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_INT);} +#line 2537 "ncgeny.c" /* yacc.c:1646 */ break; case 134: -#line 829 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT64);;} +#line 829 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_INT64);} +#line 2543 "ncgeny.c" /* yacc.c:1646 */ break; case 135: -#line 830 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UBYTE);;} +#line 830 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_UBYTE);} +#line 2549 "ncgeny.c" /* yacc.c:1646 */ break; case 136: -#line 831 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_USHORT);;} +#line 831 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_USHORT);} +#line 2555 "ncgeny.c" /* yacc.c:1646 */ break; case 137: -#line 832 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT);;} +#line 832 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_UINT);} +#line 2561 "ncgeny.c" /* yacc.c:1646 */ break; case 138: -#line 833 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT64);;} +#line 833 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_UINT64);} +#line 2567 "ncgeny.c" /* yacc.c:1646 */ break; case 139: -#line 834 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_FLOAT);;} +#line 834 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_FLOAT);} +#line 2573 "ncgeny.c" /* yacc.c:1646 */ break; case 140: -#line 835 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_DOUBLE);;} +#line 835 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_DOUBLE);} +#line 2579 "ncgeny.c" /* yacc.c:1646 */ break; case 141: -#line 836 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_STRING);;} +#line 836 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_STRING);} +#line 2585 "ncgeny.c" /* yacc.c:1646 */ break; case 142: -#line 840 "ncgen.y" - {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;} +#line 840 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));} +#line 2591 "ncgeny.c" /* yacc.c:1646 */ break; case 143: -#line 841 "ncgen.y" - {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant)));;} +#line 841 "ncgen.y" /* yacc.c:1646 */ + {(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));} +#line 2597 "ncgeny.c" /* yacc.c:1646 */ break; case 144: -#line 846 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT);;} +#line 846 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_INT);} +#line 2603 "ncgeny.c" /* yacc.c:1646 */ break; case 145: -#line 848 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT);;} +#line 848 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_UINT);} +#line 2609 "ncgeny.c" /* yacc.c:1646 */ break; case 146: -#line 850 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_INT64);;} +#line 850 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_INT64);} +#line 2615 "ncgeny.c" /* yacc.c:1646 */ break; case 147: -#line 852 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_UINT64);;} +#line 852 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_UINT64);} +#line 2621 "ncgeny.c" /* yacc.c:1646 */ break; case 148: -#line 856 "ncgen.y" - {(yyval.constant)=makeconstdata(NC_STRING);;} +#line 856 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=makeconstdata(NC_STRING);} +#line 2627 "ncgeny.c" /* yacc.c:1646 */ break; case 149: -#line 860 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} +#line 860 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=(yyvsp[0].constant);} +#line 2633 "ncgeny.c" /* yacc.c:1646 */ break; case 150: -#line 861 "ncgen.y" - {(yyval.constant)=(yyvsp[(1) - (1)].constant);;} +#line 861 "ncgen.y" /* yacc.c:1646 */ + {(yyval.constant)=(yyvsp[0].constant);} +#line 2639 "ncgeny.c" /* yacc.c:1646 */ break; case 151: -#line 867 "ncgen.y" - {(yyval.sym)=(yyvsp[(1) - (1)].sym);;} +#line 867 "ncgen.y" /* yacc.c:1646 */ + {(yyval.sym)=(yyvsp[0].sym);} +#line 2645 "ncgeny.c" /* yacc.c:1646 */ break; -/* Line 1267 of yacc.c. */ -#line 2738 "ncgen.tab.c" +#line 2649 "ncgeny.c" /* yacc.c:1646 */ 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); @@ -2745,8 +2667,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].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. */ @@ -2761,10 +2682,14 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].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) { @@ -2772,37 +2697,36 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - 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; - } + 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; } +# undef YYSYNTAX_ERROR #endif } @@ -2810,24 +2734,24 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* 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 look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2843,7 +2767,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2856,38 +2780,37 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].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 (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + if (!yypact_value_is_default (yyn)) + { + 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); } - if (yyn == YYFINAL) - YYACCEPT; - + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2911,7 +2834,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2922,17 +2845,22 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered + 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 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 @@ -2943,12 +2871,9 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -#line 870 "ncgen.y" +#line 870 "ncgen.y" /* yacc.c:1906 */ #ifndef NO_STDARG @@ -3576,4 +3501,3 @@ evaluate(Symbol* fcn, Datalist* arglist) done: return result; } - diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h index cbd5b52699..4d09af5695 100644 --- a/ncgen/ncgeny.h +++ b/ncgen/ncgeny.h @@ -1,14 +1,13 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 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 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,139 +30,100 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Tokens. */ +#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. */ #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, - IDENT = 270, - TERMSTRING = 271, - CHAR_CONST = 272, - BYTE_CONST = 273, - SHORT_CONST = 274, - INT_CONST = 275, - INT64_CONST = 276, - UBYTE_CONST = 277, - USHORT_CONST = 278, - UINT_CONST = 279, - UINT64_CONST = 280, - FLOAT_CONST = 281, - DOUBLE_CONST = 282, - DIMENSIONS = 283, - VARIABLES = 284, - NETCDF = 285, - DATA = 286, - TYPES = 287, - COMPOUND = 288, - ENUM = 289, - OPAQUE_ = 290, - OPAQUESTRING = 291, - GROUP = 292, - PATH = 293, - FILLMARKER = 294, - NIL = 295, - _FILLVALUE = 296, - _FORMAT = 297, - _STORAGE = 298, - _CHUNKSIZES = 299, - _DEFLATELEVEL = 300, - _SHUFFLE = 301, - _ENDIANNESS = 302, - _NOFILL = 303, - _FLETCHER32 = 304, - _NCPROPS = 305, - _ISNETCDF4 = 306, - _SUPERBLOCK = 307, - DATASETID = 308 - }; + 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, + IDENT = 270, + TERMSTRING = 271, + CHAR_CONST = 272, + BYTE_CONST = 273, + SHORT_CONST = 274, + INT_CONST = 275, + INT64_CONST = 276, + UBYTE_CONST = 277, + USHORT_CONST = 278, + UINT_CONST = 279, + UINT64_CONST = 280, + FLOAT_CONST = 281, + DOUBLE_CONST = 282, + DIMENSIONS = 283, + VARIABLES = 284, + NETCDF = 285, + DATA = 286, + TYPES = 287, + COMPOUND = 288, + ENUM = 289, + OPAQUE_ = 290, + OPAQUESTRING = 291, + GROUP = 292, + PATH = 293, + FILLMARKER = 294, + NIL = 295, + _FILLVALUE = 296, + _FORMAT = 297, + _STORAGE = 298, + _CHUNKSIZES = 299, + _DEFLATELEVEL = 300, + _SHUFFLE = 301, + _ENDIANNESS = 302, + _NOFILL = 303, + _FLETCHER32 = 304, + _NCPROPS = 305, + _ISNETCDF4 = 306, + _SUPERBLOCK = 307, + DATASETID = 308 + }; #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 IDENT 270 -#define TERMSTRING 271 -#define CHAR_CONST 272 -#define BYTE_CONST 273 -#define SHORT_CONST 274 -#define INT_CONST 275 -#define INT64_CONST 276 -#define UBYTE_CONST 277 -#define USHORT_CONST 278 -#define UINT_CONST 279 -#define UINT64_CONST 280 -#define FLOAT_CONST 281 -#define DOUBLE_CONST 282 -#define DIMENSIONS 283 -#define VARIABLES 284 -#define NETCDF 285 -#define DATA 286 -#define TYPES 287 -#define COMPOUND 288 -#define ENUM 289 -#define OPAQUE_ 290 -#define OPAQUESTRING 291 -#define GROUP 292 -#define PATH 293 -#define FILLMARKER 294 -#define NIL 295 -#define _FILLVALUE 296 -#define _FORMAT 297 -#define _STORAGE 298 -#define _CHUNKSIZES 299 -#define _DEFLATELEVEL 300 -#define _SHUFFLE 301 -#define _ENDIANNESS 302 -#define _NOFILL 303 -#define _FLETCHER32 304 -#define _NCPROPS 305 -#define _ISNETCDF4 306 -#define _SUPERBLOCK 307 -#define DATASETID 308 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 138 "ncgen.y" + +union YYSTYPE { +#line 138 "ncgen.y" /* yacc.c:1909 */ + 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 1529 of yacc.c. */ -#line 164 "ncgen.tab.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 + +#line 117 "ncgeny.h" /* yacc.c:1909 */ +}; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE ncglval; +int ncgparse (void); + +#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */ diff --git a/oc2/Makefile.am b/oc2/Makefile.am index d85ee81e25..aa3d65f68e 100644 --- a/oc2/Makefile.am +++ b/oc2/Makefile.am @@ -46,5 +46,3 @@ bison:: dap.y rm -f dap.tab.c dap.tab.h bison --debug -d -p dap dap.y mv dap.tab.c dapy.c; mv dap.tab.h dapy.h - - diff --git a/oc2/dap.y b/oc2/dap.y index e20153904e..9154c61a89 100644 --- a/oc2/dap.y +++ b/oc2/dap.y @@ -52,7 +52,7 @@ int dapdebug = 0; start: dataset datasetbody - | dataset datasetbody SCAN_DATA + | dataset datasetbody SCAN_DATA /* The SCAN_DATA indicates serialized data follows */ | attr attributebody | err errorbody | error {dap_unrecognizedresponse(parsestate); YYABORT;} @@ -245,29 +245,29 @@ errorprog : /*empty*/ {$$=null;} | SCAN_PROG '=' WORD_WORD ';' {$$=$3;} */ name: WORD_WORD {$$=dapdecode(parsestate->lexstate,$1);} - | SCAN_ALIAS {$$=strdup("alias");} - | SCAN_ARRAY {$$=strdup("array");} - | SCAN_ATTR {$$=strdup("attributes");} - | SCAN_BYTE {$$=strdup("byte");} - | SCAN_DATASET {$$=strdup("dataset");} - | SCAN_DATA {$$=strdup("data");} - | SCAN_ERROR {$$=strdup("error");} - | SCAN_FLOAT32 {$$=strdup("float32");} - | SCAN_FLOAT64 {$$=strdup("float64");} - | SCAN_GRID {$$=strdup("grid");} - | SCAN_INT16 {$$=strdup("int16");} - | SCAN_INT32 {$$=strdup("int32");} - | SCAN_MAPS {$$=strdup("maps");} - | SCAN_SEQUENCE {$$=strdup("sequence");} - | SCAN_STRING {$$=strdup("string");} - | SCAN_STRUCTURE {$$=strdup("structure");} - | SCAN_UINT16 {$$=strdup("uint16");} - | SCAN_UINT32 {$$=strdup("uint32");} - | SCAN_URL {$$=strdup("url");} - | SCAN_CODE {$$=strdup("code");} - | SCAN_MESSAGE {$$=strdup("message");} - | SCAN_PROG {$$=strdup("program");} - | SCAN_PTYPE {$$=strdup("program_type");} + | SCAN_ALIAS {$$=strdup($1);} + | SCAN_ARRAY {$$=strdup($1);} + | SCAN_ATTR {$$=strdup($1);} + | SCAN_BYTE {$$=strdup($1);} + | SCAN_DATASET {$$=strdup($1);} + | SCAN_DATA {$$=strdup($1);} + | SCAN_ERROR {$$=strdup($1);} + | SCAN_FLOAT32 {$$=strdup($1);} + | SCAN_FLOAT64 {$$=strdup($1);} + | SCAN_GRID {$$=strdup($1);} + | SCAN_INT16 {$$=strdup($1);} + | SCAN_INT32 {$$=strdup($1);} + | SCAN_MAPS {$$=strdup($1);} + | SCAN_SEQUENCE {$$=strdup($1);} + | SCAN_STRING {$$=strdup($1);} + | SCAN_STRUCTURE {$$=strdup($1);} + | SCAN_UINT16 {$$=strdup($1);} + | SCAN_UINT32 {$$=strdup($1);} + | SCAN_URL {$$=strdup($1);} + | SCAN_CODE {$$=strdup($1);} + | SCAN_MESSAGE {$$=strdup($1);} + | SCAN_PROG {$$=strdup($1);} + | SCAN_PTYPE {$$=strdup($1);} ; %% diff --git a/oc2/dapy.c b/oc2/dapy.c index d1cfa63abf..c4031eb3a8 100644 --- a/oc2/dapy.c +++ b/oc2/dapy.c @@ -1875,139 +1875,139 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); case 84: #line 248 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("alias");} + {(yyval)=strdup((yyvsp[0]));} #line 1880 "dap.tab.c" /* yacc.c:1646 */ break; case 85: #line 249 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("array");} + {(yyval)=strdup((yyvsp[0]));} #line 1886 "dap.tab.c" /* yacc.c:1646 */ break; case 86: #line 250 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("attributes");} + {(yyval)=strdup((yyvsp[0]));} #line 1892 "dap.tab.c" /* yacc.c:1646 */ break; case 87: #line 251 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("byte");} + {(yyval)=strdup((yyvsp[0]));} #line 1898 "dap.tab.c" /* yacc.c:1646 */ break; case 88: #line 252 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("dataset");} + {(yyval)=strdup((yyvsp[0]));} #line 1904 "dap.tab.c" /* yacc.c:1646 */ break; case 89: #line 253 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("data");} + {(yyval)=strdup((yyvsp[0]));} #line 1910 "dap.tab.c" /* yacc.c:1646 */ break; case 90: #line 254 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("error");} + {(yyval)=strdup((yyvsp[0]));} #line 1916 "dap.tab.c" /* yacc.c:1646 */ break; case 91: #line 255 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("float32");} + {(yyval)=strdup((yyvsp[0]));} #line 1922 "dap.tab.c" /* yacc.c:1646 */ break; case 92: #line 256 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("float64");} + {(yyval)=strdup((yyvsp[0]));} #line 1928 "dap.tab.c" /* yacc.c:1646 */ break; case 93: #line 257 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("grid");} + {(yyval)=strdup((yyvsp[0]));} #line 1934 "dap.tab.c" /* yacc.c:1646 */ break; case 94: #line 258 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("int16");} + {(yyval)=strdup((yyvsp[0]));} #line 1940 "dap.tab.c" /* yacc.c:1646 */ break; case 95: #line 259 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("int32");} + {(yyval)=strdup((yyvsp[0]));} #line 1946 "dap.tab.c" /* yacc.c:1646 */ break; case 96: #line 260 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("maps");} + {(yyval)=strdup((yyvsp[0]));} #line 1952 "dap.tab.c" /* yacc.c:1646 */ break; case 97: #line 261 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("sequence");} + {(yyval)=strdup((yyvsp[0]));} #line 1958 "dap.tab.c" /* yacc.c:1646 */ break; case 98: #line 262 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("string");} + {(yyval)=strdup((yyvsp[0]));} #line 1964 "dap.tab.c" /* yacc.c:1646 */ break; case 99: #line 263 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("structure");} + {(yyval)=strdup((yyvsp[0]));} #line 1970 "dap.tab.c" /* yacc.c:1646 */ break; case 100: #line 264 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("uint16");} + {(yyval)=strdup((yyvsp[0]));} #line 1976 "dap.tab.c" /* yacc.c:1646 */ break; case 101: #line 265 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("uint32");} + {(yyval)=strdup((yyvsp[0]));} #line 1982 "dap.tab.c" /* yacc.c:1646 */ break; case 102: #line 266 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("url");} + {(yyval)=strdup((yyvsp[0]));} #line 1988 "dap.tab.c" /* yacc.c:1646 */ break; case 103: #line 267 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("code");} + {(yyval)=strdup((yyvsp[0]));} #line 1994 "dap.tab.c" /* yacc.c:1646 */ break; case 104: #line 268 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("message");} + {(yyval)=strdup((yyvsp[0]));} #line 2000 "dap.tab.c" /* yacc.c:1646 */ break; case 105: #line 269 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("program");} + {(yyval)=strdup((yyvsp[0]));} #line 2006 "dap.tab.c" /* yacc.c:1646 */ break; case 106: #line 270 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup("program_type");} + {(yyval)=strdup((yyvsp[0]));} #line 2012 "dap.tab.c" /* yacc.c:1646 */ break; diff --git a/test_common.in b/test_common.in index 89720b5214..d559dd3d79 100644 --- a/test_common.in +++ b/test_common.in @@ -115,12 +115,12 @@ else ext="" fi -# We need to locate certain executables (and other things) -# and capture absolute paths -NCDUMP="${top_builddir}/ncdump${VS}/ncdump${ext}" -NCCOPY="${top_builddir}/ncdump${VS}/nccopy${ext}" -NCGEN="${top_builddir}/ncgen${VS}/ncgen${ext}" -NCGEN3="${top_builddir}/ncgen3${VS}/ncgen3${ext}" +# We need to locate certain executables (and other things), +# capture absolute paths, and make visible +export NCDUMP="${top_builddir}/ncdump${VS}/ncdump${ext}" +export NCCOPY="${top_builddir}/ncdump${VS}/nccopy${ext}" +export NCGEN="${top_builddir}/ncgen${VS}/ncgen${ext}" +export NCGEN3="${top_builddir}/ncgen3${VS}/ncgen3${ext}" # Temporary hacks (until we have a test_utils directory) # to locate certain specific test files