diff --git a/.github/workflows/run_tests_osx.yml b/.github/workflows/run_tests_osx.yml index 05f2a568ec..8e9d65a6fb 100644 --- a/.github/workflows/run_tests_osx.yml +++ b/.github/workflows/run_tests_osx.yml @@ -7,7 +7,7 @@ name: Run macOS-based netCDF Tests -on: [ pull_request ] +on: [pull_request] jobs: diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index b57cf765fa..22377985ef 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -4,8 +4,7 @@ name: Run Ubuntu/Linux netCDF Tests -on: [ pull_request ] - +on: [pull_request] jobs: diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b2bc81d560..e64d4f4517 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release ## 4.8.2 - TBD +* [Enhancement] Add complete bitgroom support to NCZarr. See [Github #2197](https://github.com/Unidata/netcdf-c/pull/2197). * [Bug Fix] Clean up the handling of deeply nested VLEN types. Marks nc_free_vlen() and nc_free_string as deprecated in favor of ncaux_reclaim_data(). See [Github #2179(https://github.com/Unidata/netcdf-c/pull/2179). * [Bug Fix] Make sure that netcdf.h accurately defines the flags in the open/create mode flags. See [Github #2183](https://github.com/Unidata/netcdf-c/pull/2183). * [Enhancement] Improve support for msys2+mingw platform. See [Github #2171](https://github.com/Unidata/netcdf-c/pull/2171). diff --git a/acinclude.m4 b/acinclude.m4 index 315eeec1f2..a3fdc712a7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -384,3 +384,4 @@ MOSTLYCLEANFILES += $(valgrind_log_files) AC_SUBST([VALGRIND_CHECK_RULES]) m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])]) ]) +AC_DEFUN([_AC_FINALIZE],[]) diff --git a/include/ncuri.h b/include/ncuri.h index 33f7068f19..c4fabd4049 100644 --- a/include/ncuri.h +++ b/include/ncuri.h @@ -79,6 +79,9 @@ EXTERNL int ncurisetquery(NCURI*,const char* query); /* Replace the fragment list */ EXTERNL int ncurisetfragments(NCURI*, const char* fragments); +/* Rebuild the uri */ +EXTERNL int ncurirebuild(NCURI*); + /* Replace a specific &key=...& in uri fragment */ EXTERNL int ncurisetfragmentkey(NCURI* duri,const char* key, const char* value); diff --git a/include/netcdf.h b/include/netcdf.h index fa688ab619..b8540c6ab5 100644 --- a/include/netcdf.h +++ b/include/netcdf.h @@ -330,12 +330,12 @@ there. */ #define NC_NOQUANTIZE 0 /**< No quantization in use. */ #define NC_QUANTIZE_BITGROOM 1 /**< Use BitGroom quantization. */ -#define NC_QUANTIZE_GRANULARBG 2 /**< Use Granular BitGroom quantization. */ +#define NC_QUANTIZE_GRANULARBR 2 /**< Use Granular BitRound quantization. */ /** When quantization is used for a variable, an attribute of the * appropriate name is added. */ #define NC_QUANTIZE_BITGROOM_ATT_NAME "_QuantizeBitgroomNumberOfSignificantDigits" -#define NC_QUANTIZE_GRANULARBG_ATT_NAME "_QuantizeGranularBitGroomNumberOfSignificantDigits" +#define NC_QUANTIZE_GRANULARBR_ATT_NAME "_QuantizeGranularBitRoundNumberOfSignificantDigits" /** For quantization, the allowed value of number of significant * digits for float. */ diff --git a/libdap4/ncd4dispatch.c b/libdap4/ncd4dispatch.c index 7c64e7280d..7f85759c8e 100644 --- a/libdap4/ncd4dispatch.c +++ b/libdap4/ncd4dispatch.c @@ -763,6 +763,42 @@ NCD4_get_var_chunk_cache(int ncid, int p2, size_t* p3, size_t* p4, float* p5) return (ret); } +static int +NCD4_inq_var_quantize(int ncid, int varid, int *quantize_modep, int *nsdp) +{ + NC* ncp; + int ret; + int substrateid; + if((ret = NC_check_id(ncid, (NC**)&ncp)) != NC_NOERR) return (ret); + substrateid = makenc4id(ncp,ncid); + ret = nc_inq_var_quantize(substrateid, varid, quantize_modep, nsdp); + return (ret); +} + +static int +NCD4_inq_var_filter_ids(int ncid, int varid, size_t* nfilters, unsigned int* filterids) +{ + NC* ncp; + int ret; + int substrateid; + if((ret = NC_check_id(ncid, (NC**)&ncp)) != NC_NOERR) return (ret); + substrateid = makenc4id(ncp,ncid); + ret = nc_inq_var_filter_ids(substrateid, varid, nfilters, filterids); + return (ret); +} + +static int +NCD4_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparams, unsigned int* params) +{ + NC* ncp; + int ret; + int substrateid; + if((ret = NC_check_id(ncid, (NC**)&ncp)) != NC_NOERR) return (ret); + substrateid = makenc4id(ncp,ncid); + ret = nc_inq_var_filter_info(substrateid, varid, id, nparams, params); + return (ret); +} + /**************************************************/ /* Following functions are overridden to handle @@ -970,9 +1006,9 @@ NCD4_def_var_filter, NCD4_set_var_chunk_cache, NCD4_get_var_chunk_cache, -NC_NOTNC4_inq_var_filter_ids, -NC_NOTNC4_inq_var_filter_info, +NCD4_inq_var_filter_ids, +NCD4_inq_var_filter_info, NC_NOTNC4_def_var_quantize, -NC_NOTNC4_inq_var_quantize, +NCD4_inq_var_quantize, }; diff --git a/libdispatch/dinfermodel.c b/libdispatch/dinfermodel.c index 3f54ec05ef..fb58d18c23 100644 --- a/libdispatch/dinfermodel.c +++ b/libdispatch/dinfermodel.c @@ -126,33 +126,43 @@ static struct FORMATMODES { {NULL,0}, }; -/* For some reason, compiler complains */ +/* Replace top-level name with defkey=defvalue */ static const struct MACRODEF { char* name; char* defkey; - char* defvalue; + char* defvalues[4]; } macrodefs[] = { -{"zarr","mode","nczarr,zarr"}, -{"dap2","mode","dap2"}, -{"dap4","mode","dap4"}, -{"s3","mode","nczarr,s3"}, -{"bytes","mode","bytes"}, -{"xarray","mode","nczarr,zarr,xarray"}, -{"noxarray","mode","nczarr,zarr,noxarray"}, -{NULL,NULL,NULL} +{"zarr","mode",{"nczarr","zarr",NULL}}, +{"dap2","mode",{"dap2",NULL}}, +{"dap4","mode",{"dap4",NULL}}, +{"s3","mode",{"s3","nczarr",NULL}}, +{"bytes","mode",{"bytes",NULL}}, +{"xarray","mode",{"nczarr","zarr","xarray",NULL}}, +{"noxarray","mode",{"nczarr","zarr","noxarray",NULL}}, +{"zarr","mode",{"nczarr","zarr","xarray",NULL}}, +{NULL,NULL,{NULL}} }; -/* Mode inferences */ +/* Mode inferences: if mode contains key, then add the inference and infer again */ static const struct MODEINFER { char* key; char* inference; } modeinferences[] = { {"zarr","nczarr"}, +{"zarr","xarray"}, {"xarray","zarr"}, {"noxarray","zarr"}, {NULL,NULL} }; +/* Mode negations: if mode contains key, then remove all occurrences of the inference and repeat */ +static const struct MODEINFER modenegations[] = { +{"bytes","nczarr"}, /* bytes negates (nc)zarr */ +{"bytes","zarr"}, +{"noxarray","xarray"}, +{NULL,NULL} +}; + /* Map FORMATX to readability to get magic number */ static struct Readable { int impl; @@ -179,9 +189,9 @@ static struct NCPROTOCOLLIST { {"http",NULL,NULL}, {"https",NULL,NULL}, {"file",NULL,NULL}, - {"dods","http","dap2"}, - {"dap4","http","dap4"}, - {"s3","s3","s3"}, + {"dods","http","mode=dap2"}, + {"dap4","http","mode=dap4"}, + {"s3","s3","mode=s3"}, {NULL,NULL,NULL} /* Terminate search */ }; @@ -205,6 +215,11 @@ static void printlist(NClist* list, const char* tag); static int isreadable(NCURI*,NCmodel*); static char* list2string(NClist*); static int parsepair(const char* pair, char** keyp, char** valuep); +static NClist* parsemode(const char* modeval); +static const char* getmodekey(const NClist* envv); +static int replacemode(NClist* envv, const char* newval); +static int inferone(const char* mode, NClist* newmodes); +static int negateone(const char* mode, NClist* modes); /* If the path looks like a URL, then parse it, reformat it. @@ -460,9 +475,11 @@ processmacros(NClist** fraglenvp) if(strlen(value) == 0) { /* must be a singleton */ for(macros=macrodefs;macros->name;macros++) { if(strcmp(macros->name,key)==0) { + char* const * p; nclistpush(expanded,strdup(macros->defkey)); - nclistpush(expanded,strdup(macros->defvalue)); - found = 1; + for(p=macros->defvalues;*p;p++) + nclistpush(expanded,strdup(*p)); + found = 1; break; } } @@ -487,68 +504,85 @@ static int processinferences(NClist* fraglenv) { int stat = NC_NOERR; - const struct MODEINFER* inferences = NULL; + const char* modeval = NULL; NClist* modes = NULL; - int inferred,i,pos = -1; - char* modeval = NULL; + NClist* newmodes = nclistnew(); + int i,inferred = 0; char* newmodeval = NULL; if(fraglenv == NULL || nclistlength(fraglenv) == 0) goto done; /* Get "mode" entry */ - for(i=0;ikey;inferences++) { - if(strcasecmp(inferences->key,mode)==0) { - int j; - int exists = 0; - for(j=0;jinference)==0) - {exists = 1; break;} - } - if(!exists) { - /* append the inferred mode if not already present */ - nclistpush(modes,strdup(inferences->inference)); - inferred = 1; - } - } - } + inferred = inferone(mode,newmodes); + nclistpush(newmodes,strdup(mode)); /* keep key */ + if(!inferred) nclistpush(newmodes,strdup(mode)); } } while(inferred); + /* Remove negative inferences */ + for(i=0;ikey;tests++) { + int i; + if(strcasecmp(tests->key,mode)==0) { + /* Find and remove all instances of the inference value */ + for(i=nclistlength(newmodes)-1;i>=0;i--) { + char* candidate = nclistget(newmodes,i); + if(strcasecmp(candidate,tests->inference)==0) { + nclistremove(newmodes,i); + nullfree(candidate); + changed = 1; + } + } + } + } + return changed; +} + +static int +inferone(const char* mode, NClist* newmodes) +{ + const struct MODEINFER* tests = modeinferences; + int changed = 0; + for(;tests->key;tests++) { + if(strcasecmp(tests->key,mode)==0) { + /* Append the inferred mode; dups removed later */ + nclistpush(newmodes,strdup(tests->inference)); + changed = 1; + } + } + return changed; +} static int mergekey(NClist** valuesp) @@ -698,7 +732,7 @@ NC_omodeinfer(int useparallel, int cmode, NCmodel* model) /* Process the cmode; may override some already set flags. The * user-defined formats must be checked first. They may choose to - * use some of the other flags, like NC_NETCDF4, so we must fist + * use some of the other flags, like NC_NETCDF4, so we must first * check NC_UDF0 and NC_UDF1 before checking for any other * flag. */ if(fIsSet(cmode,(NC_UDF0|NC_UDF1))) { @@ -793,6 +827,7 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void NClist* modeargs = nclistnew(); char* sfrag = NULL; const char* modeval = NULL; + char* abspath = NULL; /* Phase 1: 1. convert special protocols to http|https @@ -811,6 +846,9 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void printlist(fraglenv,"processmacros"); #endif + /* Cleanup the fragment list */ + if((stat = cleanfragments(&fraglenv))) goto done; + /* Phase 2a: Expand mode inferences and add to fraglenv */ if((stat = processinferences(fraglenv))) goto done; #ifdef DEBUG @@ -832,12 +870,29 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void ncurisetfragments(uri,sfrag); nullfree(sfrag); sfrag = NULL; + /* If s3, then rebuild the url */ + if(NC_iss3(uri)) { + NCURI* newuri = NULL; + if((stat = NC_s3urlrebuild(uri,&newuri,NULL,NULL))) goto done; + ncurifree(uri); + uri = newuri; + } else if(strcmp(uri->protocol,"file")==0) { + /* convert path to absolute */ + char* canon = NULL; + abspath = NCpathabsolute(uri->path); + if((stat = NCpathcanonical(abspath,&canon))) goto done; + nullfree(abspath); + abspath = canon; canon = NULL; + if((stat = ncurisetpath(uri,abspath))) goto done; + } + /* rebuild the path */ - if(newpathp) + if(newpathp) { *newpathp = ncuribuild(uri,NULL,NULL,NCURIALL); #ifdef DEBUG - fprintf(stderr,"newpath=|%s|\n",*newpathp); fflush(stderr); -#endif + fprintf(stderr,"newpath=|%s|\n",*newpathp); fflush(stderr); +#endif + } /* Phase 5: Process the mode key to see if we can tell the formatx */ modeval = ncurifragmentlookup(uri,"mode"); @@ -925,6 +980,7 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void done: nullfree(sfrag); + nullfree(abspath); ncurifree(uri); nclistfreeall(modeargs); nclistfreeall(fraglenv); @@ -935,15 +991,16 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void static int isreadable(NCURI* uri, NCmodel* model) { + int canread = 0; struct Readable* r; /* Step 1: Look up the implementation */ for(r=readable;r->impl;r++) { - if(model->impl == r->impl) return r->readable; + if(model->impl == r->impl) {canread = r->readable; break;} } /* Step 2: check for bytes mode */ - if(NC_testmode(uri,"bytes")) return 1; - - return 0; + if(!canread && NC_testmode(uri,"bytes") && (model->impl == NC_FORMATX_NC4 || model->impl == NC_FORMATX_NC_HDF5)) + canread = 1; + return canread; } #if 0 @@ -1000,7 +1057,50 @@ nc__testurl(const char* path0, char** basenamep) return ok; } +/**************************************************/ +/* Envv list utilities */ + +static const char* +getmodekey(const NClist* envv) +{ + int i; + /* Get "mode" entry */ + for(i=0;iurl */ + ncurirebuild(newurl); /* return various items */ #ifdef AWSDEBUG - { - char* s = ncuribuild(newurl,NULL,NULL,NCURIALL); - fprintf(stderr,">>> NC_s3urlrebuild: final=%s bucket=%s region=%s\n",s,bucket,region); - nullfree(s); - } + fprintf(stderr,">>> NC_s3urlrebuild: final=%s bucket=%s region=%s\n",uri->uri,bucket,region); #endif if(newurlp) {*newurlp = newurl; newurl = NULL;} if(bucketp) {*bucketp = bucket; bucket = NULL;} diff --git a/libdispatch/dvar.c b/libdispatch/dvar.c index 5c818a4fca..f13f14c811 100644 --- a/libdispatch/dvar.c +++ b/libdispatch/dvar.c @@ -469,7 +469,7 @@ nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_le The data are quantized by setting unneeded bits to zeros or ones so that they may compress well. BitGroom sets bits alternately to 1/0, - while Granular BitGroom (GBG) sets (more) bits to zeros. + while Granular BitRound (GBR) sets (more) bits to zeros. Quantization is lossy (data are irretrievably altered), and it improves the compression ratio provided by a subsequent lossless compression filter. Quantization alone will not reduce the data size. @@ -529,7 +529,7 @@ nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_le @param ncid File ID. @param varid Variable ID. ::NC_GLOBAL may not be used. @param quantize_mode Quantization mode. May be ::NC_NOQUANTIZE or - ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBG. + ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBR. @param nsd Number of significant digits. May be any integer from 1 to ::NC_QUANTIZE_MAX_FLOAT_NSD (for variables of type ::NC_FLOAT) or ::NC_QUANTIZE_MAX_DOUBLE_NSD (for variables of type diff --git a/libdispatch/ncuri.c b/libdispatch/ncuri.c index e311d2b7ea..824e2e601e 100644 --- a/libdispatch/ncuri.c +++ b/libdispatch/ncuri.c @@ -541,6 +541,16 @@ ncurisetfragments(NCURI* duri,const char* fragments) return ret; } +/* Replace the path */ +int +ncurirebuild(NCURI* duri) +{ + char* surl = ncuribuild(duri,NULL,NULL,NCURIALL); + nullfree(duri->uri); + duri->uri = surl; + return (NC_NOERR); +} + /* Replace a specific fragment key*/ int ncurisetfragmentkey(NCURI* duri,const char* key, const char* value) diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index 5e6612f6ff..f301d63e36 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -1219,10 +1219,10 @@ static int get_quantize_info(NC_VAR_INFO_T *var) } else { - attid = H5Aopen_by_name(datasetid, ".", NC_QUANTIZE_GRANULARBG_ATT_NAME, + attid = H5Aopen_by_name(datasetid, ".", NC_QUANTIZE_GRANULARBR_ATT_NAME, H5P_DEFAULT, H5P_DEFAULT); if (attid > 0) - var->quantize_mode = NC_QUANTIZE_GRANULARBG; + var->quantize_mode = NC_QUANTIZE_GRANULARBR; } /* If there is an attribute, read it for the nsd. */ diff --git a/libhdf5/hdf5var.c b/libhdf5/hdf5var.c index a2766abcd1..d1eedcc739 100644 --- a/libhdf5/hdf5var.c +++ b/libhdf5/hdf5var.c @@ -722,10 +722,10 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, /* Only two valid mode settings. */ if (*quantize_mode != NC_NOQUANTIZE && *quantize_mode != NC_QUANTIZE_BITGROOM && - *quantize_mode != NC_QUANTIZE_GRANULARBG) + *quantize_mode != NC_QUANTIZE_GRANULARBR) return NC_EINVAL; - if (*quantize_mode == NC_QUANTIZE_BITGROOM || *quantize_mode == NC_QUANTIZE_GRANULARBG) + if (*quantize_mode == NC_QUANTIZE_BITGROOM || *quantize_mode == NC_QUANTIZE_GRANULARBR) { /* Only float and double types can have quantization. */ if (var->type_info->hdr.id != NC_FLOAT && @@ -816,7 +816,7 @@ NC4_def_var_deflate(int ncid, int varid, int shuffle, int deflate, * has been specified, then the netCDF library will quantize according * to the selected algorithm. BitGroom will apply all zeros or * all ones (alternating) to bits which are not needed to specify the - * value to the number of significant digits. GranularBG will zero + * value to the number of significant digits. GranularBR will zero * more bits than BG, and thus be more compressible and less accurate. * Both will change the value of the data, and will make it more compressible. * @@ -848,7 +848,7 @@ NC4_def_var_deflate(int ncid, int varid, int shuffle, int deflate, * @param ncid File ID. * @param varid Variable ID. NC_GLOBAL may not be used. * @param quantize_mode Quantization mode. May be ::NC_NOQUANTIZE or - * ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBG. + * ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBR. * @param nsd Number of significant digits. May be any integer from 1 * to ::NC_QUANTIZE_MAX_FLOAT_NSD (for variables of type ::NC_FLOAT) or * ::NC_QUANTIZE_MAX_DOUBLE_NSD (for variables of type ::NC_DOUBLE). diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 3655879243..819c056e43 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1026,8 +1026,8 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid &var->nsd, NC_INT, 0))) BAIL(retval); - if (var->quantize_mode == NC_QUANTIZE_GRANULARBG) - if ((retval = nc4_put_att(var->container, var->hdr.id, NC_QUANTIZE_GRANULARBG_ATT_NAME, NC_INT, 1, + if (var->quantize_mode == NC_QUANTIZE_GRANULARBR) + if ((retval = nc4_put_att(var->container, var->hdr.id, NC_QUANTIZE_GRANULARBR_ATT_NAME, NC_INT, 1, &var->nsd, NC_INT, 0))) BAIL(retval); diff --git a/libnczarr/zarr.h b/libnczarr/zarr.h index 8e531297aa..9f78e19297 100644 --- a/libnczarr/zarr.h +++ b/libnczarr/zarr.h @@ -68,10 +68,11 @@ EXTERNL int NCZ_comma_parse(const char* s, NClist* list); EXTERNL int NCZ_swapatomicdata(size_t datalen, void* data, int typesize); EXTERNL char** NCZ_clonestringvec(size_t len, const char** vec); EXTERNL void NCZ_freestringvec(size_t len, char** vec); -EXTERNL int NCZ_create_fill_chunk(size64_t chunksize, size_t typesize, const void* fill, void** fillchunkp); EXTERNL int NCZ_s3clear(NCS3INFO* s3map); EXTERNL int NCZ_ischunkname(const char* name,char dimsep); EXTERNL char* NCZ_chunkpath(struct ChunkKey key); +EXTERNL int NCZ_reclaim_fill_value(NC_VAR_INFO_T* var); +EXTERNL int NCZ_copy_fill_value(NC_VAR_INFO_T* var, void** dstp); /* zwalk.c */ EXTERNL int NCZ_read_chunk(int ncid, int varid, size64_t* zindices, void* chunkdata); diff --git a/libnczarr/zattr.c b/libnczarr/zattr.c index ec24c225f4..8cd4cfd7a4 100644 --- a/libnczarr/zattr.c +++ b/libnczarr/zattr.c @@ -577,7 +577,7 @@ ncz_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type, /* If this is the _FillValue attribute, then we will also have to * copy the value to the fill_vlue pointer of the NC_VAR_INFO_T * struct for this var. (But ignore a global _FillValue - * attribute). */ + * attribute). Also kill the cache fillchunk as no longer valid */ if (!strcmp(att->hdr.name, _FillValue) && varid != NC_GLOBAL) { /* Fill value must have exactly one value */ @@ -636,6 +636,8 @@ ncz_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type, * been created in the file, so the dataset gets deleted and re-created. */ if (var->created) var->fill_val_changed = NC_TRUE; + /* Reclaim any existing fill_chunk */ + if((retval = NCZ_reclaim_fill_chunk(((NCZ_VAR_INFO_T*)var->format_var_info)->cache))) BAIL(retval); } /* Copy the attribute data, if there is any. */ @@ -701,7 +703,7 @@ ncz_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type, if(fillsave.data != NULL) { assert(fillsave.len > 0); if(att->data) - (void)nc_reclaim_data_all(h5->controller->ext_ncid,fillsave.type,var->fill_value,1); + (void)nc_reclaim_data_all(h5->controller->ext_ncid,fillsave.type,var->fill_value,1); var->fill_value = fillsave.data; } } @@ -850,22 +852,23 @@ int NCZ_inq_attname(int ncid, int varid, int attnum, char *name) { NC_ATT_INFO_T *att; - int retval; + int retval = NC_NOERR; + ZTRACE(1,"ncid=%d varid=%d attnum=%d",ncid,varid,attnum); LOG((2, "%s: ncid 0x%x varid %d", __func__, ncid, varid)); /* Find the file, group, and var info, and do lazy att read if * needed. */ if ((retval = ncz_find_grp_var_att(ncid, varid, NULL, attnum, 0, NULL, NULL, NULL, NULL, &att))) - return retval; + goto done; assert(att); /* Get the name. */ if (name) strcpy(name, att->hdr.name); - - return NC_NOERR; +done: + return ZUNTRACEX(retval,"name=%s",(retval?"":name)); } /** diff --git a/libnczarr/zcache.h b/libnczarr/zcache.h index c5065d1667..f25f30185d 100644 --- a/libnczarr/zcache.h +++ b/libnczarr/zcache.h @@ -37,9 +37,11 @@ typedef struct NCZCacheEntry { } NCZCacheEntry; typedef struct NCZChunkCache { + int valid; /* 0 => following fields need to be re-calculated */ NC_VAR_INFO_T* var; /* backlink */ size64_t ndims; /* true ndims == var->ndims + scalar */ size64_t chunksize; /* for real data */ + size64_t chunkcount; /* cross product of chunksizes */ void* fillchunk; /* enough fillvalues to fill a real chunk */ size_t maxentries; /* Max number of entries allowed; maxsize can override */ size_t maxsize; /* Maximum space used by cache; 0 => nolimit */ @@ -63,5 +65,7 @@ extern size64_t NCZ_cache_entrysize(NCZChunkCache* cache); extern NCZCacheEntry* NCZ_cache_entry(NCZChunkCache* cache, const size64_t* indices); extern size64_t NCZ_cache_size(NCZChunkCache* cache); extern int NCZ_buildchunkpath(NCZChunkCache* cache, const size64_t* chunkindices, struct ChunkKey* key); +extern int NCZ_ensure_fill_chunk(NCZChunkCache* cache); +extern int NCZ_reclaim_fill_chunk(NCZChunkCache* cache); #endif /*ZCACHE_H*/ diff --git a/libnczarr/zdebug.h b/libnczarr/zdebug.h index 4ed97975dc..97b255db41 100644 --- a/libnczarr/zdebug.h +++ b/libnczarr/zdebug.h @@ -8,8 +8,8 @@ #undef ZDEBUG /* general debug */ #undef ZDEBUG1 /* detailed debug */ -#define ZCATCH /* Warning: significant performance impact */ -#undef ZTRACING /* Warning: significant performance impact */ +#undef ZCATCH /* Warning: significant performance impact */ +#define ZTRACING /* Warning: significant performance impact */ #include "ncexternl.h" #include "nclog.h" diff --git a/libnczarr/zdispatch.c b/libnczarr/zdispatch.c index e90f0291a6..b2fff3d9ef 100644 --- a/libnczarr/zdispatch.c +++ b/libnczarr/zdispatch.c @@ -29,28 +29,28 @@ static const NC_Dispatch NCZ_dispatcher = { NCZ_abort, NCZ_close, NCZ_set_fill, - NC4_inq_format, + NCZ_inq_format, NCZ_inq_format_extended, NCZ_inq, - NC4_inq_type, + NCZ_inq_type, NCZ_def_dim, - NC4_inq_dimid, + NCZ_inq_dimid, NCZ_inq_dim, - NC4_inq_unlimdim, + NCZ_inq_unlimdim, NCZ_rename_dim, NCZ_inq_att, NCZ_inq_attid, - NC4_inq_attname, + NCZ_inq_attname, NCZ_rename_att, NCZ_del_att, NCZ_get_att, NCZ_put_att, NCZ_def_var, - NC4_inq_varid, + NCZ_inq_varid, NCZ_rename_var, NCZ_get_vara, NCZ_put_vara, @@ -67,20 +67,20 @@ static const NC_Dispatch NCZ_dispatcher = { NCZ_show_metadata, NCZ_inq_unlimdims, - NC4_inq_ncid, - NC4_inq_grps, - NC4_inq_grpname, - NC4_inq_grpname_full, - NC4_inq_grp_parent, - NC4_inq_grp_full_ncid, - NC4_inq_varids, - NC4_inq_dimids, - NC4_inq_typeids, + NCZ_inq_ncid, + NCZ_inq_grps, + NCZ_inq_grpname, + NCZ_inq_grpname_full, + NCZ_inq_grp_parent, + NCZ_inq_grp_full_ncid, + NCZ_inq_varids, + NCZ_inq_dimids, + NCZ_inq_typeids, NCZ_inq_type_equal, NCZ_def_grp, NCZ_rename_grp, - NC4_inq_user_type, - NC4_inq_typeid, + NCZ_inq_user_type, + NCZ_inq_typeid, NC_NOTNC4_def_compound, NC_NOTNC4_insert_compound, @@ -104,16 +104,12 @@ static const NC_Dispatch NCZ_dispatcher = { NC4_get_var_chunk_cache, NCZ_inq_var_filter_ids, NCZ_inq_var_filter_info, - NC_NOTNC4_def_var_quantize, - NC_NOTNC4_inq_var_quantize, + NCZ_def_var_quantize, + NCZ_inq_var_quantize, }; const NC_Dispatch* NCZ_dispatch_table = NULL; /* moved here from ddispatch.c */ -#ifdef ZTRACING -#include "ztracedispatch.h" -#endif - /** * @internal Initialize the ZARR dispatch layer. * @@ -127,9 +123,6 @@ NCZ_initialize(void) { int stat; NCZ_dispatch_table = &NCZ_dispatcher; -#ifdef ZTRACING - NCZ_dispatch_table = &NCZ_dispatcher_trace; -#endif if (!ncz_initialized) NCZ_initialize_internal(); stat = NCZ_provenance_init(); @@ -196,3 +189,123 @@ NCZ_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparams, u return REPORT(NC_ENOFILTER,"inq_var_filter_info"); } #endif /*ENABLE_NCZARR_FILTERS*/ + +/**************************************************/ +/* Following functions call into libsrc4 */ + +int +NCZ_inq_type(int ncid, nc_type xtype, char *name, size_t *size) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_type(ncid,xtype,name,size)"); + stat = NC4_inq_type(ncid,xtype,name,size); + return ZUNTRACE(stat); +} + +int +NCZ_inq_dimid(int ncid, const char *name, int *idp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_dimid(ncid,name,idp)"); + stat = NC4_inq_dimid(ncid,name,idp); + return ZUNTRACE(stat); +} + +int +NCZ_inq_unlimdim(int ncid, int *unlimdimidp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_unlimdim(ncid,unlimdimidp)"); + stat = NC4_inq_unlimdim(ncid,unlimdimidp); + return ZUNTRACE(stat); +} + +int +NCZ_inq_varid(int ncid, const char* name, int *varidp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_varid(ncid,name,varidp)"); + stat = NC4_inq_varid(ncid,name,varidp); + return ZUNTRACE(stat); +} + +int +NCZ_inq_ncid(int ncid, const char* name, int* grpidp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_ncid(ncid,name,grpidp)"); + stat = NC4_inq_ncid(ncid,name,grpidp); + return ZUNTRACE(stat); +} + +int +NCZ_inq_grps(int ncid, int* n, int* ncids) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_grps(ncid,n,ncids)"); + stat = NC4_inq_grps(ncid,n,ncids); + return ZUNTRACE(stat); +} + +int +NCZ_inq_grpname(int ncid, char* name) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_grpname(ncid,name)"); + stat = NC4_inq_grpname(ncid,name); + return ZUNTRACE(stat); +} + +int +NCZ_inq_grpname_full(int ncid, size_t* lenp, char* fullname) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_grpname_full(ncid,lenp,fullname)"); + stat = NC4_inq_grpname_full(ncid,lenp,fullname); + return ZUNTRACE(stat); +} + +int +NCZ_inq_grp_parent(int ncid, int* parentidp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_grp_parent(ncid,parentidp)"); + stat = NC4_inq_grp_parent(ncid,parentidp); + return ZUNTRACE(stat); +} + +int +NCZ_inq_grp_full_ncid(int ncid, const char* fullname, int* grpidp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_grp_full_ncid(ncid,fullname,grpidp)"); + stat = NC4_inq_grp_full_ncid(ncid,fullname,grpidp); + return ZUNTRACE(stat); +} + +int +NCZ_inq_varids(int ncid, int* nvars, int* varids) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_varids(ncid,nvars,varids)"); + stat = NC4_inq_varids(ncid,nvars,varids); + return ZUNTRACE(stat); +} + +int +NCZ_inq_dimids(int ncid, int* ndims, int* dimids, int inclparents) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_dimids(ncid,ndims,dimids,inclparents)"); + stat = NC4_inq_dimids(ncid,ndims,dimids,inclparents); + return ZUNTRACE(stat); +} + +int +NCZ_inq_user_type(int ncid, nc_type xtype, char* name, size_t* size, nc_type* basetid, size_t* nfields, int* classp) +{ + int stat = NC_NOERR; + ZTRACE(0,"NC4_inq_user_type(ncid,xtype,name,size,basetid,nfields,classp)"); + stat = NC4_inq_user_type(ncid,xtype,name,size,basetid,nfields,classp); + return ZUNTRACE(stat); +} diff --git a/libnczarr/zdispatch.h b/libnczarr/zdispatch.h index fdbd03828a..09391d03f8 100644 --- a/libnczarr/zdispatch.h +++ b/libnczarr/zdispatch.h @@ -173,9 +173,28 @@ EXTERNL int NCZ_def_var_filter(int ncid, int varid, unsigned int filterid, size_ EXTERNL int NCZ_inq_var_filter_ids(int ncid, int varid, size_t* nfiltersp, unsigned int *filterids); EXTERNL int NCZ_inq_var_filter_info(int ncid, int varid, unsigned int filterid, size_t* nparamsp, unsigned int *params); -EXTERNL int NCZ_def_var_filterx(int ncid, int varid, const char* text); -EXTERNL int NCZ_inq_var_filterx_ids(int ncid, int varid, char** textp); -EXTERNL int NCZ_inq_var_filterx_info(int ncid, int varid, const char* id, char** textp); +EXTERNL int NCZ_def_var_quantize(int ncid, int varid, int quantize_mode, int nsd); +EXTERNL int NCZ_inq_var_quantize(int ncid, int varid, int *quantize_modep, int *nsdp); + +/**************************************************/ +/* Following functions wrap libsrc4 */ +EXTERNL int NCZ_inq_type(int ncid, nc_type xtype, char *name, size_t *size); +EXTERNL int NCZ_inq_dimid(int ncid, const char *name, int *idp); +EXTERNL int NCZ_inq_unlimdim(int ncid, int *unlimdimidp); +EXTERNL int NCZ_inq_attname(int ncid, int varid, int attnum, char *name); +EXTERNL int NCZ_inq_varid(int ncid, const char* name, int *varidp); +EXTERNL int NCZ_inq_ncid(int ncid, const char* name, int* grpidp); +EXTERNL int NCZ_inq_grps(int ncid, int* n, int* ncids); +EXTERNL int NCZ_inq_grpname(int ncid, char* name); +EXTERNL int NCZ_inq_grpname_full(int ncid, size_t* lenp, char* fullname); +EXTERNL int NCZ_inq_grp_parent(int ncid, int* parentidp); +EXTERNL int NCZ_inq_grp_full_ncid(int ncid, const char* fullname, int* grpidp); +EXTERNL int NCZ_inq_varids(int ncid, int* nvars, int* varids); +EXTERNL int NCZ_inq_dimids(int ncid, int* ndims, int* dimids, int inclparents); +EXTERNL int NCZ_inq_typeids(int ncid, int* ntypes, int* typeids); +EXTERNL int NCZ_inq_user_type(int ncid, nc_type xtype, char* name, size_t* size, nc_type* basetid, size_t* nfields, int* classp); + +/**************************************************/ #if defined(__cplusplus) } diff --git a/libnczarr/zfile.c b/libnczarr/zfile.c index 96070567c8..69e13cb3f6 100644 --- a/libnczarr/zfile.c +++ b/libnczarr/zfile.c @@ -16,7 +16,7 @@ #include "zfilter.h" /* Forward */ -static int NCZ_enddef(int ncid); +static int NCZ_enddef(NC_FILE_INFO_T* h5); static int ncz_sync_netcdf4_file(NC_FILE_INFO_T* file, int isclose); /** @@ -34,20 +34,20 @@ NCZ_redef(int ncid) NC_FILE_INFO_T* zinfo = NULL; int stat = NC_NOERR; - LOG((1, "%s: ncid 0x%x", __func__, ncid)); + ZTRACE(0,"NCZ_redef(ncid)"); /* Find this file's metadata. */ if ((stat = nc4_find_grp_h5(ncid, NULL, &zinfo))) - return stat; + goto done; assert(zinfo); /* If we're already in define mode, return an error. */ if (zinfo->flags & NC_INDEF) - return NC_EINDEFINE; + {stat = NC_EINDEFINE; goto done;} /* If the file is read-only, return an error. */ if (zinfo->no_write) - return NC_EPERM; + {stat = NC_EPERM; goto done;} /* Set define mode. */ zinfo->flags |= NC_INDEF; @@ -56,7 +56,8 @@ NCZ_redef(int ncid) redef. */ zinfo->redef = NC_TRUE; - return NC_NOERR; +done: + return ZUNTRACE(stat); } /** @@ -77,8 +78,13 @@ NCZ__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align) { int stat = NC_NOERR; + NC_FILE_INFO_T* h5 = NULL; + NC_GRP_INFO_T* grp = NULL; ZTRACE(0,"ncid=%d",ncid); - stat = NCZ_enddef(ncid); + if ((stat = nc4_find_grp_h5(ncid, &grp, &h5))) + goto done; + stat = NCZ_enddef(h5); +done: return ZUNTRACE(stat); } @@ -86,7 +92,7 @@ NCZ__enddef(int ncid, size_t h_minfree, size_t v_align, * @internal Take the file out of define mode. This is called * automatically for netcdf-4 files, if the user forgets. * - * @param ncid File and group ID. + * @param h5 File object * * @return ::NC_NOERR No error. * @return ::NC_EBADID Bad ncid. @@ -94,41 +100,36 @@ NCZ__enddef(int ncid, size_t h_minfree, size_t v_align, * @author Dennis Heimbigner, Ed Hartnett */ static int -NCZ_enddef(int ncid) +NCZ_enddef(NC_FILE_INFO_T* h5) { - NC_FILE_INFO_T* h5 = NULL; - NC_GRP_INFO_T *grp; NC_VAR_INFO_T *var; int i,j; int stat = NC_NOERR; - ZTRACE(1,"ncid=%d",ncid); - - /* Find pointer to group and zinfo. */ - if ((stat = nc4_find_grp_h5(ncid, &grp, &h5))) - goto done; + ZTRACE(1,"h5=%s",h5->hdr.name); - /* Why is this here? Especially since it is not recursive so it - only applies to the this grp */ /* When exiting define mode, process all variables */ for (i = 0; i < nclistlength(h5->allgroups); i++) { NC_GRP_INFO_T* g = nclistget(h5->allgroups,i); for (j = 0; j < ncindexsize(g->vars); j++) { var = (NC_VAR_INFO_T *)ncindexith(g->vars, j); assert(var); - /* set the fill value and _FillValue attribute */ - if((stat = ncz_get_fill_value(h5,var,NULL))) goto done; /* ensure var->fill_value is set */ - assert(var->fill_value != NULL); var->written_to = NC_TRUE; /* mark it written */ + var->created = 1; +#if 0 + /* set the fill value and _FillValue attribute */ + if((stat = NCZ_ensure_fill_value(var))) goto done; /* ensure var->fill_value is set */ + assert(var->no_fill || var->fill_value != NULL); /* rebuild the fill chunk */ if((stat = NCZ_adjust_var_cache(var))) goto done; #ifdef ENABLE_NCZARR_FILTERS /* Build the filter working parameters for any filters */ if((stat = NCZ_filter_setup(var))) goto done; #endif +#endif /*0|1*/ } } - stat = ncz_enddef_netcdf4_file(h5); + if((stat = ncz_enddef_netcdf4_file(h5))) goto done; done: return ZUNTRACE(stat); } @@ -163,7 +164,7 @@ NCZ_sync(int ncid) { if (file->cmode & NC_CLASSIC_MODEL) return NC_EINDEFINE; - if ((stat = NCZ_enddef(ncid))) + if ((stat = NCZ_enddef(file))) return stat; } @@ -252,7 +253,7 @@ ncz_closeorabort(NC_FILE_INFO_T* h5, void* params, int abort) /* If we're in define mode, but not redefing the file, delete it. */ if(!abort) { - /* Invoke enddef if needed, which mean sync first */ + /* Invoke enddef if needed, which includes sync first */ if(h5->flags & NC_INDEF) h5->flags ^= NC_INDEF; /* Sync the file unless this is a read-only file. */ if(!h5->no_write) { @@ -412,7 +413,7 @@ ncz_sync_netcdf4_file(NC_FILE_INFO_T* file, int isclose) } /** - * @internal This function will do the enddef stuff for a netcdf-4 file. + * @internal This function will do the enddef stuff for an nczarr file. * * @param file Pointer to ZARR file info struct. * @@ -456,20 +457,20 @@ NCZ_set_fill(int ncid, int fillmode, int *old_modep) NC_FILE_INFO_T* h5 = NULL; int stat = NC_NOERR; - LOG((2, "%s: ncid 0x%x fillmode %d", __func__, ncid, fillmode)); + ZTRACE(0,"NCZ_set_fill(ncid,fillmode,old)"); /* Get pointer to file info. */ if ((stat = nc4_find_grp_h5(ncid, NULL, &h5))) - return stat; + goto done; assert(h5); /* Trying to set fill on a read-only file? You sicken me! */ if (h5->no_write) - return NC_EPERM; + {stat = NC_EPERM; goto done;} /* Did you pass me some weird fillmode? */ if (fillmode != NC_FILL && fillmode != NC_NOFILL) - return NC_EINVAL; + {stat = NC_EINVAL; goto done;} /* If the user wants to know, tell him what the old mode was. */ if (old_modep) @@ -477,5 +478,6 @@ NCZ_set_fill(int ncid, int fillmode, int *old_modep) h5->fill_mode = fillmode; - return NC_NOERR; +done: + return ZUNTRACE(stat); } diff --git a/libnczarr/zfilter.c b/libnczarr/zfilter.c index 3d64b66d67..d2d24b9048 100644 --- a/libnczarr/zfilter.c +++ b/libnczarr/zfilter.c @@ -53,8 +53,8 @@ #include "netcdf_aux.h" #undef DEBUG -#define DEBUGF -#define DEBUGL +#undef DEBUGF +#undef DEBUGL #define NULLIFY(x) ((x)?(x):"NULL") @@ -486,6 +486,7 @@ nc_var_filter_remove(int ncid, int varid, unsigned int filterid) } #endif +#ifdef ENABLE_NCZARR_FILTERS int NCZ_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* params) @@ -678,7 +679,7 @@ NCZ_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparamsp, done: return ZUNTRACEX(stat,"nparams=%u",(unsigned)(nparamsp?*nparamsp:0)); } - +#endif /*ENABLE_NCZARR_FILTERS*/ /**************************************************/ /* Filter application functions */ @@ -778,7 +779,6 @@ NCZ_applyfilterchain(const NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, NClist* cha void* next_buf = NULL; size_t next_used = 0; - #ifdef DEBUG fprintf(stderr,"current: alloc=%u used=%u buf=%p\n",(unsigned)current_alloc,(unsigned)current_used,current_buf); #endif @@ -796,6 +796,7 @@ fprintf(stderr,"current: alloc=%u used=%u buf=%p\n",(unsigned)current_alloc,(uns fprintf(stderr,"next: alloc=%u used=%u buf=%p\n",(unsigned)next_alloc,(unsigned)next_used,next_buf); #endif if(next_used == 0) {stat = NC_EFILTER; lastbuffer = next_buf; goto done; } + /* If the filter did not need to create a new buffer, then next == current else current was reclaimed */ current_buf = next_buf; current_alloc = next_alloc; current_used = next_used; @@ -814,6 +815,7 @@ fprintf(stderr,"next: alloc=%u used=%u buf=%p\n",(unsigned)next_alloc,(unsigned) fprintf(stderr,"next: alloc=%u used=%u buf=%p\n",(unsigned)next_alloc,(unsigned)next_used,next_buf); #endif if(next_used == 0) {stat = NC_EFILTER; lastbuffer = next_buf; goto done;} + /* If the filter did not need to create a new buffer, then next == current else current was reclaimed */ current_buf = next_buf; current_alloc = next_alloc; current_used = next_used; @@ -1451,28 +1453,34 @@ ensure_working(const NC_VAR_INFO_T* var, NCZ_Filter* filter) { int stat = NC_NOERR; if(!(filter->flags & FLAG_WORKING)) { - size_t vnparams = filter->hdf5.visible.nparams; - unsigned* vparams = filter->hdf5.visible.params; + const size_t oldnparams = filter->hdf5.visible.nparams; + const unsigned* oldparams = filter->hdf5.visible.params; assert(filter->flags & FLAG_VISIBLE); - /* Convert the visible parameters to working parameters (and back) */ - if(filter->plugin->codec.codec->NCZ_modify_parameters) { - stat = filter->plugin->codec.codec->NCZ_modify_parameters(ncidfor(var),var->hdr.id, + /* Convert the visible parameters to working parameters; may also modify the visible params */ + if(filter->plugin && filter->plugin->codec.codec->NCZ_modify_parameters) { + stat = filter->plugin->codec.codec->NCZ_modify_parameters(ncidfor(var),var->hdr.id, &filter->hdf5.visible.nparams, &filter->hdf5.visible.params, &filter->hdf5.working.nparams, &filter->hdf5.working.params); - if(stat) goto done; +#ifdef DEBUGF + fprintf(stderr,"DEBUGF: NCZ_modify_parameters: ncid=%d varid=%d filter=%s\n", (int)ncidfor(var),(int)var->hdr.id, + printfilter(filter)); +#endif + if(stat) goto done; + /* See if the visible parameters were changed */ + if(oldnparams != filter->hdf5.visible.nparams || oldparams != filter->hdf5.visible.params) + filter->flags |= FLAG_NEWVISIBLE; } else { - /* Just use the visible parameters */ + /* assume visible are unchanged */ + assert(oldnparams == filter->hdf5.visible.nparams && oldparams == filter->hdf5.visible.params); /* unchanged */ + /* Just copy the visible parameters */ nullfree(filter->hdf5.working.params); if((stat = paramnczclone(&filter->hdf5.working,&filter->hdf5.visible))) goto done; } filter->flags |= FLAG_WORKING; - /* See if the visible parameters were changed */ - if(vnparams != filter->hdf5.visible.nparams || vparams != filter->hdf5.visible.params) - filter->flags |= FLAG_NEWVISIBLE; } #ifdef DEBUGF - fprintf(stderr,"DEBUGF: ensure_working_parameters: ncid=%lu varid=%u filter=%s\n", ncidfor(var), (unsigned)var->hdr.id,printfilter(filter)); + fprintf(stderr,"DEBUGF: ensure_working_parameters: ncid=%lu varid=%u filter=%s\n", ncidfor(var), (unsigned)var->hdr.id,printfilter(filter)); #endif done: return THROW(stat); @@ -1540,40 +1548,16 @@ NCZ_filter_setup(NC_VAR_INFO_T* var) filters = (NClist*)var->filters; for(i=0;iplugin != NULL); + assert(filter != NULL && filter->plugin != NULL); assert((filter->flags & FLAG_VISIBLE)); /* Assume visible params are defined */ /* verify */ assert(filter->hdf5.id > 0 && (filter->hdf5.visible.nparams == 0 || filter->hdf5.visible.params != NULL)); - assert((filter->flags & FLAG_WORKING)==0); /* Assume working params are not defined */ - assert(filter->hdf5.working.nparams == 0 && filter->hdf5.working.params == NULL); - vnparams = filter->hdf5.visible.nparams; - vparams = filter->hdf5.visible.params; /* Initialize the working parameters */ - if(filter->plugin && filter->plugin->codec.codec->NCZ_modify_parameters) { - stat = filter->plugin->codec.codec->NCZ_modify_parameters(ncidfor(var),var->hdr.id, - &filter->hdf5.visible.nparams,&filter->hdf5.visible.params, - &filter->hdf5.working.nparams,&filter->hdf5.working.params); -#ifdef DEBUGF - fprintf(stderr,"DEBUGF: NCZ_modify_parameters: ncid=%d varid=%d filter=%s\n", (int)ncidfor(var),(int)var->hdr.id, - printfilter(filter)); -#endif - if(stat) goto done; - } else {/* Just copy over the visible params */ - filter->hdf5.working.nparams = vnparams; - if(vnparams > 0) { - if((stat=paramclone(vnparams,&filter->hdf5.working.params,vparams))) goto done; - } - } + if((stat = ensure_working(var,filter))) goto done; #ifdef DEBUGF fprintf(stderr,"DEBUGF: NCZ_filter_setup: ncid=%d varid=%d filter=%s\n", (int)ncidfor(var),(int)var->hdr.id, printfilter(filter)); #endif - filter->flags |= FLAG_WORKING; - /* See if the visible parameters were changed */ - if(vnparams != filter->hdf5.visible.nparams || vparams != filter->hdf5.visible.params) - filter->flags |= FLAG_NEWVISIBLE; } done: diff --git a/libnczarr/zinternal.c b/libnczarr/zinternal.c index 724e7d7d3d..6980c17851 100644 --- a/libnczarr/zinternal.c +++ b/libnczarr/zinternal.c @@ -635,22 +635,25 @@ ncz_find_grp_var_att(int ncid, int varid, const char *name, int attnum, } /** - * @internal What fill value should be used for a variable? + * @internal Ensure that either var->no_fill || var->fill_value != NULL. * Side effects: set as default if necessary and build _FillValue attribute. * * @param h5 Pointer to file info struct. * @param var Pointer to variable info struct. - * @param fillp Pointer that gets pointer to fill value. * * @returns NC_NOERR No error. * @returns NC_ENOMEM Out of memory. * @author Ed Hartnett, Dennis Heimbigner */ int -ncz_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp) +NCZ_ensure_fill_value(NC_VAR_INFO_T *var) { size_t size; int retval = NC_NOERR; + NC_FILE_INFO_T *h5 = var->container->nc4_info; + + if(var->no_fill) + return NC_NOERR; #if 0 /*LOOK*/ /* Find out how much space we need for this type's fill value. */ @@ -660,9 +663,8 @@ ncz_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp) size = sizeof(char *); else #endif - { - if ((retval = nc4_get_typelen_mem(h5, var->type_info->hdr.id, &size))) goto done; - } + + if ((retval = nc4_get_typelen_mem(h5, var->type_info->hdr.id, &size))) goto done; assert(size); /* If the user has set a fill_value for this var, use, otherwise find the default fill value. */ @@ -674,8 +676,7 @@ ncz_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp) {retval = NC_ENOMEM; goto done;} if((retval = nc4_get_default_fill_value(var->type_info, var->fill_value))) { /* Note: release memory, but don't return error on failure */ - free(var->fill_value); - var->fill_value = NULL; + (void)NCZ_reclaim_fill_value(var); retval = NC_NOERR; goto done; } @@ -714,18 +715,6 @@ ncz_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp) } } #endif /*0*/ - /* Create _FillValue Attribute */ - if((retval = ncz_create_fillvalue(var))) goto done; - if(fillp) { - void* fill = NULL; - /* Allocate the return space. */ - if((fill = calloc(1, size))==NULL) - {retval = NC_ENOMEM; goto done;} - memcpy(fill, var->fill_value, size); - *fillp = fill; - fill = NULL; - } - done: return retval; } @@ -769,6 +758,27 @@ NCZ_set_log_level() } #endif /* LOGGING */ +/** + * @internal Get the format (i.e. NC_FORMAT_NETCDF4 pr + * NC_FORMAT_NETCDF4_CLASSIC) of an open netCDF-4 file. + * + * @param ncid File ID (ignored). + * @param formatp Pointer that gets the constant indicating format. + + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @author Ed Hartnett + */ +int +NCZ_inq_format(int ncid, int *formatp) +{ + int stat = NC_NOERR; + + ZTRACE(0,"ncid=%d formatp=%p",ncid,formatp); + stat = NC4_inq_format(ncid,formatp); + return ZUNTRACEX(stat,"formatp=%d",(formatp?-1:*formatp)); +} + /** * @internal Return the extended format (i.e. the dispatch model), * plus the mode associated with an open file. diff --git a/libnczarr/zinternal.h b/libnczarr/zinternal.h index 471bf2f1b0..95f6060e52 100644 --- a/libnczarr/zinternal.h +++ b/libnczarr/zinternal.h @@ -225,7 +225,7 @@ int NCZ_initialize(void); int NCZ_finalize(void); int NCZ_initialize_internal(void); int NCZ_finalize_internal(void); -int ncz_get_fill_value(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, void **fillp); +int NCZ_ensure_fill_value(NC_VAR_INFO_T* var); int ncz_find_grp_var_att(int ncid, int varid, const char *name, int attnum, int use_name, char *norm_name, NC_FILE_INFO_T** file, NC_GRP_INFO_T** grp, NC_VAR_INFO_T** var, @@ -251,6 +251,7 @@ int ncz_makeattr(NC_OBJ*, NCindex* attlist, const char* name, nc_type typid, siz /* zvar.c */ int ncz_gettype(NC_FILE_INFO_T*, NC_GRP_INFO_T*, int xtype, NC_TYPE_INFO_T** typep); int ncz_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var); +int NCZ_ensure_quantizer(int ncid, NC_VAR_INFO_T* var); /* Undefined */ /* Find var, doing lazy var metadata read if needed. */ diff --git a/libnczarr/zsync.c b/libnczarr/zsync.c index e1aee04df2..fa864091b2 100644 --- a/libnczarr/zsync.c +++ b/libnczarr/zsync.c @@ -274,6 +274,21 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose) zinfo = file->format_file_info; map = zinfo->map; +#if 1 + /* Make sure that everything is established */ + /* ensure the fill value */ + if((stat = NCZ_ensure_fill_value(var))) goto done; /* ensure var->fill_value is set */ + assert(var->no_fill || var->fill_value != NULL); + /* ensure the chunk cache */ + if((stat = NCZ_adjust_var_cache(var))) goto done; + /* rebuild the fill chunk */ + if((stat = NCZ_ensure_fill_chunk(zvar->cache))) goto done; +#ifdef ENABLE_NCZARR_FILTERS + /* Build the filter working parameters for any filters */ + if((stat = NCZ_filter_setup(var))) goto done; +#endif +#endif /*0|1*/ + /* Construct var path */ if((stat = NCZ_varkey(var,&fullpath))) goto done; @@ -348,7 +363,9 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose) if((stat=NCJnew(NCJ_NULL,&jfill))) goto done; } else {/*!var->no_fill*/ int atomictype = var->type_info->hdr.id; - assert(var->fill_value != NULL); + if(var->fill_value == NULL) { + if((stat = NCZ_ensure_fill_value(var))) goto done; + } /* Convert var->fill_value to a string */ if((stat = NCZ_stringconvert(atomictype,1,var->fill_value,&jfill))) goto done; assert(jfill->sort != NCJ_ARRAY); @@ -477,6 +494,8 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose) goto done; nullfree(key); key = NULL; + var->created = 1; + /* Build .zattrs object */ assert(var->att); if((stat = ncz_sync_atts(file,(NC_OBJ*)var, var->att, isclose))) @@ -509,8 +528,7 @@ ncz_sync_var(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose) { int stat = NC_NOERR; NCZ_VAR_INFO_T* zvar = var->format_var_info; - - if(!isclose) { + if(isclose) { if((stat = ncz_sync_var_meta(file,var,isclose))) goto done; } @@ -613,6 +631,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc NCjson* jtype = NULL; NCjson* jdimrefs = NULL; NCjson* jdict = NULL; + NCjson* jint = NULL; NCZMAP* map = NULL; char* fullpath = NULL; char* key = NULL; @@ -620,8 +639,15 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc char* dimpath = NULL; int isxarray = 0; int isrootgroup = 0; - + NC_VAR_INFO_T* var = NULL; + NC_GRP_INFO_T* grp = NULL; + LOG((3, "%s", __func__)); + + if(container->sort == NCVAR) + var = (NC_VAR_INFO_T*)container; + else if(container->sort == NCGRP) + grp = (NC_GRP_INFO_T*)container; zinfo = file->format_file_info; map = zinfo->map; @@ -629,14 +655,10 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc if(zinfo->controls.flags & FLAG_XARRAYDIMS) isxarray = 1; if(container->sort == NCVAR) { - NC_VAR_INFO_T* var = (NC_VAR_INFO_T*)container; if(var->container && var->container->parent == NULL) isrootgroup = 1; } - if(!isxarray && ncindexsize(attlist) == 0) - goto done; /* do nothing */ - if(ncindexsize(attlist) > 0) { /* Create the jncattr.types object */ if((stat = NCJnew(NCJ_DICT,&jtypes))) @@ -661,9 +683,9 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc /* Construct container path */ if(container->sort == NCGRP) - stat = NCZ_grpkey((NC_GRP_INFO_T*)container,&fullpath); + stat = NCZ_grpkey(grp,&fullpath); else - stat = NCZ_varkey((NC_VAR_INFO_T*)container,&fullpath); + stat = NCZ_varkey(var,&fullpath); if(stat) goto done; @@ -671,9 +693,8 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc if((stat = ncz_jsonize_atts(attlist,&jatts))) goto done; - if(container->sort == NCVAR) { + if(container->sort == NCVAR) { if(isrootgroup && isxarray) { - NC_VAR_INFO_T* var = (NC_VAR_INFO_T*)container; /* Insert the XARRAY _ARRAY_ATTRIBUTE attribute */ if((stat = NCJnew(NCJ_ARRAY,&jdimrefs))) goto done; @@ -690,23 +711,44 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc jdimrefs = NULL; } } - if(!(zinfo->controls.flags & FLAG_PUREZARR)) { - /* Insert the _NCZARR_ATTR attribute */ - if((stat = NCJnew(NCJ_DICT,&jdict))) + /* Add Quantize Attribute */ + if(container->sort == NCVAR && var && var->quantize_mode > 0) { + char mode[64]; + snprintf(mode,sizeof(mode),"%d",var->nsd); + if((stat = NCJnewstring(NCJ_INT,mode,&jint))) goto done; - if((stat = NCJinsert(jdict,"types",jtypes))) goto done; - jtypes = NULL; - if((stat = NCJinsert(jatts,NCZ_V2_ATTR,jdict))) goto done; - jdict = NULL; + /* Insert the quantize attribute */ + switch (var->quantize_mode) { + case NC_QUANTIZE_BITGROOM: + if((stat = NCJinsert(jatts,NC_QUANTIZE_BITGROOM_ATT_NAME,jint))) goto done; + jint = NULL; + break; + case NC_QUANTIZE_GRANULARBR: + if((stat = NCJinsert(jatts,NC_QUANTIZE_GRANULARBR_ATT_NAME,jint))) goto done; + jint = NULL; + break; + default: break; + } } - /* write .zattrs path */ - if((stat = nczm_concat(fullpath,ZATTRS,&key))) - goto done; - /* Write to map */ - if((stat=NCZ_uploadjson(map,key,jatts))) - goto done; - nullfree(key); key = NULL; + if(NCJlength(jatts) > 0) { + if(!(zinfo->controls.flags & FLAG_PUREZARR)) { + /* Insert the _NCZARR_ATTR attribute */ + if((stat = NCJnew(NCJ_DICT,&jdict))) + goto done; + if((stat = NCJinsert(jdict,"types",jtypes))) goto done; + jtypes = NULL; + if((stat = NCJinsert(jatts,NCZ_V2_ATTR,jdict))) goto done; + jdict = NULL; + } + /* write .zattrs path */ + if((stat = nczm_concat(fullpath,ZATTRS,&key))) + goto done; + /* Write to map */ + if((stat=NCZ_uploadjson(map,key,jatts))) + goto done; + nullfree(key); key = NULL; + } done: nullfree(fullpath); @@ -718,6 +760,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc NCJreclaim(jtype); NCJreclaim(jdimrefs); NCJreclaim(jdict); + NCJreclaim(jint); return THROW(stat); } @@ -1423,6 +1466,12 @@ define_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NClist* varnames) var->format_var_info = zvar; zvar->common.file = file; + /* pretend it was created */ + var->created = 1; + + /* Indicate we do not have quantizer yet */ + var->quantize_mode = -1; + /* Set filter list */ assert(var->filters == NULL); var->filters = (void*)nclistnew(); @@ -2127,6 +2176,10 @@ ncz_get_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var) if ((retval = nc4_adjust_var_cache(var))) BAIL(retval); + /* Is there an attribute which means quantization was used? */ + if ((retval = get_quantize_info(var))) + BAIL(retval); + if (var->coords_read && !var->dimscale) if ((retval = get_attached_info(var, hdf5_var, var->ndims, hdf5_var->hdf_datasetid))) return retval; diff --git a/libnczarr/ztracedispatch.h b/libnczarr/ztracedispatch.h deleted file mode 100644 index 3db5ffb98c..0000000000 --- a/libnczarr/ztracedispatch.h +++ /dev/null @@ -1,572 +0,0 @@ -/* Copyright 2005-2018 University Corporation for Atmospheric - Research/Unidata. */ - -/** - * @file - * @internal This header file contains prototypes and initialization - * for the ZARR dispatch layer. - * - * @author Dennis Heimbigner, Ed Hartnett - */ - -#include "zincludes.h" - -static int NCZTR_create(const char *path, int cmode, size_t initialsz, int basepe, size_t *chunksizehintp, void *parameters, const struct NC_Dispatch *table, int ncid) -{ - int stat = NC_NOERR; - stat = NCZ_create(path,cmode,initialsz,basepe,chunksizehintp,parameters,table,ncid); - return stat; -} - -static int NCZTR_open(const char *path, int mode, int basepe, size_t *chunksizehintp,void *parameters, const struct NC_Dispatch *table, int ncid) -{ - int stat = NC_NOERR; - stat = NCZ_open(path,mode,basepe,chunksizehintp,parameters,table,ncid); - return stat; -} - -static int NCZTR_redef(int ncid) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_redef(ncid)"); - stat = NCZ_redef(ncid); - return ZUNTRACE(stat); -} - -static int NCZTR__enddef(int ncid,size_t h_minfree,size_t v_align,size_t v_minfree,size_t r_align) -{ - int stat = NC_NOERR; - stat = NCZ__enddef(ncid,h_minfree,v_align,v_minfree,r_align); - return stat; -} - -static int NCZTR_sync(int ncid) -{ - int stat = NC_NOERR; - stat = NCZ_sync(ncid); - return stat; -} - -static int NCZTR_abort(int ncid) -{ - int stat = NC_NOERR; - stat = NCZ_abort(ncid); - return stat; -} - -static int NCZTR_close(int ncid, void* params) -{ - int stat = NC_NOERR; - stat = NCZ_close(ncid,params); - return stat; -} - -static int NCZTR_set_fill(int ncid, int fillmode, int *old) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_set_fill(ncid,fillmode,old)"); - stat = NCZ_set_fill(ncid,fillmode,old); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_format(int ncid, int* formatp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_format(ncid,formatp)"); - stat = NC4_inq_format(ncid,formatp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_format_extended(int ncid, int *formatp, int *modep) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_format_extended(ncid,formatp,modep)"); - stat = NCZ_inq_format_extended(ncid,formatp,modep); - return ZUNTRACE(stat); -} - -static int NCZTR_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *udimp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq(ncid,ndimsp,nvarsp,nattsp,udimp)"); - stat = NCZ_inq(ncid,ndimsp,nvarsp,nattsp,udimp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_type(int ncid, nc_type xtype, char *name, size_t *size) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_type(ncid,xtype,name,size)"); - stat = NC4_inq_type(ncid,xtype,name,size); - return ZUNTRACE(stat); -} - -static int NCZTR_def_dim(int ncid, const char *name, size_t len, int *idp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_dim(ncid,name,len,idp)"); - stat = NCZ_def_dim(ncid,name,len,idp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_dimid(int ncid, const char *name, int *idp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_dimid(ncid,name,idp)"); - stat = NC4_inq_dimid(ncid,name,idp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_dim(int ncid, int dimid, char *name, size_t *lenp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_dim(ncid,dimid,name,lenp)"); - stat = NCZ_inq_dim(ncid,dimid,name,lenp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_unlimdim(int ncid, int *unlimdimidp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_unlimdim(ncid,unlimdimidp)"); - stat = NC4_inq_unlimdim(ncid,unlimdimidp); - return ZUNTRACE(stat); -} - -static int NCZTR_rename_dim(int ncid, int dimid, const char *name) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_rename_dim(ncid,dimid,name)"); - stat = NCZ_rename_dim(ncid,dimid,name); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_att(ncid,varid,name,xtypep,lenp)"); - stat = NCZ_inq_att(ncid,varid,name,xtypep,lenp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_attid(int ncid, int varid, const char* name, int *idp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_attid(ncid,varid,name,idp)"); - stat = NCZ_inq_attid(ncid,varid,name,idp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_attname(int ncid, int varid, int attnum, char *name) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_attname(ncid,varid,attnum,name)"); - stat = NCZ_inq_attname(ncid,varid,attnum,name); - return ZUNTRACE(stat); -} - -static int NCZTR_rename_att(int ncid, int varid, const char* name, const char *newname) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_rename_att(ncid,varid,name,newname)"); - stat = NCZ_rename_att(ncid,varid,name,newname); - return ZUNTRACE(stat); -} - -static int NCZTR_del_att(int ncid, int varid, const char *name) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_del_att(ncid,varid,name)"); - stat = NCZ_del_att(ncid,varid,name); - return ZUNTRACE(stat); -} - -static int NCZTR_get_att(int ncid, int varid, const char* name, void *data, nc_type memtype) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_get_att(ncid,varid,name,data,memtype)"); - stat = NCZ_get_att(ncid,varid,name,data,memtype); - return ZUNTRACE(stat); -} - -static int NCZTR_put_att(int ncid, int varid, const char* name, nc_type filetype, size_t len, const void *data, nc_type memtype) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_put_att(ncid,varid,name,filetype,len,data,memtype)"); - stat = NCZ_put_att(ncid,varid,name,filetype,len,data,memtype); - return ZUNTRACE(stat); -} - -static int NCZTR_def_var(int ncid, const char* name, nc_type xtype, int ndims, const int *dimidsp, int *varidp) -{ - int stat = NC_NOERR; - stat = NCZ_def_var(ncid,name,xtype,ndims,dimidsp,varidp); - return stat; -} - -static int NCZTR_inq_varid(int ncid, const char* name, int *varidp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_varid(ncid,name,varidp)"); - stat = NC4_inq_varid(ncid,name,varidp); - return ZUNTRACE(stat); -} - -static int NCZTR_rename_var(int ncid, int varid, const char *name) -{ - int stat = NC_NOERR; - stat = NCZ_rename_var(ncid,varid,name); - return stat; -} - -static int NCZTR_get_vara(int ncid, int varid, const size_t *startp, const size_t *countp, void *ip, nc_type memtype) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_get_vara(ncid,varid,startp,countp,ip,memtype)"); - stat = NCZ_get_vara(ncid,varid,startp,countp,ip,memtype); - return ZUNTRACE(stat); -} - -static int NCZTR_put_vara(int ncid, int varid, const size_t *startp, const size_t *countp, const void *ip, nc_type memtype) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_put_vara(ncid,varid,startp,countp,ip,memtype)"); - stat = NCZ_put_vara(ncid,varid,startp,countp,ip,memtype); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp, int *shufflep, int *deflatep, int *deflate_levelp, int *fletcher32p, int *contiguousp, size_t *chunksizesp, int *no_fill, void *fill_valuep, int *endiannessp, unsigned int *idp, size_t *nparamsp, unsigned int *params) -{ - int stat = NC_NOERR; - stat = NCZ_inq_var_all(ncid,varid,name,xtypep,ndimsp,dimidsp,nattsp,shufflep,deflatep,deflate_levelp,fletcher32p,contiguousp,chunksizesp,no_fill,fill_valuep,endiannessp,idp,nparamsp,params); - return stat; -} - -static int NCZTR_var_par_access(int ncid, int varid, int par_access) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_var_par_access(ncid,varid,par_access)"); - stat = NCZ_var_par_access(ncid,varid,par_access); - return ZUNTRACE(stat); -} - -static int NCZTR_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_var_fill(ncid,varid,no_fill,fill_value)"); - stat = NCZ_def_var_fill(ncid,varid,no_fill,fill_value); - return ZUNTRACE(stat); -} - -static int NCZTR_show_metadata(int ncid) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_show_metadata(ncid)"); - stat = NCZ_show_metadata(ncid); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_unlimdims(int ncid, int* n, int* uidsp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_unlimdims(ncid,n,uidsp)"); - stat = NCZ_inq_unlimdims(ncid,n,uidsp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_ncid(int ncid, const char* name, int* grpidp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_ncid(ncid,name,grpidp)"); - stat = NC4_inq_ncid(ncid,name,grpidp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_grps(int ncid, int* n, int* ncids) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_grps(ncid,n,ncids)"); - stat = NC4_inq_grps(ncid,n,ncids); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_grpname(int ncid, char* name) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_grpname(ncid,name)"); - stat = NC4_inq_grpname(ncid,name); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_grpname_full(int ncid, size_t* lenp, char* fullname) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_grpname_full(ncid,lenp,fullname)"); - stat = NC4_inq_grpname_full(ncid,lenp,fullname); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_grp_parent(int ncid, int* parentidp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_grp_parent(ncid,parentidp)"); - stat = NC4_inq_grp_parent(ncid,parentidp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_grp_full_ncid(int ncid, const char* fullname, int* grpidp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_grp_full_ncid(ncid,fullname,grpidp)"); - stat = NC4_inq_grp_full_ncid(ncid,fullname,grpidp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_varids(int ncid, int* nvars, int* varids) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_varids(ncid,nvars,varids)"); - stat = NC4_inq_varids(ncid,nvars,varids); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_dimids(int ncid, int* ndims, int* dimids, int inclparents) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_dimids(ncid,ndims,dimids,inclparents)"); - stat = NC4_inq_dimids(ncid,ndims,dimids,inclparents); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_typeids(int ncid, int* ntypes, int* typeids) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_typeids(ncid,ntypes,typeids)"); - stat = NCZ_inq_typeids(ncid,ntypes,typeids); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_type_equal(int ncid1, nc_type tid1, int ncid2, nc_type tid2, int* eq) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_type_equal(ncid1,tid1,ncid2,tid2,eq)"); - stat = NCZ_inq_type_equal(ncid1,tid1,ncid2,tid2,eq); - return ZUNTRACE(stat); -} - -static int NCZTR_def_grp(int parent, const char* name, int* grpid) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_grp(parent,name,grpid)"); - stat = NCZ_def_grp(parent,name,grpid); - return ZUNTRACE(stat); -} - -static int NCZTR_rename_grp(int ncid, const char* name) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_rename_grp(ncid,name)"); - stat = NCZ_rename_grp(ncid,name); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_user_type(int ncid, nc_type xtype, char* name, size_t* size, nc_type* basetid, size_t* nfields, int* classp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_inq_user_type(ncid,xtype,name,size,basetid,nfields,classp)"); - stat = NC4_inq_user_type(ncid,xtype,name,size,basetid,nfields,classp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_typeid(int ncid, const char* name, nc_type* tidp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_typeid(ncid,name,tidp)"); - stat = NCZ_inq_typeid(ncid,name,tidp); - return ZUNTRACE(stat); -} - -static int NCZTR_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizes) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_var_chunking(ncid,varid,storage,chunksizes)"); - stat = NCZ_def_var_chunking(ncid,varid,storage,chunksizes); - return ZUNTRACE(stat); -} - -static int NCZTR_def_var_endian(int ncid, int varid, int endian) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_var_endian(ncid,varid,endian)"); - stat = NCZ_def_var_endian(ncid,varid,endian); - return ZUNTRACE(stat); -} - -static int NCZTR_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_set_var_chunk_cache(ncid,varid,size,nelems,preemption)"); - stat = NCZ_set_var_chunk_cache(ncid,varid,size,nelems,preemption); - return ZUNTRACE(stat); -} - -static int NCZTR_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp) -{ - int stat = NC_NOERR; - ZTRACE(0,"NC4_get_var_chunk_cache(ncid,varid,sizep,nelemsp,preemptionp)"); - stat = NC4_get_var_chunk_cache(ncid,varid,sizep,nelemsp,preemptionp); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_var_filter_ids(int ncid, int varid, size_t* nfilters, unsigned int* filterids) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_var_filter_ids(ncid,varid,nfilters,filterids)"); - stat = NCZ_inq_var_filter_ids(ncid,varid,nfilters,filterids); - return ZUNTRACE(stat); -} - -static int NCZTR_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparams, unsigned int* params) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_inq_var_filter_info(ncid,varid,id,nparams,params)"); - stat = NCZ_inq_var_filter_info(ncid,varid,id,nparams,params); - return ZUNTRACE(stat); -} - - -static int NCZTR_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, void *ip, nc_type memtype) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_get_vars(ncid,varid,startp,countp,stridep,ip,memtype)"); - stat = NCZ_get_vars(ncid,varid,startp,countp,stridep,ip,memtype); - return ZUNTRACE(stat); -} - -static int NCZTR_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, const void *ip, nc_type memtype) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_put_vars(ncid,varid,startp,countp,stridep,ip,memtype)"); - stat = NCZ_put_vars(ncid,varid,startp,countp,stridep,ip,memtype); - return ZUNTRACE(stat); -} - -#if 0 -static int NCZTR_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int level) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_var_deflate(ncid,varid,shuffle,deflate,level)"); - stat = NCZ_def_var_deflate(ncid,varid,shuffle,deflate,level); - return ZUNTRACE(stat); -} - -static int NCZTR_def_var_fletcher32(int ncid, int varid, int fletcher32) -{ - int stat = NC_NOERR; - ZTRACE(0,"NCZ_def_var_fletcher32(ncid,varid,fletcher32)"); - stat = NCZ_def_var_fletcher32(ncid,varid,fletcher32); - return ZUNTRACE(stat); -} - -static int NCZTR_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int *params) -{ - int stat = NC_NOERR; - stat = NCZ_def_var_filter(ncid,varid,id,nparams,params); - return (stat); -} - -#endif - -static const NC_Dispatch NCZ_dispatcher_trace = { - - NC_FORMATX_NCZARR, - NC_DISPATCH_VERSION, - - NCZTR_create, - NCZTR_open, - - NCZTR_redef, - NCZTR__enddef, - NCZTR_sync, - NCZTR_abort, - NCZTR_close, - NCZTR_set_fill, - NCZTR_inq_format, - NCZTR_inq_format_extended, - - NCZTR_inq, - NCZTR_inq_type, - - NCZTR_def_dim, - NCZTR_inq_dimid, - NCZTR_inq_dim, - NCZTR_inq_unlimdim, - NCZTR_rename_dim, - - NCZTR_inq_att, - NCZTR_inq_attid, - NCZTR_inq_attname, - NCZTR_rename_att, - NCZTR_del_att, - NCZTR_get_att, - NCZTR_put_att, - - NCZTR_def_var, - NCZTR_inq_varid, - NCZTR_rename_var, - NCZTR_get_vara, - NCZTR_put_vara, - NCZTR_get_vars, - NCZTR_put_vars, - NCDEFAULT_get_varm, - NCDEFAULT_put_varm, - - NCZTR_inq_var_all, - - NCZTR_var_par_access, - NCZTR_def_var_fill, - - NCZTR_show_metadata, - NCZTR_inq_unlimdims, - - NCZTR_inq_ncid, - NCZTR_inq_grps, - NCZTR_inq_grpname, - NCZTR_inq_grpname_full, - NCZTR_inq_grp_parent, - NCZTR_inq_grp_full_ncid, - NCZTR_inq_varids, - NCZTR_inq_dimids, - NCZTR_inq_typeids, - NCZTR_inq_type_equal, - NCZTR_def_grp, - NCZTR_rename_grp, - NCZTR_inq_user_type, - NCZTR_inq_typeid, - - NC_NOTNC4_def_compound, - NC_NOTNC4_insert_compound, - NC_NOTNC4_insert_array_compound, - NC_NOTNC4_inq_compound_field, - NC_NOTNC4_inq_compound_fieldindex, - NC_NOTNC4_def_vlen, - NC_NOTNC4_put_vlen_element, - NC_NOTNC4_get_vlen_element, - NC_NOTNC4_def_enum, - NC_NOTNC4_insert_enum, - NC_NOTNC4_inq_enum_member, - NC_NOTNC4_inq_enum_ident, - NC_NOTNC4_def_opaque, - NC_NOTNC4_def_var_deflate, - NC_NOTNC4_def_var_fletcher32, - NCZTR_def_var_chunking, - NCZTR_def_var_endian, - NCZ_def_var_filter, - NCZTR_set_var_chunk_cache, - NCZTR_get_var_chunk_cache, - NCZTR_inq_var_filter_ids, - NCZTR_inq_var_filter_info, - NC_NOTNC4_def_var_quantize, - NC_NOTNC4_inq_var_quantize, -}; - diff --git a/libnczarr/ztype.c b/libnczarr/ztype.c index b8463aaaa8..12035dd0dd 100644 --- a/libnczarr/ztype.c +++ b/libnczarr/ztype.c @@ -133,8 +133,9 @@ NCZ_inq_typeid(int ncid, const char *name, nc_type *typeidp) int NCZ_inq_typeids(int ncid, int *ntypes, int *typeids) { + ZTRACE(0,"ncid=%d",ncid); if(ntypes) *ntypes = 0; - return NC_NOERR; + return ZUNTRACEX(NC_NOERR,"ntypes=%d typeids=%p",(ntypes?-1:*ntypes),typeids); } #ifdef LOOK diff --git a/libnczarr/zutil.c b/libnczarr/zutil.c index acf4dcb417..fb04dd38a3 100644 --- a/libnczarr/zutil.c +++ b/libnczarr/zutil.c @@ -729,51 +729,6 @@ NCZ_freestringvec(size_t len, char** vec) nullfree(vec); } -/* create a fill chunk */ -int -NCZ_create_fill_chunk(size64_t chunksize, size_t typesize, const void* fill, void** fillchunkp) -{ - int i; - void* fillchunk = NULL; - if((fillchunk = malloc(chunksize))==NULL) - return NC_ENOMEM; - if(fill == NULL) { - /* use zeros */ - memset(fillchunk,0,chunksize); - goto done; - } - switch (typesize) { - case 1: { - unsigned char c = *((unsigned char*)fill); - memset(fillchunk,c,chunksize); - } break; - case 2: { - unsigned short fv = *((unsigned short*)fill); - unsigned short* p2 = (unsigned short*)fillchunk; - for(i=0;ifill_value) { + int ncid = var->container->nc4_info->controller->ext_ncid; + int tid = var->type_info->hdr.id; + stat = nc_reclaim_data_all(ncid,tid,var->fill_value,1); + var->fill_value = NULL; + } + /* Reclaim any existing fill_chunk */ + if(!stat) stat = NCZ_reclaim_fill_chunk(((NCZ_VAR_INFO_T*)var->format_var_info)->cache); + return stat; +} + +int +NCZ_copy_fill_value(NC_VAR_INFO_T* var, void** dstp) +{ + int stat = NC_NOERR; + int ncid = var->container->nc4_info->controller->ext_ncid; + int tid = var->type_info->hdr.id; + void* dst = NULL; + + if(var->fill_value) { + if((stat = nc_copy_data_all(ncid,tid,var->fill_value,1,&dst))) goto done; + } + if(dstp) {*dstp = dst; dst = NULL;} +done: + if(dst) (void)nc_reclaim_data_all(ncid,tid,dst,1); + return stat; +} diff --git a/libnczarr/zvar.c b/libnczarr/zvar.c index b0812d5bec..d4325be8f6 100644 --- a/libnczarr/zvar.c +++ b/libnczarr/zvar.c @@ -436,16 +436,18 @@ var->type_info->rc++; * variables which may be contiguous.) */ LOG((4, "allocating array of %d size_t to hold chunksizes for var %s", var->ndims, var->hdr.name)); - if (var->ndims) { - if (!(var->chunksizes = calloc(var->ndims, sizeof(size_t)))) - BAIL(NC_ENOMEM); - if ((retval = ncz_find_default_chunksizes2(grp, var))) - BAIL(retval); - } else { - /* Pretend that scalars are like var[1] */ - if (!(var->chunksizes = calloc(1, sizeof(size_t)))) - BAIL(NC_ENOMEM); - var->chunksizes[0] = 1; + if(!var->chunksizes) { + if(var->ndims) { + if (!(var->chunksizes = calloc(var->ndims+zvar->scalar, sizeof(size_t)))) + BAIL(NC_ENOMEM); + if ((retval = ncz_find_default_chunksizes2(grp, var))) + BAIL(retval); + } else { + /* Pretend that scalars are like var[1] */ + if (!(var->chunksizes = calloc(1, sizeof(size_t)))) + BAIL(NC_ENOMEM); + var->chunksizes[0] = 1; + } } /* Compute the chunksize cross product */ @@ -510,7 +512,8 @@ static int ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, int *unused2, int *fletcher32, int *storagep, const size_t *chunksizes, int *no_fill, - const void *fill_value, int *endianness) + const void *fill_value, int *endianness, + int *quantize_mode, int *nsd) { NC_GRP_INFO_T *grp; NC_FILE_INFO_T *h5; @@ -522,13 +525,16 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, LOG((2, "%s: ncid 0x%x varid %d", __func__, ncid, varid)); - ZTRACE(2,"ncid=%d varid=%d shuffle=%d fletcher32=%d no_fill=%d, fill_value=%p endianness=%d", + ZTRACE(2,"ncid=%d varid=%d shuffle=%d fletcher32=%d no_fill=%d, fill_value=%p endianness=%d quantize_mode=%d nsd=%d", ncid,varid, (shuffle?*shuffle:-1), (fletcher32?*fletcher32:-1), (no_fill?*no_fill:-1), fill_value, - (endianness?*endianness:-1)); + (endianness?*endianness:-1), + (quantize_mode?*quantize_mode:-1), + (nsd?*nsd:-1) + ); /* Find info for this file and group, and set pointer to each. */ if ((retval = nc4_find_nc_grp_h5(ncid, NULL, &grp, &h5))) @@ -544,6 +550,8 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, {retval = NC_ENOTVAR; goto done;} assert(var && var->hdr.id == varid); + zvar = var->format_var_info; + ZTRACEMORE(1,"\tstoragep=%d chunksizes=%s",(storagep?*storagep:-1),(chunksizes?nczprint_sizevector(var->ndims,chunksizes):"null")); /* Can't turn on parallel and deflate/fletcher32/szip/shuffle @@ -633,7 +641,7 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, {retval = NC_EINVAL; goto done;} } else if (storage == NC_CHUNKED && var->ndims > 0) { var->storage = NC_CHUNKED; - + /* If the user provided chunksizes, check that they are valid * and that their total size of chunk is less than 4 GB. */ if (chunksizes) @@ -661,6 +669,7 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, int anyzero = 0; /* check for any zero length chunksizes */ zvar = var->format_var_info; assert(zvar->cache != NULL); + zvar->cache->valid = 0; if(chunksizes) { for (d = 0; d < var->ndims; d++) { var->chunksizes[d] = chunksizes[d]; @@ -679,6 +688,8 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, zvar->chunkproduct *= var->chunksizes[d]; zvar->chunksize = zvar->chunkproduct * var->type_info->size; } + /* Adjust cache */ + if((retval = NCZ_adjust_var_cache(var))) goto done; #ifdef LOGGING { @@ -722,12 +733,13 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, if ((retval = nc_put_att(ncid, varid, _FillValue, var->type_info->hdr.id, 1, fill_value))) goto done; + /* Reclaim any existing fill_chunk */ + if((retval = NCZ_reclaim_fill_chunk(zvar->cache))) goto done; } else if (var->fill_value && no_fill && (*no_fill)) { /* Turning off fill value? */ /* If there's a _FillValue attribute, delete it. */ retval = NCZ_del_att(ncid, varid, _FillValue); if (retval && retval != NC_ENOTATT) return retval; - if((retval = nc_reclaim_data_all(ncid,var->type_info->hdr.id,var->fill_value,1))) return retval; - var->fill_value = NULL; + if((retval = NCZ_reclaim_fill_value(var))) return retval; } /* Is the user setting the endianness? */ @@ -756,6 +768,46 @@ ncz_def_var_extra(int ncid, int varid, int *shuffle, int *unused1, var->endianness = *endianness; } + /* Remember quantization settings. They will be used when data are + * written. */ + if (quantize_mode) + { + /* Only two valid mode settings. */ + if (*quantize_mode != NC_NOQUANTIZE && + *quantize_mode != NC_QUANTIZE_BITGROOM) + return NC_EINVAL; + + if (*quantize_mode == NC_QUANTIZE_BITGROOM) + { + /* Only float and double types can have quantization. */ + if (var->type_info->hdr.id != NC_FLOAT && + var->type_info->hdr.id != NC_DOUBLE) + return NC_EINVAL; + + /* For bitgroom, number of significant digits is required. */ + if (!nsd) + return NC_EINVAL; + + /* NSD must be in range. */ + if (*nsd <= 0) + return NC_EINVAL; + if (var->type_info->hdr.id == NC_FLOAT && + *nsd > NC_QUANTIZE_MAX_FLOAT_NSD) + return NC_EINVAL; + if (var->type_info->hdr.id == NC_DOUBLE && + *nsd > NC_QUANTIZE_MAX_DOUBLE_NSD) + return NC_EINVAL; + + var->nsd = *nsd; + } + + var->quantize_mode = *quantize_mode; + + /* If quantization is turned off, then set nsd to 0. */ + if (*quantize_mode == NC_NOQUANTIZE) + var->nsd = 0; + } + done: return ZUNTRACE(retval); } @@ -788,7 +840,7 @@ NCZ_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int stat = NC_NOERR; unsigned int level = (unsigned int)deflate_level; /* Set shuffle first */ - if((stat = ncz_def_var_extra(ncid, varid, &shuffle, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))) goto done; + if((stat = ncz_def_var_extra(ncid, varid, &shuffle, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))) goto done; if(deflate) stat = nc_def_var_filter(ncid, varid, H5Z_FILTER_DEFLATE,1,&level); if(stat) goto done; @@ -818,7 +870,7 @@ int NCZ_def_var_fletcher32(int ncid, int varid, int fletcher32) { return ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, &fletcher32, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /** @@ -847,7 +899,7 @@ int NCZ_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp) { return ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, - &contiguous, chunksizesp, NULL, NULL, NULL); + &contiguous, chunksizesp, NULL, NULL, NULL, NULL, NULL); } /** @@ -892,7 +944,7 @@ ncz_def_var_chunking_ints(int ncid, int varid, int contiguous, int *chunksizesp) cs[i] = chunksizesp[i]; retval = ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, - &contiguous, cs, NULL, NULL, NULL); + &contiguous, cs, NULL, NULL, NULL, NULL, NULL); if (var->ndims) free(cs); @@ -926,7 +978,7 @@ int NCZ_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) { return ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, NULL, - NULL, &no_fill, fill_value, NULL); + NULL, &no_fill, fill_value, NULL, NULL, NULL); } /** @@ -955,9 +1007,143 @@ int NCZ_def_var_endian(int ncid, int varid, int endianness) { return ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, &endianness); + NULL, NULL, NULL, &endianness, NULL, NULL); +} + +/** + * @internal Set quantization settings on a variable. This is + * called by nc_def_var_quantize(). + * + * Quantization allows the user to specify a number of significant + * digits for variables of type ::NC_FLOAT or ::NC_DOUBLE. (Attempting + * to set quantize for other types will result in an ::NC_EINVAL + * error.) + * + * When quantize is turned on, and the number of significant digits + * has been specified, then the netCDF library will apply all zeros or + * all ones (alternating) to bits which are not needed to specify the + * value to the number of significant digits. This will change the + * value of the data, but will make it more compressable. + * + * Quantizing the data does not reduce the size of the data on disk, + * but combining quantize with compression will allow for better + * compression. Since the data values are changed, the use of quantize + * and compression such as deflate constitute lossy compression. + * + * Producers of large datasets may find that using quantize with + * compression will result in significant improvent in the final data + * size. + * + * Variables which use quantize will have added an attribute with either the name + * ::NC_QUANTIZE_BITGROOM_ATT_NAME or ::NC_QUANTIZE_GRANULARBR, but in either case + * will contain the number of significant digits. + * Users should not delete or change this + * attribute. This is the only record that quantize has been applied + * to the data. + * + * As with the deflate settings, quantize settings may only be + * modified before the first call to nc_enddef(). Once nc_enddef() is + * called for the file, quantize settings for any variable in the file + * may not be changed. + * + * Use of quantization is fully backwards compatible with existing + * versions and packages that can read compressed netCDF data. A + * variable which has been quantized is readable to older versions of + * the netCDF libraries, and to netCDF-Java. + * + * @param ncid File ID. + * @param varid Variable ID. NC_GLOBAL may not be used. + * @param quantize_mode Quantization mode. May be ::NC_NOQUANTIZE or + * ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBR. + * @param nsd Number of significant digits. May be any integer from 1 + * to ::NC_QUANTIZE_MAX_FLOAT_NSD (for variables of type ::NC_FLOAT) or + * ::NC_QUANTIZE_MAX_DOUBLE_NSD (for variables of type ::NC_DOUBLE). + * + * @returns ::NC_NOERR No error. + * @returns ::NC_EBADID Bad ncid. + * @returns ::NC_ENOTVAR Invalid variable ID. + * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is + * not netCDF-4/HDF5. + * @returns ::NC_ELATEDEF Too late to change settings for this variable. + * @returns ::NC_ENOTINDEFINE Not in define mode. + * @returns ::NC_EINVAL Invalid input + * @author Ed Hartnett, Dennis Heimbigner + */ +int +NCZ_def_var_quantize(int ncid, int varid, int quantize_mode, int nsd) +{ + return ncz_def_var_extra(ncid, varid, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + &quantize_mode, &nsd); } +/** +Ensure that the quantize information for a variable is defined. +Keep a flag in the NCZ_VAR_INFO_T struct to indicate if quantize +info is defined, and if not, read the attribute. +*/ +int +NCZ_ensure_quantizer(int ncid, NC_VAR_INFO_T* var) +{ + int nsd = 0; + + /* Read the attribute */ + if(NCZ_get_att(ncid,var->hdr.id,NC_QUANTIZE_BITGROOM_ATT_NAME,&nsd,NC_INT)==NC_NOERR) { + var->quantize_mode = NC_QUANTIZE_BITGROOM; + var->nsd = nsd; + } else if(NCZ_get_att(ncid,var->hdr.id,NC_QUANTIZE_GRANULARBR_ATT_NAME,&nsd,NC_INT)==NC_NOERR) { + var->quantize_mode = NC_QUANTIZE_GRANULARBR; + var->nsd = nsd; + } else { + var->quantize_mode = NC_NOQUANTIZE; + var->nsd = 0; + } + if(var->quantize_mode < 0) var->quantize_mode = 0; + return NC_NOERR; +} + +/** + * @internal Get quantize information about a variable. Pass NULL for + * whatever you don't care about. Note that this can require reading + * all the attributes for the variable. + * + * @param ncid File ID. + * @param varid Variable ID. + * @param quantize_modep Gets quantize mode. + * @param nsdp Gets Number of Significant Digits if quantize is in use. + * + * @returns ::NC_NOERR No error. + * @returns ::NC_EBADID Bad ncid. + * @returns ::NC_ENOTVAR Bad varid. + * @returns ::NC_EINVAL Invalid input. + * @author Ed Hartnett + */ +int +NCZ_inq_var_quantize(int ncid, int varid, int *quantize_modep, + int *nsdp) +{ + NC_VAR_INFO_T *var; + int retval; + + LOG((2, "%s: ncid 0x%x varid %d", __func__, ncid, varid)); + + /* Find info for this file and group, and set pointer to each. */ + /* Get pointer to the var. */ + if ((retval = nc4_find_grp_h5_var(ncid, varid, NULL, NULL, &var))) + return retval; + if (!var) + return NC_ENOTVAR; + assert(var->hdr.id == varid); + if(var->quantize_mode == -1) + {if((retval = NCZ_ensure_quantizer(ncid, var))) return retval;} + /* Copy the data to the user's data buffers. */ + if (quantize_modep) + *quantize_modep = var->quantize_mode; + if (nsdp) + *nsdp = var->nsd; + return NC_NOERR; + } + /** * @internal Rename a var to "bubba," for example. This is called by * nc_rename_var() for netCDF-4 files. This results in complexities @@ -1319,6 +1505,7 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, size64_t stride[NC_MAX_VAR_DIMS]; int retval, range_error = 0, i, d2; void *bufr = NULL; + int bufrd = 0; /* 1 => we allocated bufr */ int need_to_convert = 0; int zero_count = 0; /* true if a count is zero */ size_t len = 1; @@ -1432,18 +1619,23 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, } #endif - /* Are we going to convert any data? (No converting of user-defined types - except enum). */ - if (mem_nc_type != var->type_info->hdr.id && + /* Are we going to convert any data? (No converting of compound or + * opaque or vlen types.) We also need to call this code if we are doing + * quantization. */ + if ((mem_nc_type != var->type_info->hdr.id && mem_nc_type != NC_COMPOUND && mem_nc_type != NC_OPAQUE && mem_nc_type != NC_VLEN) + || var->quantize_mode > 0) { size_t file_type_size; /* We must convert - allocate a buffer. */ need_to_convert++; - for (d2=0; d2<(var->ndims+zvar->scalar); d2++) + if(zvar->scalar) + len = 1; + else for (d2=0; d2ndims; d2++) len *= countp[d2]; + LOG((4, "converting data for var %s type=%d len=%d", var->hdr.name, var->type_info->hdr.id, len)); @@ -1455,9 +1647,12 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, /* If we're reading, we need bufr to have enough memory to store * the data in the file. If we're writing, we need bufr to be * big enough to hold all the data in the file's type. */ - if (len > 0) + if (len > 0) { + assert(bufr == NULL); if (!(bufr = malloc(len * file_type_size))) BAIL(NC_ENOMEM); + bufrd = 1; + } } else bufr = (void *)data; @@ -1531,6 +1726,8 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, /* Do we need to convert the data? */ if (need_to_convert) { + if(var->quantize_mode < 0) {if((retval = NCZ_ensure_quantizer(ncid,var))) BAIL(retval);} + assert(bufr != NULL); if ((retval = nc4_convert_type(data, bufr, mem_nc_type, var->type_info->hdr.id, len, &range_error, var->fill_value, (h5->cmode & NC_CLASSIC_MODEL), @@ -1573,7 +1770,7 @@ NCZ_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, if (xfer_plistid && (H5Pclose(xfer_plistid) < 0)) BAIL2(NC_EPARINIT); #endif - if (need_to_convert && bufr) free(bufr); + if (bufrd && bufr) free(bufr); /* If there was an error return it, otherwise return any potential range error value. If none, return NC_NOERR as usual.*/ @@ -1627,7 +1824,6 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, size64_t fmaxdims[NC_MAX_VAR_DIMS]; size64_t start[NC_MAX_VAR_DIMS]; size64_t stride[NC_MAX_VAR_DIMS]; - void *fillvalue = NULL; int no_read = 0, provide_fill = 0; int fill_value_size[NC_MAX_VAR_DIMS]; int retval, range_error = 0, i, d2; @@ -1867,8 +2063,8 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, /* Get the fill value from the ZARR variable. Memory will be * allocated. */ - if (ncz_get_fill_value(h5, var, &fillvalue) < 0) - BAIL(NC_EHDFERR); + if (NCZ_ensure_fill_value(var)) + BAIL(NC_EINVAL); /* How many fill values do we need? */ for (fill_len = 1, d2 = 0; d2 < var->ndims; d2++) @@ -1878,9 +2074,9 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, filldata = (char *)data + real_data_size; for (i = 0; i < fill_len; i++) { - /* Copy one instance of the fill_value */ - if((retval = nc_copy_data(ncid,var->type_info->hdr.id,fillvalue,1,filldata))) - BAIL(retval); + /* Copy one instance of the fill_value */ + if((retval = nc_copy_data(ncid,var->type_info->hdr.id,var->fill_value,1,filldata))) + BAIL(retval); filldata = (char *)filldata + file_type_size; } } @@ -1888,6 +2084,7 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, /* Convert data type if needed. */ if (need_to_convert) { + if(var->quantize_mode < 0) {if((retval = NCZ_ensure_quantizer(ncid,var))) BAIL(retval);} if ((retval = nc4_convert_type(bufr, data, var->type_info->hdr.id, mem_nc_type, len, &range_error, var->fill_value, (h5->cmode & NC_CLASSIC_MODEL), var->quantize_mode, @@ -1917,15 +2114,6 @@ NCZ_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, #endif if (need_to_convert && bufr) free(bufr); - if (fillvalue) - { - if (var->type_info->nc_type_class == NC_VLEN) - nc_free_vlen((nc_vlen_t *)fillvalue); - else if (var->type_info->nc_type_class == NC_STRING && *(char **)fillvalue) - free(*(char **)fillvalue); - free(fillvalue); - } - /* If there was an error return it, otherwise return any potential range error value. If none, return NC_NOERR as usual.*/ if (retval) diff --git a/libnczarr/zwalk.c b/libnczarr/zwalk.c index 635925ab36..87f490c592 100644 --- a/libnczarr/zwalk.c +++ b/libnczarr/zwalk.c @@ -19,7 +19,7 @@ static unsigned int optimize = 0; extern int NCZ_buildchunkkey(size_t R, const size64_t* chunkindices, char** keyp); /* 0 => no debug */ -static unsigned int wdebug = 0; +static unsigned int wdebug = 1; /* Forward */ static int NCZ_walk(NCZProjection** projv, NCZOdometer* chunkodom, NCZOdometer* slpodom, NCZOdometer* memodom, const struct Common* common, void* chunkdata); @@ -123,7 +123,7 @@ NCZ_transferslice(NC_VAR_INFO_T* var, int reading, common.cache = zvar->cache; /* We need to talk scalar into account */ - common.rank = var->ndims + zvar->scalar; + common.rank = var->ndims; common.scalar = zvar->scalar; common.swap = (zfile->native_endianness == var->endianness ? 0 : 1); @@ -157,9 +157,6 @@ NCZ_transferslice(NC_VAR_INFO_T* var, int reading, common.reader.source = ((NCZ_VAR_INFO_T*)(var->format_var_info))->cache; common.reader.read = readfromcache; - /* verify */ - assert(var->no_fill || var->fill_value != NULL); - if(common.scalar) { if((stat = NCZ_transferscalar(&common))) goto done; } diff --git a/libnczarr/zxcache.c b/libnczarr/zxcache.c index f5cbd6c24f..52a8c7d351 100644 --- a/libnczarr/zxcache.c +++ b/libnczarr/zxcache.c @@ -105,13 +105,20 @@ NCZ_adjust_var_cache(NC_VAR_INFO_T *var) { int stat = NC_NOERR; NCZ_VAR_INFO_T* zvar = (NCZ_VAR_INFO_T*)var->format_var_info; - /* completely empty the cache */ - flushcache(zvar->cache); + NCZChunkCache* zcache = NULL; + + zcache = zvar->cache; + if(zcache->valid) goto done; #ifdef DEBUG fprintf(stderr,"xxx: adjusting cache for: %s\n",var->hdr.name); #endif + /* completely empty the cache */ + flushcache(zcache); + + /* Reclaim any existing fill_chunk */ + if((stat = NCZ_reclaim_fill_chunk(zcache))) goto done; /* Reset the parameters */ zvar->cache->maxsize = var->chunk_cache_size; zvar->cache->maxentries = var->chunk_cache_nelems; @@ -119,22 +126,21 @@ fprintf(stderr,"xxx: adjusting cache for: %s\n",var->hdr.name); fprintf(stderr,"%s.cache.adjust: size=%ld nelems=%ld\n", var->hdr.name,(unsigned long)zvar->cache->maxsize,(unsigned long)zvar->cache->maxentries); #endif - /* One more thing, adjust the chunksize */ - zvar->cache->chunksize = zvar->chunksize; - /* and also rebuild the fillchunk */ - nullfree(zvar->cache->fillchunk); - zvar->cache->fillchunk = NULL; - if(var->no_fill) - stat = NCZ_create_fill_chunk(zvar->cache->chunksize,var->type_info->size,NULL,&zvar->cache->fillchunk); - else { - assert(var->fill_value != NULL); - stat = NCZ_create_fill_chunk(zvar->cache->chunksize,var->type_info->size,var->fill_value,&zvar->cache->fillchunk); + /* One more thing, adjust the chunksize and count*/ + zcache->chunksize = zvar->chunksize; + zcache->chunkcount = 1; + if(var->ndims > 0) { + int i; + for(i=0;indims;i++) { + zcache->chunkcount *= var->chunksizes[i]; + } } + zcache->valid = 1; +done: return stat; } /**************************************************/ - /** * Create a chunk cache object * @@ -162,12 +168,19 @@ NCZ_create_chunk_cache(NC_VAR_INFO_T* var, size64_t chunksize, char dimsep, NCZC {stat = NC_ENOMEM; goto done;} cache->var = var; cache->ndims = var->ndims + zvar->scalar; - assert(cache->fillchunk == NULL); cache->fillchunk = NULL; cache->chunksize = chunksize; cache->dimension_separator = dimsep; zvar->cache = cache; + cache->chunkcount = 1; + if(var->ndims > 0) { + int i; + for(i=0;indims;i++) { + cache->chunkcount *= var->chunksizes[i]; + } + } + #ifdef FLUSH cache->maxentries = 1; #endif @@ -180,6 +193,7 @@ NCZ_create_chunk_cache(NC_VAR_INFO_T* var, size64_t chunksize, char dimsep, NCZC if((cache->mru = nclistnew()) == NULL) {stat = NC_ENOMEM; goto done;} nclistsetalloc(cache->mru,cache->maxentries); + if(cachep) {*cachep = cache; cache = NULL;} done: nullfree(fill); @@ -219,7 +233,7 @@ fprintf(stderr,"|cache.free|=%ld\n",nclistlength(cache->mru)); ncxcachefree(cache->xcache); nclistfree(cache->mru); cache->mru = NULL; - nullfree(cache->fillchunk); + (void)NCZ_reclaim_fill_chunk(cache); nullfree(cache); (void)ZUNTRACE(NC_NOERR); } @@ -271,13 +285,14 @@ NCZ_read_cache_chunk(NCZChunkCache* cache, const size64_t* indices, void** datap /* Create the key for this cache */ if((stat = NCZ_buildchunkpath(cache,indices,&entry->key))) goto done; entry->hashkey = hkey; - /* Try to read the object from "disk" */ + assert(entry->data == NULL && entry->size == 0); + /* Try to read the object from "disk"; might change size; will create if non-existent */ if((stat=get_chunk(cache,entry))) goto done; + assert(entry->data != NULL); + /* Ensure cache constraints not violated; but do it before entry is added */ + if((stat=makeroom(cache))) goto done; nclistpush(cache->mru,entry); - cache->used += entry->size; if((stat = ncxcacheinsert(cache->xcache,entry->hashkey,entry))) goto done; - /* Ensure cache constraints not violated */ - if((stat=makeroom(cache))) goto done; } #ifdef DEBUG @@ -360,6 +375,7 @@ flushcache(NCZChunkCache* cache) /* Remove entries to ensure cache is not violating any of its constraints. On entry, constraints might be violated. + Make sure that the entryinuse (NULL => no constraint) is not reclaimed. */ static int @@ -367,25 +383,28 @@ constraincache(NCZChunkCache* cache) { int stat = NC_NOERR; + /* If the cache is empty then do nothing */ + if(cache->used == 0) goto done; + /* Flush from LRU end if we are at capacity */ while(nclistlength(cache->mru) > cache->maxentries || cache->used > cache->maxsize) { int i; void* ptr; NCZCacheEntry* e = ncxcachelast(cache->xcache); /* last entry is the least recently used */ if((stat = ncxcacheremove(cache->xcache,e->hashkey,&ptr))) goto done; - assert(e == ptr); + assert(e == ptr); for(i=0;imru);i++) { e = nclistget(cache->mru,i); if(ptr == e) break; } - assert(e != NULL); + assert(e != NULL); assert(i >= 0 && i < nclistlength(cache->mru)); nclistremove(cache->mru,i); + assert(cache->used >= e->size); + /* Note that |old chunk data| may not be same as |new chunk data| because of filters */ + cache->used -= e->size; /* old size */ if(e->modified) /* flush to file */ stat=put_chunk(cache,e); - /* Decrement space used */ - assert(cache->used >= e->size); - cache->used -= e->size; /* reclaim */ nullfree(e->data); nullfree(e->key.varkey); nullfree(e->key.chunkkey); nullfree(e); } @@ -410,9 +429,12 @@ NCZ_flush_chunk_cache(NCZChunkCache* cache) for(i=0;imru);i++) { NCZCacheEntry* entry = nclistget(cache->mru,i); if(entry->modified) { + /* Make cache used be consistent across filter application */ + cache->used -= entry->size; /* Write out this chunk in toto*/ if((stat=put_chunk(cache,entry))) goto done; + cache->used += entry->size; } entry->modified = 0; } @@ -421,6 +443,69 @@ NCZ_flush_chunk_cache(NCZChunkCache* cache) return ZUNTRACE(stat); } +/* Ensure existence of some kind of fill chunk */ +int +NCZ_ensure_fill_chunk(NCZChunkCache* cache) +{ + int i, stat = NC_NOERR; + NC_VAR_INFO_T* var = cache->var; + size_t typesize = var->type_info->size; + + if(cache->fillchunk) goto done; + + if((cache->fillchunk = malloc(cache->chunksize))==NULL) + {stat = NC_ENOMEM; goto done;} + if(var->no_fill) { + /* use zeros */ + memset(cache->fillchunk,0,cache->chunksize); + goto done; + } + if((stat = NCZ_ensure_fill_value(var))) goto done; + switch (typesize) { + case 1: { + unsigned char c = *((unsigned char*)var->fill_value); + memset(cache->fillchunk,c,cache->chunksize); + } break; + case 2: { + unsigned short fv = *((unsigned short*)var->fill_value); + unsigned short* p2 = (unsigned short*)cache->fillchunk; + for(i=0;ichunksize;i+=typesize) *p2++ = fv; + } break; + case 4: { + unsigned int fv = *((unsigned int*)var->fill_value); + unsigned int* p4 = (unsigned int*)cache->fillchunk; + for(i=0;ichunksize;i+=typesize) *p4++ = fv; + } break; + case 8: { + unsigned long long fv = *((unsigned long long*)var->fill_value); + unsigned long long* p8 = (unsigned long long*)cache->fillchunk; + for(i=0;ichunksize;i+=typesize) *p8++ = fv; + } break; + default: { + unsigned char* p; + for(p=cache->fillchunk,i=0;ichunksize;i+=typesize,p+=typesize) + memcpy(p,var->fill_value,typesize); + } break; + } +done: + return NC_NOERR; +} + +int +NCZ_reclaim_fill_chunk(NCZChunkCache* zcache) +{ + int stat = NC_NOERR; + if(zcache && zcache->fillchunk) { + NC_VAR_INFO_T* var = zcache->var; + int ncid = var->container->nc4_info->controller->ext_ncid; + int tid = var->type_info->hdr.id; + size_t chunkcount = zcache->chunkcount; + stat = nc_reclaim_data_all(ncid,tid,zcache->fillchunk,chunkcount); + zcache->fillchunk = NULL; + } + return stat; +} + #if 0 int NCZ_chunk_cache_modified(NCZChunkCache* cache, const size64_t* indices) @@ -529,7 +614,7 @@ put_chunk(NCZChunkCache* cache, NCZCacheEntry* entry) /* Get the filter chain to apply */ NClist* filterchain = (NClist*)var->filters; if(nclistlength(filterchain) > 0) { - /* Apply the filter chain to get the filtered data */ + /* Apply the filter chain to get the filtered data; will reclaim entry->data */ if((stat = NCZ_applyfilterchain(file,var,filterchain,entry->size,entry->data,&flen,&filtered,ENCODING))) goto done; /* Fix up the cache entry */ /* Note that if filtered is different from entry->data, then entry->data will have been freed */ @@ -618,7 +703,8 @@ get_chunk(NCZChunkCache* cache, NCZCacheEntry* entry) if((entry->data = (void*)malloc(entry->size)) == NULL) {stat = NC_ENOMEM; goto done;} /* apply fill value */ - assert(cache->fillchunk); + if(cache->fillchunk == NULL) + {if((stat = NCZ_ensure_fill_chunk(cache))) goto done;} memcpy(entry->data,cache->fillchunk,entry->size); entry->isfiltered = 0; stat = NC_NOERR; @@ -669,3 +755,76 @@ NCZ_buildchunkpath(NCZChunkCache* cache, const size64_t* chunkindices, struct Ch nullfree(varkey); return THROW(stat); } + +void +NCZ_dumpxcacheentry(NCZChunkCache* cache, NCZCacheEntry* e, NCbytes* buf) +{ + char s[8192]; + char idx[64]; + int i; + + ncbytescat(buf,"{"); + snprintf(s,sizeof(s),"modified=%u isfiltered=%u indices=", + (unsigned)e->modified, + (unsigned)e->isfiltered + ); + ncbytescat(buf,s); + for(i=0;indims;i++) { + snprintf(idx,sizeof(idx),"%s%llu",(i==0?"":"."),e->indices[i]); + ncbytescat(buf,idx); + } + snprintf(s,sizeof(s),"size=%llu data=%p", + e->size, + e->data + ); + ncbytescat(buf,s); + ncbytescat(buf,"}"); +} + +void +NCZ_printxcache(NCZChunkCache* cache) +{ + static char xs[20000]; + NCbytes* buf = ncbytesnew(); + char s[8192]; + int i; + + ncbytescat(buf,"NCZChunkCache:\n"); + snprintf(s,sizeof(s),"\tvar=%s\n\tndims=%u\n\tchunksize=%u\n\tchunkcount=%u\n\tfillchunk=%p\n", + cache->var->hdr.name, + (unsigned)cache->ndims, + (unsigned)cache->chunksize, + (unsigned)cache->chunkcount, + cache->fillchunk + ); + ncbytescat(buf,s); + + snprintf(s,sizeof(s),"\tmaxentries=%u\n\tmaxsize=%u\n\tused=%u\n\tdimsep='%c'\n", + (unsigned)cache->maxentries, + (unsigned)cache->maxsize, + (unsigned)cache->used, + cache->dimension_separator + ); + ncbytescat(buf,s); + + snprintf(s,sizeof(s),"\tmru: (%u)\n",(unsigned)nclistlength(cache->mru)); + ncbytescat(buf,s); + if(nclistlength(cache->mru)==0) + ncbytescat(buf,"\t\t\n"); + for(i=0;imru);i++) { + NCZCacheEntry* e = (NCZCacheEntry*)nclistget(cache->mru,i); + snprintf(s,sizeof(s),"\t\t[%d] ",i); + ncbytescat(buf,s); + if(e == NULL) + ncbytescat(buf,""); + else + NCZ_dumpxcacheentry(cache, e, buf); + ncbytescat(buf,"\n"); + } + + xs[0] = '\0'; + strlcat(xs,ncbytescontents(buf),sizeof(xs)); + ncbytesfree(buf); + fprintf(stderr,"%s\n",xs); +// return xs; +} diff --git a/libsrc/ncio.c b/libsrc/ncio.c index 133eddad40..24bb92da10 100644 --- a/libsrc/ncio.c +++ b/libsrc/ncio.c @@ -185,11 +185,10 @@ urlmodetest(const char* path) ncuriparse(path,&uri); if(uri == NULL) return 0; /* Not URL */ - if(NC_testmode(uri, "bytes")) - kind = NC_HTTP; - else if(NC_testmode(uri, "s3")) - kind = NC_S3SDK; - else + if(NC_testmode(uri, "bytes")) { + /* NC_S3SDK takes priority over NC_HTTP */ + if(NC_testmode(uri, "s3")) kind = NC_S3SDK; else kind = NC_HTTP; + } else kind = 0; ncurifree(uri); return kind; diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c index 935f1500e2..c4377c3aa9 100644 --- a/libsrc4/nc4internal.c +++ b/libsrc4/nc4internal.c @@ -1358,8 +1358,12 @@ var_free(NC_VAR_INFO_T *var) free(var->dim); /* Delete any fill value allocation. */ - if (var->fill_value) - {free(var->fill_value); var->fill_value = NULL;} + if (var->fill_value) { + int ncid = var->container->nc4_info->controller->ext_ncid; + int tid = var->type_info->hdr.id; + if((retval = nc_reclaim_data_all(ncid, tid, var->fill_value, 1))) return retval; + var->fill_value = NULL; + } /* Release type information */ if (var->type_info) diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c index e69d092c43..c6c2410594 100644 --- a/libsrc4/nc4var.c +++ b/libsrc4/nc4var.c @@ -511,10 +511,10 @@ NC4_var_par_access(int ncid, int varid, int par_access) * @param fill_value The fill value. * @param strict_nc3 Non-zero if strict model in effect. * @param quantize_mode May be ::NC_NOQUANTIZE or - * ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBG. + * ::NC_QUANTIZE_BITGROOM or ::NC_QUANTIZE_GRANULARBR. * @param nsd Number of significant diggits for quantizize. Ignored * unless quantize_mode is ::NC_QUANTIZE_BITGROOM or - * ::NC_QUANTIZE_GRANULARBG. + * ::NC_QUANTIZE_GRANULARBR. * * @returns ::NC_NOERR No error. * @returns ::NC_EBADTYPE Type not found. @@ -574,7 +574,7 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type, { assert(dest_type == NC_FLOAT || dest_type == NC_DOUBLE); - /* Parameters shared by both BitGroom and GranularBG */ + /* Parameters shared by both BitGroom and GranularBR */ if (dest_type == NC_FLOAT) { /* Determine the fill value. */ @@ -1433,11 +1433,11 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type, } } /* endif BitGroom */ - if (quantize_mode == NC_QUANTIZE_GRANULARBG) + if (quantize_mode == NC_QUANTIZE_GRANULARBR) { if (dest_type == NC_FLOAT) { - /* Granular BitGroom */ + /* Granular BitRound */ op1.fp = (float *)dest; u32_ptr = op1.ui32p; for (idx = 0L; idx < len; idx++) @@ -1471,7 +1471,7 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type, } else { - /* Granular BitGroom */ + /* Granular BitRound */ op1.dp = (double *)dest; u64_ptr = op1.ui64p; for (idx = 0L; idx < len; idx++) @@ -1503,7 +1503,7 @@ nc4_convert_type(const void *src, void *dest, const nc_type src_type, } } - } /* endif GranularBG */ + } /* endif GranularBR */ return NC_NOERR; } diff --git a/nc_test/test_byterange.sh b/nc_test/test_byterange.sh index 83d121536f..28b5e6374d 100755 --- a/nc_test/test_byterange.sh +++ b/nc_test/test_byterange.sh @@ -7,13 +7,13 @@ set -e # Test Urls URL3="https://thredds-test.unidata.ucar.edu/thredds/fileServer/pointData/cf_dsg/example/point.nc#mode=bytes&aws.profile=none" -#URL3="https://remotetest.unidata.ucar.edu/thredds/fileServer/testdata/2004050300_eta_211.nc#bytes&aws.profile=none" +#URL3a="https://remotetest.unidata.ucar.edu/thredds/fileServer/testdata/2004050300_eta_211.nc#bytes&aws.profile=none" URL4a="https://s3.us-east-1.amazonaws.com/noaa-goes16/ABI-L1b-RadC/2017/059/03/OR_ABI-L1b-RadC-M3C13_G16_s20170590337505_e20170590340289_c20170590340316.nc#mode=bytes&aws.profile=none" URL4b="https://thredds-test.unidata.ucar.edu/thredds/fileServer/irma/metar/files/METAR_20170910_0000.nc#bytes&aws.profile=none" URL4c="s3://noaa-goes16/ABI-L1b-RadC/2017/059/03/OR_ABI-L1b-RadC-M3C13_G16_s20170590337505_e20170590340289_c20170590340316.nc#mode=bytes&aws.profile=none" # Requires auth -URL4d="s3://unidata-zarr-test-data/byterangefiles/upload3.nc#bytes&aws.profile=unidata" -URL4e="s3://unidata-zarr-test-data/byterangefiles/upload4.nc#bytes&aws.profile=unidata" +URL3b="s3://unidata-zarr-test-data/byterangefiles/upload3.nc#bytes&aws.profile=unidata" +URL4d="s3://unidata-zarr-test-data/byterangefiles/upload4.nc#bytes&aws.profile=unidata" # Do not use unless we know it has some permanence (note the segment 'testing' in the URL); URL4x="https://s3.us-west-2.amazonaws.com/coawst-public/testing/HadCRUT.4.6.0.0.median.nc#mode=bytes,&aws.profile=none" @@ -94,11 +94,11 @@ if test "x$FEATURE_S3TESTS" = xyes && test "x$FEATURE_HDF5" = xyes ; then echo "***Test remote netcdf-4 file: s3" testbytes nc4c netCDF-4 "$URL4c" echo "***Test remote netcdf-4 file: s3 auth" - tests3auth nc4e netCDF-4 "$URL4e" + tests3auth nc4d netCDF-4 "$URL4d" fi if test "x$FEATURE_S3TESTS" = xyes ; then echo "***Test remote netcdf-3 file: s3 auth" - tests3auth nc4d classic "$URL4d" + tests3auth nc3b classic "$URL3b" fi # Cleanup diff --git a/nc_test4/findplugin.in b/nc_test4/findplugin.in index f1623e73aa..fb30686307 100644 --- a/nc_test4/findplugin.in +++ b/nc_test4/findplugin.in @@ -23,7 +23,6 @@ # variables: see hdf5plugins/CMakeLists.txt findplugin() { -set -x FP_NAME="$1" diff --git a/nc_test4/tst_quantize.c b/nc_test4/tst_quantize.c index df31c17966..4abea412a6 100644 --- a/nc_test4/tst_quantize.c +++ b/nc_test4/tst_quantize.c @@ -7,6 +7,7 @@ precision. Ed Hartnett, 8/19/21 + Dennis Heimbigner, 1/16/22 */ #include @@ -72,12 +73,28 @@ pd(double myd) int main(int argc, char **argv) { +#ifdef TESTNCZARR + const char* template = NULL; + char file_url[4096]; + + if(argc == 1) + {fprintf(stderr,"usage: test_quantize \n"); exit(1);} + + template = argv[1]; + + snprintf(file_url,sizeof(file_url),template,FILE_NAME); + +#undef FILE_NAME +#define FILE_NAME file_url +#endif + printf("\n*** Testing netcdf-4 variable quantization functions.\n"); printf("**** testing quantization setting and error conditions..."); { int ncid, dimid, varid1, varid2; int quantize_mode_in, nsd_in; +#ifndef TESTNCZARR /* Create a netcdf classic file with one var. Attempt * quantization. It will not work. */ if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR; @@ -86,6 +103,7 @@ main(int argc, char **argv) if (nc_def_var_quantize(ncid, varid1, NC_QUANTIZE_BITGROOM, NSD_3) != NC_ENOTNC4) ERR; if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in) != NC_ENOTNC4) ERR; if (nc_close(ncid)) ERR; +#endif /* Create a netcdf-4 file with two vars. Attempt * quantization. It will work, eventually... */ @@ -98,10 +116,10 @@ main(int argc, char **argv) if (nc_def_var_quantize(ncid, NC_GLOBAL, NC_QUANTIZE_BITGROOM, NSD_3) != NC_EGLOBAL) ERR; if (nc_def_var_quantize(ncid, varid2 + 1, NC_QUANTIZE_BITGROOM, NSD_3) != NC_ENOTVAR) ERR; /* Invalid values. */ - if (nc_def_var_quantize(ncid, varid1, NC_QUANTIZE_GRANULARBG + 1, NSD_3) != NC_EINVAL) ERR; + if (nc_def_var_quantize(ncid, varid1, NC_QUANTIZE_GRANULARBR + 1, NSD_3) != NC_EINVAL) ERR; if (nc_def_var_quantize(ncid, varid1, NC_QUANTIZE_BITGROOM, -1) != NC_EINVAL) ERR; if (nc_def_var_quantize(ncid, varid1, NC_QUANTIZE_BITGROOM, NC_QUANTIZE_MAX_FLOAT_NSD + 1) != NC_EINVAL) ERR; - if (nc_def_var_quantize(ncid, varid2, NC_QUANTIZE_GRANULARBG + 1, 3) != NC_EINVAL) ERR; + if (nc_def_var_quantize(ncid, varid2, NC_QUANTIZE_GRANULARBR + 1, 3) != NC_EINVAL) ERR; if (nc_def_var_quantize(ncid, varid2, NC_QUANTIZE_BITGROOM, -1) != NC_EINVAL) ERR; if (nc_def_var_quantize(ncid, varid2, NC_QUANTIZE_BITGROOM, NC_QUANTIZE_MAX_DOUBLE_NSD + 1) != NC_EINVAL) ERR; if (nc_def_var_quantize(ncid, varid2, NC_QUANTIZE_BITGROOM, 0) != NC_EINVAL) ERR; @@ -147,10 +165,13 @@ main(int argc, char **argv) /* Open the file and check. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + /* Don't assume the varid !!! */ + if (nc_inq_varid(ncid, VAR_NAME_1, &varid1)) ERR; + if (nc_inq_varid(ncid, VAR_NAME_2, &varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM) ERR; if (nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM) ERR; if (nsd_in != NSD_9) ERR; if (nc_close(ncid)) ERR; @@ -172,7 +193,11 @@ main(int argc, char **argv) int varid; int nsd_in, quantize_mode; int nsd_out = 3; +#ifdef TESTNCZARR + char file_name[4096]; +#else char file_name[NC_MAX_NAME + 1]; +#endif int xtype[NTYPES] = {NC_CHAR, NC_SHORT, NC_INT, NC_BYTE, NC_UBYTE, NC_USHORT, NC_UINT, NC_INT64, NC_UINT64}; int t; @@ -180,7 +205,14 @@ main(int argc, char **argv) for (t = 0; t < NTYPES; t++) { sprintf(file_name, "%s_bitgroom_type_%d.nc", TEST, xtype[t]); - +#ifdef TESTNCZARR + { + char url[4096]; + snprintf(url,sizeof(url),template,file_name); + strcpy(file_name,url); +fprintf(stderr,"\n>>> type url = |%s|\n",file_name); + } +#endif /* Create file. */ if (nc_create(file_name, NC_NETCDF4, &ncid)) ERR; if (nc_def_dim(ncid, X_NAME, NX_BIG, &dimid[0])) ERR; @@ -195,6 +227,7 @@ main(int argc, char **argv) /* Check file. */ { if (nc_open(file_name, NC_NETCDF4, &ncid)) ERR; + if (nc_inq_varid(ncid,VAR_NAME,&varid)) ERR; if (nc_inq_var_quantize(ncid, varid, &quantize_mode, &nsd_in)) ERR; if (quantize_mode) ERR; if (nc_close(ncid)) ERR; @@ -236,9 +269,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid, VAR_NAME_1, &varid1)) ERR; + if (nc_inq_varid(ncid, VAR_NAME_2, &varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Each var now has an attribute describing the quantize settings. */ @@ -300,9 +335,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_1,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Check the data. */ @@ -376,9 +413,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_1,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Check the data. */ @@ -441,9 +480,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_1,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Each var now has an attribute describing the quantize settings. */ @@ -523,9 +564,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_1,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Check the data. */ @@ -603,9 +646,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_1,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Check the data. */ @@ -689,9 +734,11 @@ main(int argc, char **argv) /* Open the file and check metadata. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; - if (nc_inq_var_quantize(ncid, 0, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_1,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; + if (nc_inq_var_quantize(ncid, varid1, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; - if (nc_inq_var_quantize(ncid, 1, &quantize_mode_in, &nsd_in)) ERR; + if (nc_inq_var_quantize(ncid, varid2, &quantize_mode_in, &nsd_in)) ERR; if (quantize_mode_in != NC_QUANTIZE_BITGROOM || nsd_in != NSD_3) ERR; /* Check the data. */ @@ -782,6 +829,8 @@ main(int argc, char **argv) /* Now reopen the file and check. */ if (nc_open(FILE_NAME, NC_NETCDF4, &ncid)) ERR; + if (nc_inq_varid(ncid,VAR_NAME,&varid1)) ERR; + if (nc_inq_varid(ncid,VAR_NAME_2,&varid2)) ERR; /* Read the data. */ if (nc_get_var_float(ncid, varid1, float_data_in)) ERR; @@ -875,13 +924,16 @@ main(int argc, char **argv) if (nc_def_var_quantize(ncid, varid1, NC_QUANTIZE_BITGROOM, NSD_3)) ERR; if (nc_def_var_quantize(ncid, varid2, NC_QUANTIZE_BITGROOM, NSD_3)) ERR; +#ifdef TESTNCZARR +#ifdef ENABLE_NCZARR_FILTERS /* Set up zlib compression. This will work better because the * data are quantized, yielding a smaller output file. We will * set compression level to 1, which is usually the best * choice. */ if (nc_def_var_deflate(ncid, varid1, 0, 1, 1)) ERR; if (nc_def_var_deflate(ncid, varid2, 0, 1, 1)) ERR; - +#endif +#endif /* Write the data. */ if (nc_put_var_float(ncid, varid1, float_data)) ERR; if (nc_put_var_double(ncid, varid2, double_data)) ERR; @@ -896,6 +948,8 @@ main(int argc, char **argv) /* Now reopen the file and check. */ if (nc_open(FILE_NAME, NC_NETCDF4, &ncid)) ERR; + if (nc_inq_varid(ncid,"var1",&varid1)) ERR; + if (nc_inq_varid(ncid,"var2",&varid2)) ERR; /* Read the data. */ if (nc_get_var_float(ncid, varid1, float_data_in)) ERR; diff --git a/nc_test4/tst_vlenstr.c b/nc_test4/tst_vlenstr.c index 2024e30d3b..ca5c715856 100644 --- a/nc_test4/tst_vlenstr.c +++ b/nc_test4/tst_vlenstr.c @@ -3,7 +3,7 @@ #include #include "netcdf.h" -#define DEBUG +#undef DEBUG #ifdef DEBUG static char* buf = NULL; @@ -123,7 +123,7 @@ writeAttribute(int len, int ncid, nc_type vlen_typeID) stringIndex += sixth_size; #ifdef DEBUG - if(buf) free(buf); buf = NULL; + if(buf) {free(buf); buf = NULL;} nc_dump_data(ncid,vlen_typeID,data,len,&buf); fprintf(stderr,">>> attribute = %s\n",buf); #endif diff --git a/ncdump/tst_dimsizes.sh b/ncdump/tst_dimsizes.sh index e08faba862..175e60ff48 100755 --- a/ncdump/tst_dimsizes.sh +++ b/ncdump/tst_dimsizes.sh @@ -1,6 +1,6 @@ #!/bin/sh -#set -e +set -e if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh diff --git a/ncgen/genbin.c b/ncgen/genbin.c index 9c60e1dcee..a126116294 100644 --- a/ncgen/genbin.c +++ b/ncgen/genbin.c @@ -257,11 +257,15 @@ genbin_definespecialattributes(Symbol* var) } CHECK_ERR(stat); } + if(special->flags & (_QUANTIZEBG_FLAG | _QUANTIZEBR_FLAG)) { + stat = nc_def_var_quantize(var->container->nc_id, + var->nc_id, special->_Quantizer, special->_NSD); + CHECK_ERR(stat); + } return stat; } #endif /*USE_NETCDF4*/ - void genbin_close(void) { diff --git a/ncgen/genc.c b/ncgen/genc.c index b3b0c414b8..a99ba4c2ed 100644 --- a/ncgen/genc.c +++ b/ncgen/genc.c @@ -539,6 +539,22 @@ genc_definespecialattributes(Symbol* vsym) codelined(1,"CHECK_ERR(stat);"); } } + if(special->flags & (_QUANTIZEBG_FLAG | _QUANTIZEBR_FLAG)) { + const char* alg = NULL; + switch(special->_Quantizer) { + case NC_QUANTIZE_BITGROOM: alg = "NC_QUANTIZE_BITGROOM"; + case NC_QUANTIZE_GRANULARBR: alg = "NC_QUANTIZE_GRANULARBR"; + default: alg = "NC_NOQUANTIZE"; + } + bbprintf0(stmt, + " stat = nc_def_var_quantize(%s, %s, %s, %d);\n", + groupncid(vsym->container), + varncid(vsym), + alg, special->_NSD + ); + codedump(stmt); + codelined(1,"CHECK_ERR(stat);"); + } } #endif /*USE_NETCDF4*/ diff --git a/ncgen/ncgen.h b/ncgen/ncgen.h index 1e67d0232a..e2136ab5d1 100644 --- a/ncgen/ncgen.h +++ b/ncgen/ncgen.h @@ -80,6 +80,8 @@ various C global variables #define _FORMAT_FLAG 0x800 #define _FILTER_FLAG 0x1000 #define _CODECS_FLAG 0x2000 +#define _QUANTIZEBG_FLAG 0x4000 +#define _QUANTIZEBR_FLAG 0x8000 extern struct Specialtoken { char* name; @@ -122,6 +124,8 @@ typedef struct Specialdata { int _Shuffle; /* 0 => false, 1 => true*/ int _Endianness; /* 1 =>little, 2 => big*/ int _Fill ; /* 0 => false, 1 => true WATCHOUT: this is inverse of NOFILL*/ + int _Quantizer; /* algorithm */ + int _NSD; /* No. of significant digits */ NC_H5_Filterspec** _Filters; size_t nfilters; /* |filters| */ char* _Codecs; /* in JSON form */ diff --git a/ncgen/ncgen.l b/ncgen/ncgen.l index d382d8154d..576d65d62a 100644 --- a/ncgen/ncgen.l +++ b/ncgen/ncgen.l @@ -138,6 +138,8 @@ struct Specialtoken specials[] = { {"_SuperblockVersion",_SUPERBLOCK,_SUPERBLOCK_FLAG}, {"_Filter",_FILTER,_FILTER_FLAG}, {"_Codecs",_CODECS,_CODECS_FLAG}, +{"_QuantizeBitGroomNumberOfSignificantDigits",_QUANTIZEBG,_QUANTIZEBG_FLAG}, +{"_QuantizeBitRoundNumberOfSignificantDigits",_QUANTIZEBR,_QUANTIZEBR_FLAG}, {NULL,0} /* null terminate */ }; @@ -216,7 +218,7 @@ NUMBER [+-]?[0-9][0-9]*[Uu]?([BbSs]|[Ll]|[Ll][Ll])? DBLNUMBER [+-]?[0-9]*\.[0-9]*{exp}?[LlDd]?|[+-]?[0-9]*{exp}[LlDd]? FLTNUMBER [+-]?[0-9]*\.[0-9]*{exp}?[Ff]|[+-]?[0-9]*{exp}[Ff] -SPECIAL "_FillValue"|"_Format"|"_Storage"|"_ChunkSizes"|"_Fletcher32"|"_DeflateLevel"|"_Shuffle"|"_Endianness"|"_NoFill"|"_NCProperties"|"_IsNetcdf4"|"_SuperblockVersion"|"_Filter"|"_Codecs" +SPECIAL "_FillValue"|"_Format"|"_Storage"|"_ChunkSizes"|"_Fletcher32"|"_DeflateLevel"|"_Shuffle"|"_Endianness"|"_NoFill"|"_NCProperties"|"_IsNetcdf4"|"_SuperblockVersion"|"_Filter"|"_Codecs"|"_QuantizeBitgroomNumberOfSignificantDIgits"|"_QuantizeGranularBitRoundNumberOfSignificantDigits" USASCII [\x01-\x7F] diff --git a/ncgen/ncgen.y b/ncgen/ncgen.y index b0951fbe45..215e8f6ad7 100644 --- a/ncgen/ncgen.y +++ b/ncgen/ncgen.y @@ -216,6 +216,8 @@ NCConstant* constant; _SUPERBLOCK _FILTER _CODECS + _QUANTIZEBG + _QUANTIZEBR DATASETID %type ident typename primtype dimd varspec @@ -772,6 +774,10 @@ attrdecl: {$$ = makespecial(_FILTER_FLAG,$1,NULL,(void*)$5,ISCONST);} | ambiguous_ref ':' _CODECS '=' conststring {$$ = makespecial(_CODECS_FLAG,$1,NULL,(void*)$5,ISCONST);} + | ambiguous_ref ':' _QUANTIZEBG '=' constint + {$$ = makespecial(_QUANTIZEBG_FLAG,$1,NULL,(void*)$5,ISCONST);} + | ambiguous_ref ':' _QUANTIZEBR '=' constint + {$$ = makespecial(_QUANTIZEBR_FLAG,$1,NULL,(void*)$5,ISCONST);} | ambiguous_ref ':' _NOFILL '=' constbool {$$ = makespecial(_NOFILL_FLAG,$1,NULL,(void*)$5,ISCONST);} | ':' _FORMAT '=' conststring @@ -1240,6 +1246,8 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) break; case _SUPERBLOCK_FLAG: case _DEFLATE_FLAG: + case _QUANTIZEBG_FLAG: + case _QUANTIZEBR_FLAG: tmp = nullconst(); tmp->nctype = NC_INT; convert1(con,tmp); @@ -1336,6 +1344,16 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) special->_DeflateLevel = idata; special->flags |= _DEFLATE_FLAG; break; + case _QUANTIZEBG_FLAG: + special->_Quantizer = NC_QUANTIZE_BITGROOM; + special->_NSD = idata; + special->flags |= _QUANTIZEBG_FLAG; + break; + case _QUANTIZEBR_FLAG: + special->_Quantizer = NC_QUANTIZE_GRANULARBR; + special->_NSD = idata; + special->flags |= _QUANTIZEBR_FLAG; + break; case _SHUFFLE_FLAG: special->_Shuffle = tf; special->flags |= _SHUFFLE_FLAG; diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c index 49a812280f..5bf7fcce73 100644 --- a/ncgen/ncgenl.c +++ b/ncgen/ncgenl.c @@ -7,11 +7,17 @@ #define yy_create_buffer ncg_create_buffer #define yy_delete_buffer ncg_delete_buffer -#define yy_flex_debug ncg_flex_debug +#define yy_scan_buffer ncg_scan_buffer +#define yy_scan_string ncg_scan_string +#define yy_scan_bytes ncg_scan_bytes #define yy_init_buffer ncg_init_buffer #define yy_flush_buffer ncg_flush_buffer #define yy_load_buffer_state ncg_load_buffer_state #define yy_switch_to_buffer ncg_switch_to_buffer +#define yypush_buffer_state ncgpush_buffer_state +#define yypop_buffer_state ncgpop_buffer_state +#define yyensure_buffer_stack ncgensure_buffer_stack +#define yy_flex_debug ncg_flex_debug #define yyin ncgin #define yyleng ncgleng #define yylex ncglex @@ -27,11 +33,245 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define ncg_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer ncg_create_buffer +#endif + +#ifdef yy_delete_buffer +#define ncg_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer ncg_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define ncg_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer ncg_scan_buffer +#endif + +#ifdef yy_scan_string +#define ncg_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string ncg_scan_string +#endif + +#ifdef yy_scan_bytes +#define ncg_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes ncg_scan_bytes +#endif + +#ifdef yy_init_buffer +#define ncg_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer ncg_init_buffer +#endif + +#ifdef yy_flush_buffer +#define ncg_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer ncg_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define ncg_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state ncg_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define ncg_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer ncg_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define ncgpush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state ncgpush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define ncgpop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state ncgpop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define ncgensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack ncgensure_buffer_stack +#endif + +#ifdef yylex +#define ncglex_ALREADY_DEFINED +#else +#define yylex ncglex +#endif + +#ifdef yyrestart +#define ncgrestart_ALREADY_DEFINED +#else +#define yyrestart ncgrestart +#endif + +#ifdef yylex_init +#define ncglex_init_ALREADY_DEFINED +#else +#define yylex_init ncglex_init +#endif + +#ifdef yylex_init_extra +#define ncglex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra ncglex_init_extra +#endif + +#ifdef yylex_destroy +#define ncglex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy ncglex_destroy +#endif + +#ifdef yyget_debug +#define ncgget_debug_ALREADY_DEFINED +#else +#define yyget_debug ncgget_debug +#endif + +#ifdef yyset_debug +#define ncgset_debug_ALREADY_DEFINED +#else +#define yyset_debug ncgset_debug +#endif + +#ifdef yyget_extra +#define ncgget_extra_ALREADY_DEFINED +#else +#define yyget_extra ncgget_extra +#endif + +#ifdef yyset_extra +#define ncgset_extra_ALREADY_DEFINED +#else +#define yyset_extra ncgset_extra +#endif + +#ifdef yyget_in +#define ncgget_in_ALREADY_DEFINED +#else +#define yyget_in ncgget_in +#endif + +#ifdef yyset_in +#define ncgset_in_ALREADY_DEFINED +#else +#define yyset_in ncgset_in +#endif + +#ifdef yyget_out +#define ncgget_out_ALREADY_DEFINED +#else +#define yyget_out ncgget_out +#endif + +#ifdef yyset_out +#define ncgset_out_ALREADY_DEFINED +#else +#define yyset_out ncgset_out +#endif + +#ifdef yyget_leng +#define ncgget_leng_ALREADY_DEFINED +#else +#define yyget_leng ncgget_leng +#endif + +#ifdef yyget_text +#define ncgget_text_ALREADY_DEFINED +#else +#define yyget_text ncgget_text +#endif + +#ifdef yyget_lineno +#define ncgget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno ncgget_lineno +#endif + +#ifdef yyset_lineno +#define ncgset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno ncgset_lineno +#endif + +#ifdef yywrap +#define ncgwrap_ALREADY_DEFINED +#else +#define yywrap ncgwrap +#endif + +#ifdef yyalloc +#define ncgalloc_ALREADY_DEFINED +#else +#define yyalloc ncgalloc +#endif + +#ifdef yyrealloc +#define ncgrealloc_ALREADY_DEFINED +#else +#define yyrealloc ncgrealloc +#endif + +#ifdef yyfree +#define ncgfree_ALREADY_DEFINED +#else +#define yyfree ncgfree +#endif + +#ifdef yytext +#define ncgtext_ALREADY_DEFINED +#else +#define yytext ncgtext +#endif + +#ifdef yyleng +#define ncgleng_ALREADY_DEFINED +#else +#define yyleng ncgleng +#endif + +#ifdef yyin +#define ncgin_ALREADY_DEFINED +#else +#define yyin ncgin +#endif + +#ifdef yyout +#define ncgout_ALREADY_DEFINED +#else +#define yyout ncgout +#endif + +#ifdef yy_flex_debug +#define ncg_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug ncg_flex_debug +#endif + +#ifdef yylineno +#define ncglineno_ALREADY_DEFINED +#else +#define yylineno ncglineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -102,60 +342,48 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST +/* begin standard C++ headers. */ -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE ncgrestart(ncgin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -185,14 +413,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t ncgleng; +extern int yyleng; -extern FILE *ncgin, *ncgout; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) @@ -200,16 +428,15 @@ extern FILE *ncgin, *ncgout; #define yyless(n) \ do \ { \ - /* Undo effects of setting up ncgtext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up ncgtext again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -224,7 +451,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -252,7 +479,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -269,8 +496,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via ncgrestart()), so that the user can continue scanning by - * just pointing ncgin at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -280,7 +507,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -291,109 +518,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when ncgtext is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t ncgleng; +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow ncgwrap()'s to do buffer switches - * instead of setting up a fresh ncgin. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void ncgrestart (FILE *input_file ); -void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE ncg_create_buffer (FILE *file,int size ); -void ncg_delete_buffer (YY_BUFFER_STATE b ); -void ncg_flush_buffer (YY_BUFFER_STATE b ); -void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ); -void ncgpop_buffer_state (void ); - -static void ncgensure_buffer_stack (void ); -static void ncg_load_buffer_state (void ); -static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER ncg_flush_buffer(YY_CURRENT_BUFFER ) +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -void *ncgalloc (yy_size_t ); -void *ncgrealloc (void *,yy_size_t ); -void ncgfree (void * ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -#define yy_new_buffer ncg_create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - ncgensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - ncg_create_buffer(ncgin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - ncgensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - ncg_create_buffer(ncgin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *ncgin = (FILE *) 0, *ncgout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int ncglineno; +extern int yylineno; +int yylineno = 1; -int ncglineno = 1; - -extern char *ncgtext; +extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif -#define yytext_ptr ncgtext +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -#if defined(__GNUC__) && __GNUC__ >= 3 -__attribute__((__noreturn__)) -#endif -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up ncgtext. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - ncgleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 54 #define YY_END_OF_BUFFER 55 /* This struct is not used in this scanner, @@ -403,7 +619,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[429] = +static const flex_int16_t yy_accept[509] = { 0, 0, 0, 51, 51, 0, 0, 55, 53, 1, 49, 53, 53, 53, 53, 43, 37, 41, 41, 40, 40, @@ -418,43 +634,52 @@ static yyconst flex_int16_t yy_accept[429] = 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 0, 0, 51, 0, 52, 39, 45, - 0, 0, 0, 0, 43, 0, 0, 43, 2, 37, - 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, - 40, 40, 40, 40, 40, 40, 36, 33, 40, 40, + 40, 40, 40, 40, 0, 0, 51, 0, 52, 39, + 45, 0, 0, 0, 0, 43, 0, 0, 43, 2, + 37, 0, 0, 0, 0, 0, 0, 0, 4, 0, + 0, 40, 40, 40, 40, 40, 40, 36, 33, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 13, 40, 33, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 0, 48, 0, 0, + 40, 40, 40, 13, 40, 33, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 0, 48, + + 0, 0, 43, 0, 37, 0, 0, 0, 0, 0, + 0, 0, 4, 42, 42, 0, 40, 40, 34, 40, + 40, 35, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 11, 10, 40, + 40, 40, 40, 6, 40, 40, 40, 40, 21, 40, + 40, 40, 20, 40, 40, 40, 40, 40, 16, 40, + 40, 40, 40, 0, 0, 34, 0, 37, 0, 0, + 0, 0, 0, 0, 0, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 29, 40, 40, 8, - 43, 0, 37, 0, 0, 0, 0, 0, 0, 0, - 4, 42, 42, 0, 40, 40, 34, 40, 40, 35, + 40, 17, 40, 40, 40, 40, 12, 40, 40, 40, + 14, 40, 40, 23, 40, 40, 40, 46, 47, 0, + 0, 0, 0, 40, 40, 40, 31, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 11, 10, 40, 40, 40, 40, - 6, 40, 40, 40, 40, 21, 40, 40, 40, 20, - 40, 40, 40, 40, 40, 16, 40, 40, 40, 40, - 0, 0, 34, 0, 37, 0, 0, 0, 0, 0, - 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 9, 30, 40, 7, 19, + 5, 26, 18, 40, 40, 15, 40, 0, 0, 40, + 40, 40, 40, 40, 38, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 22, 40, 40, + 40, 40, 0, 40, 32, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 5, 40, 40, 24, 40, + + 40, 32, 32, 25, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 29, 40, 40, 8, 40, 17, 40, 40, - - 40, 40, 12, 40, 40, 40, 14, 40, 40, 23, - 40, 40, 40, 46, 47, 0, 0, 0, 0, 40, - 40, 40, 31, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 28, 40, 40, 40, 40, 40, + 27, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 9, 30, 40, 7, 19, 5, 26, 18, 40, 40, - 15, 40, 0, 0, 40, 40, 40, 40, 40, 38, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 22, 40, 40, 40, 40, 0, 40, 32, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 5, 40, - 40, 24, 40, 40, 32, 32, 25, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 28, 40, 40, 40, 27, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static const 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, @@ -463,429 +688,502 @@ static yyconst YY_CHAR yy_ec[256] = 5, 8, 9, 5, 10, 11, 12, 13, 14, 15, 16, 17, 14, 18, 14, 19, 19, 20, 5, 5, 5, 5, 5, 21, 22, 23, 24, 25, 26, 27, - 28, 28, 29, 28, 28, 30, 31, 32, 28, 33, - 28, 28, 34, 35, 36, 37, 28, 38, 28, 28, - 5, 39, 5, 5, 40, 5, 41, 42, 43, 44, - - 45, 46, 47, 48, 49, 28, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 28, 38, - 62, 63, 64, 5, 5, 5, 1, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, - - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, - 68, 68, 68, 68, 68, 68, 68, 1, 1, 1, + 28, 29, 30, 29, 29, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 29, 42, 29, 29, + 5, 43, 5, 5, 44, 5, 45, 46, 47, 48, + + 49, 50, 51, 52, 53, 29, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 29, 42, + 66, 67, 68, 5, 5, 5, 1, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, + + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, + 72, 72, 72, 72, 72, 72, 72, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[69] = +static const YY_CHAR yy_meta[73] = { 0, 1, 1, 2, 1, 1, 1, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 1, - 5, 9, 9, 9, 9, 10, 9, 11, 12, 13, - 11, 11, 11, 13, 11, 11, 11, 11, 11, 11, - 9, 9, 9, 9, 10, 9, 11, 11, 11, 11, + 5, 9, 9, 9, 9, 10, 9, 11, 11, 12, 13, 11, 11, 11, 11, 11, 11, 13, 11, 11, - 11, 11, 11, 14, 1, 11, 11, 11 + 11, 11, 11, 11, 9, 9, 9, 9, 10, 9, + 11, 11, 11, 11, 13, 11, 11, 11, 11, 11, + 11, 13, 11, 11, 11, 11, 11, 14, 1, 11, + 11, 11 } ; -static yyconst flex_uint16_t yy_base[447] = +static const flex_int16_t yy_base[527] = { 0, - 0, 0, 325, 321, 264, 255, 318, 2458, 67, 2458, - 64, 269, 61, 62, 95, 77, 136, 259, 51, 61, - 188, 97, 118, 150, 65, 195, 233, 153, 183, 222, - 241, 202, 207, 213, 238, 246, 243, 257, 268, 264, - 298, 276, 221, 219, 218, 270, 236, 0, 2458, 79, - 87, 2458, 244, 238, 344, 0, 206, 358, 190, 0, - 2458, 370, 2458, 2458, 0, 342, 377, 177, 175, 174, - 200, 2458, 54, 377, 0, 254, 397, 171, 170, 169, - 358, 85, 404, 373, 376, 398, 391, 406, 412, 417, - 421, 428, 432, 451, 454, 458, 488, 484, 447, 468, - - 494, 471, 501, 506, 510, 525, 532, 536, 541, 544, - 557, 562, 576, 579, 567, 583, 593, 600, 588, 618, - 613, 626, 630, 168, 167, 222, 217, 2458, 0, 2458, - 221, 688, 219, 694, 701, 179, 719, 740, 0, 709, - 683, 774, 159, 158, 135, 130, 128, 710, 125, 123, - 721, 730, 733, 744, 756, 768, 751, 775, 764, 786, - 789, 781, 800, 811, 806, 819, 831, 826, 842, 822, - 852, 845, 856, 864, 878, 875, 889, 896, 900, 908, - 911, 941, 922, 926, 957, 931, 944, 962, 966, 975, - 978, 988, 982, 1012, 999, 1019, 118, 2458, 1056, 0, - - 2458, 50, 1024, 1080, 117, 115, 112, 110, 108, 104, - 1030, 72, 2458, 103, 1038, 1043, 1061, 1064, 1076, 1068, - 1081, 1084, 1094, 1087, 1107, 1118, 1124, 1127, 1131, 1139, - 1161, 1165, 1169, 1173, 1148, 1178, 1184, 1181, 1203, 1214, - 1191, 1195, 1221, 1238, 1225, 1228, 1258, 1234, 1247, 1251, - 1264, 1269, 1273, 1288, 1299, 1303, 1306, 1295, 1311, 1318, - 160, 154, 2458, 107, 1321, 1386, 93, 91, 77, 73, - 72, 70, 1336, 1366, 1360, 1369, 1372, 1379, 1376, 1410, - 1413, 1416, 1419, 1422, 1427, 1432, 1453, 1457, 1463, 1471, - 1475, 1467, 2458, 1478, 1483, 1487, 1520, 1508, 1513, 1529, - - 1523, 1526, 1533, 1538, 1543, 1564, 1559, 1590, 1569, 1573, - 1579, 1583, 1613, 2458, 2458, 85, 65, 59, 36, 1594, - 1620, 1604, 1599, 1609, 1630, 1635, 1645, 1639, 1650, 1669, - 1661, 1655, 1676, 1685, 1681, 1694, 1691, 1724, 1702, 1707, - 1711, 2458, 1715, 1728, 1732, 1737, 2458, 1741, 1748, 1762, - 1745, 1767, 39, 27, 1771, 1780, 1783, 1797, 1792, 1786, - 1816, 1803, 1823, 1827, 1834, 1840, 1847, 1858, 1865, 1873, - 1880, 1870, 1888, 1896, 1883, 1913, 24, 1920, 1926, 1932, - 1938, 1943, 1929, 1952, 1964, 1968, 1976, 1983, 1986, 2002, - 2017, 1999, 2020, 2024, 36, 2006, 2009, 2050, 2054, 2039, - - 2057, 2042, 2062, 2072, 2076, 2087, 2093, 2098, 2102, 2109, - 2112, 2123, 2132, 2153, 2458, 2142, 2149, 2146, 2458, 2135, - 2165, 2179, 2168, 2172, 2188, 2203, 2209, 2458, 2277, 2291, - 2305, 2319, 2328, 2337, 2346, 2359, 2373, 2386, 2400, 2410, - 2416, 2424, 2426, 2432, 2438, 2444 + 0, 0, 406, 404, 342, 341, 380, 2942, 71, 2942, + 68, 326, 65, 66, 103, 89, 151, 326, 55, 65, + 207, 69, 114, 166, 161, 129, 256, 169, 191, 199, + 299, 175, 230, 233, 250, 264, 225, 267, 280, 275, + 287, 184, 286, 285, 284, 323, 317, 0, 2942, 83, + 88, 2942, 322, 317, 347, 0, 277, 357, 258, 0, + 2942, 368, 2942, 2942, 0, 336, 377, 245, 243, 242, + 264, 2942, 55, 152, 0, 345, 393, 229, 219, 218, + 359, 79, 394, 362, 368, 383, 404, 394, 407, 414, + 398, 429, 424, 440, 449, 446, 466, 462, 479, 482, + + 485, 492, 496, 504, 501, 515, 526, 534, 518, 537, + 556, 540, 559, 548, 572, 578, 590, 582, 597, 602, + 612, 621, 628, 634, 216, 206, 266, 260, 2942, 0, + 2942, 260, 672, 259, 694, 701, 215, 720, 744, 0, + 653, 552, 760, 195, 191, 190, 189, 184, 118, 182, + 179, 702, 659, 707, 738, 743, 746, 752, 755, 761, + 776, 764, 787, 795, 798, 801, 813, 806, 817, 836, + 847, 832, 839, 855, 850, 862, 869, 886, 881, 892, + 899, 902, 911, 918, 925, 934, 955, 943, 937, 950, + 975, 980, 990, 993, 987, 1023, 997, 1027, 159, 2942, + + 89, 0, 2942, 40, 1030, 1068, 141, 139, 136, 134, + 133, 132, 979, 78, 2942, 130, 1034, 1045, 1048, 1053, + 1078, 1064, 1090, 1069, 1094, 1087, 1101, 1112, 1125, 1120, + 1131, 1138, 1134, 1143, 1168, 1151, 1176, 1164, 1173, 1183, + 1207, 1194, 1187, 1190, 1213, 1227, 1232, 1220, 1224, 1244, + 1257, 1237, 1250, 1263, 1267, 1270, 1282, 1287, 1300, 1304, + 1307, 1319, 1322, 188, 181, 2942, 130, 1339, 1379, 112, + 110, 109, 107, 103, 94, 1353, 1358, 1361, 1370, 1365, + 1373, 1391, 1403, 1406, 1409, 1415, 1412, 1422, 1425, 1446, + 1455, 1458, 1462, 1466, 1470, 1479, 2942, 1492, 1496, 1476, + + 1532, 1501, 1510, 1542, 1527, 1535, 1517, 1549, 1552, 1566, + 1558, 1573, 1582, 1588, 1596, 1592, 1604, 2942, 2942, 102, + 85, 81, 69, 1618, 1599, 1614, 1608, 1644, 1653, 1630, + 1650, 1638, 1660, 1656, 1686, 1676, 1664, 1690, 1697, 1700, + 1708, 1694, 1730, 1734, 1739, 1716, 2942, 1742, 1746, 1750, + 1755, 2942, 1764, 1780, 1785, 1772, 1790, 50, 31, 1796, + 1804, 1815, 1820, 1826, 1829, 1834, 1837, 1859, 1846, 1867, + 1870, 1877, 1883, 1902, 1891, 1909, 1913, 1916, 1921, 1933, + 1926, 1946, 33, 1956, 1959, 1965, 1971, 1976, 1990, 1980, + 1997, 2006, 2002, 2010, 2021, 2014, 2032, 2045, 2027, 2052, + + 2058, 45, 2040, 2062, 2065, 2070, 2082, 2078, 2102, 2114, + 2095, 2128, 2117, 2120, 2135, 2132, 2150, 2154, 2165, 2158, + 2170, 2184, 2189, 2176, 2942, 2195, 2208, 2219, 2225, 2228, + 2942, 2231, 2242, 2264, 2249, 2238, 2268, 2273, 2280, 2284, + 2303, 2306, 2289, 2319, 2310, 2314, 2322, 2329, 2336, 2372, + 2353, 2362, 2359, 2366, 2376, 2406, 2384, 2392, 2402, 2397, + 2416, 2423, 2427, 2432, 2442, 2453, 2438, 2458, 2462, 2449, + 2475, 2479, 2492, 2484, 2499, 2509, 2496, 2522, 2539, 2529, + 2534, 2515, 2545, 2555, 2560, 2565, 2571, 2577, 2581, 2591, + 2586, 2603, 2616, 2597, 2612, 2627, 2633, 2638, 2646, 2649, + + 2652, 2668, 2659, 2682, 2689, 2664, 2685, 2942, 2761, 2775, + 2789, 2803, 2812, 2821, 2830, 2843, 2857, 2870, 2884, 2894, + 2900, 2908, 2910, 2916, 2922, 2928 } ; -static yyconst flex_int16_t yy_def[447] = +static const flex_int16_t yy_def[527] = { 0, - 428, 1, 429, 429, 430, 430, 428, 428, 428, 428, - 431, 432, 428, 433, 428, 434, 428, 17, 435, 435, - 435, 435, 435, 435, 435, 428, 435, 435, 435, 435, - 21, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 428, 428, 428, 436, 436, 437, 428, 428, - 431, 428, 431, 428, 438, 15, 17, 428, 428, 15, - 428, 428, 428, 428, 439, 440, 428, 428, 428, 428, - 17, 428, 428, 428, 441, 435, 428, 428, 428, 428, - 435, 21, 21, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 428, 428, 436, 436, 428, 437, 428, - 428, 428, 442, 428, 428, 428, 428, 428, 439, 440, - 443, 428, 428, 428, 428, 428, 428, 444, 428, 428, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 428, 428, 428, 445, - - 428, 428, 446, 428, 428, 428, 428, 428, 428, 428, - 444, 428, 428, 428, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 428, 428, 428, 428, 446, 428, 428, 428, 428, 428, - 428, 428, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 428, 435, 435, 435, 435, 435, 435, 435, - - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 428, 428, 428, 428, 428, 428, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 428, 435, 435, 435, 435, 428, 435, 435, 435, - 435, 435, 428, 428, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 428, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 428, 435, 435, 435, 435, 435, - - 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 428, 435, 435, 435, 428, 435, - 435, 435, 435, 435, 435, 435, 435, 0, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428 + 508, 1, 509, 509, 510, 510, 508, 508, 508, 508, + 511, 512, 508, 513, 508, 514, 508, 17, 515, 515, + 515, 515, 515, 515, 515, 508, 515, 515, 515, 515, + 21, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 508, 508, 508, 516, 516, 517, 508, 508, + 511, 508, 511, 508, 518, 15, 17, 508, 508, 15, + 508, 508, 508, 508, 519, 520, 508, 508, 508, 508, + 17, 508, 508, 508, 521, 515, 508, 508, 508, 508, + 515, 21, 21, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 508, 508, 516, 516, 508, 517, + 508, 508, 508, 522, 508, 508, 508, 508, 508, 519, + 520, 523, 508, 508, 508, 508, 508, 508, 524, 508, + 508, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 508, 508, + + 508, 525, 508, 508, 526, 508, 508, 508, 508, 508, + 508, 508, 524, 508, 508, 508, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 508, 508, 508, 508, 526, 508, 508, + 508, 508, 508, 508, 508, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 508, 515, 515, 515, + + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 508, 508, 508, + 508, 508, 508, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 508, 515, 515, 515, + 515, 508, 515, 515, 515, 515, 515, 508, 508, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 508, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + + 515, 508, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 508, 515, 515, 515, 515, 515, + 508, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + + 515, 515, 515, 515, 515, 515, 515, 0, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508 } ; -static yyconst flex_uint16_t yy_nxt[2527] = +static const flex_int16_t yy_nxt[3015] = { 0, 8, 9, 10, 9, 8, 11, 12, 8, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 8, - 8, 19, 19, 19, 20, 21, 22, 19, 23, 19, - 19, 24, 19, 19, 19, 25, 19, 19, 26, 27, - 19, 28, 29, 30, 31, 32, 33, 19, 34, 19, - 35, 19, 36, 37, 19, 19, 38, 39, 40, 41, - 42, 19, 19, 8, 8, 43, 44, 45, 50, 52, - 50, 56, 56, 57, 57, 57, 57, 57, 57, 57, - 50, 263, 50, 72, 64, 395, 58, 58, 65, 77, - 59, 265, 52, 76, 76, 263, 90, 377, 264, 77, - - 203, 213, 53, 77, 72, 58, 58, 60, 60, 60, - 60, 60, 60, 60, 81, 67, 78, 79, 80, 61, - 62, 63, 213, 354, 61, 53, 78, 79, 80, 265, - 78, 79, 80, 353, 140, 77, 319, 203, 61, 62, - 63, 318, 68, 69, 70, 61, 56, 84, 71, 71, - 71, 71, 71, 71, 71, 317, 77, 265, 72, 316, - 315, 58, 78, 79, 80, 73, 314, 76, 66, 72, - 85, 74, 272, 75, 140, 86, 271, 72, 87, 270, - 58, 203, 91, 78, 79, 80, 73, 214, 77, 76, - 88, 77, 210, 72, 66, 74, 82, 82, 89, 209, - - 83, 83, 83, 83, 83, 83, 83, 91, 91, 91, - 91, 91, 91, 91, 99, 78, 79, 80, 78, 79, - 80, 77, 208, 140, 202, 198, 77, 198, 428, 127, - 100, 197, 91, 150, 149, 76, 101, 428, 147, 146, - 77, 66, 136, 428, 130, 77, 428, 128, 78, 79, - 80, 77, 106, 78, 79, 80, 92, 93, 94, 95, - 77, 96, 102, 107, 97, 108, 98, 78, 79, 80, - 103, 77, 78, 79, 80, 104, 77, 127, 78, 79, - 80, 77, 125, 124, 77, 91, 110, 78, 79, 80, - 111, 109, 77, 105, 112, 77, 428, 113, 78, 79, - - 80, 114, 77, 78, 79, 80, 77, 55, 78, 79, - 80, 78, 79, 80, 77, 115, 123, 428, 49, 78, - 79, 80, 78, 79, 80, 117, 116, 49, 47, 78, - 79, 80, 47, 78, 79, 80, 77, 428, 428, 118, - 428, 78, 79, 80, 428, 428, 119, 428, 120, 428, - 121, 428, 428, 141, 428, 122, 132, 132, 132, 132, - 132, 132, 428, 78, 79, 80, 134, 134, 428, 428, - 135, 135, 135, 135, 135, 135, 135, 428, 137, 137, - 142, 133, 138, 138, 138, 138, 138, 138, 138, 66, - 66, 66, 66, 66, 66, 66, 77, 428, 428, 72, - - 76, 76, 76, 76, 76, 428, 73, 143, 144, 145, - 72, 77, 76, 76, 77, 428, 76, 151, 72, 428, - 157, 155, 428, 78, 79, 80, 154, 73, 152, 77, - 153, 428, 156, 152, 72, 76, 77, 158, 78, 79, - 80, 78, 79, 80, 77, 428, 159, 152, 428, 153, - 77, 428, 428, 428, 152, 77, 78, 79, 80, 77, - 76, 428, 157, 78, 79, 80, 77, 428, 428, 428, - 77, 78, 79, 80, 428, 160, 162, 78, 79, 80, - 428, 161, 78, 79, 80, 77, 78, 79, 80, 77, - 428, 428, 77, 78, 79, 80, 77, 78, 79, 80, - - 428, 428, 164, 163, 165, 173, 77, 166, 174, 77, - 428, 168, 78, 79, 80, 167, 78, 79, 80, 78, - 79, 80, 77, 78, 79, 80, 77, 428, 428, 176, - 428, 170, 77, 78, 79, 80, 78, 79, 80, 77, - 428, 169, 171, 172, 77, 175, 428, 428, 77, 78, - 79, 80, 177, 78, 79, 80, 428, 428, 428, 78, - 79, 80, 428, 77, 428, 178, 78, 79, 80, 179, - 77, 78, 79, 80, 77, 78, 79, 80, 180, 77, - 428, 428, 77, 428, 428, 181, 428, 428, 428, 428, - 78, 79, 80, 183, 182, 77, 184, 78, 79, 80, - - 77, 78, 79, 80, 428, 77, 78, 79, 80, 78, - 79, 80, 157, 428, 77, 185, 186, 77, 428, 187, - 188, 77, 78, 79, 80, 428, 77, 78, 79, 80, - 428, 77, 78, 79, 80, 428, 428, 428, 77, 189, - 192, 78, 79, 80, 78, 79, 80, 190, 78, 79, - 80, 77, 428, 78, 79, 80, 77, 428, 78, 79, - 80, 191, 428, 194, 77, 78, 79, 80, 77, 428, - 428, 193, 428, 195, 428, 428, 428, 428, 78, 79, - 80, 428, 428, 78, 79, 80, 196, 428, 428, 428, - 428, 78, 79, 80, 198, 78, 79, 80, 428, 428, - - 199, 199, 199, 199, 199, 199, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 141, 204, 428, 428, 428, 201, 428, 63, 428, 428, - 201, 138, 138, 138, 138, 138, 138, 138, 428, 212, - 428, 428, 428, 213, 201, 428, 63, 142, 205, 206, - 207, 201, 138, 138, 138, 138, 138, 138, 138, 77, - 212, 428, 215, 428, 61, 428, 63, 213, 77, 61, - 428, 77, 428, 428, 143, 144, 145, 140, 140, 140, - 140, 140, 77, 61, 216, 63, 78, 79, 80, 77, - 61, 219, 221, 140, 77, 78, 79, 80, 78, 79, - - 80, 217, 77, 428, 218, 428, 77, 428, 428, 78, - 79, 80, 140, 77, 428, 428, 78, 79, 80, 77, - 220, 78, 79, 80, 77, 428, 224, 77, 428, 78, - 79, 80, 223, 78, 79, 80, 428, 140, 77, 428, - 78, 79, 80, 225, 77, 222, 78, 79, 80, 77, - 227, 78, 79, 80, 78, 79, 80, 77, 230, 428, - 77, 226, 229, 428, 77, 78, 79, 80, 231, 77, - 428, 78, 79, 80, 428, 228, 78, 79, 80, 428, - 77, 232, 428, 77, 78, 79, 80, 78, 79, 80, - 77, 78, 79, 80, 77, 428, 78, 79, 80, 234, - - 235, 428, 77, 428, 428, 233, 428, 78, 79, 80, - 78, 79, 80, 77, 428, 238, 77, 78, 79, 80, - 236, 78, 79, 80, 428, 428, 428, 77, 428, 78, - 79, 80, 237, 239, 77, 428, 428, 240, 77, 428, - 78, 79, 80, 78, 79, 80, 77, 428, 242, 77, - 428, 241, 428, 428, 78, 79, 80, 428, 244, 428, - 77, 78, 79, 80, 77, 78, 79, 80, 246, 77, - 243, 220, 428, 78, 79, 80, 78, 79, 80, 77, - 247, 428, 77, 428, 428, 245, 249, 78, 79, 80, - 428, 78, 79, 80, 250, 77, 78, 79, 80, 248, - - 77, 428, 428, 428, 77, 428, 78, 79, 80, 78, - 79, 80, 428, 77, 252, 428, 77, 428, 251, 254, - 77, 428, 78, 79, 80, 253, 77, 78, 79, 80, - 428, 78, 79, 80, 257, 141, 255, 77, 428, 428, - 78, 79, 80, 78, 79, 80, 256, 78, 79, 80, - 77, 428, 259, 78, 79, 80, 428, 77, 428, 212, - 258, 428, 266, 213, 78, 79, 80, 260, 261, 261, - 261, 261, 261, 261, 428, 428, 77, 78, 79, 80, - 212, 77, 428, 428, 78, 79, 80, 213, 273, 267, - 268, 269, 203, 203, 203, 203, 203, 203, 203, 77, - - 276, 274, 77, 78, 79, 80, 77, 428, 78, 79, - 80, 277, 428, 428, 77, 428, 275, 428, 428, 77, - 428, 428, 77, 428, 428, 77, 78, 79, 80, 78, - 79, 80, 77, 78, 79, 80, 278, 280, 279, 428, - 428, 78, 79, 80, 428, 77, 78, 79, 80, 78, - 79, 80, 78, 79, 80, 281, 77, 428, 428, 78, - 79, 80, 77, 428, 428, 77, 428, 428, 282, 77, - 428, 428, 78, 79, 80, 286, 283, 77, 285, 428, - 428, 428, 284, 78, 79, 80, 77, 428, 428, 78, - 79, 80, 78, 79, 80, 287, 78, 79, 80, 77, - - 293, 428, 428, 77, 78, 79, 80, 77, 428, 288, - 289, 77, 428, 78, 79, 80, 77, 291, 428, 77, - 428, 428, 77, 428, 428, 290, 78, 79, 80, 77, - 78, 79, 80, 77, 78, 79, 80, 292, 78, 79, - 80, 77, 428, 78, 79, 80, 78, 79, 80, 78, - 79, 80, 77, 296, 298, 294, 78, 79, 80, 77, - 78, 79, 80, 77, 295, 428, 77, 428, 78, 79, - 80, 299, 77, 428, 428, 297, 77, 301, 428, 78, - 79, 80, 300, 428, 428, 77, 78, 79, 80, 77, - 78, 79, 80, 78, 79, 80, 77, 428, 428, 78, - - 79, 80, 77, 78, 79, 80, 302, 77, 428, 428, - 428, 77, 78, 79, 80, 305, 78, 79, 80, 428, - 308, 304, 303, 78, 79, 80, 77, 428, 428, 78, - 79, 80, 141, 77, 78, 79, 80, 77, 78, 79, - 80, 77, 428, 307, 77, 306, 311, 309, 428, 77, - 428, 428, 310, 78, 79, 80, 77, 428, 313, 266, - 78, 79, 80, 428, 78, 79, 80, 312, 78, 79, - 80, 78, 79, 80, 77, 428, 78, 79, 80, 428, - 320, 428, 428, 78, 79, 80, 267, 268, 269, 265, - 265, 265, 265, 265, 321, 323, 428, 428, 77, 428, - - 324, 78, 79, 80, 77, 265, 428, 77, 322, 428, - 77, 428, 428, 428, 77, 428, 428, 77, 326, 428, - 428, 428, 428, 428, 265, 78, 79, 80, 325, 428, - 428, 78, 79, 80, 78, 79, 80, 78, 79, 80, - 428, 78, 79, 80, 78, 79, 80, 428, 77, 265, - 327, 77, 329, 328, 77, 428, 428, 77, 428, 428, - 77, 428, 428, 330, 331, 77, 428, 332, 428, 428, - 77, 428, 428, 428, 428, 78, 79, 80, 78, 79, - 80, 78, 79, 80, 78, 79, 80, 78, 79, 80, - 333, 77, 78, 79, 80, 77, 428, 78, 79, 80, - - 428, 77, 428, 428, 428, 77, 334, 335, 336, 77, - 428, 337, 428, 77, 428, 428, 77, 428, 78, 79, - 80, 77, 78, 79, 80, 77, 339, 341, 78, 79, - 80, 338, 78, 79, 80, 340, 78, 79, 80, 342, - 78, 79, 80, 78, 79, 80, 77, 428, 78, 79, - 80, 77, 78, 79, 80, 323, 428, 343, 77, 428, - 428, 77, 428, 428, 77, 428, 428, 77, 323, 428, - 344, 77, 428, 78, 79, 80, 77, 428, 78, 79, - 80, 77, 428, 347, 345, 78, 79, 80, 78, 79, - 80, 78, 79, 80, 78, 79, 80, 77, 78, 79, - - 80, 346, 77, 78, 79, 80, 348, 77, 78, 79, - 80, 77, 428, 428, 428, 349, 428, 77, 428, 428, - 428, 77, 355, 428, 78, 79, 80, 350, 77, 78, - 79, 80, 77, 428, 78, 79, 80, 77, 78, 79, - 80, 351, 77, 358, 78, 79, 80, 77, 78, 79, - 80, 77, 428, 428, 352, 78, 79, 80, 77, 78, - 79, 80, 357, 359, 78, 79, 80, 428, 77, 78, - 79, 80, 356, 77, 78, 79, 80, 77, 78, 79, - 80, 428, 428, 77, 428, 78, 79, 80, 77, 428, - 363, 362, 360, 77, 428, 78, 79, 80, 428, 77, - - 78, 79, 80, 361, 78, 79, 80, 77, 364, 428, - 78, 79, 80, 360, 77, 78, 79, 80, 365, 77, - 78, 79, 80, 77, 428, 360, 78, 79, 80, 77, - 428, 360, 77, 428, 78, 79, 80, 368, 428, 366, - 77, 78, 79, 80, 367, 77, 78, 79, 80, 77, - 78, 79, 80, 77, 370, 371, 78, 79, 80, 78, - 79, 80, 77, 428, 428, 369, 77, 78, 79, 80, - 77, 372, 78, 79, 80, 77, 78, 79, 80, 77, - 78, 79, 80, 77, 428, 428, 77, 428, 428, 78, - 79, 80, 374, 78, 79, 80, 373, 78, 79, 80, - - 77, 428, 78, 79, 80, 77, 78, 79, 80, 77, - 78, 79, 80, 78, 79, 80, 428, 376, 77, 428, - 375, 77, 380, 378, 77, 217, 428, 78, 79, 80, - 77, 428, 78, 79, 80, 77, 78, 79, 80, 428, - 381, 77, 428, 428, 379, 78, 79, 80, 78, 79, - 80, 78, 79, 80, 77, 383, 428, 78, 79, 80, - 382, 77, 78, 79, 80, 77, 428, 428, 78, 79, - 80, 385, 77, 384, 428, 428, 428, 386, 77, 428, - 428, 78, 79, 80, 387, 77, 428, 428, 78, 79, - 80, 360, 78, 79, 80, 428, 77, 428, 428, 78, - - 79, 80, 360, 77, 428, 78, 79, 80, 77, 428, - 428, 77, 78, 79, 80, 388, 389, 428, 77, 428, - 428, 77, 428, 78, 79, 80, 77, 393, 428, 428, - 78, 79, 80, 390, 77, 78, 79, 80, 78, 79, - 80, 428, 428, 428, 391, 78, 79, 80, 78, 79, - 80, 77, 392, 78, 79, 80, 397, 394, 77, 428, - 428, 78, 79, 80, 77, 396, 428, 77, 428, 428, - 77, 217, 399, 400, 428, 428, 77, 428, 78, 79, - 80, 77, 428, 428, 428, 78, 79, 80, 428, 428, - 77, 78, 79, 80, 78, 79, 80, 78, 79, 80, - - 398, 428, 77, 78, 79, 80, 77, 428, 78, 79, - 80, 401, 428, 403, 77, 428, 428, 78, 79, 80, - 402, 77, 428, 428, 77, 428, 428, 428, 428, 78, - 79, 80, 404, 78, 79, 80, 405, 77, 428, 428, - 77, 78, 79, 80, 77, 428, 428, 77, 78, 79, - 80, 78, 79, 80, 406, 77, 428, 411, 77, 428, - 428, 389, 77, 397, 78, 79, 80, 78, 79, 80, - 428, 78, 79, 80, 78, 79, 80, 77, 360, 428, - 77, 407, 78, 79, 80, 78, 79, 80, 77, 78, - 79, 80, 77, 428, 408, 77, 410, 428, 409, 428, - - 77, 360, 428, 428, 78, 79, 80, 78, 79, 80, - 77, 428, 415, 428, 77, 78, 79, 80, 413, 78, - 79, 80, 78, 79, 80, 77, 360, 78, 79, 80, - 412, 77, 428, 428, 428, 428, 77, 78, 79, 80, - 77, 78, 79, 80, 414, 428, 428, 77, 428, 428, - 77, 428, 78, 79, 80, 360, 428, 428, 78, 79, - 80, 77, 416, 78, 79, 80, 360, 78, 79, 80, - 77, 417, 419, 77, 78, 79, 80, 78, 79, 80, - 77, 418, 422, 428, 77, 360, 420, 77, 78, 79, - 80, 77, 428, 421, 428, 428, 428, 78, 79, 80, - - 78, 79, 80, 77, 428, 428, 77, 78, 79, 80, - 77, 78, 79, 80, 78, 79, 80, 77, 78, 79, - 80, 428, 360, 423, 424, 428, 77, 428, 428, 425, - 78, 79, 80, 78, 79, 80, 426, 78, 79, 80, - 428, 77, 428, 428, 78, 79, 80, 77, 428, 428, - 428, 428, 428, 78, 79, 80, 427, 428, 428, 428, - 428, 360, 428, 428, 428, 428, 428, 428, 78, 79, - 80, 428, 428, 428, 78, 79, 80, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 48, 48, 48, 48, 48, 48, 48, 48, 48, - - 48, 48, 48, 48, 48, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 57, 428, 57, 428, 57, 428, 57, - 66, 428, 428, 66, 428, 66, 66, 66, 66, 66, - 76, 76, 428, 76, 76, 76, 76, 76, 76, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 131, 428, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - - 139, 428, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 148, 148, 148, 200, 428, 428, 428, - 428, 200, 200, 200, 203, 203, 203, 203, 203, 211, - 211, 211, 428, 428, 211, 262, 262, 262, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 7, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428 + 8, 19, 19, 19, 20, 21, 22, 19, 19, 23, + 19, 19, 24, 19, 19, 19, 19, 19, 19, 25, + 19, 19, 26, 27, 19, 28, 29, 30, 31, 32, + 33, 19, 34, 19, 35, 19, 36, 37, 19, 19, + 38, 39, 40, 41, 42, 19, 19, 8, 8, 43, + 44, 45, 50, 52, 50, 56, 56, 57, 57, 57, + 57, 57, 57, 57, 50, 72, 50, 76, 76, 266, + 58, 58, 267, 52, 266, 59, 64, 77, 402, 268, + + 65, 264, 264, 264, 264, 264, 264, 77, 215, 72, + 53, 77, 383, 58, 58, 60, 60, 60, 60, 60, + 60, 60, 81, 84, 78, 79, 80, 61, 62, 63, + 53, 67, 215, 61, 78, 79, 80, 205, 78, 79, + 80, 91, 91, 91, 91, 91, 91, 91, 214, 359, + 61, 62, 63, 268, 358, 215, 77, 61, 68, 69, + 70, 56, 141, 71, 71, 71, 71, 71, 71, 71, + 85, 323, 214, 72, 72, 205, 58, 322, 321, 215, + 268, 73, 73, 78, 79, 80, 320, 319, 72, 72, + 74, 86, 75, 90, 318, 87, 72, 72, 76, 58, + + 66, 275, 141, 77, 274, 73, 73, 273, 77, 205, + 88, 77, 72, 72, 74, 82, 82, 77, 89, 83, + 83, 83, 83, 83, 83, 83, 77, 91, 124, 107, + 78, 79, 80, 77, 100, 78, 79, 80, 78, 79, + 80, 77, 101, 103, 78, 79, 80, 216, 102, 77, + 76, 104, 212, 78, 79, 80, 105, 66, 211, 210, + 78, 79, 80, 141, 204, 200, 200, 77, 78, 79, + 80, 508, 77, 128, 199, 77, 78, 79, 80, 92, + 93, 94, 95, 114, 91, 96, 151, 150, 97, 109, + 108, 98, 77, 99, 78, 79, 80, 76, 77, 78, + + 79, 80, 78, 79, 80, 508, 77, 110, 111, 77, + 148, 147, 112, 66, 137, 115, 113, 77, 508, 78, + 79, 80, 77, 131, 508, 78, 79, 80, 129, 77, + 128, 116, 119, 78, 79, 80, 78, 79, 80, 120, + 118, 121, 117, 122, 78, 79, 80, 142, 123, 78, + 79, 80, 126, 125, 91, 106, 78, 79, 80, 133, + 133, 133, 133, 133, 133, 135, 135, 508, 55, 136, + 136, 136, 136, 136, 136, 136, 138, 138, 143, 508, + 139, 139, 139, 139, 139, 139, 139, 77, 134, 66, + 66, 66, 66, 66, 66, 66, 76, 76, 76, 76, + + 76, 77, 76, 76, 77, 144, 145, 146, 49, 49, + 77, 47, 76, 47, 78, 79, 80, 156, 153, 155, + 154, 157, 152, 508, 153, 77, 159, 508, 78, 79, + 80, 78, 79, 80, 158, 76, 77, 78, 79, 80, + 77, 153, 508, 154, 160, 508, 77, 508, 153, 77, + 508, 508, 78, 79, 80, 508, 77, 508, 508, 508, + 76, 158, 508, 78, 79, 80, 77, 78, 79, 80, + 508, 77, 163, 78, 79, 80, 78, 79, 80, 508, + 161, 508, 77, 78, 79, 80, 162, 508, 77, 169, + 508, 77, 508, 78, 79, 80, 164, 508, 78, 79, + + 80, 165, 508, 166, 77, 508, 167, 168, 77, 78, + 79, 80, 508, 508, 508, 78, 79, 80, 78, 79, + 80, 77, 508, 170, 77, 171, 508, 77, 508, 176, + 172, 78, 79, 80, 77, 78, 79, 80, 77, 508, + 508, 173, 174, 77, 175, 508, 77, 177, 78, 79, + 80, 78, 79, 80, 78, 79, 80, 77, 178, 179, + 77, 78, 79, 80, 180, 78, 79, 80, 77, 508, + 78, 79, 80, 78, 79, 80, 77, 508, 181, 77, + 184, 508, 77, 182, 78, 79, 80, 78, 79, 80, + 77, 183, 188, 185, 206, 78, 79, 80, 77, 508, + + 508, 77, 187, 78, 79, 80, 78, 79, 80, 78, + 79, 80, 186, 158, 77, 508, 189, 78, 79, 80, + 77, 207, 208, 209, 77, 78, 79, 80, 78, 79, + 80, 508, 77, 508, 508, 190, 508, 508, 508, 77, + 192, 78, 79, 80, 77, 508, 508, 78, 79, 80, + 191, 78, 79, 80, 77, 508, 508, 508, 194, 78, + 79, 80, 193, 77, 142, 508, 78, 79, 80, 195, + 77, 78, 79, 80, 508, 196, 77, 508, 200, 197, + 508, 78, 79, 80, 201, 201, 201, 201, 201, 201, + 78, 79, 80, 508, 198, 143, 508, 78, 79, 80, + + 508, 77, 508, 78, 79, 80, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 508, 508, 144, 145, 146, 203, 508, 63, 78, 79, + 80, 203, 139, 139, 139, 139, 139, 139, 139, 508, + 508, 508, 508, 508, 77, 508, 508, 217, 203, 77, + 63, 508, 508, 508, 508, 203, 139, 139, 139, 139, + 139, 139, 139, 141, 141, 141, 141, 141, 61, 221, + 63, 78, 79, 80, 61, 508, 78, 79, 80, 141, + 77, 508, 218, 508, 508, 77, 508, 508, 77, 508, + 223, 61, 219, 63, 77, 220, 508, 77, 61, 508, + + 508, 508, 141, 77, 222, 508, 77, 78, 79, 80, + 508, 225, 78, 79, 80, 78, 79, 80, 77, 508, + 508, 78, 79, 80, 78, 79, 80, 141, 508, 77, + 78, 79, 80, 78, 79, 80, 226, 77, 231, 224, + 77, 508, 227, 77, 508, 78, 79, 80, 77, 229, + 508, 232, 228, 508, 508, 77, 78, 79, 80, 77, + 508, 508, 233, 508, 78, 79, 80, 78, 79, 80, + 78, 79, 80, 230, 77, 78, 79, 80, 77, 508, + 508, 77, 78, 79, 80, 508, 78, 79, 80, 77, + 508, 234, 77, 508, 508, 235, 236, 77, 238, 508, + + 508, 78, 79, 80, 77, 78, 79, 80, 78, 79, + 80, 77, 508, 237, 508, 508, 78, 79, 80, 78, + 79, 80, 239, 77, 78, 79, 80, 240, 77, 242, + 241, 78, 79, 80, 77, 247, 508, 243, 78, 79, + 80, 77, 508, 508, 77, 508, 245, 508, 508, 508, + 78, 79, 80, 77, 244, 78, 79, 80, 508, 508, + 77, 78, 79, 80, 508, 508, 248, 77, 78, 79, + 80, 78, 79, 80, 246, 249, 77, 508, 250, 77, + 78, 79, 80, 222, 508, 77, 508, 78, 79, 80, + 508, 253, 77, 508, 78, 79, 80, 77, 508, 508, + + 508, 251, 252, 78, 79, 80, 78, 79, 80, 214, + 254, 508, 78, 79, 80, 508, 215, 77, 508, 78, + 79, 80, 77, 508, 78, 79, 80, 255, 257, 77, + 508, 508, 77, 214, 508, 77, 508, 508, 256, 77, + 215, 142, 508, 260, 78, 79, 80, 508, 508, 78, + 79, 80, 258, 508, 262, 259, 78, 79, 80, 78, + 79, 80, 78, 79, 80, 77, 78, 79, 80, 77, + 508, 508, 269, 508, 508, 261, 77, 508, 508, 263, + 205, 205, 205, 205, 205, 205, 205, 77, 276, 508, + 77, 508, 78, 79, 80, 77, 78, 79, 80, 270, + + 271, 272, 279, 78, 79, 80, 77, 277, 508, 278, + 508, 77, 508, 508, 78, 79, 80, 78, 79, 80, + 77, 280, 78, 79, 80, 281, 508, 508, 508, 77, + 508, 508, 77, 78, 79, 80, 77, 508, 78, 79, + 80, 283, 282, 77, 508, 508, 508, 78, 79, 80, + 508, 508, 508, 284, 77, 508, 78, 79, 80, 78, + 79, 80, 77, 78, 79, 80, 285, 77, 508, 508, + 78, 79, 80, 77, 286, 288, 77, 508, 508, 289, + 77, 78, 79, 80, 508, 77, 291, 287, 508, 78, + 79, 80, 508, 77, 78, 79, 80, 508, 290, 292, + + 78, 79, 80, 78, 79, 80, 77, 78, 79, 80, + 77, 294, 78, 79, 80, 77, 508, 293, 77, 508, + 78, 79, 80, 508, 295, 77, 297, 508, 508, 77, + 508, 508, 77, 78, 79, 80, 77, 78, 79, 80, + 296, 299, 78, 79, 80, 78, 79, 80, 302, 77, + 298, 508, 78, 79, 80, 77, 78, 79, 80, 78, + 79, 80, 77, 78, 79, 80, 77, 508, 304, 77, + 303, 508, 508, 508, 77, 300, 78, 79, 80, 77, + 508, 508, 78, 79, 80, 301, 77, 508, 508, 78, + 79, 80, 77, 78, 79, 80, 78, 79, 80, 77, + + 306, 78, 79, 80, 305, 77, 78, 79, 80, 77, + 508, 508, 77, 78, 79, 80, 309, 312, 508, 78, + 79, 80, 508, 308, 77, 307, 78, 79, 80, 77, + 508, 508, 78, 79, 80, 311, 78, 79, 80, 78, + 79, 80, 77, 310, 508, 508, 77, 508, 313, 77, + 142, 78, 79, 80, 314, 508, 78, 79, 80, 508, + 508, 77, 315, 508, 77, 508, 317, 508, 508, 78, + 79, 80, 508, 78, 79, 80, 78, 79, 80, 316, + 508, 269, 268, 268, 268, 268, 268, 325, 78, 79, + 80, 78, 79, 80, 328, 77, 327, 508, 268, 508, + + 77, 324, 508, 77, 508, 508, 508, 77, 270, 271, + 272, 508, 77, 326, 508, 77, 508, 508, 508, 508, + 508, 268, 78, 79, 80, 508, 329, 78, 79, 80, + 78, 79, 80, 77, 78, 79, 80, 330, 508, 78, + 79, 80, 78, 79, 80, 77, 268, 331, 77, 333, + 332, 77, 508, 508, 77, 508, 508, 77, 335, 508, + 78, 79, 80, 334, 77, 508, 336, 77, 508, 508, + 508, 508, 78, 79, 80, 78, 79, 80, 78, 79, + 80, 78, 79, 80, 78, 79, 80, 337, 77, 508, + 508, 78, 79, 80, 78, 79, 80, 77, 508, 508, + + 77, 508, 508, 338, 77, 508, 508, 508, 77, 339, + 342, 341, 77, 508, 508, 78, 79, 80, 77, 508, + 340, 77, 508, 508, 78, 79, 80, 78, 79, 80, + 343, 78, 79, 80, 77, 78, 79, 80, 77, 78, + 79, 80, 344, 77, 346, 78, 79, 80, 78, 79, + 80, 347, 77, 345, 508, 508, 508, 508, 348, 77, + 508, 78, 79, 80, 508, 78, 79, 80, 327, 77, + 78, 79, 80, 508, 77, 508, 327, 77, 508, 78, + 79, 80, 508, 349, 77, 352, 78, 79, 80, 353, + 508, 77, 508, 508, 77, 508, 78, 79, 80, 350, + + 77, 78, 79, 80, 78, 79, 80, 508, 77, 508, + 508, 78, 79, 80, 351, 77, 508, 508, 78, 79, + 80, 78, 79, 80, 77, 508, 508, 78, 79, 80, + 77, 508, 354, 508, 77, 78, 79, 80, 77, 508, + 508, 77, 78, 79, 80, 508, 77, 360, 355, 357, + 77, 78, 79, 80, 356, 361, 77, 78, 79, 80, + 77, 78, 79, 80, 508, 78, 79, 80, 78, 79, + 80, 508, 77, 78, 79, 80, 362, 78, 79, 80, + 77, 508, 363, 78, 79, 80, 77, 78, 79, 80, + 364, 365, 77, 508, 367, 77, 508, 508, 77, 78, + + 79, 80, 77, 508, 368, 508, 77, 78, 79, 80, + 370, 508, 366, 78, 79, 80, 365, 508, 77, 78, + 79, 80, 78, 79, 80, 78, 79, 80, 77, 78, + 79, 80, 77, 78, 79, 80, 77, 369, 365, 77, + 508, 508, 77, 508, 374, 78, 79, 80, 371, 508, + 77, 365, 372, 508, 508, 78, 79, 80, 77, 78, + 79, 80, 373, 78, 79, 80, 78, 79, 80, 78, + 79, 80, 77, 508, 508, 375, 77, 78, 79, 80, + 508, 77, 508, 508, 77, 78, 79, 80, 77, 508, + 376, 377, 77, 508, 508, 508, 508, 77, 508, 78, + + 79, 80, 378, 78, 79, 80, 77, 508, 78, 79, + 80, 78, 79, 80, 77, 78, 79, 80, 379, 78, + 79, 80, 77, 508, 78, 79, 80, 77, 380, 508, + 508, 508, 77, 78, 79, 80, 508, 508, 77, 508, + 508, 78, 79, 80, 382, 386, 77, 381, 508, 78, + 79, 80, 384, 219, 78, 79, 80, 77, 508, 78, + 79, 80, 77, 508, 508, 78, 79, 80, 77, 508, + 508, 77, 508, 78, 79, 80, 77, 508, 387, 77, + 385, 508, 388, 508, 78, 79, 80, 508, 77, 78, + 79, 80, 508, 389, 391, 78, 79, 80, 78, 79, + + 80, 77, 508, 78, 79, 80, 78, 79, 80, 77, + 508, 508, 77, 390, 392, 78, 79, 80, 393, 77, + 508, 508, 508, 508, 508, 77, 508, 508, 78, 79, + 80, 365, 508, 77, 508, 508, 78, 79, 80, 78, + 79, 80, 508, 394, 77, 395, 78, 79, 80, 508, + 365, 77, 78, 79, 80, 77, 396, 508, 77, 508, + 78, 79, 80, 77, 508, 508, 508, 508, 77, 508, + 397, 78, 79, 80, 400, 77, 508, 508, 78, 79, + 80, 398, 78, 79, 80, 78, 79, 80, 77, 404, + 78, 79, 80, 399, 401, 78, 79, 80, 77, 508, + + 508, 77, 78, 79, 80, 403, 406, 77, 219, 508, + 508, 508, 508, 77, 508, 78, 79, 80, 77, 508, + 508, 508, 77, 508, 508, 78, 79, 80, 78, 79, + 80, 508, 77, 508, 78, 79, 80, 405, 407, 77, + 78, 79, 80, 408, 77, 78, 79, 80, 77, 78, + 79, 80, 77, 508, 508, 410, 77, 409, 412, 78, + 79, 80, 411, 77, 508, 508, 78, 79, 80, 77, + 508, 78, 79, 80, 77, 78, 79, 80, 413, 78, + 79, 80, 77, 78, 79, 80, 508, 77, 414, 508, + 78, 79, 80, 396, 77, 508, 78, 79, 80, 404, + + 77, 78, 79, 80, 77, 508, 508, 77, 508, 78, + 79, 80, 77, 416, 78, 79, 80, 419, 417, 415, + 77, 78, 79, 80, 77, 508, 365, 78, 79, 80, + 365, 78, 79, 80, 78, 79, 80, 77, 508, 78, + 79, 80, 508, 418, 77, 508, 508, 78, 79, 80, + 421, 78, 79, 80, 425, 422, 77, 420, 508, 77, + 508, 508, 77, 423, 78, 79, 80, 508, 508, 508, + 77, 78, 79, 80, 77, 508, 508, 77, 508, 365, + 508, 424, 508, 78, 79, 80, 78, 79, 80, 78, + 79, 80, 77, 365, 508, 431, 77, 78, 79, 80, + + 77, 78, 79, 80, 78, 79, 80, 77, 508, 508, + 427, 508, 77, 508, 426, 365, 508, 508, 77, 78, + 79, 80, 428, 78, 79, 80, 77, 78, 79, 80, + 508, 77, 508, 508, 78, 79, 80, 77, 508, 78, + 79, 80, 430, 432, 429, 78, 79, 80, 508, 508, + 77, 508, 508, 78, 79, 80, 433, 508, 78, 79, + 80, 77, 508, 508, 78, 79, 80, 77, 436, 435, + 77, 508, 508, 77, 508, 508, 508, 78, 79, 80, + 77, 434, 508, 508, 77, 365, 439, 508, 78, 79, + 80, 77, 508, 508, 78, 79, 80, 78, 79, 80, + + 78, 79, 80, 365, 508, 438, 77, 78, 79, 80, + 77, 78, 79, 80, 437, 77, 508, 508, 78, 79, + 80, 508, 77, 508, 508, 508, 77, 508, 440, 508, + 508, 77, 508, 78, 79, 80, 441, 78, 79, 80, + 442, 443, 78, 79, 80, 77, 446, 508, 77, 78, + 79, 80, 77, 78, 79, 80, 77, 444, 78, 79, + 80, 77, 448, 447, 77, 508, 508, 445, 452, 449, + 508, 77, 78, 79, 80, 78, 79, 80, 77, 78, + 79, 80, 450, 78, 79, 80, 451, 508, 78, 79, + 80, 78, 79, 80, 453, 77, 508, 508, 78, 79, + + 80, 77, 508, 508, 77, 78, 79, 80, 77, 365, + 508, 455, 508, 508, 77, 508, 508, 508, 77, 508, + 459, 456, 78, 79, 80, 454, 77, 508, 78, 79, + 80, 78, 79, 80, 77, 78, 79, 80, 457, 77, + 460, 78, 79, 80, 77, 78, 79, 80, 77, 508, + 508, 458, 508, 78, 79, 80, 464, 462, 77, 461, + 508, 78, 79, 80, 508, 77, 78, 79, 80, 77, + 469, 78, 79, 80, 77, 78, 79, 80, 508, 463, + 77, 466, 508, 465, 77, 78, 79, 80, 508, 467, + 468, 77, 78, 79, 80, 77, 78, 79, 80, 472, + + 77, 78, 79, 80, 77, 508, 508, 78, 79, 80, + 470, 78, 79, 80, 508, 508, 508, 77, 78, 79, + 80, 77, 78, 79, 80, 471, 77, 78, 79, 80, + 473, 78, 79, 80, 77, 474, 476, 475, 77, 508, + 508, 77, 508, 508, 78, 79, 80, 477, 78, 79, + 80, 77, 508, 78, 79, 80, 479, 77, 478, 484, + 508, 78, 79, 80, 77, 78, 79, 80, 78, 79, + 80, 77, 481, 508, 480, 482, 77, 508, 78, 79, + 80, 77, 485, 483, 78, 79, 80, 77, 508, 508, + 508, 78, 79, 80, 508, 508, 508, 77, 78, 79, + + 80, 490, 77, 78, 79, 80, 508, 77, 78, 79, + 80, 486, 487, 77, 78, 79, 80, 508, 508, 77, + 492, 489, 508, 77, 78, 79, 80, 488, 77, 78, + 79, 80, 508, 77, 78, 79, 80, 491, 493, 77, + 78, 79, 80, 508, 508, 77, 78, 79, 80, 496, + 78, 79, 80, 494, 77, 78, 79, 80, 77, 508, + 78, 79, 80, 508, 497, 495, 78, 79, 80, 77, + 508, 508, 78, 79, 80, 77, 508, 508, 508, 499, + 77, 78, 79, 80, 508, 78, 79, 80, 77, 498, + 500, 77, 503, 508, 77, 508, 78, 79, 80, 365, + + 508, 77, 78, 79, 80, 501, 77, 78, 79, 80, + 77, 504, 508, 508, 502, 78, 79, 80, 78, 79, + 80, 78, 79, 80, 77, 508, 507, 77, 78, 79, + 80, 77, 505, 78, 79, 80, 508, 78, 79, 80, + 508, 506, 508, 508, 508, 508, 365, 508, 508, 508, + 508, 78, 79, 80, 78, 79, 80, 508, 78, 79, + 80, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + + 51, 51, 51, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 57, 508, 57, + 508, 57, 508, 57, 66, 508, 508, 66, 508, 66, + 66, 66, 66, 66, 76, 76, 508, 76, 76, 76, + 76, 76, 76, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 132, 508, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 140, 508, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, + + 141, 141, 141, 141, 141, 141, 141, 149, 149, 149, + 202, 508, 508, 508, 508, 202, 202, 202, 205, 205, + 205, 205, 205, 213, 213, 213, 508, 508, 213, 265, + 265, 265, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 7, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508 } ; -static yyconst flex_int16_t yy_chk[2527] = +static const flex_int16_t yy_chk[3015] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -893,285 +1191,339 @@ static yyconst flex_int16_t yy_chk[2527] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 9, 11, - 9, 13, 14, 13, 13, 13, 13, 13, 13, 13, - 50, 395, 50, 73, 16, 377, 13, 14, 16, 19, - 14, 354, 51, 82, 82, 202, 25, 353, 202, 20, - - 319, 212, 11, 25, 73, 13, 14, 15, 15, 15, - 15, 15, 15, 15, 20, 16, 19, 19, 19, 15, - 15, 15, 212, 318, 15, 51, 20, 20, 20, 317, - 25, 25, 25, 316, 272, 22, 271, 270, 15, 15, - 15, 269, 16, 16, 16, 15, 17, 22, 17, 17, - 17, 17, 17, 17, 17, 268, 23, 267, 17, 264, - 262, 17, 22, 22, 22, 17, 261, 214, 210, 17, - 23, 17, 209, 17, 208, 24, 207, 17, 24, 206, - 17, 205, 197, 23, 23, 23, 17, 150, 24, 149, - 24, 28, 147, 17, 146, 17, 21, 21, 24, 145, - - 21, 21, 21, 21, 21, 21, 21, 26, 26, 26, - 26, 26, 26, 26, 28, 24, 24, 24, 28, 28, - 28, 29, 144, 143, 136, 133, 21, 131, 127, 126, - 29, 125, 124, 80, 79, 78, 29, 71, 70, 69, - 32, 68, 59, 57, 54, 33, 53, 47, 29, 29, - 29, 34, 32, 21, 21, 21, 27, 27, 27, 27, - 30, 27, 30, 33, 27, 34, 27, 32, 32, 32, - 30, 27, 33, 33, 33, 30, 35, 46, 34, 34, - 34, 37, 45, 44, 36, 43, 36, 30, 30, 30, - 36, 35, 76, 31, 36, 38, 18, 37, 27, 27, - - 27, 38, 40, 35, 35, 35, 39, 12, 37, 37, - 37, 36, 36, 36, 42, 39, 42, 7, 6, 76, - 76, 76, 38, 38, 38, 40, 39, 5, 4, 40, - 40, 40, 3, 39, 39, 39, 41, 0, 0, 41, - 0, 42, 42, 42, 0, 0, 41, 0, 41, 0, - 41, 0, 0, 66, 0, 41, 55, 55, 55, 55, - 55, 55, 0, 41, 41, 41, 58, 58, 0, 0, - 58, 58, 58, 58, 58, 58, 58, 0, 62, 62, - 66, 55, 62, 62, 62, 62, 62, 62, 62, 67, - 67, 67, 67, 67, 67, 67, 81, 0, 0, 74, - - 77, 77, 77, 77, 77, 0, 74, 66, 66, 66, - 74, 84, 83, 83, 85, 0, 77, 81, 74, 0, - 87, 85, 0, 81, 81, 81, 84, 74, 83, 87, - 83, 0, 86, 83, 74, 77, 86, 88, 84, 84, - 84, 85, 85, 85, 88, 0, 90, 83, 0, 83, - 89, 0, 0, 0, 83, 90, 87, 87, 87, 91, - 77, 0, 89, 86, 86, 86, 92, 0, 0, 0, - 93, 88, 88, 88, 0, 92, 93, 89, 89, 89, - 0, 92, 90, 90, 90, 99, 91, 91, 91, 94, - 0, 0, 95, 92, 92, 92, 96, 93, 93, 93, - - 0, 0, 95, 94, 95, 99, 100, 95, 100, 102, - 0, 97, 99, 99, 99, 96, 94, 94, 94, 95, - 95, 95, 98, 96, 96, 96, 97, 0, 0, 102, - 0, 98, 101, 100, 100, 100, 102, 102, 102, 103, - 0, 97, 98, 98, 104, 101, 0, 0, 105, 98, - 98, 98, 103, 97, 97, 97, 0, 0, 0, 101, - 101, 101, 0, 106, 0, 104, 103, 103, 103, 105, - 107, 104, 104, 104, 108, 105, 105, 105, 106, 109, - 0, 0, 110, 0, 0, 107, 0, 0, 0, 0, - 106, 106, 106, 109, 108, 111, 110, 107, 107, 107, - - 112, 108, 108, 108, 0, 115, 109, 109, 109, 110, - 110, 110, 112, 0, 113, 111, 113, 114, 0, 114, - 115, 116, 111, 111, 111, 0, 119, 112, 112, 112, - 0, 117, 115, 115, 115, 0, 0, 0, 118, 116, - 119, 113, 113, 113, 114, 114, 114, 117, 116, 116, - 116, 121, 0, 119, 119, 119, 120, 0, 117, 117, - 117, 118, 0, 121, 122, 118, 118, 118, 123, 0, - 0, 120, 0, 122, 0, 0, 0, 0, 121, 121, - 121, 0, 0, 120, 120, 120, 123, 0, 0, 0, - 0, 122, 122, 122, 132, 123, 123, 123, 0, 0, - - 132, 132, 132, 132, 132, 132, 134, 134, 134, 134, - 134, 134, 134, 135, 135, 135, 135, 135, 135, 135, - 140, 141, 0, 0, 0, 135, 0, 135, 0, 0, - 135, 137, 137, 137, 137, 137, 137, 137, 0, 148, - 0, 0, 0, 148, 135, 0, 135, 140, 141, 141, - 141, 135, 138, 138, 138, 138, 138, 138, 138, 151, - 148, 0, 151, 0, 138, 0, 138, 148, 152, 138, - 0, 153, 0, 0, 140, 140, 140, 142, 142, 142, - 142, 142, 154, 138, 154, 138, 151, 151, 151, 157, - 138, 156, 159, 142, 155, 152, 152, 152, 153, 153, - - 153, 155, 159, 0, 155, 0, 156, 0, 0, 154, - 154, 154, 142, 158, 0, 0, 157, 157, 157, 162, - 158, 155, 155, 155, 160, 0, 162, 161, 0, 159, - 159, 159, 161, 156, 156, 156, 0, 142, 163, 0, - 158, 158, 158, 163, 165, 160, 162, 162, 162, 164, - 165, 160, 160, 160, 161, 161, 161, 166, 168, 0, - 170, 164, 167, 0, 168, 163, 163, 163, 169, 167, - 0, 165, 165, 165, 0, 166, 164, 164, 164, 0, - 169, 170, 0, 172, 166, 166, 166, 170, 170, 170, - 171, 168, 168, 168, 173, 0, 167, 167, 167, 172, - - 173, 0, 174, 0, 0, 171, 0, 169, 169, 169, - 172, 172, 172, 176, 0, 176, 175, 171, 171, 171, - 174, 173, 173, 173, 0, 0, 0, 177, 0, 174, - 174, 174, 175, 177, 178, 0, 0, 178, 179, 0, - 176, 176, 176, 175, 175, 175, 180, 0, 180, 181, - 0, 179, 0, 0, 177, 177, 177, 0, 182, 0, - 183, 178, 178, 178, 184, 179, 179, 179, 183, 186, - 181, 184, 0, 180, 180, 180, 181, 181, 181, 182, - 185, 0, 187, 0, 0, 182, 186, 183, 183, 183, - 0, 184, 184, 184, 187, 185, 186, 186, 186, 185, - - 188, 0, 0, 0, 189, 0, 182, 182, 182, 187, - 187, 187, 0, 190, 189, 0, 191, 0, 188, 190, - 193, 0, 185, 185, 185, 189, 192, 188, 188, 188, - 0, 189, 189, 189, 193, 203, 191, 195, 0, 0, - 190, 190, 190, 191, 191, 191, 192, 193, 193, 193, - 194, 0, 195, 192, 192, 192, 0, 196, 0, 211, - 194, 0, 203, 211, 195, 195, 195, 196, 199, 199, - 199, 199, 199, 199, 0, 0, 215, 194, 194, 194, - 211, 216, 0, 0, 196, 196, 196, 211, 215, 203, - 203, 203, 204, 204, 204, 204, 204, 204, 204, 217, - - 219, 216, 218, 215, 215, 215, 220, 0, 216, 216, - 216, 221, 0, 0, 219, 0, 218, 0, 0, 221, - 0, 0, 222, 0, 0, 224, 217, 217, 217, 218, - 218, 218, 223, 220, 220, 220, 222, 224, 223, 0, - 0, 219, 219, 219, 0, 225, 221, 221, 221, 222, - 222, 222, 224, 224, 224, 225, 226, 0, 0, 223, - 223, 223, 227, 0, 0, 228, 0, 0, 226, 229, - 0, 0, 225, 225, 225, 229, 226, 230, 228, 0, - 0, 0, 227, 226, 226, 226, 235, 0, 0, 227, - 227, 227, 228, 228, 228, 230, 229, 229, 229, 231, - - 238, 0, 0, 232, 230, 230, 230, 233, 0, 231, - 232, 234, 0, 235, 235, 235, 236, 234, 0, 238, - 0, 0, 237, 0, 0, 233, 231, 231, 231, 241, - 232, 232, 232, 242, 233, 233, 233, 237, 234, 234, - 234, 239, 0, 236, 236, 236, 238, 238, 238, 237, - 237, 237, 240, 242, 244, 239, 241, 241, 241, 243, - 242, 242, 242, 245, 240, 0, 246, 0, 239, 239, - 239, 245, 248, 0, 0, 243, 244, 248, 0, 240, - 240, 240, 247, 0, 0, 249, 243, 243, 243, 250, - 245, 245, 245, 246, 246, 246, 247, 0, 0, 248, - - 248, 248, 251, 244, 244, 244, 249, 252, 0, 0, - 0, 253, 249, 249, 249, 253, 250, 250, 250, 0, - 256, 252, 251, 247, 247, 247, 254, 0, 0, 251, - 251, 251, 265, 258, 252, 252, 252, 255, 253, 253, - 253, 256, 0, 255, 257, 254, 258, 256, 0, 259, - 0, 0, 257, 254, 254, 254, 260, 0, 260, 265, - 258, 258, 258, 0, 255, 255, 255, 259, 256, 256, - 256, 257, 257, 257, 273, 0, 259, 259, 259, 0, - 273, 0, 0, 260, 260, 260, 265, 265, 265, 266, - 266, 266, 266, 266, 274, 276, 0, 0, 275, 0, - - 277, 273, 273, 273, 274, 266, 0, 276, 275, 0, - 277, 0, 0, 0, 279, 0, 0, 278, 279, 0, - 0, 0, 0, 0, 266, 275, 275, 275, 278, 0, - 0, 274, 274, 274, 276, 276, 276, 277, 277, 277, - 0, 279, 279, 279, 278, 278, 278, 0, 280, 266, - 280, 281, 282, 281, 282, 0, 0, 283, 0, 0, - 284, 0, 0, 283, 284, 285, 0, 285, 0, 0, - 286, 0, 0, 0, 0, 280, 280, 280, 281, 281, - 281, 282, 282, 282, 283, 283, 283, 284, 284, 284, - 286, 287, 285, 285, 285, 288, 0, 286, 286, 286, - - 0, 289, 0, 0, 0, 292, 287, 288, 289, 290, - 0, 290, 0, 291, 0, 0, 294, 0, 287, 287, - 287, 295, 288, 288, 288, 296, 292, 295, 289, 289, - 289, 291, 292, 292, 292, 294, 290, 290, 290, 297, - 291, 291, 291, 294, 294, 294, 298, 0, 295, 295, - 295, 299, 296, 296, 296, 300, 0, 299, 297, 0, - 0, 301, 0, 0, 302, 0, 0, 300, 301, 0, - 302, 303, 0, 298, 298, 298, 304, 0, 299, 299, - 299, 305, 0, 306, 304, 297, 297, 297, 301, 301, - 301, 302, 302, 302, 300, 300, 300, 307, 303, 303, - - 303, 305, 306, 304, 304, 304, 308, 309, 305, 305, - 305, 310, 0, 0, 0, 309, 0, 311, 0, 0, - 0, 312, 320, 0, 307, 307, 307, 311, 308, 306, - 306, 306, 320, 0, 309, 309, 309, 323, 310, 310, - 310, 312, 322, 324, 311, 311, 311, 324, 312, 312, - 312, 313, 0, 0, 313, 308, 308, 308, 321, 320, - 320, 320, 322, 325, 323, 323, 323, 0, 325, 322, - 322, 322, 321, 326, 324, 324, 324, 328, 313, 313, - 313, 0, 0, 327, 0, 321, 321, 321, 329, 0, - 329, 328, 326, 332, 0, 325, 325, 325, 0, 331, - - 326, 326, 326, 327, 328, 328, 328, 330, 331, 0, - 327, 327, 327, 332, 333, 329, 329, 329, 333, 335, - 332, 332, 332, 334, 0, 330, 331, 331, 331, 337, - 0, 335, 336, 0, 330, 330, 330, 337, 0, 334, - 339, 333, 333, 333, 336, 340, 335, 335, 335, 341, - 334, 334, 334, 343, 339, 340, 337, 337, 337, 336, - 336, 336, 338, 0, 0, 338, 344, 339, 339, 339, - 345, 343, 340, 340, 340, 346, 341, 341, 341, 348, - 343, 343, 343, 351, 0, 0, 349, 0, 0, 338, - 338, 338, 349, 344, 344, 344, 346, 345, 345, 345, - - 350, 0, 346, 346, 346, 352, 348, 348, 348, 355, - 351, 351, 351, 349, 349, 349, 0, 352, 356, 0, - 350, 357, 358, 355, 360, 356, 0, 350, 350, 350, - 359, 0, 352, 352, 352, 358, 355, 355, 355, 0, - 359, 362, 0, 0, 357, 356, 356, 356, 357, 357, - 357, 360, 360, 360, 361, 362, 0, 359, 359, 359, - 361, 363, 358, 358, 358, 364, 0, 0, 362, 362, - 362, 364, 365, 363, 0, 0, 0, 365, 366, 0, - 0, 361, 361, 361, 366, 367, 0, 0, 363, 363, - 363, 367, 364, 364, 364, 0, 368, 0, 0, 365, - - 365, 365, 368, 369, 0, 366, 366, 366, 372, 0, - 0, 370, 367, 367, 367, 369, 370, 0, 371, 0, - 0, 375, 0, 368, 368, 368, 373, 375, 0, 0, - 369, 369, 369, 371, 374, 372, 372, 372, 370, 370, - 370, 0, 0, 0, 373, 371, 371, 371, 375, 375, - 375, 376, 374, 373, 373, 373, 380, 376, 378, 0, - 0, 374, 374, 374, 379, 378, 0, 383, 0, 0, - 380, 379, 382, 383, 0, 0, 381, 0, 376, 376, - 376, 382, 0, 0, 0, 378, 378, 378, 0, 0, - 384, 379, 379, 379, 383, 383, 383, 380, 380, 380, - - 381, 0, 385, 381, 381, 381, 386, 0, 382, 382, - 382, 384, 0, 386, 387, 0, 0, 384, 384, 384, - 385, 388, 0, 0, 389, 0, 0, 0, 0, 385, - 385, 385, 387, 386, 386, 386, 388, 392, 0, 0, - 390, 387, 387, 387, 396, 0, 0, 397, 388, 388, - 388, 389, 389, 389, 390, 391, 0, 402, 393, 0, - 0, 391, 394, 393, 392, 392, 392, 390, 390, 390, - 0, 396, 396, 396, 397, 397, 397, 400, 403, 0, - 402, 394, 391, 391, 391, 393, 393, 393, 398, 394, - 394, 394, 399, 0, 398, 401, 400, 0, 399, 0, - - 403, 401, 0, 0, 400, 400, 400, 402, 402, 402, - 404, 0, 407, 0, 405, 398, 398, 398, 405, 399, - 399, 399, 401, 401, 401, 406, 411, 403, 403, 403, - 404, 407, 0, 0, 0, 0, 408, 404, 404, 404, - 409, 405, 405, 405, 406, 0, 0, 410, 0, 0, - 411, 0, 406, 406, 406, 408, 0, 0, 407, 407, - 407, 412, 409, 408, 408, 408, 410, 409, 409, 409, - 413, 412, 414, 420, 410, 410, 410, 411, 411, 411, - 416, 413, 418, 0, 418, 420, 416, 417, 412, 412, - 412, 414, 0, 417, 0, 0, 0, 413, 413, 413, - - 420, 420, 420, 421, 0, 0, 423, 416, 416, 416, - 424, 418, 418, 418, 417, 417, 417, 422, 414, 414, - 414, 0, 421, 422, 423, 0, 425, 0, 0, 424, - 421, 421, 421, 423, 423, 423, 425, 424, 424, 424, - 0, 426, 0, 0, 422, 422, 422, 427, 0, 0, - 0, 0, 0, 425, 425, 425, 426, 0, 0, 0, - 0, 427, 0, 0, 0, 0, 0, 0, 426, 426, - 426, 0, 0, 0, 427, 427, 427, 429, 429, 429, - 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, - 429, 430, 430, 430, 430, 430, 430, 430, 430, 430, - - 430, 430, 430, 430, 430, 431, 431, 431, 431, 431, - 431, 431, 431, 431, 431, 431, 431, 431, 431, 432, - 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - 432, 432, 432, 433, 0, 433, 0, 433, 0, 433, - 434, 0, 0, 434, 0, 434, 434, 434, 434, 434, - 435, 435, 0, 435, 435, 435, 435, 435, 435, 436, - 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, - 436, 436, 436, 437, 437, 437, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 438, 0, 438, 438, - 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, - - 439, 0, 439, 439, 439, 439, 439, 439, 439, 439, - 439, 439, 439, 439, 440, 440, 440, 440, 440, 440, - 440, 440, 440, 441, 441, 441, 442, 0, 0, 0, - 0, 442, 442, 442, 443, 443, 443, 443, 443, 444, - 444, 444, 0, 0, 444, 445, 445, 445, 446, 446, - 446, 446, 446, 446, 446, 446, 446, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 428, 428, 428, 428 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 9, 11, 9, 13, 14, 13, 13, 13, + 13, 13, 13, 13, 50, 73, 50, 82, 82, 204, + 13, 14, 204, 51, 402, 14, 16, 19, 383, 359, + + 16, 201, 201, 201, 201, 201, 201, 20, 214, 73, + 11, 22, 358, 13, 14, 15, 15, 15, 15, 15, + 15, 15, 20, 22, 19, 19, 19, 15, 15, 15, + 51, 16, 214, 15, 20, 20, 20, 323, 22, 22, + 22, 26, 26, 26, 26, 26, 26, 26, 149, 322, + 15, 15, 15, 321, 320, 149, 23, 15, 16, 16, + 16, 17, 275, 17, 17, 17, 17, 17, 17, 17, + 23, 274, 149, 17, 74, 273, 17, 272, 271, 149, + 270, 17, 74, 23, 23, 23, 267, 265, 17, 74, + 17, 24, 17, 25, 264, 24, 17, 74, 216, 17, + + 212, 211, 210, 25, 209, 17, 74, 208, 24, 207, + 24, 28, 17, 74, 17, 21, 21, 32, 24, 21, + 21, 21, 21, 21, 21, 21, 42, 199, 42, 32, + 25, 25, 25, 29, 28, 24, 24, 24, 28, 28, + 28, 30, 29, 30, 32, 32, 32, 151, 29, 21, + 150, 30, 148, 42, 42, 42, 30, 147, 146, 145, + 29, 29, 29, 144, 137, 134, 132, 37, 30, 30, + 30, 128, 33, 127, 126, 34, 21, 21, 21, 27, + 27, 27, 27, 37, 125, 27, 80, 79, 27, 34, + 33, 27, 35, 27, 37, 37, 37, 78, 27, 33, + + 33, 33, 34, 34, 34, 71, 36, 35, 36, 38, + 70, 69, 36, 68, 59, 38, 36, 40, 57, 35, + 35, 35, 39, 54, 53, 27, 27, 27, 47, 41, + 46, 39, 41, 36, 36, 36, 38, 38, 38, 41, + 40, 41, 39, 41, 40, 40, 40, 66, 41, 39, + 39, 39, 45, 44, 43, 31, 41, 41, 41, 55, + 55, 55, 55, 55, 55, 58, 58, 18, 12, 58, + 58, 58, 58, 58, 58, 58, 62, 62, 66, 7, + 62, 62, 62, 62, 62, 62, 62, 76, 55, 67, + 67, 67, 67, 67, 67, 67, 77, 77, 77, 77, + + 77, 81, 83, 83, 84, 66, 66, 66, 6, 5, + 85, 4, 77, 3, 76, 76, 76, 85, 83, 84, + 83, 86, 81, 0, 83, 86, 88, 0, 81, 81, + 81, 84, 84, 84, 87, 77, 88, 85, 85, 85, + 91, 83, 0, 83, 90, 0, 87, 0, 83, 89, + 0, 0, 86, 86, 86, 0, 90, 0, 0, 0, + 77, 89, 0, 88, 88, 88, 93, 91, 91, 91, + 0, 92, 93, 87, 87, 87, 89, 89, 89, 0, + 92, 0, 94, 90, 90, 90, 92, 0, 96, 97, + 0, 95, 0, 93, 93, 93, 94, 0, 92, 92, + + 92, 95, 0, 95, 98, 0, 95, 96, 97, 94, + 94, 94, 0, 0, 0, 96, 96, 96, 95, 95, + 95, 99, 0, 97, 100, 98, 0, 101, 0, 101, + 99, 98, 98, 98, 102, 97, 97, 97, 103, 0, + 0, 99, 99, 105, 100, 0, 104, 102, 99, 99, + 99, 100, 100, 100, 101, 101, 101, 106, 103, 104, + 109, 102, 102, 102, 105, 103, 103, 103, 107, 0, + 105, 105, 105, 104, 104, 104, 108, 0, 106, 110, + 109, 0, 112, 107, 106, 106, 106, 109, 109, 109, + 114, 108, 114, 110, 142, 107, 107, 107, 111, 0, + + 0, 113, 112, 108, 108, 108, 110, 110, 110, 112, + 112, 112, 111, 113, 115, 0, 115, 114, 114, 114, + 116, 142, 142, 142, 118, 111, 111, 111, 113, 113, + 113, 0, 117, 0, 0, 116, 0, 0, 0, 119, + 118, 115, 115, 115, 120, 0, 0, 116, 116, 116, + 117, 118, 118, 118, 121, 0, 0, 0, 120, 117, + 117, 117, 119, 122, 141, 0, 119, 119, 119, 121, + 123, 120, 120, 120, 0, 122, 124, 0, 133, 123, + 0, 121, 121, 121, 133, 133, 133, 133, 133, 133, + 122, 122, 122, 0, 124, 141, 0, 123, 123, 123, + + 0, 153, 0, 124, 124, 124, 135, 135, 135, 135, + 135, 135, 135, 136, 136, 136, 136, 136, 136, 136, + 0, 0, 141, 141, 141, 136, 0, 136, 153, 153, + 153, 136, 138, 138, 138, 138, 138, 138, 138, 0, + 0, 0, 0, 0, 152, 0, 0, 152, 136, 154, + 136, 0, 0, 0, 0, 136, 139, 139, 139, 139, + 139, 139, 139, 143, 143, 143, 143, 143, 139, 157, + 139, 152, 152, 152, 139, 0, 154, 154, 154, 143, + 155, 0, 155, 0, 0, 156, 0, 0, 157, 0, + 160, 139, 156, 139, 158, 156, 0, 159, 139, 0, + + 0, 0, 143, 160, 159, 0, 162, 155, 155, 155, + 0, 162, 156, 156, 156, 157, 157, 157, 161, 0, + 0, 158, 158, 158, 159, 159, 159, 143, 0, 163, + 160, 160, 160, 162, 162, 162, 163, 164, 168, 161, + 165, 0, 164, 166, 0, 161, 161, 161, 168, 166, + 0, 169, 165, 0, 0, 167, 163, 163, 163, 169, + 0, 0, 170, 0, 164, 164, 164, 165, 165, 165, + 166, 166, 166, 167, 172, 168, 168, 168, 170, 0, + 0, 173, 167, 167, 167, 0, 169, 169, 169, 171, + 0, 171, 175, 0, 0, 172, 173, 174, 175, 0, + + 0, 172, 172, 172, 176, 170, 170, 170, 173, 173, + 173, 177, 0, 174, 0, 0, 171, 171, 171, 175, + 175, 175, 176, 179, 174, 174, 174, 177, 178, 179, + 178, 176, 176, 176, 180, 184, 0, 180, 177, 177, + 177, 181, 0, 0, 182, 0, 182, 0, 0, 0, + 179, 179, 179, 183, 181, 178, 178, 178, 0, 0, + 184, 180, 180, 180, 0, 0, 184, 185, 181, 181, + 181, 182, 182, 182, 183, 185, 186, 0, 187, 189, + 183, 183, 183, 186, 0, 188, 0, 184, 184, 184, + 0, 189, 190, 0, 185, 185, 185, 187, 0, 0, + + 0, 187, 188, 186, 186, 186, 189, 189, 189, 213, + 190, 0, 188, 188, 188, 0, 213, 191, 0, 190, + 190, 190, 192, 0, 187, 187, 187, 191, 192, 195, + 0, 0, 193, 213, 0, 194, 0, 0, 191, 197, + 213, 205, 0, 195, 191, 191, 191, 0, 0, 192, + 192, 192, 193, 0, 197, 194, 195, 195, 195, 193, + 193, 193, 194, 194, 194, 196, 197, 197, 197, 198, + 0, 0, 205, 0, 0, 196, 217, 0, 0, 198, + 206, 206, 206, 206, 206, 206, 206, 218, 217, 0, + 219, 0, 196, 196, 196, 220, 198, 198, 198, 205, + + 205, 205, 221, 217, 217, 217, 222, 218, 0, 220, + 0, 224, 0, 0, 218, 218, 218, 219, 219, 219, + 221, 223, 220, 220, 220, 224, 0, 0, 0, 226, + 0, 0, 223, 222, 222, 222, 225, 0, 224, 224, + 224, 226, 225, 227, 0, 0, 0, 221, 221, 221, + 0, 0, 0, 227, 228, 0, 226, 226, 226, 223, + 223, 223, 230, 225, 225, 225, 228, 229, 0, 0, + 227, 227, 227, 231, 228, 230, 233, 0, 0, 231, + 232, 228, 228, 228, 0, 234, 233, 229, 0, 230, + 230, 230, 0, 236, 229, 229, 229, 0, 232, 234, + + 231, 231, 231, 233, 233, 233, 238, 232, 232, 232, + 235, 236, 234, 234, 234, 239, 0, 235, 237, 0, + 236, 236, 236, 0, 237, 240, 241, 0, 0, 243, + 0, 0, 244, 238, 238, 238, 242, 235, 235, 235, + 240, 243, 239, 239, 239, 237, 237, 237, 247, 241, + 242, 0, 240, 240, 240, 245, 243, 243, 243, 244, + 244, 244, 248, 242, 242, 242, 249, 0, 250, 246, + 248, 0, 0, 0, 247, 245, 241, 241, 241, 252, + 0, 0, 245, 245, 245, 246, 250, 0, 0, 248, + 248, 248, 253, 249, 249, 249, 246, 246, 246, 251, + + 252, 247, 247, 247, 251, 254, 252, 252, 252, 255, + 0, 0, 256, 250, 250, 250, 256, 259, 0, 253, + 253, 253, 0, 255, 257, 254, 251, 251, 251, 258, + 0, 0, 254, 254, 254, 258, 255, 255, 255, 256, + 256, 256, 259, 257, 0, 0, 260, 0, 259, 261, + 268, 257, 257, 257, 260, 0, 258, 258, 258, 0, + 0, 262, 261, 0, 263, 0, 263, 0, 0, 259, + 259, 259, 0, 260, 260, 260, 261, 261, 261, 262, + 0, 268, 269, 269, 269, 269, 269, 277, 262, 262, + 262, 263, 263, 263, 280, 276, 279, 0, 269, 0, + + 277, 276, 0, 278, 0, 0, 0, 280, 268, 268, + 268, 0, 279, 278, 0, 281, 0, 0, 0, 0, + 0, 269, 276, 276, 276, 0, 281, 277, 277, 277, + 278, 278, 278, 282, 280, 280, 280, 282, 0, 279, + 279, 279, 281, 281, 281, 283, 269, 283, 284, 285, + 284, 285, 0, 0, 287, 0, 0, 286, 287, 0, + 282, 282, 282, 286, 288, 0, 288, 289, 0, 0, + 0, 0, 283, 283, 283, 284, 284, 284, 285, 285, + 285, 287, 287, 287, 286, 286, 286, 289, 290, 0, + 0, 288, 288, 288, 289, 289, 289, 291, 0, 0, + + 292, 0, 0, 290, 293, 0, 0, 0, 294, 291, + 294, 293, 295, 0, 0, 290, 290, 290, 300, 0, + 292, 296, 0, 0, 291, 291, 291, 292, 292, 292, + 295, 293, 293, 293, 298, 294, 294, 294, 299, 295, + 295, 295, 296, 302, 299, 300, 300, 300, 296, 296, + 296, 301, 303, 298, 0, 0, 0, 0, 303, 307, + 0, 298, 298, 298, 0, 299, 299, 299, 304, 305, + 302, 302, 302, 0, 301, 0, 305, 306, 0, 303, + 303, 303, 0, 306, 304, 310, 307, 307, 307, 312, + 0, 308, 0, 0, 309, 0, 305, 305, 305, 308, + + 311, 301, 301, 301, 306, 306, 306, 0, 310, 0, + 0, 304, 304, 304, 309, 312, 0, 0, 308, 308, + 308, 309, 309, 309, 313, 0, 0, 311, 311, 311, + 314, 0, 313, 0, 316, 310, 310, 310, 315, 0, + 0, 325, 312, 312, 312, 0, 317, 324, 315, 317, + 327, 313, 313, 313, 316, 325, 326, 314, 314, 314, + 324, 316, 316, 316, 0, 315, 315, 315, 325, 325, + 325, 0, 330, 317, 317, 317, 326, 327, 327, 327, + 332, 0, 328, 326, 326, 326, 328, 324, 324, 324, + 329, 330, 331, 0, 332, 329, 0, 0, 334, 330, + + 330, 330, 333, 0, 333, 0, 337, 332, 332, 332, + 337, 0, 331, 328, 328, 328, 334, 0, 336, 331, + 331, 331, 329, 329, 329, 334, 334, 334, 335, 333, + 333, 333, 338, 337, 337, 337, 342, 335, 336, 339, + 0, 0, 340, 0, 342, 336, 336, 336, 338, 0, + 341, 339, 340, 0, 0, 335, 335, 335, 346, 338, + 338, 338, 341, 342, 342, 342, 339, 339, 339, 340, + 340, 340, 343, 0, 0, 343, 344, 341, 341, 341, + 0, 345, 0, 0, 348, 346, 346, 346, 349, 0, + 344, 345, 350, 0, 0, 0, 0, 351, 0, 343, + + 343, 343, 348, 344, 344, 344, 353, 0, 345, 345, + 345, 348, 348, 348, 356, 349, 349, 349, 351, 350, + 350, 350, 354, 0, 351, 351, 351, 355, 354, 0, + 0, 0, 357, 353, 353, 353, 0, 0, 360, 0, + 0, 356, 356, 356, 357, 363, 361, 355, 0, 354, + 354, 354, 360, 361, 355, 355, 355, 362, 0, 357, + 357, 357, 363, 0, 0, 360, 360, 360, 364, 0, + 0, 365, 0, 361, 361, 361, 366, 0, 364, 367, + 362, 0, 366, 0, 362, 362, 362, 0, 369, 363, + 363, 363, 0, 367, 369, 364, 364, 364, 365, 365, + + 365, 368, 0, 366, 366, 366, 367, 367, 367, 370, + 0, 0, 371, 368, 370, 369, 369, 369, 371, 372, + 0, 0, 0, 0, 0, 373, 0, 0, 368, 368, + 368, 373, 0, 375, 0, 0, 370, 370, 370, 371, + 371, 371, 0, 372, 374, 375, 372, 372, 372, 0, + 374, 376, 373, 373, 373, 377, 376, 0, 378, 0, + 375, 375, 375, 379, 0, 0, 0, 0, 381, 0, + 377, 374, 374, 374, 381, 380, 0, 0, 376, 376, + 376, 379, 377, 377, 377, 378, 378, 378, 382, 386, + 379, 379, 379, 380, 382, 381, 381, 381, 384, 0, + + 0, 385, 380, 380, 380, 384, 388, 386, 385, 0, + 0, 0, 0, 387, 0, 382, 382, 382, 388, 0, + 0, 0, 390, 0, 0, 384, 384, 384, 385, 385, + 385, 0, 389, 0, 386, 386, 386, 387, 389, 391, + 387, 387, 387, 390, 393, 388, 388, 388, 392, 390, + 390, 390, 394, 0, 0, 392, 396, 391, 394, 389, + 389, 389, 393, 395, 0, 0, 391, 391, 391, 399, + 0, 393, 393, 393, 397, 392, 392, 392, 395, 394, + 394, 394, 403, 396, 396, 396, 0, 398, 397, 0, + 395, 395, 395, 398, 400, 0, 399, 399, 399, 400, + + 401, 397, 397, 397, 404, 0, 0, 405, 0, 403, + 403, 403, 406, 405, 398, 398, 398, 409, 406, 401, + 408, 400, 400, 400, 407, 0, 408, 401, 401, 401, + 410, 404, 404, 404, 405, 405, 405, 411, 0, 406, + 406, 406, 0, 407, 409, 0, 0, 408, 408, 408, + 412, 407, 407, 407, 415, 412, 410, 411, 0, 413, + 0, 0, 414, 413, 411, 411, 411, 0, 0, 0, + 412, 409, 409, 409, 416, 0, 0, 415, 0, 419, + 0, 414, 0, 410, 410, 410, 413, 413, 413, 414, + 414, 414, 417, 416, 0, 424, 418, 412, 412, 412, + + 420, 416, 416, 416, 415, 415, 415, 419, 0, 0, + 420, 0, 421, 0, 417, 418, 0, 0, 424, 417, + 417, 417, 421, 418, 418, 418, 422, 420, 420, 420, + 0, 423, 0, 0, 419, 419, 419, 426, 0, 421, + 421, 421, 423, 426, 422, 424, 424, 424, 0, 0, + 427, 0, 0, 422, 422, 422, 427, 0, 423, 423, + 423, 428, 0, 0, 426, 426, 426, 429, 430, 429, + 430, 0, 0, 432, 0, 0, 0, 427, 427, 427, + 436, 428, 0, 0, 433, 432, 436, 0, 428, 428, + 428, 435, 0, 0, 429, 429, 429, 430, 430, 430, + + 432, 432, 432, 433, 0, 435, 434, 436, 436, 436, + 437, 433, 433, 433, 434, 438, 0, 0, 435, 435, + 435, 0, 439, 0, 0, 0, 440, 0, 437, 0, + 0, 443, 0, 434, 434, 434, 438, 437, 437, 437, + 439, 440, 438, 438, 438, 441, 443, 0, 442, 439, + 439, 439, 445, 440, 440, 440, 446, 441, 443, 443, + 443, 444, 445, 444, 447, 0, 0, 442, 449, 446, + 0, 448, 441, 441, 441, 442, 442, 442, 449, 445, + 445, 445, 447, 446, 446, 446, 448, 0, 444, 444, + 444, 447, 447, 447, 450, 451, 0, 0, 448, 448, + + 448, 453, 0, 0, 452, 449, 449, 449, 454, 451, + 0, 453, 0, 0, 450, 0, 0, 0, 455, 0, + 457, 454, 451, 451, 451, 452, 457, 0, 453, 453, + 453, 452, 452, 452, 458, 454, 454, 454, 455, 460, + 458, 450, 450, 450, 459, 455, 455, 455, 456, 0, + 0, 456, 0, 457, 457, 457, 462, 460, 461, 459, + 0, 458, 458, 458, 0, 462, 460, 460, 460, 463, + 467, 459, 459, 459, 464, 456, 456, 456, 0, 461, + 467, 464, 0, 463, 465, 461, 461, 461, 0, 465, + 466, 470, 462, 462, 462, 466, 463, 463, 463, 470, + + 468, 464, 464, 464, 469, 0, 0, 467, 467, 467, + 468, 465, 465, 465, 0, 0, 0, 471, 470, 470, + 470, 472, 466, 466, 466, 469, 474, 468, 468, 468, + 471, 469, 469, 469, 473, 472, 474, 473, 477, 0, + 0, 475, 0, 0, 471, 471, 471, 475, 472, 472, + 472, 476, 0, 474, 474, 474, 477, 482, 476, 482, + 0, 473, 473, 473, 478, 477, 477, 477, 475, 475, + 475, 480, 479, 0, 478, 480, 481, 0, 476, 476, + 476, 479, 483, 481, 482, 482, 482, 483, 0, 0, + 0, 478, 478, 478, 0, 0, 0, 484, 480, 480, + + 480, 488, 485, 481, 481, 481, 0, 486, 479, 479, + 479, 484, 485, 487, 483, 483, 483, 0, 0, 488, + 490, 487, 0, 489, 484, 484, 484, 486, 491, 485, + 485, 485, 0, 490, 486, 486, 486, 489, 491, 494, + 487, 487, 487, 0, 0, 492, 488, 488, 488, 494, + 489, 489, 489, 492, 495, 491, 491, 491, 493, 0, + 490, 490, 490, 0, 495, 493, 494, 494, 494, 496, + 0, 0, 492, 492, 492, 497, 0, 0, 0, 497, + 498, 495, 495, 495, 0, 493, 493, 493, 499, 496, + 499, 500, 502, 0, 501, 0, 496, 496, 496, 498, + + 0, 503, 497, 497, 497, 500, 506, 498, 498, 498, + 502, 503, 0, 0, 501, 499, 499, 499, 500, 500, + 500, 501, 501, 501, 504, 0, 506, 507, 503, 503, + 503, 505, 504, 506, 506, 506, 0, 502, 502, 502, + 0, 505, 0, 0, 0, 0, 507, 0, 0, 0, + 0, 504, 504, 504, 507, 507, 507, 0, 505, 505, + 505, 509, 509, 509, 509, 509, 509, 509, 509, 509, + 509, 509, 509, 509, 509, 510, 510, 510, 510, 510, + 510, 510, 510, 510, 510, 510, 510, 510, 510, 511, + 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, + + 511, 511, 511, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 513, 0, 513, + 0, 513, 0, 513, 514, 0, 0, 514, 0, 514, + 514, 514, 514, 514, 515, 515, 0, 515, 515, 515, + 515, 515, 515, 516, 516, 516, 516, 516, 516, 516, + 516, 516, 516, 516, 516, 516, 516, 517, 517, 517, + 517, 517, 517, 517, 517, 517, 517, 517, 517, 517, + 518, 0, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 519, 0, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 520, 520, + + 520, 520, 520, 520, 520, 520, 520, 521, 521, 521, + 522, 0, 0, 0, 0, 522, 522, 522, 523, 523, + 523, 523, 523, 524, 524, 524, 0, 0, 524, 525, + 525, 525, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int ncg_flex_debug; -int ncg_flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -1180,7 +1532,7 @@ int ncg_flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *ncgtext; +char *yytext; #line 1 "ncgen.l" #line 2 "ncgen.l" /********************************************************************* @@ -1322,10 +1674,12 @@ struct Specialtoken specials[] = { {"_SuperblockVersion",_SUPERBLOCK,_SUPERBLOCK_FLAG}, {"_Filter",_FILTER,_FILTER_FLAG}, {"_Codecs",_CODECS,_CODECS_FLAG}, +{"_QuantizeBitGroomNumberOfSignificantDigits",_QUANTIZEBG,_QUANTIZEBG_FLAG}, +{"_QuantizeBitRoundNumberOfSignificantDigits",_QUANTIZEBR,_QUANTIZEBR_FLAG}, {NULL,0} /* null terminate */ }; - +#line 1683 "ncgenl.c" /* The most correct (validating) version of UTF8 character set (Taken from: http://www.w3.org/2005/03/23-lex-U) @@ -1368,7 +1722,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 1372 "ncgenl.c" +#line 1726 "ncgenl.c" #define INITIAL 0 #define ST_C_COMMENT 1 @@ -1386,36 +1740,36 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int ncglex_destroy (void ); +int yylex_destroy ( void ); -int ncgget_debug (void ); +int yyget_debug ( void ); -void ncgset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE ncgget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void ncgset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *ncgget_in (void ); +FILE *yyget_in ( void ); -void ncgset_in (FILE * _in_str ); +void yyset_in ( FILE * _in_str ); -FILE *ncgget_out (void ); +FILE *yyget_out ( void ); -void ncgset_out (FILE * _out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t ncgget_leng (void ); + int yyget_leng ( void ); -char *ncgget_text (void ); +char *yyget_text ( void ); -int ncgget_lineno (void ); +int yyget_lineno ( void ); -void ncgset_lineno (int _line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1423,32 +1777,31 @@ void ncgset_lineno (int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int ncgwrap (void ); +extern "C" int yywrap ( void ); #else -extern int ncgwrap (void ); +extern int yywrap ( void ); #endif #endif #ifndef YY_NO_UNPUT - static void yyunput (int c,char *buf_ptr ); + static void yyunput ( int c, char *buf_ptr ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif @@ -1468,7 +1821,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 do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1479,20 +1832,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( ncgin ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, ncgin))==0 && ferror(ncgin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1500,7 +1853,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(ncgin); \ + clearerr(yyin); \ } \ }\ \ @@ -1533,12 +1886,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int ncglex (void); +extern int yylex (void); -#define YY_DECL int ncglex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after ncgtext and ncgleng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1572,31 +1925,31 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! ncgin ) - ncgin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! ncgout ) - ncgout = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - ncgensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - ncg_create_buffer(ncgin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - ncg_load_buffer_state( ); + yy_load_buffer_state( ); } { -#line 223 "ncgen.l" +#line 225 "ncgen.l" -#line 1594 "ncgenl.c" +#line 1947 "ncgenl.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of ncgtext. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1617,13 +1970,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 429 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_current_state >= 509 ) + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 2458 ); + while ( yy_base[yy_current_state] != 2942 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1649,14 +2002,14 @@ YY_DECL case 1: YY_RULE_SETUP -#line 224 "ncgen.l" +#line 226 "ncgen.l" { /* whitespace */ break; } YY_BREAK case 2: YY_RULE_SETUP -#line 228 "ncgen.l" +#line 230 "ncgen.l" { /* comment */ break; } @@ -1664,19 +2017,19 @@ YY_RULE_SETUP case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 232 "ncgen.l" +#line 234 "ncgen.l" {int len; char* s = NULL; /* In netcdf4, this will be used in a variety of places, so only remove escapes */ /* -if(ncgleng > MAXTRST) { +if(yyleng > MAXTRST) { yyerror("string too long, truncated\n"); -ncgtext[MAXTRST-1] = '\0'; +yytext[MAXTRST-1] = '\0'; } */ - len = unescape((char *)ncgtext+1,ncgleng-2,!ISIDENT,&s); + len = unescape((char *)yytext+1,yyleng-2,!ISIDENT,&s); if(len < 0) { - sprintf(errstr,"Illegal character: %s",ncgtext); + sprintf(errstr,"Illegal character: %s",yytext); yyerror(errstr); } bbClear(lextext); @@ -1688,10 +2041,10 @@ ncgtext[MAXTRST-1] = '\0'; YY_BREAK case 4: YY_RULE_SETUP -#line 253 "ncgen.l" +#line 255 "ncgen.l" { /* drop leading 0x; pad to even number of chars */ - char* p = ncgtext+2; - int len = ncgleng - 2; + char* p = yytext+2; + int len = yyleng - 2; bbClear(lextext); bbAppendn(lextext,p,len); if((len % 2) == 1) bbAppend(lextext,'0'); @@ -1703,145 +2056,145 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 265 "ncgen.l" +#line 267 "ncgen.l" {return lexdebug(COMPOUND);} YY_BREAK case 6: YY_RULE_SETUP -#line 266 "ncgen.l" +#line 268 "ncgen.l" {return lexdebug(ENUM);} YY_BREAK case 7: YY_RULE_SETUP -#line 267 "ncgen.l" +#line 269 "ncgen.l" {return lexdebug(OPAQUE_);} YY_BREAK case 8: YY_RULE_SETUP -#line 269 "ncgen.l" +#line 271 "ncgen.l" {return lexdebug(FLOAT_K);} YY_BREAK case 9: YY_RULE_SETUP -#line 270 "ncgen.l" +#line 272 "ncgen.l" {return lexdebug(DOUBLE_K);} YY_BREAK case 10: YY_RULE_SETUP -#line 271 "ncgen.l" +#line 273 "ncgen.l" {return lexdebug(CHAR_K);} YY_BREAK case 11: YY_RULE_SETUP -#line 272 "ncgen.l" +#line 274 "ncgen.l" {return lexdebug(BYTE_K);} YY_BREAK case 12: YY_RULE_SETUP -#line 273 "ncgen.l" +#line 275 "ncgen.l" {return lexdebug(SHORT_K);} YY_BREAK case 13: YY_RULE_SETUP -#line 274 "ncgen.l" +#line 276 "ncgen.l" {return lexdebug(INT_K);} YY_BREAK case 14: YY_RULE_SETUP -#line 275 "ncgen.l" +#line 277 "ncgen.l" {return lexdebug(identcheck(UBYTE_K));} YY_BREAK case 15: YY_RULE_SETUP -#line 276 "ncgen.l" +#line 278 "ncgen.l" {return lexdebug(identcheck(USHORT_K));} YY_BREAK case 16: YY_RULE_SETUP -#line 277 "ncgen.l" +#line 279 "ncgen.l" {return lexdebug(identcheck(UINT_K));} YY_BREAK case 17: YY_RULE_SETUP -#line 278 "ncgen.l" +#line 280 "ncgen.l" {return lexdebug(identcheck(INT64_K));} YY_BREAK case 18: YY_RULE_SETUP -#line 279 "ncgen.l" +#line 281 "ncgen.l" {return lexdebug(identcheck(UINT64_K));} YY_BREAK case 19: YY_RULE_SETUP -#line 280 "ncgen.l" +#line 282 "ncgen.l" {return lexdebug(identcheck(STRING_K));} YY_BREAK case 20: YY_RULE_SETUP -#line 282 "ncgen.l" +#line 284 "ncgen.l" {return lexdebug(FLOAT_K);} YY_BREAK case 21: YY_RULE_SETUP -#line 283 "ncgen.l" +#line 285 "ncgen.l" {return lexdebug(INT_K);} YY_BREAK case 22: YY_RULE_SETUP -#line 284 "ncgen.l" +#line 286 "ncgen.l" {return lexdebug(INT_K);} YY_BREAK case 23: YY_RULE_SETUP -#line 285 "ncgen.l" +#line 287 "ncgen.l" {return lexdebug(identcheck(UINT_K));} YY_BREAK case 24: YY_RULE_SETUP -#line 286 "ncgen.l" +#line 288 "ncgen.l" {return lexdebug(identcheck(UINT_K));} YY_BREAK case 25: YY_RULE_SETUP -#line 289 "ncgen.l" +#line 291 "ncgen.l" {int32_val = -1; return lexdebug(NC_UNLIMITED_K);} YY_BREAK case 26: YY_RULE_SETUP -#line 292 "ncgen.l" +#line 294 "ncgen.l" {return lexdebug(TYPES);} YY_BREAK case 27: YY_RULE_SETUP -#line 293 "ncgen.l" +#line 295 "ncgen.l" {return lexdebug(DIMENSIONS);} YY_BREAK case 28: YY_RULE_SETUP -#line 294 "ncgen.l" +#line 296 "ncgen.l" {return lexdebug(VARIABLES);} YY_BREAK case 29: YY_RULE_SETUP -#line 295 "ncgen.l" +#line 297 "ncgen.l" {return lexdebug(DATA);} YY_BREAK case 30: YY_RULE_SETUP -#line 296 "ncgen.l" +#line 298 "ncgen.l" {return lexdebug(GROUP);} YY_BREAK case 31: YY_RULE_SETUP -#line 298 "ncgen.l" +#line 300 "ncgen.l" {BEGIN(TEXT);return lexdebug(NETCDF);} YY_BREAK case 32: YY_RULE_SETUP -#line 300 "ncgen.l" +#line 302 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ - if (ncgtext[0] == '-') { + if (yytext[0] == '-') { double_val = -INFINITY; } else { double_val = INFINITY; @@ -1852,7 +2205,7 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 309 "ncgen.l" +#line 311 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ double_val = NAN; specialconstants = 1; @@ -1861,9 +2214,9 @@ YY_RULE_SETUP YY_BREAK case 34: YY_RULE_SETUP -#line 315 "ncgen.l" +#line 317 "ncgen.l" {/* missing value (pre-2.4 backward compatibility)*/ - if (ncgtext[0] == '-') { + if (yytext[0] == '-') { float_val = -INFINITYF; } else { float_val = INFINITYF; @@ -1874,7 +2227,7 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 324 "ncgen.l" +#line 326 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ float_val = NANF; specialconstants = 1; @@ -1883,7 +2236,7 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 330 "ncgen.l" +#line 332 "ncgen.l" { #ifdef USE_NETCDF4 if(l_flag == L_C || l_flag == L_BINARY) @@ -1896,10 +2249,10 @@ YY_RULE_SETUP YY_BREAK case 37: YY_RULE_SETUP -#line 340 "ncgen.l" +#line 342 "ncgen.l" { bbClear(lextext); - bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ + bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ bbNull(lextext); yylval.sym = makepath(bbContents(lextext)); return lexdebug(PATH); @@ -1907,10 +2260,10 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 349 "ncgen.l" +#line 351 "ncgen.l" {struct Specialtoken* st; bbClear(lextext); - bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ + bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ bbNull(lextext); for(st=specials;st->name;st++) { if(strcmp(bbContents(lextext),st->name)==0) {return lexdebug(st->token);} @@ -1921,13 +2274,13 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 359 "ncgen.l" +#line 361 "ncgen.l" { int c; char* p; char* q; /* copy the trimmed name */ bbClear(lextext); - bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ + bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ bbNull(lextext); p = bbContents(lextext); q = p; @@ -1941,10 +2294,10 @@ YY_RULE_SETUP YY_BREAK case 40: YY_RULE_SETUP -#line 376 "ncgen.l" +#line 378 "ncgen.l" { char* id = NULL; int len; - len = strlen(ncgtext); - len = unescape(ncgtext,len,ISIDENT,&id); + len = strlen(yytext); + len = unescape(yytext,len,ISIDENT,&id); if(NCSTREQ(id, FILL_STRING)) { efree(id); return lexdebug(FILLMARKER); @@ -1956,7 +2309,7 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 388 "ncgen.l" +#line 390 "ncgen.l" { /* We need to try to see what size of integer ((u)int). @@ -2037,25 +2390,25 @@ done: return 0; YY_BREAK case 42: YY_RULE_SETUP -#line 466 "ncgen.l" +#line 468 "ncgen.l" { int c; int token = 0; - int slen = strlen(ncgtext); + int slen = strlen(yytext); char* stag = NULL; int tag = NC_NAT; - char* hex = ncgtext+2; /* point to first true hex digit */ + char* hex = yytext+2; /* point to first true hex digit */ int xlen = (slen - 3); /* true hex length */ - ncgtext[slen-1] = '\0'; + yytext[slen-1] = '\0'; /* capture the tag string */ - tag = collecttag(ncgtext,&stag); + tag = collecttag(yytext,&stag); if(tag == NC_NAT) { sprintf(errstr,"Illegal integer suffix: %s",stag); yyerror(errstr); goto done; } - ncgtext[slen - strlen(stag)] = '\0'; + yytext[slen - strlen(stag)] = '\0'; if(xlen > 16) { /* truncate hi order digits */ hex += (xlen - 16); } @@ -2077,8 +2430,8 @@ YY_RULE_SETUP token = UINT64_CONST; break; default: /* should never happen */ - if (sscanf((char*)ncgtext, "%i", &uint32_val) != 1) { - sprintf(errstr,"bad unsigned int constant: %s",(char*)ncgtext); + if (sscanf((char*)yytext, "%i", &uint32_val) != 1) { + sprintf(errstr,"bad unsigned int constant: %s",(char*)yytext); yyerror(errstr); } token = UINT_CONST; @@ -2088,10 +2441,10 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 513 "ncgen.l" +#line 515 "ncgen.l" { - if (sscanf((char*)ncgtext, "%le", &double_val) != 1) { - sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext); + if (sscanf((char*)yytext, "%le", &double_val) != 1) { + sprintf(errstr,"bad long or double constant: %s",(char*)yytext); yyerror(errstr); } return lexdebug(DOUBLE_CONST); @@ -2099,10 +2452,10 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 520 "ncgen.l" +#line 522 "ncgen.l" { - if (sscanf((char*)ncgtext, "%e", &float_val) != 1) { - sprintf(errstr,"bad float constant: %s",(char*)ncgtext); + if (sscanf((char*)yytext, "%e", &float_val) != 1) { + sprintf(errstr,"bad float constant: %s",(char*)yytext); yyerror(errstr); } return lexdebug(FLOAT_CONST); @@ -2111,19 +2464,19 @@ YY_RULE_SETUP case 45: /* rule 45 can match eol */ YY_RULE_SETUP -#line 527 "ncgen.l" +#line 529 "ncgen.l" { - (void) sscanf((char*)&ncgtext[1],"%c",&byte_val); + (void) sscanf((char*)&yytext[1],"%c",&byte_val); return lexdebug(BYTE_CONST); } YY_BREAK case 46: YY_RULE_SETUP -#line 531 "ncgen.l" +#line 533 "ncgen.l" { - int oct = unescapeoct(&ncgtext[2]); + int oct = unescapeoct(&yytext[2]); if(oct < 0) { - sprintf(errstr,"bad octal character constant: %s",(char*)ncgtext); + sprintf(errstr,"bad octal character constant: %s",(char*)yytext); yyerror(errstr); } byte_val = (unsigned int)oct; @@ -2132,11 +2485,11 @@ YY_RULE_SETUP YY_BREAK case 47: YY_RULE_SETUP -#line 540 "ncgen.l" +#line 542 "ncgen.l" { - int hex = unescapehex(&ncgtext[3]); + int hex = unescapehex(&yytext[3]); if(byte_val < 0) { - sprintf(errstr,"bad hex character constant: %s",(char*)ncgtext); + sprintf(errstr,"bad hex character constant: %s",(char*)yytext); yyerror(errstr); } byte_val = (unsigned int)hex; @@ -2145,9 +2498,9 @@ YY_RULE_SETUP YY_BREAK case 48: YY_RULE_SETUP -#line 549 "ncgen.l" +#line 551 "ncgen.l" { - switch ((char)ncgtext[2]) { + switch ((char)yytext[2]) { case 'a': byte_val = '\007'; break; /* not everyone under- * stands '\a' yet */ case 'b': byte_val = '\b'; break; @@ -2159,7 +2512,7 @@ YY_RULE_SETUP case '\\': byte_val = '\\'; break; case '?': byte_val = '\177'; break; case '\'': byte_val = '\''; break; - default: byte_val = (char)ncgtext[2]; + default: byte_val = (char)yytext[2]; } return lexdebug(BYTE_CONST); } @@ -2167,7 +2520,7 @@ YY_RULE_SETUP case 49: /* rule 49 can match eol */ YY_RULE_SETUP -#line 567 "ncgen.l" +#line 569 "ncgen.l" { lineno++ ; break; @@ -2175,7 +2528,7 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 572 "ncgen.l" +#line 574 "ncgen.l" {/*initial*/ BEGIN(ST_C_COMMENT); break; @@ -2184,21 +2537,21 @@ YY_RULE_SETUP case 51: /* rule 51 can match eol */ YY_RULE_SETUP -#line 577 "ncgen.l" +#line 579 "ncgen.l" {/* continuation */ break; } YY_BREAK case 52: YY_RULE_SETUP -#line 581 "ncgen.l" +#line 583 "ncgen.l" {/* final */ BEGIN(INITIAL); break; } YY_BREAK case YY_STATE_EOF(ST_C_COMMENT): -#line 586 "ncgen.l" +#line 588 "ncgen.l" {/* final, error */ fprintf(stderr,"unterminated /**/ comment"); BEGIN(INITIAL); @@ -2207,17 +2560,17 @@ case YY_STATE_EOF(ST_C_COMMENT): YY_BREAK case 53: YY_RULE_SETUP -#line 592 "ncgen.l" +#line 594 "ncgen.l" {/* Note: this next rule will not work for UTF8 characters */ - return lexdebug(ncgtext[0]) ; + return lexdebug(yytext[0]) ; } YY_BREAK case 54: YY_RULE_SETUP -#line 595 "ncgen.l" +#line 597 "ncgen.l" ECHO; YY_BREAK -#line 2221 "ncgenl.c" +#line 2574 "ncgenl.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TEXT): yyterminate(); @@ -2235,15 +2588,15 @@ case YY_STATE_EOF(TEXT): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed ncgin at a new source and called - * ncglex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = ncgin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -2296,11 +2649,11 @@ case YY_STATE_EOF(TEXT): { (yy_did_buffer_switch_on_eof) = 0; - if ( ncgwrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * ncgtext, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -2350,7 +2703,7 @@ case YY_STATE_EOF(TEXT): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of ncglex */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2363,7 +2716,7 @@ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); - yy_size_t number_to_move, i; + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2392,7 +2745,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2405,7 +2758,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2419,7 +2772,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2428,11 +2781,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - ncgrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2460,7 +2814,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - ncgrestart(ncgin ); + yyrestart( yyin ); } else @@ -2474,12 +2828,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -2511,10 +2868,10 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 429 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_current_state >= 509 ) + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -2539,11 +2896,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 429 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_current_state >= 509 ) + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 428); + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 508); return yy_is_jam ? 0 : yy_current_state; } @@ -2556,13 +2913,13 @@ static int yy_get_next_buffer (void) yy_cp = (yy_c_buf_p); - /* undo effects of setting up ncgtext */ + /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; + int number_to_move = (yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = @@ -2574,7 +2931,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -2613,7 +2970,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2630,14 +2987,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - ncgrestart(ncgin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( ncgwrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2656,7 +3013,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve ncgtext */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -2668,32 +3025,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void ncgrestart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - ncgensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - ncg_create_buffer(ncgin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - ncg_init_buffer(YY_CURRENT_BUFFER,input_file ); - ncg_load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * ncgpop_buffer_state(); - * ncgpush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - ncgensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2706,21 +3063,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - ncg_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (ncgwrap()) processing, but the only time this flag - * is looked at is after ncgwrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void ncg_load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - ncgin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2730,35 +3087,35 @@ static void ncg_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE ncg_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) ncgalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - ncg_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with ncg_create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void ncg_delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2768,27 +3125,27 @@ static void ncg_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - ncgfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - ncgfree((void *) b ); + yyfree( (void *) b ); } /* 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. + * such as during a yyrestart() or at EOF. */ - static void ncg_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - ncg_flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then ncg_init_buffer was _probably_ - * called from ncgrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2805,7 +3162,7 @@ static void ncg_load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void ncg_flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2825,7 +3182,7 @@ static void ncg_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - ncg_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2834,14 +3191,14 @@ static void ncg_load_buffer_state (void) * @param new_buffer The new state. * */ -void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - ncgensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from ncg_switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2855,8 +3212,8 @@ void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from ncg_switch_to_buffer. */ - ncg_load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -2864,18 +3221,18 @@ void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void ncgpop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - ncg_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - ncg_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2883,7 +3240,7 @@ void ncgpop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void ncgensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -2893,15 +3250,15 @@ 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; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2913,12 +3270,12 @@ static void ncgensure_buffer_stack (void) 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 + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2930,9 +3287,9 @@ static void ncgensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2940,69 +3297,69 @@ YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - ncg_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to ncglex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * ncg_scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return ncg_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to ncglex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) ncgalloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = ncg_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in ncg_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -3016,9 +3373,9 @@ YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -3028,14 +3385,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up ncgtext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - ncgtext[ncgleng] = (yy_hold_char); \ - (yy_c_buf_p) = ncgtext + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - ncgleng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -3044,126 +3401,126 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int ncgget_lineno (void) +int yyget_lineno (void) { - - return ncglineno; + + return yylineno; } /** Get the input stream. * */ -FILE *ncgget_in (void) +FILE *yyget_in (void) { - return ncgin; + return yyin; } /** Get the output stream. * */ -FILE *ncgget_out (void) +FILE *yyget_out (void) { - return ncgout; + return yyout; } /** Get the length of the current token. * */ -yy_size_t ncgget_leng (void) +int yyget_leng (void) { - return ncgleng; + return yyleng; } /** Get the current token. * */ -char *ncgget_text (void) +char *yyget_text (void) { - return ncgtext; + return yytext; } /** Set the current line number. * @param _line_number line number * */ -void ncgset_lineno (int _line_number ) +void yyset_lineno (int _line_number ) { - ncglineno = _line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * - * @see ncg_switch_to_buffer + * @see yy_switch_to_buffer */ -void ncgset_in (FILE * _in_str ) +void yyset_in (FILE * _in_str ) { - ncgin = _in_str ; + yyin = _in_str ; } -void ncgset_out (FILE * _out_str ) +void yyset_out (FILE * _out_str ) { - ncgout = _out_str ; + yyout = _out_str ; } -int ncgget_debug (void) +int yyget_debug (void) { - return ncg_flex_debug; + return yy_flex_debug; } -void ncgset_debug (int _bdebug ) +void yyset_debug (int _bdebug ) { - ncg_flex_debug = _bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from ncglex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - ncgin = stdin; - ncgout = stdout; + yyin = stdin; + yyout = stdout; #else - ncgin = (FILE *) 0; - ncgout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * ncglex_init() + * yylex_init() */ return 0; } -/* ncglex_destroy is for both reentrant and non-reentrant scanners. */ -int ncglex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - ncg_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - ncgpop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - ncgfree((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * ncglex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -3174,7 +3531,7 @@ int ncglex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; @@ -3184,7 +3541,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) @@ -3194,12 +3551,12 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *ncgalloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *ncgrealloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both @@ -3209,25 +3566,24 @@ void *ncgrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void ncgfree (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 595 "ncgen.l" - +#line 597 "ncgen.l" static int lexdebug(int token) { if(debug >= 2) { - fprintf(stderr,"Token=%d |%s| line=%d\n",token,ncgtext,lineno); + fprintf(stderr,"Token=%d |%s| line=%d\n",token,yytext,lineno); } return token; } @@ -3529,13 +3885,13 @@ identcheck(int token) case INT64_K: case UINT64_K: if(k_flag != NC_FORMAT_NETCDF4 && k_flag != NC_FORMAT_64BIT_DATA) { - yylval.sym = install(ncgtext); + yylval.sym = install(yytext); token = IDENT; } break; case STRING_K: if(k_flag != NC_FORMAT_NETCDF4) { - yylval.sym = install(ncgtext); + yylval.sym = install(yytext); token = IDENT; } break; diff --git a/ncgen/ncgeny.c b/ncgen/ncgeny.c index e275602fd6..464a8f79dd 100644 --- a/ncgen/ncgeny.c +++ b/ncgen/ncgeny.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.7.5. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -40,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30705 -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" +/* Bison version string. */ +#define YYBISON_VERSION "3.7.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -65,12 +70,11 @@ #define yyerror ncgerror #define yydebug ncgdebug #define yynerrs ncgnerrs - #define yylval ncglval #define yychar ncgchar -/* Copy the first part of user declarations. */ -#line 11 "ncgen.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 11 "ncgen.y" /* static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $"; @@ -213,157 +217,261 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl; extern int lex_init(void); -#line 217 "ncgeny.c" /* yacc.c:339 */ +#line 221 "ncgeny.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 1 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "ncgeny.h". */ -#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED -# define YY_NCG_NCGEN_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int ncgdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - STRING_K = 270, - IDENT = 271, - TERMSTRING = 272, - CHAR_CONST = 273, - BYTE_CONST = 274, - SHORT_CONST = 275, - INT_CONST = 276, - INT64_CONST = 277, - UBYTE_CONST = 278, - USHORT_CONST = 279, - UINT_CONST = 280, - UINT64_CONST = 281, - FLOAT_CONST = 282, - DOUBLE_CONST = 283, - DIMENSIONS = 284, - VARIABLES = 285, - NETCDF = 286, - DATA = 287, - TYPES = 288, - COMPOUND = 289, - ENUM = 290, - OPAQUE_ = 291, - OPAQUESTRING = 292, - GROUP = 293, - PATH = 294, - FILLMARKER = 295, - NIL = 296, - _FILLVALUE = 297, - _FORMAT = 298, - _STORAGE = 299, - _CHUNKSIZES = 300, - _DEFLATELEVEL = 301, - _SHUFFLE = 302, - _ENDIANNESS = 303, - _NOFILL = 304, - _FLETCHER32 = 305, - _NCPROPS = 306, - _ISNETCDF4 = 307, - _SUPERBLOCK = 308, - _FILTER = 309, - _CODECS = 310, - DATASETID = 311 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +#include "ncgeny.h" +/* Symbol kind. */ +enum yysymbol_kind_t { -#line 156 "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 323 "ncgeny.c" /* yacc.c:355 */ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_NC_UNLIMITED_K = 3, /* NC_UNLIMITED_K */ + YYSYMBOL_CHAR_K = 4, /* CHAR_K */ + YYSYMBOL_BYTE_K = 5, /* BYTE_K */ + YYSYMBOL_SHORT_K = 6, /* SHORT_K */ + YYSYMBOL_INT_K = 7, /* INT_K */ + YYSYMBOL_FLOAT_K = 8, /* FLOAT_K */ + YYSYMBOL_DOUBLE_K = 9, /* DOUBLE_K */ + YYSYMBOL_UBYTE_K = 10, /* UBYTE_K */ + YYSYMBOL_USHORT_K = 11, /* USHORT_K */ + YYSYMBOL_UINT_K = 12, /* UINT_K */ + YYSYMBOL_INT64_K = 13, /* INT64_K */ + YYSYMBOL_UINT64_K = 14, /* UINT64_K */ + YYSYMBOL_STRING_K = 15, /* STRING_K */ + YYSYMBOL_IDENT = 16, /* IDENT */ + YYSYMBOL_TERMSTRING = 17, /* TERMSTRING */ + YYSYMBOL_CHAR_CONST = 18, /* CHAR_CONST */ + YYSYMBOL_BYTE_CONST = 19, /* BYTE_CONST */ + YYSYMBOL_SHORT_CONST = 20, /* SHORT_CONST */ + YYSYMBOL_INT_CONST = 21, /* INT_CONST */ + YYSYMBOL_INT64_CONST = 22, /* INT64_CONST */ + YYSYMBOL_UBYTE_CONST = 23, /* UBYTE_CONST */ + YYSYMBOL_USHORT_CONST = 24, /* USHORT_CONST */ + YYSYMBOL_UINT_CONST = 25, /* UINT_CONST */ + YYSYMBOL_UINT64_CONST = 26, /* UINT64_CONST */ + YYSYMBOL_FLOAT_CONST = 27, /* FLOAT_CONST */ + YYSYMBOL_DOUBLE_CONST = 28, /* DOUBLE_CONST */ + YYSYMBOL_DIMENSIONS = 29, /* DIMENSIONS */ + YYSYMBOL_VARIABLES = 30, /* VARIABLES */ + YYSYMBOL_NETCDF = 31, /* NETCDF */ + YYSYMBOL_DATA = 32, /* DATA */ + YYSYMBOL_TYPES = 33, /* TYPES */ + YYSYMBOL_COMPOUND = 34, /* COMPOUND */ + YYSYMBOL_ENUM = 35, /* ENUM */ + YYSYMBOL_OPAQUE_ = 36, /* OPAQUE_ */ + YYSYMBOL_OPAQUESTRING = 37, /* OPAQUESTRING */ + YYSYMBOL_GROUP = 38, /* GROUP */ + YYSYMBOL_PATH = 39, /* PATH */ + YYSYMBOL_FILLMARKER = 40, /* FILLMARKER */ + YYSYMBOL_NIL = 41, /* NIL */ + YYSYMBOL__FILLVALUE = 42, /* _FILLVALUE */ + YYSYMBOL__FORMAT = 43, /* _FORMAT */ + YYSYMBOL__STORAGE = 44, /* _STORAGE */ + YYSYMBOL__CHUNKSIZES = 45, /* _CHUNKSIZES */ + YYSYMBOL__DEFLATELEVEL = 46, /* _DEFLATELEVEL */ + YYSYMBOL__SHUFFLE = 47, /* _SHUFFLE */ + YYSYMBOL__ENDIANNESS = 48, /* _ENDIANNESS */ + YYSYMBOL__NOFILL = 49, /* _NOFILL */ + YYSYMBOL__FLETCHER32 = 50, /* _FLETCHER32 */ + YYSYMBOL__NCPROPS = 51, /* _NCPROPS */ + YYSYMBOL__ISNETCDF4 = 52, /* _ISNETCDF4 */ + YYSYMBOL__SUPERBLOCK = 53, /* _SUPERBLOCK */ + YYSYMBOL__FILTER = 54, /* _FILTER */ + YYSYMBOL__CODECS = 55, /* _CODECS */ + YYSYMBOL__QUANTIZEBG = 56, /* _QUANTIZEBG */ + YYSYMBOL__QUANTIZEBR = 57, /* _QUANTIZEBR */ + YYSYMBOL_DATASETID = 58, /* DATASETID */ + YYSYMBOL_59_ = 59, /* '{' */ + YYSYMBOL_60_ = 60, /* '}' */ + YYSYMBOL_61_ = 61, /* ';' */ + YYSYMBOL_62_ = 62, /* ',' */ + YYSYMBOL_63_ = 63, /* '=' */ + YYSYMBOL_64_ = 64, /* '(' */ + YYSYMBOL_65_ = 65, /* ')' */ + YYSYMBOL_66_ = 66, /* '*' */ + YYSYMBOL_67_ = 67, /* ':' */ + YYSYMBOL_YYACCEPT = 68, /* $accept */ + YYSYMBOL_ncdesc = 69, /* ncdesc */ + YYSYMBOL_datasetid = 70, /* datasetid */ + YYSYMBOL_rootgroup = 71, /* rootgroup */ + YYSYMBOL_groupbody = 72, /* groupbody */ + YYSYMBOL_subgrouplist = 73, /* subgrouplist */ + YYSYMBOL_namedgroup = 74, /* namedgroup */ + YYSYMBOL_75_1 = 75, /* $@1 */ + YYSYMBOL_76_2 = 76, /* $@2 */ + YYSYMBOL_typesection = 77, /* typesection */ + YYSYMBOL_typedecls = 78, /* typedecls */ + YYSYMBOL_typename = 79, /* typename */ + YYSYMBOL_type_or_attr_decl = 80, /* type_or_attr_decl */ + YYSYMBOL_typedecl = 81, /* typedecl */ + YYSYMBOL_optsemicolon = 82, /* optsemicolon */ + YYSYMBOL_enumdecl = 83, /* enumdecl */ + YYSYMBOL_enumidlist = 84, /* enumidlist */ + YYSYMBOL_enumid = 85, /* enumid */ + YYSYMBOL_opaquedecl = 86, /* opaquedecl */ + YYSYMBOL_vlendecl = 87, /* vlendecl */ + YYSYMBOL_compounddecl = 88, /* compounddecl */ + YYSYMBOL_fields = 89, /* fields */ + YYSYMBOL_field = 90, /* field */ + YYSYMBOL_primtype = 91, /* primtype */ + YYSYMBOL_dimsection = 92, /* dimsection */ + YYSYMBOL_dimdecls = 93, /* dimdecls */ + YYSYMBOL_dim_or_attr_decl = 94, /* dim_or_attr_decl */ + YYSYMBOL_dimdeclist = 95, /* dimdeclist */ + YYSYMBOL_dimdecl = 96, /* dimdecl */ + YYSYMBOL_dimd = 97, /* dimd */ + YYSYMBOL_vasection = 98, /* vasection */ + YYSYMBOL_vadecls = 99, /* vadecls */ + YYSYMBOL_vadecl_or_attr = 100, /* vadecl_or_attr */ + YYSYMBOL_vardecl = 101, /* vardecl */ + YYSYMBOL_varlist = 102, /* varlist */ + YYSYMBOL_varspec = 103, /* varspec */ + YYSYMBOL_dimspec = 104, /* dimspec */ + YYSYMBOL_dimlist = 105, /* dimlist */ + YYSYMBOL_dimref = 106, /* dimref */ + YYSYMBOL_fieldlist = 107, /* fieldlist */ + YYSYMBOL_fieldspec = 108, /* fieldspec */ + YYSYMBOL_fielddimspec = 109, /* fielddimspec */ + YYSYMBOL_fielddimlist = 110, /* fielddimlist */ + YYSYMBOL_fielddim = 111, /* fielddim */ + YYSYMBOL_varref = 112, /* varref */ + YYSYMBOL_typeref = 113, /* typeref */ + YYSYMBOL_ambiguous_ref = 114, /* ambiguous_ref */ + YYSYMBOL_attrdecllist = 115, /* attrdecllist */ + YYSYMBOL_attrdecl = 116, /* attrdecl */ + YYSYMBOL_path = 117, /* path */ + YYSYMBOL_datasection = 118, /* datasection */ + YYSYMBOL_datadecls = 119, /* datadecls */ + YYSYMBOL_datadecl = 120, /* datadecl */ + YYSYMBOL_datalist = 121, /* datalist */ + YYSYMBOL_datalist0 = 122, /* datalist0 */ + YYSYMBOL_datalist1 = 123, /* datalist1 */ + YYSYMBOL_dataitem = 124, /* dataitem */ + YYSYMBOL_constdata = 125, /* constdata */ + YYSYMBOL_econstref = 126, /* econstref */ + YYSYMBOL_function = 127, /* function */ + YYSYMBOL_arglist = 128, /* arglist */ + YYSYMBOL_simpleconstant = 129, /* simpleconstant */ + YYSYMBOL_intlist = 130, /* intlist */ + YYSYMBOL_constint = 131, /* constint */ + YYSYMBOL_conststring = 132, /* conststring */ + YYSYMBOL_constbool = 133, /* constbool */ + YYSYMBOL_varident = 134, /* varident */ + YYSYMBOL_ident = 135 /* ident */ }; +typedef enum yysymbol_kind_t yysymbol_kind_t; -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif -extern YYSTYPE ncglval; -int ncgparse (void); +#ifdef short +# undef short +#endif -#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */ +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ -/* Copy the second part of user declarations. */ +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif -#line 340 "ncgeny.c" /* yacc.c:358 */ +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ -#ifdef short -# undef short +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned char yytype_uint8; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_uint8; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; #else -typedef short int yytype_int16; +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -371,15 +479,28 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_int16 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -393,47 +514,37 @@ typedef short int yytype_int16; # 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__)) +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif #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) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 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\"")\ +# 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 \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -446,8 +557,22 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) -#if ! defined yyoverflow || YYERROR_VERBOSE +#if 1 /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -512,8 +637,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* 1 */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -522,17 +646,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t 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) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -545,11 +669,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -561,12 +685,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -578,42 +702,45 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 462 +#define YYLAST 446 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 66 +#define YYNTOKENS 68 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 68 /* YYNRULES -- Number of rules. */ -#define YYNRULES 156 +#define YYNRULES 158 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 267 +#define YYNSTATES 273 + +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 313 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 311 -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 62, 63, 64, 2, 60, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 65, 59, - 2, 61, 2, 2, 2, 2, 2, 2, 2, 2, + 64, 65, 66, 2, 62, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 67, 61, + 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 57, 2, 58, 2, 2, 2, 2, + 2, 2, 2, 59, 2, 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -632,51 +759,59 @@ static const yytype_uint8 yytranslate[] = 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56 + 55, 56, 57, 58 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { - 0, 240, 240, 246, 248, 255, 262, 262, 265, 274, - 264, 279, 280, 281, 285, 285, 287, 297, 297, 300, - 301, 302, 303, 306, 306, 309, 339, 341, 358, 367, - 379, 393, 426, 427, 430, 444, 445, 446, 447, 448, - 449, 450, 451, 452, 453, 454, 455, 458, 459, 460, - 463, 464, 467, 467, 469, 470, 474, 482, 492, 504, - 505, 506, 509, 510, 513, 513, 515, 537, 541, 545, - 574, 575, 578, 579, 583, 597, 601, 606, 635, 636, - 640, 641, 646, 656, 676, 687, 698, 717, 724, 724, - 727, 729, 731, 733, 735, 744, 755, 757, 759, 761, - 763, 765, 767, 769, 771, 773, 775, 777, 782, 789, - 798, 799, 800, 803, 804, 807, 811, 812, 816, 820, - 821, 826, 827, 831, 832, 833, 834, 835, 836, 840, - 844, 848, 850, 855, 856, 857, 858, 859, 860, 861, - 862, 863, 864, 865, 866, 870, 871, 875, 877, 879, - 881, 886, 890, 891, 899, 900, 904 + 0, 242, 242, 248, 250, 257, 264, 264, 267, 276, + 266, 281, 282, 283, 287, 287, 289, 299, 299, 302, + 303, 304, 305, 308, 308, 311, 341, 343, 360, 369, + 381, 395, 428, 429, 432, 446, 447, 448, 449, 450, + 451, 452, 453, 454, 455, 456, 457, 460, 461, 462, + 465, 466, 469, 469, 471, 472, 476, 484, 494, 506, + 507, 508, 511, 512, 515, 515, 517, 539, 543, 547, + 576, 577, 580, 581, 585, 599, 603, 608, 637, 638, + 642, 643, 648, 658, 678, 689, 700, 719, 726, 726, + 729, 731, 733, 735, 737, 746, 757, 759, 761, 763, + 765, 767, 769, 771, 773, 775, 777, 779, 781, 783, + 788, 795, 804, 805, 806, 809, 810, 813, 817, 818, + 822, 826, 827, 832, 833, 837, 838, 839, 840, 841, + 842, 846, 850, 854, 856, 861, 862, 863, 864, 865, + 866, 867, 868, 869, 870, 871, 872, 876, 877, 881, + 883, 885, 887, 892, 896, 897, 905, 906, 910 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if 1 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "NC_UNLIMITED_K", "CHAR_K", "BYTE_K", - "SHORT_K", "INT_K", "FLOAT_K", "DOUBLE_K", "UBYTE_K", "USHORT_K", - "UINT_K", "INT64_K", "UINT64_K", "STRING_K", "IDENT", "TERMSTRING", - "CHAR_CONST", "BYTE_CONST", "SHORT_CONST", "INT_CONST", "INT64_CONST", - "UBYTE_CONST", "USHORT_CONST", "UINT_CONST", "UINT64_CONST", - "FLOAT_CONST", "DOUBLE_CONST", "DIMENSIONS", "VARIABLES", "NETCDF", - "DATA", "TYPES", "COMPOUND", "ENUM", "OPAQUE_", "OPAQUESTRING", "GROUP", - "PATH", "FILLMARKER", "NIL", "_FILLVALUE", "_FORMAT", "_STORAGE", - "_CHUNKSIZES", "_DEFLATELEVEL", "_SHUFFLE", "_ENDIANNESS", "_NOFILL", - "_FLETCHER32", "_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", "_FILTER", - "_CODECS", "DATASETID", "'{'", "'}'", "';'", "','", "'='", "'('", "')'", - "'*'", "':'", "$accept", "ncdesc", "datasetid", "rootgroup", "groupbody", - "subgrouplist", "namedgroup", "$@1", "$@2", "typesection", "typedecls", - "typename", "type_or_attr_decl", "typedecl", "optsemicolon", "enumdecl", + "\"end of file\"", "error", "\"invalid token\"", "NC_UNLIMITED_K", + "CHAR_K", "BYTE_K", "SHORT_K", "INT_K", "FLOAT_K", "DOUBLE_K", "UBYTE_K", + "USHORT_K", "UINT_K", "INT64_K", "UINT64_K", "STRING_K", "IDENT", + "TERMSTRING", "CHAR_CONST", "BYTE_CONST", "SHORT_CONST", "INT_CONST", + "INT64_CONST", "UBYTE_CONST", "USHORT_CONST", "UINT_CONST", + "UINT64_CONST", "FLOAT_CONST", "DOUBLE_CONST", "DIMENSIONS", "VARIABLES", + "NETCDF", "DATA", "TYPES", "COMPOUND", "ENUM", "OPAQUE_", "OPAQUESTRING", + "GROUP", "PATH", "FILLMARKER", "NIL", "_FILLVALUE", "_FORMAT", + "_STORAGE", "_CHUNKSIZES", "_DEFLATELEVEL", "_SHUFFLE", "_ENDIANNESS", + "_NOFILL", "_FLETCHER32", "_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", + "_FILTER", "_CODECS", "_QUANTIZEBG", "_QUANTIZEBR", "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", @@ -688,64 +823,71 @@ static const char *const yytname[] = "constdata", "econstref", "function", "arglist", "simpleconstant", "intlist", "constint", "conststring", "constbool", "varident", "ident", YY_NULLPTR }; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} #endif -# ifdef YYPRINT +#ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 123, 125, 59, - 44, 61, 40, 41, 42, 58 + 305, 306, 307, 308, 309, 310, 311, 312, 313, 123, + 125, 59, 44, 61, 40, 41, 42, 58 }; -# endif +#endif -#define YYPACT_NINF -147 +#define YYPACT_NINF (-149) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-147))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -157 +#define YYTABLE_NINF (-159) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { - -14, -35, 41, -147, -27, -147, 231, -147, -147, -147, - -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, - -147, -147, -9, -147, -147, 423, -18, 15, -3, -147, - -147, 7, 25, 26, 32, 46, -25, -7, 145, 218, - 47, 231, 72, 72, 1, 49, 349, 74, -147, -147, - -4, 50, 52, 55, 56, 59, 60, 61, 62, 63, - 64, 65, 74, 35, 218, -147, -147, 45, 45, 45, - 45, 67, 293, 68, 231, 78, -147, -147, -147, -147, - -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, - -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, - -147, -147, -147, 349, -147, 69, -147, -147, -147, -147, - -147, -147, -147, 73, 79, 76, 77, 349, 72, 49, - 49, 1, 72, 1, 1, 72, 72, 349, 82, -147, - 109, -147, -147, -147, -147, -147, -147, 74, 81, -147, - 231, 84, 80, -147, 85, -147, 88, 231, 118, 36, - 349, 241, -147, 349, 349, 69, -147, 93, -147, -147, - -147, -147, -147, -147, -147, -147, 69, 423, 91, 98, - 95, 97, -147, 74, 29, 231, 100, -147, 387, -147, - 423, -147, -147, -147, 9, -147, 231, 69, 69, 49, - 306, 101, 74, -147, 74, 74, 74, -147, -147, -147, - -147, -147, 103, -147, 99, -147, 106, -147, 105, 107, - -147, 423, 110, 241, -147, -147, -147, -147, 112, -147, - 116, -147, 115, -147, 43, -147, 117, -147, -147, 3, - -2, -147, 349, 120, -147, -147, 142, -147, 74, 28, - -147, -147, 74, 49, -147, -147, 17, -147, -147, 69, - -147, 83, -147, -147, -147, 22, -147, -147, -147, -2, - -147, 231, 28, -147, -147, -147, -147 + -10, -13, 46, -149, -3, -149, 237, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -4, -149, -149, 407, -12, 40, 18, -149, + -149, 29, 32, 33, 38, 39, -9, 24, 251, 224, + 56, 237, 86, 86, 43, 1, 333, 88, -149, -149, + -1, 42, 44, 45, 49, 53, 54, 57, 58, 60, + 61, 62, 63, 64, 88, 65, 224, -149, -149, 67, + 67, 67, 67, 71, 273, 69, 237, 101, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, 333, -149, 72, -149, -149, + -149, -149, -149, -149, -149, 76, 74, 78, 79, 333, + 86, 1, 1, 43, 86, 43, 43, 86, 86, 1, + 1, 333, 84, -149, 123, -149, -149, -149, -149, -149, + -149, 88, 80, -149, 237, 89, 85, -149, 90, -149, + 92, 237, 117, 16, 333, 408, -149, 333, 333, 72, + -149, 94, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, 72, 407, 87, 100, 96, 102, -149, 88, + 41, 237, 103, -149, 371, -149, 407, -149, -149, -149, + -45, -149, 237, 72, 72, 1, 309, 104, 88, -149, + 88, 88, 88, -149, -149, -149, -149, -149, 105, -149, + 95, -149, 106, -149, 108, 107, -149, 407, 112, 408, + -149, -149, -149, -149, 113, -149, 115, -149, 111, -149, + 22, -149, 119, -149, -149, 2, -2, -149, 333, 122, + -149, -149, 129, -149, 88, 11, -149, -149, 88, 1, + -149, -149, -27, -149, -149, 72, -149, 91, -149, -149, + -149, 12, -149, -149, -149, -2, -149, 237, 11, -149, + -149, -149, -149 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -755,55 +897,56 @@ static const yytype_uint8 yydefact[] = { 0, 0, 0, 3, 0, 1, 88, 2, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 156, 109, 0, 6, 87, 0, 85, 11, 0, 86, - 108, 0, 0, 0, 0, 0, 0, 0, 0, 12, - 47, 88, 0, 0, 0, 0, 118, 0, 4, 7, + 158, 111, 0, 6, 87, 0, 85, 11, 0, 86, + 110, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 47, 88, 0, 0, 0, 0, 120, 0, 4, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 13, 14, 17, 23, + 23, 23, 23, 87, 0, 0, 48, 59, 89, 153, + 109, 90, 149, 151, 150, 152, 155, 154, 91, 92, + 146, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 126, 127, 128, 120, 131, 93, 118, 119, + 121, 123, 129, 130, 125, 110, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 13, 14, 17, 23, 23, 23, - 23, 87, 0, 0, 48, 59, 89, 151, 107, 90, - 147, 149, 148, 150, 153, 152, 91, 92, 144, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 124, 125, 126, 118, 129, 93, 116, 117, 119, 121, - 127, 128, 123, 108, 0, 0, 0, 118, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 118, 0, 16, - 0, 15, 24, 19, 22, 21, 20, 0, 0, 18, - 49, 0, 52, 54, 0, 53, 108, 60, 110, 0, - 0, 0, 8, 118, 118, 96, 98, 99, 145, 101, - 102, 103, 106, 100, 104, 105, 95, 0, 0, 0, - 0, 0, 50, 0, 0, 61, 0, 64, 0, 65, - 111, 5, 122, 120, 0, 131, 88, 97, 94, 0, - 0, 0, 0, 85, 0, 0, 0, 51, 55, 58, - 57, 56, 0, 62, 154, 155, 66, 67, 70, 0, - 84, 112, 0, 0, 130, 6, 146, 31, 0, 32, - 34, 75, 78, 29, 0, 26, 0, 30, 63, 0, - 0, 69, 118, 0, 113, 132, 9, 33, 0, 0, - 77, 25, 0, 0, 154, 68, 0, 72, 74, 115, - 114, 0, 76, 83, 82, 0, 80, 27, 28, 0, - 71, 88, 0, 79, 73, 10, 81 + 0, 120, 0, 16, 0, 15, 24, 19, 22, 21, + 20, 0, 0, 18, 49, 0, 52, 54, 0, 53, + 110, 60, 112, 0, 0, 0, 8, 120, 120, 96, + 98, 99, 147, 101, 102, 103, 108, 100, 104, 105, + 106, 107, 95, 0, 0, 0, 0, 0, 50, 0, + 0, 61, 0, 64, 0, 65, 113, 5, 124, 122, + 0, 133, 88, 97, 94, 0, 0, 0, 0, 85, + 0, 0, 0, 51, 55, 58, 57, 56, 0, 62, + 156, 157, 66, 67, 70, 0, 84, 114, 0, 0, + 132, 6, 148, 31, 0, 32, 34, 75, 78, 29, + 0, 26, 0, 30, 63, 0, 0, 69, 120, 0, + 115, 134, 9, 33, 0, 0, 77, 25, 0, 0, + 156, 68, 0, 72, 74, 117, 116, 0, 76, 83, + 82, 0, 80, 27, 28, 0, 71, 88, 0, 79, + 73, 10, 81 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -147, -147, -147, -147, -5, -32, -147, -147, -147, -147, - -147, -134, 121, -147, 30, -147, -147, -58, -147, -147, - -147, -147, -8, -19, -147, -147, 57, -147, 31, -147, - -147, -147, 23, -147, -147, -26, -147, -147, -54, -147, - -37, -147, -147, -56, -147, -33, -15, -40, -28, -44, - -147, -147, 0, -88, -147, -147, 58, -147, -147, -147, - -147, -146, -147, -41, -34, -60, -147, -22 + -149, -149, -149, -149, -8, -35, -149, -149, -149, -149, + -149, -130, 121, -149, 28, -149, -149, -63, -149, -149, + -149, -149, -7, -26, -149, -149, 47, -149, 9, -149, + -149, -149, 14, -149, -149, -42, -149, -149, -75, -149, + -48, -149, -149, -71, -149, -36, -15, -40, -33, -44, + -149, -149, -19, -100, -149, -149, 50, -149, -149, -149, + -149, -148, -149, -41, -34, -73, -149, -22 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 4, 7, 23, 36, 49, 186, 251, 40, - 64, 128, 65, 66, 133, 67, 224, 225, 68, 69, - 70, 190, 191, 24, 75, 140, 141, 142, 143, 144, - 148, 175, 176, 177, 206, 207, 231, 246, 247, 220, - 221, 240, 255, 256, 209, 25, 26, 27, 28, 29, - 181, 211, 212, 105, 106, 107, 108, 109, 110, 111, - 184, 112, 157, 84, 85, 86, 208, 30 + 0, 2, 4, 7, 23, 36, 49, 192, 257, 40, + 66, 132, 67, 68, 137, 69, 230, 231, 70, 71, + 72, 196, 197, 24, 77, 144, 145, 146, 147, 148, + 152, 181, 182, 183, 212, 213, 237, 252, 253, 226, + 227, 246, 261, 262, 215, 25, 26, 27, 28, 29, + 187, 217, 218, 107, 108, 109, 110, 111, 112, 113, + 190, 114, 161, 86, 87, 88, 214, 30 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -811,162 +954,159 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 35, 76, 104, 169, 87, 185, 72, 20, 78, 79, - 37, 73, 20, 47, 20, 149, 61, 1, 77, 244, - 71, 3, 80, 81, 113, 114, 82, 83, 116, 155, - 6, 72, 200, 48, 31, 205, 73, 21, 115, 166, - 129, 5, 32, 33, 34, 71, 145, 38, 39, 253, - 80, 81, 146, 254, 82, 83, 41, 37, 50, 104, - 223, 160, 227, 162, 163, 187, 188, 235, 42, 213, - 80, 81, 214, 104, 82, 83, 74, 259, 158, 159, - 260, 113, 262, 104, 156, 263, 43, 44, 161, 77, - 20, 164, 165, 45, 182, 113, 150, 130, 134, 135, - 136, 241, 137, 242, 132, 113, 104, 46, 147, 104, - 104, 117, 145, 118, 178, 129, 119, 120, 146, 179, - 121, 122, 123, 124, 125, 126, 127, 139, 113, 150, - 168, 113, 113, 201, 192, 151, 152, 153, 154, 167, - 173, 261, 178, 172, 249, 170, 174, 179, 216, -58, - 180, 199, 193, 189, 194, 195, 197, 192, 196, 203, - 219, 20, 228, 37, -156, 210, 229, 230, 232, 234, - 222, 237, 129, 226, 129, 193, 238, 239, 243, 250, - 47, 215, 218, 236, 257, 131, 248, 51, 104, 52, - 53, 54, 55, 56, 57, 58, 210, 171, 202, 59, - 60, 252, 258, 245, 198, 264, 266, 0, 183, 0, - 113, 233, 0, 0, 0, 248, 222, 0, 0, 0, - 226, 265, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 0, 0, - 0, 0, 62, 0, 63, 0, 0, 21, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, - 0, 0, 0, 0, 217, 20, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 0, 0, - 0, 0, 0, 0, 0, 0, 100, 0, 21, 101, - 102, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 204, 0, 0, 103, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, + 35, 78, 106, 74, 89, 153, 75, 191, 80, 81, + 37, 175, 20, 73, 20, 20, 63, 219, 250, 159, + 220, 1, 82, 83, 115, 116, 84, 85, 118, 47, + 74, 172, 259, 75, 211, 265, 260, 21, 266, 31, + 73, 117, 133, 149, 206, 3, 5, 32, 33, 34, + 164, 48, 166, 167, 150, 38, 6, 193, 194, 37, + 79, 106, 82, 83, 82, 83, 84, 85, 84, 85, + 229, 241, 233, 39, 268, 106, 188, 269, 154, 41, + 162, 163, 247, 115, 248, 76, 160, 106, 170, 171, + 165, 50, 42, 168, 169, 43, 44, 115, 138, 139, + 140, 45, 46, 79, 20, 119, 141, 120, 121, 115, + 106, 149, 122, 106, 106, 184, 123, 124, 185, 133, + 125, 126, 150, 127, 128, 129, 130, 131, 136, 134, + 143, 151, 115, 156, 154, 115, 115, 198, 255, 207, + 155, 157, 158, 173, 174, 184, 176, 179, 185, 186, + 178, 267, 200, 180, 222, -58, 195, 205, 199, 201, + 198, 202, -158, 203, 209, 225, 234, 47, 235, 37, + 238, 216, 236, 240, 243, 245, 228, 244, 133, 232, + 133, 199, 249, 256, 221, 263, 242, 135, 204, 224, + 270, 177, 254, 251, 106, 208, 258, 272, 239, 0, + 0, 0, 216, 0, 189, 0, 0, 0, 264, 0, + 0, 0, 0, 0, 0, 0, 115, 0, 0, 0, + 0, 254, 228, 0, 0, 0, 232, 271, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 0, 0, 0, 0, 64, 0, + 65, 0, 0, 21, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 21, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 21 + 0, 22, 0, 51, 0, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 22, 59, 60, 61, 62, 0, + 0, 0, 21, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 142, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 21, 20, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 0, 0, 0, 0, 0, 0, 0, 223, + 102, 0, 21, 103, 104, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 210, 0, 0, + 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 211, 0, 0, 0, 0, 0, 0, + 21, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 0, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 21 }; static const yytype_int16 yycheck[] = { - 22, 41, 46, 137, 45, 151, 39, 16, 42, 43, - 25, 39, 16, 38, 16, 103, 38, 31, 17, 16, - 39, 56, 21, 22, 46, 47, 25, 26, 50, 117, - 57, 64, 3, 58, 43, 32, 64, 39, 42, 127, - 62, 0, 51, 52, 53, 64, 74, 65, 33, 21, - 21, 22, 74, 25, 25, 26, 59, 72, 65, 103, - 194, 121, 196, 123, 124, 153, 154, 213, 61, 60, - 21, 22, 63, 117, 25, 26, 29, 60, 119, 120, - 63, 103, 60, 127, 118, 63, 61, 61, 122, 17, - 16, 125, 126, 61, 58, 117, 60, 62, 68, 69, - 70, 58, 35, 60, 59, 127, 150, 61, 30, 153, - 154, 61, 140, 61, 147, 137, 61, 61, 140, 147, - 61, 61, 61, 61, 61, 61, 61, 59, 150, 60, - 21, 153, 154, 174, 167, 62, 57, 61, 61, 57, - 60, 58, 175, 59, 232, 64, 61, 175, 189, 61, - 32, 173, 167, 60, 63, 57, 59, 190, 63, 59, - 59, 16, 59, 178, 65, 180, 60, 62, 61, 59, - 192, 59, 194, 195, 196, 190, 60, 62, 61, 59, - 38, 186, 190, 215, 242, 64, 230, 42, 232, 44, - 45, 46, 47, 48, 49, 50, 211, 140, 175, 54, - 55, 238, 243, 229, 173, 259, 262, -1, 150, -1, - 232, 211, -1, -1, -1, 259, 238, -1, -1, -1, - 242, 261, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, - -1, -1, 34, -1, 36, -1, -1, 39, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, - -1, -1, -1, -1, 58, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, -1, -1, - -1, -1, -1, -1, -1, -1, 37, -1, 39, 40, - 41, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, -1, -1, 57, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, + 22, 41, 46, 39, 45, 105, 39, 155, 42, 43, + 25, 141, 16, 39, 16, 16, 38, 62, 16, 119, + 65, 31, 21, 22, 46, 47, 25, 26, 50, 38, + 66, 131, 21, 66, 32, 62, 25, 39, 65, 43, + 66, 42, 64, 76, 3, 58, 0, 51, 52, 53, + 123, 60, 125, 126, 76, 67, 59, 157, 158, 74, + 17, 105, 21, 22, 21, 22, 25, 26, 25, 26, + 200, 219, 202, 33, 62, 119, 60, 65, 62, 61, + 121, 122, 60, 105, 62, 29, 120, 131, 129, 130, + 124, 67, 63, 127, 128, 63, 63, 119, 70, 71, + 72, 63, 63, 17, 16, 63, 35, 63, 63, 131, + 154, 144, 63, 157, 158, 151, 63, 63, 151, 141, + 63, 63, 144, 63, 63, 63, 63, 63, 61, 64, + 61, 30, 154, 59, 62, 157, 158, 173, 238, 180, + 64, 63, 63, 59, 21, 181, 66, 62, 181, 32, + 61, 60, 65, 63, 195, 63, 62, 179, 173, 59, + 196, 65, 67, 61, 61, 61, 61, 38, 62, 184, + 63, 186, 64, 61, 61, 64, 198, 62, 200, 201, + 202, 196, 63, 61, 192, 248, 221, 66, 179, 196, + 265, 144, 236, 235, 238, 181, 244, 268, 217, -1, + -1, -1, 217, -1, 154, -1, -1, -1, 249, -1, + -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, + -1, 265, 244, -1, -1, -1, 248, 267, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, -1, -1, -1, -1, 34, -1, + 36, -1, -1, 39, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, 39, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 39 + -1, 67, -1, 42, -1, 44, 45, 46, 47, 48, + 49, 50, -1, -1, 67, 54, 55, 56, 57, -1, + -1, -1, 39, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 39, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, -1, -1, -1, -1, -1, -1, -1, 60, + 37, -1, 39, 40, 41, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, + -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, + 39, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, -1, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 39 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 31, 67, 56, 68, 0, 57, 69, 4, 5, + 0, 31, 69, 58, 70, 0, 59, 71, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 39, 65, 70, 89, 111, 112, 113, 114, 115, - 133, 43, 51, 52, 53, 133, 71, 112, 65, 33, - 75, 59, 61, 61, 61, 61, 61, 38, 58, 72, - 65, 42, 44, 45, 46, 47, 48, 49, 50, 54, - 55, 133, 34, 36, 76, 78, 79, 81, 84, 85, - 86, 89, 111, 114, 29, 90, 113, 17, 130, 130, - 21, 22, 25, 26, 129, 130, 131, 129, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 37, 40, 41, 57, 115, 119, 120, 121, 122, 123, - 124, 125, 127, 133, 133, 42, 133, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 77, 133, - 62, 78, 59, 80, 80, 80, 80, 35, 62, 59, - 91, 92, 93, 94, 95, 114, 133, 30, 96, 119, - 60, 62, 57, 61, 61, 119, 130, 128, 129, 129, - 131, 130, 131, 131, 130, 130, 119, 57, 21, 77, - 64, 92, 59, 60, 61, 97, 98, 99, 111, 114, - 32, 116, 58, 122, 126, 127, 73, 119, 119, 60, - 87, 88, 111, 112, 63, 57, 63, 59, 94, 133, - 3, 129, 98, 59, 16, 32, 100, 101, 132, 110, - 112, 117, 118, 60, 63, 70, 129, 58, 88, 59, - 105, 106, 133, 77, 82, 83, 133, 77, 59, 60, - 62, 102, 61, 118, 59, 127, 71, 59, 60, 62, - 107, 58, 60, 61, 16, 101, 103, 104, 115, 119, - 59, 74, 106, 21, 25, 108, 109, 83, 129, 60, - 63, 58, 60, 63, 104, 113, 109 + 16, 39, 67, 72, 91, 113, 114, 115, 116, 117, + 135, 43, 51, 52, 53, 135, 73, 114, 67, 33, + 77, 61, 63, 63, 63, 63, 63, 38, 60, 74, + 67, 42, 44, 45, 46, 47, 48, 49, 50, 54, + 55, 56, 57, 135, 34, 36, 78, 80, 81, 83, + 86, 87, 88, 91, 113, 116, 29, 92, 115, 17, + 132, 132, 21, 22, 25, 26, 131, 132, 133, 131, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 37, 40, 41, 59, 117, 121, 122, 123, + 124, 125, 126, 127, 129, 135, 135, 42, 135, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 79, 135, 64, 80, 61, 82, 82, 82, + 82, 35, 64, 61, 93, 94, 95, 96, 97, 116, + 135, 30, 98, 121, 62, 64, 59, 63, 63, 121, + 132, 130, 131, 131, 133, 132, 133, 133, 132, 132, + 131, 131, 121, 59, 21, 79, 66, 94, 61, 62, + 63, 99, 100, 101, 113, 116, 32, 118, 60, 124, + 128, 129, 75, 121, 121, 62, 89, 90, 113, 114, + 65, 59, 65, 61, 96, 135, 3, 131, 100, 61, + 16, 32, 102, 103, 134, 112, 114, 119, 120, 62, + 65, 72, 131, 60, 90, 61, 107, 108, 135, 79, + 84, 85, 135, 79, 61, 62, 64, 104, 63, 120, + 61, 129, 73, 61, 62, 64, 109, 60, 62, 63, + 16, 103, 105, 106, 117, 121, 61, 76, 108, 21, + 25, 110, 111, 85, 131, 62, 65, 60, 62, 65, + 106, 115, 111 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 66, 67, 68, 69, 70, 71, 71, 73, 74, - 72, 75, 75, 75, 76, 76, 77, 78, 78, 79, - 79, 79, 79, 80, 80, 81, 82, 82, 83, 84, - 85, 86, 87, 87, 88, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, - 91, 91, 92, 92, 93, 93, 94, 94, 95, 96, - 96, 96, 97, 97, 98, 98, 99, 100, 100, 101, - 102, 102, 103, 103, 104, 105, 105, 106, 107, 107, - 108, 108, 109, 109, 110, 111, 112, 112, 113, 113, - 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, - 114, 114, 114, 114, 114, 114, 114, 114, 115, 115, - 116, 116, 116, 117, 117, 118, 119, 119, 120, 121, - 121, 122, 122, 123, 123, 123, 123, 123, 123, 124, - 125, 126, 126, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 128, 128, 129, 129, 129, - 129, 130, 131, 131, 132, 132, 133 + 0, 68, 69, 70, 71, 72, 73, 73, 75, 76, + 74, 77, 77, 77, 78, 78, 79, 80, 80, 81, + 81, 81, 81, 82, 82, 83, 84, 84, 85, 86, + 87, 88, 89, 89, 90, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, + 93, 93, 94, 94, 95, 95, 96, 96, 97, 98, + 98, 98, 99, 99, 100, 100, 101, 102, 102, 103, + 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, + 110, 110, 111, 111, 112, 113, 114, 114, 115, 115, + 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, + 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, + 117, 117, 118, 118, 118, 119, 119, 120, 121, 121, + 122, 123, 123, 124, 124, 125, 125, 125, 125, 125, + 125, 126, 127, 128, 128, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 130, 130, 131, + 131, 131, 131, 132, 133, 133, 134, 134, 135 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 3, 1, 4, 5, 0, 2, 0, 0, 9, 0, 1, 2, 1, 2, 1, 1, 2, 2, @@ -978,19 +1118,19 @@ static const yytype_uint8 yyr2[] = 0, 3, 1, 3, 1, 1, 3, 2, 0, 3, 1, 3, 1, 1, 1, 1, 1, 1, 0, 3, 4, 4, 4, 4, 6, 5, 5, 6, 5, 5, - 5, 5, 5, 5, 5, 5, 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, 1, 1 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, + 1, 1, 0, 1, 2, 2, 3, 3, 1, 1, + 0, 1, 3, 1, 3, 1, 1, 1, 1, 1, + 1, 1, 4, 1, 3, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1 }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab @@ -999,27 +1139,26 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#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 (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +#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 (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* Enable debugging if requested. */ @@ -1037,54 +1176,58 @@ do { \ } while (0) /* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +# ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value); \ + Kind, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YY_USE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); # endif - YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -1093,7 +1236,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1116,21 +1259,21 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); YYFPRINTF (stderr, "\n"); } } @@ -1145,8 +1288,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -1169,28 +1312,76 @@ int yydebug; #endif -#if YYERROR_VERBOSE +/* Context of a parse error. */ +typedef struct +{ + yy_state_t *yyssp; + yysymbol_kind_t yytoken; +} yypcontext_t; + +/* Put in YYARG at most YYARGN of the expected tokens given the + current YYCTX, and return the number of tokens stored in YYARG. If + YYARG is null, return the number of expected tokens (guaranteed to + be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. + Return 0 if there are more than YYARGN expected tokens, yet fill + YYARG up to YYARGN. */ +static int +yypcontext_expected_tokens (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn) +{ + /* Actual size of YYARG. */ + int yycount = 0; + int yyn = yypact[+*yyctx->yyssp]; + 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 != YYSYMBOL_YYerror + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); + } + } + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = YYSYMBOL_YYEMPTY; + return yycount; +} + + -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else + +#ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } -# endif # endif +#endif -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else +#ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * @@ -1204,10 +1395,10 @@ yystpcpy (char *yydest, const char *yysrc) return yyd - 1; } -# endif # endif +#endif -# ifndef yytnamerr +#ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string @@ -1215,14 +1406,13 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; - for (;;) switch (*++yyp) { @@ -1233,7 +1423,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1248,36 +1441,20 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; } -# endif +#endif -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +yy_syntax_error_arguments (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn) { - 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"). */ + /* Actual size of YYARG. */ 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 @@ -1301,63 +1478,78 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 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) + if (yyctx->yytoken != YYSYMBOL_YYEMPTY) { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } + int yyn; + if (yyarg) + yyarg[yycount] = yyctx->yytoken; + ++yycount; + yyn = yypcontext_expected_tokens (yyctx, + yyarg ? yyarg + 1 : yyarg, yyargn - 1); + if (yyn == YYENOMEM) + return YYENOMEM; + else + yycount += yyn; } + return yycount; +} + +/* 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 YYENOMEM if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + const yypcontext_t *yyctx) +{ + enum { YYARGS_MAX = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + yysymbol_kind_t yyarg[YYARGS_MAX]; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; + + /* Actual size of YYARG. */ + int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); + if (yycount == YYENOMEM) + return YYENOMEM; switch (yycount) { -# define YYCASE_(N, S) \ +#define YYCASE_(N, S) \ case N: \ yyformat = S; \ - break + break + default: /* Avoid compiler warnings. */ 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_ +#undef YYCASE_ } + /* Compute error message size. Don't count the "%s"s, but reserve + room for the terminator. */ + yysize = yystrlen (yyformat) - 2 * yycount + 1; { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + int yyi; + for (yyi = 0; yyi < yycount; ++yyi) + { + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return YYENOMEM; + } } if (*yymsg_alloc < yysize) @@ -1366,7 +1558,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; + return -1; } /* Avoid sprintf, as that infringes on the user's name space. @@ -1378,40 +1570,39 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { - yyp += yytnamerr (yyp, yyarg[yyi++]); + yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); yyformat += 2; } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; } -#endif /* YYERROR_VERBOSE */ + /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { - YYUSE (yyvaluep); + YY_USE (yyvaluep); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } - - -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; /* The semantic value of the lookahead symbol. */ @@ -1420,6 +1611,8 @@ YYSTYPE yylval; int yynerrs; + + /*----------. | yyparse. | `----------*/ @@ -1427,43 +1620,39 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* 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; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - YYSIZE_T yystacksize; + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1471,58 +1660,60 @@ yyparse (void) 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. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined 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. */ + yy_state_t *yyss1 = yyss; 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), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1531,9 +1722,10 @@ yyparse (void) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); @@ -1543,30 +1735,30 @@ yyparse (void) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1577,18 +1769,29 @@ yyparse (void) /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (); } if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1616,15 +1819,13 @@ yyparse (void) /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1639,7 +1840,7 @@ yyparse (void) /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1659,75 +1860,75 @@ yyparse (void) YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 243 "ncgen.y" /* yacc.c:1646 */ - {if (error_count > 0) YYABORT;} -#line 1666 "ncgeny.c" /* yacc.c:1646 */ + case 2: /* ncdesc: NETCDF datasetid rootgroup */ +#line 245 "ncgen.y" + {if (error_count > 0) YYABORT;} +#line 1867 "ncgeny.c" break; - case 3: -#line 246 "ncgen.y" /* yacc.c:1646 */ - {createrootgroup(datasetname);} -#line 1672 "ncgeny.c" /* yacc.c:1646 */ + case 3: /* datasetid: DATASETID */ +#line 248 "ncgen.y" + {createrootgroup(datasetname);} +#line 1873 "ncgeny.c" break; - case 8: -#line 265 "ncgen.y" /* yacc.c:1646 */ - { + case 8: /* $@1: %empty */ +#line 267 "ncgen.y" + { Symbol* id = (yyvsp[-1].sym); markcdf4("Group specification"); if(creategroup(id) == NULL) yyerror("duplicate group declaration within parent group for %s", id->name); } -#line 1684 "ncgeny.c" /* yacc.c:1646 */ +#line 1885 "ncgeny.c" break; - case 9: -#line 274 "ncgen.y" /* yacc.c:1646 */ - {listpop(groupstack);} -#line 1690 "ncgeny.c" /* yacc.c:1646 */ + case 9: /* $@2: %empty */ +#line 276 "ncgen.y" + {listpop(groupstack);} +#line 1891 "ncgeny.c" break; - case 12: -#line 280 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1696 "ncgeny.c" /* yacc.c:1646 */ + case 12: /* typesection: TYPES */ +#line 282 "ncgen.y" + {} +#line 1897 "ncgeny.c" break; - case 13: -#line 282 "ncgen.y" /* yacc.c:1646 */ - {markcdf4("Type specification");} -#line 1702 "ncgeny.c" /* yacc.c:1646 */ + case 13: /* typesection: TYPES typedecls */ +#line 284 "ncgen.y" + {markcdf4("Type specification");} +#line 1903 "ncgeny.c" break; - case 16: -#line 288 "ncgen.y" /* yacc.c:1646 */ - { /* Use when defining a type */ + case 16: /* typename: ident */ +#line 290 "ncgen.y" + { /* Use when defining a type */ (yyvsp[0].sym)->objectclass = NC_TYPE; if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym))) yyerror("duplicate type declaration for %s", (yyvsp[0].sym)->name); listpush(typdefs,(void*)(yyvsp[0].sym)); } -#line 1714 "ncgeny.c" /* yacc.c:1646 */ +#line 1915 "ncgeny.c" break; - case 17: -#line 297 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1720 "ncgeny.c" /* yacc.c:1646 */ + case 17: /* type_or_attr_decl: typedecl */ +#line 299 "ncgen.y" + {} +#line 1921 "ncgeny.c" break; - case 18: -#line 297 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1726 "ncgeny.c" /* yacc.c:1646 */ + case 18: /* type_or_attr_decl: attrdecl ';' */ +#line 299 "ncgen.y" + {} +#line 1927 "ncgeny.c" break; - case 25: -#line 311 "ncgen.y" /* yacc.c:1646 */ - { + case 25: /* enumdecl: primtype ENUM typename '{' enumidlist '}' */ +#line 313 "ncgen.y" + { int i; addtogroup((yyvsp[-3].sym)); /* sets prefix*/ (yyvsp[-3].sym)->objectclass=NC_TYPE; @@ -1753,18 +1954,18 @@ yyparse (void) } listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 1757 "ncgeny.c" /* yacc.c:1646 */ +#line 1958 "ncgeny.c" break; - case 26: -#line 340 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 1763 "ncgeny.c" /* yacc.c:1646 */ + case 26: /* enumidlist: enumid */ +#line 342 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 1964 "ncgeny.c" break; - case 27: -#line 342 "ncgen.y" /* yacc.c:1646 */ - { + case 27: /* enumidlist: enumidlist ',' enumid */ +#line 344 "ncgen.y" + { int i; (yyval.mark)=(yyvsp[-2].mark); /* check for duplicates*/ @@ -1778,23 +1979,23 @@ yyparse (void) } listpush(stack,(void*)(yyvsp[0].sym)); } -#line 1782 "ncgeny.c" /* yacc.c:1646 */ +#line 1983 "ncgeny.c" break; - case 28: -#line 359 "ncgen.y" /* yacc.c:1646 */ - { + case 28: /* enumid: ident '=' constint */ +#line 361 "ncgen.y" + { (yyvsp[-2].sym)->objectclass=NC_TYPE; (yyvsp[-2].sym)->subclass=NC_ECONST; (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant); (yyval.sym)=(yyvsp[-2].sym); } -#line 1793 "ncgeny.c" /* yacc.c:1646 */ +#line 1994 "ncgeny.c" break; - case 29: -#line 368 "ncgen.y" /* yacc.c:1646 */ - { + case 29: /* opaquedecl: OPAQUE_ '(' INT_CONST ')' typename */ +#line 370 "ncgen.y" + { vercheck(NC_OPAQUE); addtogroup((yyvsp[0].sym)); /*sets prefix*/ (yyvsp[0].sym)->objectclass=NC_TYPE; @@ -1803,12 +2004,12 @@ yyparse (void) (yyvsp[0].sym)->typ.size=int32_val; (void)ncaux_class_alignment(NC_OPAQUE,&(yyvsp[0].sym)->typ.alignment); } -#line 1807 "ncgeny.c" /* yacc.c:1646 */ +#line 2008 "ncgeny.c" break; - case 30: -#line 380 "ncgen.y" /* yacc.c:1646 */ - { + case 30: /* vlendecl: typeref '(' '*' ')' typename */ +#line 382 "ncgen.y" + { Symbol* basetype = (yyvsp[-4].sym); vercheck(NC_VLEN); addtogroup((yyvsp[0].sym)); /*sets prefix*/ @@ -1819,12 +2020,12 @@ yyparse (void) (yyvsp[0].sym)->typ.size=VLENSIZE; (void)ncaux_class_alignment(NC_VLEN,&(yyvsp[0].sym)->typ.alignment); } -#line 1823 "ncgeny.c" /* yacc.c:1646 */ +#line 2024 "ncgeny.c" break; - case 31: -#line 394 "ncgen.y" /* yacc.c:1646 */ - { + case 31: /* compounddecl: COMPOUND typename '{' fields '}' */ +#line 396 "ncgen.y" + { int i,j; vercheck(NC_COMPOUND); addtogroup((yyvsp[-3].sym)); @@ -1853,24 +2054,24 @@ yyparse (void) } listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 1857 "ncgeny.c" /* yacc.c:1646 */ +#line 2058 "ncgeny.c" break; - case 32: -#line 426 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 1863 "ncgeny.c" /* yacc.c:1646 */ + case 32: /* fields: field ';' */ +#line 428 "ncgen.y" + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2064 "ncgeny.c" break; - case 33: -#line 427 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark);} -#line 1869 "ncgeny.c" /* yacc.c:1646 */ + case 33: /* fields: fields field ';' */ +#line 429 "ncgen.y" + {(yyval.mark)=(yyvsp[-2].mark);} +#line 2070 "ncgeny.c" break; - case 34: -#line 431 "ncgen.y" /* yacc.c:1646 */ - { + case 34: /* field: typeref fieldlist */ +#line 433 "ncgen.y" + { int i; (yyval.mark)=(yyvsp[0].mark); stackbase=(yyvsp[0].mark); @@ -1881,132 +2082,132 @@ yyparse (void) f->typ.basetype = (yyvsp[-1].sym); } } -#line 1885 "ncgeny.c" /* yacc.c:1646 */ +#line 2086 "ncgeny.c" break; - case 35: -#line 444 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_CHAR]; } -#line 1891 "ncgeny.c" /* yacc.c:1646 */ + case 35: /* primtype: CHAR_K */ +#line 446 "ncgen.y" + { (yyval.sym) = primsymbols[NC_CHAR]; } +#line 2092 "ncgeny.c" break; - case 36: -#line 445 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_BYTE]; } -#line 1897 "ncgeny.c" /* yacc.c:1646 */ + case 36: /* primtype: BYTE_K */ +#line 447 "ncgen.y" + { (yyval.sym) = primsymbols[NC_BYTE]; } +#line 2098 "ncgeny.c" break; - case 37: -#line 446 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_SHORT]; } -#line 1903 "ncgeny.c" /* yacc.c:1646 */ + case 37: /* primtype: SHORT_K */ +#line 448 "ncgen.y" + { (yyval.sym) = primsymbols[NC_SHORT]; } +#line 2104 "ncgeny.c" break; - case 38: -#line 447 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_INT]; } -#line 1909 "ncgeny.c" /* yacc.c:1646 */ + case 38: /* primtype: INT_K */ +#line 449 "ncgen.y" + { (yyval.sym) = primsymbols[NC_INT]; } +#line 2110 "ncgeny.c" break; - case 39: -#line 448 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_FLOAT]; } -#line 1915 "ncgeny.c" /* yacc.c:1646 */ + case 39: /* primtype: FLOAT_K */ +#line 450 "ncgen.y" + { (yyval.sym) = primsymbols[NC_FLOAT]; } +#line 2116 "ncgeny.c" break; - case 40: -#line 449 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym) = primsymbols[NC_DOUBLE]; } -#line 1921 "ncgeny.c" /* yacc.c:1646 */ + case 40: /* primtype: DOUBLE_K */ +#line 451 "ncgen.y" + { (yyval.sym) = primsymbols[NC_DOUBLE]; } +#line 2122 "ncgeny.c" break; - case 41: -#line 450 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } -#line 1927 "ncgeny.c" /* yacc.c:1646 */ + case 41: /* primtype: UBYTE_K */ +#line 452 "ncgen.y" + { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } +#line 2128 "ncgeny.c" break; - case 42: -#line 451 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } -#line 1933 "ncgeny.c" /* yacc.c:1646 */ + case 42: /* primtype: USHORT_K */ +#line 453 "ncgen.y" + { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } +#line 2134 "ncgeny.c" break; - case 43: -#line 452 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } -#line 1939 "ncgeny.c" /* yacc.c:1646 */ + case 43: /* primtype: UINT_K */ +#line 454 "ncgen.y" + { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } +#line 2140 "ncgeny.c" break; - case 44: -#line 453 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } -#line 1945 "ncgeny.c" /* yacc.c:1646 */ + case 44: /* primtype: INT64_K */ +#line 455 "ncgen.y" + { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } +#line 2146 "ncgeny.c" break; - case 45: -#line 454 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } -#line 1951 "ncgeny.c" /* yacc.c:1646 */ + case 45: /* primtype: UINT64_K */ +#line 456 "ncgen.y" + { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } +#line 2152 "ncgeny.c" break; - case 46: -#line 455 "ncgen.y" /* yacc.c:1646 */ - { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; } -#line 1957 "ncgeny.c" /* yacc.c:1646 */ + case 46: /* primtype: STRING_K */ +#line 457 "ncgen.y" + { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; } +#line 2158 "ncgeny.c" break; - case 48: -#line 459 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1963 "ncgeny.c" /* yacc.c:1646 */ + case 48: /* dimsection: DIMENSIONS */ +#line 461 "ncgen.y" + {} +#line 2164 "ncgeny.c" break; - case 49: -#line 460 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1969 "ncgeny.c" /* yacc.c:1646 */ + case 49: /* dimsection: DIMENSIONS dimdecls */ +#line 462 "ncgen.y" + {} +#line 2170 "ncgeny.c" break; - case 52: -#line 467 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1975 "ncgeny.c" /* yacc.c:1646 */ + case 52: /* dim_or_attr_decl: dimdeclist */ +#line 469 "ncgen.y" + {} +#line 2176 "ncgeny.c" break; - case 53: -#line 467 "ncgen.y" /* yacc.c:1646 */ - {} -#line 1981 "ncgeny.c" /* yacc.c:1646 */ + case 53: /* dim_or_attr_decl: attrdecl */ +#line 469 "ncgen.y" + {} +#line 2182 "ncgeny.c" break; - case 56: -#line 475 "ncgen.y" /* yacc.c:1646 */ - { + case 56: /* dimdecl: dimd '=' constint */ +#line 477 "ncgen.y" + { (yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant)); #ifdef GENDEBUG1 fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize); #endif reclaimconstant((yyvsp[0].constant)); } -#line 1993 "ncgeny.c" /* yacc.c:1646 */ +#line 2194 "ncgeny.c" break; - case 57: -#line 483 "ncgen.y" /* yacc.c:1646 */ - { + case 57: /* dimdecl: dimd '=' NC_UNLIMITED_K */ +#line 485 "ncgen.y" + { (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED; (yyvsp[-2].sym)->dim.isunlimited = 1; #ifdef GENDEBUG1 fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); #endif } -#line 2005 "ncgeny.c" /* yacc.c:1646 */ +#line 2206 "ncgeny.c" break; - case 58: -#line 493 "ncgen.y" /* yacc.c:1646 */ - { + case 58: /* dimd: ident */ +#line 495 "ncgen.y" + { (yyvsp[0].sym)->objectclass=NC_DIM; if(dupobjectcheck(NC_DIM,(yyvsp[0].sym))) yyerror( "Duplicate dimension declaration for %s", @@ -2015,36 +2216,36 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)=(yyvsp[0].sym); listpush(dimdefs,(void*)(yyvsp[0].sym)); } -#line 2019 "ncgeny.c" /* yacc.c:1646 */ +#line 2220 "ncgeny.c" break; - case 60: -#line 505 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2025 "ncgeny.c" /* yacc.c:1646 */ + case 60: /* vasection: VARIABLES */ +#line 507 "ncgen.y" + {} +#line 2226 "ncgeny.c" break; - case 61: -#line 506 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2031 "ncgeny.c" /* yacc.c:1646 */ + case 61: /* vasection: VARIABLES vadecls */ +#line 508 "ncgen.y" + {} +#line 2232 "ncgeny.c" break; - case 64: -#line 513 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2037 "ncgeny.c" /* yacc.c:1646 */ + case 64: /* vadecl_or_attr: vardecl */ +#line 515 "ncgen.y" + {} +#line 2238 "ncgeny.c" break; - case 65: -#line 513 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2043 "ncgeny.c" /* yacc.c:1646 */ + case 65: /* vadecl_or_attr: attrdecl */ +#line 515 "ncgen.y" + {} +#line 2244 "ncgeny.c" break; - case 66: -#line 516 "ncgen.y" /* yacc.c:1646 */ - { + case 66: /* vardecl: typeref varlist */ +#line 518 "ncgen.y" + { int i; stackbase=(yyvsp[0].mark); stacklen=listlength(stack); @@ -2063,26 +2264,26 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); } listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 2067 "ncgeny.c" /* yacc.c:1646 */ +#line 2268 "ncgeny.c" break; - case 67: -#line 538 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); + case 67: /* varlist: varspec */ +#line 540 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym)); } -#line 2075 "ncgeny.c" /* yacc.c:1646 */ +#line 2276 "ncgeny.c" break; - case 68: -#line 542 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2081 "ncgeny.c" /* yacc.c:1646 */ + case 68: /* varlist: varlist ',' varspec */ +#line 544 "ncgen.y" + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2282 "ncgeny.c" break; - case 69: -#line 546 "ncgen.y" /* yacc.c:1646 */ - { + case 69: /* varspec: varident dimspec */ +#line 548 "ncgen.y" + { int i; Dimset dimset; Symbol* var = (yyvsp[-1].sym); /* for debugging */ @@ -2108,36 +2309,36 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); listsetlength(stack,stackbase);/* remove stack nodes*/ (yyval.sym) = var; } -#line 2112 "ncgeny.c" /* yacc.c:1646 */ +#line 2313 "ncgeny.c" break; - case 70: -#line 574 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack);} -#line 2118 "ncgeny.c" /* yacc.c:1646 */ + case 70: /* dimspec: %empty */ +#line 576 "ncgen.y" + {(yyval.mark)=listlength(stack);} +#line 2319 "ncgeny.c" break; - case 71: -#line 575 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 2124 "ncgeny.c" /* yacc.c:1646 */ + case 71: /* dimspec: '(' dimlist ')' */ +#line 577 "ncgen.y" + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2325 "ncgeny.c" break; - case 72: -#line 578 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2130 "ncgeny.c" /* yacc.c:1646 */ + case 72: /* dimlist: dimref */ +#line 580 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2331 "ncgeny.c" break; - case 73: -#line 580 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2136 "ncgeny.c" /* yacc.c:1646 */ + case 73: /* dimlist: dimlist ',' dimref */ +#line 582 "ncgen.y" + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2337 "ncgeny.c" break; - case 74: -#line 584 "ncgen.y" /* yacc.c:1646 */ - {Symbol* dimsym = (yyvsp[0].sym); + case 74: /* dimref: path */ +#line 586 "ncgen.y" + {Symbol* dimsym = (yyvsp[0].sym); dimsym->objectclass = NC_DIM; /* Find the actual dimension*/ dimsym = locate(dimsym); @@ -2147,26 +2348,26 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); } (yyval.sym)=dimsym; } -#line 2151 "ncgeny.c" /* yacc.c:1646 */ +#line 2352 "ncgeny.c" break; - case 75: -#line 598 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); + case 75: /* fieldlist: fieldspec */ +#line 600 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym)); } -#line 2159 "ncgeny.c" /* yacc.c:1646 */ +#line 2360 "ncgeny.c" break; - case 76: -#line 602 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2165 "ncgeny.c" /* yacc.c:1646 */ + case 76: /* fieldlist: fieldlist ',' fieldspec */ +#line 604 "ncgen.y" + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2366 "ncgeny.c" break; - case 77: -#line 607 "ncgen.y" /* yacc.c:1646 */ - { + case 77: /* fieldspec: ident fielddimspec */ +#line 609 "ncgen.y" + { int i; Dimset dimset; stackbase=(yyvsp[0].mark); @@ -2192,36 +2393,36 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); listsetlength(stack,stackbase);/* remove stack nodes*/ (yyval.sym) = (yyvsp[-1].sym); } -#line 2196 "ncgeny.c" /* yacc.c:1646 */ +#line 2397 "ncgeny.c" break; - case 78: -#line 635 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack);} -#line 2202 "ncgeny.c" /* yacc.c:1646 */ + case 78: /* fielddimspec: %empty */ +#line 637 "ncgen.y" + {(yyval.mark)=listlength(stack);} +#line 2403 "ncgeny.c" break; - case 79: -#line 636 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 2208 "ncgeny.c" /* yacc.c:1646 */ + case 79: /* fielddimspec: '(' fielddimlist ')' */ +#line 638 "ncgen.y" + {(yyval.mark)=(yyvsp[-1].mark);} +#line 2409 "ncgeny.c" break; - case 80: -#line 640 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2214 "ncgeny.c" /* yacc.c:1646 */ + case 80: /* fielddimlist: fielddim */ +#line 642 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2415 "ncgeny.c" break; - case 81: -#line 642 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2220 "ncgeny.c" /* yacc.c:1646 */ + case 81: /* fielddimlist: fielddimlist ',' fielddim */ +#line 644 "ncgen.y" + {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} +#line 2421 "ncgeny.c" break; - case 82: -#line 647 "ncgen.y" /* yacc.c:1646 */ - { /* Anonymous integer dimension. + case 82: /* fielddim: UINT_CONST */ +#line 649 "ncgen.y" + { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; sprintf(anon,"const%u",uint32_val); @@ -2230,12 +2431,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = uint32_val; } -#line 2234 "ncgeny.c" /* yacc.c:1646 */ +#line 2435 "ncgeny.c" break; - case 83: -#line 657 "ncgen.y" /* yacc.c:1646 */ - { /* Anonymous integer dimension. + case 83: /* fielddim: INT_CONST */ +#line 659 "ncgen.y" + { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; if(int32_val <= 0) { @@ -2248,36 +2449,36 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = int32_val; } -#line 2252 "ncgeny.c" /* yacc.c:1646 */ +#line 2453 "ncgeny.c" break; - case 84: -#line 677 "ncgen.y" /* yacc.c:1646 */ - {Symbol* vsym = (yyvsp[0].sym); + case 84: /* varref: ambiguous_ref */ +#line 679 "ncgen.y" + {Symbol* vsym = (yyvsp[0].sym); if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); YYABORT; } (yyval.sym)=vsym; } -#line 2264 "ncgeny.c" /* yacc.c:1646 */ +#line 2465 "ncgeny.c" break; - case 85: -#line 688 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tsym = (yyvsp[0].sym); + case 85: /* typeref: ambiguous_ref */ +#line 690 "ncgen.y" + {Symbol* tsym = (yyvsp[0].sym); if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); YYABORT; } (yyval.sym)=tsym; } -#line 2276 "ncgeny.c" /* yacc.c:1646 */ +#line 2477 "ncgeny.c" break; - case 86: -#line 699 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; + case 86: /* ambiguous_ref: path */ +#line 701 "ncgen.y" + {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; /* disambiguate*/ tvsym->objectclass = NC_VAR; sym = locate(tvsym); @@ -2295,54 +2496,54 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); } (yyval.sym)=tvsym; } -#line 2299 "ncgeny.c" /* yacc.c:1646 */ +#line 2500 "ncgeny.c" break; - case 87: -#line 717 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2305 "ncgeny.c" /* yacc.c:1646 */ + case 87: /* ambiguous_ref: primtype */ +#line 719 "ncgen.y" + {(yyval.sym)=(yyvsp[0].sym);} +#line 2506 "ncgeny.c" break; - case 88: -#line 724 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2311 "ncgeny.c" /* yacc.c:1646 */ + case 88: /* attrdecllist: %empty */ +#line 726 "ncgen.y" + {} +#line 2512 "ncgeny.c" break; - case 89: -#line 724 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2317 "ncgeny.c" /* yacc.c:1646 */ + case 89: /* attrdecllist: attrdecl ';' attrdecllist */ +#line 726 "ncgen.y" + {} +#line 2518 "ncgeny.c" break; - case 90: -#line 728 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2323 "ncgeny.c" /* yacc.c:1646 */ + case 90: /* attrdecl: ':' _NCPROPS '=' conststring */ +#line 730 "ncgen.y" + {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2524 "ncgeny.c" break; - case 91: -#line 730 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2329 "ncgeny.c" /* yacc.c:1646 */ + case 91: /* attrdecl: ':' _ISNETCDF4 '=' constbool */ +#line 732 "ncgen.y" + {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2530 "ncgeny.c" break; - case 92: -#line 732 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2335 "ncgeny.c" /* yacc.c:1646 */ + case 92: /* attrdecl: ':' _SUPERBLOCK '=' constint */ +#line 734 "ncgen.y" + {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2536 "ncgeny.c" break; - case 93: -#line 734 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} -#line 2341 "ncgeny.c" /* yacc.c:1646 */ + case 93: /* attrdecl: ':' ident '=' datalist */ +#line 736 "ncgen.y" + { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} +#line 2542 "ncgeny.c" break; - case 94: -#line 736 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); + case 94: /* attrdecl: typeref ambiguous_ref ':' ident '=' datalist */ +#line 738 "ncgen.y" + {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[0].datalist),ATTRVAR); } else { @@ -2350,12 +2551,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); YYABORT; } } -#line 2354 "ncgeny.c" /* yacc.c:1646 */ +#line 2555 "ncgeny.c" break; - case 95: -#line 745 "ncgen.y" /* yacc.c:1646 */ - {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); + case 95: /* attrdecl: ambiguous_ref ':' ident '=' datalist */ +#line 747 "ncgen.y" + {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(sym->objectclass == NC_VAR) { (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR); } else if(sym->objectclass == NC_TYPE) { @@ -2365,363 +2566,376 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); YYABORT; } } -#line 2369 "ncgeny.c" /* yacc.c:1646 */ +#line 2570 "ncgeny.c" break; - case 96: -#line 756 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} -#line 2375 "ncgeny.c" /* yacc.c:1646 */ + case 96: /* attrdecl: ambiguous_ref ':' _FILLVALUE '=' datalist */ +#line 758 "ncgen.y" + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} +#line 2576 "ncgeny.c" break; - case 97: -#line 758 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),ISLIST);} -#line 2381 "ncgeny.c" /* yacc.c:1646 */ + case 97: /* attrdecl: typeref ambiguous_ref ':' _FILLVALUE '=' datalist */ +#line 760 "ncgen.y" + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),ISLIST);} +#line 2582 "ncgeny.c" break; - case 98: -#line 760 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2387 "ncgeny.c" /* yacc.c:1646 */ + case 98: /* attrdecl: ambiguous_ref ':' _STORAGE '=' conststring */ +#line 762 "ncgen.y" + {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2588 "ncgeny.c" break; - case 99: -#line 762 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} -#line 2393 "ncgeny.c" /* yacc.c:1646 */ + case 99: /* attrdecl: ambiguous_ref ':' _CHUNKSIZES '=' intlist */ +#line 764 "ncgen.y" + {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} +#line 2594 "ncgeny.c" break; - case 100: -#line 764 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2399 "ncgeny.c" /* yacc.c:1646 */ + case 100: /* attrdecl: ambiguous_ref ':' _FLETCHER32 '=' constbool */ +#line 766 "ncgen.y" + {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2600 "ncgeny.c" break; - case 101: -#line 766 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2405 "ncgeny.c" /* yacc.c:1646 */ + case 101: /* attrdecl: ambiguous_ref ':' _DEFLATELEVEL '=' constint */ +#line 768 "ncgen.y" + {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2606 "ncgeny.c" break; - case 102: -#line 768 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2411 "ncgeny.c" /* yacc.c:1646 */ + case 102: /* attrdecl: ambiguous_ref ':' _SHUFFLE '=' constbool */ +#line 770 "ncgen.y" + {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2612 "ncgeny.c" break; - case 103: -#line 770 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2417 "ncgeny.c" /* yacc.c:1646 */ + case 103: /* attrdecl: ambiguous_ref ':' _ENDIANNESS '=' conststring */ +#line 772 "ncgen.y" + {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2618 "ncgeny.c" break; - case 104: -#line 772 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2423 "ncgeny.c" /* yacc.c:1646 */ + case 104: /* attrdecl: ambiguous_ref ':' _FILTER '=' conststring */ +#line 774 "ncgen.y" + {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2624 "ncgeny.c" break; - case 105: -#line 774 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_CODECS_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2429 "ncgeny.c" /* yacc.c:1646 */ + case 105: /* attrdecl: ambiguous_ref ':' _CODECS '=' conststring */ +#line 776 "ncgen.y" + {(yyval.sym) = makespecial(_CODECS_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2630 "ncgeny.c" break; - case 106: -#line 776 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2435 "ncgeny.c" /* yacc.c:1646 */ + case 106: /* attrdecl: ambiguous_ref ':' _QUANTIZEBG '=' constint */ +#line 778 "ncgen.y" + {(yyval.sym) = makespecial(_QUANTIZEBG_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2636 "ncgeny.c" break; - case 107: -#line 778 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} -#line 2441 "ncgeny.c" /* yacc.c:1646 */ + case 107: /* attrdecl: ambiguous_ref ':' _QUANTIZEBR '=' constint */ +#line 780 "ncgen.y" + {(yyval.sym) = makespecial(_QUANTIZEBR_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2642 "ncgeny.c" break; - case 108: -#line 783 "ncgen.y" /* yacc.c:1646 */ - { + case 108: /* attrdecl: ambiguous_ref ':' _NOFILL '=' constbool */ +#line 782 "ncgen.y" + {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2648 "ncgeny.c" + break; + + case 109: /* attrdecl: ':' _FORMAT '=' conststring */ +#line 784 "ncgen.y" + {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} +#line 2654 "ncgeny.c" + break; + + case 110: /* path: ident */ +#line 789 "ncgen.y" + { (yyval.sym)=(yyvsp[0].sym); (yyvsp[0].sym)->ref.is_ref=1; (yyvsp[0].sym)->is_prefixed=0; setpathcurrent((yyvsp[0].sym)); } -#line 2452 "ncgeny.c" /* yacc.c:1646 */ +#line 2665 "ncgeny.c" break; - case 109: -#line 790 "ncgen.y" /* yacc.c:1646 */ - { + case 111: /* path: PATH */ +#line 796 "ncgen.y" + { (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 2463 "ncgeny.c" /* yacc.c:1646 */ +#line 2676 "ncgeny.c" break; - case 111: -#line 799 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2469 "ncgeny.c" /* yacc.c:1646 */ + case 113: /* datasection: DATA */ +#line 805 "ncgen.y" + {} +#line 2682 "ncgeny.c" break; - case 112: -#line 800 "ncgen.y" /* yacc.c:1646 */ - {} -#line 2475 "ncgeny.c" /* yacc.c:1646 */ + case 114: /* datasection: DATA datadecls */ +#line 806 "ncgen.y" + {} +#line 2688 "ncgeny.c" break; - case 115: -#line 808 "ncgen.y" /* yacc.c:1646 */ - {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} -#line 2481 "ncgeny.c" /* yacc.c:1646 */ + case 117: /* datadecl: varref '=' datalist */ +#line 814 "ncgen.y" + {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} +#line 2694 "ncgeny.c" break; - case 116: -#line 811 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = (yyvsp[0].datalist);} -#line 2487 "ncgeny.c" /* yacc.c:1646 */ + case 118: /* datalist: datalist0 */ +#line 817 "ncgen.y" + {(yyval.datalist) = (yyvsp[0].datalist);} +#line 2700 "ncgeny.c" break; - case 117: -#line 812 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = (yyvsp[0].datalist);} -#line 2493 "ncgeny.c" /* yacc.c:1646 */ + case 119: /* datalist: datalist1 */ +#line 818 "ncgen.y" + {(yyval.datalist) = (yyvsp[0].datalist);} +#line 2706 "ncgeny.c" break; - case 118: -#line 816 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = builddatalist(0);} -#line 2499 "ncgeny.c" /* yacc.c:1646 */ + case 120: /* datalist0: %empty */ +#line 822 "ncgen.y" + {(yyval.datalist) = builddatalist(0);} +#line 2712 "ncgeny.c" break; - case 119: -#line 820 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = const2list((yyvsp[0].constant));} -#line 2505 "ncgeny.c" /* yacc.c:1646 */ + case 121: /* datalist1: dataitem */ +#line 826 "ncgen.y" + {(yyval.datalist) = const2list((yyvsp[0].constant));} +#line 2718 "ncgeny.c" break; - case 120: -#line 822 "ncgen.y" /* yacc.c:1646 */ - {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist); } -#line 2511 "ncgeny.c" /* yacc.c:1646 */ + case 122: /* datalist1: datalist ',' dataitem */ +#line 828 "ncgen.y" + {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist); } +#line 2724 "ncgeny.c" break; - case 121: -#line 826 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2517 "ncgeny.c" /* yacc.c:1646 */ + case 123: /* dataitem: constdata */ +#line 832 "ncgen.y" + {(yyval.constant)=(yyvsp[0].constant);} +#line 2730 "ncgeny.c" break; - case 122: -#line 827 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} -#line 2523 "ncgeny.c" /* yacc.c:1646 */ + case 124: /* dataitem: '{' datalist '}' */ +#line 833 "ncgen.y" + {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} +#line 2736 "ncgeny.c" break; - case 123: -#line 831 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2529 "ncgeny.c" /* yacc.c:1646 */ + case 125: /* constdata: simpleconstant */ +#line 837 "ncgen.y" + {(yyval.constant)=(yyvsp[0].constant);} +#line 2742 "ncgeny.c" break; - case 124: -#line 832 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_OPAQUE);} -#line 2535 "ncgeny.c" /* yacc.c:1646 */ + case 126: /* constdata: OPAQUESTRING */ +#line 838 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_OPAQUE);} +#line 2748 "ncgeny.c" break; - case 125: -#line 833 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_FILLVALUE);} -#line 2541 "ncgeny.c" /* yacc.c:1646 */ + case 127: /* constdata: FILLMARKER */ +#line 839 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_FILLVALUE);} +#line 2754 "ncgeny.c" break; - case 126: -#line 834 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_NIL);} -#line 2547 "ncgeny.c" /* yacc.c:1646 */ + case 128: /* constdata: NIL */ +#line 840 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_NIL);} +#line 2760 "ncgeny.c" break; - case 127: -#line 835 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2553 "ncgeny.c" /* yacc.c:1646 */ + case 129: /* constdata: econstref */ +#line 841 "ncgen.y" + {(yyval.constant)=(yyvsp[0].constant);} +#line 2766 "ncgeny.c" break; - case 129: -#line 840 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} -#line 2559 "ncgeny.c" /* yacc.c:1646 */ + case 131: /* econstref: path */ +#line 846 "ncgen.y" + {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} +#line 2772 "ncgeny.c" break; - case 130: -#line 844 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} -#line 2565 "ncgeny.c" /* yacc.c:1646 */ + case 132: /* function: ident '(' arglist ')' */ +#line 850 "ncgen.y" + {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} +#line 2778 "ncgeny.c" break; - case 131: -#line 849 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = const2list((yyvsp[0].constant));} -#line 2571 "ncgeny.c" /* yacc.c:1646 */ + case 133: /* arglist: simpleconstant */ +#line 855 "ncgen.y" + {(yyval.datalist) = const2list((yyvsp[0].constant));} +#line 2784 "ncgeny.c" break; - case 132: -#line 851 "ncgen.y" /* yacc.c:1646 */ - {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} -#line 2577 "ncgeny.c" /* yacc.c:1646 */ + case 134: /* arglist: arglist ',' simpleconstant */ +#line 857 "ncgen.y" + {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} +#line 2790 "ncgeny.c" break; - case 133: -#line 855 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_CHAR);} -#line 2583 "ncgeny.c" /* yacc.c:1646 */ + case 135: /* simpleconstant: CHAR_CONST */ +#line 861 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_CHAR);} +#line 2796 "ncgeny.c" break; - case 134: -#line 856 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_BYTE);} -#line 2589 "ncgeny.c" /* yacc.c:1646 */ + case 136: /* simpleconstant: BYTE_CONST */ +#line 862 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_BYTE);} +#line 2802 "ncgeny.c" break; - case 135: -#line 857 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_SHORT);} -#line 2595 "ncgeny.c" /* yacc.c:1646 */ + case 137: /* simpleconstant: SHORT_CONST */ +#line 863 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_SHORT);} +#line 2808 "ncgeny.c" break; - case 136: -#line 858 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT);} -#line 2601 "ncgeny.c" /* yacc.c:1646 */ + case 138: /* simpleconstant: INT_CONST */ +#line 864 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT);} +#line 2814 "ncgeny.c" break; - case 137: -#line 859 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT64);} -#line 2607 "ncgeny.c" /* yacc.c:1646 */ + case 139: /* simpleconstant: INT64_CONST */ +#line 865 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT64);} +#line 2820 "ncgeny.c" break; - case 138: -#line 860 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UBYTE);} -#line 2613 "ncgeny.c" /* yacc.c:1646 */ + case 140: /* simpleconstant: UBYTE_CONST */ +#line 866 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UBYTE);} +#line 2826 "ncgeny.c" break; - case 139: -#line 861 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_USHORT);} -#line 2619 "ncgeny.c" /* yacc.c:1646 */ + case 141: /* simpleconstant: USHORT_CONST */ +#line 867 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_USHORT);} +#line 2832 "ncgeny.c" break; - case 140: -#line 862 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT);} -#line 2625 "ncgeny.c" /* yacc.c:1646 */ + case 142: /* simpleconstant: UINT_CONST */ +#line 868 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT);} +#line 2838 "ncgeny.c" break; - case 141: -#line 863 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT64);} -#line 2631 "ncgeny.c" /* yacc.c:1646 */ + case 143: /* simpleconstant: UINT64_CONST */ +#line 869 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT64);} +#line 2844 "ncgeny.c" break; - case 142: -#line 864 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_FLOAT);} -#line 2637 "ncgeny.c" /* yacc.c:1646 */ + case 144: /* simpleconstant: FLOAT_CONST */ +#line 870 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_FLOAT);} +#line 2850 "ncgeny.c" break; - case 143: -#line 865 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_DOUBLE);} -#line 2643 "ncgeny.c" /* yacc.c:1646 */ + case 145: /* simpleconstant: DOUBLE_CONST */ +#line 871 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_DOUBLE);} +#line 2856 "ncgeny.c" break; - case 144: -#line 866 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_STRING);} -#line 2649 "ncgeny.c" /* yacc.c:1646 */ + case 146: /* simpleconstant: TERMSTRING */ +#line 872 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_STRING);} +#line 2862 "ncgeny.c" break; - case 145: -#line 870 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = const2list((yyvsp[0].constant));} -#line 2655 "ncgeny.c" /* yacc.c:1646 */ + case 147: /* intlist: constint */ +#line 876 "ncgen.y" + {(yyval.datalist) = const2list((yyvsp[0].constant));} +#line 2868 "ncgeny.c" break; - case 146: -#line 871 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist)=(yyvsp[-2].datalist); dlappend((yyvsp[-2].datalist),((yyvsp[0].constant)));} -#line 2661 "ncgeny.c" /* yacc.c:1646 */ + case 148: /* intlist: intlist ',' constint */ +#line 877 "ncgen.y" + {(yyval.datalist)=(yyvsp[-2].datalist); dlappend((yyvsp[-2].datalist),((yyvsp[0].constant)));} +#line 2874 "ncgeny.c" break; - case 147: -#line 876 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT);} -#line 2667 "ncgeny.c" /* yacc.c:1646 */ + case 149: /* constint: INT_CONST */ +#line 882 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT);} +#line 2880 "ncgeny.c" break; - case 148: -#line 878 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT);} -#line 2673 "ncgeny.c" /* yacc.c:1646 */ + case 150: /* constint: UINT_CONST */ +#line 884 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT);} +#line 2886 "ncgeny.c" break; - case 149: -#line 880 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_INT64);} -#line 2679 "ncgeny.c" /* yacc.c:1646 */ + case 151: /* constint: INT64_CONST */ +#line 886 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_INT64);} +#line 2892 "ncgeny.c" break; - case 150: -#line 882 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_UINT64);} -#line 2685 "ncgeny.c" /* yacc.c:1646 */ + case 152: /* constint: UINT64_CONST */ +#line 888 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_UINT64);} +#line 2898 "ncgeny.c" break; - case 151: -#line 886 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=makeconstdata(NC_STRING);} -#line 2691 "ncgeny.c" /* yacc.c:1646 */ + case 153: /* conststring: TERMSTRING */ +#line 892 "ncgen.y" + {(yyval.constant)=makeconstdata(NC_STRING);} +#line 2904 "ncgeny.c" break; - case 152: -#line 890 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2697 "ncgeny.c" /* yacc.c:1646 */ + case 154: /* constbool: conststring */ +#line 896 "ncgen.y" + {(yyval.constant)=(yyvsp[0].constant);} +#line 2910 "ncgeny.c" break; - case 153: -#line 891 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2703 "ncgeny.c" /* yacc.c:1646 */ + case 155: /* constbool: constint */ +#line 897 "ncgen.y" + {(yyval.constant)=(yyvsp[0].constant);} +#line 2916 "ncgeny.c" break; - case 154: -#line 899 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2709 "ncgeny.c" /* yacc.c:1646 */ + case 156: /* varident: IDENT */ +#line 905 "ncgen.y" + {(yyval.sym)=(yyvsp[0].sym);} +#line 2922 "ncgeny.c" break; - case 155: -#line 900 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=identkeyword((yyvsp[0].sym));} -#line 2715 "ncgeny.c" /* yacc.c:1646 */ + case 157: /* varident: DATA */ +#line 906 "ncgen.y" + {(yyval.sym)=identkeyword((yyvsp[0].sym));} +#line 2928 "ncgeny.c" break; - case 156: -#line 904 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2721 "ncgeny.c" /* yacc.c:1646 */ + case 158: /* ident: IDENT */ +#line 910 "ncgen.y" + {(yyval.sym)=(yyvsp[0].sym);} +#line 2934 "ncgeny.c" break; -#line 2725 "ncgeny.c" /* yacc.c:1646 */ +#line 2938 "ncgeny.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2735,25 +2949,23 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); 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); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2764,50 +2976,44 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); 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); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) { + yypcontext_t yyctx + = {yyssp, yytoken}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; + yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); if (yysyntax_error_status == 0) yymsgp = yymsg; - else if (yysyntax_error_status == 1) + else if (yysyntax_error_status == -1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) + yymsg = YY_CAST (char *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + if (yymsg) { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; + yysyntax_error_status + = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); + yymsgp = yymsg; } else { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = YYENOMEM; } } yyerror (yymsgp); - if (yysyntax_error_status == 2) + if (yysyntax_error_status == YYENOMEM) goto yyexhaustedlab; } -# undef YYSYNTAX_ERROR -#endif } - - if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -2836,12 +3042,10 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2858,13 +3062,14 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -2878,7 +3083,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); yydestruct ("Error: popping", - yystos[yystate], yyvsp); + YY_ACCESSING_SYMBOL (yystate), yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2890,7 +3095,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -2903,6 +3108,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2910,16 +3116,21 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE + +#if 1 /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ + goto yyreturn; #endif + +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2936,20 +3147,19 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); -#endif return yyresult; } -#line 907 "ncgen.y" /* yacc.c:1906 */ + +#line 913 "ncgen.y" #ifndef NO_STDARG @@ -3286,6 +3496,8 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) break; case _SUPERBLOCK_FLAG: case _DEFLATE_FLAG: + case _QUANTIZEBG_FLAG: + case _QUANTIZEBR_FLAG: tmp = nullconst(); tmp->nctype = NC_INT; convert1(con,tmp); @@ -3382,6 +3594,16 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) special->_DeflateLevel = idata; special->flags |= _DEFLATE_FLAG; break; + case _QUANTIZEBG_FLAG: + special->_Quantizer = NC_QUANTIZE_BITGROOM; + special->_NSD = idata; + special->flags |= _QUANTIZEBG_FLAG; + break; + case _QUANTIZEBR_FLAG: + special->_Quantizer = NC_QUANTIZE_GRANULARBR; + special->_NSD = idata; + special->flags |= _QUANTIZEBR_FLAG; + break; case _SHUFFLE_FLAG: special->_Shuffle = tf; special->flags |= _SHUFFLE_FLAG; diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h index 05c1de616a..009885edbb 100644 --- a/ncgen/ncgeny.h +++ b/ncgen/ncgeny.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.7.5. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,10 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + #ifndef YY_NCG_NCGEN_TAB_H_INCLUDED # define YY_NCG_NCGEN_TAB_H_INCLUDED /* Debug traces. */ @@ -40,74 +45,80 @@ extern int ncgdebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - STRING_K = 270, - IDENT = 271, - TERMSTRING = 272, - CHAR_CONST = 273, - BYTE_CONST = 274, - SHORT_CONST = 275, - INT_CONST = 276, - INT64_CONST = 277, - UBYTE_CONST = 278, - USHORT_CONST = 279, - UINT_CONST = 280, - UINT64_CONST = 281, - FLOAT_CONST = 282, - DOUBLE_CONST = 283, - DIMENSIONS = 284, - VARIABLES = 285, - NETCDF = 286, - DATA = 287, - TYPES = 288, - COMPOUND = 289, - ENUM = 290, - OPAQUE_ = 291, - OPAQUESTRING = 292, - GROUP = 293, - PATH = 294, - FILLMARKER = 295, - NIL = 296, - _FILLVALUE = 297, - _FORMAT = 298, - _STORAGE = 299, - _CHUNKSIZES = 300, - _DEFLATELEVEL = 301, - _SHUFFLE = 302, - _ENDIANNESS = 303, - _NOFILL = 304, - _FLETCHER32 = 305, - _NCPROPS = 306, - _ISNETCDF4 = 307, - _SUPERBLOCK = 308, - _FILTER = 309, - _CODECS = 310, - DATASETID = 311 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + NC_UNLIMITED_K = 258, /* NC_UNLIMITED_K */ + CHAR_K = 259, /* CHAR_K */ + BYTE_K = 260, /* BYTE_K */ + SHORT_K = 261, /* SHORT_K */ + INT_K = 262, /* INT_K */ + FLOAT_K = 263, /* FLOAT_K */ + DOUBLE_K = 264, /* DOUBLE_K */ + UBYTE_K = 265, /* UBYTE_K */ + USHORT_K = 266, /* USHORT_K */ + UINT_K = 267, /* UINT_K */ + INT64_K = 268, /* INT64_K */ + UINT64_K = 269, /* UINT64_K */ + STRING_K = 270, /* STRING_K */ + IDENT = 271, /* IDENT */ + TERMSTRING = 272, /* TERMSTRING */ + CHAR_CONST = 273, /* CHAR_CONST */ + BYTE_CONST = 274, /* BYTE_CONST */ + SHORT_CONST = 275, /* SHORT_CONST */ + INT_CONST = 276, /* INT_CONST */ + INT64_CONST = 277, /* INT64_CONST */ + UBYTE_CONST = 278, /* UBYTE_CONST */ + USHORT_CONST = 279, /* USHORT_CONST */ + UINT_CONST = 280, /* UINT_CONST */ + UINT64_CONST = 281, /* UINT64_CONST */ + FLOAT_CONST = 282, /* FLOAT_CONST */ + DOUBLE_CONST = 283, /* DOUBLE_CONST */ + DIMENSIONS = 284, /* DIMENSIONS */ + VARIABLES = 285, /* VARIABLES */ + NETCDF = 286, /* NETCDF */ + DATA = 287, /* DATA */ + TYPES = 288, /* TYPES */ + COMPOUND = 289, /* COMPOUND */ + ENUM = 290, /* ENUM */ + OPAQUE_ = 291, /* OPAQUE_ */ + OPAQUESTRING = 292, /* OPAQUESTRING */ + GROUP = 293, /* GROUP */ + PATH = 294, /* PATH */ + FILLMARKER = 295, /* FILLMARKER */ + NIL = 296, /* NIL */ + _FILLVALUE = 297, /* _FILLVALUE */ + _FORMAT = 298, /* _FORMAT */ + _STORAGE = 299, /* _STORAGE */ + _CHUNKSIZES = 300, /* _CHUNKSIZES */ + _DEFLATELEVEL = 301, /* _DEFLATELEVEL */ + _SHUFFLE = 302, /* _SHUFFLE */ + _ENDIANNESS = 303, /* _ENDIANNESS */ + _NOFILL = 304, /* _NOFILL */ + _FLETCHER32 = 305, /* _FLETCHER32 */ + _NCPROPS = 306, /* _NCPROPS */ + _ISNETCDF4 = 307, /* _ISNETCDF4 */ + _SUPERBLOCK = 308, /* _SUPERBLOCK */ + _FILTER = 309, /* _FILTER */ + _CODECS = 310, /* _CODECS */ + _QUANTIZEBG = 311, /* _QUANTIZEBG */ + _QUANTIZEBR = 312, /* _QUANTIZEBR */ + DATASETID = 313 /* DATASETID */ }; + typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 156 "ncgen.y" /* yacc.c:1909 */ +#line 156 "ncgen.y" Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ @@ -116,9 +127,9 @@ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant* constant; -#line 120 "ncgeny.h" /* yacc.c:1909 */ -}; +#line 131 "ncgeny.h" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/nczarr_test/CMakeLists.txt b/nczarr_test/CMakeLists.txt index 3d0a8f93bb..b1f23d5aca 100644 --- a/nczarr_test/CMakeLists.txt +++ b/nczarr_test/CMakeLists.txt @@ -9,6 +9,10 @@ SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}) remove_definitions(-DDLL_EXPORT) +FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/../nc_test4/tst_quantize.c QSOURCE) +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_quantize.c "#define TESTNCZARR\n") +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/test_quantize.c "${QSOURCE}") + FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/ref*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/ref*.txt) @@ -92,6 +96,9 @@ IF(ENABLE_TESTS) add_sh_test(nczarr_test run_misc) add_sh_test(nczarr_test run_nczarr_fill) + BUILD_BIN_TEST(test_quantize ${TSTCOMMONSRC}) + add_sh_test(nczarr_test run_quantize) + if(ENABLE_NCZARR_S3) add_sh_test(nczarr_test run_s3_cleanup) ENDIF() diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index d2278ae17c..b466a68510 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -35,7 +35,7 @@ ut_projections_SOURCES = ut_projections.c ${commonsrc} ut_chunking_SOURCES = ut_chunking.c ${commonsrc} tst_fillonlyz_SOURCES = tst_fillonlyz.c ${tstcommonsrc} -check_PROGRAMS += tst_zchunks tst_zchunks2 tst_zchunks3 tst_fillonlyz +check_PROGRAMS += tst_zchunks tst_zchunks2 tst_zchunks3 tst_fillonlyz test_quantize TESTS += run_ut_map.sh TESTS += run_ut_mapapi.sh @@ -55,6 +55,8 @@ check_PROGRAMS += tst_chunkcases tst_chunkcases_SOURCES = tst_chunkcases.c ${tstcommonsrc} TESTS += run_chunkcases.sh +TESTS += run_quantize.sh + TESTS += run_purezarr.sh TESTS += run_interop.sh TESTS += run_misc.sh @@ -126,7 +128,7 @@ run_ut_map.sh run_ut_mapapi.sh run_ut_misc.sh run_ut_chunk.sh run_ncgen4.sh \ run_nccopyz.sh run_fillonlyz.sh run_chunkcases.sh test_nczarr.sh run_perf_chunks1.sh run_s3_cleanup.sh \ run_purezarr.sh run_interop.sh run_misc.sh \ run_filter.sh run_specific_filters.sh \ -run_newformat.sh run_nczarr_fill.sh +run_newformat.sh run_nczarr_fill.sh run_quantize.sh EXTRA_DIST += \ ref_ut_map_create.cdl ref_ut_map_writedata.cdl ref_ut_map_writemeta2.cdl ref_ut_map_writemeta.cdl \ @@ -153,12 +155,19 @@ EXTRA_DIST += ref_power_901_constants.zip ref_power_901_constants.cdl ref_quotes CLEANFILES = ut_*.txt ut*.cdl tmp*.nc tmp*.cdl tmp*.txt tmp*.dmp tmp*.zip tmp*.nc tmp*.dump tmp*.tmp tmp_ngc.c ref_zarr_test_data.cdl +BUILT_SOURCES = test_quantize.c +test_quantize.c: ../nc_test4/tst_quantize.c + rm -f test_quantize.c + echo "#define TESTNCZARR" > test_quantize.c + cat ../nc_test4/tst_quantize.c >> test_quantize.c + # Remove directories clean-local: rm -fr tmp*.file results.file results.s3 results.zip rm -fr rcmiscdir -DISTCLEANFILES = findplugin.sh +DISTCLEANFILES = findplugin.sh test_quantize.c # If valgrind is present, add valgrind targets. @VALGRIND_CHECK_RULES@ + diff --git a/nczarr_test/ref_filtered.cdl b/nczarr_test/ref_filtered.cdl index 6afa77b2e2..cf9e6febb4 100644 --- a/nczarr_test/ref_filtered.cdl +++ b/nczarr_test/ref_filtered.cdl @@ -11,7 +11,6 @@ dimensions: group: g { variables: float var(dim0, dim1, dim2, dim3) ; - var:_FillValue = 9.96921e+36f ; var:_Storage = "chunked" ; var:_ChunkSizes = 4, 4, 4, 4 ; var:_Filter = "307,9" ; diff --git a/nczarr_test/ref_purezarr.cdl b/nczarr_test/ref_purezarr.cdl index f9b9720608..edc00790f7 100644 --- a/nczarr_test/ref_purezarr.cdl +++ b/nczarr_test/ref_purezarr.cdl @@ -4,7 +4,6 @@ dimensions: _zdim_5 = 5 ; variables: int i(_zdim_2, _zdim_5) ; - i:_FillValue = -2147483647 ; data: i = diff --git a/nczarr_test/ref_xarray.cdl b/nczarr_test/ref_xarray.cdl index cd3e3c3874..69ef9f8e8b 100644 --- a/nczarr_test/ref_xarray.cdl +++ b/nczarr_test/ref_xarray.cdl @@ -4,7 +4,6 @@ dimensions: y = 5 ; variables: int i(x, y) ; - i:_FillValue = -2147483647 ; data: i = diff --git a/nczarr_test/ref_zarr_test_data.cdl.gz b/nczarr_test/ref_zarr_test_data.cdl.gz deleted file mode 100644 index 27cc5e8541..0000000000 Binary files a/nczarr_test/ref_zarr_test_data.cdl.gz and /dev/null differ diff --git a/nczarr_test/run_interop.sh b/nczarr_test/run_interop.sh index 4c13d17381..17d059e02c 100755 --- a/nczarr_test/run_interop.sh +++ b/nczarr_test/run_interop.sh @@ -69,14 +69,13 @@ case "$zext" in testcasezip ref_quotes zarr metaonly ;; s3) - # Test file does not exist on stratus - if test "x$NCZARR_S3_TEST_HOST" = "xs3.us-east-1.amazonaws.com" ; then - # Read a test case created by netcdf-java zarr. - # Move into position - rm -f ${execdir}/ref_zarr_test_data.cdl - if gunzip -c < ${srcdir}/ref_zarr_test_data.cdl.gz > ${execdir}/ref_zarr_test_data.cdl ; then - testcases3 zarr_test_data.zarr ref_zarr_test_data xarray - fi + # Read a test case created by netcdf-java zarr. + # Move into position + rm -f ${execdir}/ref_zarr_test_data.cdl + # Use gunzip because it always appears to be available + if gunzip ${srcdir}/ref_zarr_test_data.cdl.gz ; then ignore=1; fi + if test -f ${srcdir}/ref_zarr_test_data.cdl ; then + testcases3 zarr_test_data.zarr ref_zarr_test_data xarray fi ;; *) echo "unimplemented kind: $1" ; exit 1;; diff --git a/nczarr_test/run_quantize.sh b/nczarr_test/run_quantize.sh new file mode 100755 index 0000000000..5df10f2358 --- /dev/null +++ b/nczarr_test/run_quantize.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if test "x$srcdir" = x ; then srcdir=`pwd`; fi +. ../test_common.sh + +. "$srcdir/test_nczarr.sh" + +# This shell script runs test_quantize + +set -e + +testcase() { + zext=$1 + fileargs tmp_quantize "mode=$zarr,$zext" + case "$zext" in + file) template="file://${execdir}/%s.zarr#mode=zarr,$zext" ;; + zip) template="file://${execdir}/%s.zip#mode=zarr,$zext" ;; + s3) template="s3://${NCZARR_S3_TEST_BUCKET}/netcdf-c/%s.zarr#mode=zarr,$zext" ;; + *) echo "unknown file type"; exit 1 ;; + esac + ${execdir}/test_quantize "$template" +} + +testcase file +#if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testcase zip; fi +#if test "x$FEATURE_S3TESTS" = xyes ; then testcase s3; fi