From 2bf233c9d5748b925b4086cb1985016c9094cc00 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Tue, 21 Jun 2016 13:04:15 -0500 Subject: [PATCH 01/46] This patch changes the algorithm for determining the extended size of a dataset in parallel to pass a variable of type unsigned long long to MPI_Allreduce. Despite the comment in the code on this line (removed in this patch), the current usage is not correct. For example, consider if process 0 has an extend size of 2^32 (0x100000000) and process 2 has an extend size of 1 (0x1). The current algorithm will compute the max of each 4 byte segment then combine these into an 8 byte number, yielding a max of (2^32)+1 (0x100000001), when it should simply be 2^32. N. Fortner --- libsrc4/nc4hdf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index 14dfa46f4..e1b355861 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -526,9 +526,9 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, NC_VAR_INFO_T *var; NC_DIM_INFO_T *dim; hid_t file_spaceid = 0, mem_spaceid = 0, xfer_plistid = 0; - hsize_t xtend_size[NC_MAX_VAR_DIMS] , count[NC_MAX_VAR_DIMS]; + long long unsigned xtend_size[NC_MAX_VAR_DIMS]; hsize_t fdims[NC_MAX_VAR_DIMS], fmaxdims[NC_MAX_VAR_DIMS]; - hsize_t start[NC_MAX_VAR_DIMS]; + hsize_t start[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS]; char *name_to_use; int need_to_extend = 0; int retval = NC_NOERR, range_error = 0, i, d2; @@ -709,11 +709,11 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, { if (start[d2] + count[d2] > fdims[d2]) { - xtend_size[d2] = start[d2] + count[d2]; + xtend_size[d2] = (long long unsigned)(start[d2] + count[d2]); need_to_extend++; } else - xtend_size[d2] = fdims[d2]; + xtend_size[d2] = (long long unsigned)fdims[d2]; if (start[d2] + count[d2] > dim->len) { @@ -723,7 +723,7 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, } else { - xtend_size[d2] = dim->len; + xtend_size[d2] = (long long unsigned)dim->len; } } @@ -751,15 +751,15 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, BAIL(NC_ECANTEXTEND); /* Reach consensus about dimension sizes to extend to */ - /* (Note: Somewhat hackish, with the use of MPI_INTEGER, but MPI_MAX is - * correct with this usage, as long as it's not executed on - * heterogeneous systems) - */ - if(MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &xtend_size, (var->ndims * (sizeof(hsize_t) / sizeof(int))), MPI_UNSIGNED, MPI_MAX, h5->comm)) + if(MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, xtend_size, var->ndims, MPI_UNSIGNED_LONG_LONG, MPI_MAX, h5->comm)) BAIL(NC_EMPI); } #endif /* USE_PARALLEL4 */ - if (H5Dset_extent(var->hdf_datasetid, xtend_size) < 0) + /* Convert xtend_size back to hsize_t for use with H5Dset_extent */ + for (d2 = 0; d2 < var->ndims; d2++) + fdims[d2] = (hsize_t)xtend_size[d2]; + + if (H5Dset_extent(var->hdf_datasetid, fdims) < 0) BAIL(NC_EHDFERR); if (file_spaceid > 0 && H5Sclose(file_spaceid) < 0) BAIL2(NC_EHDFERR); From 6da5d38dde2e05a33ce9fbc01ce700b117a6fff2 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Fri, 8 Jul 2016 15:38:05 -0600 Subject: [PATCH 02/46] Started filling out group documentation. See https://github.com/Unidata/netcdf-c/issues/277 for more information. --- libdispatch/dgroup.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/libdispatch/dgroup.c b/libdispatch/dgroup.c index 5952bb956..59a12bc28 100644 --- a/libdispatch/dgroup.c +++ b/libdispatch/dgroup.c @@ -40,7 +40,8 @@ than 32767. Similarly, the number of simultaneously open netCDF-4 files in one program context is limited to 32767. */ -/** \{ */ + +/** \{*/ /* All these functions are part of the above defgroup... */ /*! @@ -131,6 +132,43 @@ int nc_inq_typeids(int ncid, int *ntypes, int *typeids) return ncp->dispatch->inq_typeids(ncid,ntypes,typeids); } +/*! + +Define a new group. The function nc_def_grp adds a new +group to an open netCDF dataset in define mode. It returns (as an + argument) a group id, given the parent ncid and the name of the group. + +A group may be a top-level group if it is passed the ncid of the file, +or a sub-group if passed the ncid of an existing group. + +@param[in] parent_ncid The ncid of the parent for the group. +@param[in] name Name of the new group. +@param[out] new_ncid Pointer to memory to hold the new ncid. + +@returns Error code or 0 for no error. + +@retval ::NC_NOERR No error. +@retval ::NC_ENOTNC4 Not an nc4 file. +@retval ::NC_ENOTINDEFINE Not in define mode. +@retval ::NC_ESTRICTNC3 Not permissible in nc4 classic mode. +@retval ::NC_EPERM Write to read only. +@retval ::NC_ENOMEM Memory allocation (malloc) failure. +@retval ::NC_ENAMEINUSE String match to name in use. + +\section nc_def_grp_example Example + +Here is an example using nc_def_grp() to create a new group. + +\code{.c} + +#include +... +int status, ncid, grpid, latid, recid; +... + +\endcode + +*/ int nc_def_grp(int parent_ncid, const char *name, int *new_ncid) { NC* ncp; @@ -139,6 +177,7 @@ int nc_def_grp(int parent_ncid, const char *name, int *new_ncid) return ncp->dispatch->def_grp(parent_ncid,name,new_ncid); } + int nc_rename_grp(int grpid, const char *name) { NC* ncp; From 37162e55cc1087cd13fd7fbe307c795abaa369e2 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Mon, 11 Jul 2016 11:27:26 -0600 Subject: [PATCH 03/46] Roughed in documentation blocks for the group-related functions in dgroup.c. Details for the bulk of the code still need to be filled in. --- libdispatch/dgroup.c | 160 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 135 insertions(+), 25 deletions(-) diff --git a/libdispatch/dgroup.c b/libdispatch/dgroup.c index 59a12bc28..49146285f 100644 --- a/libdispatch/dgroup.c +++ b/libdispatch/dgroup.c @@ -45,6 +45,13 @@ files in one program context is limited to 32767. /*! + + @param[in] ncid A valid file or group ncid. + @param[in] name The name of the group you are querying. + @param[out] grp_ncid Pointer to memory to hold the group ncid. + + @returns Error code or ::NC_NOERR or no error. + */ int nc_inq_ncid(int ncid, const char *name, int *grp_ncid) { @@ -54,6 +61,15 @@ int nc_inq_ncid(int ncid, const char *name, int *grp_ncid) return ncp->dispatch->inq_ncid(ncid,name,grp_ncid); } +/*! + + @param[in] ncid The ncid of the file or parent group. + @param[out] numgrps Pointer to memory to hold the number of groups. + @param[out] ncids Pointer to memory to hold the ncid for each group. + + @returns Error code or ::NC_NOERR for no error. + + */ int nc_inq_grps(int ncid, int *numgrps, int *ncids) { NC* ncp; @@ -62,6 +78,13 @@ int nc_inq_grps(int ncid, int *numgrps, int *ncids) return ncp->dispatch->inq_grps(ncid,numgrps,ncids); } +/*! + + @param[in] ncid The ncid of the file or parent group. + @param[out] name The name of the group associated with the id. + + @returns Error code or ::NC_NOERR for no error. +*/ int nc_inq_grpname(int ncid, char *name) { NC* ncp; @@ -70,6 +93,16 @@ int nc_inq_grpname(int ncid, char *name) return ncp->dispatch->inq_grpname(ncid,name); } +/*! + + @param[in] ncid The ncid of the file or parent group. + @param[out] lenp Pointer to memory to hold the length of the full name. + @param[out] full_name Pointer to memory to hold the full name of the group including root/parent. + + @returns Error code or ::NC_NOERR for no error. + +*/ + int nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name) { NC* ncp; @@ -78,12 +111,28 @@ int nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name) return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name); } +/*! + + @param[in] ncid The ncid of the group in question. + @param[out] lenp Pointer to memory to hold the length of the name of the group in question. + + @returns Error code or ::NC_NOERR for no error. + +*/ int nc_inq_grpname_len(int ncid, size_t *lenp) { int stat = nc_inq_grpname_full(ncid,lenp,NULL); return stat; } +/*! + + @param[in] ncid The ncid of the group in question. + @param[out] parent_ncid Pointer to memory to hold the identifier of the parent of the group in question. + + @returns Error code or ::NC_NOERR for no error. + + */ int nc_inq_grp_parent(int ncid, int *parent_ncid) { NC* ncp; @@ -92,7 +141,15 @@ int nc_inq_grp_parent(int ncid, int *parent_ncid) return ncp->dispatch->inq_grp_parent(ncid,parent_ncid); } -/*! This has same semantics as nc_inq_ncid +/*! + + @param[in] ncid The ncid of the file. + @param[in] grp_name The name of the group in question. + @param[out] grp_ncid Pointer to memory to hold the identifier of the group in question. + + @returns Error code or ::NC_NOERR for no error. + +\note{This has same semantics as nc_inq_ncid} */ int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid) @@ -100,6 +157,15 @@ int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid) return nc_inq_ncid(ncid,grp_name,grp_ncid); } +/*! + + @param[in] ncid The ncid of the file. + @param[in] full_name The full name of the group in question. + @param[out] grp_ncid Pointer to memory to hold the identifier of the full group in question. + + @returns Error code or ::NC_NOERR for no error. + + */ int nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) { NC* ncp; @@ -108,6 +174,16 @@ int nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) return ncp->dispatch->inq_grp_full_ncid(ncid,full_name,grp_ncid); } + +/*! + + @param[in] ncid The ncid of the group in question. + @param[out] nvars Pointer to memory to hold the number of variables in the group in question. + @param[out] varids Pointer to memory to hold the variable ids contained by the group in question. + + @returns Error code or ::NC_NOERR for no error. + +*/ int nc_inq_varids(int ncid, int *nvars, int *varids) { NC* ncp; @@ -116,6 +192,16 @@ int nc_inq_varids(int ncid, int *nvars, int *varids) return ncp->dispatch->inq_varids(ncid,nvars,varids); } +/*! + + @param[in] ncid The ncid of the group in question. + @param[out] ndims Pointer to memory to contain the number of dimids associated with the group. + @param[out] dimids Pointer to memory to contain the number of dimensions associated with the group. + @param[in] include_parents If non-zero, parent groups are also traversed. + + @returns Error code or ::NC_NOERR for no error. + + */ int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents) { NC* ncp; @@ -124,6 +210,16 @@ int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents) return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents); } +/*! + + @param[in] ncid The ncid for the group in question. + @param[out] ntypes Pointer to memory to hold the number of typeids contained by the group in question. + @param[out] typeids Pointer to memory to hold the typeids contained by the group in question. + + @returns Error code or ::NC_NOERR for no error. + +*/ + int nc_inq_typeids(int ncid, int *ntypes, int *typeids) { NC* ncp; @@ -134,39 +230,39 @@ int nc_inq_typeids(int ncid, int *ntypes, int *typeids) /*! -Define a new group. The function nc_def_grp adds a new -group to an open netCDF dataset in define mode. It returns (as an - argument) a group id, given the parent ncid and the name of the group. + Define a new group. The function nc_def_grp adds a new + group to an open netCDF dataset in define mode. It returns (as an + argument) a group id, given the parent ncid and the name of the group. -A group may be a top-level group if it is passed the ncid of the file, -or a sub-group if passed the ncid of an existing group. + A group may be a top-level group if it is passed the ncid of the file, + or a sub-group if passed the ncid of an existing group. -@param[in] parent_ncid The ncid of the parent for the group. -@param[in] name Name of the new group. -@param[out] new_ncid Pointer to memory to hold the new ncid. + @param[in] parent_ncid The ncid of the parent for the group. + @param[in] name Name of the new group. + @param[out] new_ncid Pointer to memory to hold the new ncid. -@returns Error code or 0 for no error. + @returns Error code or ::NC_NOERR for no error. -@retval ::NC_NOERR No error. -@retval ::NC_ENOTNC4 Not an nc4 file. -@retval ::NC_ENOTINDEFINE Not in define mode. -@retval ::NC_ESTRICTNC3 Not permissible in nc4 classic mode. -@retval ::NC_EPERM Write to read only. -@retval ::NC_ENOMEM Memory allocation (malloc) failure. -@retval ::NC_ENAMEINUSE String match to name in use. + @retval ::NC_NOERR No error. + @retval ::NC_ENOTNC4 Not an nc4 file. + @retval ::NC_ENOTINDEFINE Not in define mode. + @retval ::NC_ESTRICTNC3 Not permissible in nc4 classic mode. + @retval ::NC_EPERM Write to read only. + @retval ::NC_ENOMEM Memory allocation (malloc) failure. + @retval ::NC_ENAMEINUSE String match to name in use. -\section nc_def_grp_example Example + \section nc_def_grp_example Example -Here is an example using nc_def_grp() to create a new group. + Here is an example using nc_def_grp() to create a new group. -\code{.c} + \code{.c} -#include -... -int status, ncid, grpid, latid, recid; -... + #include + ... + int status, ncid, grpid, latid, recid; + ... -\endcode + \endcode */ int nc_def_grp(int parent_ncid, const char *name, int *new_ncid) @@ -177,7 +273,14 @@ int nc_def_grp(int parent_ncid, const char *name, int *new_ncid) return ncp->dispatch->def_grp(parent_ncid,name,new_ncid); } +/*! + @param[in] grpid The ID for the group in question. + @param[in] name The new name for the group. + + @returns Error code or ::NC_NOERR for no error. + +*/ int nc_rename_grp(int grpid, const char *name) { NC* ncp; @@ -186,6 +289,13 @@ int nc_rename_grp(int grpid, const char *name) return ncp->dispatch->rename_grp(grpid,name); } +/*! + + @param[in] ncid The ncid of the group in question. + + @returns Error code or ::NC_NOERR for no error. + + */ int nc_show_metadata(int ncid) { NC* ncp; From ca49086a32d5e73e3918a25fec5fbab5d1fd7839 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Mon, 11 Jul 2016 13:43:19 -0600 Subject: [PATCH 04/46] Cleaned up warnings about undocumented parameters for NC_inq_var_all. --- libdispatch/dvarinq.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/libdispatch/dvarinq.c b/libdispatch/dvarinq.c index f125a0bcd..d0df63be0 100644 --- a/libdispatch/dvarinq.c +++ b/libdispatch/dvarinq.c @@ -571,12 +571,34 @@ nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) #endif /* USE_NETCDF4 */ -/** +/*! + +Used in libdap2 and libdap4. + +@param[in] ncid ncid for file. +@param[in] varid varid for variable in question. +@param[out] name Pointer to memory to contain the name of the variable. +@param[out] xtypep Pointer to memory to contain the type of the variable. +@param[out] ndimsp Pointer to memory to store the number of associated dimensions for the variable. +@param[out] dimidsp Pointer to memory to store the dimids associated with the variable. +@param[out] nattsp Pointer to memory to store the number of attributes associated with the variable. +@param[out] shufflep Pointer to memory to store shuffle information associated with the variable. +@param[out] deflatep Pointer to memory to store compression type associated with the variable. +@param[out] deflate_levelp Pointer to memory to store compression level associated with the variable. +@param[out] fletcher32p Pointer to memory to store compression information associated with the variable. +@param[out] contiguousp Pointer to memory to store contiguous-data information associated with the variable. +@param[out] chunksizesp Pointer to memory to store chunksize information associated with the variable. +@param[out] no_fill Pointer to memory to store whether or not there is a fill value associated with the variable. +@param[out] fill_valuep Pointer to memory to store the fill value (if one exists) for the variable. +@param[out] endiannessp Pointer to memory to store endianness value. One of ::NC_ENDIAN_BIG ::NC_ENDIAN_LITTLE ::NC_ENDIAN_NATIVE +@param[out] options_maskp Pointer to memory to store mask options information. +@param[out] pixels_per_blockp Pointer to memory to store pixels-per-block information for chunked data. + +\note Expose access to nc_inq_var_all(). + \internal \ingroup variables -Expose access to nc_inq_var_all(). -Used in libdap2 and libdap4. */ int @@ -597,7 +619,7 @@ NC_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, contiguousp, chunksizesp, no_fill, fill_valuep, endiannessp, - options_maskp, + options_maskp, pixels_per_blockp); } From 586e832f648600d4580f2b9d5e84036096cc3951 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 6 Jul 2016 12:06:59 -0400 Subject: [PATCH 05/46] Fix variable and dimension renaming for nc3 with hashmap The problem is that the name was being updated prior to the old variable being removed from the hashmap. It checks whether the key and the name of the variable being removed match, but since the name had already been updated, the names did not match so the variable was not removed. This patch removes the variable from the hashmap first, then updates the name, and then adds the variable with the new name to the hashmap. Similar change for renaming dimensions. --- libsrc/dim.c | 10 +++++++--- libsrc/var.c | 11 ++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libsrc/dim.c b/libsrc/dim.c index ef7dfb32c..7d904ee7c 100644 --- a/libsrc/dim.c +++ b/libsrc/dim.c @@ -475,10 +475,12 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname) free(newname); if(newStr == NULL) return NC_ENOMEM; - dimp->name = newStr; /* Remove old name from hashmap; add new... */ NC_hashmapRemoveDim(&ncp->dims, old->cp); + + dimp->name = newStr; + NC_hashmapAddDim(&ncp->dims, dimid, newStr->cp); free_NC_string(old); @@ -487,13 +489,15 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname) /* else, not in define mode */ + + /* Remove old name from hashmap; add new... */ + NC_hashmapRemoveDim(&ncp->dims, old->cp); + status = set_NC_string(dimp->name, newname); free(newname); if(status != NC_NOERR) return status; - /* Remove old name from hashmap; add new... */ - NC_hashmapRemoveDim(&ncp->dims, old->cp); NC_hashmapAddDim(&ncp->dims, dimid, dimp->name->cp); set_NC_hdirty(ncp); diff --git a/libsrc/var.c b/libsrc/var.c index a510ba52b..7729a7e37 100644 --- a/libsrc/var.c +++ b/libsrc/var.c @@ -740,14 +740,14 @@ NC3_rename_var(int ncid, int varid, const char *unewname) return NC_ENOMEM; if(NC_indef(ncp)) { + /* Remove old name from hashmap; add new... */ + NC_hashmapRemoveVar(&ncp->vars, old->cp); + newStr = new_NC_string(strlen(newname),newname); free(newname); if(newStr == NULL) return(-1); varp->name = newStr; - - /* Remove old name from hashmap; add new... */ - NC_hashmapRemoveVar(&ncp->vars, old->cp); NC_hashmapAddVar(&ncp->vars, varid, newStr->cp); free_NC_string(old); @@ -755,13 +755,14 @@ NC3_rename_var(int ncid, int varid, const char *unewname) } /* else, not in define mode */ + /* Remove old name from hashmap; add new... */ + NC_hashmapRemoveVar(&ncp->vars, old->cp); + status = set_NC_string(varp->name, newname); free(newname); if(status != NC_NOERR) return status; - /* Remove old name from hashmap; add new... */ - NC_hashmapRemoveVar(&ncp->vars, old->cp); NC_hashmapAddVar(&ncp->vars, varid, varp->name->cp); set_NC_hdirty(ncp); From c5d1b664f377664493b0e0666b170b69f17c459d Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Mon, 11 Jul 2016 14:43:39 -0600 Subject: [PATCH 06/46] refactoring of documentation. --- libdispatch/dgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdispatch/dgroup.c b/libdispatch/dgroup.c index 49146285f..4d8a1b985 100644 --- a/libdispatch/dgroup.c +++ b/libdispatch/dgroup.c @@ -228,9 +228,9 @@ int nc_inq_typeids(int ncid, int *ntypes, int *typeids) return ncp->dispatch->inq_typeids(ncid,ntypes,typeids); } -/*! +/*! Define a new group. - Define a new group. The function nc_def_grp adds a new + The function nc_def_grp() adds a new group to an open netCDF dataset in define mode. It returns (as an argument) a group id, given the parent ncid and the name of the group. From af26592f509fa74a855e108ca44eeff893d6f38d Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Mon, 11 Jul 2016 16:55:30 -0600 Subject: [PATCH 07/46] Filled in short description for group-related functions in support of https://github.com/Unidata/netcdf-c/issues/277 full documentation still pending. --- libdispatch/dgroup.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libdispatch/dgroup.c b/libdispatch/dgroup.c index 4d8a1b985..8b1fe4b44 100644 --- a/libdispatch/dgroup.c +++ b/libdispatch/dgroup.c @@ -43,7 +43,7 @@ files in one program context is limited to 32767. /** \{*/ /* All these functions are part of the above defgroup... */ -/*! +/*! Return the group ID for a group given the name. @param[in] ncid A valid file or group ncid. @@ -61,7 +61,7 @@ int nc_inq_ncid(int ncid, const char *name, int *grp_ncid) return ncp->dispatch->inq_ncid(ncid,name,grp_ncid); } -/*! +/*! Get a list of groups or subgroups from a file or groupID. @param[in] ncid The ncid of the file or parent group. @param[out] numgrps Pointer to memory to hold the number of groups. @@ -78,7 +78,7 @@ int nc_inq_grps(int ncid, int *numgrps, int *ncids) return ncp->dispatch->inq_grps(ncid,numgrps,ncids); } -/*! +/*! Get the name of a group given an ID. @param[in] ncid The ncid of the file or parent group. @param[out] name The name of the group associated with the id. @@ -93,7 +93,7 @@ int nc_inq_grpname(int ncid, char *name) return ncp->dispatch->inq_grpname(ncid,name); } -/*! +/*! Get the full path/groupname of a group/subgroup given an ID. @param[in] ncid The ncid of the file or parent group. @param[out] lenp Pointer to memory to hold the length of the full name. @@ -111,7 +111,7 @@ int nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name) return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name); } -/*! +/*! Get the length of a group name given an ID. @param[in] ncid The ncid of the group in question. @param[out] lenp Pointer to memory to hold the length of the name of the group in question. @@ -125,7 +125,7 @@ int nc_inq_grpname_len(int ncid, size_t *lenp) return stat; } -/*! +/*! Get the ID of the parent based on a group ID. @param[in] ncid The ncid of the group in question. @param[out] parent_ncid Pointer to memory to hold the identifier of the parent of the group in question. @@ -141,7 +141,7 @@ int nc_inq_grp_parent(int ncid, int *parent_ncid) return ncp->dispatch->inq_grp_parent(ncid,parent_ncid); } -/*! +/*! Get a group ncid given the group name. @param[in] ncid The ncid of the file. @param[in] grp_name The name of the group in question. @@ -157,7 +157,7 @@ int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid) return nc_inq_ncid(ncid,grp_name,grp_ncid); } -/*! +/*! Get the full ncid given a group name. @param[in] ncid The ncid of the file. @param[in] full_name The full name of the group in question. @@ -175,7 +175,7 @@ int nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) } -/*! +/*! Get a list of varids associated with a group given a group ID. @param[in] ncid The ncid of the group in question. @param[out] nvars Pointer to memory to hold the number of variables in the group in question. @@ -192,7 +192,7 @@ int nc_inq_varids(int ncid, int *nvars, int *varids) return ncp->dispatch->inq_varids(ncid,nvars,varids); } -/*! +/*! Retrieve a list of dimension ids associated with a group. @param[in] ncid The ncid of the group in question. @param[out] ndims Pointer to memory to contain the number of dimids associated with the group. @@ -210,7 +210,7 @@ int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents) return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents); } -/*! +/*! Retrieve a list of types associated with a group @param[in] ncid The ncid for the group in question. @param[out] ntypes Pointer to memory to hold the number of typeids contained by the group in question. @@ -273,7 +273,7 @@ int nc_def_grp(int parent_ncid, const char *name, int *new_ncid) return ncp->dispatch->def_grp(parent_ncid,name,new_ncid); } -/*! +/*! Rename a group. @param[in] grpid The ID for the group in question. @param[in] name The new name for the group. @@ -289,9 +289,9 @@ int nc_rename_grp(int grpid, const char *name) return ncp->dispatch->rename_grp(grpid,name); } -/*! +/*! Print the metadata for a file. - @param[in] ncid The ncid of the group in question. + @param[in] ncid The ncid of an open file. @returns Error code or ::NC_NOERR for no error. From c361938c8edcaef36ebfe5325ce75e7f7d4c2cc3 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Tue, 12 Jul 2016 08:12:23 -0400 Subject: [PATCH 08/46] Fix att_name size There was a mismatch between the allocated size of att_name and the size that H5Aget_name was told the size was. --- libsrc4/nc4hdf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index 1fb08202e..782cae64a 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -1952,7 +1952,7 @@ write_nc3_strict_att(hid_t hdf_grpid) { hid_t attid = 0, spaceid = 0; int one = 1, num, a; - char att_name[NC_MAX_NAME + 1]; + char att_name[NC_MAX_HDF5_NAME + 1]; int retval = NC_NOERR; /* If the attribute already exists, call that a success and return From fcb1455b28b57f23a32a7a1ae7f828781702c11b Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Tue, 12 Jul 2016 08:59:01 -0400 Subject: [PATCH 09/46] Update nc4hdf.c If H5Aopen_idx on line 1964 fails, then attid will be < 0. The BAIL will goto exit at line 1989 and then the test of "if (attid ...)" at line 1995 will pass (attd != 0) and then call H5Aclose(attid) with a negative attid. Similar issue for spaceid. Result of function if probably the same since there is a failure somewhere, but more difficult to track down if looks like failure is happening in the wrong place. --- libsrc4/nc4hdf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index 1fb08202e..fe4eb6f72 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -1987,12 +1987,12 @@ write_nc3_strict_att(hid_t hdf_grpid) BAIL(NC_EFILEMETA); exit: - if (spaceid && (H5Sclose(spaceid) < 0)) + if (spaceid > 0 && (H5Sclose(spaceid) < 0)) BAIL2(NC_EFILEMETA); #ifdef EXTRA_TESTS num_spaces--; #endif - if (attid && (H5Aclose(attid) < 0)) + if (attid > 0 && (H5Aclose(attid) < 0)) BAIL2(NC_EFILEMETA); return retval; } From 2fe943d32ebe7a41637fa1dbad5a7f389cbbfb63 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 12 Jul 2016 16:58:49 -0600 Subject: [PATCH 10/46] Wiring in test contributed by Greg Sjaardema in support of https://github.com/Unidata/netcdf-c/issues/282 --- nc_test4/CMakeLists.txt | 3 ++- nc_test4/Makefile.am | 8 ++++---- nc_test4/tst_rehash.c | 43 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 nc_test4/tst_rehash.c diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index 0c6979ea2..114a96c54 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -9,7 +9,8 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2 tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite - tst_put_vars_two_unlim_dim tst_hdf5_file_compat tst_fill_attr_vanish) + tst_put_vars_two_unlim_dim tst_hdf5_file_compat tst_fill_attr_vanish + tst_rehash) # Note, renamegroup needs to be compiled before run_grp_rename build_bin_test(renamegroup) diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index fc0fc3652..6e7b0a457 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -22,7 +22,7 @@ tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts \ t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \ tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \ tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \ -tst_hdf5_file_compat tst_fill_attr_vanish +tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim @@ -125,8 +125,8 @@ run_grp_rename.sh tst_formatx_hdf4.sh \ run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \ tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \ tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \ -ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh tdset.h5 \ -tst_hdf4_read_var.sh +ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh \ +tdset.h5 tst_hdf4_read_var.sh CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \ @@ -139,7 +139,7 @@ usi_01.* thetau_01.* tst_*.nc tst_*.h5 \ tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \ foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \ tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc \ -tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc +tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc tst_rehash.nc if USE_HDF4_FILE_TESTS DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \ diff --git a/nc_test4/tst_rehash.c b/nc_test4/tst_rehash.c new file mode 100644 index 000000000..04ed04332 --- /dev/null +++ b/nc_test4/tst_rehash.c @@ -0,0 +1,43 @@ +/* This is part of the netCDF package. + Copyright 2016 University Corporation for Atmospheric Research/Unidata + See COPYRIGHT file for conditions of use. + + Provided in support of https://github.com/Unidata/netcdf-c/issues/282 + Test provided by Greg Sjaardema + + Tests to see if the hashmap is being properly updated. + + */ + +#define FILENAME "tst_rehash.nc" + +#include +int main() +{ + int status; + int id; + int rh_id, varid, v1, v2, v3, v4; + int dimids[2]; + + + nc_create(FILENAME, NC_CLOBBER, &id); + nc_redef(id); + + status = nc_def_dim(id, "dim1", 10, &dimids[0]); + status = nc_def_var(id, "dim1", NC_FLOAT, 1, dimids, &v1); + status = nc_def_var(id, "var1", NC_FLOAT, 1, dimids, &v2); + + nc_close(id); + + nc_open(FILENAME, NC_WRITE, &id); + + nc_redef(id); + nc_rename_var(id, v1,"dim_new1"); + nc_rename_dim(id, dimids[0], "dim_new1"); + + status = nc_def_dim(id, "dim2", 20, &dimids[1]); + nc_def_var(id, "dim2", NC_FLOAT, 1, &dimids[1], &v3); + nc_def_var(id, "var2", NC_FLOAT, 2, dimids, &v4); + + nc_close(id); +} From 033712ef1ed5eee22c954403fc722f6d79e01705 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Fri, 15 Jul 2016 07:47:40 -0400 Subject: [PATCH 11/46] Use correct symbol As best I can tell, this should be ENABLE_PARALLEL4 instead of ENABLE_PARALLEL. ENABLE_PARALLEL is not used other than in a couple documentation files. But, ENABLE_PARALLEL4 is set in the top-level CMakeLists.txt file if a parallel hdf5 library is detected. --- include/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 60eabd18c..1cc7580e3 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -14,7 +14,7 @@ INSTALL(FILES ${netCDF_BINARY_DIR}/include/netcdf_meta.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers) -IF(ENABLE_PNETCDF OR ENABLE_PARALLEL) +IF(ENABLE_PNETCDF OR ENABLE_PARALLEL4) INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf_par.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers) From eae6d75d4710114a41f356beeec9d1a03bf8d9fb Mon Sep 17 00:00:00 2001 From: tbeu Date: Mon, 18 Jul 2016 22:18:42 +0200 Subject: [PATCH 12/46] Test all three files for compatibility --- nc_test4/tst_hdf5_file_compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nc_test4/tst_hdf5_file_compat.c b/nc_test4/tst_hdf5_file_compat.c index ff9e9156a..dae8fc7d1 100644 --- a/nc_test4/tst_hdf5_file_compat.c +++ b/nc_test4/tst_hdf5_file_compat.c @@ -45,13 +45,13 @@ int main(int argc, char **argv) { { printf("Testing %s\n",FILE_NAME2); - if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR; + if (nc_open(FILE_NAME2, NC_NOWRITE, &ncid)) ERR; if (nc_close(ncid)) ERR; } { printf("Testing %s\n",FILE_NAME3); - if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR; + if (nc_open(FILE_NAME3, NC_NOWRITE, &ncid)) ERR; if (nc_close(ncid)) ERR; } From 9290b31c9dd5aa2961e208a867022f0e607cdff3 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Thu, 31 Mar 2016 11:31:31 -0600 Subject: [PATCH 13/46] Fix variable bounds check for parallel output The following code is in nc4hdf.c, function `nc4_put_vara`. ``` /* Check dimension bounds. Remember that unlimited dimnsions can * put data beyond their current length. */ for (d2 = 0; d2 < var->ndims; d2++) { dim = var->dim[d2]; assert(dim && dim->dimid == var->dimids[d2]); if (!dim->unlimited) { if (start[d2] >= (hssize_t)fdims[d2]) BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE); } } ``` There is an issue when the process with the highest rank has zero items to output. As an example, if I have 4 mpi processes which are each writing the following amount of data: * rank 0: 0 items * rank 1: 2548 items * rank 2: 4352 items * rank 3: 0 items. I will define the variable to have a length of 6900 items (0 + 2548 + 4352 + 0). When I am outputting data to the variable, each rank will call nc_put_vara_longlong with the following start and count values: * rank 0: start = 0, count = 0 * rank 1: start = 0, count = 2548 * rank 2: start = 2548, count = 4352 * rank 3: start = 6900, count = 0. In each case, the `start` for rank N is equal to `start` for rank N-1 + `count` for rank N-1. This all works ok until the highest rank is writing 0 items. In that case, the `start` value for that rank is equal to the total size of the variable and the check in the code fragment shown above fails since `start[] == fdims[]`. This could be fixed in the application code by checking whether the `count` is zero and if so, then set `start` to 0 also, but I think that is a kluge that should not be required. Note that this test appears three times in this file. In one case, the check for non-zero count already exists, but not in the other two. This pull request adds the check to the other two tests. --- libsrc4/nc4hdf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index b9d48b16d..35b41558f 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -617,7 +617,7 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, log_dim_info(var, fdims, fmaxdims, start, count); #endif - /* Check dimension bounds. Remember that unlimited dimnsions can + /* Check dimension bounds. Remember that unlimited dimensions can * put data beyond their current length. */ for (d2 = 0; d2 < var->ndims; d2++) { @@ -625,7 +625,7 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, assert(dim && dim->dimid == var->dimids[d2]); if (!dim->unlimited) { - if (start[d2] >= (hssize_t)fdims[d2]) + if (start[d2] >= (hssize_t)fdims[d2] && count[d2] > 0) BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE); @@ -979,7 +979,7 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp, else { /* Check for out of bound requests. */ - if (start[d2] >= (hssize_t)fdims[d2]) + if (start[d2] >= (hssize_t)fdims[d2] && count[d2] > 0) BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE); From c7ccdfa543018fad132d99509188eb26a81ad6e7 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 4 Apr 2016 08:56:08 -0600 Subject: [PATCH 14/46] More pedantically correct check This modifies the previous change to be more pedantically correct. It should always be an NC_EINVALCOORDS error if start exceeds fdims[2]; however, if start equals fdims[2], then it is only an error if count is non-zero. --- libsrc4/nc4hdf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index 35b41558f..e4256f30f 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -625,7 +625,8 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, assert(dim && dim->dimid == var->dimids[d2]); if (!dim->unlimited) { - if (start[d2] >= (hssize_t)fdims[d2] && count[d2] > 0) + if (start[d2] > (hssize_t)fdims[d2] || + (start[d2] == (hssize_t)fdims[d2] && count[d2] > 0)) BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE); @@ -956,7 +957,8 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp, BAIL(retval); /* Check for out of bound requests. */ - if (start[d2] >= (hssize_t)ulen && count[d2]) + if (start[d2] > (hssize_t)ulen || + (start[d2] == (hssize_t)ulen && count[d2] > 0)) BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > ulen) BAIL_QUIET(NC_EEDGE); @@ -979,7 +981,8 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp, else { /* Check for out of bound requests. */ - if (start[d2] >= (hssize_t)fdims[d2] && count[d2] > 0) + if (start[d2] > (hssize_t)fdims[d2] || + (start[d2] == (hssize_t)fdims[d2] && count[d2] > 0)) BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE); From 2bfd984fad5f22ca64ac356a5cdaa6bfc81cbed3 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 4 Apr 2016 09:07:00 -0600 Subject: [PATCH 15/46] Update testing -- not error if start==size --- nc_test/test_get.m4 | 9 --------- nc_test/test_put.m4 | 19 ------------------- 2 files changed, 28 deletions(-) diff --git a/nc_test/test_get.m4 b/nc_test/test_get.m4 index 3b77f9cca..5b792be12 100644 --- a/nc_test/test_get.m4 +++ b/nc_test/test_get.m4 @@ -308,15 +308,6 @@ test_nc_get_vara_$1(void) err = nc_get_vara_$1(ncid, BAD_VARID, start, edge, value); IF (err != NC_ENOTVAR) error("bad var id: status = %d", err); - for (j = 0; j < var_rank[i]; j++) { - if (var_dimid[i][j] > 0) { /* skip record dim */ - start[j] = var_shape[i][j]; - err = nc_get_vara_$1(ncid, i, start, edge, value); - IF (canConvert && err != NC_EINVALCOORDS) - error("bad start: status = %d", err); - start[j] = 0; - } - } err = nc_get_vara_$1(ncid, i, start, edge, value); if (canConvert) { IF (err) diff --git a/nc_test/test_put.m4 b/nc_test/test_put.m4 index 3e6ca5d47..32601f5aa 100644 --- a/nc_test/test_put.m4 +++ b/nc_test/test_put.m4 @@ -614,25 +614,6 @@ test_nc_put_vara_$1(void) edge[j] = 1; } } - /* Check correct error returned even when nothing to put */ - for (j = 0; j < var_rank[i]; j++) { - edge[j] = 0; - } - err = nc_put_vara_$1(BAD_ID, i, start, edge, value); - IF (err != NC_EBADID) - error("bad ncid: status = %d", err); - err = nc_put_vara_$1(ncid, BAD_VARID, start, edge, value); - IF (err != NC_ENOTVAR) - error("bad var id: status = %d", err); - for (j = 0; j < var_rank[i]; j++) { - if (var_dimid[i][j] > 0) { /* skip record dim */ - start[j] = var_shape[i][j]; - err = nc_put_vara_$1(ncid, i, start, edge, value); - IF (canConvert && err != NC_EINVALCOORDS) - error("bad start: status = %d", err); - start[j] = 0; - } - } /* wkliao: this test below of put_vara is redundant and incorrectly uses the value[] set from the previously iteration. There is no such test From 792322dc4bfb542b98c8573cf62b4868d47d7a5f Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 27 Jul 2016 14:05:47 -0600 Subject: [PATCH 16/46] Got nc-config to properly parse nf-config in support of https://github.com/Unidata/netcdf-c/issues/296 --- nc-config.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nc-config.in b/nc-config.in index f6c07d31f..6c4cc8069 100644 --- a/nc-config.in +++ b/nc-config.in @@ -20,9 +20,15 @@ has_hdf5="@HAS_HDF5@" has_logging="@HAS_LOGGING@" version="@PACKAGE_NAME@ @PACKAGE_VERSION@" +has_fortran="no" has_f90="no" has_f03="no" -if type -p nf-config > /dev/null 2>&1; then + +nfconf=$(which nf-config) + +if [ -f "$nfconf" ]; then + echo "Using nf-config: $nfconf" + has_fortran="yes" fc=`nf-config --fc` fflags=`nf-config --fflags` flibs=`nf-config --flibs` @@ -80,7 +86,7 @@ elif type -p ncxx-config > /dev/null 2>&1; then EOF fi -if type -p nf-config > /dev/null 2>&1; then +if [ -f "$nfconf" ]; then cat < $has_cxx4" echo " --cxx4 -> $cxx4" echo + +if [ -f "$nfconf" ]; then echo " --fc -> $fc" echo " --fflags -> $fflags" echo " --flibs -> $flibs" echo " --has-f90 -> $has_f90" echo " --has-f03 -> $has_f03" echo +fi echo " --has-dap -> $has_dap" echo " --has-nc2 -> $has_nc2" echo " --has-nc4 -> $has_nc4" From 05cbb8444b13827d316b9190f87c2c349e1148a0 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 27 Jul 2016 14:10:05 -0600 Subject: [PATCH 17/46] Propegated previous change into cmake-based builds. --- nc-config.cmake.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nc-config.cmake.in b/nc-config.cmake.in index 2ef070641..09aeb8ed0 100755 --- a/nc-config.cmake.in +++ b/nc-config.cmake.in @@ -22,6 +22,7 @@ fi has_nc2="@BUILD_V2@" + if [ -z $has_nc2 -o "$has_nc2" = "OFF" ]; then has_nc2="no" else @@ -73,9 +74,16 @@ fi version="@PACKAGE@ @VERSION@" + +has_fortran="no" has_f90="no" has_f03="no" -if type -p nf-config > /dev/null 2>&1; then + +nfconf=$(which nf-config) + +if [ -f "$nfconf" ]; then + echo "Using nf-config: $nfconf" + has_fortran="yes" fc=`nf-config --fc` fflags=`nf-config --fflags` flibs=`nf-config --flibs` @@ -133,7 +141,7 @@ elif type -p ncxx-config > /dev/null 2>&1; then EOF fi -if type -p nf-config > /dev/null 2>&1; then +if [ -f "$nfconf" ]; then cat < $has_cxx" echo " --cxx -> $cxx" + +# echo " --cxxflags -> $cxxflags" +# echo " --cxxlibs -> $cxxlibs" echo " --has-c++4 -> $has_cxx4" echo " --cxx4 -> $cxx4" echo + +if [ -f "$nfconf" ]; then echo " --fc -> $fc" echo " --fflags -> $fflags" echo " --flibs -> $flibs" echo " --has-f90 -> $has_f90" echo " --has-f03 -> $has_f03" echo +fi echo " --has-dap -> $has_dap" echo " --has-nc2 -> $has_nc2" echo " --has-nc4 -> $has_nc4" From ec879abca604fd83cc397406ce1bb05fabcffe25 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 27 Jul 2016 14:14:32 -0600 Subject: [PATCH 18/46] Updated release notes. --- RELEASE_NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e5cbefbc4..55af9058f 100755 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,10 @@ This file contains a high-level description of this package's evolution. Release > Note: The combination of netCDF-C library versions earlier than 4.4.1 and libhdf5 1.10.0+ should be avoided, as they will result in binary files not readable by systems using earlier libhdf5 versions. +## 4.4.2 - TBD + +* [Bug] Corrected behavior for `nc-config` so that, if `nf-config` is found in system, the proper fortran-related information will be conveyed. See [GitHub #296](https://github.com/Unidata/netcdf-c/issues/296] for more information. + ## 4.4.1 - June 28, 2016 * [File Change] Starting with release 4.4.1, netCDF-4 files created will have superblock version 0 instead of superblock version 2, as was observed in previous netCDF versions. This is due to a workaround required to avoid backwards binary incompatibility when using libhdf5 1.10.x or greater. Superblock versions 0 and 2 appear to be forward and backward compatible. Other than a different superblock number the data should remain consistent. From 0cf1e2c49f4edba440beb8692585f7384eb0e72f Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Mon, 8 Aug 2016 09:24:19 -0600 Subject: [PATCH 19/46] re: Github issue netcdf-c 300 Modified provenance code to allocate the minimal space needed for _NCProperties attribute in file. Basically required using malloc in the provenance code and in ncdump. Otherwise should cause no externally visible effects. Also removed the ENABLE_FILEINFO from configure.ac since the provenance code is no longer optional. --- CMakeLists.txt | 8 --- config.h.cmake.in | 1 - configure.ac | 15 ----- docs/attribute_conventions.md | 10 ++-- include/nc4internal.h | 11 +--- liblib/nc_initialize.c | 5 +- libsrc4/Makefile.am | 6 +- libsrc4/nc4attr.c | 19 +++---- libsrc4/nc4file.c | 10 ---- libsrc4/nc4hdf.c | 4 +- libsrc4/nc4info.c | 102 ++++++++++++++++++++++------------ ncdump/CMakeLists.txt | 2 +- ncdump/Makefile.am | 2 +- ncdump/ncdump.c | 19 ++++--- ncdump/utils.c | 4 +- 15 files changed, 99 insertions(+), 119 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd9a43c84..2149713f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1074,14 +1074,6 @@ MARK_AS_ADVANCED(ENABLE_DAP_REMOTE_TESTS ENABLE_DAP_LONG_TESTS USE_REMOTE_CDASH) MARK_AS_ADVANCED(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS DOXYGEN_ENABLE_TASKS ENABLE_DOXYGEN_SERVER_SIDE_SEARCH) MARK_AS_ADVANCED(ENABLE_SHARED_LIBRARY_VERSION) -# This option is temporary and should always be on except if netcdf-4 is off. -IF(ENABLE_NETCDF_4) -OPTION(ENABLE_FILEINFO "Enable FILEINFO." ON) -ELSE() -OPTION(ENABLE_FILEINFO "Enable FILEINFO." OFF) -ENDIF() -MARK_AS_ADVANCED(ENABLE_FILEINFO) - ################################ # Option checks ################################ diff --git a/config.h.cmake.in b/config.h.cmake.in index 82bd1630d..a973d41d1 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -87,7 +87,6 @@ are set when opening a binary file on Windows. */ #cmakedefine ENABLE_DAP 1 #cmakedefine ENABLE_DAP_GROUPS 1 #cmakedefine ENABLE_DAP_REMOTE_TESTS 1 -#cmakedefine ENABLE_FILEINFO 1 #cmakedefine EXTRA_TESTS #cmakedefine USE_NETCDF4 1 #cmakedefine USE_LIBDL 1 diff --git a/configure.ac b/configure.ac index 3b84e95e0..d0f2aca93 100644 --- a/configure.ac +++ b/configure.ac @@ -204,21 +204,6 @@ enable_netcdf_4=no fi AC_MSG_RESULT([$enable_netcdf_4]) -#### -# Is Netcdf4 file info capture enabled; includes properties attribute -# We do not actually provide a direct flag for disabling this -if test "x$enable_netcdf_4" = xyes ; then -enable_fileinfo=yes -else -enable_fileinfo=no -fi -AC_MSG_CHECKING([If file info capture is enabled]) -AC_MSG_RESULT([$enable_fileinfo]) -if test "x$enable_fileinfo" = xyes ; then -AC_DEFINE([ENABLE_FILEINFO], [1], [file info]) -fi -AM_CONDITIONAL(ENABLE_FILEINFO, [test x$enable_fileinfo = xyes]) - # Does the user require dynamic loading? # This is only for those hdf5 installs that support it. AC_MSG_CHECKING([do we require hdf5 dynamic-loading support]) diff --git a/docs/attribute_conventions.md b/docs/attribute_conventions.md index cb05ccbc2..c589ac705 100644 --- a/docs/attribute_conventions.md +++ b/docs/attribute_conventions.md @@ -131,10 +131,11 @@ It is strongly recommended that applicable conventions be followed unless there These attributes can occur in netCDF enhanced (netcdf-4) files beginning with version 4.4.1. They all are associated with the root group as -global attributes. They are hidden in the sense that they have no -attribute number, so they can only be accessed thru the netcdf-C api -calls via the name. Additionally, these attributes will not be counted -in the number of global attributes in the root group. +global attributes, although only _NCProperties is actually stored in the +file; the others are computed. They are hidden in the sense that they +have no attribute number, so they can only be accessed thru the netcdf-C +API calls via the name. Additionally, these attributes will not be +counted in the number of global attributes in the root group. The simplest way to view these attributes is to use the -s flag to the ncdump command. Alternatively, one can use the following API calls to @@ -152,7 +153,6 @@ Using the following API calls will fail. - nc_del_att - nc_put_att (and derivatives) - `_NCProperties` > This attribute is persistent in the file, but hidden. It is inserted in the file at creation time and is never modified after that point. It specifies the following. diff --git a/include/nc4internal.h b/include/nc4internal.h index 05ae83927..bfd367800 100644 --- a/include/nc4internal.h +++ b/include/nc4internal.h @@ -102,10 +102,8 @@ typedef enum {VAR, DIM, ATT} NC_OBJ_T; /* Boolean type, to make the code easier to read */ typedef enum {NC_FALSE = 0, NC_TRUE = 1} nc_bool_t; -#ifdef ENABLE_FILEINFO /*Forward*/ struct NCFILEINFO; -#endif /* Generic doubly-linked list node */ typedef struct NC_LIST_NODE @@ -322,9 +320,7 @@ typedef struct NC_HDF5_FILE_INFO nc_bool_t hdf4; /* True for HDF4 file */ int sdid; #endif /* USE_HDF4 */ -#ifdef ENABLE_FILEINFO struct NCFILEINFO* fileinfo; -#endif } NC_HDF5_FILE_INFO_T; @@ -452,12 +448,9 @@ For netcdf4 files, capture state information about the following: 5. Per file: _NCProperties attribute */ -#ifdef ENABLE_FILEINFO - #define NCPROPS "_NCProperties" #define NCPROPS_VERSION (1) #define NCPROPSSEP '|' -#define NCPROPS_LENGTH (8192) /* Currently used properties */ #define NCPVERSION "version" /* Of the properties format */ @@ -475,7 +468,6 @@ struct NCFILEINFO { int version; /* 0 => not defined */ char hdf5ver[NC_MAX_NAME+1]; char netcdfver[NC_MAX_NAME+1]; - char text[NCPROPS_LENGTH+1]; /* Value of the NCPROPS attribute */ } propattr; }; @@ -484,11 +476,10 @@ extern struct NCPROPINFO globalpropinfo; extern int NC4_fileinfo_init(void); /*libsrc4/ncinfo.c*/ extern int NC4_get_fileinfo(struct NC_HDF5_FILE_INFO* info, struct NCPROPINFO*); /*libsrc4/ncinfo.c*/ extern int NC4_put_propattr(struct NC_HDF5_FILE_INFO* info); /*libsrc4/ncinfo.c*/ +extern int NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap); -/* ENABLE_FILEINFO => ENABLE_NETCDF4 */ extern int NC4_hdf5get_libversion(unsigned*,unsigned*,unsigned*);/*libsrc4/nc4hdf.c*/ extern int NC4_hdf5get_superblock(struct NC_HDF5_FILE_INFO*, int*);/*libsrc4/nc4hdf.c*/ extern int NC4_isnetcdf4(struct NC_HDF5_FILE_INFO*); /*libsrc4/nc4hdf.c*/ -#endif /*ENABLE_FILEINFO*/ #endif /* _NETCDF4_ */ diff --git a/liblib/nc_initialize.c b/liblib/nc_initialize.c index 3da1acca2..128d1429c 100644 --- a/liblib/nc_initialize.c +++ b/liblib/nc_initialize.c @@ -67,11 +67,8 @@ nc_initialize() #endif #ifdef USE_NETCDF4 if((stat = NC4_initialize())) goto done; -#endif /* USE_NETCDF4 */ - -#ifdef ENABLE_FILEINFO stat = NC4_fileinfo_init(); -#endif +#endif /* USE_NETCDF4 */ done: return stat; diff --git a/libsrc4/Makefile.am b/libsrc4/Makefile.am index d1197bd0c..eb474ae17 100644 --- a/libsrc4/Makefile.am +++ b/libsrc4/Makefile.am @@ -15,10 +15,8 @@ endif # This is our output. The netCDF-4 convenience library. noinst_LTLIBRARIES = libnetcdf4.la libnetcdf4_la_SOURCES = nc4dispatch.c nc4dispatch.h nc4attr.c nc4dim.c \ -nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c -if ENABLE_FILEINFO -libnetcdf4_la_SOURCES += nc4info.c -endif +nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c \ +nc4info.c EXTRA_DIST=CMakeLists.txt diff --git a/libsrc4/nc4attr.c b/libsrc4/nc4attr.c index 7530c289b..d230ee3a1 100644 --- a/libsrc4/nc4attr.c +++ b/libsrc4/nc4attr.c @@ -17,10 +17,8 @@ conditions. #include "nc4dispatch.h" #include "ncdispatch.h" -#ifdef ENABLE_FILEINFO static int nc4_get_att_special(NC_HDF5_FILE_INFO_T*, const char*, nc_type*, nc_type, size_t*, int*, int, void*); -#endif int nc4typelen(nc_type type); @@ -62,7 +60,6 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, if ((retval = nc4_normalize_name(name, norm_name))) BAIL(retval); -#ifdef ENABLE_FILEINFO if(nc->ext_ncid == ncid && varid == NC_GLOBAL) { const char** sp; for(sp = NC_RESERVED_SPECIAL_LIST;*sp;sp++) { @@ -71,7 +68,6 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, } } } -#endif /* Find the attribute, if it exists. If we don't find it, we are major failures. @@ -251,7 +247,6 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name, if ((retval = nc4_check_name(name, norm_name))) return retval; -#ifdef ENABLE_FILEINFO if(nc->ext_ncid == ncid && varid == NC_GLOBAL) { const char** sp; for(sp = NC_RESERVED_SPECIAL_LIST;*sp;sp++) { @@ -260,7 +255,6 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name, } } } -#endif /* Find att, if it exists. */ if (varid == NC_GLOBAL) @@ -877,7 +871,6 @@ nc4_put_att_tc(int ncid, int varid, const char *name, nc_type file_type, mem_type_is_long, op); } -#ifdef ENABLE_FILEINFO static int nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name, nc_type* filetypep, nc_type mem_type, size_t* lenp, @@ -888,14 +881,21 @@ nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name, return NC_EATTMETA; if(strcmp(name,NCPROPS)==0) { + char* propdata = NULL; + int stat = NC_NOERR; + int len; if(h5->fileinfo->propattr.version == 0) return NC_ENOTATT; if(mem_type == NC_NAT) mem_type = NC_CHAR; if(mem_type != NC_CHAR) return NC_ECHAR; if(filetypep) *filetypep = NC_CHAR; - if(lenp) *lenp = strlen(h5->fileinfo->propattr.text); - if(data) strcpy((char*)data,h5->fileinfo->propattr.text); + stat = NC4_buildpropinfo(&h5->fileinfo->propattr, &propdata); + if(stat != NC_NOERR) return stat; + len = strlen(propdata); + if(lenp) *lenp = len; + if(data) strncpy((char*)data,propdata,len+1); + free(propdata); } else if(strcmp(name,ISNETCDF4ATT)==0 || strcmp(name,SUPERBLOCKATT)==0) { unsigned long long iv = 0; @@ -922,7 +922,6 @@ nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name, } return NC_NOERR; } -#endif /* Read an attribute of any type, with type conversion. This may be * called by any of the nc_get_att_* functions. */ diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c index 7db532379..7667b3586 100644 --- a/libsrc4/nc4file.c +++ b/libsrc4/nc4file.c @@ -101,15 +101,12 @@ NULL const char* NC_RESERVED_ATT_LIST[] = { NC_ATT_FORMAT, NC3_STRICT_ATT_NAME, -#ifdef ENABLE_FILEINFO NCPROPS, ISNETCDF4ATT, SUPERBLOCKATT, -#endif NULL }; -#ifdef ENABLE_FILEINFO /* Define the subset of the reserved list that is readable by name only */ const char* NC_RESERVED_SPECIAL_LIST[] = { ISNETCDF4ATT, @@ -117,7 +114,6 @@ SUPERBLOCKATT, NCPROPS, NULL }; -#endif /* These are the default chunk cache sizes for HDF5 files created or * opened with netCDF-4. */ @@ -468,10 +464,8 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info, /* Define mode gets turned on automatically on create. */ nc4_info->flags |= NC_INDEF; -#ifdef ENABLE_FILEINFO NC4_get_fileinfo(nc4_info,&globalpropinfo); NC4_put_propattr(nc4_info); -#endif return NC_NOERR; @@ -2355,9 +2349,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc) num_plists--; #endif -#ifdef ENABLE_FILEINFO NC4_get_fileinfo(nc4_info,NULL); -#endif return NC_NOERR; @@ -3094,9 +3086,7 @@ close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort) } #endif -#ifdef ENABLE_FILEINFO if(h5->fileinfo) free(h5->fileinfo); -#endif if (H5Fclose(h5->hdfid) < 0) { diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index e4256f30f..b66317666 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -4003,7 +4003,6 @@ reportopenobjects(int log, hid_t fid) } -#ifdef ENABLE_FILEINFO int NC4_hdf5get_libversion(unsigned* major,unsigned* minor,unsigned* release) { @@ -4076,7 +4075,6 @@ NC4_get_strict_att(NC_HDF5_FILE_INFO_T* h5) { int ncstat = NC_NOERR; size_t size; - char text[NCPROPS_LENGTH+1]; hid_t grp = -1; hid_t attid = -1; herr_t herr = 0; @@ -4147,4 +4145,4 @@ NC4_walk(hid_t gid, int* countp) return ncstat; } -#endif + diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index 4f6e15201..141ea2b87 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -26,7 +26,6 @@ NC4_fileinfo_init(void) int stat = NC_NOERR; unsigned major,minor,release; int super; - size_t total = 0; /* Build nc properties */ memset((void*)&globalpropinfo,0,sizeof(globalpropinfo)); @@ -39,45 +38,28 @@ NC4_fileinfo_init(void) snprintf(globalpropinfo.hdf5ver,sizeof(globalpropinfo.hdf5ver), "%1u.%1u.%1u",major,minor,release); strncpy(globalpropinfo.netcdfver,PACKAGE_VERSION,sizeof(globalpropinfo.netcdfver)); - /* Now build actual attribute text */ - total = 0; - total += strlen(NCPVERSION); - total += strlen("=00000000|"); - total += strlen(NCPNCLIBVERSION); - total += strlen(globalpropinfo.netcdfver); - total += strlen("=|"); - total += strlen(NCPHDF5LIBVERSION); - total += strlen(globalpropinfo.hdf5ver); - total += strlen("="); /* Last pair has no trailing '|' */ - if(total >= sizeof(globalpropinfo.text)) { - fprintf(stderr,"%s size is too small\n",NCPROPS); - goto done; - } - globalpropinfo.text[0] = '\0'; - snprintf(globalpropinfo.text,sizeof(globalpropinfo.text), - "%s=%d|%s=%s|%s=%s", - NCPVERSION,globalpropinfo.version, - NCPNCLIBVERSION,globalpropinfo.netcdfver, - NCPHDF5LIBVERSION,globalpropinfo.hdf5ver); done: return stat; } static int -NC4_properties_parse(struct NCPROPINFO* ncprops) +NC4_properties_parse(struct NCPROPINFO* ncprops, const char* text) { + int ret = NC_NOERR; size_t len; - char propdata[NCPROPS_LENGTH]; /* match nc.h struct NCProperties */ char* p; + char* propdata = NULL; ncprops->version = 0; ncprops->hdf5ver[0] = '\0'; ncprops->netcdfver[0] = '\0'; - strncpy(propdata,ncprops->text,sizeof(propdata)-1); - propdata[sizeof(propdata)-1] = '\0'; - len = strlen(propdata); + len = strlen(text); if(len == 0) return NC_NOERR; + propdata = (char*)malloc(len+1); + if(propdata == NULL) return NC_ENOMEM; + memcpy(propdata,text,len+1); + propdata[len] = '\0'; /* guarantee */ /* Walk and fill in ncinfo */ p = propdata; @@ -86,7 +68,7 @@ NC4_properties_parse(struct NCPROPINFO* ncprops) char* value = NULL; char* q = strchr(p,'='); if(q == NULL) - return NC_EINVAL; + {ret = NC_EINVAL; goto done;} *q++ = '\0'; value = p = q; q = strchr(p,NCPROPSSEP); @@ -107,7 +89,9 @@ NC4_properties_parse(struct NCPROPINFO* ncprops) /* Guarantee null term */ ncprops->netcdfver[sizeof(ncprops->netcdfver)-1] = '\0'; ncprops->hdf5ver[sizeof(ncprops->hdf5ver)-1] = '\0'; - return NC_NOERR; +done: + if(propdata != NULL) free(propdata); + return ret; } static int @@ -116,13 +100,13 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5) int ncstat = NC_NOERR; size_t size; H5T_class_t t_class; - char text[NCPROPS_LENGTH+1]; hid_t grp = -1; hid_t attid = -1; hid_t aspace = -1; hid_t atype = -1; hid_t ntype = -1; herr_t herr = 0; + char* text = NULL; /* Get root group */ grp = h5->root_grp->hdf_grpid; /* get root group */ @@ -136,13 +120,14 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5) t_class = H5Tget_class(atype); if(t_class != H5T_STRING) {ncstat = NC_EATTMETA; goto done;} size = H5Tget_size(atype); - if(size != NCPROPS_LENGTH) {ncstat = NC_EATTMETA; goto done;} + if(size == 0) goto done; + text = (char*)malloc(size+1); + if(text == NULL) + {ncstat = NC_ENOMEM; goto done;} HCHECK((ntype = H5Tget_native_type(atype, H5T_DIR_ASCEND))); HCHECK((H5Aread(attid, ntype, text))); /* Try to parse text */ - strncpy(h5->fileinfo->propattr.text,text,NCPROPS_LENGTH); - h5->fileinfo->propattr.text[NCPROPS_LENGTH-1] = '\0'; - ncstat = NC4_properties_parse(&h5->fileinfo->propattr); + ncstat = NC4_properties_parse(&h5->fileinfo->propattr,text); herr = 0; } done: @@ -150,6 +135,7 @@ done: if(aspace >= 0) HCHECK((H5Sclose(aspace))); if(ntype >= 0) HCHECK((H5Tclose(ntype))); if(atype >= 0) HCHECK((H5Tclose(atype))); + if(text != NULL) free(text); return ncstat; } @@ -157,7 +143,6 @@ int NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) { int ncstat = NC_NOERR; - char text[NCPROPS_LENGTH+1]; H5T_class_t t_class; size_t size; hid_t grp = -1; @@ -171,14 +156,20 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) grp = h5->root_grp->hdf_grpid; /* get root group */ /* See if the NCPROPS attribute exists */ if(H5Aexists(grp,NCPROPS) == 0) { /* Does not exist */ + char* text = NULL; + ncstat = NC4_buildpropinfo(&h5->fileinfo->propattr,&text); + if(text == NULL || ncstat != NC_NOERR) { + if(text != NULL) free(text); + goto done; + } herr = -1; /* Create a datatype to refer to. */ HCHECK((atype = H5Tcopy(H5T_C_S1))); - HCHECK((H5Tset_cset(atype, H5T_CSET_UTF8))); - HCHECK((H5Tset_size(atype, NCPROPS_LENGTH))); + HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII))); + HCHECK((H5Tset_size(atype, strlen(text)))); HCHECK((aspace = H5Screate(H5S_SCALAR))); HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT))); - HCHECK((H5Awrite(attid, atype, h5->fileinfo->propattr.text))); + HCHECK((H5Awrite(attid, atype, text))); herr = 0; } done: @@ -209,3 +200,40 @@ NC4_get_fileinfo(NC_HDF5_FILE_INFO_T* h5, struct NCPROPINFO* init) done: return ncstat; } + +int +NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap) +{ + size_t total; + + if(info == NULL || info->version == 0) return NC_EINVAL; + if(propdatap == NULL) + return NC_NOERR; + *propdatap = NULL; + + /* compute attribute length */ + total = 0; + total += strlen(NCPVERSION); + total += strlen("=00000000"); + if(strlen(info->netcdfver) > 0) { + total += 1; /*|NCPROPSEP|*/ + total += strlen(NCPNCLIBVERSION); + total += strlen("="); + total += strlen(info->netcdfver); + } + if(strlen(info->hdf5ver) > 0) { + total += 1; /*|NCPROPSEP|*/ + total += strlen(NCPHDF5LIBVERSION); + total += strlen("="); + total += strlen(info->hdf5ver); + } + *propdatap = (char*)malloc(total+1); + if(*propdatap == NULL) + return NC_ENOMEM; + snprintf(*propdatap,total+1, + "%s=%d|%s=%s|%s=%s", + NCPVERSION,info->version, + NCPNCLIBVERSION,info->netcdfver, + NCPHDF5LIBVERSION,info->hdf5ver); + return NC_NOERR; +} diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt index fb96ee428..8d888a188 100644 --- a/ncdump/CMakeLists.txt +++ b/ncdump/CMakeLists.txt @@ -59,7 +59,7 @@ IF(ENABLE_TESTS) TARGET_LINK_LIBRARIES(bom netcdf) TARGET_LINK_LIBRARIES(tst_dimsizes netcdf) -IF(ENABLE_FILEINFO) +IF(USE_NETCDF4) ADD_EXECUTABLE(tst_fileinfo tst_fileinfo.c) TARGET_LINK_LIBRARIES(tst_fileinfo netcdf) add_sh_test(ncdump tst_fileinfo) diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am index bb7046a1d..b8bec73a8 100644 --- a/ncdump/Makefile.am +++ b/ncdump/Makefile.am @@ -35,7 +35,7 @@ tst_lengths.sh tst_calendars.sh tst_utf8 run_utf8_tests.sh \ tst_nccopy3.sh tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \ tst_dimsizes.sh -if ENABLE_FILEINFO +if USE_NETCDF4 check_PROGRAMS += tst_fileinfo TESTS += tst_fileinfo.sh endif diff --git a/ncdump/ncdump.c b/ncdump/ncdump.c index 6d353ed5a..be43a9e3a 100644 --- a/ncdump/ncdump.c +++ b/ncdump/ncdump.c @@ -763,7 +763,7 @@ pr_att( ncatt_t att; /* attribute */ NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) ); -#ifdef ENABLE_FILEINFO +#ifdef USE_NETCDF4 if (ncid == getrootid(ncid) && varid == NC_GLOBAL && strcmp(att.name,NCPROPS)==0) @@ -1074,7 +1074,7 @@ pr_att_specials( } #endif /* USE_NETCDF4 */ -#ifdef ENABLE_FILEINFO /*=>NETCDF4*/ +#ifdef USE_NETCDF4 static void pr_att_hidden( int ncid, @@ -1083,7 +1083,6 @@ pr_att_hidden( { int stat; size_t len; - char propdata[NCPROPS_LENGTH]; /* No special variable attributes for classic or 64-bit offset data */ if(kind == 1 || kind == 2) @@ -1091,14 +1090,18 @@ pr_att_hidden( /* Print out Selected hidden attributes */ /* NCPROPS */ stat = nc_inq_att(ncid,NC_GLOBAL,NCPROPS,NULL,&len); - if(stat == NC_NOERR && len < sizeof(propdata)) { + if(stat == NC_NOERR) { + char* propdata = (char*)malloc(len+1); + if(propdata == NULL) + return; stat = nc_get_att_text(ncid,NC_GLOBAL,NCPROPS,propdata); if(stat == NC_NOERR) { pr_att_name(ncid, "", NCPROPS); /* make sure its null terminated */ - propdata[NCPROPS_LENGTH-1] = '\0'; + propdata[len+1] = '\0'; printf(" = \"%s\" ;\n",propdata); } + free(propdata); } /* _SuperblockVersion */ stat = nc_inq_att(ncid,NC_GLOBAL,SUPERBLOCKATT,NULL,&len); @@ -1121,7 +1124,7 @@ pr_att_hidden( } } } -#endif /* ENABLE_FILEINFO */ +#endif /* USE_NETCDF4 */ /* * Print a variable attribute for NcML @@ -1138,7 +1141,7 @@ pr_attx( int attvalslen = 0; NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) ); -#ifdef ENABLE_FILEINFO +#ifdef USE_NETCDF4 if (ncid == getrootid(ncid) && varid == NC_GLOBAL && strcmp(att.name,NCPROPS)==0 @@ -1751,7 +1754,7 @@ do_ncdump_rec(int ncid, const char *path) } if (is_root && formatting_specs.special_atts) { /* output special attribute * for format variant */ -#ifdef ENABLE_FILEINFO +#ifdef USE_NETCDF4 pr_att_hidden(ncid, kind); #endif pr_att_global_format(ncid, kind); diff --git a/ncdump/utils.c b/ncdump/utils.c index 412ea2d97..bdaa39eac 100644 --- a/ncdump/utils.c +++ b/ncdump/utils.c @@ -746,11 +746,11 @@ nc_inq_grps_full(int rootid, int *numgrps, int *grpids) return stat; } -#ifdef ENABLE_FILEINFO int getrootid(int grpid) { int current = grpid; +#ifdef USE_NETCDF4 int parent = current; /* see if root id */ for(;;) { @@ -758,7 +758,7 @@ getrootid(int grpid) if(stat) break; current = parent; } +#endif return current; } -#endif From 7701bc932c88e8c1f57041c407c254223c894102 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Mon, 8 Aug 2016 10:39:34 -0600 Subject: [PATCH 20/46] travis failing; add debug output --- ncdump/tst_ncgen4.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ncdump/tst_ncgen4.sh b/ncdump/tst_ncgen4.sh index 39d74f45e..78c557ffe 100755 --- a/ncdump/tst_ncgen4.sh +++ b/ncdump/tst_ncgen4.sh @@ -1,4 +1,5 @@ #!/bin/sh +export SETX=1 if test "x$SETX" = x1 ; then echo "file=$0"; set -x ; fi verbose=1 set -e From f205989d59de275dd1af250140e8eb0c6cf0a7cf Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Mon, 8 Aug 2016 11:23:14 -0600 Subject: [PATCH 21/46] Undo debug output because Travis won't show it --- ncdump/tst_ncgen4.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ncdump/tst_ncgen4.sh b/ncdump/tst_ncgen4.sh index 78c557ffe..39d74f45e 100755 --- a/ncdump/tst_ncgen4.sh +++ b/ncdump/tst_ncgen4.sh @@ -1,5 +1,4 @@ #!/bin/sh -export SETX=1 if test "x$SETX" = x1 ; then echo "file=$0"; set -x ; fi verbose=1 set -e From ddfb6d6279ff284861291fc7c7c244ff82bdb8c5 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Mon, 8 Aug 2016 21:54:23 -0600 Subject: [PATCH 22/46] Make sure that the _NcProperties attr is null terminated and stored as such --- libsrc4/nc4info.c | 14 ++++++++++---- ncdump/ncdump.c | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index 141ea2b87..0f8b8efdb 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -126,6 +126,8 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5) {ncstat = NC_ENOMEM; goto done;} HCHECK((ntype = H5Tget_native_type(atype, H5T_DIR_ASCEND))); HCHECK((H5Aread(attid, ntype, text))); + /* Make sure its null terminated */ + text[size] = '\0'; /* Try to parse text */ ncstat = NC4_properties_parse(&h5->fileinfo->propattr,text); herr = 0; @@ -166,7 +168,7 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) /* Create a datatype to refer to. */ HCHECK((atype = H5Tcopy(H5T_C_S1))); HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII))); - HCHECK((H5Tset_size(atype, strlen(text)))); + HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */ HCHECK((aspace = H5Screate(H5S_SCALAR))); HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT))); HCHECK((H5Awrite(attid, atype, text))); @@ -205,6 +207,7 @@ int NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap) { size_t total; + char* propdata = NULL; if(info == NULL || info->version == 0) return NC_EINVAL; if(propdatap == NULL) @@ -227,13 +230,16 @@ NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap) total += strlen("="); total += strlen(info->hdf5ver); } - *propdatap = (char*)malloc(total+1); - if(*propdatap == NULL) + propdata = (char*)malloc(total+1); + if(propdata == NULL) return NC_ENOMEM; - snprintf(*propdatap,total+1, + snprintf(propdata,total+1, "%s=%d|%s=%s|%s=%s", NCPVERSION,info->version, NCPNCLIBVERSION,info->netcdfver, NCPHDF5LIBVERSION,info->hdf5ver); + /* Force null termination */ + propdata[total] = '\0'; + if(propdatap) {*propdatap = propdata;} else {free(propdata);} return NC_NOERR; } diff --git a/ncdump/ncdump.c b/ncdump/ncdump.c index be43a9e3a..374a883f5 100644 --- a/ncdump/ncdump.c +++ b/ncdump/ncdump.c @@ -1098,7 +1098,7 @@ pr_att_hidden( if(stat == NC_NOERR) { pr_att_name(ncid, "", NCPROPS); /* make sure its null terminated */ - propdata[len+1] = '\0'; + propdata[len] = '\0'; printf(" = \"%s\" ;\n",propdata); } free(propdata); From c2929b77c974c1f8a3392dab405e8eb3b409927b Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 9 Aug 2016 13:37:10 -0600 Subject: [PATCH 23/46] Updated release notes to reference https://github.com/Unidata/netcdf-c/issues/gh300.dmh and https://github.com/Unidata/netcdf-c/pull/301 --- RELEASE_NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 55af9058f..20c31fe8e 100755 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -9,6 +9,8 @@ This file contains a high-level description of this package's evolution. Release ## 4.4.2 - TBD +* [Bug][Enhancement] Corrected a behavioral issue with the `_NCProperties` attribute taking up too much space. See [GitHub #300](https://github.com/Unidata/netcdf-c/issues/300) and [GitHub #301](https://github.com/Unidata/netcdf-c/pull/301) for more information. + * [Bug] Corrected behavior for `nc-config` so that, if `nf-config` is found in system, the proper fortran-related information will be conveyed. See [GitHub #296](https://github.com/Unidata/netcdf-c/issues/296] for more information. ## 4.4.1 - June 28, 2016 From 5204c3728f521bf44b865e30eea570d18cba2db3 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 10 Aug 2016 09:40:15 -0600 Subject: [PATCH 24/46] Carrying cmake options into autotools based builds. --- .travis.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43d6fbb8e..ffbe43ce1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,25 +5,25 @@ services: env: matrix: - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned before_install: - docker pull $DOCKIMG > /dev/null From 69c70e487f21eb78d60d8ebf79c14b2cbedd87d9 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 10 Aug 2016 09:50:36 -0600 Subject: [PATCH 25/46] Further refinement. --- .travis.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffbe43ce1..78ffb05d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,25 +5,25 @@ services: env: matrix: - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-fsigned-char' COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='-funsigned-char' COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-unsigned before_install: - docker pull $DOCKIMG > /dev/null From 86c7575f97d21a6351bf0ac965823df37d113cd3 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 17 Aug 2016 14:01:25 +0100 Subject: [PATCH 26/46] Use correct autotools variables in nc-config This was fixed in a previous commit for nc-config.cmake.in, but not for the autotools version --- nc-config.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) mode change 100644 => 100755 nc-config.in diff --git a/nc-config.in b/nc-config.in old mode 100644 new mode 100755 index 6c4cc8069..b964bcb80 --- a/nc-config.in +++ b/nc-config.in @@ -5,12 +5,14 @@ # contributed by netCDF user Arlindo DaSilva. Thanks Arlindo! prefix=@prefix@ -exec_prefix=${prefix} -includedir=${prefix}/include - +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ cc="@CC@" -cflags=" -I${includedir} @CPPFLAGS@" +cflags="-I${includedir} @CPPFLAGS@" +libs="-L${libdir} @NC_LIBS@" + has_dap="@HAS_DAP@" has_nc2="@HAS_NC2@" has_nc4="@HAS_NC4@" From a49816ad43e98a4222832d780d8ee9dcaada9af4 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 17 Aug 2016 14:03:38 +0100 Subject: [PATCH 27/46] Use libs variable instead of pkg-config pkg-config isn't used in the cmake version of nc-config, so probably shouldn't be used in autotools version either? --- nc-config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nc-config.in b/nc-config.in index b964bcb80..b5006421c 100755 --- a/nc-config.in +++ b/nc-config.in @@ -205,7 +205,7 @@ while test $# -gt 0; do ;; --libs) - PKG_CONFIG_PATH=${prefix}/lib/pkgconfig pkg-config netcdf --libs + echo $libs ;; --prefix) From ce15b1cc2df8989ca706b3e381fa3fb3b35d94e1 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 17 Aug 2016 14:40:37 +0100 Subject: [PATCH 28/46] Add couple of missing flags to nc-config - Add --has-fortran, in addition to the specific --has-f90, --has-f03 - Add --libdir to print just the libdir - Also 'which nf-config' will spit out errors if nf-config is not found. Silence these errors --- nc-config.cmake.in | 18 +++++++++++++++--- nc-config.in | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/nc-config.cmake.in b/nc-config.cmake.in index 09aeb8ed0..b11d7394c 100755 --- a/nc-config.cmake.in +++ b/nc-config.cmake.in @@ -79,11 +79,11 @@ has_fortran="no" has_f90="no" has_f03="no" -nfconf=$(which nf-config) +nfconf=$(which nf-config 2>/dev/null) if [ -f "$nfconf" ]; then - echo "Using nf-config: $nfconf" - has_fortran="yes" + echo "Using nf-config: $nfconf" + has_fortran="yes" fc=`nf-config --fc` fflags=`nf-config --fflags` flibs=`nf-config --flibs` @@ -112,6 +112,7 @@ Available values for OPTION include: --all display all options --cc C compiler --cflags pre-processor and compiler flags + --has-fortran whether Fortran API is installed --has-dap whether OPeNDAP is enabled in this build --has-nc2 whether NetCDF-2 API is enabled --has-nc4 whether NetCDF-4/HDF-5 is enabled in this build @@ -123,6 +124,7 @@ Available values for OPTION include: --libs library linking information for netcdf --prefix Install prefix --includedir Include directory + --libdir Library directory --version Library version EOF @@ -171,6 +173,7 @@ all() echo " --cxx4 -> $cxx4" echo + echo " --has-fortran-> $has_fortran" if [ -f "$nfconf" ]; then echo " --fc -> $fc" echo " --fflags -> $fflags" @@ -190,6 +193,7 @@ fi echo echo " --prefix -> $prefix" echo " --includedir-> $includedir" + echo " --libdir -> $libdir" echo " --version -> $version" echo } @@ -269,6 +273,10 @@ while test $# -gt 0; do echo "${includedir}" ;; + --libdir) + echo "${libdir}" + ;; + --version) echo $version ;; @@ -297,6 +305,10 @@ while test $# -gt 0; do # echo $cxxlibs # ;; + --has-fortran) + echo $has_fortran + ;; + --fc) echo $fc ;; diff --git a/nc-config.in b/nc-config.in index b5006421c..74cee44ff 100755 --- a/nc-config.in +++ b/nc-config.in @@ -26,11 +26,11 @@ has_fortran="no" has_f90="no" has_f03="no" -nfconf=$(which nf-config) +nfconf=$(which nf-config 2>/dev/null) if [ -f "$nfconf" ]; then - echo "Using nf-config: $nfconf" - has_fortran="yes" + echo "Using nf-config: $nfconf" + has_fortran="yes" fc=`nf-config --fc` fflags=`nf-config --fflags` flibs=`nf-config --flibs` @@ -59,6 +59,7 @@ Available values for OPTION include: --all display all options --cc C compiler --cflags pre-processor and compiler flags + --has-fortran whether Fortran API is installed --has-dap whether OPeNDAP is enabled in this build --has-nc2 whether NetCDF-2 API is enabled --has-nc4 whether NetCDF-4/HDF-5 is enabled in this build @@ -70,6 +71,7 @@ Available values for OPTION include: --libs library linking information for netcdf --prefix Install prefix --includedir Include directory + --libdir Library directory --version Library version EOF @@ -118,6 +120,7 @@ all() echo " --cxx4 -> $cxx4" echo + echo " --has-fortran-> $has_fortran" if [ -f "$nfconf" ]; then echo " --fc -> $fc" echo " --fflags -> $fflags" @@ -137,6 +140,7 @@ fi echo echo " --prefix -> $prefix" echo " --includedir-> $includedir" + echo " --libdir -> $libdir" echo " --version -> $version" echo } @@ -216,6 +220,10 @@ while test $# -gt 0; do echo "${includedir}" ;; + --libdir) + echo "${libdir}" + ;; + --version) echo $version ;; @@ -236,6 +244,11 @@ while test $# -gt 0; do echo $cxx4 ;; + + --has-fortran) + echo $has_fortran + ;; + --fc) echo $fc ;; From 6c028fbf5c40f312063e06234f672715950c0a52 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 17 Aug 2016 14:45:40 +0100 Subject: [PATCH 29/46] Get C++ flags from ncxx{4}-config --- nc-config.cmake.in | 51 +++++++++++++++++++++++++++++++--------------- nc-config.in | 44 +++++++++++++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 25 deletions(-) diff --git a/nc-config.cmake.in b/nc-config.cmake.in index b11d7394c..a07e85b5d 100755 --- a/nc-config.cmake.in +++ b/nc-config.cmake.in @@ -95,9 +95,13 @@ has_cxx="no" has_cxx4="no" if type -p ncxx4-config > /dev/null 2>&1; then cxx4=`ncxx4-config --cxx` + cxx4flags=`ncxx4-config --cflags` + cxx4libs=`ncxx4-config --libs` has_cxx4="yes" elif type -p ncxx-config > /dev/null 2>&1; then cxx=`ncxx-config --cxx` + cxxflags=`ncxx-config --cflags` + cxxlibs=`ncxx-config --libs` has_cxx="yes" fi @@ -112,6 +116,8 @@ Available values for OPTION include: --all display all options --cc C compiler --cflags pre-processor and compiler flags + --has-c++ whether C++ API is installed + --has-c++4 whether netCDF-4 C++ API is installed --has-fortran whether Fortran API is installed --has-dap whether OPeNDAP is enabled in this build --has-nc2 whether NetCDF-2 API is enabled @@ -128,19 +134,17 @@ Available values for OPTION include: --version Library version EOF -# When supported by ncxx4-config and ncxx-config, add -# --cxxflags flags needed to compile a netCDF-4 C++ program -# --cxxlibs libraries needed to link a netCDF-4 C++ program if type -p ncxx4-config > /dev/null 2>&1; then cat < /dev/null 2>&1; then cat < $has_cxx" echo " --cxx -> $cxx" -# echo " --cxxflags -> $cxxflags" -# echo " --cxxlibs -> $cxxlibs" +if type -p ncxx-config > /dev/null 2>&1; then + echo " --cxxflags -> $cxxflags" + echo " --cxxlibs -> $cxxlibs" +fi + echo echo " --has-c++4 -> $has_cxx4" echo " --cxx4 -> $cxx4" +if type -p ncxx4-config > /dev/null 2>&1; then + echo " --cxx4flags -> $cxx4flags" + echo " --cxx4libs -> $cxx4libs" +fi echo echo " --has-fortran-> $has_fortran" @@ -289,6 +300,14 @@ while test $# -gt 0; do echo $cxx ;; + --cxxflags) + echo $cxxflags + ;; + + --cxxlibs) + echo $cxxlibs + ;; + --has-c++4) echo $has_cxx4 ;; @@ -297,13 +316,13 @@ while test $# -gt 0; do echo $cxx4 ;; -# --cxxflags) -# echo $cxxflags -# ;; -# -# --cxxlibs) -# echo $cxxlibs -# ;; + --cxx4flags) + echo $cxx4flags + ;; + + --cxx4libs) + echo $cxx4libs + ;; --has-fortran) echo $has_fortran diff --git a/nc-config.in b/nc-config.in index 74cee44ff..339ec3d83 100755 --- a/nc-config.in +++ b/nc-config.in @@ -42,9 +42,13 @@ has_cxx="no" has_cxx4="no" if type -p ncxx4-config > /dev/null 2>&1; then cxx4=`ncxx4-config --cxx` + cxx4flags=`ncxx4-config --cflags` + cxx4libs=`ncxx4-config --libs` has_cxx4="yes" elif type -p ncxx-config > /dev/null 2>&1; then cxx=`ncxx-config --cxx` + cxxflags=`ncxx-config --cflags` + cxxlibs=`ncxx-config --libs` has_cxx="yes" fi @@ -59,6 +63,8 @@ Available values for OPTION include: --all display all options --cc C compiler --cflags pre-processor and compiler flags + --has-c++ whether C++ API is installed + --has-c++4 whether netCDF-4 C++ API is installed --has-fortran whether Fortran API is installed --has-dap whether OPeNDAP is enabled in this build --has-nc2 whether NetCDF-2 API is enabled @@ -75,19 +81,17 @@ Available values for OPTION include: --version Library version EOF -# When supported by ncxx4-config and ncxx-config, add -# --cxxflags flags needed to compile a netCDF-4 C++ program -# --cxxlibs libraries needed to link a netCDF-4 C++ program if type -p ncxx4-config > /dev/null 2>&1; then cat < /dev/null 2>&1; then cat < $has_cxx" echo " --cxx -> $cxx" -# echo " --cxxflags -> $cxxflags" -# echo " --cxxlibs -> $cxxlibs" +if type -p ncxx-config > /dev/null 2>&1; then + echo " --cxxflags -> $cxxflags" + echo " --cxxlibs -> $cxxlibs" +fi + echo echo " --has-c++4 -> $has_cxx4" echo " --cxx4 -> $cxx4" +if type -p ncxx4-config > /dev/null 2>&1; then + echo " --cxx4flags -> $cxx4flags" + echo " --cxx4libs -> $cxx4libs" +fi echo echo " --has-fortran-> $has_fortran" @@ -236,6 +247,14 @@ while test $# -gt 0; do echo $cxx ;; + --cxxflags) + echo $cxxflags + ;; + + --cxxlibs) + echo $cxxlibs + ;; + --has-c++4) echo $has_cxx4 ;; @@ -244,6 +263,13 @@ while test $# -gt 0; do echo $cxx4 ;; + --cxx4flags) + echo $cxx4flags + ;; + + --cxx4libs) + echo $cxx4libs + ;; --has-fortran) echo $has_fortran From d455718f40fe5c2db10b1348753870401d6e0df3 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 18 Aug 2016 16:48:30 +0100 Subject: [PATCH 30/46] Usage function called wrong in nc-config `usage` needs to be called with an exit value. Incorrect options won't set the exit value, so are trickier to detect --- nc-config.cmake.in | 5 ++--- nc-config.in | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/nc-config.cmake.in b/nc-config.cmake.in index a07e85b5d..a97e8403c 100755 --- a/nc-config.cmake.in +++ b/nc-config.cmake.in @@ -350,9 +350,8 @@ while test $# -gt 0; do *) echo "unknown option: $1" - usage - exit 1 - ;; + usage 1 + ;; esac shift done diff --git a/nc-config.in b/nc-config.in index 339ec3d83..e6f01534a 100755 --- a/nc-config.in +++ b/nc-config.in @@ -297,9 +297,8 @@ while test $# -gt 0; do *) echo "unknown option: $1" - usage - exit 1 - ;; + usage 1 + ;; esac shift done From 6198af95ad59d627e98bef9a0d5b21aca901e172 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Thu, 18 Aug 2016 11:21:19 -0600 Subject: [PATCH 31/46] Turned of netcdf-4 where appropriate for AC checks. --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78ffb05d4..6ac8a2479 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,15 @@ services: env: matrix: - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-signed - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-signed + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-signed - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-unsigned - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-unsigned - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-unsigned + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-unsigned + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-unsigned - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed From 2d059f4580c2c9f566b4af1f69328a3a398ce197 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Thu, 25 Aug 2016 11:32:49 -0600 Subject: [PATCH 32/46] Fix invalid array access If an empty line is passed to this routine, then there is an invalid memory access at the cp[nn-1] line. This becomes cp[-1] which is invalid. --- ncdump/vardata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncdump/vardata.c b/ncdump/vardata.c index 483fc291d..41b17f0ce 100644 --- a/ncdump/vardata.c +++ b/ncdump/vardata.c @@ -64,7 +64,7 @@ lput(const char *cp) { linep = (int)strlen(LINEPIND) + indent_get(); } (void) fputs(cp,stdout); - if (cp[nn - 1] == '\n') { + if (nn > 0 && cp[nn - 1] == '\n') { linep = indent_get(); } else linep += nn; From 6e5c74550d990d38de6a5eb91e6c5d35614f9f87 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Sun, 28 Aug 2016 15:26:35 +0200 Subject: [PATCH 33/46] Fix HDF5 include directory with CMake >= 3.6.0. HDF5_INCLUDE_DIR has been deprecated some time ago, only HDF5_INCLUDE_DIRS is set for CMake >= 3.6.0. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2149713f6..65cb0f7c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -572,6 +572,10 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) ## # Include the HDF5 include directory. ## + IF(HDF5_INCLUDE_DIRS AND NOT HDF5_INCLUDE_DIR) + SET(HDF5_INCLUDE_DIR ${HDF5_INCLUDE_DIRS}) + ENDIF() + MESSAGE(STATUS "Using HDF5 include dir: ${HDF5_INCLUDE_DIR}") INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR}) ### From 988b4ff868e1eb9a169d8c41e9fd133692590e59 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Sun, 28 Aug 2016 15:45:36 +0200 Subject: [PATCH 34/46] Fix spelling errors. * characers -> characters * varaible -> variable --- docs/netcdf.m4 | 6 +++--- docs/old/netcdf-f90.texi | 2 +- ncgen/ncgen.1 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/netcdf.m4 b/docs/netcdf.m4 index 2baa47845..19dd1d659 100644 --- a/docs/netcdf.m4 +++ b/docs/netcdf.m4 @@ -774,15 +774,15 @@ Learn about a compound type. .HP FDECL(def_vlen, (INCID(), INAME(), INCTYPE(base_typeid), ONCTYPE(xtypep))) .sp -Create a varaible length array type. +Create a variable length array type. .HP FDECL(inq_vlen, (INCID(), INCTYPE(), ONAME(), OSIZET(datum_sizep), ONCTYPE(base_nc_typep))) .sp -Learn about a varaible length array type. +Learn about a variable length array type. .HP FDECL(free_vlen, (nc_vlen_t *vl)) .sp -Free memory comsumed by reading data of a varaible length array type. +Free memory comsumed by reading data of a variable length array type. .HP FDECL(put_vlen_element, (INCID(), INCTYPE(), IVOIDP(vlen_element), ISIZET(len), IVOIDP(data))) .sp diff --git a/docs/old/netcdf-f90.texi b/docs/old/netcdf-f90.texi index 335132da4..31a0be6db 100755 --- a/docs/old/netcdf-f90.texi +++ b/docs/old/netcdf-f90.texi @@ -5180,7 +5180,7 @@ rh in an existing netCDF dataset named foo.nc: @findex NF90_INQ_VARID @cindex NF90_INQ_VARID, example -Given the name of a varaible, nf90_inq_varid finds the variable ID. +Given the name of a variable, nf90_inq_varid finds the variable ID. @heading Usage @example diff --git a/ncgen/ncgen.1 b/ncgen/ncgen.1 index 1582ee31c..77a87c247 100644 --- a/ncgen/ncgen.1 +++ b/ncgen/ncgen.1 @@ -864,7 +864,7 @@ There are three other cases of note. .IP 1. 3 If there is only a single, unlimited dimension, then all of the constants are concatenated -and fill characers are added to the +and fill characters are added to the end of the resulting string to make its length be that of the unlimited dimension. If the length is larger than From b2e4b74e3a7ff416cb72625702ba0c8f73b307fe Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 31 Aug 2016 15:38:59 -0600 Subject: [PATCH 35/46] Restricted tests from running when they require the utilities but the utilities were not built, in autoconf-based tests. See https://github.com/Unidata/netcdf-c/issues/313 for more information. --- configure.ac | 2 +- nc_test/Makefile.am | 18 ++++++++++-------- nc_test4/Makefile.am | 6 +++++- ncdap_test/Makefile.am | 6 +++++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index d0f2aca93..4bd25b517 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -M# -*- Autoconf -*- +# -*- Autoconf -*- ## Process this file with autoconf to produce a configure script. # This is part of Unidata's netCDF package. Copyright 2005-2012, see diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am index 17df2639c..2c46c4b26 100644 --- a/nc_test/Makefile.am +++ b/nc_test/Makefile.am @@ -62,14 +62,16 @@ endif TESTS = $(TESTPROGRAMS) -if BUILD_DISKLESS -TESTS += run_diskless.sh -if BUILD_MMAP -TESTS += run_mmap.sh -endif -if LARGE_FILE_TESTS -TESTS += run_diskless2.sh -endif +if BUILD_UTILITIES + if BUILD_DISKLESS + TESTS += run_diskless.sh + if BUILD_MMAP + TESTS += run_mmap.sh + endif + if LARGE_FILE_TESTS + TESTS += run_diskless2.sh + endif + endif endif if USE_PNETCDF diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 6e7b0a457..00c1fabc7 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -33,7 +33,11 @@ endif TESTS = $(NC4_TESTS) -TESTS += run_grp_rename.sh run_empty_vlen_test.sh tst_misc.sh +if BUILD_UTILITIES + TESTS += run_grp_rename.sh tst_misc.sh +endif + +TESTS += run_empty_vlen_test.sh # If the v2 API was built, add its test program. if BUILD_V2 diff --git a/ncdap_test/Makefile.am b/ncdap_test/Makefile.am index b4e0a9f95..f672ccb0d 100644 --- a/ncdap_test/Makefile.am +++ b/ncdap_test/Makefile.am @@ -33,7 +33,11 @@ if ENABLE_DAP_REMOTE_TESTS check_PROGRAMS += nctestserver nctestserver_SOURCES = nctestserver.c -TESTS += tst_remote3.sh tst_formatx.sh test_partvar testurl.sh +if BUILD_UTILITIES +TESTS += tst_remote3.sh tst_formatx.sh +endif + +TESTS += test_partvar testurl.sh if ENABLE_DAP_LONG_TESTS TESTS += tst_longremote3.sh From 486f69522c86d0ba853d05c5f5c440425b631f53 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 31 Aug 2016 15:48:10 -0600 Subject: [PATCH 36/46] Merged utility-based tests fix into cmake-based builds. --- nc_test/CMakeLists.txt | 21 ++++++++++++--------- nc_test4/CMakeLists.txt | 10 +++++++--- ncdap_test/CMakeLists.txt | 6 ++++-- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt index 23430f96b..f46ac171f 100644 --- a/nc_test/CMakeLists.txt +++ b/nc_test/CMakeLists.txt @@ -68,16 +68,19 @@ ENDFOREACH() ADD_TEST(nc_test ${EXECUTABLE_OUTPUT_PATH}/nc_test) -IF(BUILD_DISKLESS) - add_sh_test(nc_test run_diskless) - IF(BUILD_MMAP) - add_sh_test(nc_test run_mmap) - ENDIF() - IF(LARGE_FILE_TESTS) - add_sh_test(nc_test run_diskless2) - ENDIF() +IF(BUILD_UTILITIES) -ENDIF() + IF(BUILD_DISKLESS) + add_sh_test(nc_test run_diskless) + IF(BUILD_MMAP) + add_sh_test(nc_test run_mmap) + ENDIF(BUILD_MMAP) + IF(LARGE_FILE_TESTS) + add_sh_test(nc_test run_diskless2) + ENDIF(LARGE_FILE_TESTS) + + ENDIF(BUILD_DISKLESS) +ENDIF(BUILD_UTILITIES) # Copy some test files from current source dir to out-of-tree build dir. FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh) diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index 114a96c54..1b52fb2b8 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -13,8 +13,12 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars tst_rehash) # Note, renamegroup needs to be compiled before run_grp_rename -build_bin_test(renamegroup) -add_sh_test(nc_test4 run_grp_rename) + +IF(BUILD_UTILITIES) + build_bin_test(renamegroup) + add_sh_test(nc_test4 run_grp_rename) + ADD_SH_TEST(nc_test4 tst_misc) +ENDIF(BUILD_UTILITIES) ## # The shell script, run_empty_vlen_test.sh, @@ -23,7 +27,7 @@ add_sh_test(nc_test4 run_grp_rename) BUILD_BIN_TEST(tst_empty_vlen_unlim) ADD_SH_TEST(nc_test4 run_empty_vlen_test) -ADD_SH_TEST(nc_test4 tst_misc) + IF(NOT MSVC) SET(NC4_TESTS ${NC4_TESTS} tst_interops5 tst_camrun) diff --git a/ncdap_test/CMakeLists.txt b/ncdap_test/CMakeLists.txt index 1294fa686..c25b966f7 100644 --- a/ncdap_test/CMakeLists.txt +++ b/ncdap_test/CMakeLists.txt @@ -43,8 +43,10 @@ IF(ENABLE_TESTS) ENDIF() IF(ENABLE_DAP_REMOTE_TESTS) - add_sh_test(ncdap tst_remote3) - add_sh_test(ncdap tst_formatx) + IF(BUILD_UTILITIES) + add_sh_test(ncdap tst_remote3) + add_sh_test(ncdap tst_formatx) + ENDIF(BUILD_UTILTIES) add_bin_test(ncdap test_partvar) IF(ENABLE_DAP_LONG_TESTS) add_sh_test(ncdap tst_longremote3) From 8580fe543c9ee17ab538d587ad1f3d272c5fab8c Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 31 Aug 2016 15:53:12 -0600 Subject: [PATCH 37/46] Updated release notes. --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 20c31fe8e..ccfaa5455 100755 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -9,6 +9,7 @@ This file contains a high-level description of this package's evolution. Release ## 4.4.2 - TBD +* [Bug] Corrected an issue related to test failures when `--disable-utilities` or `-DENABLE_UTILITIES=OFF` are specified when building with autotools or cmake, respectively. See [GitHub #313](https://github.com/Unidata/netcdf-c/issues/313) for more information. * [Bug][Enhancement] Corrected a behavioral issue with the `_NCProperties` attribute taking up too much space. See [GitHub #300](https://github.com/Unidata/netcdf-c/issues/300) and [GitHub #301](https://github.com/Unidata/netcdf-c/pull/301) for more information. * [Bug] Corrected behavior for `nc-config` so that, if `nf-config` is found in system, the proper fortran-related information will be conveyed. See [GitHub #296](https://github.com/Unidata/netcdf-c/issues/296] for more information. From c179cf0c5f243ff48ed23d5f2800d1bd53e9823c Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 31 Aug 2016 15:53:34 -0600 Subject: [PATCH 38/46] Updated cmakelists.txt for the final test failure. --- nc_test4/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index 1b52fb2b8..12199cae9 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -5,7 +5,7 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars tst_strings2 tst_interops tst_interops4 tst_interops6 tst_enums tst_coords tst_coords2 tst_coords3 tst_vars3 tst_vars4 tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 tst_fillbug - tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts + tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2 tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite @@ -15,6 +15,7 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars # Note, renamegroup needs to be compiled before run_grp_rename IF(BUILD_UTILITIES) + SET(NC4_TESTS ${NC4_TESTS} tst_xplatform) build_bin_test(renamegroup) add_sh_test(nc_test4 run_grp_rename) ADD_SH_TEST(nc_test4 tst_misc) From e2967bb622501c93aed678972dd5e036ffd38e8b Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Thu, 1 Sep 2016 22:06:07 -0600 Subject: [PATCH 39/46] Fix for Github issue 314. Problem was in oc2/dap.y. In definition of errormsg:, change WORD_WORD to WORD_STRING since the msg field of an opendap error response is a quoted string. Also took the opportunity to modify ncgen to transfer the logging level (-L flag) into the c-code generated using -lc. --- libdap2/env | 2 +- ncgen/Make0 | 23 +- ncgen/genc.c | 8 + oc2/dap.y | 2 +- oc2/dapy.c | 1659 +++++++++++++++++++++----------------------------- oc2/dapy.h | 92 +-- 6 files changed, 758 insertions(+), 1028 deletions(-) diff --git a/libdap2/env b/libdap2/env index e4e59c319..d6d8bca18 100644 --- a/libdap2/env +++ b/libdap2/env @@ -4,7 +4,7 @@ alias xx="cd ..;make; cd libdap2" PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""; SHARP='#' alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=; -F="https://eosdap.hdfgroup.org:8080/opendap/data/test/kent/ceres-converted/edition_4/CER_SSF1deg-Hour_Terra-MODIS_TestSuite_000000.200407D01.hdf" +F="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.dailyavgs/pressure/air.1947.nc" if test -e "/cygdrive/f/git/netcdf-c" ; then TOP="/cygdrive/f/git/netcdf-c" diff --git a/ncgen/Make0 b/ncgen/Make0 index cc0f1911d..b58acb506 100644 --- a/ncgen/Make0 +++ b/ncgen/Make0 @@ -1,6 +1,7 @@ # Test c output -T=test0 -K=1 +T=t +K=4 +L=-L5 #VG=valgrind --leak-check=full STDLIB=/usr/local @@ -13,19 +14,23 @@ LDFLAGS=../liblib/.libs/libnetcdf.a -L${STDLIB}/lib -lhdf5_hl -lhdf5 -lz -lm -lc CLASSPATH=".:ncCore-4.2.jar" btest:: - ./ncgen -k$K -lb -o ${T}.nc ${T}.cdl - ../ncdump/ncdump ./${T}.nc >${T}.dmp + ./ncgen ${L} -$K -lb -o ${T}.nc ${T}.cdl + ../ncdump/ncdump -L2 ./${T}.nc >${T}.dmp diff -wBb ${T}.cdl ${T}.dmp + rm -f ./junk.nc + ../ncdump/nccopy ./${T}.nc ./junk.nc ctest:: - ./ncgen -k$K -lc ${T}.cdl >${T}.c + ./ncgen ${L} -$K -lc ${T}.cdl >${T}.c gcc -o ${T} ${CFLAGS} ${T}.c ${LDFLAGS} ./${T} - ../ncdump/ncdump ./${T}.nc >${T}.dmp + ../ncdump/ncdump ${L} ./${T}.nc >${T}.dmp diff -wBb ${T}.cdl ${T}.dmp + rm -f ./junk.nc + ../ncdump/nccopy ./${T}.nc ./junk.nc gtest:: - ./ncgen -k$K -lc ${T}.cdl >${T}.c + ./ncgen -$K -lc ${T}.cdl >${T}.c gcc -g -O0 -o ${T} ${CFLAGS} ${T}.c ${LDFLAGS} gdb --args ./${T} @@ -35,11 +40,11 @@ vctest:: ${VG} ./vt ftest:: - ./ncgen -k$K -lf77 ${T}.cdl >${T}.f77 + ./ncgen -$K -lf77 ${T}.cdl >${T}.f77 gfortran -c ${CFLAGS} ${T}.f77 jtest:: - ./ncgen -k$K -lj ${T}.cdl >Main.java + ./ncgen -$K -lj ${T}.cdl >Main.java javac -d . -classpath "${CLASSPATH}" Main.java # java -cp ${CPATH} ./${T} diff --git a/ncgen/genc.c b/ncgen/genc.c index f73308512..c8abe934d 100644 --- a/ncgen/genc.c +++ b/ncgen/genc.c @@ -229,6 +229,14 @@ gen_ncc(const char *filename) } codeflush(); + /* Set log level */ + if(ncloglevel >= 0) { + codeline(""); + bbprintf0(stmt," nc_set_log_level(%d); /* set log level */",ncloglevel); + codedump(stmt); + codeline(""); + } + /* create netCDF file, uses NC_CLOBBER mode */ codeline(""); codelined(1,"/* enter define mode */"); diff --git a/oc2/dap.y b/oc2/dap.y index cf2569a19..e20153904 100644 --- a/oc2/dap.y +++ b/oc2/dap.y @@ -236,7 +236,7 @@ errorbody: ; errorcode: /*empty*/ {$$=null;} | SCAN_CODE '=' WORD_WORD ';' {$$=$3;} -errormsg: /*empty*/ {$$=null;} | SCAN_MESSAGE '=' WORD_WORD ';' {$$=$3;} +errormsg: /*empty*/ {$$=null;} | SCAN_MESSAGE '=' WORD_STRING ';' {$$=$3;} errorptype: /*empty*/ {$$=null;} | SCAN_PTYPE '=' WORD_WORD ';' {$$=$3;} errorprog : /*empty*/ {$$=null;} | SCAN_PROG '=' WORD_WORD ';' {$$=$3;} diff --git a/oc2/dapy.c b/oc2/dapy.c index e2af8b2fd..d1cfa63ab 100644 --- a/oc2/dapy.c +++ b/oc2/dapy.c @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,37 +58,32 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse dapparse #define yylex daplex #define yyerror daperror -#define yylval daplval -#define yychar dapchar #define yydebug dapdebug #define yynerrs dapnerrs /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ -#line 11 "dap.y" +#line 11 "dap.y" /* yacc.c:339 */ #include "config.h" #include "dapparselex.h" #include "dapy.h" int dapdebug = 0; +#line 79 "dap.tab.c" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 87 "dap.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -98,61 +93,67 @@ int dapdebug = 0; # define YYERROR_VERBOSE 1 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "dap.tab.h". */ +#ifndef YY_DAP_DAP_TAB_H_INCLUDED +# define YY_DAP_DAP_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int dapdebug; #endif - -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - SCAN_ALIAS = 258, - SCAN_ARRAY = 259, - SCAN_ATTR = 260, - SCAN_BYTE = 261, - SCAN_CODE = 262, - SCAN_DATASET = 263, - SCAN_DATA = 264, - SCAN_ERROR = 265, - SCAN_FLOAT32 = 266, - SCAN_FLOAT64 = 267, - SCAN_GRID = 268, - SCAN_INT16 = 269, - SCAN_INT32 = 270, - SCAN_MAPS = 271, - SCAN_MESSAGE = 272, - SCAN_SEQUENCE = 273, - SCAN_STRING = 274, - SCAN_STRUCTURE = 275, - SCAN_UINT16 = 276, - SCAN_UINT32 = 277, - SCAN_URL = 278, - SCAN_PTYPE = 279, - SCAN_PROG = 280, - WORD_WORD = 281, - WORD_STRING = 282 - }; + enum yytokentype + { + SCAN_ALIAS = 258, + SCAN_ARRAY = 259, + SCAN_ATTR = 260, + SCAN_BYTE = 261, + SCAN_CODE = 262, + SCAN_DATASET = 263, + SCAN_DATA = 264, + SCAN_ERROR = 265, + SCAN_FLOAT32 = 266, + SCAN_FLOAT64 = 267, + SCAN_GRID = 268, + SCAN_INT16 = 269, + SCAN_INT32 = 270, + SCAN_MAPS = 271, + SCAN_MESSAGE = 272, + SCAN_SEQUENCE = 273, + SCAN_STRING = 274, + SCAN_STRUCTURE = 275, + SCAN_UINT16 = 276, + SCAN_UINT32 = 277, + SCAN_URL = 278, + SCAN_PTYPE = 279, + SCAN_PROG = 280, + WORD_WORD = 281, + WORD_STRING = 282 + }; #endif - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + +int dapparse (DAPparsestate* parsestate); + +#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */ + /* Copy the second part of user declarations. */ - -/* Line 343 of yacc.c */ -#line 156 "dap.tab.c" +#line 157 "dap.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -166,11 +167,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -190,8 +188,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -205,38 +202,67 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -255,9 +281,9 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -267,8 +293,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -284,7 +310,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -292,15 +318,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -310,7 +334,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -335,35 +359,35 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -379,17 +403,19 @@ union yyalloc #define YYNNTS 34 /* YYNRULES -- Number of rules. */ #define YYNRULES 106 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 201 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 282 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -424,62 +450,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 6, 10, 13, 16, 18, 20, 22, - 24, 30, 31, 34, 39, 47, 54, 66, 68, 70, - 72, 74, 76, 78, 80, 82, 84, 86, 87, 90, - 94, 99, 105, 107, 109, 111, 113, 117, 119, 120, - 123, 126, 131, 136, 141, 146, 151, 156, 161, 166, - 171, 176, 178, 180, 184, 186, 190, 192, 196, 198, - 202, 204, 208, 210, 214, 216, 220, 222, 226, 228, - 232, 234, 236, 238, 242, 250, 251, 256, 257, 262, - 263, 268, 269, 274, 276, 278, 280, 282, 284, 286, - 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, - 308, 310, 312, 314, 316, 318, 320 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 37, 0, -1, 38, 41, -1, 38, 41, 9, -1, - 39, 49, -1, 40, 64, -1, 1, -1, 8, -1, - 5, -1, 10, -1, 28, 42, 29, 47, 30, -1, - -1, 42, 43, -1, 44, 48, 45, 30, -1, 20, - 28, 42, 29, 48, 45, 30, -1, 18, 28, 42, - 29, 48, 30, -1, 13, 28, 4, 31, 43, 16, - 31, 42, 29, 48, 30, -1, 1, -1, 6, -1, - 14, -1, 21, -1, 15, -1, 22, -1, 11, -1, - 12, -1, 23, -1, 19, -1, -1, 45, 46, -1, - 32, 26, 33, -1, 32, 34, 26, 33, -1, 32, - 69, 34, 26, 33, -1, 1, -1, 48, -1, 1, - -1, 69, -1, 28, 50, 29, -1, 1, -1, -1, - 50, 51, -1, 63, 30, -1, 6, 69, 52, 30, - -1, 14, 69, 53, 30, -1, 21, 69, 54, 30, - -1, 15, 69, 55, 30, -1, 22, 69, 56, 30, - -1, 11, 69, 57, 30, -1, 12, 69, 58, 30, - -1, 19, 69, 59, 30, -1, 23, 69, 60, 30, - -1, 69, 28, 50, 29, -1, 1, -1, 26, -1, - 52, 35, 26, -1, 26, -1, 53, 35, 26, -1, - 26, -1, 54, 35, 26, -1, 26, -1, 55, 35, - 26, -1, 26, -1, 56, 35, 26, -1, 26, -1, - 57, 35, 26, -1, 26, -1, 58, 35, 26, -1, - 62, -1, 59, 35, 62, -1, 61, -1, 60, 35, - 61, -1, 62, -1, 69, -1, 27, -1, 3, 26, - 26, -1, 28, 65, 66, 67, 68, 29, 30, -1, - -1, 7, 34, 26, 30, -1, -1, 17, 34, 26, - 30, -1, -1, 24, 34, 26, 30, -1, -1, 25, - 34, 26, 30, -1, 26, -1, 3, -1, 4, -1, - 5, -1, 6, -1, 8, -1, 9, -1, 10, -1, - 11, -1, 12, -1, 13, -1, 14, -1, 15, -1, - 16, -1, 18, -1, 19, -1, 20, -1, 21, -1, - 22, -1, 23, -1, 7, -1, 17, -1, 25, -1, - 24, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 54, 54, 55, 56, 57, 58, 62, 66, 70, @@ -496,7 +467,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -512,13 +483,13 @@ static const char *const yytname[] = "array_decl", "datasetname", "var_name", "attributebody", "attr_list", "attribute", "bytes", "int16", "uint16", "int32", "uint32", "float32", "float64", "strs", "urls", "url", "str_or_id", "alias", "errorbody", - "errorcode", "errormsg", "errorptype", "errorprog", "name", 0 + "errorcode", "errormsg", "errorptype", "errorprog", "name", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -528,41 +499,46 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +#define YYPACT_NINF -91 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-91))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = { - 0, 36, 37, 37, 37, 37, 37, 38, 39, 40, - 41, 42, 42, 43, 43, 43, 43, 43, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 45, 45, 46, - 46, 46, 46, 47, 47, 48, 49, 49, 50, 50, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, - 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, - 61, 62, 62, 63, 64, 65, 65, 66, 66, 67, - 67, 68, 68, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69 + 6, -91, -91, -91, -91, 9, -22, 7, -16, -91, + -91, 10, -91, -91, -91, 20, -91, 37, -91, 191, + -6, 14, -91, -91, -91, -91, 17, -91, -91, 18, + -91, 19, -91, -91, -91, 271, -91, 320, -91, 27, + -91, -91, 320, -91, -91, -91, -91, 320, 320, -91, + 320, 320, -91, -91, -91, 320, -91, 320, 320, 320, + -91, -91, -91, -91, -91, 24, 43, 35, 39, 50, + 74, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, 55, -91, -91, -91, 60, 67, + 68, 70, 71, 73, 295, 77, 78, 295, -91, -91, + 65, 79, 66, 80, 76, 69, 127, -91, 4, -91, + -91, -20, -91, -13, -91, -12, -91, -10, -91, -9, + -91, 32, -91, -91, -91, 33, -91, 34, 42, -91, + -91, 218, -91, 81, 82, 75, 83, 346, 320, 320, + -91, -91, 159, -91, -91, 84, -91, 88, -91, 89, + -91, 90, -91, 91, -91, 295, -91, 92, -91, 93, + -91, 295, -91, -91, 95, 94, 96, 105, 97, -91, + 98, 103, 100, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, 102, -91, 99, -91, 12, -91, 111, + 109, -91, -91, -91, -91, 118, 244, -91, 320, 106, + -91 }; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 2, 3, 2, 2, 1, 1, 1, 1, - 5, 0, 2, 4, 7, 6, 11, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 2, 3, - 4, 5, 1, 1, 1, 1, 3, 1, 0, 2, - 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 1, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 1, 1, 3, 7, 0, 4, 0, 4, 0, - 4, 0, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 6, 8, 7, 9, 0, 0, 0, 0, 1, @@ -588,44 +564,7 @@ static const yytype_uint8 yydefact[] = 16 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 5, 6, 7, 8, 11, 17, 36, 37, 108, - 143, 84, 85, 14, 19, 64, 111, 117, 125, 119, - 127, 113, 115, 121, 128, 129, 130, 65, 16, 21, - 69, 103, 136, 86 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -91 -static const yytype_int16 yypact[] = -{ - 6, -91, -91, -91, -91, 9, -22, 7, -16, -91, - -91, 10, -91, -91, -91, 20, -91, 37, -91, 191, - -6, 14, -91, -91, -91, -91, 17, -91, -91, 18, - -91, 19, -91, -91, -91, 271, -91, 320, -91, 27, - -91, -91, 320, -91, -91, -91, -91, 320, 320, -91, - 320, 320, -91, -91, -91, 320, -91, 320, 320, 320, - -91, -91, -91, -91, -91, 24, 43, 35, 39, 50, - 74, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, 55, -91, -91, -91, 60, 67, - 68, 70, 71, 73, 295, 77, 78, 295, -91, -91, - 65, 79, 66, 81, 76, 69, 127, -91, 4, -91, - -91, -20, -91, -13, -91, -12, -91, -10, -91, -9, - -91, 32, -91, -91, -91, 33, -91, 34, 42, -91, - -91, 218, -91, 80, 82, 75, 83, 346, 320, 320, - -91, -91, 159, -91, -91, 85, -91, 88, -91, 89, - -91, 90, -91, 91, -91, 295, -91, 92, -91, 93, - -91, 295, -91, -91, 95, 94, 96, 105, 97, -91, - 98, 103, 100, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, 102, -91, 99, -91, 12, -91, 111, - 109, -91, -91, -91, -91, 118, 244, -91, 320, 106, - -91 -}; - -/* YYPGOTO[NTERM-NUM]. */ + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -91, -91, -91, -91, -91, -91, -69, -15, -91, -17, @@ -634,10 +573,18 @@ static const yytype_int8 yypgoto[] = -91, -91, -91, -18 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 5, 6, 7, 8, 11, 17, 36, 37, 108, + 143, 84, 85, 14, 19, 64, 111, 117, 125, 119, + 127, 113, 115, 121, 128, 129, 130, 65, 16, 21, + 69, 103, 136, 86 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 87, 66, 105, 106, 122, 140, 10, 1, 12, 9, @@ -650,8 +597,8 @@ static const yytype_uint8 yytable[] = 22, 99, 160, 101, 102, 23, 123, 161, 104, 123, 24, 25, 26, 27, 28, 107, 109, 29, 30, 31, 32, 33, 34, 110, 112, 132, 114, 116, 138, 118, - 134, 168, 169, 124, 126, 133, 135, 137, 164, 165, - 163, 173, 166, 66, 174, 175, 176, 177, 179, 180, + 134, 168, 169, 124, 126, 135, 133, 137, 164, 165, + 173, 163, 166, 66, 174, 175, 176, 177, 179, 180, 183, 185, 167, 196, 172, 182, 184, 186, 22, 189, 192, 188, 191, 23, 190, 195, 200, 123, 24, 25, 26, 27, 28, 123, 194, 29, 30, 31, 32, 33, @@ -679,12 +626,6 @@ static const yytype_uint8 yytable[] = 27, 28, 0, 0, 29, 30, 31, 32, 33, 34 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-91)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int16 yycheck[] = { 37, 19, 71, 72, 94, 1, 28, 1, 1, 0, @@ -697,8 +638,8 @@ static const yytype_int16 yycheck[] = 1, 28, 30, 34, 24, 6, 94, 35, 4, 97, 11, 12, 13, 14, 15, 30, 26, 18, 19, 20, 21, 22, 23, 26, 26, 30, 26, 26, 29, 26, - 34, 138, 139, 26, 26, 26, 25, 31, 26, 34, - 30, 26, 29, 131, 26, 26, 26, 26, 26, 26, + 34, 138, 139, 26, 26, 25, 27, 31, 26, 34, + 26, 30, 29, 131, 26, 26, 26, 26, 26, 26, 26, 16, 137, 192, 142, 30, 30, 30, 1, 26, 31, 33, 30, 6, 34, 26, 30, 155, 11, 12, 13, 14, 15, 161, 33, 18, 19, 20, 21, 22, @@ -726,8 +667,8 @@ static const yytype_int16 yycheck[] = 14, 15, -1, -1, 18, 19, 20, 21, 22, 23 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 1, 5, 8, 10, 37, 38, 39, 40, 0, @@ -743,7 +684,7 @@ static const yytype_uint8 yystos[] = 26, 34, 24, 67, 4, 42, 42, 30, 45, 26, 26, 52, 26, 57, 26, 58, 26, 53, 26, 55, 27, 59, 62, 69, 26, 54, 26, 56, 60, 61, - 62, 50, 30, 26, 34, 25, 68, 31, 29, 29, + 62, 50, 30, 27, 34, 25, 68, 31, 29, 29, 1, 30, 32, 46, 30, 35, 30, 35, 30, 35, 30, 35, 30, 35, 30, 35, 30, 35, 30, 35, 30, 35, 29, 30, 26, 34, 29, 43, 48, 48, @@ -753,94 +694,73 @@ static const yytype_uint8 yystos[] = 30 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 36, 37, 37, 37, 37, 37, 38, 39, 40, + 41, 42, 42, 43, 43, 43, 43, 43, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 45, 45, 46, + 46, 46, 46, 47, 47, 48, 49, 49, 50, 50, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, + 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, + 61, 62, 62, 63, 64, 65, 65, 66, 66, 67, + 67, 68, 68, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 2, 3, 2, 2, 1, 1, 1, 1, + 5, 0, 2, 4, 7, 6, 11, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 2, 3, + 4, 5, 1, 1, 1, 1, 3, 1, 0, 2, + 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 1, 1, 3, 7, 0, 4, 0, 4, 0, + 4, 0, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (parsestate, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* This macro is provided for backward compatibility. */ - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, parsestate) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -850,56 +770,47 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, parsestate); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, parsestate); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - DAPparsestate* parsestate; -#endif { + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (parsestate); if (!yyvaluep) return; - YYUSE (parsestate); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -907,23 +818,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, parsestate) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - DAPparsestate* parsestate; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate); YYFPRINTF (yyoutput, ")"); @@ -934,16 +833,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, parsestate) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -954,50 +845,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule, DAPparsestate* parsestate) -#else -static void -yy_reduce_print (yyvsp, yyrule, parsestate) - YYSTYPE *yyvsp; - int yyrule; - DAPparsestate* parsestate; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, DAPparsestate* parsestate) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , parsestate); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , parsestate); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule, parsestate); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, parsestate); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1011,7 +894,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1034,15 +917,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1058,16 +934,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1097,27 +965,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1140,12 +1008,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + 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 @@ -1153,10 +1020,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1205,11 +1068,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1229,10 +1094,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1269,83 +1136,39 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, DAPparsestate* parsestate) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, parsestate) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - DAPparsestate* parsestate; -#endif { YYUSE (yyvaluep); YYUSE (parsestate); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (DAPparsestate* parsestate); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (DAPparsestate* parsestate) -#else -int -yyparse (parsestate) - DAPparsestate* parsestate; -#endif -#endif { /* The lookahead symbol. */ int yychar; + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1355,10 +1178,10 @@ YYSTYPE yylval; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1376,7 +1199,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1394,9 +1217,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1405,14 +1227,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1433,23 +1247,23 @@ YYSTYPE yylval; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1457,22 +1271,22 @@ YYSTYPE yylval; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1481,10 +1295,10 @@ YYSTYPE yylval; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1513,7 +1327,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, parsestate); } if (yychar <= YYEOF) @@ -1553,7 +1367,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1576,7 +1392,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1590,716 +1406,613 @@ yyreduce: switch (yyn) { case 6: - -/* Line 1806 of yacc.c */ -#line 58 "dap.y" +#line 58 "dap.y" /* yacc.c:1646 */ {dap_unrecognizedresponse(parsestate); YYABORT;} +#line 1412 "dap.tab.c" /* yacc.c:1646 */ break; case 7: - -/* Line 1806 of yacc.c */ -#line 63 "dap.y" +#line 63 "dap.y" /* yacc.c:1646 */ {dap_tagparse(parsestate,SCAN_DATASET);} +#line 1418 "dap.tab.c" /* yacc.c:1646 */ break; case 8: - -/* Line 1806 of yacc.c */ -#line 67 "dap.y" +#line 67 "dap.y" /* yacc.c:1646 */ {dap_tagparse(parsestate,SCAN_ATTR);} +#line 1424 "dap.tab.c" /* yacc.c:1646 */ break; case 9: - -/* Line 1806 of yacc.c */ -#line 71 "dap.y" +#line 71 "dap.y" /* yacc.c:1646 */ {dap_tagparse(parsestate,SCAN_ERROR);} +#line 1430 "dap.tab.c" /* yacc.c:1646 */ break; case 10: - -/* Line 1806 of yacc.c */ -#line 76 "dap.y" - {dap_datasetbody(parsestate,(yyvsp[(4) - (5)]),(yyvsp[(2) - (5)]));} +#line 76 "dap.y" /* yacc.c:1646 */ + {dap_datasetbody(parsestate,(yyvsp[-1]),(yyvsp[-3]));} +#line 1436 "dap.tab.c" /* yacc.c:1646 */ break; case 11: - -/* Line 1806 of yacc.c */ -#line 81 "dap.y" +#line 81 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_declarations(parsestate,null,null);} +#line 1442 "dap.tab.c" /* yacc.c:1646 */ break; case 12: - -/* Line 1806 of yacc.c */ -#line 82 "dap.y" - {(yyval)=dap_declarations(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));} +#line 82 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_declarations(parsestate,(yyvsp[-1]),(yyvsp[0]));} +#line 1448 "dap.tab.c" /* yacc.c:1646 */ break; case 13: - -/* Line 1806 of yacc.c */ -#line 89 "dap.y" - {(yyval)=dap_makebase(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(1) - (4)]),(yyvsp[(3) - (4)]));} +#line 89 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_makebase(parsestate,(yyvsp[-2]),(yyvsp[-3]),(yyvsp[-1]));} +#line 1454 "dap.tab.c" /* yacc.c:1646 */ break; case 14: - -/* Line 1806 of yacc.c */ -#line 91 "dap.y" - {if(((yyval)=dap_makestructure(parsestate,(yyvsp[(5) - (7)]),(yyvsp[(6) - (7)]),(yyvsp[(3) - (7)])))==null) {YYABORT;}} +#line 91 "dap.y" /* yacc.c:1646 */ + {if(((yyval)=dap_makestructure(parsestate,(yyvsp[-2]),(yyvsp[-1]),(yyvsp[-4])))==null) {YYABORT;}} +#line 1460 "dap.tab.c" /* yacc.c:1646 */ break; case 15: - -/* Line 1806 of yacc.c */ -#line 93 "dap.y" - {if(((yyval)=dap_makesequence(parsestate,(yyvsp[(5) - (6)]),(yyvsp[(3) - (6)])))==null) {YYABORT;}} +#line 93 "dap.y" /* yacc.c:1646 */ + {if(((yyval)=dap_makesequence(parsestate,(yyvsp[-1]),(yyvsp[-3])))==null) {YYABORT;}} +#line 1466 "dap.tab.c" /* yacc.c:1646 */ break; case 16: - -/* Line 1806 of yacc.c */ -#line 96 "dap.y" - {if(((yyval)=dap_makegrid(parsestate,(yyvsp[(10) - (11)]),(yyvsp[(5) - (11)]),(yyvsp[(8) - (11)])))==null) {YYABORT;}} +#line 96 "dap.y" /* yacc.c:1646 */ + {if(((yyval)=dap_makegrid(parsestate,(yyvsp[-1]),(yyvsp[-6]),(yyvsp[-3])))==null) {YYABORT;}} +#line 1472 "dap.tab.c" /* yacc.c:1646 */ break; case 17: - -/* Line 1806 of yacc.c */ -#line 98 "dap.y" +#line 98 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EBADTYPE,"Unrecognized type"); YYABORT;} +#line 1478 "dap.tab.c" /* yacc.c:1646 */ break; case 18: - -/* Line 1806 of yacc.c */ -#line 103 "dap.y" +#line 103 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_BYTE;} +#line 1484 "dap.tab.c" /* yacc.c:1646 */ break; case 19: - -/* Line 1806 of yacc.c */ -#line 104 "dap.y" +#line 104 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_INT16;} +#line 1490 "dap.tab.c" /* yacc.c:1646 */ break; case 20: - -/* Line 1806 of yacc.c */ -#line 105 "dap.y" +#line 105 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_UINT16;} +#line 1496 "dap.tab.c" /* yacc.c:1646 */ break; case 21: - -/* Line 1806 of yacc.c */ -#line 106 "dap.y" +#line 106 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_INT32;} +#line 1502 "dap.tab.c" /* yacc.c:1646 */ break; case 22: - -/* Line 1806 of yacc.c */ -#line 107 "dap.y" +#line 107 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_UINT32;} +#line 1508 "dap.tab.c" /* yacc.c:1646 */ break; case 23: - -/* Line 1806 of yacc.c */ -#line 108 "dap.y" +#line 108 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_FLOAT32;} +#line 1514 "dap.tab.c" /* yacc.c:1646 */ break; case 24: - -/* Line 1806 of yacc.c */ -#line 109 "dap.y" +#line 109 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_FLOAT64;} +#line 1520 "dap.tab.c" /* yacc.c:1646 */ break; case 25: - -/* Line 1806 of yacc.c */ -#line 110 "dap.y" +#line 110 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_URL;} +#line 1526 "dap.tab.c" /* yacc.c:1646 */ break; case 26: - -/* Line 1806 of yacc.c */ -#line 111 "dap.y" +#line 111 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_STRING;} +#line 1532 "dap.tab.c" /* yacc.c:1646 */ break; case 27: - -/* Line 1806 of yacc.c */ -#line 115 "dap.y" +#line 115 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_arraydecls(parsestate,null,null);} +#line 1538 "dap.tab.c" /* yacc.c:1646 */ break; case 28: - -/* Line 1806 of yacc.c */ -#line 116 "dap.y" - {(yyval)=dap_arraydecls(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));} +#line 116 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_arraydecls(parsestate,(yyvsp[-1]),(yyvsp[0]));} +#line 1544 "dap.tab.c" /* yacc.c:1646 */ break; case 29: - -/* Line 1806 of yacc.c */ -#line 120 "dap.y" - {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[(2) - (3)]));} +#line 120 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));} +#line 1550 "dap.tab.c" /* yacc.c:1646 */ break; case 30: - -/* Line 1806 of yacc.c */ -#line 121 "dap.y" - {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[(3) - (4)]));} +#line 121 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));} +#line 1556 "dap.tab.c" /* yacc.c:1646 */ break; case 31: - -/* Line 1806 of yacc.c */ -#line 122 "dap.y" - {(yyval)=dap_arraydecl(parsestate,(yyvsp[(2) - (5)]),(yyvsp[(4) - (5)]));} +#line 122 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_arraydecl(parsestate,(yyvsp[-3]),(yyvsp[-1]));} +#line 1562 "dap.tab.c" /* yacc.c:1646 */ break; case 32: - -/* Line 1806 of yacc.c */ -#line 124 "dap.y" +#line 124 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDIMSIZE,"Illegal dimension declaration"); YYABORT;} +#line 1568 "dap.tab.c" /* yacc.c:1646 */ break; case 33: - -/* Line 1806 of yacc.c */ -#line 128 "dap.y" - {(yyval)=(yyvsp[(1) - (1)]);} +#line 128 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[0]);} +#line 1574 "dap.tab.c" /* yacc.c:1646 */ break; case 34: - -/* Line 1806 of yacc.c */ -#line 130 "dap.y" +#line 130 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDDS,"Illegal dataset declaration"); YYABORT;} +#line 1580 "dap.tab.c" /* yacc.c:1646 */ break; case 35: - -/* Line 1806 of yacc.c */ -#line 133 "dap.y" - {(yyval)=(yyvsp[(1) - (1)]);} +#line 133 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[0]);} +#line 1586 "dap.tab.c" /* yacc.c:1646 */ break; case 36: - -/* Line 1806 of yacc.c */ -#line 136 "dap.y" - {dap_attributebody(parsestate,(yyvsp[(2) - (3)]));} +#line 136 "dap.y" /* yacc.c:1646 */ + {dap_attributebody(parsestate,(yyvsp[-1]));} +#line 1592 "dap.tab.c" /* yacc.c:1646 */ break; case 37: - -/* Line 1806 of yacc.c */ -#line 138 "dap.y" +#line 138 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDAS,"Illegal DAS body"); YYABORT;} +#line 1598 "dap.tab.c" /* yacc.c:1646 */ break; case 38: - -/* Line 1806 of yacc.c */ -#line 142 "dap.y" +#line 142 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrlist(parsestate,null,null);} +#line 1604 "dap.tab.c" /* yacc.c:1646 */ break; case 39: - -/* Line 1806 of yacc.c */ -#line 143 "dap.y" - {(yyval)=dap_attrlist(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));} +#line 143 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrlist(parsestate,(yyvsp[-1]),(yyvsp[0]));} +#line 1610 "dap.tab.c" /* yacc.c:1646 */ break; case 40: - -/* Line 1806 of yacc.c */ -#line 147 "dap.y" +#line 147 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} +#line 1616 "dap.tab.c" /* yacc.c:1646 */ break; case 41: - -/* Line 1806 of yacc.c */ -#line 149 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_BYTE);} +#line 149 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_BYTE);} +#line 1622 "dap.tab.c" /* yacc.c:1646 */ break; case 42: - -/* Line 1806 of yacc.c */ -#line 151 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_INT16);} +#line 151 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT16);} +#line 1628 "dap.tab.c" /* yacc.c:1646 */ break; case 43: - -/* Line 1806 of yacc.c */ -#line 153 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_UINT16);} +#line 153 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT16);} +#line 1634 "dap.tab.c" /* yacc.c:1646 */ break; case 44: - -/* Line 1806 of yacc.c */ -#line 155 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_INT32);} +#line 155 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT32);} +#line 1640 "dap.tab.c" /* yacc.c:1646 */ break; case 45: - -/* Line 1806 of yacc.c */ -#line 157 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_UINT32);} +#line 157 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT32);} +#line 1646 "dap.tab.c" /* yacc.c:1646 */ break; case 46: - -/* Line 1806 of yacc.c */ -#line 159 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_FLOAT32);} +#line 159 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT32);} +#line 1652 "dap.tab.c" /* yacc.c:1646 */ break; case 47: - -/* Line 1806 of yacc.c */ -#line 161 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_FLOAT64);} +#line 161 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT64);} +#line 1658 "dap.tab.c" /* yacc.c:1646 */ break; case 48: - -/* Line 1806 of yacc.c */ -#line 163 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_STRING);} +#line 163 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_STRING);} +#line 1664 "dap.tab.c" /* yacc.c:1646 */ break; case 49: - -/* Line 1806 of yacc.c */ -#line 165 "dap.y" - {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_URL);} +#line 165 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_URL);} +#line 1670 "dap.tab.c" /* yacc.c:1646 */ break; case 50: - -/* Line 1806 of yacc.c */ -#line 166 "dap.y" - {(yyval)=dap_attrset(parsestate,(yyvsp[(1) - (4)]),(yyvsp[(3) - (4)]));} +#line 166 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrset(parsestate,(yyvsp[-3]),(yyvsp[-1]));} +#line 1676 "dap.tab.c" /* yacc.c:1646 */ break; case 51: - -/* Line 1806 of yacc.c */ -#line 168 "dap.y" +#line 168 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDAS,"Illegal attribute"); YYABORT;} +#line 1682 "dap.tab.c" /* yacc.c:1646 */ break; case 52: - -/* Line 1806 of yacc.c */ -#line 172 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_BYTE);} +#line 172 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_BYTE);} +#line 1688 "dap.tab.c" /* yacc.c:1646 */ break; case 53: - -/* Line 1806 of yacc.c */ -#line 174 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_BYTE);} +#line 174 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_BYTE);} +#line 1694 "dap.tab.c" /* yacc.c:1646 */ break; case 54: - -/* Line 1806 of yacc.c */ -#line 177 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_INT16);} +#line 177 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT16);} +#line 1700 "dap.tab.c" /* yacc.c:1646 */ break; case 55: - -/* Line 1806 of yacc.c */ -#line 179 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_INT16);} +#line 179 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT16);} +#line 1706 "dap.tab.c" /* yacc.c:1646 */ break; case 56: - -/* Line 1806 of yacc.c */ -#line 182 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_UINT16);} +#line 182 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT16);} +#line 1712 "dap.tab.c" /* yacc.c:1646 */ break; case 57: - -/* Line 1806 of yacc.c */ -#line 184 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_UINT16);} +#line 184 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT16);} +#line 1718 "dap.tab.c" /* yacc.c:1646 */ break; case 58: - -/* Line 1806 of yacc.c */ -#line 187 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_INT32);} +#line 187 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT32);} +#line 1724 "dap.tab.c" /* yacc.c:1646 */ break; case 59: - -/* Line 1806 of yacc.c */ -#line 189 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_INT32);} +#line 189 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT32);} +#line 1730 "dap.tab.c" /* yacc.c:1646 */ break; case 60: - -/* Line 1806 of yacc.c */ -#line 192 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_UINT32);} +#line 192 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT32);} +#line 1736 "dap.tab.c" /* yacc.c:1646 */ break; case 61: - -/* Line 1806 of yacc.c */ -#line 193 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_UINT32);} +#line 193 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT32);} +#line 1742 "dap.tab.c" /* yacc.c:1646 */ break; case 62: - -/* Line 1806 of yacc.c */ -#line 196 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_FLOAT32);} +#line 196 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT32);} +#line 1748 "dap.tab.c" /* yacc.c:1646 */ break; case 63: - -/* Line 1806 of yacc.c */ -#line 197 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_FLOAT32);} +#line 197 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT32);} +#line 1754 "dap.tab.c" /* yacc.c:1646 */ break; case 64: - -/* Line 1806 of yacc.c */ -#line 200 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_FLOAT64);} +#line 200 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT64);} +#line 1760 "dap.tab.c" /* yacc.c:1646 */ break; case 65: - -/* Line 1806 of yacc.c */ -#line 201 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_FLOAT64);} +#line 201 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT64);} +#line 1766 "dap.tab.c" /* yacc.c:1646 */ break; case 66: - -/* Line 1806 of yacc.c */ -#line 204 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_STRING);} +#line 204 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_STRING);} +#line 1772 "dap.tab.c" /* yacc.c:1646 */ break; case 67: - -/* Line 1806 of yacc.c */ -#line 205 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_STRING);} +#line 205 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_STRING);} +#line 1778 "dap.tab.c" /* yacc.c:1646 */ break; case 68: - -/* Line 1806 of yacc.c */ -#line 209 "dap.y" - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_URL);} +#line 209 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_URL);} +#line 1784 "dap.tab.c" /* yacc.c:1646 */ break; case 69: - -/* Line 1806 of yacc.c */ -#line 210 "dap.y" - {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_URL);} +#line 210 "dap.y" /* yacc.c:1646 */ + {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_URL);} +#line 1790 "dap.tab.c" /* yacc.c:1646 */ break; case 70: - -/* Line 1806 of yacc.c */ -#line 214 "dap.y" - {(yyval)=(yyvsp[(1) - (1)]);} +#line 214 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[0]);} +#line 1796 "dap.tab.c" /* yacc.c:1646 */ break; case 71: - -/* Line 1806 of yacc.c */ -#line 218 "dap.y" - {(yyval)=(yyvsp[(1) - (1)]);} +#line 218 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[0]);} +#line 1802 "dap.tab.c" /* yacc.c:1646 */ break; case 72: - -/* Line 1806 of yacc.c */ -#line 219 "dap.y" - {(yyval)=(yyvsp[(1) - (1)]);} +#line 219 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[0]);} +#line 1808 "dap.tab.c" /* yacc.c:1646 */ break; case 73: - -/* Line 1806 of yacc.c */ -#line 230 "dap.y" - {(yyval)=(yyvsp[(2) - (3)]); (yyval)=(yyvsp[(3) - (3)]); (yyval)=null;} +#line 230 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[-1]); (yyval)=(yyvsp[0]); (yyval)=null;} +#line 1814 "dap.tab.c" /* yacc.c:1646 */ break; case 74: - -/* Line 1806 of yacc.c */ -#line 235 "dap.y" - {dap_errorbody(parsestate,(yyvsp[(2) - (7)]),(yyvsp[(3) - (7)]),(yyvsp[(4) - (7)]),(yyvsp[(5) - (7)]));} +#line 235 "dap.y" /* yacc.c:1646 */ + {dap_errorbody(parsestate,(yyvsp[-5]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[-2]));} +#line 1820 "dap.tab.c" /* yacc.c:1646 */ break; case 75: - -/* Line 1806 of yacc.c */ -#line 238 "dap.y" +#line 238 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} +#line 1826 "dap.tab.c" /* yacc.c:1646 */ break; case 76: - -/* Line 1806 of yacc.c */ -#line 238 "dap.y" - {(yyval)=(yyvsp[(3) - (4)]);} +#line 238 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[-1]);} +#line 1832 "dap.tab.c" /* yacc.c:1646 */ break; case 77: - -/* Line 1806 of yacc.c */ -#line 239 "dap.y" +#line 239 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} +#line 1838 "dap.tab.c" /* yacc.c:1646 */ break; case 78: - -/* Line 1806 of yacc.c */ -#line 239 "dap.y" - {(yyval)=(yyvsp[(3) - (4)]);} +#line 239 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[-1]);} +#line 1844 "dap.tab.c" /* yacc.c:1646 */ break; case 79: - -/* Line 1806 of yacc.c */ -#line 240 "dap.y" +#line 240 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} +#line 1850 "dap.tab.c" /* yacc.c:1646 */ break; case 80: - -/* Line 1806 of yacc.c */ -#line 240 "dap.y" - {(yyval)=(yyvsp[(3) - (4)]);} +#line 240 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[-1]);} +#line 1856 "dap.tab.c" /* yacc.c:1646 */ break; case 81: - -/* Line 1806 of yacc.c */ -#line 241 "dap.y" +#line 241 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} +#line 1862 "dap.tab.c" /* yacc.c:1646 */ break; case 82: - -/* Line 1806 of yacc.c */ -#line 241 "dap.y" - {(yyval)=(yyvsp[(3) - (4)]);} +#line 241 "dap.y" /* yacc.c:1646 */ + {(yyval)=(yyvsp[-1]);} +#line 1868 "dap.tab.c" /* yacc.c:1646 */ break; case 83: - -/* Line 1806 of yacc.c */ -#line 247 "dap.y" - {(yyval)=dapdecode(parsestate->lexstate,(yyvsp[(1) - (1)]));} +#line 247 "dap.y" /* yacc.c:1646 */ + {(yyval)=dapdecode(parsestate->lexstate,(yyvsp[0]));} +#line 1874 "dap.tab.c" /* yacc.c:1646 */ break; case 84: - -/* Line 1806 of yacc.c */ -#line 248 "dap.y" +#line 248 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("alias");} +#line 1880 "dap.tab.c" /* yacc.c:1646 */ break; case 85: - -/* Line 1806 of yacc.c */ -#line 249 "dap.y" +#line 249 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("array");} +#line 1886 "dap.tab.c" /* yacc.c:1646 */ break; case 86: - -/* Line 1806 of yacc.c */ -#line 250 "dap.y" +#line 250 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("attributes");} +#line 1892 "dap.tab.c" /* yacc.c:1646 */ break; case 87: - -/* Line 1806 of yacc.c */ -#line 251 "dap.y" +#line 251 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("byte");} +#line 1898 "dap.tab.c" /* yacc.c:1646 */ break; case 88: - -/* Line 1806 of yacc.c */ -#line 252 "dap.y" +#line 252 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("dataset");} +#line 1904 "dap.tab.c" /* yacc.c:1646 */ break; case 89: - -/* Line 1806 of yacc.c */ -#line 253 "dap.y" +#line 253 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("data");} +#line 1910 "dap.tab.c" /* yacc.c:1646 */ break; case 90: - -/* Line 1806 of yacc.c */ -#line 254 "dap.y" +#line 254 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("error");} +#line 1916 "dap.tab.c" /* yacc.c:1646 */ break; case 91: - -/* Line 1806 of yacc.c */ -#line 255 "dap.y" +#line 255 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("float32");} +#line 1922 "dap.tab.c" /* yacc.c:1646 */ break; case 92: - -/* Line 1806 of yacc.c */ -#line 256 "dap.y" +#line 256 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("float64");} +#line 1928 "dap.tab.c" /* yacc.c:1646 */ break; case 93: - -/* Line 1806 of yacc.c */ -#line 257 "dap.y" +#line 257 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("grid");} +#line 1934 "dap.tab.c" /* yacc.c:1646 */ break; case 94: - -/* Line 1806 of yacc.c */ -#line 258 "dap.y" +#line 258 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("int16");} +#line 1940 "dap.tab.c" /* yacc.c:1646 */ break; case 95: - -/* Line 1806 of yacc.c */ -#line 259 "dap.y" +#line 259 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("int32");} +#line 1946 "dap.tab.c" /* yacc.c:1646 */ break; case 96: - -/* Line 1806 of yacc.c */ -#line 260 "dap.y" +#line 260 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("maps");} +#line 1952 "dap.tab.c" /* yacc.c:1646 */ break; case 97: - -/* Line 1806 of yacc.c */ -#line 261 "dap.y" +#line 261 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("sequence");} +#line 1958 "dap.tab.c" /* yacc.c:1646 */ break; case 98: - -/* Line 1806 of yacc.c */ -#line 262 "dap.y" +#line 262 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("string");} +#line 1964 "dap.tab.c" /* yacc.c:1646 */ break; case 99: - -/* Line 1806 of yacc.c */ -#line 263 "dap.y" +#line 263 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("structure");} +#line 1970 "dap.tab.c" /* yacc.c:1646 */ break; case 100: - -/* Line 1806 of yacc.c */ -#line 264 "dap.y" +#line 264 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("uint16");} +#line 1976 "dap.tab.c" /* yacc.c:1646 */ break; case 101: - -/* Line 1806 of yacc.c */ -#line 265 "dap.y" +#line 265 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("uint32");} +#line 1982 "dap.tab.c" /* yacc.c:1646 */ break; case 102: - -/* Line 1806 of yacc.c */ -#line 266 "dap.y" +#line 266 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("url");} +#line 1988 "dap.tab.c" /* yacc.c:1646 */ break; case 103: - -/* Line 1806 of yacc.c */ -#line 267 "dap.y" +#line 267 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("code");} +#line 1994 "dap.tab.c" /* yacc.c:1646 */ break; case 104: - -/* Line 1806 of yacc.c */ -#line 268 "dap.y" +#line 268 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("message");} +#line 2000 "dap.tab.c" /* yacc.c:1646 */ break; case 105: - -/* Line 1806 of yacc.c */ -#line 269 "dap.y" +#line 269 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("program");} +#line 2006 "dap.tab.c" /* yacc.c:1646 */ break; case 106: - -/* Line 1806 of yacc.c */ -#line 270 "dap.y" +#line 270 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("program_type");} +#line 2012 "dap.tab.c" /* yacc.c:1646 */ break; - -/* Line 1806 of yacc.c */ -#line 2303 "dap.tab.c" +#line 2016 "dap.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2321,7 +2034,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2336,9 +2049,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -2389,20 +2102,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, parsestate); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, parsestate); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -2421,7 +2134,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2434,35 +2147,37 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp, parsestate); + yystos[yystate], yyvsp, parsestate); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2486,7 +2201,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2505,14 +2220,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, parsestate); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, parsestate); + yystos[*yyssp], yyvsp, parsestate); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2523,13 +2238,7 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - - -/* Line 2067 of yacc.c */ -#line 273 "dap.y" - +#line 273 "dap.y" /* yacc.c:1906 */ diff --git a/oc2/dapy.h b/oc2/dapy.h index e085df562..d11cfc987 100644 --- a/oc2/dapy.h +++ b/oc2/dapy.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,54 +26,62 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - SCAN_ALIAS = 258, - SCAN_ARRAY = 259, - SCAN_ATTR = 260, - SCAN_BYTE = 261, - SCAN_CODE = 262, - SCAN_DATASET = 263, - SCAN_DATA = 264, - SCAN_ERROR = 265, - SCAN_FLOAT32 = 266, - SCAN_FLOAT64 = 267, - SCAN_GRID = 268, - SCAN_INT16 = 269, - SCAN_INT32 = 270, - SCAN_MAPS = 271, - SCAN_MESSAGE = 272, - SCAN_SEQUENCE = 273, - SCAN_STRING = 274, - SCAN_STRUCTURE = 275, - SCAN_UINT16 = 276, - SCAN_UINT32 = 277, - SCAN_URL = 278, - SCAN_PTYPE = 279, - SCAN_PROG = 280, - WORD_WORD = 281, - WORD_STRING = 282 - }; +#ifndef YY_DAP_DAP_TAB_H_INCLUDED +# define YY_DAP_DAP_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int dapdebug; #endif +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + SCAN_ALIAS = 258, + SCAN_ARRAY = 259, + SCAN_ATTR = 260, + SCAN_BYTE = 261, + SCAN_CODE = 262, + SCAN_DATASET = 263, + SCAN_DATA = 264, + SCAN_ERROR = 265, + SCAN_FLOAT32 = 266, + SCAN_FLOAT64 = 267, + SCAN_GRID = 268, + SCAN_INT16 = 269, + SCAN_INT32 = 270, + SCAN_MAPS = 271, + SCAN_MESSAGE = 272, + SCAN_SEQUENCE = 273, + SCAN_STRING = 274, + SCAN_STRUCTURE = 275, + SCAN_UINT16 = 276, + SCAN_UINT32 = 277, + SCAN_URL = 278, + SCAN_PTYPE = 279, + SCAN_PROG = 280, + WORD_WORD = 281, + WORD_STRING = 282 + }; +#endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +int dapparse (DAPparsestate* parsestate); +#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */ From b477a9c1b3f1b4857083ec3d923afaa45ad4d300 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 6 Sep 2016 12:41:48 -0600 Subject: [PATCH 40/46] Corrected a typo resulting in a cmake warning. --- ncdap_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncdap_test/CMakeLists.txt b/ncdap_test/CMakeLists.txt index c25b966f7..333bf31f8 100644 --- a/ncdap_test/CMakeLists.txt +++ b/ncdap_test/CMakeLists.txt @@ -46,7 +46,7 @@ IF(ENABLE_TESTS) IF(BUILD_UTILITIES) add_sh_test(ncdap tst_remote3) add_sh_test(ncdap tst_formatx) - ENDIF(BUILD_UTILTIES) + ENDIF(BUILD_UTILITIES) add_bin_test(ncdap test_partvar) IF(ENABLE_DAP_LONG_TESTS) add_sh_test(ncdap tst_longremote3) From 5132ffa80fdad9d2d1a00fafce168cd374ef952d Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 13 Sep 2016 11:21:42 -0600 Subject: [PATCH 41/46] Corrected dead links. --- docs/FAQ.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index 69515792a..9f94508c2 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -322,7 +322,7 @@ We test releases on the following operating systems with various compilers: - Solaris - Windows (some versions, see below) -The [NetCDF Installation and Porting Guide](http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/index.html) explains how to build netCDF from source on various platforms. Often, it's as easy as running +The [NetCDF Installation and Porting Guide](@ref getting_and_building_netcdf) explains how to build netCDF from source on various platforms. Often, it's as easy as running ~~~~ {.boldcode} ./configure @@ -483,7 +483,7 @@ How do I build and install netCDF for a specific development environment? {#How- You have to build and install the netCDF C library first, before you build and install other language libraries that depend on it, such as Fortran, C++, or Python netCDF libraries. The netCDF Java library is mostly independent of the netCDF C library, unless you need to write netCDF-4 files from Java, in which case you will also need an installed netCDF C library. For more details, see -[Getting and Building netCDF](http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html). +[NetCDF Installation and Porting Guide](@ref getting_and_building_netcdf). ---------- From 4e46a31088c5442be2d81c23adcb8c2facdf3882 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 13 Sep 2016 13:55:33 -0600 Subject: [PATCH 42/46] Corrected an issue reported in https://github.com/Unidata/netcdf-c/issues/317 --- RELEASE_NOTES.md | 1 + libdispatch/dfile.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index ccfaa5455..45e18303a 100755 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -9,6 +9,7 @@ This file contains a high-level description of this package's evolution. Release ## 4.4.2 - TBD +* [Bug] Fixed an issue with `nc_inq_type()` not returning proper value in some circumstances. See [GitHub #317](https://github.com/Unidata/netcdf-c/issues/317) for more information. * [Bug] Corrected an issue related to test failures when `--disable-utilities` or `-DENABLE_UTILITIES=OFF` are specified when building with autotools or cmake, respectively. See [GitHub #313](https://github.com/Unidata/netcdf-c/issues/313) for more information. * [Bug][Enhancement] Corrected a behavioral issue with the `_NCProperties` attribute taking up too much space. See [GitHub #300](https://github.com/Unidata/netcdf-c/issues/300) and [GitHub #301](https://github.com/Unidata/netcdf-c/pull/301) for more information. diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c index 5e1778715..1b5566e0f 100644 --- a/libdispatch/dfile.c +++ b/libdispatch/dfile.c @@ -1587,7 +1587,7 @@ nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size) if(stat != NC_NOERR) { /* bad ncid; do what we can */ /* For compatibility, we need to allow inq about atomic types, even if ncid is ill-defined */ - if(xtype <= ATOMICTYPEMAX5) { + if(xtype <= ATOMICTYPEMAX4) { if(name) strncpy(name,NC_atomictypename(xtype),NC_MAX_NAME); if(size) *size = NC_atomictypelen(xtype); return NC_NOERR; From 485faa03338e07227cdd4b4ea1631aa5321414b9 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 14 Sep 2016 16:11:22 -0600 Subject: [PATCH 43/46] Addressed defect 1372912 in coverity. --- libsrc4/nc4info.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index 0f8b8efdb..fae877926 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -64,27 +64,27 @@ NC4_properties_parse(struct NCPROPINFO* ncprops, const char* text) /* Walk and fill in ncinfo */ p = propdata; while(*p) { - char* name = p; - char* value = NULL; - char* q = strchr(p,'='); - if(q == NULL) + char* name = p; + char* value = NULL; + char* q = strchr(p,'='); + if(q == NULL) {ret = NC_EINVAL; goto done;} - *q++ = '\0'; - value = p = q; - q = strchr(p,NCPROPSSEP); - if(q == NULL) q = (p+strlen(p)); else* q++ = '\0'; - p = q; - if(name != NULL && value != NULL) { + *q++ = '\0'; + value = p = q; + q = strchr(p,NCPROPSSEP); + if(q == NULL) q = (p+strlen(p)); else* q++ = '\0'; + p = q; + if(value != NULL) { if(strcmp(name,NCPVERSION) == 0) { - int v = atoi(value); - if(v < 0) v = 0; - ncprops->version = v; + int v = atoi(value); + if(v < 0) v = 0; + ncprops->version = v; } else if(strcmp(name,NCPNCLIBVERSION) == 0) - strncpy(ncprops->netcdfver,value,sizeof(ncprops->netcdfver)-1); + strncpy(ncprops->netcdfver,value,sizeof(ncprops->netcdfver)-1); else if(strcmp(name,NCPHDF5LIBVERSION) == 0) - strncpy(ncprops->hdf5ver,value,sizeof(ncprops->hdf5ver)-1); + strncpy(ncprops->hdf5ver,value,sizeof(ncprops->hdf5ver)-1); /* else ignore */ - } + } } /* Guarantee null term */ ncprops->netcdfver[sizeof(ncprops->netcdfver)-1] = '\0'; @@ -99,7 +99,7 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5) { int ncstat = NC_NOERR; size_t size; - H5T_class_t t_class; + H5T_class_t t_class; hid_t grp = -1; hid_t attid = -1; hid_t aspace = -1; @@ -131,7 +131,7 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5) /* Try to parse text */ ncstat = NC4_properties_parse(&h5->fileinfo->propattr,text); herr = 0; - } + } done: if(attid >= 0) HCHECK((H5Aclose(attid))); if(aspace >= 0) HCHECK((H5Sclose(aspace))); @@ -145,7 +145,7 @@ int NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) { int ncstat = NC_NOERR; - H5T_class_t t_class; + H5T_class_t t_class; size_t size; hid_t grp = -1; hid_t exists = -1; @@ -200,7 +200,7 @@ NC4_get_fileinfo(NC_HDF5_FILE_INFO_T* h5, struct NCPROPINFO* init) h5->fileinfo->propattr = *init; /* Initialize */ } done: - return ncstat; + return ncstat; } int @@ -212,7 +212,7 @@ NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap) if(info == NULL || info->version == 0) return NC_EINVAL; if(propdatap == NULL) return NC_NOERR; - *propdatap = NULL; + *propdatap = NULL; /* compute attribute length */ total = 0; From ad1220453a9e764eea739bb12c7a0ea18145e686 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 14 Sep 2016 16:16:06 -0600 Subject: [PATCH 44/46] Corrected issue 1372911 in Coverity. --- libsrc4/nc4info.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index fae877926..d951f388c 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -161,20 +161,24 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) char* text = NULL; ncstat = NC4_buildpropinfo(&h5->fileinfo->propattr,&text); if(text == NULL || ncstat != NC_NOERR) { - if(text != NULL) free(text); - goto done; + goto done; } herr = -1; /* Create a datatype to refer to. */ - HCHECK((atype = H5Tcopy(H5T_C_S1))); - HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII))); - HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */ + HCHECK((atype = H5Tcopy(H5T_C_S1))); + HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII))); + HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */ HCHECK((aspace = H5Screate(H5S_SCALAR))); HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT))); - HCHECK((H5Awrite(attid, atype, text))); + HCHECK((H5Awrite(attid, atype, text))); herr = 0; } done: + if(ncstat != NC_NOERR) { + if(text != NULL) { + free(text); + } + if(attid >= 0) HCHECK((H5Aclose(attid))); if(aspace >= 0) HCHECK((H5Sclose(aspace))); if(atype >= 0) HCHECK((H5Tclose(atype))); From 934bb4bd66dbfe4f84fe7a2f3423e120cc242e20 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 14 Sep 2016 16:20:43 -0600 Subject: [PATCH 45/46] Corrected typo. --- libsrc4/nc4info.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index d951f388c..e3bebf086 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -153,31 +153,32 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5) hid_t aspace = -1; hid_t atype = -1; herr_t herr = 0; + char* text = NULL; /* Get root group */ grp = h5->root_grp->hdf_grpid; /* get root group */ /* See if the NCPROPS attribute exists */ if(H5Aexists(grp,NCPROPS) == 0) { /* Does not exist */ - char* text = NULL; - ncstat = NC4_buildpropinfo(&h5->fileinfo->propattr,&text); - if(text == NULL || ncstat != NC_NOERR) { - goto done; - } - herr = -1; - /* Create a datatype to refer to. */ - HCHECK((atype = H5Tcopy(H5T_C_S1))); - HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII))); - HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */ - HCHECK((aspace = H5Screate(H5S_SCALAR))); - HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT))); - HCHECK((H5Awrite(attid, atype, text))); - herr = 0; + ncstat = NC4_buildpropinfo(&h5->fileinfo->propattr,&text); + if(text == NULL || ncstat != NC_NOERR) { + goto done; + } + herr = -1; + /* Create a datatype to refer to. */ + HCHECK((atype = H5Tcopy(H5T_C_S1))); + HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII))); + HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */ + HCHECK((aspace = H5Screate(H5S_SCALAR))); + HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT))); + HCHECK((H5Awrite(attid, atype, text))); + herr = 0; } -done: + done: if(ncstat != NC_NOERR) { if(text != NULL) { free(text); } + } if(attid >= 0) HCHECK((H5Aclose(attid))); if(aspace >= 0) HCHECK((H5Sclose(aspace))); From a08be0a312965b242687184af39fa491ecd7ade1 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 14 Sep 2016 16:26:08 -0600 Subject: [PATCH 46/46] Corrected issue 1372910 in coverity. --- libsrc4/nc4info.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c index e3bebf086..9aa6685b8 100644 --- a/libsrc4/nc4info.c +++ b/libsrc4/nc4info.c @@ -216,7 +216,7 @@ NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap) if(info == NULL || info->version == 0) return NC_EINVAL; if(propdatap == NULL) - return NC_NOERR; + return NC_NOERR; *propdatap = NULL; /* compute attribute length */ @@ -239,12 +239,20 @@ NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap) if(propdata == NULL) return NC_ENOMEM; snprintf(propdata,total+1, - "%s=%d|%s=%s|%s=%s", + "%s=%d|%s=%s|%s=%s", NCPVERSION,info->version, NCPNCLIBVERSION,info->netcdfver, NCPHDF5LIBVERSION,info->hdf5ver); /* Force null termination */ propdata[total] = '\0'; - if(propdatap) {*propdatap = propdata;} else {free(propdata);} + *propdatap = propdata; + + /* propdatap is checked against being NULL above already. */ + //if(propdatap) { + // *propdatap = propdata; + //} else { + // free(propdata); + //} + return NC_NOERR; }