[netcdf] 02/05: Imported Upstream version 4.4.0~rc3
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sat Oct 10 11:42:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository netcdf.
commit d9a5d334b6858a9f7337ebe0f6ae1bd7415cc0f2
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Oct 10 12:59:25 2015 +0200
Imported Upstream version 4.4.0~rc3
---
CMakeLists.txt | 32 +-
Doxyfile.developer | 37 +-
Makefile.am | 6 +-
Makefile.in | 12 +-
README.md | 61 +-
RELEASE_NOTES.md | 9 +
cf | 23 +-
config.h.in | 3 +
configure | 162 +-
configure.ac | 68 +-
docs/CMakeLists.txt | 3 +-
docs/Doxyfile.in | 9 +-
docs/FAQ.md | 26 +-
docs/Makefile.in | 4 +-
docs/credits.md | 4 +-
docs/images/Makefile.in | 4 +-
docs/install.md | 5 +
docs/known_problems.md | 1463 +++++
docs/release.css | 29 +
docs/release_header.html | 93 +
docs/software.md | 129 +-
docs/windows-binaries.md | 26 +-
examples/C/Makefile.in | 4 +-
examples/CDL/Makefile.in | 4 +-
examples/Makefile.in | 4 +-
extra.css | 29 +
h5_test/Makefile.in | 4 +-
include/Makefile.in | 4 +-
include/nc3internal.h | 6 +-
include/ncdispatch.h | 7 +-
include/netcdf.h | 12 +-
libdap2/Makefile.in | 4 +-
libdispatch/Makefile.in | 4 +-
libdispatch/dcopy.c | 150 +-
libdispatch/ddispatch.c | 7 -
libdispatch/dfile.c | 175 +-
liblib/CMakeLists.txt | 2 +-
liblib/Makefile.am | 4 +-
liblib/Makefile.in | 8 +-
liblib/stub.c | 4 +-
libsrc/CMakeLists.txt | 3 +-
libsrc/Makefile.am | 12 +-
libsrc/Makefile.in | 42 +-
libsrc/attr.c | 339 ++
libsrc/memio.c | 69 +-
libsrc/ncio.c | 11 +-
libsrc/ncx.c | 6136 +++++++++++++++++++-
libsrc/ncx.m4 | 57 +-
libsrc/posixio.c | 50 +-
libsrc/putget.c | 543 +-
libsrc/putget.m4 | 93 +-
libsrc/var.c | 48 +-
libsrc/winceio.c | 2 +-
libsrc4/Makefile.in | 4 +-
libsrc4/nc4hdf.c | 8 +-
libsrc4/nc4var.c | 22 +-
libsrc5/CMakeLists.txt | 5 -
libsrcp/CMakeLists.txt | 5 +
{libsrc5 => libsrcp}/Makefile.am | 8 +-
{libsrc5 => libsrcp}/Makefile.in | 42 +-
libsrc5/nc5dispatch.c => libsrcp/ncpdispatch.c | 414 +-
nc_test/CMakeLists.txt | 3 +-
nc_test/Makefile.am | 20 +-
nc_test/Makefile.in | 18 +-
nc_test/test_get.c | 6161 ++++++++++++++++++++
nc_test/test_put.c | 7206 ++++++++++++++++++++++++
nc_test/tst_atts.c | 12 +-
nc_test4/Makefile.in | 4 +-
nc_test4/tst_h4_lendian.c | 11 +-
ncdap_test/Makefile.in | 4 +-
ncdap_test/expected3/Makefile.in | 4 +-
ncdap_test/expected4/Makefile.in | 4 +-
ncdap_test/expectremote3/Makefile.in | 4 +-
ncdap_test/expectremote4/Makefile.in | 4 +-
ncdap_test/t_ncf330.c | 2 +
ncdap_test/testdata3/Makefile.in | 4 +-
ncdump/CMakeLists.txt | 8 +-
ncdump/Makefile.am | 13 +-
ncdump/Makefile.in | 18 +-
ncdump/cdl/Makefile.in | 4 +-
ncdump/expected/Makefile.in | 4 +-
ncdump/nccopy.c | 4 +-
ncdump/ncdump.c | 146 +-
ncdump/ref1.ncml | 2 +
ncdump/ref_ctest.c | 2 +-
ncdump/ref_ctest1_nc4.cdl | 2 +-
ncdump/ref_ctest1_nc4c.cdl | 2 +-
ncdump/ref_ctest64.c | 2 +-
ncdump/ref_tst_utf8_4.cdl | 24 +
ncdump/run_utf8_tests.sh | 14 +
ncdump/tst_ncml.cdl | 2 +
ncdump/tst_output.sh | 2 +-
ncdump/vardata.c | 2 +-
ncgen/Makefile.in | 4 +-
ncgen/c0.cdl | 2 +-
ncgen/c0_4.cdl | 2 +-
ncgen/genbin.c | 38 +-
ncgen/main.c | 2 +-
ncgen/ncgentab.c | 2061 ++++---
ncgen/ncgentab.h | 149 +-
ncgen3/Makefile.in | 4 +-
ncgen3/c0.cdl | 2 +-
ncgen3/main.c | 2 +-
nctest/Makefile.in | 4 +-
oc2/Make0 | 11 +-
oc2/Makefile.in | 4 +-
oc2/occurlfunctions.c | 27 +-
oc2/ocinternal.c | 2 +-
oc2/ocrc.c | 6 +-
109 files changed, 24206 insertions(+), 2379 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa5bebc..f6cc03a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ set(PACKAGE "netCDF" CACHE STRING "")
SET(NC_VERSION_MAJOR 4)
SET(NC_VERSION_MINOR 4)
SET(NC_VERSION_PATCH 0)
-SET(NC_VERSION_NOTE "-rc2")
+SET(NC_VERSION_NOTE "-rc3")
SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
SET(VERSION ${netCDF_VERSION})
SET(NC_VERSION ${netCDF_VERSION})
@@ -678,7 +678,7 @@ ELSE()
ENDIF()
# Enable some developer-only tests
-OPTION(ENABLE_EXTRA_TESTS "Enable Extra tests. Some may not work because of known issues. Developers only." ON)
+OPTION(ENABLE_EXTRA_TESTS "Enable Extra tests. Some may not work because of known issues. Developers only." OFF)
IF(ENABLE_EXTRA_TESTS)
SET(EXTRA_TESTS ON)
ENDIF()
@@ -873,12 +873,21 @@ IF(ENABLE_DOXYGEN)
SET(BUILD_INTERNAL_DOCS NO CACHE STRING "")
ENDIF()
- OPTION(DOXYGEN_ENABLE_SERVER_SIDE_SEARCH "Enable doxygen server-side search. This is of interest to developers only." OFF)
- IF(DOXYGEN_ENABLE_SERVER_SIDE_SEARCH)
- SET(SERVER_SIDE_SEARCH YES CACHE STRING "")
+ ###
+ #
+ # If we are building release documentation, we need to set some
+ # variables that will be used in the Doxygen.in template.
+ ###
+ OPTION(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS "Build release documentation. This is of interest only to the netCDF developers." OFF)
+ IF(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS)
+ SET(DOXYGEN_CSS_FILE "${CMAKE_SOURCE_DIR}/docs/release.css" CACHE STRING "")
+ SET(DOXYGEN_HEADER_FILE "${CMAKE_SOURCE_DIR}/docs/release_header.html" CACHE STRING "")
+ SET(DOXYGEN_SEARCHENGINE "NO" CACHE STRING "")
ELSE()
- SET(SERVER_SIDE_SEARCH NO CACHE STRING "")
- ENDIF()
+ SET(DOXYGEN_CSS_FILE "" CACHE STRING "")
+ SET(DOXYGEN_HEADER_FILE "" CACHE STRING "")
+ SET(DOXYGEN_SEARCHENGINE "YES" CACHE STRING "")
+ ENDIF(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS)
# Option to turn on the TODO list in the doxygen-generated documentation.
OPTION(DOXYGEN_ENABLE_TASKS "Turn on test, todo, bug lists in documentation. This is of interest to developers only." OFF)
IF(DOXYGEN_ENABLE_TASKS)
@@ -920,7 +929,7 @@ ENDIF()
# Set some of the options as advanced.
MARK_AS_ADVANCED(ENABLE_INTERNAL_DOCS VALGRIND_TESTS ENABLE_PNETCDF ENABLE_COVERAGE_TESTS)
MARK_AS_ADVANCED(ENABLE_DAP_REMOTE_TESTS ENABLE_DAP_LONG_TESTS USE_REMOTE_CDASH)
-MARK_AS_ADVANCED(DOXYGEN_ENABLE_SERVER_SIDE_SEARCH DOXYGEN_ENABLE_TASKS)
+MARK_AS_ADVANCED(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS DOXYGEN_ENABLE_TASKS)
################################
# Option checks
################################
@@ -1058,11 +1067,6 @@ FIND_PROGRAM(NC_M4 NAMES m4)
IF(NC_M4)
SET(HAVE_M4 TRUE)
ENDIF()
-#IF(NOT MSVC)
- #IF(NOT NC_M4)
- # MESSAGE(FATAL "Cannot find 'm4' utility. Install m4 and try again.")
- # ENDIF(NOT NC_M4)
-#ENDIF(NOT MSVC)
MACRO(GEN_m4 filename)
# IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
@@ -1339,7 +1343,7 @@ add_subdirectory(libdispatch)
add_subdirectory(libsrc)
IF(USE_PNETCDF)
- add_subdirectory(libsrc5)
+ add_subdirectory(libsrcp)
ENDIF(USE_PNETCDF)
IF(USE_HDF5)
diff --git a/Doxyfile.developer b/Doxyfile.developer
index c403316..127d14c 100755
--- a/Doxyfile.developer
+++ b/Doxyfile.developer
@@ -38,7 +38,7 @@ PROJECT_NAME = netCDF-C
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 4.4.0-rc2
+PROJECT_NUMBER = 4.4.0-rc3
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -1009,25 +1009,6 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
-# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the
-# clang parser (see: http://clang.llvm.org/) for more acurate parsing at the
-# cost of reduced performance. This can be particularly helpful with template
-# rich C++ code for which doxygen's built-in parser lacks the necessary type
-# information.
-# Note: The availability of this option depends on whether or not doxygen was
-# compiled with the --with-libclang option.
-# The default value is: NO.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-CLANG_OPTIONS =
-
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@@ -1129,7 +1110,7 @@ HTML_STYLESHEET =
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = docs/extra.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1850,18 +1831,6 @@ GENERATE_XML = NO
XML_OUTPUT = xml
-# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_DTD =
-
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
@@ -2130,7 +2099,7 @@ DOT_NUM_THREADS = 4
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTNAME = FreeSans.ttf
+DOT_FONTNAME =
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
diff --git a/Makefile.am b/Makefile.am
index 7fc886f..93fb69b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,7 @@ endif
# Build pnetcdf
if USE_PNETCDF
-LIBSRC5 = libsrc5
+LIBSRCP = libsrcp
endif
# Build UDUNITS?
@@ -86,7 +86,7 @@ endif
# and run. ncgen must come before ncdump, because their tests
# depend on it.
SUBDIRS = include $(OCLIB) $(H5_TEST_DIR) libdispatch libsrc \
-$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRC5) liblib \
+$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRCP) liblib \
$(NCGEN3) $(NCGEN) $(NCDUMP) \
$(TESTDIRS) \
docs $(EXAMPLES) \
@@ -176,7 +176,7 @@ install-data-hook:
#endif
if BUILD_DLL
- cp liblib/netcdfdll.def $(DESTDIR)${prefix}/lib
+ cp liblib/netcdfdll.def $(DESTDIR)${prefix}/bin
endif # BUILD_DLL
@echo ''
@echo '+-------------------------------------------------------------+'
diff --git a/Makefile.in b/Makefile.in
index 7d7786d..7ba9d4a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -213,7 +213,7 @@ ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = include oc2 h5_test libdispatch libsrc libsrc4 libdap2 \
- libsrc5 liblib ncgen3 ncgen ncdump nctest nc_test nc_test4 \
+ libsrcp liblib ncgen3 ncgen ncdump nctest nc_test nc_test4 \
ncdap_test docs examples
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libnetcdf.settings.in $(srcdir)/nc-config.in \
@@ -289,6 +289,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -364,7 +367,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
@@ -477,7 +479,7 @@ pkgconfig_DATA = netcdf.pc
#endif # BUILD_UTILITIES
# Build pnetcdf
- at USE_PNETCDF_TRUE@LIBSRC5 = libsrc5
+ at USE_PNETCDF_TRUE@LIBSRCP = libsrcp
# Build UDUNITS?
#if BUILD_UDUNITS
@@ -496,7 +498,7 @@ pkgconfig_DATA = netcdf.pc
# and run. ncgen must come before ncdump, because their tests
# depend on it.
SUBDIRS = include $(OCLIB) $(H5_TEST_DIR) libdispatch libsrc \
-$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRC5) liblib \
+$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRCP) liblib \
$(NCGEN3) $(NCGEN) $(NCDUMP) \
$(TESTDIRS) \
docs $(EXAMPLES) \
@@ -1144,7 +1146,7 @@ install-data-hook:
# sh -c "$(abs_top_builddir)/postinstall.sh -t autotools"
#endif
- at BUILD_DLL_TRUE@ cp liblib/netcdfdll.def $(DESTDIR)${prefix}/lib
+ at BUILD_DLL_TRUE@ cp liblib/netcdfdll.def $(DESTDIR)${prefix}/bin
@echo ''
@echo '+-------------------------------------------------------------+'
@echo '| Congratulations! You have successfully installed netCDF! |'
diff --git a/README.md b/README.md
index 273287b..e588976 100644
--- a/README.md
+++ b/README.md
@@ -34,49 +34,60 @@ formats. For information about a variety of analysis and display
packages that have been developed to analyze and display data in
netCDF form, see
-* http://www.unidata.ucar.edu/netcdf/software.html
+* [Software for Manipulating or Displaying NetCDF Data](http://www.unidata.ucar.edu/netcdf/software.html)
-##### More informations
-For more information about netCDF, see the netCDF Web page at
+##### More information
+For more information about netCDF, see
-* http://www.unidata.ucar.edu/netcdf/
+* [Unidata Network Common Data Form (NetCDF)](http://www.unidata.ucar.edu/netcdf/)
### Latest releases
-You can obtain a copy of the latest released version of netCDF software
-from
+You can obtain a copy of the latest released version of netCDF
+software for various languages:
-* C - http://github.com/Unidata/netcdf-c
-* Fortan - http://github.com/Unidata/netcdf-fortran
-* Libraries and utilities in C - http://github.com/Unidata/netcdf-cxx4
-* Python - http://github.com/Unidata/netcdf4-python
+* [C library and utilities](http://github.com/Unidata/netcdf-c)
+* [Fortran](http://github.com/Unidata/netcdf-fortran)
+* [Java](http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/)
+* [Python](http://github.com/Unidata/netcdf4-python)
+* [C++](http://github.com/Unidata/netcdf-cxx4)
### Copyright
-Copyright and licensing information can be found here, as well as in
-the COPYRIGHT file accompanying the software
+Copyright and licensing information can be found
+[here](http://www.unidata.ucar.edu/software/netcdf/copyright.html), as
+well as in the COPYRIGHT file accompanying the software
-* http://www.unidata.ucar.edu/software/netcdf/copyright.html
+### Installation
+To install the netCDF-C software, please see the file INSTALL in the
+netCDF-C distribution, or the (usually more up-to-date) document:
-### Install
-To install this package, please see the file INSTALL in the
-distribution, or the (usually more up-to-date) document:
+* [Building NetCDF](http://www.unidata.ucar.edu/netcdf/docs/building.html)
-* http://www.unidata.ucar.edu/netcdf/docs/building.html
+### Documentation
+A language-independent User's Guide for netCDF, and some other
+language-specific user-level documents are available from:
-The netCDF-3 C and FORTRAN-77 interfaces are documented in man(1)
-pages at
+* [Language-independent User's Guide](http://www.unidata.ucar.edu/netcdf/docs/user_guide.html)
+* [NetCDF-C Tutorial](http://www.unidata.ucar.edu/software/netcdf/docs/tutorial_8dox.html)
+* [Fortran-90 User's Guide](http://www.unidata.ucar.edu/netcdf/docs/netcdf-f90.html)
+* [Fortran-77 User's Guide](http://www.unidata.ucar.edu/netcdf/docs/netcdf-f77.html)
+* [netCDF-Java/Common Data Model library](http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/)
+* [netCDF4-python](http://unidata.github.io/netcdf4-python/)
-* http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3.html
-* http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3f.html
+Reference documentation for various language interfaces are available from:
-### User's Guides
-User's Guides are also available in several forms from the same
-location.
+* [NetCDF-C](http://www.unidata.ucar.edu/netcdf/docs/modules.html),
+ [C man page](http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3.html)
+* [Fortran-90](http://www.unidata.ucar.edu/netcdf/docs/netcdf-f90.html)
+* [Fortran-77 man page](http://www.unidata.ucar.edu/netcdf/docs/netcdf-man-3f.html)
+* [Java](http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/reference/)
+* [C++](https://www.unidata.ucar.edu/netcdf/docs/cxx4/index.html)
+* [Python](http://unidata.github.io/netcdf4-python/#header-classes)
A mailing list, netcdfgroup at unidata.ucar.edu, exists for discussion of
the netCDF interface and announcements about netCDF bugs, fixes, and
enhancements. For information about how to subscribe, see the URL
-* http://www.unidata.ucar.edu/netcdf/mailing-lists.html
+* [Unidata netCDF Mailing-Lists](http://www.unidata.ucar.edu/netcdf/mailing-lists.html)
### Feedback
We appreciate feedback from users of this package. Please send
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
old mode 100644
new mode 100755
index 1971c28..1e42a7a
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -7,6 +7,15 @@ This file contains a high-level description of this package's evolution. Release
## 4.4.0 Released TBD
+### 4.4.0-RC3 2015-10-08
+
+* Addressed an inefficiency in how bytes would be swapped when converting between `LITTLE` and `BIG` ENDIANNESS. See [NCF-338](https://bugtracking.unidata.ucar.edu/browse/NCF-338) for more information.
+* Addressed an issue where an interrupted read on a `POSIX` system would return an error even if errno had been properly set to `EINTR`. This issue was initially reported by David Knaak at Cray. More information may be found at [NCF-337](https://bugtracking.unidata.ucar.edu/browse/NCF-337).
+* Added a note to the install directions pointing out that parallel make
+cannot be used for 'make check'.
+* Many miscellaneous bug fixes.
+
+
### 4.4.0-RC2 Released 2015-07-09
* Minor bug fixes and cleanup of issues reported with first release candidate.
diff --git a/cf b/cf
index 170d95f..abffb78 100644
--- a/cf
+++ b/cf
@@ -1,7 +1,7 @@
#!/bin/bash
#X="-x"
#NB=1
-#DB=1
+DB=1
if test $# != 0 ; then
cmds=$@
@@ -139,6 +139,20 @@ else
FLAGS="$FLAGS --enable-shared"
fi
+TMP=
+rm -f ./test_mpi.tmp
+if test -f $stddir/lib/libhdf5.a ; then
+ nm $stddir/lib/libhdf5.a | grep mpich_mpi_float$ >./test_mpi.tmp
+else
+ if test -f $stddir/lib/libhdf5.so ; then
+ nm $stddir/lib/libhdf5.so | grep mpich_mpi_float$ >./test_mpi.tmp
+ fi
+fi
+if test -s ./test_mpi.tmp ; then
+ PAR=1
+fi
+rm -f ./test_mpi.tmp
+
if test "x${PAR}" != x ; then
FLAGS="$FLAGS --enable-parallel"
fi
@@ -159,7 +173,7 @@ if test "x$RPC" = "x1" ; then
FLAGS="$FLAGS --enable-rpc"
fi
-if test "x$PNETCDF" = x1 ; then
+if test "x$PAR" = x1 -o "x$PNETCDF" = x1 ; then
if test -f /machine/local_mpich2 ; then
MPI1=/machine/local_mpich2
MPI2=/machine/local_par7
@@ -173,11 +187,13 @@ PATH=${PATH}:${MPI1}/bin
CC="${MPI1}/bin/mpicc"
CPPFLAGS="-I${MPI2}/include -I${MPI1}/include -I${MPI3}/include"
LDFLAGS="-L${MPI2}/lib -L${MPI1}/lib -L${MPI3}/lib"
-LDLIBS="-lmpich -lmpl"
+LDLIBS="-lmpich"
FLAGS="$FLAGS --enable-pnetcdf"
FLAGS="$FLAGS --enable-parallel-tests"
fi
+#FLAGS="${FLAGS} --enable-stdio"
+
export PATH
export CC
export CPPFLAGS
@@ -198,6 +214,7 @@ fi
if test -f Makefile ; then ${MAKE} distclean >/dev/null 2>&1 ; fi
sh $X ./configure ${FLAGS}
for c in $cmds; do
+printenv LD_LIBRARY_PATH
${MAKE} ${FORCE} $c
done
exit 0
diff --git a/config.h.in b/config.h.in
index 8b24c4b..5c5fb4c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -468,6 +468,9 @@
/* if true, parallel netCDF is used */
#undef USE_PNETCDF
+/* if true, use stdio instead of posixio */
+#undef USE_STDIO
+
/* if true, compile in szip compression in netCDF-4 variables */
#undef USE_SZIP
diff --git a/configure b/configure
index e349182..9a1a04e 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for netCDF 4.4.0-rc2.
+# Generated by GNU Autoconf 2.69 for netCDF 4.4.0-rc3.
#
# Report bugs to <support-netcdf at unidata.ucar.edu>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='netCDF'
PACKAGE_TARNAME='netcdf'
-PACKAGE_VERSION='4.4.0-rc2'
-PACKAGE_STRING='netCDF 4.4.0-rc2'
+PACKAGE_VERSION='4.4.0-rc3'
+PACKAGE_STRING='netCDF 4.4.0-rc3'
PACKAGE_BUGREPORT='support-netcdf at unidata.ucar.edu'
PACKAGE_URL=''
@@ -759,6 +759,8 @@ BUILD_V2_FALSE
BUILD_V2_TRUE
BUILD_EXAMPLES_FALSE
BUILD_EXAMPLES_TRUE
+USE_STDIO_FALSE
+USE_STDIO_TRUE
USE_FFIO_FALSE
USE_FFIO_TRUE
EXTRA_TESTS_FALSE
@@ -786,9 +788,11 @@ BUILD_INTERNAL_DOCS
NC_ENABLE_DOXYGEN_PDF_OUTPUT
NC_ENABLE_DOXYGEN_PDF_OUTPUT_FALSE
NC_ENABLE_DOXYGEN_PDF_OUTPUT_TRUE
-SERVER_SIDE_SEARCH
-SERVER_SIDE_SEARCH_FALSE
-SERVER_SIDE_SEARCH_TRUE
+DOXYGEN_SEARCHENGINE
+DOXYGEN_HEADER_FILE
+DOXYGEN_CSS_FILE
+DOXYGEN_BUILD_RELEASE_DOCS_FALSE
+DOXYGEN_BUILD_RELEASE_DOCS_TRUE
SHOW_DOXYGEN_TAG_LIST
SHOW_DOXYGEN_TAG_LIST_FALSE
SHOW_DOXYGEN_TAG_LIST_TRUE
@@ -890,7 +894,7 @@ enable_dll
with_minblocksize
enable_doxygen
enable_doxygen_tasks
-enable_doxygen_server_side_search
+enable_doxygen_build_release_docs
enable_doxygen_pdf_output
enable_dot
enable_internal_docs
@@ -922,6 +926,7 @@ enable_dap_groups
enable_dap_long_tests
enable_extra_tests
enable_ffio
+enable_stdio
enable_examples
enable_v2
enable_utilities
@@ -1492,7 +1497,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures netCDF 4.4.0-rc2 to adapt to many kinds of systems.
+\`configure' configures netCDF 4.4.0-rc3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1563,7 +1568,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of netCDF 4.4.0-rc2:";;
+ short | recursive ) echo "Configuration of netCDF 4.4.0-rc3:";;
esac
cat <<\_ACEOF
@@ -1580,11 +1585,9 @@ Optional Features:
--enable-doxygen Enable generation of documentation.
--enable-doxygen-tasks Enable Doxygen-generated test, todo and bug list
documentation. Developers only.
- --enable-doxygen-server-side-search
- Enable doxygen server-side search. This is of
- interest to developers only, or users who will serve
- the documentation via a web server instead of
- browsing locally.
+ --enable-doxygen-build-release-docs
+ Build release documentation. This is of interest
+ only to developers.
--enable-doxygen-pdf-output
Build netCDF library documentation in PDF format.
Experimental.
@@ -1632,9 +1635,10 @@ Optional Features:
--enable-dap-auth-tests enable dap remote authorization tests
--disable-dap-groups disable [netcdf4] dap group names
--enable-dap-long-tests enable dap long tests
- --disable-extra-tests disable some extra tests that may not pass because
- of known issues
+ --enable-extra-tests enable some extra tests that may not pass because of
+ known issues
--enable-ffio use ffio instead of posixio (ex. on the Cray)
+ --enable-stdio use stdio instead of posixio (ex. on the Cray)
--disable-examples don't build the netCDF examples during make check
(examples are treated as extra tests by netCDF)
--disable-v2 turn off the netCDF version 2 API
@@ -1780,7 +1784,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-netCDF configure 4.4.0-rc2
+netCDF configure 4.4.0-rc3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2489,7 +2493,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by netCDF $as_me 4.4.0-rc2, which was
+It was created by netCDF $as_me 4.4.0-rc3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2844,7 +2848,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
NC_VERSION_MAJOR=4
NC_VERSION_MINOR=4
NC_VERSION_PATCH=0
- NC_VERSION_NOTE="-rc2"
+ NC_VERSION_NOTE="-rc3"
#####
# Set some variables used to generate a libnetcdf.settings file,
@@ -2853,11 +2857,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Create the VERSION file, which contains the package version from
# AC_INIT.
-echo 4.4.0-rc2>VERSION
+echo 4.4.0-rc3>VERSION
-{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.0-rc2" >&5
-$as_echo "$as_me: netCDF 4.4.0-rc2" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.0-rc3" >&5
+$as_echo "$as_me: netCDF 4.4.0-rc3" >&6;}
# Keep libtool macros in an m4 directory.
@@ -3498,7 +3502,7 @@ fi
# Define the identity of the package.
PACKAGE='netcdf'
- VERSION='4.4.0-rc2'
+ VERSION='4.4.0-rc3'
cat >>confdefs.h <<_ACEOF
@@ -3704,22 +3708,38 @@ fi
SHOW_DOXYGEN_TAG_LIST=$enable_doxygen_tasks
-# Check whether --enable-doxygen-server-side-search was given.
-if test "${enable_doxygen_server_side_search+set}" = set; then :
- enableval=$enable_doxygen_server_side_search;
+###
+# Determine if we should build documentation
+# configured for releases on the Unidata web server.
+###
+# Check whether --enable-doxygen-build-release-docs was given.
+if test "${enable_doxygen_build_release_docs+set}" = set; then :
+ enableval=$enable_doxygen_build_release_docs;
fi
-test "x$enable_doxygen_server_side_search" = xyes || enable_doxygen_server_side_search=no
- if test "x$enable_doxygen_server_side_search" = xyes; then
- SERVER_SIDE_SEARCH_TRUE=
- SERVER_SIDE_SEARCH_FALSE='#'
+test "x$enable_doxygen_build_release_docs" = xyes || enable_doxygen_build_release_docs=no
+ if test "x$enable_doxygen_build_release_docs" = xyes; then
+ DOXYGEN_BUILD_RELEASE_DOCS_TRUE=
+ DOXYGEN_BUILD_RELEASE_DOCS_FALSE='#'
else
- SERVER_SIDE_SEARCH_TRUE='#'
- SERVER_SIDE_SEARCH_FALSE=
+ DOXYGEN_BUILD_RELEASE_DOCS_TRUE='#'
+ DOXYGEN_BUILD_RELEASE_DOCS_FALSE=
fi
-SERVER_SIDE_SEARCH=$enable_doxygen_server_side_search
+if test $enable_doxygen_build_release_docs = yes; then
+ DOXYGEN_CSS_FILE="release.css"
+
+ DOXYGEN_HEADER_FILE="release_header.html"
+
+ DOXYGEN_SEARCHENGINE="NO"
+
+else
+
+
+ DOXYGEN_SEARCHENGINE="YES"
+
+fi
# Check whether --enable-doxygen-pdf-output was given.
if test "${enable_doxygen_pdf_output+set}" = set; then :
@@ -5406,6 +5426,31 @@ else
fi
+# Does the user want to use the stdio module?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether STDIO will be used" >&5
+$as_echo_n "checking whether STDIO will be used... " >&6; }
+# Check whether --enable-stdio was given.
+if test "${enable_stdio+set}" = set; then :
+ enableval=$enable_stdio;
+fi
+
+test "x$enable_stdio" = xyes || enable_stdio=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_stdio" >&5
+$as_echo "$enable_stdio" >&6; }
+if test "x$enable_stdio" = xyes; then
+
+$as_echo "#define USE_STDIO 1" >>confdefs.h
+
+fi
+ if test x$enable_stdio = xyes; then
+ USE_STDIO_TRUE=
+ USE_STDIO_FALSE='#'
+else
+ USE_STDIO_TRUE='#'
+ USE_STDIO_FALSE=
+fi
+
+
# Does the user want to enable the user-provided NEC-SX vectorization
# patch.
@@ -16829,6 +16874,20 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
esac
+
+###
+# Crude hack to work around an issue
+# in Cygwin.
+###
+SLEEPCMD=""
+PLTFORMOUT="$(uname | cut -d '_' -f 1)"
+if test "$PLTFORMOUT" = "CYGWIN"; then
+ SLEEPCMD="sleep 5"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Pausing between sizeof() checks to mitigate a Cygwin issue." >&5
+$as_echo "$as_me: Pausing between sizeof() checks to mitigate a Cygwin issue." >&6;}
+fi
+
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -16862,6 +16921,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -16895,6 +16955,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -16928,6 +16989,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -16961,6 +17023,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -16994,6 +17057,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17027,6 +17091,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17060,6 +17125,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+$SLEEPCMD
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -18024,14 +18090,6 @@ else
SHOW_DOXYGEN_TAG_LIST_FALSE=
fi
- if test x$enable_doxygen_server_side_search = xyes; then
- SERVER_SIDE_SEARCH_TRUE=
- SERVER_SIDE_SEARCH_FALSE='#'
-else
- SERVER_SIDE_SEARCH_TRUE='#'
- SERVER_SIDE_SEARCH_FALSE=
-fi
-
# If the machine doesn't have a long long, and we want netCDF-4, then
# we've got problems!
@@ -18435,7 +18493,7 @@ HAS_JNA=$enable_jna
{ $as_echo "$as_me:${as_lineno-$LINENO}: generating header files and makefiles" >&5
$as_echo "$as_me: generating header files and makefiles" >&6;}
-ac_config_files="$ac_config_files Makefile nc-config netcdf.pc libnetcdf.settings postinstall.sh include/netcdf_meta.h include/Makefile h5_test/Makefile docs/Makefile docs/images/Makefile libsrc/Makefile libsrc4/Makefile libsrc5/Makefile nctest/Makefile nc_test4/Makefile nc_test/Makefile ncdump/Makefile ncgen3/Makefile ncgen/Makefile examples/Makefile examples/C/Makefile examples/CDL/Makefile oc2/Makefile libdap2/Makefile libdispatch/Makefile liblib/Makefile ncdump/cdl/Makefile ncdump/ex [...]
+ac_config_files="$ac_config_files Makefile nc-config netcdf.pc libnetcdf.settings postinstall.sh include/netcdf_meta.h include/Makefile h5_test/Makefile docs/Makefile docs/images/Makefile libsrc/Makefile libsrc4/Makefile libsrcp/Makefile nctest/Makefile nc_test4/Makefile nc_test/Makefile ncdump/Makefile ncgen3/Makefile ncgen/Makefile examples/Makefile examples/C/Makefile examples/CDL/Makefile oc2/Makefile libdap2/Makefile libdispatch/Makefile liblib/Makefile ncdump/cdl/Makefile ncdump/ex [...]
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -18578,8 +18636,8 @@ if test -z "${SHOW_DOXYGEN_TAG_LIST_TRUE}" && test -z "${SHOW_DOXYGEN_TAG_LIST_F
as_fn_error $? "conditional \"SHOW_DOXYGEN_TAG_LIST\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${SERVER_SIDE_SEARCH_TRUE}" && test -z "${SERVER_SIDE_SEARCH_FALSE}"; then
- as_fn_error $? "conditional \"SERVER_SIDE_SEARCH\" was never defined.
+if test -z "${DOXYGEN_BUILD_RELEASE_DOCS_TRUE}" && test -z "${DOXYGEN_BUILD_RELEASE_DOCS_FALSE}"; then
+ as_fn_error $? "conditional \"DOXYGEN_BUILD_RELEASE_DOCS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${NC_ENABLE_DOXYGEN_PDF_OUTPUT_TRUE}" && test -z "${NC_ENABLE_DOXYGEN_PDF_OUTPUT_FALSE}"; then
@@ -18606,6 +18664,10 @@ if test -z "${USE_FFIO_TRUE}" && test -z "${USE_FFIO_FALSE}"; then
as_fn_error $? "conditional \"USE_FFIO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${USE_STDIO_TRUE}" && test -z "${USE_STDIO_FALSE}"; then
+ as_fn_error $? "conditional \"USE_STDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${BUILD_EXAMPLES_TRUE}" && test -z "${BUILD_EXAMPLES_FALSE}"; then
as_fn_error $? "conditional \"BUILD_EXAMPLES\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -18739,10 +18801,6 @@ if test -z "${SHOW_DOXYGEN_TAG_LIST_TRUE}" && test -z "${SHOW_DOXYGEN_TAG_LIST_F
as_fn_error $? "conditional \"SHOW_DOXYGEN_TAG_LIST\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${SERVER_SIDE_SEARCH_TRUE}" && test -z "${SERVER_SIDE_SEARCH_FALSE}"; then
- as_fn_error $? "conditional \"SERVER_SIDE_SEARCH\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
@@ -19140,7 +19198,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by netCDF $as_me 4.4.0-rc2, which was
+This file was extended by netCDF $as_me 4.4.0-rc3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19206,7 +19264,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-netCDF config.status 4.4.0-rc2
+netCDF config.status 4.4.0-rc3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -19636,7 +19694,7 @@ do
"docs/images/Makefile") CONFIG_FILES="$CONFIG_FILES docs/images/Makefile" ;;
"libsrc/Makefile") CONFIG_FILES="$CONFIG_FILES libsrc/Makefile" ;;
"libsrc4/Makefile") CONFIG_FILES="$CONFIG_FILES libsrc4/Makefile" ;;
- "libsrc5/Makefile") CONFIG_FILES="$CONFIG_FILES libsrc5/Makefile" ;;
+ "libsrcp/Makefile") CONFIG_FILES="$CONFIG_FILES libsrcp/Makefile" ;;
"nctest/Makefile") CONFIG_FILES="$CONFIG_FILES nctest/Makefile" ;;
"nc_test4/Makefile") CONFIG_FILES="$CONFIG_FILES nc_test4/Makefile" ;;
"nc_test/Makefile") CONFIG_FILES="$CONFIG_FILES nc_test/Makefile" ;;
@@ -20904,7 +20962,7 @@ ltmain=$ac_aux_dir/ltmain.sh
"docs/images/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
"libsrc/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
"libsrc4/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
- "libsrc5/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
+ "libsrcp/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
"nctest/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
"nc_test4/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
"nc_test/Makefile":F) test -f nc-config && chmod 755 nc-config ;;
diff --git a/configure.ac b/configure.ac
index a6a7d0d..d214b96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,12 +15,12 @@ AC_REVISION([$Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp $])
AC_PREREQ([2.59])
# Initialize with name, version, and support email address.
-AC_INIT([netCDF], [4.4.0-rc2], [support-netcdf at unidata.ucar.edu])
+AC_INIT([netCDF], [4.4.0-rc3], [support-netcdf at unidata.ucar.edu])
AC_SUBST([NC_VERSION_MAJOR]) NC_VERSION_MAJOR=4
AC_SUBST([NC_VERSION_MINOR]) NC_VERSION_MINOR=4
AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=0
-AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc2"
+AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc3"
#####
# Set some variables used to generate a libnetcdf.settings file,
@@ -96,12 +96,25 @@ test "x$enable_doxygen_tasks" = xyes || enable_doxygen_tasks=no
AM_CONDITIONAL([SHOW_DOXYGEN_TAG_LIST], [test "x$enable_doxygen_tasks" = xyes])
AC_SUBST([SHOW_DOXYGEN_TAG_LIST], [$enable_doxygen_tasks])
-AC_ARG_ENABLE([doxygen-server-side-search],
- [AS_HELP_STRING([--enable-doxygen-server-side-search],
- [Enable doxygen server-side search. This is of interest to developers only, or users who will serve the documentation via a web server instead of browsing locally.])])
-test "x$enable_doxygen_server_side_search" = xyes || enable_doxygen_server_side_search=no
-AM_CONDITIONAL([SERVER_SIDE_SEARCH], [test "x$enable_doxygen_server_side_search" = xyes])
-AC_SUBST([SERVER_SIDE_SEARCH], [$enable_doxygen_server_side_search])
+###
+# Determine if we should build documentation
+# configured for releases on the Unidata web server.
+###
+AC_ARG_ENABLE([doxygen-build-release-docs],
+ [AS_HELP_STRING([--enable-doxygen-build-release-docs],
+ [Build release documentation. This is of interest only to developers.])])
+test "x$enable_doxygen_build_release_docs" = xyes || enable_doxygen_build_release_docs=no
+AM_CONDITIONAL([DOXYGEN_BUILD_RELEASE_DOCS], [test "x$enable_doxygen_build_release_docs" = xyes])
+
+if test $enable_doxygen_build_release_docs = yes; then
+ AC_SUBST([DOXYGEN_CSS_FILE], ["release.css"])
+ AC_SUBST([DOXYGEN_HEADER_FILE], ["release_header.html"])
+ AC_SUBST([DOXYGEN_SEARCHENGINE], ["NO"])
+else
+ AC_SUBST([DOXYGEN_CSS_FILE], [])
+ AC_SUBST([DOXYGEN_HEADER_FILE], [])
+ AC_SUBST([DOXYGEN_SEARCHENGINE], ["YES"])
+fi
AC_ARG_ENABLE([doxygen-pdf-output],
[AS_HELP_STRING([--enable-doxygen-pdf-output],
@@ -427,8 +440,8 @@ AM_CONDITIONAL(INTERNAL_OCLIB,[test "x" = "x"])
# Does the user want to do some extra tests?
AC_MSG_CHECKING([whether netCDF extra tests should be run (developers only)])
AC_ARG_ENABLE([extra-tests],
- [AS_HELP_STRING([--disable-extra-tests],
- [disable some extra tests that may not pass because of known issues])])
+ [AS_HELP_STRING([--enable-extra-tests],
+ [enable some extra tests that may not pass because of known issues])])
test "x$enable_extra_tests" = xno || enable_extra_tests=yes
AC_MSG_RESULT($enable_extra_tests)
if test "x$enable_extra_tests" = xyes; then
@@ -448,6 +461,18 @@ if test "x$enable_ffio" = xyes; then
fi
AM_CONDITIONAL(USE_FFIO, [test x$enable_ffio = xyes])
+# Does the user want to use the stdio module?
+AC_MSG_CHECKING([whether STDIO will be used])
+AC_ARG_ENABLE([stdio],
+ [AS_HELP_STRING([--enable-stdio],
+ [use stdio instead of posixio (ex. on the Cray)])])
+test "x$enable_stdio" = xyes || enable_stdio=no
+AC_MSG_RESULT($enable_stdio)
+if test "x$enable_stdio" = xyes; then
+ AC_DEFINE([USE_STDIO], [1], [if true, use stdio instead of posixio])
+fi
+AM_CONDITIONAL(USE_STDIO, [test x$enable_stdio = xyes])
+
# Does the user want to enable the user-provided NEC-SX vectorization
# patch.
dnl AC_MSG_CHECKING([whether netCDF NEC-SX vectorization patch is enabled])
@@ -821,13 +846,33 @@ AC_TYPE_OFF_T
AC_CHECK_TYPES([ssize_t, ptrdiff_t, uchar, longlong])
AC_C_CHAR_UNSIGNED
AC_C_BIGENDIAN
+
+###
+# Crude hack to work around an issue
+# in Cygwin.
+###
+SLEEPCMD=""
+PLTFORMOUT="$(uname | cut -d '_' -f 1)"
+if test "$PLTFORMOUT" = "CYGWIN"; then
+ SLEEPCMD="sleep 5"
+ AC_MSG_NOTICE([Pausing between sizeof() checks to mitigate a Cygwin issue.])
+fi
+
+$SLEEPCMD
AC_CHECK_SIZEOF(short)
+$SLEEPCMD
AC_CHECK_SIZEOF(int)
+$SLEEPCMD
AC_CHECK_SIZEOF(long)
+$SLEEPCMD
AC_CHECK_SIZEOF(long long)
+$SLEEPCMD
AC_CHECK_SIZEOF(float)
+$SLEEPCMD
AC_CHECK_SIZEOF(double)
+$SLEEPCMD
AC_CHECK_SIZEOF(off_t)
+$SLEEPCMD
AC_CHECK_SIZEOF(size_t)
if test "x$enable_netcdf_4" = xyes || test "x$enable_dap" = xyes; then
@@ -1000,7 +1045,6 @@ AM_CONDITIONAL(BUILD_DISKLESS, [test x$enable_diskless = xyes])
AM_CONDITIONAL(BUILD_MMAP, [test x$enable_mmap = xyes])
AM_CONDITIONAL(BUILD_DOCS, [test x$enable_doxygen = xyes])
AM_CONDITIONAL(SHOW_DOXYGEN_TAG_LIST, [test x$enable_doxygen_tasks = xyes])
-AM_CONDITIONAL(SERVER_SIDE_SEARCH, [test x$enable_doxygen_server_side_search = xyes])
# If the machine doesn't have a long long, and we want netCDF-4, then
# we've got problems!
@@ -1168,7 +1212,7 @@ AC_CONFIG_FILES([Makefile
docs/images/Makefile
libsrc/Makefile
libsrc4/Makefile
- libsrc5/Makefile
+ libsrcp/Makefile
nctest/Makefile
nc_test4/Makefile
nc_test/Makefile
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 93a754f..a3cd2f6 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -7,6 +7,8 @@ IF(ENABLE_DOXYGEN)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.html ${CMAKE_CURRENT_SOURCE_DIR}/images ${CMAKE_CURRENT_SOURCE_DIR}/*.doc ${CMAKE_CURRENT_SOURCE_DIR}/*.xml ${CMAKE_CURRENT_SOURCE_DIR}/*.m4 ${CMAKE_CURRENT_SOURCE_DIR}/*.texi)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+
+
# Set abs_top_srcdir to work with the autotools
# doxyfile template.
SET(abs_top_srcdir ${CMAKE_SOURCE_DIR})
@@ -16,7 +18,6 @@ IF(ENABLE_DOXYGEN)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
-
# Create auth.md by combining auth.md.in and oc2/ocauth.md
ADD_CUSTOM_TARGET(auth_doc ALL
diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in
index cd7b596..21656b6 100644
--- a/docs/Doxyfile.in
+++ b/docs/Doxyfile.in
@@ -762,6 +762,7 @@ INPUT = \
@abs_top_srcdir@/docs/all-error-codes.md \
@abs_top_srcdir@/docs/FAQ.md \
@abs_top_srcdir@/docs/software.md \
+ @abs_top_srcdir@/docs/known_problems.md \
@abs_top_srcdir@/docs/COPYRIGHT.dox \
@abs_top_srcdir@/docs/credits.md \
@abs_top_srcdir@/include/netcdf.h \
@@ -1120,7 +1121,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER = @DOXYGEN_HEADER_FILE@
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1142,7 +1143,7 @@ HTML_FOOTER = @abs_top_srcdir@/docs/footer.html
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET = @DOXYGEN_CSS_FILE@
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
# defined cascading style sheet that is included after the standard style sheets
@@ -1550,7 +1551,7 @@ MATHJAX_CODEFILE =
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
-SEARCHENGINE = YES
+SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
@@ -1562,7 +1563,7 @@ SEARCHENGINE = YES
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SERVER_BASED_SEARCH = @SERVER_SIDE_SEARCH@
+SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
diff --git a/docs/FAQ.md b/docs/FAQ.md
index f42b8a3..6e7681a 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -36,7 +36,7 @@ NetCDF data is:
The netCDF software was developed by Glenn Davis, Russ Rew, Ed Hartnett,
John Caron, Dennis Heimbigner, Steve Emmerson, Harvey Davies, and Ward
Fisher at the Unidata Program Center in Boulder, Colorado, with
-[contributions](/netcdf/credits.html) from many other netCDF users.
+[contributions](http://www.unidata.ucar.edu/software/netcdf/docs/credits.html) from many other netCDF users.
----------
@@ -241,9 +241,6 @@ A primary reference is the User's Guide:
Rew, R. K., G. P. Davis, S. Emmerson, and H. Davies, **NetCDF User's
Guide for C, An Interface for Data Access, Version 3**, April 1997.
-To cite use of netCDF software, please use this Digital Object Identifier (DOI):
-[http://dx.doi.org/10.5065/D6H70CW6](http://dx.doi.org/10.5065/D6H70CW6)
-
Current online and downloadable documentation is available from the
[documentation directory](http://www.unidata.ucar.edu/software/netcdf/docs/).
@@ -280,6 +277,21 @@ Rew, R. K. and G. P. Davis, " [Unidata's netCDF Interface for Data Access: Statu
----------
+I'm submitting a paper for publication and want to include a citation for use of netCDF software. What reference should I use? {#How-should-I-cite-use-of-netCDF-software}
+-----------------
+
+The registered Digital Object Identifier for all versions of netCDF software is `http://doi.org/10.5065/D6H70CW6`.
+
+The following can be used as a citation:
+
+Unidata, (_year_): Network Common Data Form (netCDF) version _nc_version_ [software]. Boulder, CO: UCAR/Unidata. (http://doi.org/10.5065/D6H70CW6)
+
+where _year_ is the year in which the work being described was done and _nc_version_ is the version of netCDF used. For example:
+
+Unidata, (2015): Network Common Data Form (netCDF) version 4.3.3.1 [software]. Boulder, CO: UCAR/Unidata. (http://doi.org/10.5065/D6H70CW6)
+
+----------
+
Is there a document describing the actual physical format for a Unidata netCDF file? {#Is-there-a-document-describing-the-actual-physical-format-for-a-Unidata-netCDF-file}
-----------------
@@ -1164,7 +1176,7 @@ Was it possible to create netCDF files larger than 2 GiBytes before version 3.6?
Yes, but there are significant restrictions on the structure of large
netCDF files that result from the 32-bit relative offsets that are part
-of the classic netCDF format. For details, see [NetCDF Classic Format Limitations](netcdf/NetCDF-Classic-Format-Limitations.html#NetCDF-Classic-Format-Limitations)
+of the classic netCDF format. For details, see [NetCDF Classic Format Limitations](http://www.unidata.ucar.edu/software/netcdf/documentation/historic/netcdf/NetCDF-Classic-Format-Limitations.html#NetCDF-Classic-Format-Limitations)
in the User's Guide.
----------
@@ -1429,7 +1441,7 @@ purposes.
It is also possible to overcome the 4 GiB variable restriction for a
single fixed size variable, when there are no record variables, by
-making it the last variable, as explained in the example in [NetCDF Classic Format Limitations](netcdf/NetCDF-Classic-Format-Limitations.html#NetCDF-Classic-Format-Limitations).
+making it the last variable, as explained in the example in [NetCDF Classic Format Limitations](http://www.unidata.ucar.edu/software/netcdf/documentation/historic/netcdf/NetCDF-Classic-Format-Limitations.html#NetCDF-Classic-Format-Limitations).
----------
@@ -1548,7 +1560,7 @@ Data Center at Goddard, and is freely available. It was originally a VMS
FORTRAN interface for scientific data access. Unidata reimplemented the
library from scratch to use [XDR](http://www.faqs.org/rfcs/rfc1832.html)
for a machine-independent representation, designed the
-[CDL](netcdf/CDL-Syntax.htm) (network Common Data form Language) text
+[CDL](http://www.unidata.ucar.edu/software/netcdf/documentation/historic/netcdf/CDL-Syntax.htm) (network Common Data form Language) text
representation for netCDF data, and added aggregate data access, a
single-file implementation, named dimensions, and variable-specific
attributes.
diff --git a/docs/Makefile.in b/docs/Makefile.in
index a6f15aa..d5b6964 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -214,6 +214,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -289,7 +292,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/docs/credits.md b/docs/credits.md
index e7c164a..beb77f2 100644
--- a/docs/credits.md
+++ b/docs/credits.md
@@ -25,9 +25,7 @@ while converting it into texinfo, and is the primary developer for
netCDF-4. Dennis Heimbigner wrote the netCDF-4 version of ncgen, the C
OPeNDAP client, the dispatch layer, and the implementation of diskless
files. The nccopy utility was added by Russ Rew. Lynton Appel developed
-the C++ implementation for netCDF-4. Ward Fisher developed the netCDF
-Windows/Microsoft Visual Studio port and implemented the portable
-CMake-based netCDF build and test system.
+the C++ implementation for netCDF-4. Ward Fisher overhauled netCDF release-engineering, developed a new build-and-test framework using CMake, virtualization, and container technologies, moved sources to GitHub, developed a Windows/Microsoft Visual Studio port, refactored documentation for improved web access, and merged all the documentation into the sources for maintaining with Markdown and Doxygen.
The following people have contributed related software, bug reports,
fixes, valuable suggestions, and other kinds of useful support:
diff --git a/docs/images/Makefile.in b/docs/images/Makefile.in
index 3874079..8370448 100644
--- a/docs/images/Makefile.in
+++ b/docs/images/Makefile.in
@@ -151,6 +151,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -226,7 +229,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/docs/install.md b/docs/install.md
old mode 100644
new mode 100755
index ac48957..50de54f
--- a/docs/install.md
+++ b/docs/install.md
@@ -177,6 +177,11 @@ installation location specified with the <CODE>--prefix</CODE> option
must be different from the source directory where the software is
being built.
+WARNING: you should be able to use parallel 'make all'. But 'make check'
+will probably fail if you use parallel make. This is because historically,
+there are inter-dependencies between test programs. It is unlikely
+that this will be fixed any time soon, if ever.
+
Building netCDF with Classic Library Only {#build_classic}
---------------------------------------
diff --git a/docs/known_problems.md b/docs/known_problems.md
new file mode 100644
index 0000000..f681257
--- /dev/null
+++ b/docs/known_problems.md
@@ -0,0 +1,1463 @@
+# Known Problems with netCDF {#known_problems}
+
+
+Known Problems with netCDF 4.3.0
+--------------------------------
+
+- [clang compiler (default on OSX 10.9 Mavericks) detects error
+ building ncgen3](#clang-ncgen3)
+
+Known Problems with netCDF 4.2
+------------------------------
+
+- [Fortran options of nc-config utility (--fflags, --flibs, --has-f90)
+ don't work correctly](#nc-config-fortran)
+- [Using "--with-hdf5=..." configure option doesn't seem to
+ work](#with-hdf5)
+
+Known Problems with netCDF 4.1.3
+--------------------------------
+
+- [nccopy -d and -c options for compression and chunking don't work on
+ netCDF-4 input files](#nccopy-compression-bug)
+- [Debug statement left in F90 source](#f90-debug-segfault)
+- [Building with Intel Fortran on Mac OS X](#intel-fortran-macosx)
+- [Accessing OPeNDAP servers using a constraint expression](#dap-413)
+- [Configuring with "--enable-benchmarks"
+ option](#enabling-benchmarks)
+
+Known Problems with netCDF 4.1.2
+--------------------------------
+
+- [Building with Intel Fortran on Mac OS X](#intel-fortran-macosx)
+- [Problem with disabling fill mode when using Lustre (or other large
+ blksize file system)](#lustre)
+
+Known Problems with netCDF 4.1.1
+--------------------------------
+
+- [Ncgen is known to produce bad output and should not
+ be used.](#bad-ncgen)
+- [Building with Intel Fortran on Mac OS X](#intel-fortran-macosx)
+- ["make check" fails when linked with HDF5-1.8.6](#incompat-411-186)
+- [Make tries to regenerate documentation with texi2dvi
+ command](#texi2dvi)
+- [Accessing a multidimensional variable with more than 4 billion
+ values on a 32-bit platform](#big-mvar-32bit)
+
+------------------------------------------------------------------------
+
+### The clang compiler (default on OSX 10.9 Mavericks) detects error building ncgen3
+
+Building the netCDF C library with the clang C compiler, the default
+/usr/bin/cc on OSX 10.9 Mavericks, detects an error in compiling
+ncgen3/load.c. A fix is to insert the line
+
+ #include <config.h>
+
+above the "`#include <stdlib.h>`" statement near the beginning of
+ncgen3/genlib.h.
+
+This fix will be in the next release.
+
+### Fortran options of nc-config utility (--fflags, --flibs, --has-f90) don't work correctly
+
+Beginning with version 4.2 of the C-based netCDF software, the netCDF
+Fortran library is built from an independent netcdf-fortran release with
+its own nf-config utility. In netCDF-4.2 the nc-config utility doesn't
+detect whether nf-config is installed and make use of its output to
+preserve backward compatibility with nc-config from previous releases.
+This problem is fixed in netCDF-4.2.1-rc1 and later releases.
+
+### Using "--with-hdf5=..." configure option doesn't seem to work
+
+With releases of netCDF-4 after version 4.1.2 (this includes 4.1.3, 4.2,
+4.2.1, ...) you don't use "--with-hdf5" to specify the location of the
+HDF5 libraries, you use CPPFLAGS and LDFLAGS, as in
+
+ CPPFLAGS=-I/usr/local/hdf5/include LDFLAGS=-L/usr/local/hdf5/lib ./configure
+
+The reason for this change is explained
+[here](https://www.unidata.ucar.edu/jira/browse/NCF-20).
+
+### nccopy -d and -c options for compression and chunking don't work on netCDF-4 input files
+
+Due to a bug in nccopy, the "-d n" and "-c" options only work for
+classic and 64-bit input files, producing netCDF-4 classic model output
+files. These options are also useful for netCDF-4 files to compress or
+recompress files and to chunk or rechunk variables. The bug description
+and its resolution have been
+[entered](https://www.unidata.ucar.edu/jira/browse/NCF-79) into the
+issue tracker.
+
+The bug has been fixed in all releases since 4.1.3, including the
+netcdf-4.2-rc1 release candidate.
+
+### Debug statement left in F90 source
+
+The debugging statement
+
+ print *, values(1, 1), values(1, 2), values(1, 3), values(1, 4)
+
+was inadvertently left in the file f90/netcdf\_expanded.f90 at line 734,
+and should be removed. If the variable has a second dimension less than
+4, this can cause a segfault. The problem has been fixed in the
+subsequent netcdf-fortran-4.2 release.
+
+### Ncgen is known to produce bad output.
+
+Dave Allured at NOAA has reported that the ncgen for 4.1.1 produces bad
+.nc files under circumstances. We recommend that this version of ncgen
+should not be used.
+
+### Building with Intel Fortran on Mac OS X
+
+Setting the environment variable **lt\_cv\_ld\_force\_load=no** before
+invoking the configure script is a workaround to successfully build
+netCDF version 4.1.3 with the Intel ifort Fortran compiler.
+Specifically, the following works on Mac OS X 10.7.x (Lion) for building
+C and Fortran libraries and passing all tests on Lion:
+
+ $ lt_cv_ld_force_load=no FC="ifort" CC="cc" CXX="" \
+ LDFLAGS=-L/WHERE_HDF5_IS_INSTALLED/lib \
+ CPPFLAGS=-I/WHERE_HDF5_IS_INSTALLED/include ./configure
+ make check
+
+(The CXX environment variable is set to "" in this example to disable
+building and testing the legacy netCDF-3 C++ API, because of an as yet
+unsolved error that's not relevant to this Fortran problem.)
+
+### Accessing OPeNDAP servers using a constraint expression
+
+The use of subsetting by specifying a URL with subsetting information to
+dap-enabled netCDF is broken for stable release 4.1.3. This can be
+demonstrated by using the 4.1.3 version of ncdump to access data from an
+OPeNDAP server, using a constraint expression in the URL, which results
+in the error message
+
+ NetCDF: Malformed or inaccessible DAP DDS
+
+This bug is fixed in 4.2 releases after 2011-09-11, as well as by fixing
+the 4.1.3 release using the 3 replacement source files in [this tar
+file](http://www.unidata.ucar.edu/downloads/netcdf/ftp/4.1.3-fix.tar).
+
+### Configuring with "--enable-benchmarks" option
+
+Using the "--enable-benchmarks" option to the configure script fails
+with a compile error on some platforms, and has been reported to fail in
+other ways on some other platforms.
+
+### Problem with disabling fill mode when using Lustre (or other large blksize file system)
+
+Joerg Henrichs has reported a bug when writing netCDF classic format
+data with fill mode disabled, on a file system such as Lustre that uses
+a large disk block size (for example 2 MB). On such a system, tests run
+by "make check" may all pass, but some write operations will fail
+without reporting an error.
+
+A fix is available. in netCDF-4.1.3-beta1 or later and also in [this
+patch](/software/netcdf/patches/nofill-bug.patch) for the file
+libsrc/posixio.c in netCDF-4.1.2 and earlier versions.
+
+An example that failed depended on all the following circumstances:
+
+- The disk block size must be within a range of sizes, in this case
+ one of the 58080 values between 2091953 and 2150032 inclusive.
+ Equivalently, the file must be created using the "double underbar"
+ function nc\_\_create() with a I/O block size in this range.
+- No-fill mode must be set, for example by calling nc\_set\_fill()
+ with NC\_NOFILL, or by using a software package such as NCO that
+ uses no-fill mode by default.
+- A data variable at the end of a file being created must be written
+ in reverse order from how it is stored on disk, for example writing
+ a multidimensional variable by slices in reverse order along one of
+ its more slowly varying dimensions. This must result in writing at
+ least two disk blocks beyond the end of the file.
+
+Workarounds include avoiding use of no-fill mode (NC\_NOFILL), enabling
+share mode (NC\_SHARE), changing the order of writes of a
+multidimensional variable written in reverse order, or creating the file
+using nc\_\_create with a blocksize outside the range in which erroneous
+writes occur. Some of these workarounds slow the write performance of
+netCDF.
+
+### "make check" fails when linked with HDF5-1.8.6
+
+When built with HDF5 version 1.8.6, version 4.1.1 fails one of the tests
+invoked by "make check":
+
+ ...
+ *** Checking that one var, two dimscales, one att file can still be read by HDF5...ok.
+ *** Creating a HDF5 file with one var and no dimension scales...ok.
+ HDF5-DIAG: Error detected in HDF5 (1.8.6) thread 0:
+ #000: H5O.c line 717 in H5Oget_info_by_idx(): group not found
+ major: Symbol table
+ minor: Object not found
+ #001: H5Gloc.c line 591 in H5G_loc_find_by_idx(): can't find object
+ major: Symbol table
+ minor: Object not found
+ ...
+ PASS: tst_endian_fill
+ ================================================
+ 1 of 59 tests failed
+ Please report to support-netcdf at unidata.ucar.edu
+ ================================================
+ make[2]: *** [check-TESTS] Error 1
+
+Currently the workarounds are to either
+
+- Use the earlier HDF5 1.8.5-patch1 release for building netCDF 4.1.1
+- Use netCDF-4.1.2-beta2 or later with HDF5 1.8.6
+
+The HDF5 1.8.5-patch1 release is available from the HDF5 site at
+<http://www.hdfgroup.org/ftp/HDF5/prev-releases/> or from the netCDF-4
+ftp site at <ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4>.
+
+### Make tries to regenerate documentation with texi2dvi command
+
+After building netCDF-4.1.1, invoking "make clean", and then building it
+again with "make all" or "make check", a failure to find the texi2dvi
+command is reported:
+
+ make[1]: Entering directory `/usr/local/netcdf/netcdf-4.1.1/man4'
+ TEXINPUTS=".:$TEXINPUTS" \
+ MAKEINFO='/bin/sh /usr/local/netcdf/netcdf-4.1.1/missing --run makeinfo -I .' \
+ texi2dvi -s --pdf --batch netcdf.texi
+ make[1]: Leaving directory `/usr/local/netcdf/netcdf-4.1.1/man4'
+ /bin/sh: texi2dvi: command not found
+
+This results from a bug where "make clean" erroneously deleted the
+documentation generated for the release, so make tries to regenerate the
+documentation from source, which will fail if you don't happen to have
+the "texi2dvi" program installed (which you shouldn't need).
+
+This is fixed in the current snapshot and in the upcoming release 4.1.2,
+but a workaround is to get a new copy of the 4.1.1 source and rebuild
+from that with the same settings you used to get to the above message,
+without invoking "make clean" until after the software and documentation
+is successfully installed. An alternative workaround is to just invoke
+"make install" after the error above and use online documentation.
+
+### Accessing a multidimensional variable with more than 4 billion values on a 32-bit platform
+
+Kari Hoijarvi has reported a bug in implementation of large variable
+support that has been in netCDF software since at least 1997, and which
+is fixed in netCDF snapshots after 2010-05-13 as well as in the upcoming
+netCDF-4.1.2 release. The bug occurs when all of the following
+conditions are met:
+
+- A 32-bit version of the netCDF library is used.
+- The file format is either classic or 64-bit offset format.
+- Values are written to or read from a fixed-size variable that has
+ more than 2^32^ (4,294,967,296) values, or a record variable with
+ more than 2^32^ values per record. The variable must be the last
+ fixed-size variable in a file with no record variables or the last
+ record variable, because otherwise it would violate the format
+ constraints for netCDF classic or 64-bit offset formats described
+ [here](http://www.unidata.ucar.edu/netcdf/docs/netcdf/NetCDF-Classic-Format-Limitations.html).
+ Note that the bug involves number of values, not bytes, so if the
+ variable is of type integer or float, for example, it would require
+ more than 17 Gbytes.
+- The variable must have 2 or more dimensions.
+- The values to be written or read must begin after the first 2^32^
+ values of the variable.
+
+In this case an undetected integer overflow occurred in calculating the
+file offset, and the values were written to or read from the wrong
+location in the file, overwriting data stored at that location in the
+case of a write.
+
+The fix is a one-line change to a line in the libsrc/putget.m4 file,
+from which the libsrc/putget.c file is generated, replacing the
+statement
+
+ lcoord += *up * *ip;
+
+with
+
+ lcoord += (off_t)(*up) * (off_t)(*ip);
+
+Known Problems with netCDF 4.0.1
+--------------------------------
+
+- [Including mpi.h before netcdf.h breaks MPI](#include_mpi_order)
+- [With Sun C compiler, 64-bit ncdump fails](#suncc-m64-ncdump)
+- [Portland Group compilers can't build shared fortran 90 or shared
+ C++ library, or 64-bit C++ API](#PG_shared)
+- [Intel 10.1 64-bit C++ compiler problem](#intel_10.1_64_bit_c++)
+- [Intel 9.1 C++ compiler problem doesn't build C++
+ API](#intel_9.1__c++)
+- [ncgen/ncdump test failure with Intel version 11
+ compilers](#intel_11-ncgen)
+- ["ncdump -v group/var" reports "group not found"](#ncdump-v)
+
+### Including mpi.h before netcdf.h breaks MPI
+
+Luis Kornblueh reports a subtle bug in netcdf 4.0.1. In the netcdf.h
+header file, the following mpi entities are defined:
+
+ /* These defs added by netCDF configure because parallel HDF5 is not
+ present. */
+ #define MPI_Comm int
+ #define MPI_Info int
+ #define MPI_COMM_WORLD 0
+ #define MPI_INFO_NULL 0
+
+If mpi.h is included before netcdf.h, these defines (may) break the MPI
+implementation.
+
+### With Sun C compiler, 64-bit ncdump fails
+
+As identified by Udo Grabowski, using the "-m64" option to build netCDF
+with the Sun C compiler results in a failed test when running "make
+check" in the ncdump directory:
+
+ *** checking that test1.cdl and test2.nc are the same...
+ 62,63c62,63
+ < 8.88178419700125e-16, 1.11022302462516e-15, 1.33226762955019e-15,
+ < 1.55431223447522e-15, 1.77635683940025e-15, 222044604925031 ;
+ ---
+ > 1.97215226305253e-31, 2.46519032881567e-31, 2.9582283945788e-31,
+ > 3.45126646034193e-31, 3.94430452610506e-31, 0.0493038065763132 ;
+ FAIL: run_tests.sh
+
+This bug is fixed in recent Sun C compiler releases, for example "Sun C
+5.11 SunOS\_i386 Aten 2010/05/10".
+
+Short of upgrading the compiler, other workarounds include specifying
+
+ CFLAGS="-O0 -m64"
+
+before rerunning the configure script, to turn off optimization, or just
+install an ncdump built without "-m64". Because ncdump reads only a
+little data at a time, there is no benefit to a 64-bit ncdump. The
+32-bit ncdump handles classic, 64-bit offset, and netCDF-4 files
+correctly even if they are larger than 4 GiB.
+
+### Portland Group compilers can't build shared fortran 90 library or shared C++ library
+
+The portland group compilers can't build netCDF shared fortran 90
+library. They fail with this error:
+
+ pgf90 -I../fortran -I../f90 -I../libsrc -I../fortran -I../f90
+ -g -c -o tst_f90.o tst_f90.f90
+ /bin/sh ../libtool --mode=link pgf90 -I../fortran -I../f90 --
+ ---I../libsrc -I../fortran -I../f90 -g -L/lib --
+ ---o tst_f90 tst_f90.o ../fortran/libnetcdff.la --
+ ---lm ../libsrc/libnetcdf.la
+ libtool: link: pgf90 -I../fortran -I../f90 -I../libsrc -I../fortran
+ -I../f90 -g -o .libs/tst_f90 tst_f90.o -L/lib
+ ../fortran/.libs/libnetcdff.so -lm ../libsrc/.libs/libnetcdf.so
+ -Wl,-rpath
+ -Wl,/machine/netcdf/n362_test_9456/netcdf-3.6.3-snapshot2008081305/install/lib
+ tst_f90.o:(.debug_info+0x135d): undefined reference to
+ `..Dm_typesizes'
+ tst_f90.o:(.debug_info+0x136e): undefined reference to `..Dm_netcdf'
+
+If anyone could shed some light on this, it would be most appreciated.
+Send comments to support-netcdf at unidata.ucar.edu.
+
+The C++ compiler chokes on the netCDF C++ tests on a shared build:
+
+ pgCC -DHAVE_CONFIG_H -I. -I.. -I../fortran -I../libdap
+ -I../libsrc -g -c -o tst_failure.o tst_failure.cpp
+ /bin/sh ../libtool --tag=CXX --mode=link pgCC -g -o tst_failure
+ tst_failure.o ../cxx/libnetcdf_c++.la ../libsrc/libnetcdf.la
+ libtool: link: pgCC -g -o .libs/tst_failure tst_failure.o
+ ../cxx/.libs/libnetcdf_c++.so ../libsrc/.libs/libnetcdf.so
+ -Wl,--rpath -Wl,/usr/local/lib
+ make[2]: Leaving directory `/machine/shecky/n4_new2/cxx'
+ make check-TESTS
+ make[2]: Entering directory `/machine/shecky/n4_new2/cxx'
+ C++ runtime abort: internal error: static object marked for
+ destruction more than once
+ /bin/sh: line 4: 8445 Aborted ${dir}$tst
+ FAIL: nctst
+ C++ runtime abort: internal error: static object marked for
+ destruction more than once
+ /bin/sh: line 4: 8468 Aborted ${dir}$tst
+ XFAIL: tst_failure
+
+There is a problem with the pgCC compiler noted as "Fixed in version
+6.2.1" described as
+
+ C++ runtime abort: internal error: static object marked for
+ destruction more than once
+
+here as [Technical Problem Report
+3809](http://www.pgroup.com/support/tprs_62.htm#t3809).
+
+This bug was also previously [reported by a
+user](http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg03783.html).
+
+### Intel 10.1 64-bit C++ compiler problem
+
+On my test machine, the intel 10.1 C++ compiler cannot build the netCDF
+C++ API in 64-bit mode. I get an error like this:
+
+ make[1]: Entering directory
+ `/machine/netcdf/n362_test_16030/netcdf-3.6.3-snapshot2008081312/cxx'
+ depbase=`echo netcdf.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
+ /bin/sh ../libtool --tag=CXX --mode=compile icpc -DHAVE_CONFIG_H
+ -I. -I.. -I../fortran -I../libdap -I../libsrc
+ -I/opt/intel/cce/10.1.015/include -MT netcdf.lo -MD -MP -MF
+ $depbase.Tpo -c -o netcdf.lo netcdf.cpp &&\
+ mv -f $depbase.Tpo $depbase.Plo
+ libtool: compile: icpc -DHAVE_CONFIG_H -I. -I.. -I../fortran
+ -I../libdap -I../libsrc -I/opt/intel/cce/10.1.015/include -MT
+ netcdf.lo -MD -MP -MF .deps/netcdf.Tpo -c netcdf.cpp -o netcdf.o
+ /usr/include/c++/4.3.0/x86_64-redhat-linux/bits/c++locale.h(94):
+ error: argument of type "__va_list_tag *" is incompatible with
+ parameter of type "char *"
+ const int __ret = __builtin_vsnprintf(__out, __size, __fmt,
+ __args);
+ ^
+
+ compilation aborted for netcdf.cpp (code 2)
+ make[1]: *** [netcdf.lo] Error 1
+ make[1]: Leaving directory
+ `/machine/netcdf/n362_test_16030/netcdf-3.6.3-snapshot2008081312/cxx'
+ make: *** [check-recursive] Error 1
+
+This is because the Intel C++ compiler has not caught up to the GNU C++
+compiler, and for some reason that is not clear to me, it is using the
+header files from gcc.
+
+To solve this problem, install an older version of gcc (4.1.2 works in
+testing at Unidata World Test Center, located at the bottom of a
+six-mile deep mine shaft.) Put the bin directory at the beginning of
+your PATH, and the lib (or lib64) directory at the beginning at the
+LD\_LIBRARY\_PATH. Then rebuild.
+
+### Intel 9.1 C++ compiler problem doesn't build C++ API
+
+On my test machine, the intel 9.1 C++ compile fails like this:
+
+ make nctst tst_failure
+ make[2]: Entering directory
+ `/machine/netcdf/n362_test_16035/netcdf-3.6.3-snapshot2008081312/cxx'
+ depbase=`echo nctst.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
+ icpc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I../libdap
+ -I../libsrc -I/opt/intel/cc/9.1.047/include/c++/ -MT nctst.o -MD -MP
+ -MF $depbase.Tpo -c -o nctst.o nctst.cpp &&\
+ mv -f $depbase.Tpo $depbase.Po
+ /bin/sh ../libtool --tag=CXX --mode=link icpc
+ -I/opt/intel/cc/9.1.047/include/c++/ -o nctst nctst.o
+ ../cxx/libnetcdf_c++.la ../libsrc/libnetcdf.la
+ libtool: link: icpc -I/opt/intel/cc/9.1.047/include/c++/ -o nctst
+ nctst.o ../cxx/.libs/libnetcdf_c++.a ../libsrc/.libs/libnetcdf.a
+ nctst.o: In function `main':
+ nctst.cpp:(.text+0x22e): undefined reference to
+ `std::ios_base::clear(std::_Iosb::_Iostate, bool)'
+ nctst.cpp:(.text+0x290): undefined reference to
+ `std::ios_base::clear(std::_Iosb::_Iostate, bool)'
+ nctst.cpp:(.text+0x3b1): undefined reference to
+ `std::ios_base::clear(std::_Iosb::_Iostate, bool)'
+ nctst.cpp:(.text+0x520): undefined reference to
+ `std::ios_base::clear(std::_Iosb::_Iostate, bool)'
+ nctst.cpp:(.text+0x582): undefined reference to
+ `std::ios_base::clear(std::_Iosb::_Iostate, bool)'
+ nctst.o:nctst.cpp:(.text+0x767): more undefined references to
+ `std::ios_base::clear(std::_Iosb::_Iostate, bool)' follow
+ nctst.o: In function `__sti__$E':
+ nctst.cpp:(.text+0x2cb0): undefined reference to
+ `std::_Winit::_Winit()'
+ nctst.cpp:(.text+0x2cbf): undefined reference to `std::_Winit::~_Winit()'
+
+Anyone who can shed light on this should send email to
+support-netcdf at unidata.ucar.edu.
+
+### ncgen/ncdump test failure with Intel version 11 compilers
+
+Ed Anderson reports that the tests of the netcdf-4.0 (and presumable
+4.0.1 and 3.6.3) package fail with the recently released version 11 of
+the Intel compilers, producing the error message:
+
+ *** creating UTF-8 test file tst_utf8.nc...Sorry! Unexpected result, tst_utf8.c, line: 63
+ Sorry! Unexpected result, tst_utf8.c, line: 68
+ Sorry! Unexpected result, tst_utf8.c, line: 72
+ Sorry! Unexpected result, tst_utf8.c, line: 79
+ Sorry! Unexpected result, tst_utf8.c, line: 90
+ Sorry! Unexpected result, tst_utf8.c, line: 92
+ Sorry! Unexpected result, tst_utf8.c, line: 114
+ Sorry! Unexpected result, tst_utf8.c, line: 117
+ Sorry! Unexpected result, tst_utf8.c, line: 119
+ Sorry! Unexpected result, tst_utf8.c, line: 122
+ /bin/sh: line 1: 5216 Segmentation fault ${dir}$tst
+ FAIL: tst_utf8
+
+ *** Testing ncgen and ncdump for UTF8 support...
+ *** creating classic offset file with utf8 characters...
+ ncgen: NetCDF: Name contains illegal characters
+ ncgen: NetCDF: Invalid dimension ID or name
+ ncgen: NetCDF: Name contains illegal characters
+ FAIL: run_utf8_tests.sh
+ =========================================
+ 2 of 8 tests failed
+
+Ed also reports this is a compiler problem (which has been reported) and
+that there is a workaround:
+
+ ... in libsrc/string.c the test
+
+ if(ch <= 0x7f) {
+
+ can be changed (in two places) to
+
+ if(ch < 0x7f || ch == 0x7f) {
+
+ This was the only change I needed to pass the netcdf-4 tests with Intel
+ version 11.
+
+### "ncdump -v group/var" reports "group not found"
+
+John Storrs reported a bug using ncdump -v applied to netCDF-4 files, in
+which an erroneous 'group not found' message was displayed for valid
+group/var names. This is fixed in the next release, and the fix is also
+in the [current snapshot
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/).
+
+Known Problems with netCDF 4.0
+------------------------------
+
+- [Ncdump assumes default fill value for unsigned byte
+ data](#ncdump_ubyte_fill)
+- [Ncdump of compound type with array field](#compound_array_field)
+- [Memory leak with VLEN attributes](#mem_leak)
+- [Error dyld: Symbol not found:
+ _H5P_CLS_FILE_ACCESS_g](#o_problem_mac)
+- [Bug with multiple unlimited dimensions in one
+ var](#multiple_unlimited)
+- [Fortran90 interface Using Intel ifort under
+ Cygwin](#ifort-f90-cygwin)
+- [ncdump bug for filenames beginning with a numeric
+ character](#ncdump-numeric-filename)
+- [ncgen/ncdump test failure with Intel version 11
+ compilers](#intel_11-ncgen)
+
+### Ncdump assumes default fill value for unsigned byte data
+
+The ncdump utility incorrectly assumes a default fill value of "255" for
+data of unsigned byte type, although no default fill value is assumed
+for data of type signed byte. There should be no default fill values
+when reading any byte type, signed or unsigned, because the byte ranges
+are too small to assume one of the values should appear as a missing
+value unless a \_FillValue attribute is set explicitly. This bug is
+fixed in the current snapshot distribution.
+
+### Ncdump of compound type with array field
+
+Running the ncdump utility on a file with a compound type with an array
+field may result in a segmentation violation. A fix is in the current
+netCDF-4.0 snapshot distribution.
+
+### Memory leak with VLEN attributes
+
+We believe there are some memory leaks associated with VLEN attributes
+in HDF5 1.8.1. This is being addressed by the HDF5 team, and will be
+fixed by the next HDF5 release.
+
+### Error dyld: Symbol not found: _H5P_CLS_FILE_ACCESS_g
+
+On some Macintosh systems here at NetCDF World Test Center, on the
+hundreth floor of UCAR Tower \#2, the following build error occurs:
+
+ *** Checking HDF5 enum types.
+ *** Checking simple HDF5 enum type...ok.
+ *** Checking HDF5 enum type missing values...ok.
+ *** Tests successful!
+ PASS: tst_h_enums
+ dyld: Symbol not found: _H5P_CLS_FILE_ACCESS_g
+ Referenced from:
+ /tmp/n4_sid/netcdf-4.0-snapshot2008042320/libsrc4/.libs/libnetcdf.5.dylib
+ Expected in: flat namespace
+
+ FAIL: tst_lists
+ dyld: Symbol not found: _H5P_CLS_FILE_ACCESS_g
+ Referenced from:
+ /tmp/n4_sid/netcdf-4.0-snapshot2008042320/libsrc4/.libs/libnetcdf.5.dylib
+ Expected in: flat namespace
+
+ FAIL: tst_dims
+ dyld: Symbol not found: _H5P_CLS_FILE_ACCESS_g
+ Referenced from:
+ /tmp/n4_sid/netcdf-4.0-snapshot2008042320/libsrc4/.libs/libnetcdf.5.dylib
+ Expected in: flat namespace
+
+ etc.
+
+This can be caused by the configure script failing to add "-lhdf5" to
+the link flags in the generated Makefiles. Set LDFLAGS to include
+"-L/WHERE/HDF5/IS/INSTALLED/lib -lhdf5" and try again.
+
+------------------------------------------------------------------------
+
+Bug with multiple unlimited dimensions in one var
+
+There is a bug in the 4.0 release related to the lengths of dimensions
+when more than one unlimited dimension is used in the same variable.
+
+The bug is fixed in the latest [netCDF-4 snapshot
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-4-daily.tar.gz).
+
+### Fortran90 interface Using Intel ifort under Cygwin
+
+Chris Dallimore reports success in getting the Fortran 90 interface of
+Version 4.0 to compile under CYGWIN using the Intel ifort compile;
+
+ 1 - Download and unpack netcdf-4.0.tar.gz
+
+ 2 - In configure replace conftest.o and conftestf.o with conftest.
+ $ac_objext and conftest.$ac_objext, I'm Not sure why autoconf doesn't
+ do this.
+
+ 3 -
+ Save http://msinttypes.googlecode.com/svn/trunk/inttypes.h as libsrc/
+ inttypes_msvc.h
+ Save ttp://msinttypes.googlecode.com/svn/trunk/stdint.h as libsrc/
+ stdint_msvc.h
+
+ modify line 43 of libsrc/inttypes_msvc.h
+ from
+ #include
+ to
+ #include
+
+ 4 - in libsrc utf8proc.h at line 79 replaces
+
+ #include
+
+ with
+
+ #ifndef _MSC_VER
+ #include
+ #else
+ #include
+ typedef long ssize_t;
+ typedef unsigned int uint32_t;
+ #endif
+
+ It looks like configure is checking for ssize_t so there is probably a
+ better way to do this.
+
+ 5 -
+ in libsrc/posixio.c at line 18 replace
+
+ #ifdef _MSC_VER /* Microsoft Compilers */
+ #include
+ #else
+ #include
+ #endif
+
+ with
+
+ #ifdef _MSC_VER /* Microsoft Compilers */
+ #include
+ typedef long ssize_t;
+ typedef unsigned int uint32_t;
+ #else
+ #include
+ #endif
+
+ 6 -
+ in putget.m4 at line 24 added
+
+ #ifdef _MSC_VER
+ #include
+ #endif // _MSC_VER ]
+
+ Run
+ ./configure --prefix=/cygdrive/z/cwr/Software/Eclipse/CWRModelSource --
+ disable-examples --disable-cxx --disable-utilities
+
+ Relevant environment variables
+ FC=ifort
+ F90=ifort
+ FFLAGS=/debug:full /traceback /nologo
+ FCFLAGS=/debug:full /traceback /nologo
+ FCFLAGS_f90=/debug:full /traceback /nologo
+ FLIBS=
+ CXX=
+ CPPFLAGS=/D AbsoftProFortran /D _MSC_VER /nologo
+
+ IFORT_COMPILER10_POSIX=/cygdrive/c/Program Files/Intel/Compiler/
+ Fortran/10.1.013
+ VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
+ INTEL_LICENSE_FILE=C:\Program Files\Common Files\Intel\Licenses
+ PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel
+ TERM=cygwin
+ WINDIR=C:\WINDOWS
+ MAKEFLAGS=w -- F90=ifort
+ VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
+ VSINSTALLDIR_POSIX=/cygdrive/c/Program Files/Microsoft Visual Studio 8
+ F90FLAGS=/debug:full /traceback /nologo
+ OS=CYGWIN
+ MAKEOVERRIDES=${-*-command-variables-*-}
+ USER=dallimor
+ VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\VC
+ INTEL_SHARED=C:\Program Files\Common Files\Intel\Shared Files
+ LIB=C:\Program Files\Intel\Compiler\Fortran\10.1.013\Ia32\Lib;C:
+ \Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib;C:\Program Files
+ \Microsoft Visual Studio 8\VC\lib;C:\Program Files\Microsoft Visual
+ Studio 8\VC\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio
+ \DF98\LIB;C:\Program Files\Microsoft Visual Studio\VC98\LIB
+ IFORT_COMPILER10=C:\Program Files\Intel\Compiler\Fortran\10.1.013
+ MFLAGS=-w
+ VCINSTALLDIR_POSIX=/cygdrive/c/Program Files/Microsoft Visual Studio 8/
+ VC
+ PROCESSOR_LEVEL=6
+ PATH=/cygdrive/c/Program Files/Intel/Compiler/Fortran/10.1.013/Ia32/
+ Bin:/cygdrive/c/Program Files/Common Files/Intel/Shared Files/Ia32/
+ Bin:/cygdrive/c/Program Files/Microsoft Visual Studio 8/Common7/IDE:/
+ cygdrive/c/Program Files/Microsoft Visual Studio 8/VC/bin:/cygdrive/c/
+ Program Files/Microsoft Visual Studio 8/Common7/Tools:/cygdrive/c/
+ Program Files/Microsoft Visual Studio 8/Common7/Tools/bin:/cygdrive/c/
+ Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/bin:/cygdrive/c/
+ apache-ant-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/
+ cygdrive/c/Program Files/Microsoft Visual Studio/Common/Tools:/
+ cygdrive/c/Program Files/Microsoft Visual Studio/Common/Msdev98/BIN:/
+ cygdrive/c/Program Files/Microsoft Visual Studio/DF98/BIN:/cygdrive/c/
+ Program Files/Microsoft Visual Studio/VC98/BIN:/cygdrive/c/Sun/SDK/jdk/
+ bin:C:/oraclexe/app/oracle/product/10.2.0/server/bin:/cygdrive/c/
+ WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/
+ Wbem:/cygdrive/c/Program Files/jEdit:/cygdrive/c/Program Files/
+ Microsoft SQL Server/90/Tools/binn/:/cygdrive/c/Program Files/Intel/
+ Compiler/Fortran/10.1.013/IA32/Lib:/cygdrive/c/Program Files/Intel/
+ Compiler/Fortran/10.1.013/EM64T/Lib:/cygdrive/c/Program Files/MATLAB/
+ R2008a/bin:/cygdrive/c/Program Files/MATLAB/R2008a/bin/win32
+ CPU=i386
+ FP_NO_HOST_CHECK=NO
+ PROCESSOR_ARCHITECTURE=x86
+ PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
+ INTEL_SHARED_POSIX=/cygdrive/c/Program Files/Common Files/Intel/Shared
+ Files
+ MAKE_MODE=unix
+ INFOPATH=/usr/local/info:/usr/share/info:/usr/info:
+ PROGRAMFILES=C:\Program Files
+ CC=cl
+ INCLUDE=C:\Program Files\Intel\Compiler\Fortran
+ \10.1.013\Ia32\Include;C:\Program Files\Microsoft Visual Studio 8\VC
+ \atlmfc\include;C:\Program Files\Microsoft Visual Studio 8\VC
+ \include;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
+ \include;C:\Program Files\Microsoft Visual Studio\DF98\INCLUDE;C:
+ \Program Files\Microsoft Visual Studio\VC98\INCLUDE
+
+
+ Now configure works
+
+ make will compile but fails on linking
+
+ libtool: link: ( cd ".libs" && rm -f "libnetcdf2.la" && ln -s "../
+ libnetcdf2.la" "libnetcdf2.la" )
+ /bin/sh ../libtool --tag=CC --mode=link /cygdrive/z/cwr/Software/
+ Eclipse/CWRModelSource/src/external/netcdf_src/netcdf-4.0/compile
+ cl -version-info 4:0:0 -o libnetcdf.la -rpath /cygdrive/z/cwr/
+ Software/Eclipse/CWRModelSource/lib attr.lo ncx.lo putget.lo dim.lo
+ error.lo libvers.lo nc.lo string.lo v1hpg.lo var.lo utf8proc.lo
+ posixio.lo libnetcdf2.la ../fortran/libnetcdff.la
+ libtool: link: warning: undefined symbols not allowed in i686-pc-
+ cygwin shared libraries
+ libtool: link: (cd .libs/libnetcdf.lax/libnetcdf2.lib && ar x "/
+ cygdrive/z/cwr/Software/Eclipse/CWRModelSource/src/external/netcdf_src/
+ netcdf-4.0/libsrc/./.libs/libnetcdf2.lib")
+ libtool: link: (cd .libs/libnetcdf.lax/libnetcdff.lib && ar x "/
+ cygdrive/z/cwr/Software/Eclipse/CWRModelSource/src/external/netcdf_src/
+ netcdf-4.0/libsrc/../fortran/.libs/libnetcdff.lib")
+ .libs/libnetcdff.lax/libnetcdff90.lib/typeSizes.obj: No such file or
+ directory
+
+ It looks like the Microsoft LInker doesn't like the GNU lib format.
+
+ I was however able to compile and link using some static (ie non
+ automake) makefiles that are part of our overall model build
+ environment.
+
+### ncdump bug for filenames beginning with a numeric character
+
+The ncdump utility in releases 4.0 and 3.6.3 rejects filenames starting
+with the digits 0,1 and 2 with an error message such as:
+
+ ncdump: name begins with space or control-character: 2
+
+This bug is fixed in the daily snapshot release and in 4.0.1-beta
+releases, but a one-line patch to ncdump/dumplib.c (for either
+netCDF-4.0 or netCDF-3.6.3) is to replace the line
+
+ if((*cp >= 0x01 && *cp <= 0x32) || (*cp == 0x7f))
+
+with the following line instead
+
+ if((*cp >= 0x00 && *cp <= 0x20) || (*cp == 0x7f))
+
+------------------------------------------------------------------------
+
+Known Problems with netCDF 3.6.3
+--------------------------------
+
+- [Building shared libraries on Macintosh with
+ g95 fails.](#g95_mac_shared)
+- [Building Fortran/C++ shared libraries on AIX fails.](#AIX_shared)
+- [Building shared libraries on HPUX with native tools results in only
+ static libraries.](#HPUX_shared)
+- [Can't build shared library with F90 API on IRIX.](#IRIX_f90_shared)
+- [ncdump bug for filenames beginning with a numeric
+ character](#ncdump-numeric-filename)
+
+------------------------------------------------------------------------
+
+### Can't build shared library with F90 API on IRIX
+
+When building shared libraries on out IRIX test system, I got the
+following error:
+
+ ld32: FATAL 12 : Expecting n32 objects: /lib/libc.so.1 is o32.
+
+Obviously there is some ABI confusion here, but we don't know how to
+resolve it. Any user who can solve this should email
+support-netcdf at unidata.ucar.edu so that we can share the method with
+other users.
+
+------------------------------------------------------------------------
+
+Known Problems with netCDF 3.6.2
+--------------------------------
+
+- [Setting ARFLAGS does not work.](#ARFLAGS)
+- [Bugs in support for variables larger than 4 GiB](#large_vars_362)
+- [Bug in C++ interface prevents creating 64-bit offset format
+ files](#cxx_64-bit)
+- [Shared libraries do not work with the NAG
+ fortran compiler.](#nag_362)
+- [The tests in nf_test fail with seg fault with the Absoft Version
+ 10.0 fortran compiler.](#absoft10)
+- [The documented --enable-64bit option doesn't work](#enable-64bit)
+- [Building netCDF-3.6.2 with gfortran version
+ 4.3.x fails.](#gfortran_43)
+- [Building shared libraries on Macintosh with
+ g95 fails.](#g95_mac_shared)
+- [Building shared libraries on HPUX with native tools results in only
+ static libraries.](#HPUX_shared)
+- [Building Fortran/C++ shared libraries on AIX fails.](#AIX_shared)
+- [Building with older versions of g++ fails.](#old_gpp)
+- [The .NET build files are not included in the
+ 3.6.2 release.](#NET_3_6_2)
+- [Snapshot .NET build files do not work for Visual Studio 8.0
+ beta releases.](#NET_80_362)
+- [The -disable-v2 option causes the fortran build to fail with some
+ fortran compilers.](#disable-v2_3_6_2)
+- [The --disable-c option does not work.](#disable-c_3_6_2)
+
+------------------------------------------------------------------------
+
+### Setting ARFLAGS does not work
+
+Sometimes when building netCDF, flags to the ar utility need to be set.
+Setting ARFLAGS does not work.
+
+(Note: If you are doing this to build 64-bit libraries on an AIX
+platform, the most fool-proof way to built 64-bit applications under AIX
+is to set the OBJECT\_MODE environment variable to 64. If you still feel
+you must setr flags for ar, read on.)
+
+Try the build again, setting AR\_FLAGS instead of ARFLAGS.
+
+### Bugs in support for variables larger than 4 GiB
+
+As first reported by Mario Emmenlauer, there is a bug in netCDF-3.6.2
+(and earlier versions) in the code for creating byte and short type
+variables greater than 4 GiB in size. This problem resulted in an
+assertion violation or arithmetic exception that would have caused a
+program to halt, rather than writing bad data or corrupting existing
+data.
+
+A fix is available as a [patch](../patches/large-vars-362-patch) to the
+file libsrc/var.c in the netcdf-3.6.2 distribution. The bug is also
+fixed in releases 3.6.3 and later.
+
+1. On 32-bit platforms (with size\_t an unsigned 32-bit type):
+ - For a short variable, if the product of dimensions (not counting
+ the record dimension, if any) is greater than 2^31^ (that's
+ 2147483648), the following assertion violation occurs
+
+ Assertion failed: remaining > 0, file putget.c, line 347
+
+ - For any type of variable, if the product of dimensions (not
+ counting the record dimension, if any) is exactly 2^32^
+ (that's 4294967296) or any multiple of 2^32^, a divide by zero
+ occurs
+
+ Arithmetic Exception(coredump)
+
+2. On 64-bit platforms (with size\_t an unsigned 64-bit type):
+ - For a byte variable, if the product of dimensions (not counting
+ the record dimension, if any) is greater than 2^32^, an
+ assertion violation occurs
+
+ Assertion failed: *ulp <= X_SIZE_MAX, file ncx.c, line 1810
+
+ - For a short variable, if the product of dimensions (not counting
+ the record dimension, if any) is greater than 2^31^, the same
+ assertion violation occurs
+
+ Assertion failed: *ulp <= X_SIZE_MAX, file ncx.c, line 1810
+
+### Bug in C++ interface prevents creating 64-bit offset format files
+
+As reported by Jos Verdoold, a bug in the netCDF 3.6.2 (and earlier
+versions) C++ interface prevents creating new files in Offset64Bits mode
+using the C++ API. The fix is to change two lines (378 and 393) in the
+file src/cxx/netcdf.cpp, changing "=" to "|=" in each line, then
+rebuild:
+
+ 378c378
+ < mode = NC_WRITE;
+ ---
+ > mode |= NC_WRITE;
+ 393c393
+ < mode = NC_NOCLOBBER;
+ ---
+ > mode |= NC_NOCLOBBER;
+
+This fix has been incorporated into netCDF 3.6.3 and later versions.
+
+### The tests in nf\_test fail with seg fault with the Absoft Version 10.0 fortran compiler.
+
+The absoft fortran compiler, version 10.0, changes the way that a C
+function returning string is called from fortran.
+
+This causes the absoft fortran settings in cfortran.h to no longer work,
+and this is reflected in a segmentation fault in the test program
+nf\_test/nf\_test.
+
+As a workaround, users with absoft version 10 can get the latest
+netCDF-3 snapshot and build it with the --enable-absoft10-hack option
+set.
+
+Get the snapshot, and see the working output, on the [netCDF-3
+snapshot](http://www.unidata.ucar.edu/software/netcdf/builds/snapshot/)
+page.
+
+### Shared libraries do not work with the NAG fortran compiler.
+
+We have reports that the shared library build does not work with the NAG
+fortran compiler. The NAG compiler is not one of the compilers we
+current support (and test on) at Unidata. The only known work around is
+to build without the --enable-shared option.
+
+Any user who can debug this problem with the NAG compiler should send
+the resuts to support-netcdf at unidata.ucar.edu, so that it can be
+incorporated into the netCDF distribution.
+
+Interested users may also wish to subscribe to the [netcdf-porting
+mailing
+list](http://www.unidata.ucar.edu/mailing_lists/archives/netcdf-porting/).
+
+### The documented --enable-64bit option doesn't work.
+
+The --enable-64bit option appeared in the 3.6.1 release, and was--
+removed for the 3.6.2 release.
+
+Unfortunately, the documentation was not updated, so that the 3.6.2
+documentation still mentions the enable-64bit option. Sorry about that.
+
+The documentation has been corrected for the [netCDF-3
+snapshot](http://www.unidata.ucar.edu/software/netcdf/builds/snapshot/)
+and the [netCDF-4
+snapshot](http://www.unidata.ucar.edu/software/netcdf/builds/snapshot/index_4.html)
+documentation.
+
+### Building netCDF-3.6.2 with gfortran version 4.2.x or 4.3.x fails.
+
+Something changed in gfortran version 4.3 relating to how fortran
+functions can call C functions.
+
+In netCDF, the interface between C and Fortran is handled by the
+cfortran.h package, which requires a pre-processor define describing the
+type of fortran you are using.
+
+For gfortran up to version 4.1.x, the netCDF distribution builds cleanly
+with the "gFortran" preprocessor symbol set. For gfortran 4.2.x and
+greater, the "pgiFortran" preprocessor symbol works.
+
+The 3.6.2 build uses "gFortran", unless you specifically set the
+CPPFLAGS environmental variable to "-DpgiFortran".
+
+This works in my bash shell:
+
+ FC=gfortran CPPFLAGS=-DpgiFortran ./configure && make check
+
+This problem has been fixed in the [netCDF-3
+snapshot](../builds/snapshot). Now configure checks the version of
+gfortran before setting the appropriate flag.
+
+### Building shared libraries on Macintosh with g95 fails.
+
+Building shared libraries on the Macintosh fails
+
+
+ *** Testing netCDF-3 Fortran 90 API.
+ dyld: lazy symbol binding failed: Symbol not found: __g95_size
+ Referenced from:
+ /tmp/n3_mort/netcdf-3.6.2-snapshot2007052501/fortran/.libs/libnetcdff.4.dylib
+ Expected in: flat namespace
+
+ dyld: Symbol not found: __g95_size
+ Referenced from:
+ /tmp/n3_mort/netcdf-3.6.2-snapshot2007052501/fortran/.libs/libnetcdff.4.dylib
+ Expected in: flat namespace
+
+ FAIL: tst_f90
+ =========================================
+ 1 of 5 tests failed
+ Please report to support at unidata.ucar.edu
+ =========================================
+
+### Building shared libraries on HPUX with native tools results in only static libraries.
+
+On the only HPUX machine I have access to for testing, the
+--enable-shared still results in only the static library being linked.
+
+This may be because of and old C++ compiler on this particular platform.
+Any HPUX use who can provide information about this should send email to
+support-netcdf at unidata.ucar.edu. bash-2.04\$ uname -a HP-UX tweety
+B.11.00 A 9000/785 2004553471
+
+### Building shared libraries on AIX fails.
+
+On the Unidata AIX platforms, the shared netCDF build fails with either
+the Fortran or C++ compilers, like this:
+
+ make check-TESTS
+ *** Creating fills.nc.
+ *** SUCCESS!
+ PASS: create_fills.sh
+ /bin/sh: 16012 Segmentation fault(coredump)
+ FAIL: nf_test
+ /bin/sh: 16018 Segmentation fault(coredump)
+ FAIL: tst_f77_v2
+ /bin/sh: 16024 Segmentation fault(coredump)
+ FAIL: ftest
+ =========================================
+ 3 of 4 tests failed
+ Please report to support at unidata.ucar.edu
+ =========================================
+
+If built without fortran or C++, the build succeeds, but shared
+libraries are not built. (Static libraries are).
+
+I don't know what is causing this. If any AIX users can shed any light,
+that would be most helpful.
+
+Shared builds also fail the same way when using GNU compilers.
+
+### Building with older versions of g++ fails.
+
+The build fails like this:
+
+ libtool: compile: g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran -DDEBUG -I../libsrc -g -O2 -MT netcdf.lo -MD -MP -MF .deps/netcdf.Tpo -c netcdf.cpp -o netcdf.o
+ In file included from /opt/gnu/gcc/include/c++/3.2/powerpc-ibm-aix5.0.0.0/bits/c++io.h:35,
+ from /opt/gnu/gcc/include/c++/3.2/bits/fpos.h:44,
+ from /opt/gnu/gcc/include/c++/3.2/iosfwd:46,
+ from /opt/gnu/gcc/include/c++/3.2/ios:44,
+ from /opt/gnu/gcc/include/c++/3.2/ostream:45,
+ from /opt/gnu/gcc/include/c++/3.2/iostream:45,
+ from netcdf.cpp:13:
+ /opt/gnu/gcc/include/c++/3.2/cstdio:108: `fgetpos' not declared
+ /opt/gnu/gcc/include/c++/3.2/cstdio:110: `fopen' not declared
+ /opt/gnu/gcc/include/c++/3.2/cstdio:115: `freopen' not declared
+ /opt/gnu/gcc/include/c++/3.2/cstdio:118: `fsetpos' not declared
+ netcdf.cpp: In member function `NcBool NcVar::set_cur(long int, long int, long
+ int, long int, long int)':
+
+This happens in old versions of g++ when large files are used. To fix
+this, either upgrade your g++ compiler, or else use --disable-largefile
+with configure, to turn off large file handling.
+
+### The .NET build files are not included in the 3.6.2 release.
+
+The netCDF 3.6.2 release does not contain the .NET build files. Whoops!
+Sorry about that.
+
+.NET users should use the latest snapshot, or continue to use the 3.6.1
+release.
+
+This is now fixed in the netCDF-3 snapshot. Get the snapshot from the
+[netCDF-3 snapshot build page](../builds/snapshot).
+
+### Snapshot .NET build files do not work for Visual Studio 8.0 beta.
+
+A user has reported that Visual Studio .NET version 8.0 beta does not
+build with the netCDF .NET build files in win32/NET.
+
+Interested users may also wish to subscribe to the [netcdf-porting
+mailing
+list](http://www.unidata.ucar.edu/mailing_lists/archives/netcdf-porting/).
+
+### The -disable-v2 option causes the fortran build to fail with some fortran compilers.
+
+The netCDF version 2 API is maintained for backward compatibility. We
+are committed to maintaining the V2 API for all future releases of
+netCDF. However, the --disable-v2 option is provided -- for users who
+wish to compile the netCDF libraries without the V2 API.
+
+The --disable-v2 option will cause the fortran build to fail on some
+fortran 95 compilers because the netcdf.inc file still includes the
+names of the V2 API functions. (Other fortran 90 compilers ignore
+these).
+
+If your compiler fails with --disable-v2, you can either refrain from
+using this option (that is, build the v2 API as well as the V3 API), or
+you can get the netCDF-3 [snapshot](../builds/snapshot).
+
+This is fixed for future releases of netCDF.
+
+### The --disable-c option does not work.
+
+The --disable-c option should turn off the building of the netCDF C
+library for use with --enable-separate-fortran (to save a small amount
+of tme building and testing. However this does not happen. The C library
+is built in any case.
+
+Users may ignore this option in version 3.6.2. It is fixed in the
+netCDF-3 [snapshot](../builds/snapshot) and for future releases of
+netCDF.
+
+Known Problems with netCDF 3.6.1
+--------------------------------
+
+[Building on IBM Bluegene login node (SUSE Linux)](#login_node_3_6_1)
+
+[Linux x86 Fedora4 with Intel ifort 9.0 compiler](#ifort_3_6_1)
+
+### Building on IBM Bluegene login node (SUSE Linux)
+
+Michael McCracken reports the following:
+
+ Hi, I have been working with netcdf and parallel netcdf on
+ bluegene at SDSC. I have no problems building a version to link with
+ WRF and run on the ppc32 compute nodes.
+
+ When I need to inspect a data file, I can't run the ncdump that is
+ built with the cross-compiling configure without running it on a
+ compute node. It works, but I end up waiting in the queue (and being
+ charged for using 64 CPUs).
+
+ I'd like to build an ncdump that works on the login node, and I was
+ wondering if anyone had done that on a bluegene yet. The local staff
+ at SDSC haven't.
+
+ Here's how I did it:
+
+ After some debugging, I can configure and compile with the following
+ commands.
+
+ I added -DIBMR2Fortran because apparently that's not getting set on
+ bluegene (probably because it's linux and not AIX), and without it
+ compiling in the fortran/ subdir barfs.
+
+ setenv CC "xlc"
+ setenv CFLAGS "-O3 -qstrict -DIBMR2Fortran"
+ setenv CPP "xlc -E"
+ setenv CXX "xlC"
+ setenv CXXFLAGS "-O3 -qstrict"
+ setenv CXXCPP "xlC -E"
+ setenv F77 "xlf"
+ setenv FC "xlf"
+ setenv F90 "xlf90"
+ setenv FFLAGS "-O3 -qstrict"
+
+ ./configure --disable-flag-setting
+
+ I get a clean build, and ncdump works for me...
+
+### Linux x86 Fedora4 with Intel ifort 9.0 compiler
+
+For netCDF version 3.6.1, Jonathan Rougier contributes the following
+work around for an intel fortran compiler bug.
+
+There is a bug (which may have been fixed: see the ifort pages), which
+generates an error message along the lines of:
+
+ IPO link: can not find "("
+ ifort: error: problem during multi-file optimization compilation (code
+ 1)
+
+The documented cludge, which worked for me, is:
+
+ # normal flags
+
+ setenv FC ifort
+ setenv FFLAGS "-mp -recursive"
+ setenv CPPFLAGS "-DNDEBUG -DpgiFortran"
+
+ # cludge
+
+ echo null > \(; echo null > AS_NEEDED
+ echo null > nf_test/\(; echo null > nf_test/AS_NEEDED
+ echo null > ncgen/\(; echo null > ncgen/AS_NEEDED
+
+which creates files called '(' and AS\_NEEDED in the appropriate places.
+
+------------------------------------------------------------------------
+
+\
+
+Known Problems with netCDF 3.6.0
+--------------------------------
+
+- [nctest fails on IRIX platform](#irix-nctest)
+- [C++ API doesn't build on Irix](#irix-CXX-build)
+- [Potentially serious bug with 64-bit offset files](#cdf2-bug)
+- [Cygwin build doesn't work](#bad-cygwin)
+- [Windows DLL doesn't include F77 API](#dll-fortran)
+- [F90 tests fail with Portland F90 compiler](#portland-f90)
+- [Config doesn't find working F77 or F90 compiler on
+ AIX](#aix-config)
+- [F90 functions not added to library on AIX](#aix-make)
+- [Problems with fortran compile because of -Df2cFortran being added
+ by configure](#fortran-config)
+- [Message: "ncgenyy.c is out-of-date with respect to
+ ncgen.l"](#ncgen-timestamp)
+- [Configure help specifies FCFLAGS instead of FFLAGS](#fcflags)
+- [Specifying an edge-length of zero returns error instead of no
+ data](#zeroedge)
+- [C++ library doesn't build under Cygwin](#cygwincpp)
+- [Large file problems in Visual C++ compile](#visualcpp_largefile)
+- [When using TEMP_LARGE, need a trailing slash](#temp_large)
+
+------------------------------------------------------------------------
+
+### nctest fails on IRIX platform
+
+It has been reported (by Atro Tossavainen) that nctest fails on some
+Irix builds. (We cannot duplicate this problem at netCDF World HQ).
+
+The nctest fails when comparing the test-generated out with a saved copy
+of the output.
+
+This problem was fixed in the 3.6.1 release.
+
+### C++ API doesn't build on Irix
+
+On Irix systems without a recent version of the C++ compiler, the C++
+API won't build. The solution is to set CXXFLAGS to -LANG:std.
+
+### Potentially serious bug with 64-bit offset files
+
+Kevin Thomas of the University of Oklahoma has reported a potentially
+serious bug in using the new large file support in netCDF 3.6.0. Users
+of the new large file facilities are cautioned to either apply [this
+one-line patch to netCDF
+3.6.0](/software/netcdf/patches/patch-3.6.0-cdf2) or to upgrade from
+version 3.6.0 to the current release version 3.6.0-p1, available from
+[netcdf.tar.Z](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.Z) or
+[netcdf.tar.gz](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz).
+Until you can upgrade, avoid rewriting in place any large (> 2 GiB)
+netCDF files that use the new 64-bit offset format under the conditions
+described below.
+
+The bug occurs following this sequence of steps:
+
+A large netCDF file is created using the new 64-bit offset format
+variant (also known as the version 2 format) and the file is closed.
+
+Later the file is opened for writing, followed by either of the
+following operations:
+
+- enter define mode (calling nc\_redef(), nf\_redef(), or
+ nf90\_redef(), in C, Fortran-77, or Fortran-90 interface,
+ for example) to add a new dimension, variable, or attribute; or
+- write a new value for an existing attribute (either a global or a
+ variable-specific attribute).
+
+Under these conditions, after you leave define mode or close the file,
+the file header is written out in the "classic" (version 1) netCDF
+format, chopping the leading bits off any variable offsets that were
+large enough to require more than 32 bits. If there were no such huge
+variable offsets, the file is undamaged and remains readable as a
+classic netCDF file. If there were any huge variable offsets (> 2
+GiB), data for the first such variable and all subsequent variables will
+not be accessed correctly. It is possible to restore the header for such
+a file to the correct 64-bit offset form so that the data can
+subsequently be accessed correctly, if no data values have been
+overwritten since the file header was changed to classic format. Feel
+free to [contact us](mailto:support-netcdf at unidata.ucar.edu) for help
+restoring the file headers if this applies to you. If you have any large
+64-bit offset format netCDF files that might have mistakenly been
+rewritten with classic format headers, please be careful not to write
+any more data into them, as it could overwrite data that could not
+subsequently be recovered.
+
+If you want to know how to tell if a 64-bit offset file has been
+converted by this bug into a classic format file, see the answer to the
+FAQ [How can I tell if a netCDF file uses the classic format or new
+64-bit offset
+format?](/software/netcdf/faq.html#Large%20File%20Support5).
+
+### Cygwin Build Doesn't Work
+
+To build on Cygwin, you must get the [latest 3.6.1 beta
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.gz).
+
+### Windows DLL doesn't include F77 API
+
+The netCDF windows DLL doesn't include the Fortran API. We are working
+on this problem for the next release. Meanwhile, if you need the fortran
+API in your DLL, you'll have to use the [netCDF 3.5.1
+DLL](ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-3.5.1-win32dll.zip).
+
+### F90 tests fail with Portland F90 compiler
+
+On some versions of the Portland Group F90 compiler, the F90 tests fail,
+looking something like this:
+
+
+ *** Failure ***
+ *** example_good.cdl 2000-04-05 21:33:14.000000000 +0200
+ --- example.cdl 2005-01-11 10:21:31.624884000 +0100
+ ***************
+ *** 34,43 ****
+ 953, 954, 955,
+ 956, 957, 958,
+ 959, 960, 961,
+ ! 962, 963, 964,
+ ! 965, 966, 967,
+ ! 968, 969, 970,
+ ! 971, 972, 973 ;
+
+ lat = -90, -87.5, -85, -82.5 ;
+
+ --- 34,43 ----
+ 953, 954, 955,
+ 956, 957, 958,
+ 959, 960, 961,
+ ! 950, 951, 952,
+ ! 953, 954, 955,
+ ! 956, 957, 958,
+ ! 959, 960, 961 ;
+
+This problem is caused by a bug in the Portland F90 compiler. Upgrade to
+the latest version of the compiler or get the free patch from Portland
+Group to fix this.
+
+### Config doesn't find working F77 or F90 compiler on AIX
+
+On AIX systems, the configure step can't find either the F90 or the F77
+compiler. On AIX system, you must set the environment variables FC and
+F90 to xlf and xlf95.
+
+### xlf90 fails to compile test program during configure on AIX
+
+On AIX systems, the F90 option -qsuffix=f=f90 is required in F90FLAGS.
+Configure should automatically detect and add this to F90FLAGS if it's
+not already there, but it doesn't.
+
+FIX: Make sure that -qsuffix=f=f90 is set in the F90FLAGS before running
+configure.
+
+This will be fixed in the next beta release.
+
+### F90 functions not added to library on AIX
+
+On AIX systems, the F90 functions may not be added to the library. This
+is due to a quirk of AIX make.
+
+Before doing "make install", change to the Fortran90 directory (src/f90)
+and do "make". Then proceed to "make install".
+
+### Problems with fortran compile because of -Df2cFortran being added by configure"
+
+With some fortran compilers, such as Absoft, the configure script
+stupidly adds a -Df2cFortran to the C preprocessor flags, which causes
+the fortran tests in nf\_test to fail to link.
+
+This problem is fixed in the 3.6.1 beta release. Get the [3.6.1 beta
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.Z).
+
+### Message: "ncgenyy.c is out-of-date with respect to ncgen.l"
+
+On some platforms (HP-UX 11.00, maybe others), make fails with an error
+message like:
+
+ Warning: ncgenyy.c is out-of-date with respect to ncgen.l
+ Warning: It should be recreated via flex on a SunOS 5 system
+
+and then fails if the "flex" command is not found.
+
+The problem is that the modification time on the source file
+src/ncgen/ncgenyy.c is being interpreted as earlier than the
+modification time on the source file src/ncgen/ncgen.l, even though
+ncgenyy.c was actually created after ncgen.l was modified. To workaround
+this problem on a Unix system, run the following command from the netCDF
+src/ directory to update the modification time of the derived file:
+
+ touch ncgen/ncgenyy.c
+
+Then rerun the make command.
+
+### Configure help specifies FCFLAGS instead of FFLAGS
+
+If you run "configure --help", it suggests setting "FCFLAGS" for the
+fortran compiler flags, but "FFLAGS" is actually used for the Fortran
+compiler flags. "FCFLAGS" is ignored when compiling.
+
+This problem will be is fixed in the next beta release. Until then, use
+FFLAGS, not FCFLAGS.
+
+### Specifying a count length of zero returns an error instead of no data
+
+For access to array sections, strided access, or mapped access, you need
+to specify both a start index vector and a count vector, where the count
+vector specifies the number of slices along each edge to access. If the
+start index vector specifies the maximum dimension size and the
+corresponding count vector is zero, the library should just return no
+data, but instead it returns an error status indicating "Index exceeds
+dimension bound". This problem has been present in all versions of
+netCDF, and the test programs even verify that in this case an error is
+returned rather than gracefully accessing no data.
+
+This will be fixed in the next minor version.
+
+### C++ library doesn't build under Cygwin
+
+Running configure on Cygwin fails to find GNU C++ compiler, even if it
+is present on the platform. As a result, the C++ interface is never
+built.
+
+This problem is fixed in the 3.6.1 beta release. Cygwin users interested
+in the C++ interface should get the [3.6.1 beta
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.1-beta1.tar.Z).
+
+### Large file problems in Visual C++ compile
+
+The use of large files, and an 8-byte off\_t type, is not handled
+correctly in the 3.6.0 release of the code and project files needed to
+compile the netCDF library with Visual C++.NET.
+
+This problem is fixed in the 3.6.1 beta release. Users interested in
+building their own DLL should get the [3.6.1 beta
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.1-beta1.tar.Z).
+The DLL offered on the binary release page is 3.6.1 beta.
+
+### When using TEMP\_LARGE, need a trailing slash
+
+When using the environment variable TEMP\_LARGE during the netCDF 3.6.0
+make extra\_test phase, the directory name must be followed by a slash
+to work. For example, use 'setenv TEMP\_LARGE /tmp/' instead of 'setenv
+TEMP\_LARGE /tmp', as one would usually expect, and as the documentation
+describes.
+
+This problem is fixed in the [3.6.1 beta
+release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.1-beta1.tar.Z).
+Users of 3.6.0 should specify the trailing slash to use the TEMP\_LARGE
+environment variable in make extra\_test.
+
+------------------------------------------------------------------------
+
+Reported problems and workarounds are also available for some previous
+releases: [version 3.5](/software/netcdf/known_problems_35.html),
+[version 3.4](/software/netcdf/known_problems_34.html), [version
+3.3.1](/software/netcdf/known_problems_331.html), [version
+3.3](/software/netcdf/known_problems_330.html), [version
+2.4.3](/software/netcdf/known_problems_243.html), and [version
+2.4.2](/software/netcdf/known_problems_242.html).
diff --git a/docs/release.css b/docs/release.css
new file mode 100644
index 0000000..629b887
--- /dev/null
+++ b/docs/release.css
@@ -0,0 +1,29 @@
+.tabs {
+ width: 100% !important;
+}
+
+.tabs ul.tablist {
+ width: 100% !important;
+}
+
+.tabs ul.tablist li.linkMenu select#versions {
+ vertical-align: middle;
+ height: ;
+ margin: 8px 0 0 10px !important;
+ padding: 0;
+}
+
+.tabs ul.tablist li.searchForm {
+ float: right;
+ padding: 0;
+ margin: 0;
+}
+
+.tabs ul.tablist li.searchForm form#cse-search-box {
+ float: right;
+ margin: 8px 10px 0 0;
+}
+.tabs ul.tablist li.searchForm form#cse-search-box input#search {
+ border-radius: 5px;
+ margin: 0 5px 0 0;
+}
diff --git a/docs/release_header.html b/docs/release_header.html
new file mode 100644
index 0000000..a98c759
--- /dev/null
+++ b/docs/release_header.html
@@ -0,0 +1,93 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="http://www.unidata.ucar.edu/js/jquery/jquery-latest.min.js"></script>
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$mathjax
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+<script type="text/javascript">
+ $( document ).ready(function() {
+ var $searchForm = "<form name=\"google\" action=\"http://www.unidata.ucar.edu/search.jsp\" id=\"cse-search-box\">" +
+ " <input type=\"hidden\" name=\"locationName\" value=\"NetCDF Documentation\"></input>" +
+ " <input type=\"hidden\" name=\"hq\" value=\"site:www.unidata.ucar.edu/software/netcdf/docs\"></input>" +
+ " <input type=\"hidden\" name=\"cx\" value=\"008424664622949020059:afj38jxaljc\"></input>" +
+ " <input type=\"hidden\" name=\"cof\" value=\"FORID:9\"></input>" +
+ " <input type=\"hidden\" name=\"ie\" value=\"UTF-8\"></input>" +
+ " <input type=\"text\" autocomplete=\"on\" name=\"q\" maxlength=\"255\" id=\"search\"></input>" +
+ " <input type=\"submit\" name=\"sa\" value=\"search\" id=\"form_submit\"></input>" +
+ "</form>";
+
+ var $linkMenu = "<select id=\"versions\">" +
+ " <option value=\"http://www.unidata.ucar.edu/software/netcdf/docs\">Current</option>" +
+ " <option value=\"http://www.unidata.ucar.edu/software/netcdf/documentation/$projectnumber\">$projectnumber</option>" +
+ " <option value=\"http://www.unidata.ucar.edu/software/netcdf/documentation/historic\">Historic Documentation</option>" +
+ "</select>";
+
+ $("#navrow1 ul.tablist").append('<li class=\"linkMenu\"><span class="tab">' + $linkMenu + '</span></li>');
+ $("#navrow1 ul.tablist").append('<li class=\"searchForm\"><span class="tab">' + $searchForm + '</span></li>');
+
+ $("#versions").change(function() {
+ window.location.href = $(this).val();
+ });
+ });
+</script>
+</head>
+<body>
+ <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<!--BEGIN TITLEAREA-->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <!--BEGIN PROJECT_LOGO-->
+ <td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
+ <!--END PROJECT_LOGO-->
+ <!--BEGIN PROJECT_NAME-->
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname">$projectname
+ <!--BEGIN PROJECT_NUMBER--> <span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
+ </div>
+ <!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
+ </td>
+ <!--END PROJECT_NAME-->
+ <!--BEGIN !PROJECT_NAME-->
+ <!--BEGIN PROJECT_BRIEF-->
+ <td style="padding-left: 0.5em;">
+ <div id="projectbrief">$projectbrief</div>
+ </td>
+ <!--END PROJECT_BRIEF-->
+ <!--END !PROJECT_NAME-->
+ <!--BEGIN DISABLE_INDEX-->
+ <!--BEGIN SEARCHENGINE-->
+ <td>
+ <form name="google" action="http://www.unidata.ucar.edu/search.jsp" id="cse-search-box">
+ <input type="hidden" name="locationName" value="NetCDF Documentation"></input>
+ <input type="hidden" name="hq" value="site:www.unidata.ucar.edu/software/netcdf/docs">
+ <input type="hidden" name="cx" value="008424664622949020059:afj38jxaljc" />
+ <input type="hidden" name="cof" value="FORID:9" />
+ <input type="hidden" name="ie" value="UTF-8" />
+ <input type="text" autocomplete="on" name="q" maxlength="255" id="search"/>
+ <input type="submit" name="sa" value="search" id="form_submit" />
+ </form>
+ <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
+
+ </td>
+ <!--END SEARCHENGINE-->
+ <!--END DISABLE_INDEX-->
+ </tr>
+ </tbody>
+</table>
+</div>
+<!--END TITLEAREA-->
+<!-- end header part -->
diff --git a/docs/software.md b/docs/software.md
index 22f1047..cabb313 100644
--- a/docs/software.md
+++ b/docs/software.md
@@ -1,137 +1,14 @@
Software for Manipulating or Displaying NetCDF Data {#software}
===================================================
+[TOC]
+
This document provides references to software packages that may be used for manipulating or displaying [netCDF](/software/netcdf/) data. We include information about both freely-available and licensed (commercial) software that can be used with netCDF data. We rely on developers to help keep this list up-to-date. If you know of corrections or additions, please [send them to us (mailto:support at unidata.ucar.edu). Where practical, we would like to include WWW links to information about thes [...]
Other useful guides to utilities that can handle netCDF data include ARM's list of [ARM-tested netCDF data tools](http://science.arm.gov/%7ecflynn/ARM_Tested_Tools/), which includes some downloadable binaries and the NOAA Geophysical Fluid Dynamics Laboratory [guide to netCDF utilities](http://nomads.gfdl.noaa.gov/sandbox/products/vis/data/netcdf/GFDL_VG_NetCDF_Utils.html).
------------------------------------------------------------------------
-[Freely Available Software](#freely)
-------------------------------------
-
-- [ANDX (ARM NetCDF Data eXtract) and ANAX (ARM NetCDF ASCII
- eXtract)](#ANDX)
-
-- [ANTS (ARM NetCDF Tool Suite)](#ANTS)
-- [ARGOS (interActive thRee-dimensional Graphics ObServatory)](#ARGOS)
-- [CDAT (Climate Data Analysis Tool)](#CDAT)
-- [CDFconvert (Convert netCDF to RPN and GEMPAK Grids)](#CDFconvert)
-- [cdfsync (network synchronization of netCDF files)](#cdfsync)
-- [CDO (Climate Data Operators)](#CDO)
-- [CIDS Tools](#CIDS_Tools)
-- [CSIRO MATLAB/netCDF interface](#CSIRO-MATLAB)
-- [EPIC](#EPIC)
-- [Excel Use](#ExcelUse)
-- [EzGet](#EzGet)
-- [FAN (File Array Notation)](#FAN)
-- [FERRET](#FERRET)
-- [FIMEX (File Interpolation, Manipulation, and EXtraction)](#fimex)
-- [FWTools (GIS Binary Kit for Windows and Linux)](#fwtools)
-- [GDAL (Geospatial Data Abstraction Library)](#GDAL)
-- [GDL (GNU Data Language)](#GDL)
-- [Gfdnavi (Geophysical fluid data navigator)](#Gfdnavi)
-- [GMT (Generic Mapping Tools)](#GMT)
-- [Grace](#Grace)
-- [GrADS (Grid Analysis and Display System)](#GrADS)
-- [Gri](#Gri)
-- [GXSM - Gnome X Scanning Microscopy project](#GXSM)
-- [HDF (Hierarchical Data Format) interface](#HDF_interface)
-- [HDF-EOS to netCDF converter](#HDF-EOS)
-- [HIPHOP (Handy IDL-Program for HDF-Output Plotting)](#HIPHOP)
-- [HOPS (Hyperslab OPerator
- Suite)](#HOPS))
-- [iCDF (imports chromatographic netCDF data into MATLAB)](#iCDF)
-- [IDV (Integrated Data Viewer)](#IDV)
-- [Ingrid](#Ingrid)
-- [Intel Array Visualizer](#IntelArrayVisualizer)
-- [IVE (Interactive Visualization Environment)](#IVE)
-- [JSON format with the ncdump-json utility](#JSON)
-- [Java interface](#Java_interface)
-- [Kst (2D plotting tool)](#KST)
-- [Labview interface](#Labview-API)
-- [MBDyn (MultiBody Dynamics)](#MBDyn)
-- [Max_diff_nc](#Maxdiffnc)
-- [MeteoExplorer](#MeteoExplorer)
-- [MeteoInfo](#MeteoInfo)
-- [MexEPS (MATLAB interface)](#MexEPS)
-- [MEXNC and SNCTOOLS (a MATLAB interface)](#MEXNC)
-- [Mirone (Windows MATLAB-based display)](#Mirone)
-- [ncBrowse (netCDF File Browser)](#ncBrowse)
-- [nccmp (netCDF compare)](#nccmp)
-- [ncdx (netCDF for OpenDX)](#ncdx)
-- [ncensemble (command line utility to do ensemble
- statistics)](#ncensemble)
-- [NCL (NCAR Command Language)](#NCL)
-- [NCO (NetCDF Operators)](#NCO)
-- [ncregrid](#ncregrid)
-- [nctoolbox (a MATLAB common data model interface)](#nctoolbox)
-- [ncview](#ncview)
-- [NetCDF Toolbox for MATLAB-5](#matlab5)
-- [ncvtk](#ncvtk)
-- [netcdf tools](#netcdf_tools)
-- [netcdf4excel (add-in for MS Excel)](#netcdf4excel)
-- [NetCDF95 alternative Fortran API](#netcdf95)
-- [Objective-C interface](#Objective-C)
-- [Octave interface](#NCMEX)
-- [Octave interface (Barth)](#Octave)
-- [OPeNDAP (formerly DODS)](#OPeNDAP)
-- [OpenDX (formerly IBM Data Explorer)](#OpenDX)
-- [Panoply](#Panoply)
-- [Parallel-NetCDF](#Parallel-NetCDF)
-- [Paraview and vtkCSCSNetCDF](#Paraview)
-- [Perl interfaces](#Perl)
-- [PolyPaint+](#PolyPaint)
-- [Pomegranate](#pomegranate)
-- [Pupynere (PUre PYthon NEtcdf REader)](#pupynere)
-- [PyNGL and PyNIO](#PyNGL)
-- [Python interfaces](#Python)
-- [QGIS (Quantum GIS)](#QGIS)
-- [R interface](#R)
-- [Ruby interface](#Ruby)
-- [Scientific DataSet (SDS) Library](#SDS)
-- [Apache Spatial Information System (SIS)](#SIS)
-- [Tcl/Tk interfaces](#TclTk)
-- [Tcl-nap (N-dimensional array processor)](#Tcl-nap)
-- [Visual Basic and VB.net](#VB)
-- [VisAD](#VisAD)
-- [WebWinds](#WebWinds)
-- [xray (Python N-D labelled arrays)](#xray)
-- [Zebra](#Zebra)
-- [User-contributed software](#user)
-
-------------------------------------------------------------------------
-
-[Commercial or Licensed Packages](#commercial)
-----------------------------------------------
-
-- [ASA ViewNcDap](#ViewNcDap)
-- [Avizo](#Avizo)
-- [AVS](#AVS)
-- [Barrodale UFI](#BCS-UFI)
-- [DioVISTA/Storm](#DioVISTAStorm)
-- [EnSight](#EnSight)
-- [Environmental WorkBench](#Environmental_WorkBench)
-- [ESRI](#ESRI)
-- [FME](#FME)
-- [HDF Explorer](#HDF-Explorer)
-- [IDL Interface](#IDL)
-- [InterFormat](#InterFormat)
-- [IRIS Explorer Module](#IRIS_Explorer_Module)
-- [LeoNetCDF](#LeoNetCDF)
-- [Mathematica](#Mathematica)
-- [MATLAB](#MATLAB)
-- [Noesys](#Noesys)
-- [Origin](#Origin)
-- [PPLUS](#PPLUS)
-- [PV-Wave](#PV-Wave)
-- [Slicer Dicer](#SlicerDicer)
-- [Surfer](#Surfer)
-- [vGeo](#vGeo)
-- [VISAGE and Decimate](#VISAGE_and_Decimate)
-- [Voyager](#Voyager)
-
-
Freely Available Software {#freely}
=========================
@@ -1250,7 +1127,7 @@ command line operators that work on generic netCDF or HDF4 files:
- ncrename - renamer
- ncwa - weighted averager
-All operators may now be [OPeNDAP](www.opendao.org) clients. OPeNDAP
+All operators may now be [OPeNDAP](http://www.opendap.org) clients. OPeNDAP
enables network transparent data access to any OPeNDAP server. Thus
OPeNDAP-enabled NCO can operate on remote files accessible through any
OPeNDAP server without transferring the files. Only the required data
diff --git a/docs/windows-binaries.md b/docs/windows-binaries.md
index 59bf724..61fae65 100644
--- a/docs/windows-binaries.md
+++ b/docs/windows-binaries.md
@@ -32,14 +32,14 @@ The included dependencies and versions are as follows:
* `libcurl`: 7.35.0
* `zlib`: 1.2.8
-## Latest Release (netCDF-C 4.4.0-rc2) {#msvc-latest-release}
+## Latest Release (netCDF-C 4.4.0-rc3) {#msvc-latest-release}
Configuration | 32-bit | 64-bit |
:-------------------|:-------- |:-------|
-netCDF 3 | [netCDF4.4.0-rc2-NC3-32.exe][r1] | [netCDF4.4.0-rc2-NC3-64.exe][r6]
-netCDF3+DAP | [netCDF4.4.0-rc2-NC3-DAP-32.exe][r2] | [netCDF4.4.0-rc2-NC3-DAP-64.exe][r6]
-netCDF4 | [netCDF4.4.0-rc2-NC4-32.exe][r3] | [netCDF4.4.0-rc2-NC4-64.exe][r7]
-netCDF4+DAP | [netCDF4.4.0-rc2-NC4-DAP-32.exe][r4] | [netCDF4.4.0-rc2-NC4-DAP-64.exe][r8]
+netCDF 3 | [netCDF4.4.0-rc3-NC3-32.exe][r1] | [netCDF4.4.0-rc3-NC3-64.exe][r6]
+netCDF3+DAP | [netCDF4.4.0-rc3-NC3-DAP-32.exe][r2] | [netCDF4.4.0-rc3-NC3-DAP-64.exe][r6]
+netCDF4 | [netCDF4.4.0-rc3-NC4-32.exe][r3] | [netCDF4.4.0-rc3-NC4-64.exe][r7]
+netCDF4+DAP | [netCDF4.4.0-rc3-NC4-DAP-32.exe][r4] | [netCDF4.4.0-rc3-NC4-DAP-64.exe][r8]
# Using the netCDF-C Libraries with Visual Studio {#msvc-using}
@@ -60,11 +60,11 @@ When installed, the netCDF libraries are placed in the specified locations, alon
1. When building the netCDF-C libraries with netCDF4 support, using the `Debug` libraries may cause extraneous warnings. These warnings are related to cross-dll memory management, and appear to be harmless. You can safely ignore them by using the `Release` libraries. [NCF-220]
-[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC3-32.exe
-[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC3-DAP-32.exe
-[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC4-32.exe
-[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC4-DAP-32.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC3-64.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC3-DAP-64.exe
-[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC4-64.exe
-[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc2-NC4-DAP-64.exe
+[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC3-32.exe
+[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC3-DAP-32.exe
+[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC4-32.exe
+[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC4-DAP-32.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC3-64.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC3-DAP-64.exe
+[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC4-64.exe
+[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc3-NC4-DAP-64.exe
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in
index 600fa08..12593b7 100644
--- a/examples/C/Makefile.in
+++ b/examples/C/Makefile.in
@@ -474,6 +474,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -549,7 +552,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/examples/CDL/Makefile.in b/examples/CDL/Makefile.in
index d8fb05c..cc4d6f7 100644
--- a/examples/CDL/Makefile.in
+++ b/examples/CDL/Makefile.in
@@ -361,6 +361,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -436,7 +439,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 705f32d..adbd420 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -217,6 +217,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -292,7 +295,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/extra.css b/extra.css
new file mode 100644
index 0000000..629b887
--- /dev/null
+++ b/extra.css
@@ -0,0 +1,29 @@
+.tabs {
+ width: 100% !important;
+}
+
+.tabs ul.tablist {
+ width: 100% !important;
+}
+
+.tabs ul.tablist li.linkMenu select#versions {
+ vertical-align: middle;
+ height: ;
+ margin: 8px 0 0 10px !important;
+ padding: 0;
+}
+
+.tabs ul.tablist li.searchForm {
+ float: right;
+ padding: 0;
+ margin: 0;
+}
+
+.tabs ul.tablist li.searchForm form#cse-search-box {
+ float: right;
+ margin: 8px 10px 0 0;
+}
+.tabs ul.tablist li.searchForm form#cse-search-box input#search {
+ border-radius: 5px;
+ margin: 0 5px 0 0;
+}
diff --git a/h5_test/Makefile.in b/h5_test/Makefile.in
index 0ae9d62..530f0a8 100644
--- a/h5_test/Makefile.in
+++ b/h5_test/Makefile.in
@@ -547,6 +547,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -622,7 +625,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/include/Makefile.in b/include/Makefile.in
index 3d805d3..c5829ec 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -215,6 +215,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -290,7 +293,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/include/nc3internal.h b/include/nc3internal.h
index deb78a4..646452f 100644
--- a/include/nc3internal.h
+++ b/include/nc3internal.h
@@ -217,8 +217,8 @@ NC_findvar(const NC_vararray *ncap, const char *name, NC_var **varpp);
extern int
NC_check_vlen(NC_var *varp, size_t vlen_max);
-extern NC_var *
-NC_lookupvar(NC3_INFO* ncp, int varid);
+extern int
+NC_lookupvar(NC3_INFO* ncp, int varid, NC_var **varp);
/* End defined in var.c */
@@ -286,7 +286,7 @@ struct NC3_INFO {
fIsSet((ncp)->flags, NC_CREAT)
#define NC_indef(ncp) \
- (NC_IsNew(ncp) || fIsSet((ncp)->flags, NC_INDEF))
+ (NC_IsNew(ncp) || fIsSet((ncp)->flags, NC_INDEF))
#define set_NC_ndirty(ncp) \
fSet((ncp)->flags, NC_NDIRTY)
diff --git a/include/ncdispatch.h b/include/ncdispatch.h
index a42ad4e..32d985e 100644
--- a/include/ncdispatch.h
+++ b/include/ncdispatch.h
@@ -61,8 +61,7 @@
#define NC_DISPATCH_NC3 1
#define NC_DISPATCH_NC4 2
#define NC_DISPATCH_NCD 4
-#define NC_DISPATCH_NCR 8
-#define NC_DISPATCH_NC5 16
+#define NC_DISPATCH_NCP 8
/* Define a type for use when doing e.g. nc_get_vara_long, etc. */
@@ -123,8 +122,8 @@ extern int NCD2_initialize(void);
#endif
#ifdef USE_PNETCDF
-extern NC_Dispatch* NC5_dispatch_table;
-extern int NC5_initialize(void);
+extern NC_Dispatch* NCP_dispatch_table;
+extern int NCP_initialize(void);
#endif
#ifdef USE_NETCDF4
diff --git a/include/netcdf.h b/include/netcdf.h
index c17168e..bf714e1 100644
--- a/include/netcdf.h
+++ b/include/netcdf.h
@@ -145,7 +145,7 @@ extern "C" {
*/
#define NC_LOCK 0x0400
-/** Share updates, limit cacheing.
+/** Share updates, limit caching.
Use this in mode flags for both nc_create() and nc_open(). */
#define NC_SHARE 0x0800
@@ -410,7 +410,7 @@ by the desired type. */
#define NC_EMAPTYPE (-121) /**< Mapped access for atomic types only. */
#define NC_ELATEFILL (-122) /**< Attempt to define fill value when data already exists. */
#define NC_ELATEDEF (-123) /**< Attempt to define var properties, like deflate, after enddef. */
-#define NC_EDIMSCALE (-124) /**< Probem with HDF5 dimscales. */
+#define NC_EDIMSCALE (-124) /**< Problem with HDF5 dimscales. */
#define NC_ENOGRP (-125) /**< No group found. */
#define NC_ESTORAGE (-126) /**< Can't specify both contiguous and chunking. */
#define NC_EBADCHUNK (-127) /**< Bad chunksize. */
@@ -851,7 +851,7 @@ EXTERNL int
nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
float preemption);
-/* Set the per-variable cache size, nelems, and preemption policy. */
+/* Get the per-variable cache size, nelems, and preemption policy. */
EXTERNL int
nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
float *preemptionp);
@@ -1742,10 +1742,10 @@ nc_inq_base_pe(int ncid, int *pe);
EXTERNL int
nctypelen(nc_type datatype);
-/* Begin v2.4 backward compatiblity */
+/* Begin v2.4 backward compatibility */
/*
* defining NO_NETCDF_2 to the preprocessor
- * turns off backward compatiblity declarations.
+ * turns off backward compatibility declarations.
*/
#ifndef NO_NETCDF_2
@@ -1910,7 +1910,7 @@ ncrecget(int ncid, long recnum, void **datap);
EXTERNL int
ncrecput(int ncid, long recnum, void *const *datap);
-/* End v2.4 backward compatiblity */
+/* End v2.4 backward compatibility */
#endif /*!NO_NETCDF_2*/
#if defined(__cplusplus)
diff --git a/libdap2/Makefile.in b/libdap2/Makefile.in
index 944d0d3..78016cd 100644
--- a/libdap2/Makefile.in
+++ b/libdap2/Makefile.in
@@ -241,6 +241,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -316,7 +319,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/libdispatch/Makefile.in b/libdispatch/Makefile.in
index fc60515..0bc27bf 100644
--- a/libdispatch/Makefile.in
+++ b/libdispatch/Makefile.in
@@ -264,6 +264,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -339,7 +342,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/libdispatch/dcopy.c b/libdispatch/dcopy.c
index 3fe25af..f0a202f 100644
--- a/libdispatch/dcopy.c
+++ b/libdispatch/dcopy.c
@@ -3,7 +3,7 @@
This file has the var and att copy functions.
- "$Id: copy.c,v 1.1 2010/06/01 15:46:49 ed Exp $"
+ "$Id: copy.c,v 1.1 2010/06/01 15:46:49 ed Exp $"
*/
#include "ncdispatch.h"
@@ -13,13 +13,13 @@
/* Compare two netcdf types for equality. Must have the ncids as well,
to find user-defined types. */
static int
-NC_compare_nc_types(int ncid1, int typeid1, int ncid2, int typeid2,
+NC_compare_nc_types(int ncid1, int typeid1, int ncid2, int typeid2,
int *equalp)
{
int ret = NC_NOERR;
/* If you don't care about the answer, neither do I! */
- if(equalp == NULL)
+ if(equalp == NULL)
return NC_NOERR;
/* Assume the types are not equal. If we find any inequality, then
@@ -27,13 +27,13 @@ NC_compare_nc_types(int ncid1, int typeid1, int ncid2, int typeid2,
*equalp = 0;
/* Atomic types are so easy! */
- if (typeid1 <= NC_MAX_ATOMIC_TYPE)
+ if (typeid1 <= NC_MAX_ATOMIC_TYPE)
{
- if (typeid2 != typeid1)
+ if (typeid2 != typeid1)
return NC_NOERR;
*equalp = 1;
}
- else
+ else
{
int i, ret, equal1;
char name1[NC_MAX_NAME];
@@ -53,23 +53,23 @@ NC_compare_nc_types(int ncid1, int typeid1, int ncid2, int typeid2,
/* Find out about the two types. */
if ((ret = nc_inq_user_type(ncid1, typeid1, name1, &size1,
&base1, &nelems1, &class1)))
- return ret;
+ return ret;
if ((ret = nc_inq_user_type(ncid2, typeid2, name2, &size2,
&base2, &nelems2, &class2)))
- return ret;
+ return ret;
/* Check the obvious. */
if(size1 != size2 || class1 != class2 || strcmp(name1,name2))
return NC_NOERR;
/* Check user-defined types in detail. */
- switch(class1)
+ switch(class1)
{
case NC_VLEN:
if((ret = NC_compare_nc_types(ncid1, base1, ncid2,
base1, &equal1)))
return ret;
- if(!equal1)
+ if(!equal1)
return NC_NOERR;
break;
case NC_OPAQUE:
@@ -80,10 +80,12 @@ NC_compare_nc_types(int ncid1, int typeid1, int ncid2, int typeid2,
if (!(value1 = malloc(size1)))
return NC_ENOMEM;
- if (!(value2 = malloc(size2)))
- return NC_ENOMEM;
+ if (!(value2 = malloc(size2))) {
+ free(value1);
+ return NC_ENOMEM;
+ }
- for(i = 0; i < nelems1; i++)
+ for(i = 0; i < nelems1; i++)
{
if ((ret = nc_inq_enum_member(ncid1, typeid1, i, name1,
value1)) ||
@@ -91,39 +93,39 @@ NC_compare_nc_types(int ncid1, int typeid1, int ncid2, int typeid2,
value2)) ||
strcmp(name1, name2) || memcmp(value1, value2, size1))
{
- free(value1);
+ free(value1);
free(value2);
return ret;
}
}
- free(value1);
+ free(value1);
free(value2);
break;
case NC_COMPOUND:
- if(nelems1 != nelems2)
+ if(nelems1 != nelems2)
return NC_NOERR;
/* Compare each field. Each must be equal! */
- for(i = 0; i < nelems1; i++)
+ for(i = 0; i < nelems1; i++)
{
int j;
- if ((ret = nc_inq_compound_field(ncid1, typeid1, i, name1, &offset1,
+ if ((ret = nc_inq_compound_field(ncid1, typeid1, i, name1, &offset1,
&ftype1, &ndims1, dimsizes1)))
return ret;
if ((ret = nc_inq_compound_field(ncid2, typeid2, i, name2, &offset2,
&ftype2, &ndims2, dimsizes2)))
return ret;
- if(ndims1 != ndims2)
+ if(ndims1 != ndims2)
return NC_NOERR;
- for(j = 0; j < ndims1;j++)
- if(dimsizes1[j] != dimsizes2[j])
+ for(j = 0; j < ndims1;j++)
+ if(dimsizes1[j] != dimsizes2[j])
return NC_NOERR;
/* Compare user-defined field types. */
if((ret = NC_compare_nc_types(ncid1, ftype1, ncid2, ftype2,
&equal1)))
return ret;
- if(!equal1)
+ if(!equal1)
return NC_NOERR;
}
break;
@@ -145,7 +147,7 @@ NC_rec_find_nc_type(int ncid1, nc_type tid1, int ncid2, nc_type* tid2)
int* ids = NULL;
/* Get all types in grp ncid2 */
- if(tid2)
+ if(tid2)
*tid2 = 0;
if ((ret = nc_inq_typeids(ncid2, &nids, NULL)))
return ret;
@@ -155,22 +157,22 @@ NC_rec_find_nc_type(int ncid1, nc_type tid1, int ncid2, nc_type* tid2)
return NC_ENOMEM;
if ((ret = nc_inq_typeids(ncid2, &nids, ids)))
return ret;
- for(i = 0; i < nids; i++)
+ for(i = 0; i < nids; i++)
{
int equal = 0;
if ((ret = NC_compare_nc_types(ncid1, tid1, ncid2, ids[i], &equal)))
return ret;
- if(equal)
+ if(equal)
{
- if(tid2)
- *tid2 = ids[i];
+ if(tid2)
+ *tid2 = ids[i];
free(ids);
return NC_NOERR;
}
}
free(ids);
}
-
+
/* recurse */
if ((ret = nc_inq_grps(ncid1, &nids, NULL)))
return ret;
@@ -183,10 +185,10 @@ NC_rec_find_nc_type(int ncid1, nc_type tid1, int ncid2, nc_type* tid2)
free(ids);
return ret;
}
- for (i = 0; i < nids; i++)
+ for (i = 0; i < nids; i++)
{
ret = NC_rec_find_nc_type(ncid1, tid1, ids[i], tid2);
- if (ret && ret != NC_EBADTYPE)
+ if (ret && ret != NC_EBADTYPE)
break;
if (tid2 && *tid2 != 0) /* found */
{
@@ -207,13 +209,13 @@ NC_find_equal_type(int ncid1, nc_type xtype1, int ncid2, nc_type *xtype2)
int ret = NC_NOERR;
/* Check input */
- if(xtype1 <= NC_NAT)
+ if(xtype1 <= NC_NAT)
return NC_EINVAL;
/* Handle atomic types. */
- if (xtype1 <= NC_MAX_ATOMIC_TYPE)
+ if (xtype1 <= NC_MAX_ATOMIC_TYPE)
{
- if(xtype2)
+ if(xtype2)
*xtype2 = xtype1;
return NC_NOERR;
}
@@ -268,10 +270,10 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
int i;
/* Learn about this var. */
- if ((retval = nc_inq_var(ncid_in, varid_in, name, &xtype,
+ if ((retval = nc_inq_var(ncid_in, varid_in, name, &xtype,
&ndims, dimids_in, &natts)))
return retval;
- /* find corresponding dimids in the output file */
+ /* find corresponding dimids in the output file */
for(i = 0; i < ndims; i++) {
dimids_out[i] = dimids_in[i];
if ((retval = nc_inq_dimname(ncid_in, dimids_in[i], dimname_in)))
@@ -281,7 +283,7 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
}
#ifdef USE_NETCDF4
- LOG((2, "nc_copy_var: ncid_in 0x%x varid_in %d ncid_out 0x%x",
+ LOG((2, "nc_copy_var: ncid_in 0x%x varid_in %d ncid_out 0x%x",
ncid_in, varid_in, ncid_out));
#endif
@@ -315,7 +317,7 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
{
if ((retval = nc_inq_attname(ncid_in, varid_in, a, att_name)))
BAIL(retval);
- if ((retval = nc_copy_att(ncid_in, varid_in, att_name,
+ if ((retval = nc_copy_att(ncid_in, varid_in, att_name,
ncid_out, varid_out)))
BAIL(retval);
}
@@ -376,7 +378,7 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
if(dimlen) free(dimlen);
if(start) free(start);
return NC_ENOMEM;
- }
+ }
/* Copy the var data one record at a time. */
for (start[0]=0; !retval && start[0]<(size_t)dimlen[0]; start[0]++)
@@ -387,14 +389,14 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
retval = nc_get_vara_schar(ncid_in, varid_in, start, count,
(signed char *)data);
if (!retval)
- retval = nc_put_vara_schar(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_schar(ncid_out, varid_out, start, count,
(const signed char *)data);
break;
case NC_CHAR:
retval = nc_get_vara_text(ncid_in, varid_in, start, count,
(char *)data);
if (!retval)
- retval = nc_put_vara_text(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_text(ncid_out, varid_out, start, count,
(char *)data);
break;
case NC_SHORT:
@@ -422,49 +424,49 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
retval = nc_get_vara_double(ncid_in, varid_in, start, count,
(double *)data);
if (!retval)
- retval = nc_put_vara_double(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_double(ncid_out, varid_out, start, count,
(double *)data);
break;
case NC_UBYTE:
retval = nc_get_vara_uchar(ncid_in, varid_in, start, count,
(unsigned char *)data);
if (!retval)
- retval = nc_put_vara_uchar(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_uchar(ncid_out, varid_out, start, count,
(unsigned char *)data);
break;
case NC_USHORT:
retval = nc_get_vara_ushort(ncid_in, varid_in, start, count,
(unsigned short *)data);
if (!retval)
- retval = nc_put_vara_ushort(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_ushort(ncid_out, varid_out, start, count,
(unsigned short *)data);
break;
case NC_UINT:
retval = nc_get_vara_uint(ncid_in, varid_in, start, count,
(unsigned int *)data);
if (!retval)
- retval = nc_put_vara_uint(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_uint(ncid_out, varid_out, start, count,
(unsigned int *)data);
break;
case NC_INT64:
retval = nc_get_vara_longlong(ncid_in, varid_in, start, count,
(long long *)data);
if (!retval)
- retval = nc_put_vara_longlong(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_longlong(ncid_out, varid_out, start, count,
(long long *)data);
break;
case NC_UINT64:
retval = nc_get_vara_ulonglong(ncid_in, varid_in, start, count,
(unsigned long long *)data);
if (!retval)
- retval = nc_put_vara_ulonglong(ncid_out, varid_out, start, count,
+ retval = nc_put_vara_ulonglong(ncid_out, varid_out, start, count,
(unsigned long long *)data);
break;
default:
retval = NC_EBADTYPE;
}
}
-
+
exit:
if (data) free(data);
if (dimlen) free(dimlen);
@@ -474,25 +476,25 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
}
static int
-NC_copy_att(int ncid_in, int varid_in, const char *name,
+NC_copy_att(int ncid_in, int varid_in, const char *name,
int ncid_out, int varid_out)
{
nc_type xtype;
size_t len;
void *data=NULL;
int res;
-
- LOG((2, "nc_copy_att: ncid_in 0x%x varid_in %d name %s",
+
+ LOG((2, "nc_copy_att: ncid_in 0x%x varid_in %d name %s",
ncid_in, varid_in, name));
-
+
/* Find out about the attribute to be copied. */
if ((res = nc_inq_att(ncid_in, varid_in, name, &xtype, &len)))
return res;
-
- if (xtype < NC_STRING)
+
+ if (xtype < NC_STRING)
{
/* Handle non-string atomic types. */
- if (len)
+ if (len)
{
size_t size = NC_atomictypelen(xtype);
@@ -503,13 +505,13 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
res = nc_get_att(ncid_in, varid_in, name, data);
if (!res)
- res = nc_put_att(ncid_out, varid_out, name, xtype,
+ res = nc_put_att(ncid_out, varid_out, name, xtype,
len, data);
if (len)
free(data);
}
#ifdef USE_NETCDF4
- else if (xtype == NC_STRING)
+ else if (xtype == NC_STRING)
{
/* Copy string attributes. */
char **str_data;
@@ -517,12 +519,12 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
return NC_ENOMEM;
res = nc_get_att_string(ncid_in, varid_in, name, str_data);
if (!res)
- res = nc_put_att_string(ncid_out, varid_out, name, len,
+ res = nc_put_att_string(ncid_out, varid_out, name, len,
(const char **)str_data);
nc_free_string(len, str_data);
free(str_data);
- }
- else
+ }
+ else
{
/* Copy user-defined type attributes. */
int class;
@@ -535,28 +537,28 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
which we had to "duplicate" here */
if ((res = NC_find_equal_type(ncid_in, xtype, ncid_out, &xtype_out)))
return res;
- if (xtype_out)
+ if (xtype_out)
{
/* We found an equal type! */
- if ((res = nc_inq_user_type(ncid_in, xtype, NULL, &size,
+ if ((res = nc_inq_user_type(ncid_in, xtype, NULL, &size,
NULL, NULL, &class)))
return res;
if (class == NC_VLEN) /* VLENs are different... */
- {
+ {
nc_vlen_t *vldata;
int i;
if (!(vldata = malloc(sizeof(nc_vlen_t) * len)))
return NC_ENOMEM;
if ((res = nc_get_att(ncid_in, varid_in, name, vldata)))
return res;
- if ((res = nc_put_att(ncid_out, varid_out, name, xtype_out,
+ if ((res = nc_put_att(ncid_out, varid_out, name, xtype_out,
len, vldata)))
return res;
- for (i = 0; i < len; i++)
- if((res = nc_free_vlen(&vldata[i])))
+ for (i = 0; i < len; i++)
+ if((res = nc_free_vlen(&vldata[i])))
return res;
free(vldata);
- }
+ }
else /* not VLEN */
{
if (!(data = malloc(size * len)))
@@ -576,7 +578,7 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
Special programming challenge: this function must work even if one
of the other of the files is a netcdf version 1.0 file (i.e. not
- HDF5). So only use top level netcdf api functions.
+ HDF5). So only use top level netcdf api functions.
From the netcdf-3 docs: The output netCDF dataset should be in
define mode if the attribute to be copied does not already exist
@@ -584,7 +586,7 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
attribute to grow.
*/
int
-nc_copy_att(int ncid_in, int varid_in, const char *name,
+nc_copy_att(int ncid_in, int varid_in, const char *name,
int ncid_out, int varid_out)
{
int format, target_natts, target_attid;
@@ -594,11 +596,11 @@ nc_copy_att(int ncid_in, int varid_in, const char *name,
/* What is the destination format? */
if ((retval = nc_inq_format(ncid_out, &format)))
return retval;
-
+
/* Can't copy to same var in same file. */
if (ncid_in == ncid_out && varid_in == varid_out)
return NC_NOERR;
-
+
/* For classic model netCDF-4 files, order of attributes must be
* maintained during copies. We MUST MAINTAIN ORDER! */
if (format == NC_FORMAT_NETCDF4_CLASSIC)
@@ -620,7 +622,7 @@ nc_copy_att(int ncid_in, int varid_in, const char *name,
* off the hook. */
if (target_attid == target_natts - 1)
return NC_copy_att(ncid_in, varid_in, name, ncid_out, varid_out);
-
+
/* Order MUST BE MAINTAINED! Copy all existing atts in the target
* file, stopping at our target att. */
for (a = 0; a < target_natts; a++)
@@ -629,12 +631,12 @@ nc_copy_att(int ncid_in, int varid_in, const char *name,
{
if ((retval = NC_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)))
return retval;
- }
+ }
else
{
if ((retval = nc_inq_attname(ncid_out, varid_out, a, att_name)))
return retval;
- if ((retval = NC_copy_att(ncid_out, varid_out, att_name,
+ if ((retval = NC_copy_att(ncid_out, varid_out, att_name,
ncid_out, varid_out)))
return retval;
}
@@ -648,5 +650,3 @@ nc_copy_att(int ncid_in, int varid_in, const char *name,
return NC_NOERR;
}
-
-
diff --git a/libdispatch/ddispatch.c b/libdispatch/ddispatch.c
index c808212..6d7b346 100644
--- a/libdispatch/ddispatch.c
+++ b/libdispatch/ddispatch.c
@@ -21,10 +21,6 @@ static struct NCPROTOCOLLIST {
{"file",NULL,NC_DISPATCH_NCD},
{"dods","http",NC_DISPATCH_NCD},
{"dodss","https",NC_DISPATCH_NCD},
- {"cdmr","http",NC_DISPATCH_NCR|NC_DISPATCH_NC4},
- {"cdmrs","https",NC_DISPATCH_NCR|NC_DISPATCH_NC4},
- {"cdmremote","http",NC_DISPATCH_NCR|NC_DISPATCH_NC4},
- {"cdmremotes","https",NC_DISPATCH_NCR|NC_DISPATCH_NC4},
{NULL,NULL,0} /* Terminate search */
};
@@ -151,9 +147,6 @@ NC_urlmodel(const char* path)
} else if(ncurilookup(tmpurl,"netcdf3",NULL)
|| ncurilookup(tmpurl,"netcdf-3",NULL)) {
model = (NC_DISPATCH_NC3|NC_DISPATCH_NCD);
- } else if(ncurilookup(tmpurl,"cdmremote",NULL)
- || ncurilookup(tmpurl,"cdmr",NULL)) {
- model = (NC_DISPATCH_NCR|NC_DISPATCH_NC4);
}
if(model == 0) {
diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c
index 001bff0..1516224 100644
--- a/libdispatch/dfile.c
+++ b/libdispatch/dfile.c
@@ -1,11 +1,11 @@
-/** \file
+/** \file
File create and open functions
These functions end up calling functions in one of the dispatch layers
(netCDF-4, dap server, etc).
Copyright 2010 University Corporation for Atmospheric
-Research/Unidata. See COPYRIGHT file for more info.
+Research/Unidata. See COPYRIGHT file for more info.
*/
#include "config.h"
@@ -44,7 +44,7 @@ associated with a netCDF dataset.
Functions that deal with the netCDF library include:
- Get version of library.
-- Get error message corresponding to a returned error code.
+- Get error message corresponding to a returned error code.
The operations supported on a netCDF dataset as a single object are:
- Create, given dataset name and whether to overwrite or not.
@@ -106,7 +106,7 @@ NC_interpret_magic_number(char* magic, int* model, int* version, int use_paralle
#endif
else
{status = NC_ENOTNC; goto done;}
- *model = (use_parallel || *version == 5)?NC_DISPATCH_NC5:NC_DISPATCH_NC3;
+ *model = (use_parallel || *version == 5)?NC_DISPATCH_NCP:NC_DISPATCH_NC3;
} else
{status = NC_ENOTNC; goto done;}
done:
@@ -120,10 +120,13 @@ NC_check_file_type(const char *path, int flags, void *parameters,
char magic[MAGIC_NUMBER_LEN];
int status = NC_NOERR;
int diskless = ((flags & NC_DISKLESS) == NC_DISKLESS);
- int persist = ((flags & NC_WRITE) == NC_WRITE);
+
+ /* Unused, throws a 'value never read' in static analysis. */
+ //int persist = ((flags & NC_WRITE) == NC_WRITE);
+
int use_parallel = ((flags & NC_MPIIO) == NC_MPIIO);
int inmemory = (diskless && ((flags & NC_INMEMORY) == NC_INMEMORY));
-
+
*model = 0;
if(inmemory) {
@@ -141,7 +144,7 @@ NC_check_file_type(const char *path, int flags, void *parameters,
int retval;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
-
+
if(parameters != NULL) {
comm = ((NC_MPI_INFO*)parameters)->comm;
info = ((NC_MPI_INFO*)parameters)->info;
@@ -164,7 +167,7 @@ NC_check_file_type(const char *path, int flags, void *parameters,
#endif
if(path == NULL || strlen(path)==0)
{status = NC_EINVAL; goto done;}
-
+
if (!(fp = fopen(path, "r")))
{status = errno; goto done;}
@@ -177,7 +180,7 @@ NC_check_file_type(const char *path, int flags, void *parameters,
status = errno;
goto done;
}
-
+
if(st.st_size < MAGIC_NUMBER_LEN) {
fclose(fp);
status = NC_ENOTNC;
@@ -187,13 +190,13 @@ NC_check_file_type(const char *path, int flags, void *parameters,
i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
fclose(fp);
- if(i == 0)
+ if(i == 0)
{status = NC_ENOTNC; goto done;}
- if(i != 1)
+ if(i != 1)
{status = errno; goto done;}
}
} /* !inmemory */
-
+
/* Look at the magic number */
status = NC_interpret_magic_number(magic,model,version,use_parallel);
@@ -227,7 +230,7 @@ stored.
<h2>The cmode Flag</h2>
The cmode flag is used to control the type of file created, and some
-aspects of how it may be used.
+aspects of how it may be used.
Setting NC_NOCLOBBER means you do not want to clobber (overwrite) an
existing dataset; an error (NC_EEXIST) is returned if the specified
@@ -239,7 +242,7 @@ concurrently; it means that dataset accesses are not buffered and
caching is limited. Since the buffering scheme is optimized for
sequential access, programs that do not access data sequentially may
see some performance improvement by setting the NC_SHARE flag. This
-flag is ignored for netCDF-4 files.
+flag is ignored for netCDF-4 files.
Setting NC_64BIT_OFFSET causes netCDF to create a 64-bit offset format
file, instead of a netCDF classic format file. The 64-bit offset
@@ -407,7 +410,7 @@ nc_create(const char *path, int cmode, int *ncidp)
Create a netCDF file with some extra parameters controlling classic
file cacheing.
-Like nc_create(), this function creates a netCDF file.
+Like nc_create(), this function creates a netCDF file.
\param path The file name of the new netCDF dataset.
@@ -468,7 +471,7 @@ int
nc__create(const char *path, int cmode, size_t initialsz,
size_t *chunksizehintp, int *ncidp)
{
- return NC_create(path, cmode, initialsz, 0,
+ return NC_create(path, cmode, initialsz, 0,
chunksizehintp, 0, NULL, ncidp);
}
@@ -481,16 +484,16 @@ backward compatibility.
*/
int
-nc__create_mp(const char *path, int cmode, size_t initialsz,
+nc__create_mp(const char *path, int cmode, size_t initialsz,
int basepe, size_t *chunksizehintp, int *ncidp)
{
- return NC_create(path, cmode, initialsz, basepe,
+ return NC_create(path, cmode, initialsz, basepe,
chunksizehintp, 0, NULL, ncidp);
}
-/**
+/**
Open an existing netCDF file.
-
+
This function opens an existing netCDF dataset for access. It
determines the underlying file format automatically. Use the same call
to open a netCDF classic, 64-bit offset, or netCDF-4 file.
@@ -498,7 +501,7 @@ to open a netCDF classic, 64-bit offset, or netCDF-4 file.
\param path File name for netCDF dataset to be opened. When DAP
support is enabled, then the path may be an OPeNDAP URL rather than a
file path.
-
+
\param mode The mode flag may include NC_WRITE (for read/write
access) and NC_SHARE (see below) and NC_DISKLESS (see below).
@@ -561,7 +564,7 @@ improvement in this case.
It is not necessary to pass any information about the format of the
file being opened. The file type will be detected automatically by the
netCDF library.
-
+
If a the path is a DAP URL, then the open mode is read-only.
Setting NC_WRITE will be ignored.
@@ -594,10 +597,10 @@ named foo.nc for read-only, non-shared access:
@code
#include <netcdf.h>
- ...
+ ...
int status = NC_NOERR;
int ncid;
- ...
+ ...
status = nc_open("foo.nc", 0, &ncid);
if (status != NC_NOERR) handle_error(status);
@endcode
@@ -608,14 +611,14 @@ nc_open(const char *path, int mode, int *ncidp)
return NC_open(path, mode, 0, NULL, 0, NULL, ncidp);
}
-/**
+/**
Open a netCDF file with extra performance parameters for the classic
library.
\param path File name for netCDF dataset to be opened. When DAP
support is enabled, then the path may be an OPeNDAP URL rather than a
file path.
-
+
\param mode The mode flag may include NC_WRITE (for read/write
access) and NC_SHARE as in nc_open().
@@ -636,7 +639,7 @@ Because of internal requirements, the value may not be set to exactly
the value requested. The actual value chosen is returned by reference.
Using a NULL pointer or having the pointer point to the value
-NC_SIZEHINT_DEFAULT causes the library to choose a default.
+NC_SIZEHINT_DEFAULT causes the library to choose a default.
How the system chooses the default depends on the system. On
many systems, the "preferred I/O block size" is available from the
stat() system call, struct stat member st_blksize. If this is
@@ -663,11 +666,11 @@ int
nc__open(const char *path, int mode,
size_t *chunksizehintp, int *ncidp)
{
- return NC_open(path, mode, 0, chunksizehintp, 0,
+ return NC_open(path, mode, 0, chunksizehintp, 0,
NULL, ncidp);
}
-/**
+/**
Open a netCDF file with the contents taken from a block of memory.
\param path Must be non-null, but otherwise only used to set the dataset name.
@@ -675,7 +678,7 @@ Open a netCDF file with the contents taken from a block of memory.
\param mode the mode flags; Note that this procedure uses a limited set of flags because it forcibly sets NC_NOWRITE|NC_DISKLESS|NC_INMEMORY.
\param size The length of the block of memory being passed.
-
+
\param memory Pointer to the block of memory containing the contents
of a netcdf file.
@@ -699,15 +702,15 @@ example in that it assumes the contents of foo.nc have been read into memory.
@code
#include <netcdf.h>
#include <netcdf_mem.h>
- ...
+ ...
int status = NC_NOERR;
int ncid;
size_t size;
void* memory;
- ...
+ ...
size = <compute file size of foo.nc in bytes>;
memory = malloc(size);
- ...
+ ...
status = nc_open_mem("foo.nc", 0, size, memory, &ncid);
if (status != NC_NOERR) handle_error(status);
@endcode
@@ -728,7 +731,7 @@ nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp)
meminfo.memory = memory;
return NC_open(path, mode, 0, NULL, 0, &meminfo, ncidp);
#else
- return NC_EDISKLESS;
+ return NC_EDISKLESS;
#endif
}
@@ -741,14 +744,14 @@ backward compatibility.
*/
int
-nc__open_mp(const char *path, int mode, int basepe,
+nc__open_mp(const char *path, int mode, int basepe,
size_t *chunksizehintp, int *ncidp)
{
return NC_open(path, mode, basepe, chunksizehintp,
0, NULL, ncidp);
}
-/**
+/**
Get the file pathname (or the opendap URL) which was used to
open/create the ncid's file.
@@ -759,13 +762,13 @@ nc_create().
if NULL.
\param path Pointer where path name will be copied. Space must already
-be allocated. Ignored if NULL.
+be allocated. Ignored if NULL.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Invalid ncid passed.
*/
-int
+int
nc_inq_path(int ncid, size_t *pathlen, char *path)
{
NC* ncp;
@@ -819,14 +822,14 @@ named foo.nc and put it into define mode:
\code
#include <netcdf.h>
- ...
+ ...
int status = NC_NOERR;
int ncid;
- ...
-status = nc_open("foo.nc", NC_WRITE, &ncid);
+ ...
+status = nc_open("foo.nc", NC_WRITE, &ncid);
if (status != NC_NOERR) handle_error(status);
- ...
-status = nc_redef(ncid);
+ ...
+status = nc_redef(ncid);
if (status != NC_NOERR) handle_error(status);
\endcode
*/
@@ -861,7 +864,7 @@ For netCDF-4/HDF5 format files there are some variable settings (the
compression, endianness, fletcher32 error correction, and fill value)
which must be set (if they are going to be set at all) between the
nc_def_var() and the next nc_enddef(). Once the nc_enddef() is called,
-these settings can no longer be changed for a variable.
+these settings can no longer be changed for a variable.
\param ncid NetCDF ID, from a previous call to nc_open() or
nc_create().
@@ -887,10 +890,10 @@ netCDF dataset named foo.nc and put it into data mode:
...
status = nc_create("foo.nc", NC_NOCLOBBER, &ncid);
if (status != NC_NOERR) handle_error(status);
-
- ... create dimensions, variables, attributes
-
- status = nc_enddef(ncid);
+
+ ... create dimensions, variables, attributes
+
+ status = nc_enddef(ncid);
if (status != NC_NOERR) handle_error(status);
\endcode
*/
@@ -899,7 +902,7 @@ nc_enddef(int ncid)
{
int status = NC_NOERR;
NC *ncp;
- status = NC_check_id(ncid, &ncp);
+ status = NC_check_id(ncid, &ncp);
if(status != NC_NOERR) return status;
return ncp->dispatch->_enddef(ncid,0,1,0,1);
}
@@ -963,7 +966,7 @@ calculated from the sizes of the record variables. This unfortunate
fact prevents us from providing minfree and alignment control of the
"records" in a netcdf file. If you add a variable which has an
unlimited dimension, the third section will always be copied with the
-new variable added.
+new variable added.
\param ncid NetCDF ID, from a previous call to nc_open() or
nc_create().
@@ -986,7 +989,7 @@ variables).
*/
int
-nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree,
+nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree,
size_t r_align)
{
NC* ncp;
@@ -1101,13 +1104,13 @@ dataset named foo.nc:
status = nc_open("foo.nc", NC_WRITE, &ncid);
if (status != NC_NOERR) handle_error(status);
...
- status = nc_redef(ncid);
+ status = nc_redef(ncid);
if (status != NC_NOERR) handle_error(status);
...
status = nc_def_dim(ncid, "lat", 18L, &latid);
if (status != NC_NOERR) {
handle_error(status);
- status = nc_abort(ncid);
+ status = nc_abort(ncid);
if (status != NC_NOERR) handle_error(status);
}
\endcode
@@ -1129,7 +1132,7 @@ nc_abort(int ncid)
stat = ncp->dispatch->abort(ncid);
del_from_NCList(ncp);
free_NC(ncp);
- return stat;
+ return stat;
}
/**
@@ -1164,10 +1167,10 @@ netCDF dataset named foo.nc and release its netCDF ID:
...
status = nc_create("foo.nc", NC_NOCLOBBER, &ncid);
if (status != NC_NOERR) handle_error(status);
-
- ... create dimensions, variables, attributes
-
- status = nc_close(ncid);
+
+ ... create dimensions, variables, attributes
+
+ status = nc_close(ncid);
if (status != NC_NOERR) handle_error(status);
\endcode
@@ -1249,7 +1252,7 @@ The use of this feature may not be available (or even needed) in
future releases. Programmers are cautioned against heavy reliance upon
this feature.
-\param ncid NetCDF ID, from a previous call to nc_open() or
+\param ncid NetCDF ID, from a previous call to nc_open() or
nc_create().
\param fillmode Desired fill mode for the dataset, either ::NC_NOFILL or
@@ -1279,15 +1282,15 @@ writes of a netCDF dataset named foo.nc:
...
int ncid, status, old_fill_mode;
...
- status = nc_open("foo.nc", NC_WRITE, &ncid);
+ status = nc_open("foo.nc", NC_WRITE, &ncid);
if (status != NC_NOERR) handle_error(status);
-
+
... write data with default prefilling behavior
-
+
status = nc_set_fill(ncid, ::NC_NOFILL, &old_fill_mode);
if (status != NC_NOERR) handle_error(status);
-
- ... write data with no prefilling
+
+ ... write data with no prefilling
\endcode
*/
int
@@ -1345,7 +1348,7 @@ as presented by the API.
This function returns the (rarely needed) format version.
-\param ncid NetCDF ID, from a previous call to nc_open() or
+\param ncid NetCDF ID, from a previous call to nc_open() or
nc_create().
\param formatp Pointer to location for returned format version, one of
@@ -1376,7 +1379,7 @@ a netcdf file; it might be DAP, HDF4, or PNETCDF,
for example. This function returns that true file type.
It also returns the effective mode for the file.
-\param ncid NetCDF ID, from a previous call to nc_open() or
+\param ncid NetCDF ID, from a previous call to nc_open() or
nc_create().
\param formatp Pointer to location for returned true format.
@@ -1404,7 +1407,7 @@ nc_inq_format_extended(int ncid, int *formatp, int *modep)
Inquire about a file or group.
\param ncid NetCDF or group ID, from a previous call to nc_open(),
-nc_create(), nc_def_grp(), or associated inquiry functions such as
+nc_create(), nc_def_grp(), or associated inquiry functions such as
nc_inq_ncid().
\param ndimsp Pointer to location for returned number of dimensions
@@ -1419,7 +1422,7 @@ attributes defined for this netCDF dataset. Ignored if NULL.
\param unlimdimidp Pointer to location for returned ID of the
unlimited dimension, if there is one for this netCDF dataset. If no
unlimited length dimension has been defined, -1 is returned. Ignored
-if NULL. If there are multiple unlimited dimensions (possible only
+if NULL. If there are multiple unlimited dimensions (possible only
for netCDF-4 files), only a pointer to the first is returned, for
backward compatibility. If you want them all, use nc_inq_unlimids().
@@ -1472,7 +1475,7 @@ type, whether compound, opaque, enumeration, or variable length array.
For even more information about a user defined type nc_inq_user_type().
\param ncid The ncid for the group containing the type (ignored for
-atomic types).
+atomic types).
\param xtype The typeid for this type, as returned by nc_def_compound,
nc_def_opaque, nc_def_enum, nc_def_vlen, or nc_inq_var, or as found in
@@ -1507,7 +1510,7 @@ for which classic model has been turned on.
This example is from the test program tst_enums.c, and it uses all the
possible inquiry functions on an enum type.
-\code
+\code
if (nc_inq_user_type(ncid, typeids[0], name_in, &base_size_in, &base_nc_type_in,
&nfields_in, &class_in)) ERR;
if (strcmp(name_in, TYPE_NAME) || base_size_in != sizeof(int) ||
@@ -1523,7 +1526,7 @@ possible inquiry functions on an enum type.
if (nc_inq_enum_ident(ncid, typeid, member_value[i], name_in)) ERR;
if (strcmp(name_in, member_name[i])) ERR;
}
-
+
if (nc_close(ncid)) ERR;
\endcode
*/
@@ -1581,8 +1584,8 @@ stored.
\returns ::NC_NOERR No error.
*/
int
-NC_create(const char *path, int cmode, size_t initialsz,
- int basepe, size_t *chunksizehintp, int useparallel,
+NC_create(const char *path, int cmode, size_t initialsz,
+ int basepe, size_t *chunksizehintp, int useparallel,
void* parameters, int *ncidp)
{
int stat = NC_NOERR;
@@ -1599,7 +1602,7 @@ NC_create(const char *path, int cmode, size_t initialsz,
if(!nc_initialized)
{
if ((stat = NC_initialize()))
- return stat;
+ return stat;
/* Do local initialization */
nc_local_initialize();
nc_initialized = 1;
@@ -1609,7 +1612,7 @@ NC_create(const char *path, int cmode, size_t initialsz,
/* If this path is already open, then fail */
ncp = find_in_NCList_by_name(path);
if(ncp != NULL)
- return NC_ENFILE;
+ return NC_ENFILE;
#endif
if((isurl = NC_testurl(path)))
@@ -1624,7 +1627,7 @@ NC_create(const char *path, int cmode, size_t initialsz,
#endif
#ifdef USE_PNETCDF
if(cmode & NC_PNETCDF)
- model = NC_DISPATCH_NC5;
+ model = NC_DISPATCH_NCP;
else
#endif
if(cmode & NC_CLASSIC_MODEL)
@@ -1654,7 +1657,7 @@ NC_create(const char *path, int cmode, size_t initialsz,
break;
}
}
-
+
/* Add inferred flags */
cmode |= xcmode;
@@ -1683,8 +1686,8 @@ NC_create(const char *path, int cmode, size_t initialsz,
else
#endif
#ifdef USE_PNETCDF
- if(model == (NC_DISPATCH_NC5))
- dispatcher = NC5_dispatch_table;
+ if(model == (NC_DISPATCH_NCP))
+ dispatcher = NCP_dispatch_table;
else
#endif
if(model == (NC_DISPATCH_NC3))
@@ -1743,7 +1746,7 @@ NC_open(const char *path, int cmode,
int inmemory = ((cmode & NC_INMEMORY) == NC_INMEMORY);
/* Need pieces of information for now to decide model*/
int model = 0;
- int isurl = 0;
+ int isurl = 0;
int version = 0;
int flags = 0;
@@ -1760,7 +1763,7 @@ NC_open(const char *path, int cmode,
ncp = find_in_NCList_by_name(path);
if(ncp != NULL) {
ncp->refcount++;
- if(ncidp) *ncidp = ncp->ext_ncid;
+ if(ncidp) *ncidp = ncp->ext_ncid;
return NC_NOERR;
}
#endif
@@ -1794,10 +1797,10 @@ NC_open(const char *path, int cmode,
else if(model & NC_DISPATCH_NC3) {
cmode &= ~NC_NETCDF4; /* must be netcdf-3 */
if(version == 2) cmode |= NC_64BIT_OFFSET;
- } else if(model & NC_DISPATCH_NC5) {
+ } else if(model & NC_DISPATCH_NCP) {
#if 0
It appears that pnetcdf can read NC_64_BIT_OFFSET
- cmode &= ~(NC_NETCDF4 | NC_64BIT_OFFSET); /* must be pnetcdf */
+ cmode &= ~(NC_NETCDF4 | NC_64BIT_OFFSET); /* must be pnetcdf */
#else
cmode &= ~(NC_NETCDF4);
#endif
@@ -1823,8 +1826,8 @@ It appears that pnetcdf can read NC_64_BIT_OFFSET
else
#endif
#if defined(USE_PNETCDF)
- if(model == (NC_DISPATCH_NC5))
- dispatcher = NC5_dispatch_table;
+ if(model == (NC_DISPATCH_NCP))
+ dispatcher = NCP_dispatch_table;
else
#endif
#if defined(USE_NETCDF4)
@@ -1891,5 +1894,3 @@ nc__pseudofd(void)
}
return pseudofd++;
}
-
-
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index ef7925f..9f4b00e 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -10,7 +10,7 @@ IF(USE_HDF5 OR USE_NETCDF4)
ENDIF()
IF(USE_PNETCDF)
- SET(liblib_LIBS ${liblib_LIBS} netcdf5)
+ SET(liblib_LIBS ${liblib_LIBS} netcdfp)
ENDIF()
IF(USE_DAP)
diff --git a/liblib/Makefile.am b/liblib/Makefile.am
index 9b5df4f..b390d69 100755
--- a/liblib/Makefile.am
+++ b/liblib/Makefile.am
@@ -43,8 +43,8 @@ libnetcdf_la_LIBADD += ${top_builddir}/libdispatch/libdispatch.la \
# + pnetcdf
if USE_PNETCDF
-AM_CPPFLAGS += -I${top_srcdir}/libsrc5
-libnetcdf_la_LIBADD += ${top_builddir}/libsrc5/libnetcdf5.la
+AM_CPPFLAGS += -I${top_srcdir}/libsrcp
+libnetcdf_la_LIBADD += ${top_builddir}/libsrcp/libnetcdfp.la
endif # USE_PNETCDF
# + dap
diff --git a/liblib/Makefile.in b/liblib/Makefile.in
index 819228a..bd7464f 100644
--- a/liblib/Makefile.in
+++ b/liblib/Makefile.in
@@ -117,8 +117,8 @@ target_triplet = @target@
@BUILD_V2_TRUE at am__append_5 = ${top_builddir}/libdispatch/libnetcdf2.la
# + pnetcdf
- at USE_PNETCDF_TRUE@am__append_6 = -I${top_srcdir}/libsrc5
- at USE_PNETCDF_TRUE@am__append_7 = ${top_builddir}/libsrc5/libnetcdf5.la
+ at USE_PNETCDF_TRUE@am__append_6 = -I${top_srcdir}/libsrcp
+ at USE_PNETCDF_TRUE@am__append_7 = ${top_builddir}/libsrcp/libnetcdfp.la
# + dap
@USE_DAP_TRUE at am__append_8 = -I${top_srcdir}/libdap2 -I${top_srcdir}/oc
@@ -281,6 +281,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -356,7 +359,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/liblib/stub.c b/liblib/stub.c
index cfdd9e1..58c39fc 100644
--- a/liblib/stub.c
+++ b/liblib/stub.c
@@ -23,7 +23,7 @@ extern int NCCR_initialize(void);
#endif
#ifdef USE_PNETCDF
-extern int NC5_initialize(void);
+extern int NCP_initialize(void);
#endif
/**
@@ -51,7 +51,7 @@ NC_initialize(void)
#endif
#ifdef USE_PNETCDF
- if((stat = NC5_initialize())) return stat;
+ if((stat = NCP_initialize())) return stat;
#endif
#ifdef USE_NETCDF4
diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt
index c2e87c2..6579773 100644
--- a/libsrc/CMakeLists.txt
+++ b/libsrc/CMakeLists.txt
@@ -9,7 +9,8 @@ IF(HAVE_M4)
ENDIF()
endforeach(f)
-SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c lookup3.c ncio.c)
+SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c
+ nc3internal.c var.c dim.c ncx.c lookup3.c ncio.c)
SET(libsrc_SOURCES ${libsrc_SOURCES} pstdint.h)
IF (BUILD_DISKLESS)
diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am
index 6ef6efc..6814aef 100644
--- a/libsrc/Makefile.am
+++ b/libsrc/Makefile.am
@@ -30,7 +30,11 @@ endif BUILD_DISKLESS
if USE_FFIO
libnetcdf3_la_SOURCES += ffio.c
else !USE_FFIO
+if USE_STDIO
+libnetcdf3_la_SOURCES += ncstdio.c
+else !USE_STDIO
libnetcdf3_la_SOURCES += posixio.c
+endif !USE_STDIO
endif !USE_FFIO
noinst_LTLIBRARIES = libnetcdf3.la
@@ -39,14 +43,14 @@ noinst_LTLIBRARIES = libnetcdf3.la
# with m4), but they are included in the distribution so that the user
# does not have to have m4.
MAINTAINERCLEANFILES = $(man_MANS) attrx.c putgetx.c
-EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
+EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
# This tells make how to turn .m4 files into .c files.
.m4.c:
m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >$@
# The C API man page.
-man_MANS = netcdf.3
+man_MANS = netcdf.3
# Decide what goes in the man page, based on user configure options.
ARGS_MANPAGE = -DAPI=C
@@ -61,7 +65,5 @@ ARGS_MANPAGE += -DPARALLEL_IO=TRUE
endif
# This rule generates the C manpage.
-netcdf.3: $(top_srcdir)/docs/netcdf.m4
+netcdf.3: $(top_srcdir)/docs/netcdf.m4
m4 $(M4FLAGS) $(ARGS_MANPAGE) $? >$@ || rm $@
-
-
diff --git a/libsrc/Makefile.in b/libsrc/Makefile.in
index 826425a..9c2d56f 100644
--- a/libsrc/Makefile.in
+++ b/libsrc/Makefile.in
@@ -115,10 +115,11 @@ target_triplet = @target@
# Does the user want to use ffio, a replacement for posixio for Cray
# computers?
@USE_FFIO_TRUE at am__append_6 = ffio.c
- at USE_FFIO_FALSE@am__append_7 = posixio.c
- at USE_NETCDF4_TRUE@am__append_8 = -DNETCDF4=TRUE
- at BUILD_DAP_TRUE@am__append_9 = -DDAP=TRUE
- at BUILD_PARALLEL_TRUE@am__append_10 = -DPARALLEL_IO=TRUE
+ at USE_FFIO_FALSE@@USE_STDIO_TRUE at am__append_7 = ncstdio.c
+ at USE_FFIO_FALSE@@USE_STDIO_FALSE at am__append_8 = posixio.c
+ at USE_NETCDF4_TRUE@am__append_9 = -DNETCDF4=TRUE
+ at BUILD_DAP_TRUE@am__append_10 = -DDAP=TRUE
+ at BUILD_PARALLEL_TRUE@am__append_11 = -DPARALLEL_IO=TRUE
subdir = libsrc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -136,19 +137,22 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
libnetcdf3_la_LIBADD =
am__libnetcdf3_la_SOURCES_DIST = v1hpg.c putget.c attr.c nc3dispatch.c \
nc3internal.c var.c dim.c ncx.c ncx.h lookup3.c pstdint.h \
- ncio.c ncio.h memio.c mmapio.c ffio.c posixio.c
+ ncio.c ncio.h memio.c mmapio.c ffio.c ncstdio.c posixio.c
@BUILD_DISKLESS_TRUE at am__objects_1 = libnetcdf3_la-memio.lo
@BUILD_DISKLESS_TRUE@@BUILD_MMAP_TRUE at am__objects_2 = \
@BUILD_DISKLESS_TRUE@@BUILD_MMAP_TRUE@ libnetcdf3_la-mmapio.lo
@USE_FFIO_TRUE at am__objects_3 = libnetcdf3_la-ffio.lo
- at USE_FFIO_FALSE@am__objects_4 = libnetcdf3_la-posixio.lo
+ at USE_FFIO_FALSE@@USE_STDIO_TRUE at am__objects_4 = \
+ at USE_FFIO_FALSE@@USE_STDIO_TRUE@ libnetcdf3_la-ncstdio.lo
+ at USE_FFIO_FALSE@@USE_STDIO_FALSE at am__objects_5 = \
+ at USE_FFIO_FALSE@@USE_STDIO_FALSE@ libnetcdf3_la-posixio.lo
am_libnetcdf3_la_OBJECTS = libnetcdf3_la-v1hpg.lo \
libnetcdf3_la-putget.lo libnetcdf3_la-attr.lo \
libnetcdf3_la-nc3dispatch.lo libnetcdf3_la-nc3internal.lo \
libnetcdf3_la-var.lo libnetcdf3_la-dim.lo libnetcdf3_la-ncx.lo \
libnetcdf3_la-lookup3.lo libnetcdf3_la-ncio.lo \
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
- $(am__objects_4)
+ $(am__objects_4) $(am__objects_5)
libnetcdf3_la_OBJECTS = $(am_libnetcdf3_la_OBJECTS)
AM_V_lt = $(am__v_lt_ at AM_V@)
am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -276,6 +280,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -351,7 +358,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
@@ -421,21 +427,21 @@ libnetcdf3_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_3)
libnetcdf3_la_SOURCES = v1hpg.c putget.c attr.c nc3dispatch.c \
nc3internal.c var.c dim.c ncx.c ncx.h lookup3.c pstdint.h \
ncio.c ncio.h $(am__append_4) $(am__append_5) $(am__append_6) \
- $(am__append_7)
+ $(am__append_7) $(am__append_8)
noinst_LTLIBRARIES = libnetcdf3.la
# These files are cleaned on developer workstations (and then rebuilt
# with m4), but they are included in the distribution so that the user
# does not have to have m4.
MAINTAINERCLEANFILES = $(man_MANS) attrx.c putgetx.c
-EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
+EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
# The C API man page.
-man_MANS = netcdf.3
+man_MANS = netcdf.3
# Decide what goes in the man page, based on user configure options.
-ARGS_MANPAGE = -DAPI=C $(am__append_8) $(am__append_9) \
- $(am__append_10)
+ARGS_MANPAGE = -DAPI=C $(am__append_9) $(am__append_10) \
+ $(am__append_11)
all: all-am
.SUFFIXES:
@@ -500,6 +506,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc3dispatch.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc3internal.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncstdio.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncx.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-posixio.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-putget.Plo at am__quote@
@@ -621,6 +628,13 @@ libnetcdf3_la-ffio.lo: ffio.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdf3_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetcdf3_la-ffio.lo `test -f 'ffio.c' || echo '$(srcdir)/'`ffio.c
+libnetcdf3_la-ncstdio.lo: ncstdio.c
+ at am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdf3_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetcdf3_la-ncstdio.lo -MD -MP -MF $(DEPDIR)/libnetcdf3_la-ncstdio.Tpo -c -o libnetcdf3_la-ncstdio.lo `test -f 'ncstdio.c' || echo '$(srcdir)/'`ncstdio.c
+ at am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdf3_la-ncstdio.Tpo $(DEPDIR)/libnetcdf3_la-ncstdio.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ncstdio.c' object='libnetcdf3_la-ncstdio.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdf3_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetcdf3_la-ncstdio.lo `test -f 'ncstdio.c' || echo '$(srcdir)/'`ncstdio.c
+
libnetcdf3_la-posixio.lo: posixio.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdf3_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetcdf3_la-posixio.lo -MD -MP -MF $(DEPDIR)/libnetcdf3_la-posixio.Tpo -c -o libnetcdf3_la-posixio.lo `test -f 'posixio.c' || echo '$(srcdir)/'`posixio.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdf3_la-posixio.Tpo $(DEPDIR)/libnetcdf3_la-posixio.Plo
@@ -895,7 +909,7 @@ uninstall-man: uninstall-man3
m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >$@
# This rule generates the C manpage.
-netcdf.3: $(top_srcdir)/docs/netcdf.m4
+netcdf.3: $(top_srcdir)/docs/netcdf.m4
m4 $(M4FLAGS) $(ARGS_MANPAGE) $? >$@ || rm $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/libsrc/attr.c b/libsrc/attr.c
index 3c1c668..22a961d 100644
--- a/libsrc/attr.c
+++ b/libsrc/attr.c
@@ -1,4 +1,6 @@
+#line 5 "attr.m4"
/* Do not edit this file. It is produced from the corresponding .m4 source */
+#line 7
/*
* Copyright 1996, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
@@ -611,367 +613,704 @@ NC3_del_att(int ncid, int varid, const char *uname)
return NC_NOERR;
}
+#line 674
static int
+#line 675
ncx_pad_putn_Iuchar(void **xpp, size_t nelems, const uchar *tp, nc_type type)
+#line 675
{
+#line 675
switch(type) {
+#line 675
case NC_CHAR:
+#line 675
return NC_ECHAR;
+#line 675
case NC_BYTE:
+#line 675
return ncx_pad_putn_schar_uchar(xpp, nelems, tp);
+#line 675
case NC_SHORT:
+#line 675
return ncx_pad_putn_short_uchar(xpp, nelems, tp);
+#line 675
case NC_INT:
+#line 675
return ncx_putn_int_uchar(xpp, nelems, tp);
+#line 675
case NC_FLOAT:
+#line 675
return ncx_putn_float_uchar(xpp, nelems, tp);
+#line 675
case NC_DOUBLE:
+#line 675
return ncx_putn_double_uchar(xpp, nelems, tp);
+#line 675
default:
+#line 675
assert("ncx_pad_putn_Iuchar invalid type" == 0);
+#line 675
}
+#line 675
return NC_EBADTYPE;
+#line 675
}
+#line 675
static int
+#line 676
ncx_pad_getn_Iuchar(const void **xpp, size_t nelems, uchar *tp, nc_type type)
+#line 676
{
+#line 676
switch(type) {
+#line 676
case NC_CHAR:
+#line 676
return NC_ECHAR;
+#line 676
case NC_BYTE:
+#line 676
return ncx_pad_getn_schar_uchar(xpp, nelems, tp);
+#line 676
case NC_SHORT:
+#line 676
return ncx_pad_getn_short_uchar(xpp, nelems, tp);
+#line 676
case NC_INT:
+#line 676
return ncx_getn_int_uchar(xpp, nelems, tp);
+#line 676
case NC_FLOAT:
+#line 676
return ncx_getn_float_uchar(xpp, nelems, tp);
+#line 676
case NC_DOUBLE:
+#line 676
return ncx_getn_double_uchar(xpp, nelems, tp);
+#line 676
default:
+#line 676
assert("ncx_pad_getn_Iuchar invalid type" == 0);
+#line 676
}
+#line 676
return NC_EBADTYPE;
+#line 676
}
+#line 676
static int
+#line 678
ncx_pad_putn_Ischar(void **xpp, size_t nelems, const schar *tp, nc_type type)
+#line 678
{
+#line 678
switch(type) {
+#line 678
case NC_CHAR:
+#line 678
return NC_ECHAR;
+#line 678
case NC_BYTE:
+#line 678
return ncx_pad_putn_schar_schar(xpp, nelems, tp);
+#line 678
case NC_SHORT:
+#line 678
return ncx_pad_putn_short_schar(xpp, nelems, tp);
+#line 678
case NC_INT:
+#line 678
return ncx_putn_int_schar(xpp, nelems, tp);
+#line 678
case NC_FLOAT:
+#line 678
return ncx_putn_float_schar(xpp, nelems, tp);
+#line 678
case NC_DOUBLE:
+#line 678
return ncx_putn_double_schar(xpp, nelems, tp);
+#line 678
default:
+#line 678
assert("ncx_pad_putn_Ischar invalid type" == 0);
+#line 678
}
+#line 678
return NC_EBADTYPE;
+#line 678
}
+#line 678
static int
+#line 679
ncx_pad_getn_Ischar(const void **xpp, size_t nelems, schar *tp, nc_type type)
+#line 679
{
+#line 679
switch(type) {
+#line 679
case NC_CHAR:
+#line 679
return NC_ECHAR;
+#line 679
case NC_BYTE:
+#line 679
return ncx_pad_getn_schar_schar(xpp, nelems, tp);
+#line 679
case NC_SHORT:
+#line 679
return ncx_pad_getn_short_schar(xpp, nelems, tp);
+#line 679
case NC_INT:
+#line 679
return ncx_getn_int_schar(xpp, nelems, tp);
+#line 679
case NC_FLOAT:
+#line 679
return ncx_getn_float_schar(xpp, nelems, tp);
+#line 679
case NC_DOUBLE:
+#line 679
return ncx_getn_double_schar(xpp, nelems, tp);
+#line 679
default:
+#line 679
assert("ncx_pad_getn_Ischar invalid type" == 0);
+#line 679
}
+#line 679
return NC_EBADTYPE;
+#line 679
}
+#line 679
static int
+#line 681
ncx_pad_putn_Ishort(void **xpp, size_t nelems, const short *tp, nc_type type)
+#line 681
{
+#line 681
switch(type) {
+#line 681
case NC_CHAR:
+#line 681
return NC_ECHAR;
+#line 681
case NC_BYTE:
+#line 681
return ncx_pad_putn_schar_short(xpp, nelems, tp);
+#line 681
case NC_SHORT:
+#line 681
return ncx_pad_putn_short_short(xpp, nelems, tp);
+#line 681
case NC_INT:
+#line 681
return ncx_putn_int_short(xpp, nelems, tp);
+#line 681
case NC_FLOAT:
+#line 681
return ncx_putn_float_short(xpp, nelems, tp);
+#line 681
case NC_DOUBLE:
+#line 681
return ncx_putn_double_short(xpp, nelems, tp);
+#line 681
default:
+#line 681
assert("ncx_pad_putn_Ishort invalid type" == 0);
+#line 681
}
+#line 681
return NC_EBADTYPE;
+#line 681
}
+#line 681
static int
+#line 682
ncx_pad_getn_Ishort(const void **xpp, size_t nelems, short *tp, nc_type type)
+#line 682
{
+#line 682
switch(type) {
+#line 682
case NC_CHAR:
+#line 682
return NC_ECHAR;
+#line 682
case NC_BYTE:
+#line 682
return ncx_pad_getn_schar_short(xpp, nelems, tp);
+#line 682
case NC_SHORT:
+#line 682
return ncx_pad_getn_short_short(xpp, nelems, tp);
+#line 682
case NC_INT:
+#line 682
return ncx_getn_int_short(xpp, nelems, tp);
+#line 682
case NC_FLOAT:
+#line 682
return ncx_getn_float_short(xpp, nelems, tp);
+#line 682
case NC_DOUBLE:
+#line 682
return ncx_getn_double_short(xpp, nelems, tp);
+#line 682
default:
+#line 682
assert("ncx_pad_getn_Ishort invalid type" == 0);
+#line 682
}
+#line 682
return NC_EBADTYPE;
+#line 682
}
+#line 682
static int
+#line 684
ncx_pad_putn_Iint(void **xpp, size_t nelems, const int *tp, nc_type type)
+#line 684
{
+#line 684
switch(type) {
+#line 684
case NC_CHAR:
+#line 684
return NC_ECHAR;
+#line 684
case NC_BYTE:
+#line 684
return ncx_pad_putn_schar_int(xpp, nelems, tp);
+#line 684
case NC_SHORT:
+#line 684
return ncx_pad_putn_short_int(xpp, nelems, tp);
+#line 684
case NC_INT:
+#line 684
return ncx_putn_int_int(xpp, nelems, tp);
+#line 684
case NC_FLOAT:
+#line 684
return ncx_putn_float_int(xpp, nelems, tp);
+#line 684
case NC_DOUBLE:
+#line 684
return ncx_putn_double_int(xpp, nelems, tp);
+#line 684
default:
+#line 684
assert("ncx_pad_putn_Iint invalid type" == 0);
+#line 684
}
+#line 684
return NC_EBADTYPE;
+#line 684
}
+#line 684
static int
+#line 685
ncx_pad_getn_Iint(const void **xpp, size_t nelems, int *tp, nc_type type)
+#line 685
{
+#line 685
switch(type) {
+#line 685
case NC_CHAR:
+#line 685
return NC_ECHAR;
+#line 685
case NC_BYTE:
+#line 685
return ncx_pad_getn_schar_int(xpp, nelems, tp);
+#line 685
case NC_SHORT:
+#line 685
return ncx_pad_getn_short_int(xpp, nelems, tp);
+#line 685
case NC_INT:
+#line 685
return ncx_getn_int_int(xpp, nelems, tp);
+#line 685
case NC_FLOAT:
+#line 685
return ncx_getn_float_int(xpp, nelems, tp);
+#line 685
case NC_DOUBLE:
+#line 685
return ncx_getn_double_int(xpp, nelems, tp);
+#line 685
default:
+#line 685
assert("ncx_pad_getn_Iint invalid type" == 0);
+#line 685
}
+#line 685
return NC_EBADTYPE;
+#line 685
}
+#line 685
static int
+#line 687
ncx_pad_putn_Ifloat(void **xpp, size_t nelems, const float *tp, nc_type type)
+#line 687
{
+#line 687
switch(type) {
+#line 687
case NC_CHAR:
+#line 687
return NC_ECHAR;
+#line 687
case NC_BYTE:
+#line 687
return ncx_pad_putn_schar_float(xpp, nelems, tp);
+#line 687
case NC_SHORT:
+#line 687
return ncx_pad_putn_short_float(xpp, nelems, tp);
+#line 687
case NC_INT:
+#line 687
return ncx_putn_int_float(xpp, nelems, tp);
+#line 687
case NC_FLOAT:
+#line 687
return ncx_putn_float_float(xpp, nelems, tp);
+#line 687
case NC_DOUBLE:
+#line 687
return ncx_putn_double_float(xpp, nelems, tp);
+#line 687
default:
+#line 687
assert("ncx_pad_putn_Ifloat invalid type" == 0);
+#line 687
}
+#line 687
return NC_EBADTYPE;
+#line 687
}
+#line 687
static int
+#line 688
ncx_pad_getn_Ifloat(const void **xpp, size_t nelems, float *tp, nc_type type)
+#line 688
{
+#line 688
switch(type) {
+#line 688
case NC_CHAR:
+#line 688
return NC_ECHAR;
+#line 688
case NC_BYTE:
+#line 688
return ncx_pad_getn_schar_float(xpp, nelems, tp);
+#line 688
case NC_SHORT:
+#line 688
return ncx_pad_getn_short_float(xpp, nelems, tp);
+#line 688
case NC_INT:
+#line 688
return ncx_getn_int_float(xpp, nelems, tp);
+#line 688
case NC_FLOAT:
+#line 688
return ncx_getn_float_float(xpp, nelems, tp);
+#line 688
case NC_DOUBLE:
+#line 688
return ncx_getn_double_float(xpp, nelems, tp);
+#line 688
default:
+#line 688
assert("ncx_pad_getn_Ifloat invalid type" == 0);
+#line 688
}
+#line 688
return NC_EBADTYPE;
+#line 688
}
+#line 688
static int
+#line 690
ncx_pad_putn_Idouble(void **xpp, size_t nelems, const double *tp, nc_type type)
+#line 690
{
+#line 690
switch(type) {
+#line 690
case NC_CHAR:
+#line 690
return NC_ECHAR;
+#line 690
case NC_BYTE:
+#line 690
return ncx_pad_putn_schar_double(xpp, nelems, tp);
+#line 690
case NC_SHORT:
+#line 690
return ncx_pad_putn_short_double(xpp, nelems, tp);
+#line 690
case NC_INT:
+#line 690
return ncx_putn_int_double(xpp, nelems, tp);
+#line 690
case NC_FLOAT:
+#line 690
return ncx_putn_float_double(xpp, nelems, tp);
+#line 690
case NC_DOUBLE:
+#line 690
return ncx_putn_double_double(xpp, nelems, tp);
+#line 690
default:
+#line 690
assert("ncx_pad_putn_Idouble invalid type" == 0);
+#line 690
}
+#line 690
return NC_EBADTYPE;
+#line 690
}
+#line 690
static int
+#line 691
ncx_pad_getn_Idouble(const void **xpp, size_t nelems, double *tp, nc_type type)
+#line 691
{
+#line 691
switch(type) {
+#line 691
case NC_CHAR:
+#line 691
return NC_ECHAR;
+#line 691
case NC_BYTE:
+#line 691
return ncx_pad_getn_schar_double(xpp, nelems, tp);
+#line 691
case NC_SHORT:
+#line 691
return ncx_pad_getn_short_double(xpp, nelems, tp);
+#line 691
case NC_INT:
+#line 691
return ncx_getn_int_double(xpp, nelems, tp);
+#line 691
case NC_FLOAT:
+#line 691
return ncx_getn_float_double(xpp, nelems, tp);
+#line 691
case NC_DOUBLE:
+#line 691
return ncx_getn_double_double(xpp, nelems, tp);
+#line 691
default:
+#line 691
assert("ncx_pad_getn_Idouble invalid type" == 0);
+#line 691
}
+#line 691
return NC_EBADTYPE;
+#line 691
}
+#line 691
#ifdef IGNORE
static int
+#line 694
ncx_pad_putn_Ilong(void **xpp, size_t nelems, const long *tp, nc_type type)
+#line 694
{
+#line 694
switch(type) {
+#line 694
case NC_CHAR:
+#line 694
return NC_ECHAR;
+#line 694
case NC_BYTE:
+#line 694
return ncx_pad_putn_schar_long(xpp, nelems, tp);
+#line 694
case NC_SHORT:
+#line 694
return ncx_pad_putn_short_long(xpp, nelems, tp);
+#line 694
case NC_INT:
+#line 694
return ncx_putn_int_long(xpp, nelems, tp);
+#line 694
case NC_FLOAT:
+#line 694
return ncx_putn_float_long(xpp, nelems, tp);
+#line 694
case NC_DOUBLE:
+#line 694
return ncx_putn_double_long(xpp, nelems, tp);
+#line 694
default:
+#line 694
assert("ncx_pad_putn_Ilong invalid type" == 0);
+#line 694
}
+#line 694
return NC_EBADTYPE;
+#line 694
}
+#line 694
static int
+#line 695
ncx_pad_getn_Ilong(const void **xpp, size_t nelems, long *tp, nc_type type)
+#line 695
{
+#line 695
switch(type) {
+#line 695
case NC_CHAR:
+#line 695
return NC_ECHAR;
+#line 695
case NC_BYTE:
+#line 695
return ncx_pad_getn_schar_long(xpp, nelems, tp);
+#line 695
case NC_SHORT:
+#line 695
return ncx_pad_getn_short_long(xpp, nelems, tp);
+#line 695
case NC_INT:
+#line 695
return ncx_getn_int_long(xpp, nelems, tp);
+#line 695
case NC_FLOAT:
+#line 695
return ncx_getn_float_long(xpp, nelems, tp);
+#line 695
case NC_DOUBLE:
+#line 695
return ncx_getn_double_long(xpp, nelems, tp);
+#line 695
default:
+#line 695
assert("ncx_pad_getn_Ilong invalid type" == 0);
+#line 695
}
+#line 695
return NC_EBADTYPE;
+#line 695
}
+#line 695
#endif
static int
+#line 698
ncx_pad_putn_Ilonglong(void **xpp, size_t nelems, const longlong *tp, nc_type type)
+#line 698
{
+#line 698
switch(type) {
+#line 698
case NC_CHAR:
+#line 698
return NC_ECHAR;
+#line 698
case NC_BYTE:
+#line 698
return ncx_pad_putn_schar_longlong(xpp, nelems, tp);
+#line 698
case NC_SHORT:
+#line 698
return ncx_pad_putn_short_longlong(xpp, nelems, tp);
+#line 698
case NC_INT:
+#line 698
return ncx_putn_int_longlong(xpp, nelems, tp);
+#line 698
case NC_FLOAT:
+#line 698
return ncx_putn_float_longlong(xpp, nelems, tp);
+#line 698
case NC_DOUBLE:
+#line 698
return ncx_putn_double_longlong(xpp, nelems, tp);
+#line 698
default:
+#line 698
assert("ncx_pad_putn_Ilonglong invalid type" == 0);
+#line 698
}
+#line 698
return NC_EBADTYPE;
+#line 698
}
+#line 698
static int
+#line 699
ncx_pad_getn_Ilonglong(const void **xpp, size_t nelems, longlong *tp, nc_type type)
+#line 699
{
+#line 699
switch(type) {
+#line 699
case NC_CHAR:
+#line 699
return NC_ECHAR;
+#line 699
case NC_BYTE:
+#line 699
return ncx_pad_getn_schar_longlong(xpp, nelems, tp);
+#line 699
case NC_SHORT:
+#line 699
return ncx_pad_getn_short_longlong(xpp, nelems, tp);
+#line 699
case NC_INT:
+#line 699
return ncx_getn_int_longlong(xpp, nelems, tp);
+#line 699
case NC_FLOAT:
+#line 699
return ncx_getn_float_longlong(xpp, nelems, tp);
+#line 699
case NC_DOUBLE:
+#line 699
return ncx_getn_double_longlong(xpp, nelems, tp);
+#line 699
default:
+#line 699
assert("ncx_pad_getn_Ilonglong invalid type" == 0);
+#line 699
}
+#line 699
return NC_EBADTYPE;
+#line 699
}
+#line 699
diff --git a/libsrc/memio.c b/libsrc/memio.c
index ac3be87..efcd097 100644
--- a/libsrc/memio.c
+++ b/libsrc/memio.c
@@ -97,9 +97,8 @@ static int memio_close(ncio* nciop, int);
static long pagesize = 0;
-/* Create a new ncio struct to hold info about the file. */
-static int
-memio_new(const char* path, int ioflags, off_t initialsize, void* memory, ncio** nciopp, NCMEMIO** memiop)
+/*! Create a new ncio struct to hold info about the file. */
+static int memio_new(const char* path, int ioflags, off_t initialsize, void* memory, ncio** nciopp, NCMEMIO** memiop)
{
int status = NC_NOERR;
ncio* nciop = NULL;
@@ -126,6 +125,14 @@ memio_new(const char* path, int ioflags, off_t initialsize, void* memory, ncio**
#endif
}
+ /* We need to catch errors.
+ sysconf, at least, can return a negative value
+ when there is an error. */
+ if(pagesize < 0) {
+ status = NC_EIO;
+ goto fail;
+ }
+
errno = 0;
/* Always force the allocated size to be a multiple of pagesize */
@@ -135,7 +142,7 @@ memio_new(const char* path, int ioflags, off_t initialsize, void* memory, ncio**
nciop = (ncio* )calloc(1,sizeof(ncio));
if(nciop == NULL) {status = NC_ENOMEM; goto fail;}
-
+
nciop->ioflags = ioflags;
*((int*)&nciop->fd) = -1; /* caller will fix */
@@ -146,7 +153,7 @@ memio_new(const char* path, int ioflags, off_t initialsize, void* memory, ncio**
*((ncio_filesizefunc**)&nciop->filesize) = memio_filesize;
*((ncio_pad_lengthfunc**)&nciop->pad_length) = memio_pad_length;
*((ncio_closefunc**)&nciop->close) = memio_close;
-
+
memio = (NCMEMIO*)calloc(1,sizeof(NCMEMIO));
if(memio == NULL) {status = NC_ENOMEM; goto fail;}
*((void* *)&nciop->pvt) = memio;
@@ -165,7 +172,7 @@ memio_new(const char* path, int ioflags, off_t initialsize, void* memory, ncio**
free(nciop);
}
if(inmemory) {
- memio->memory = memory;
+ memio->memory = memory;
} else {
/* malloc memory */
memio->memory = (char*)malloc(memio->alloc);
@@ -190,10 +197,10 @@ fail:
ioflags - flags from nc_create
initialsz - From the netcdf man page: "The argument
initialsize sets the initial size of the file at creation time."
- igeto -
- igetsz -
+ igeto -
+ igetsz -
sizehintp - the size of a page of data for buffered reads and writes.
- parameters - arbitrary data
+ parameters - arbitrary data
nciopp - pointer to a pointer that will get location of newly
created and inited ncio struct.
mempp - pointer to pointer to the initial memory read.
@@ -221,7 +228,7 @@ memio_create(const char* path, int ioflags,
if(persist) {
/* Open the file just tomake sure we can write it if needed */
- oflags = (persist ? O_RDWR : O_RDONLY);
+ oflags = (persist ? O_RDWR : O_RDONLY);
#ifdef O_BINARY
fSet(oflags, O_BINARY);
#endif
@@ -243,7 +250,7 @@ fprintf(stderr,"memio_create: initial memory: %lu/%lu\n",(unsigned long)memio->m
#endif
fd = nc__pseudofd();
- *((int* )&nciop->fd) = fd;
+ *((int* )&nciop->fd) = fd;
fSet(nciop->ioflags, NC_WRITE);
@@ -274,11 +281,11 @@ unwind_open:
ioflags - flags passed into nc_open.
igeto - looks like this function can do an initial page get, and
igeto is going to be the offset for that. But it appears to be
- unused
+ unused
igetsz - the size in bytes of initial page get (a.k.a. extent). Not
ever used in the library.
sizehintp - the size of a page of data for buffered reads and writes.
- parameters - arbitrary data
+ parameters - arbitrary data
nciopp - pointer to pointer that will get address of newly created
and inited ncio struct.
mempp - pointer to pointer to the initial memory read.
@@ -307,13 +314,13 @@ memio_open(const char* path,
return NC_EINVAL;
assert(sizehintp != NULL);
- sizehint = *sizehintp;
+ sizehint = *sizehintp;
if(inmemory) {
filesize = meminfo->size;
} else {
/* Open the file,and make sure we can write it if needed */
- oflags = (persist ? O_RDWR : O_RDONLY);
+ oflags = (persist ? O_RDWR : O_RDONLY);
#ifdef O_BINARY
fSet(oflags, O_BINARY);
#endif
@@ -345,7 +352,7 @@ memio_open(const char* path,
else
status = memio_new(path, ioflags, filesize, NULL, &nciop, &memio);
if(status != NC_NOERR) {
- if(fd >= 0)
+ if(fd >= 0)
close(fd);
return status;
}
@@ -371,10 +378,10 @@ fprintf(stderr,"memio_open: initial memory: %lu/%lu\n",(unsigned long)memio->mem
}
/* Use half the filesize as the blocksize ; why? */
- sizehint = filesize/2;
+ sizehint = filesize/2;
fd = nc__pseudofd();
- *((int* )&nciop->fd) = fd;
+ *((int* )&nciop->fd) = fd;
if(igetsz != 0)
{
@@ -397,7 +404,7 @@ unwind_open:
return status;
}
-/*
+/*
* Get file size in bytes.
*/
static int
@@ -451,29 +458,31 @@ fprintf(stderr,"realloc: %lu/%lu -> %lu/%lu\n",
#endif
memio->memory = newmem;
memio->alloc = newsize;
- }
+ }
memio->size = length;
return NC_NOERR;
}
-/* Write out any dirty buffers to disk and
- ensure that next read will get data from disk.
- Sync any changes, then close the open file associated with the ncio
- struct, and free its memory.
- nciop - pointer to ncio to close.
- doUnlink - if true, unlink file
+/*! Write out any dirty buffers to disk.
+
+ Write out any dirty buffers to disk and ensure that next read will get data from disk. Sync any changes, then close the open file associated with the ncio struct, and free its memory.
+
+ @param[in] nciop pointer to ncio to close.
+ @param[in] doUnlink if true, unlink file
+ @return NC_NOERR on success, error code on failure.
*/
-static int
+static int
memio_close(ncio* nciop, int doUnlink)
{
int status = NC_NOERR;
- NCMEMIO* memio;
+ NCMEMIO* memio ;
int fd = -1;
- int inmemory = (fIsSet(nciop->ioflags,NC_INMEMORY));
+ int inmemory = 0;
if(nciop == NULL || nciop->pvt == NULL) return NC_NOERR;
+ inmemory = (fIsSet(nciop->ioflags,NC_INMEMORY));
memio = (NCMEMIO*)nciop->pvt;
assert(memio != NULL);
@@ -507,7 +516,7 @@ done:
if(!inmemory && memio->memory != NULL)
free(memio->memory);
/* do cleanup */
- if(fd >= 0) (void)close(fd);
+ if(fd >= 0) (void)close(fd);
if(memio != NULL) free(memio);
if(nciop->path != NULL) free((char*)nciop->path);
free(nciop);
diff --git a/libsrc/ncio.c b/libsrc/ncio.c
index 60377d8..f46e28f 100644
--- a/libsrc/ncio.c
+++ b/libsrc/ncio.c
@@ -19,6 +19,9 @@
extern int posixio_create(const char*,int,size_t,off_t,size_t,size_t*,void*,ncio**,void** const);
extern int posixio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
+extern int stdio_create(const char*,int,size_t,off_t,size_t,size_t*,void*,ncio**,void** const);
+extern int stdio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
+
#ifdef USE_FFIO
extern int ffio_create(const char*,int,size_t,off_t,size_t,size_t*,void*,ncio**,void** const);
extern int ffio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
@@ -50,7 +53,9 @@ ncio_create(const char *path, int ioflags, size_t initialsz,
}
#endif
-#ifdef USE_FFIO
+#ifdef USE_STDIO
+ return stdio_create(path,ioflags,initialsz,igeto,igetsz,sizehintp,parameters,iopp,mempp);
+#elif defined(USE_FFIO)
return ffio_create(path,ioflags,initialsz,igeto,igetsz,sizehintp,parameters,iopp,mempp);
#else
return posixio_create(path,ioflags,initialsz,igeto,igetsz,sizehintp,parameters,iopp,mempp);
@@ -76,7 +81,9 @@ ncio_open(const char *path, int ioflags,
return memio_open(path,ioflags,igeto,igetsz,sizehintp,parameters,iopp,mempp);
}
#endif
-#ifdef USE_FFIO
+#ifdef USE_STDIO
+ return stdio_open(path,ioflags,igeto,igetsz,sizehintp,parameters,iopp,mempp);
+#elif defined(USE_FFIO)
return ffio_open(path,ioflags,igeto,igetsz,sizehintp,parameters,iopp,mempp);
#else
return posixio_open(path,ioflags,igeto,igetsz,sizehintp,parameters,iopp,mempp);
diff --git a/libsrc/ncx.c b/libsrc/ncx.c
index d1644d5..31f53f9 100644
--- a/libsrc/ncx.c
+++ b/libsrc/ncx.c
@@ -1,8 +1,10 @@
+#line 11 "ncx.m4"
/* Do not edit this file. It is produced from the corresponding .m4 source */
+#line 13
/*
* Copyright 1996, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
- *
+ *
* This file contains some routines derived from code
* which is copyrighted by Sun Microsystems, Inc.
* The "#ifdef vax" versions of
@@ -133,7 +135,7 @@ swapn2b(void *dst, const void *src, size_t nn)
* {
* *op++ = *(++ip);
* *op++ = *(ip++ -1);
- * }
+ * }
*/
while(nn > 3)
{
@@ -155,15 +157,22 @@ swapn2b(void *dst, const void *src, size_t nn)
}
# ifndef vax
-static void
+void
swap4b(void *dst, const void *src)
{
- char *op = dst;
- const char *ip = src;
- op[0] = ip[3];
- op[1] = ip[2];
- op[2] = ip[1];
- op[3] = ip[0];
+ unsigned int *op = dst;
+ const char *ip = src;
+ unsigned int tempIn;
+ unsigned int tempOut;
+
+ tempIn = *(unsigned int *)(ip+0);
+ tempOut =
+ ( tempIn << 24) |
+ ((tempIn & 0x0000ff00) << 8) |
+ ((tempIn & 0x00ff0000) >> 8) |
+ ( tempIn >> 24);
+
+ *(float *)op = *(float *)(&tempOut);
}
# endif /* !vax */
@@ -367,7 +376,7 @@ get_ix_short(const void *xp, ix_short *ip)
*ip |= (~(0xffff)); /* N.B. Assumes "twos complement" */
}
#endif
- *ip |= *cp;
+ *ip |= *cp;
}
static void
@@ -670,7 +679,7 @@ get_ix_int(const void *xp, ix_int *ip)
#endif
*ip |= (*cp++ << 16);
*ip |= (*cp++ << 8);
- *ip |= *cp;
+ *ip |= *cp;
}
static void
@@ -930,7 +939,7 @@ ncx_put_int_double(void *xp, const double *ip)
return NC_ERANGE;
return ENOERR;
}
-
+
/* x_float */
@@ -991,105 +1000,196 @@ static struct sgl_limits min = {
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } /* Min IEEE */
};
+#line 1064
static void
get_ix_float(const void *xp, float *ip)
{
struct vax_single *const vsp = (struct vax_single *) ip;
+#line 1067
const struct ieee_single *const isp =
+#line 1067
(const struct ieee_single *) xp;
+#line 1067
unsigned exp = isp->exp_hi << 1 | isp->exp_lo;
+#line 1067
+#line 1067
switch(exp) {
+#line 1067
case 0 :
+#line 1067
/* ieee subnormal */
+#line 1067
if(isp->mant_hi == min.ieee.mant_hi
+#line 1067
&& isp->mant_lo_hi == min.ieee.mant_lo_hi
+#line 1067
&& isp->mant_lo_lo == min.ieee.mant_lo_lo)
+#line 1067
{
+#line 1067
*vsp = min.s;
+#line 1067
}
+#line 1067
else
+#line 1067
{
+#line 1067
unsigned mantissa = (isp->mant_hi << 16)
+#line 1067
| isp->mant_lo_hi << 8
+#line 1067
| isp->mant_lo_lo;
+#line 1067
unsigned tmp = mantissa >> 20;
+#line 1067
if(tmp >= 4) {
+#line 1067
vsp->exp = 2;
+#line 1067
} else if (tmp >= 2) {
+#line 1067
vsp->exp = 1;
+#line 1067
} else {
+#line 1067
*vsp = min.s;
+#line 1067
break;
+#line 1067
} /* else */
+#line 1067
tmp = mantissa - (1 << (20 + vsp->exp ));
+#line 1067
tmp <<= 3 - vsp->exp;
+#line 1067
vsp->mantissa2 = tmp;
+#line 1067
vsp->mantissa1 = (tmp >> 16);
+#line 1067
}
+#line 1067
break;
+#line 1067
case 0xfe :
+#line 1067
case 0xff :
+#line 1067
*vsp = max.s;
+#line 1067
break;
+#line 1067
default :
+#line 1067
vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
+#line 1067
vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo;
+#line 1067
vsp->mantissa1 = isp->mant_hi;
+#line 1067
}
+#line 1067
+#line 1067
vsp->sign = isp->sign;
+#line 1067
}
+#line 1121
static void
put_ix_float(void *xp, const float *ip)
{
const struct vax_single *const vsp =
+#line 1125
(const struct vax_single *)ip;
+#line 1125
struct ieee_single *const isp = (struct ieee_single *) xp;
+#line 1125
+#line 1125
switch(vsp->exp){
+#line 1125
case 0 :
+#line 1125
/* all vax float with zero exponent map to zero */
+#line 1125
*isp = min.ieee;
+#line 1125
break;
+#line 1125
case 2 :
+#line 1125
case 1 :
+#line 1125
{
+#line 1125
/* These will map to subnormals */
+#line 1125
unsigned mantissa = (vsp->mantissa1 << 16)
+#line 1125
| vsp->mantissa2;
+#line 1125
mantissa >>= 3 - vsp->exp;
+#line 1125
mantissa += (1 << (20 + vsp->exp));
+#line 1125
isp->mant_lo_lo = mantissa;
+#line 1125
isp->mant_lo_hi = mantissa >> 8;
+#line 1125
isp->mant_hi = mantissa >> 16;
+#line 1125
isp->exp_lo = 0;
+#line 1125
isp->exp_hi = 0;
+#line 1125
}
+#line 1125
break;
+#line 1125
case 0xff : /* max.s.exp */
+#line 1125
if( vsp->mantissa2 == max.s.mantissa2
+#line 1125
&& vsp->mantissa1 == max.s.mantissa1)
+#line 1125
{
+#line 1125
/* map largest vax float to ieee infinity */
+#line 1125
*isp = max.ieee;
+#line 1125
break;
+#line 1125
} /* else, fall thru */
+#line 1125
default :
+#line 1125
{
+#line 1125
unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
+#line 1125
isp->exp_hi = exp >> 1;
+#line 1125
isp->exp_lo = exp;
+#line 1125
isp->mant_lo_lo = vsp->mantissa2;
+#line 1125
isp->mant_lo_hi = vsp->mantissa2 >> 8;
+#line 1125
isp->mant_hi = vsp->mantissa1;
+#line 1125
}
+#line 1125
}
+#line 1125
+#line 1125
isp->sign = vsp->sign;
+#line 1125
}
@@ -1149,6 +1249,7 @@ static const int cs_ieis_bias = 0x4000 - 0x7f;
static const int cs_id_bias = 0x4000 - 0x3ff;
+#line 1260
static void
get_ix_float(const void *xp, float *ip)
@@ -1158,48 +1259,86 @@ get_ix_float(const void *xp, float *ip)
{
const ieee_single_hi *isp = (const ieee_single_hi *) xp;
cray_single *csp = (cray_single *) ip;
+#line 1268
+#line 1268
if(isp->exp == 0)
+#line 1268
{
+#line 1268
/* ieee subnormal */
+#line 1268
*ip = (double)isp->mant;
+#line 1268
if(isp->mant != 0)
+#line 1268
{
+#line 1268
csp->exp -= (ieee_single_bias + 22);
+#line 1268
}
+#line 1268
}
+#line 1268
else
+#line 1268
{
+#line 1268
csp->exp = isp->exp + cs_ieis_bias + 1;
+#line 1268
csp->mant = isp->mant << (48 - 1 - 23);
+#line 1268
csp->mant |= (1 << (48 - 1));
+#line 1268
}
+#line 1268
csp->sign = isp->sign;
+#line 1268
+#line 1268
}
else
{
const ieee_single_lo *isp = (const ieee_single_lo *) xp;
cray_single *csp = (cray_single *) ip;
+#line 1273
+#line 1273
if(isp->exp == 0)
+#line 1273
{
+#line 1273
/* ieee subnormal */
+#line 1273
*ip = (double)isp->mant;
+#line 1273
if(isp->mant != 0)
+#line 1273
{
+#line 1273
csp->exp -= (ieee_single_bias + 22);
+#line 1273
}
+#line 1273
}
+#line 1273
else
+#line 1273
{
+#line 1273
csp->exp = isp->exp + cs_ieis_bias + 1;
+#line 1273
csp->mant = isp->mant << (48 - 1 - 23);
+#line 1273
csp->mant |= (1 << (48 - 1));
+#line 1273
}
+#line 1273
csp->sign = isp->sign;
+#line 1273
+#line 1273
}
}
@@ -1211,96 +1350,182 @@ put_ix_float(void *xp, const float *ip)
{
ieee_single_hi *isp = (ieee_single_hi*)xp;
const cray_single *csp = (const cray_single *) ip;
+#line 1283
int ieee_exp = csp->exp - cs_ieis_bias -1;
+#line 1283
+#line 1283
isp->sign = csp->sign;
+#line 1283
+#line 1283
if(ieee_exp >= 0xff)
+#line 1283
{
+#line 1283
/* NC_ERANGE => ieee Inf */
+#line 1283
isp->exp = 0xff;
+#line 1283
isp->mant = 0x0;
+#line 1283
}
+#line 1283
else if(ieee_exp > 0)
+#line 1283
{
+#line 1283
/* normal ieee representation */
+#line 1283
isp->exp = ieee_exp;
+#line 1283
/* assumes cray rep is in normal form */
+#line 1283
assert(csp->mant & 0x800000000000);
+#line 1283
isp->mant = (((csp->mant << 1) &
+#line 1283
0xffffffffffff) >> (48 - 23));
+#line 1283
}
+#line 1283
else if(ieee_exp > -23)
+#line 1283
{
+#line 1283
/* ieee subnormal, right shift */
+#line 1283
const int rshift = (48 - 23 - ieee_exp);
+#line 1283
+#line 1283
isp->mant = csp->mant >> rshift;
+#line 1283
+#line 1283
#if 0
+#line 1283
if(csp->mant & (1 << (rshift -1)))
+#line 1283
{
+#line 1283
/* round up */
+#line 1283
isp->mant++;
+#line 1283
}
+#line 1283
#endif
+#line 1283
+#line 1283
isp->exp = 0;
+#line 1283
}
+#line 1283
else
+#line 1283
{
+#line 1283
/* smaller than ieee can represent */
+#line 1283
isp->exp = 0;
+#line 1283
isp->mant = 0;
+#line 1283
}
+#line 1283
}
else
{
ieee_single_lo *isp = (ieee_single_lo*)xp;
const cray_single *csp = (const cray_single *) ip;
+#line 1288
int ieee_exp = csp->exp - cs_ieis_bias -1;
+#line 1288
+#line 1288
isp->sign = csp->sign;
+#line 1288
+#line 1288
if(ieee_exp >= 0xff)
+#line 1288
{
+#line 1288
/* NC_ERANGE => ieee Inf */
+#line 1288
isp->exp = 0xff;
+#line 1288
isp->mant = 0x0;
+#line 1288
}
+#line 1288
else if(ieee_exp > 0)
+#line 1288
{
+#line 1288
/* normal ieee representation */
+#line 1288
isp->exp = ieee_exp;
+#line 1288
/* assumes cray rep is in normal form */
+#line 1288
assert(csp->mant & 0x800000000000);
+#line 1288
isp->mant = (((csp->mant << 1) &
+#line 1288
0xffffffffffff) >> (48 - 23));
+#line 1288
}
+#line 1288
else if(ieee_exp > -23)
+#line 1288
{
+#line 1288
/* ieee subnormal, right shift */
+#line 1288
const int rshift = (48 - 23 - ieee_exp);
+#line 1288
+#line 1288
isp->mant = csp->mant >> rshift;
+#line 1288
+#line 1288
#if 0
+#line 1288
if(csp->mant & (1 << (rshift -1)))
+#line 1288
{
+#line 1288
/* round up */
+#line 1288
isp->mant++;
+#line 1288
}
+#line 1288
#endif
+#line 1288
+#line 1288
isp->exp = 0;
+#line 1288
}
+#line 1288
else
+#line 1288
{
+#line 1288
/* smaller than ieee can represent */
+#line 1288
isp->exp = 0;
+#line 1288
isp->mant = 0;
+#line 1288
}
+#line 1288
}
}
@@ -1633,116 +1858,218 @@ static const struct dbl_limits {
};
+#line 1668
static void
get_ix_double(const void *xp, double *ip)
{
struct vax_double *const vdp =
+#line 1671
(struct vax_double *)ip;
+#line 1671
const struct ieee_double *const idp =
+#line 1671
(const struct ieee_double *) xp;
+#line 1671
{
+#line 1671
const struct dbl_limits *lim;
+#line 1671
int ii;
+#line 1671
for (ii = 0, lim = dbl_limits;
+#line 1671
ii < sizeof(dbl_limits)/sizeof(struct dbl_limits);
+#line 1671
ii++, lim++)
+#line 1671
{
+#line 1671
if ((idp->mant_lo == lim->ieee.mant_lo)
+#line 1671
&& (idp->mant_4 == lim->ieee.mant_4)
+#line 1671
&& (idp->mant_5 == lim->ieee.mant_5)
+#line 1671
&& (idp->mant_6 == lim->ieee.mant_6)
+#line 1671
&& (idp->exp_lo == lim->ieee.exp_lo)
+#line 1671
&& (idp->exp_hi == lim->ieee.exp_hi)
+#line 1671
)
+#line 1671
{
+#line 1671
*vdp = lim->d;
+#line 1671
goto doneit;
+#line 1671
}
+#line 1671
}
+#line 1671
}
+#line 1671
{
+#line 1671
unsigned exp = idp->exp_hi << 4 | idp->exp_lo;
+#line 1671
vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
+#line 1671
}
+#line 1671
{
+#line 1671
unsigned mant_hi = ((idp->mant_6 << 16)
+#line 1671
| (idp->mant_5 << 8)
+#line 1671
| idp->mant_4);
+#line 1671
unsigned mant_lo = SWAP4(idp->mant_lo);
+#line 1671
vdp->mantissa1 = (mant_hi >> 13);
+#line 1671
vdp->mantissa2 = ((mant_hi & MASK(13)) << 3)
+#line 1671
| (mant_lo >> 29);
+#line 1671
vdp->mantissa3 = (mant_lo >> 13);
+#line 1671
vdp->mantissa4 = (mant_lo << 3);
+#line 1671
}
+#line 1671
doneit:
+#line 1671
vdp->sign = idp->sign;
+#line 1671
}
+#line 1741
static void
put_ix_double(void *xp, const double *ip)
{
- const struct vax_double *const vdp =
+ const struct vax_double *const vdp =
+#line 1744
(const struct vax_double *)ip;
+#line 1744
struct ieee_double *const idp =
+#line 1744
(struct ieee_double *) xp;
+#line 1744
+#line 1744
if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) &&
+#line 1744
(vdp->mantissa3 == dbl_limits[0].d.mantissa3) &&
+#line 1744
(vdp->mantissa2 == dbl_limits[0].d.mantissa2) &&
+#line 1744
(vdp->mantissa1 == dbl_limits[0].d.mantissa1) &&
+#line 1744
(vdp->exp == dbl_limits[0].d.exp))
+#line 1744
{
+#line 1744
*idp = dbl_limits[0].ieee;
+#line 1744
goto shipit;
+#line 1744
}
+#line 1744
if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) &&
+#line 1744
(vdp->mantissa3 == dbl_limits[1].d.mantissa3) &&
+#line 1744
(vdp->mantissa2 == dbl_limits[1].d.mantissa2) &&
+#line 1744
(vdp->mantissa1 == dbl_limits[1].d.mantissa1) &&
+#line 1744
(vdp->exp == dbl_limits[1].d.exp))
+#line 1744
{
+#line 1744
*idp = dbl_limits[1].ieee;
+#line 1744
goto shipit;
+#line 1744
}
+#line 1744
+#line 1744
{
+#line 1744
unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
+#line 1744
+#line 1744
unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) |
+#line 1744
(vdp->mantissa3 << 13) |
+#line 1744
((vdp->mantissa4 >> 3) & MASK(13));
+#line 1744
+#line 1744
unsigned mant_hi = (vdp->mantissa1 << 13)
+#line 1744
| (vdp->mantissa2 >> 3);
+#line 1744
+#line 1744
if((vdp->mantissa4 & 7) > 4)
+#line 1744
{
+#line 1744
/* round up */
+#line 1744
mant_lo++;
+#line 1744
if(mant_lo == 0)
+#line 1744
{
+#line 1744
mant_hi++;
+#line 1744
if(mant_hi > 0xffffff)
+#line 1744
{
+#line 1744
mant_hi = 0;
+#line 1744
exp++;
+#line 1744
}
+#line 1744
}
+#line 1744
}
+#line 1744
+#line 1744
idp->mant_lo = SWAP4(mant_lo);
+#line 1744
idp->mant_6 = mant_hi >> 16;
+#line 1744
idp->mant_5 = (mant_hi & 0xff00) >> 8;
+#line 1744
idp->mant_4 = mant_hi;
+#line 1744
idp->exp_hi = exp >> 4;
+#line 1744
idp->exp_lo = exp;
+#line 1744
}
-
+#line 1744
+
+#line 1744
shipit:
+#line 1744
idp->sign = vdp->sign;
+#line 1744
}
@@ -1904,7 +2231,7 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip)
{
double xx;
get_ix_double(xp, &xx);
- *ip = (unsigned longlong) xx;
+ *ip = (unsigned long long) xx;
if(xx > ULONG_LONG_MAX || xx < 0)
return NC_ERANGE;
return ENOERR;
@@ -2070,7 +2397,7 @@ ncx_get_size_t(const void **xpp, size_t *ulp)
*ulp = (unsigned)(*cp++ << 24);
*ulp |= (*cp++ << 16);
*ulp |= (*cp++ << 8);
- *ulp |= *cp;
+ *ulp |= *cp;
*xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_SIZE_T);
return ENOERR;
@@ -2088,7 +2415,7 @@ ncx_put_off_t(void **xpp, const off_t *lp, size_t sizeof_off_t)
/* Assume this is an overflow of a 32-bit int... */
return ERANGE;
}
-
+
assert(sizeof_off_t == 4 || sizeof_off_t == 8);
if (sizeof_off_t == 4) {
@@ -2134,7 +2461,7 @@ ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t)
*lp = (off_t)(*cp++ << 24);
*lp |= (off_t)(*cp++ << 16);
*lp |= (off_t)(*cp++ << 8);
- *lp |= (off_t)*cp;
+ *lp |= (off_t)*cp;
} else {
#if SIZEOF_OFF_T == 4
/* Read a 64-bit offset on a system with only a 32-bit offset */
@@ -2184,791 +2511,1505 @@ ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t)
/*
* Aggregate numeric conversion functions.
*/
+#line 2632
+#line 2639
/* schar */
+#line 2643
int
ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
{
(void) memcpy(tp, *xpp, nelems);
+#line 2646
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2646
return ENOERR;
+#line 2646
}
+#line 2649
int
ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
{
(void) memcpy(tp, *xpp, nelems);
+#line 2652
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2652
return ENOERR;
+#line 2652
}
int
+#line 2654
ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp)
+#line 2654
{
+#line 2654
schar *xp = (schar *)(*xpp);
+#line 2654
+#line 2654
while(nelems-- != 0)
+#line 2654
{
+#line 2654
*tp++ = *xp++;
+#line 2654
}
+#line 2654
+#line 2654
*xpp = (const void *)xp;
+#line 2654
return ENOERR;
+#line 2654
}
+#line 2654
int
+#line 2655
ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp)
+#line 2655
{
+#line 2655
schar *xp = (schar *)(*xpp);
+#line 2655
+#line 2655
while(nelems-- != 0)
+#line 2655
{
+#line 2655
*tp++ = *xp++;
+#line 2655
}
+#line 2655
+#line 2655
*xpp = (const void *)xp;
+#line 2655
return ENOERR;
+#line 2655
}
+#line 2655
int
+#line 2656
ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
+#line 2656
{
+#line 2656
schar *xp = (schar *)(*xpp);
+#line 2656
+#line 2656
while(nelems-- != 0)
+#line 2656
{
+#line 2656
*tp++ = *xp++;
+#line 2656
}
+#line 2656
+#line 2656
*xpp = (const void *)xp;
+#line 2656
return ENOERR;
+#line 2656
}
+#line 2656
int
+#line 2657
ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
+#line 2657
{
+#line 2657
schar *xp = (schar *)(*xpp);
+#line 2657
+#line 2657
while(nelems-- != 0)
+#line 2657
{
+#line 2657
*tp++ = *xp++;
+#line 2657
}
+#line 2657
+#line 2657
*xpp = (const void *)xp;
+#line 2657
return ENOERR;
+#line 2657
}
+#line 2657
int
+#line 2658
ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2658
{
+#line 2658
schar *xp = (schar *)(*xpp);
+#line 2658
+#line 2658
while(nelems-- != 0)
+#line 2658
{
+#line 2658
*tp++ = *xp++;
+#line 2658
}
+#line 2658
+#line 2658
*xpp = (const void *)xp;
+#line 2658
return ENOERR;
+#line 2658
}
+#line 2658
int
+#line 2659
ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2659
{
+#line 2659
schar *xp = (schar *)(*xpp);
+#line 2659
+#line 2659
while(nelems-- != 0)
+#line 2659
{
+#line 2659
*tp++ = *xp++;
+#line 2659
}
+#line 2659
+#line 2659
*xpp = (const void *)xp;
+#line 2659
return ENOERR;
+#line 2659
}
+#line 2659
int
+#line 2660
ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2660
{
+#line 2660
schar *xp = (schar *)(*xpp);
+#line 2660
+#line 2660
while(nelems-- != 0)
+#line 2660
{
+#line 2660
*tp++ = *xp++;
+#line 2660
}
+#line 2660
+#line 2660
*xpp = (const void *)xp;
+#line 2660
return ENOERR;
+#line 2660
}
+#line 2660
+#line 2663
int
ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2666
+#line 2666
if(rndup)
+#line 2666
rndup = X_ALIGN - rndup;
+#line 2666
+#line 2666
(void) memcpy(tp, *xpp, nelems);
+#line 2666
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 2666
+#line 2666
return ENOERR;
+#line 2666
}
+#line 2669
int
ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2672
+#line 2672
if(rndup)
+#line 2672
rndup = X_ALIGN - rndup;
+#line 2672
+#line 2672
(void) memcpy(tp, *xpp, nelems);
+#line 2672
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 2672
+#line 2672
return ENOERR;
+#line 2672
}
int
+#line 2674
ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp)
+#line 2674
{
+#line 2674
size_t rndup = nelems % X_ALIGN;
+#line 2674
schar *xp = (schar *) *xpp;
+#line 2674
+#line 2674
if(rndup)
+#line 2674
rndup = X_ALIGN - rndup;
+#line 2674
+#line 2674
while(nelems-- != 0)
+#line 2674
{
+#line 2674
*tp++ = *xp++;
+#line 2674
}
+#line 2674
+#line 2674
*xpp = (void *)(xp + rndup);
+#line 2674
return ENOERR;
+#line 2674
}
+#line 2674
int
+#line 2675
ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp)
+#line 2675
{
+#line 2675
size_t rndup = nelems % X_ALIGN;
+#line 2675
schar *xp = (schar *) *xpp;
+#line 2675
+#line 2675
if(rndup)
+#line 2675
rndup = X_ALIGN - rndup;
+#line 2675
+#line 2675
while(nelems-- != 0)
+#line 2675
{
+#line 2675
*tp++ = *xp++;
+#line 2675
}
+#line 2675
+#line 2675
*xpp = (void *)(xp + rndup);
+#line 2675
return ENOERR;
+#line 2675
}
+#line 2675
int
+#line 2676
ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
+#line 2676
{
+#line 2676
size_t rndup = nelems % X_ALIGN;
+#line 2676
schar *xp = (schar *) *xpp;
+#line 2676
+#line 2676
if(rndup)
+#line 2676
rndup = X_ALIGN - rndup;
+#line 2676
+#line 2676
while(nelems-- != 0)
+#line 2676
{
+#line 2676
*tp++ = *xp++;
+#line 2676
}
+#line 2676
+#line 2676
*xpp = (void *)(xp + rndup);
+#line 2676
return ENOERR;
+#line 2676
}
+#line 2676
int
+#line 2677
ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
+#line 2677
{
+#line 2677
size_t rndup = nelems % X_ALIGN;
+#line 2677
schar *xp = (schar *) *xpp;
+#line 2677
+#line 2677
if(rndup)
+#line 2677
rndup = X_ALIGN - rndup;
+#line 2677
+#line 2677
while(nelems-- != 0)
+#line 2677
{
+#line 2677
*tp++ = *xp++;
+#line 2677
}
+#line 2677
+#line 2677
*xpp = (void *)(xp + rndup);
+#line 2677
return ENOERR;
+#line 2677
}
+#line 2677
int
+#line 2678
ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2678
{
+#line 2678
size_t rndup = nelems % X_ALIGN;
+#line 2678
schar *xp = (schar *) *xpp;
+#line 2678
+#line 2678
if(rndup)
+#line 2678
rndup = X_ALIGN - rndup;
+#line 2678
+#line 2678
while(nelems-- != 0)
+#line 2678
{
+#line 2678
*tp++ = *xp++;
+#line 2678
}
+#line 2678
+#line 2678
*xpp = (void *)(xp + rndup);
+#line 2678
return ENOERR;
+#line 2678
}
+#line 2678
int
+#line 2679
ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2679
{
+#line 2679
size_t rndup = nelems % X_ALIGN;
+#line 2679
schar *xp = (schar *) *xpp;
+#line 2679
+#line 2679
if(rndup)
+#line 2679
rndup = X_ALIGN - rndup;
+#line 2679
+#line 2679
while(nelems-- != 0)
+#line 2679
{
+#line 2679
*tp++ = *xp++;
+#line 2679
}
+#line 2679
+#line 2679
*xpp = (void *)(xp + rndup);
+#line 2679
return ENOERR;
+#line 2679
}
+#line 2679
int
+#line 2680
ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2680
{
+#line 2680
size_t rndup = nelems % X_ALIGN;
+#line 2680
schar *xp = (schar *) *xpp;
+#line 2680
+#line 2680
if(rndup)
+#line 2680
rndup = X_ALIGN - rndup;
+#line 2680
+#line 2680
while(nelems-- != 0)
+#line 2680
{
+#line 2680
*tp++ = *xp++;
+#line 2680
}
+#line 2680
+#line 2680
*xpp = (void *)(xp + rndup);
+#line 2680
return ENOERR;
+#line 2680
}
+#line 2680
+#line 2683
int
ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 2686
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2686
+#line 2686
return ENOERR;
+#line 2686
}
+#line 2689
int
ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 2692
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2692
+#line 2692
return ENOERR;
+#line 2692
}
int
+#line 2694
ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp)
+#line 2694
{
+#line 2694
int status = ENOERR;
+#line 2694
schar *xp = (schar *) *xpp;
+#line 2694
+#line 2694
while(nelems-- != 0)
+#line 2694
{
+#line 2694
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2694
status = NC_ERANGE;
+#line 2694
*xp++ = (schar) *tp++;
+#line 2694
}
+#line 2694
+#line 2694
*xpp = (void *)xp;
+#line 2694
return status;
+#line 2694
}
+#line 2694
int
+#line 2695
ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp)
+#line 2695
{
+#line 2695
int status = ENOERR;
+#line 2695
schar *xp = (schar *) *xpp;
+#line 2695
+#line 2695
while(nelems-- != 0)
+#line 2695
{
+#line 2695
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2695
status = NC_ERANGE;
+#line 2695
*xp++ = (schar) *tp++;
+#line 2695
}
+#line 2695
+#line 2695
*xpp = (void *)xp;
+#line 2695
return status;
+#line 2695
}
+#line 2695
int
+#line 2696
ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp)
+#line 2696
{
+#line 2696
int status = ENOERR;
+#line 2696
schar *xp = (schar *) *xpp;
+#line 2696
+#line 2696
while(nelems-- != 0)
+#line 2696
{
+#line 2696
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2696
status = NC_ERANGE;
+#line 2696
*xp++ = (schar) *tp++;
+#line 2696
}
+#line 2696
+#line 2696
*xpp = (void *)xp;
+#line 2696
return status;
+#line 2696
}
+#line 2696
int
+#line 2697
ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp)
+#line 2697
{
+#line 2697
int status = ENOERR;
+#line 2697
schar *xp = (schar *) *xpp;
+#line 2697
+#line 2697
while(nelems-- != 0)
+#line 2697
{
+#line 2697
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2697
status = NC_ERANGE;
+#line 2697
*xp++ = (schar) *tp++;
+#line 2697
}
+#line 2697
+#line 2697
*xpp = (void *)xp;
+#line 2697
return status;
+#line 2697
}
+#line 2697
int
+#line 2698
ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2698
{
+#line 2698
int status = ENOERR;
+#line 2698
schar *xp = (schar *) *xpp;
+#line 2698
+#line 2698
while(nelems-- != 0)
+#line 2698
{
+#line 2698
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2698
status = NC_ERANGE;
+#line 2698
*xp++ = (schar) *tp++;
+#line 2698
}
+#line 2698
+#line 2698
*xpp = (void *)xp;
+#line 2698
return status;
+#line 2698
}
+#line 2698
int
+#line 2699
ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2699
{
+#line 2699
int status = ENOERR;
+#line 2699
schar *xp = (schar *) *xpp;
+#line 2699
+#line 2699
while(nelems-- != 0)
+#line 2699
{
+#line 2699
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2699
status = NC_ERANGE;
+#line 2699
*xp++ = (schar) *tp++;
+#line 2699
}
+#line 2699
+#line 2699
*xpp = (void *)xp;
+#line 2699
return status;
+#line 2699
}
+#line 2699
int
+#line 2700
ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2700
{
+#line 2700
int status = ENOERR;
+#line 2700
schar *xp = (schar *) *xpp;
+#line 2700
+#line 2700
while(nelems-- != 0)
+#line 2700
{
+#line 2700
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2700
status = NC_ERANGE;
+#line 2700
*xp++ = (schar) *tp++;
+#line 2700
}
+#line 2700
+#line 2700
*xpp = (void *)xp;
+#line 2700
return status;
+#line 2700
}
+#line 2700
+#line 2703
int
ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2706
+#line 2706
if(rndup)
+#line 2706
rndup = X_ALIGN - rndup;
+#line 2706
+#line 2706
(void) memcpy(*xpp, tp, nelems);
+#line 2706
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2706
+#line 2706
if(rndup)
+#line 2706
{
+#line 2706
(void) memcpy(*xpp, nada, rndup);
+#line 2706
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2706
}
-
+#line 2706
+
+#line 2706
return ENOERR;
+#line 2706
}
+#line 2709
int
ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2712
+#line 2712
if(rndup)
+#line 2712
rndup = X_ALIGN - rndup;
+#line 2712
+#line 2712
(void) memcpy(*xpp, tp, nelems);
+#line 2712
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2712
+#line 2712
if(rndup)
+#line 2712
{
+#line 2712
(void) memcpy(*xpp, nada, rndup);
+#line 2712
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2712
}
-
+#line 2712
+
+#line 2712
return ENOERR;
+#line 2712
}
int
+#line 2714
ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp)
+#line 2714
{
+#line 2714
int status = ENOERR;
+#line 2714
size_t rndup = nelems % X_ALIGN;
+#line 2714
schar *xp = (schar *) *xpp;
+#line 2714
+#line 2714
if(rndup)
+#line 2714
rndup = X_ALIGN - rndup;
+#line 2714
+#line 2714
while(nelems-- != 0)
+#line 2714
{
+#line 2714
/* N.B. schar as signed */
+#line 2714
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2714
status = NC_ERANGE;
+#line 2714
*xp++ = (schar) *tp++;
+#line 2714
}
+#line 2714
+#line 2714
+#line 2714
if(rndup)
+#line 2714
{
+#line 2714
(void) memcpy(xp, nada, rndup);
+#line 2714
xp += rndup;
+#line 2714
}
+#line 2714
+#line 2714
*xpp = (void *)xp;
+#line 2714
return status;
+#line 2714
}
+#line 2714
int
+#line 2715
ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp)
+#line 2715
{
+#line 2715
int status = ENOERR;
+#line 2715
size_t rndup = nelems % X_ALIGN;
+#line 2715
schar *xp = (schar *) *xpp;
+#line 2715
+#line 2715
if(rndup)
+#line 2715
rndup = X_ALIGN - rndup;
+#line 2715
+#line 2715
while(nelems-- != 0)
+#line 2715
{
+#line 2715
/* N.B. schar as signed */
+#line 2715
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2715
status = NC_ERANGE;
+#line 2715
*xp++ = (schar) *tp++;
+#line 2715
}
+#line 2715
+#line 2715
+#line 2715
if(rndup)
+#line 2715
{
+#line 2715
(void) memcpy(xp, nada, rndup);
+#line 2715
xp += rndup;
+#line 2715
}
+#line 2715
+#line 2715
*xpp = (void *)xp;
+#line 2715
return status;
+#line 2715
}
+#line 2715
int
+#line 2716
ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp)
+#line 2716
{
+#line 2716
int status = ENOERR;
+#line 2716
size_t rndup = nelems % X_ALIGN;
+#line 2716
schar *xp = (schar *) *xpp;
+#line 2716
+#line 2716
if(rndup)
+#line 2716
rndup = X_ALIGN - rndup;
+#line 2716
+#line 2716
while(nelems-- != 0)
+#line 2716
{
+#line 2716
/* N.B. schar as signed */
+#line 2716
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2716
status = NC_ERANGE;
+#line 2716
*xp++ = (schar) *tp++;
+#line 2716
}
+#line 2716
+#line 2716
+#line 2716
if(rndup)
+#line 2716
{
+#line 2716
(void) memcpy(xp, nada, rndup);
+#line 2716
xp += rndup;
+#line 2716
}
+#line 2716
+#line 2716
*xpp = (void *)xp;
+#line 2716
return status;
+#line 2716
}
+#line 2716
int
+#line 2717
ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp)
+#line 2717
{
+#line 2717
int status = ENOERR;
+#line 2717
size_t rndup = nelems % X_ALIGN;
+#line 2717
schar *xp = (schar *) *xpp;
+#line 2717
+#line 2717
if(rndup)
+#line 2717
rndup = X_ALIGN - rndup;
+#line 2717
+#line 2717
while(nelems-- != 0)
+#line 2717
{
+#line 2717
/* N.B. schar as signed */
+#line 2717
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2717
status = NC_ERANGE;
+#line 2717
*xp++ = (schar) *tp++;
+#line 2717
}
+#line 2717
+#line 2717
+#line 2717
if(rndup)
+#line 2717
{
+#line 2717
(void) memcpy(xp, nada, rndup);
+#line 2717
xp += rndup;
+#line 2717
}
+#line 2717
+#line 2717
*xpp = (void *)xp;
+#line 2717
return status;
+#line 2717
}
+#line 2717
int
+#line 2718
ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2718
{
+#line 2718
int status = ENOERR;
+#line 2718
size_t rndup = nelems % X_ALIGN;
+#line 2718
schar *xp = (schar *) *xpp;
+#line 2718
+#line 2718
if(rndup)
+#line 2718
rndup = X_ALIGN - rndup;
+#line 2718
+#line 2718
while(nelems-- != 0)
+#line 2718
{
+#line 2718
/* N.B. schar as signed */
+#line 2718
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2718
status = NC_ERANGE;
+#line 2718
*xp++ = (schar) *tp++;
+#line 2718
}
+#line 2718
+#line 2718
+#line 2718
if(rndup)
+#line 2718
{
+#line 2718
(void) memcpy(xp, nada, rndup);
+#line 2718
xp += rndup;
+#line 2718
}
+#line 2718
+#line 2718
*xpp = (void *)xp;
+#line 2718
return status;
+#line 2718
}
+#line 2718
int
+#line 2719
ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2719
{
+#line 2719
int status = ENOERR;
+#line 2719
size_t rndup = nelems % X_ALIGN;
+#line 2719
schar *xp = (schar *) *xpp;
+#line 2719
+#line 2719
if(rndup)
+#line 2719
rndup = X_ALIGN - rndup;
+#line 2719
+#line 2719
while(nelems-- != 0)
+#line 2719
{
+#line 2719
/* N.B. schar as signed */
+#line 2719
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2719
status = NC_ERANGE;
+#line 2719
*xp++ = (schar) *tp++;
+#line 2719
}
+#line 2719
+#line 2719
+#line 2719
if(rndup)
+#line 2719
{
+#line 2719
(void) memcpy(xp, nada, rndup);
+#line 2719
xp += rndup;
+#line 2719
}
+#line 2719
+#line 2719
*xpp = (void *)xp;
+#line 2719
return status;
+#line 2719
}
+#line 2719
int
+#line 2720
ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2720
{
+#line 2720
int status = ENOERR;
+#line 2720
size_t rndup = nelems % X_ALIGN;
+#line 2720
schar *xp = (schar *) *xpp;
+#line 2720
+#line 2720
if(rndup)
+#line 2720
rndup = X_ALIGN - rndup;
+#line 2720
+#line 2720
while(nelems-- != 0)
+#line 2720
{
+#line 2720
/* N.B. schar as signed */
+#line 2720
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2720
status = NC_ERANGE;
+#line 2720
*xp++ = (schar) *tp++;
+#line 2720
}
+#line 2720
+#line 2720
+#line 2720
if(rndup)
+#line 2720
{
+#line 2720
(void) memcpy(xp, nada, rndup);
+#line 2720
xp += rndup;
+#line 2720
}
+#line 2720
+#line 2720
*xpp = (void *)xp;
+#line 2720
return status;
+#line 2720
}
+#line 2720
/* short */
int
+#line 2725
ncx_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2725
{
+#line 2725
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2725
+#line 2725
/* basic algorithm is:
+#line 2725
* - ensure sane alignment of input data
+#line 2725
* - copy (conversion happens automatically) input data
+#line 2725
* to output
+#line 2725
* - update xpp to point at next unconverted input, and tp to point
+#line 2725
* at next location for converted output
+#line 2725
*/
+#line 2725
long i, j, ni;
+#line 2725
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2725
short *xp;
+#line 2725
int nrange = 0; /* number of range errors */
+#line 2725
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2725
long cxp = (long) *((char**)xpp);
+#line 2725
+#line 2725
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2725
/* sjl: manually stripmine so we can limit amount of
+#line 2725
* vector work space reserved to LOOPCNT elements. Also
+#line 2725
* makes vectorisation easy */
+#line 2725
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2725
ni=Min(nelems-j,LOOPCNT);
+#line 2725
if (realign) {
+#line 2725
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2725
xp = tmp;
+#line 2725
} else {
+#line 2725
xp = (short *) *xpp;
+#line 2725
}
+#line 2725
/* copy the next block */
+#line 2725
#pragma cdir loopcnt=LOOPCNT
+#line 2725
#pragma cdir shortloop
+#line 2725
for (i=0; i<ni; i++) {
+#line 2725
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2725
/* test for range errors (not always needed but do it anyway) */
+#line 2725
nrange += xp[i] < SCHAR_MIN || xp[i] > SCHAR_MAX;
+#line 2725
}
+#line 2725
/* update xpp and tp */
+#line 2725
if (realign) xp = (short *) *xpp;
+#line 2725
xp += ni;
+#line 2725
tp += ni;
+#line 2725
*xpp = (void*)xp;
+#line 2725
}
+#line 2725
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2725
+#line 2725
#else /* not SX */
+#line 2725
const char *xp = (const char *) *xpp;
+#line 2725
int status = ENOERR;
+#line 2725
+#line 2725
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2725
{
+#line 2725
const int lstatus = ncx_get_short_schar(xp, tp);
+#line 2725
if(lstatus != ENOERR)
+#line 2725
status = lstatus;
+#line 2725
}
+#line 2725
+#line 2725
*xpp = (const void *)xp;
+#line 2725
return status;
+#line 2725
# endif
+#line 2725
}
+#line 2725
int
+#line 2726
ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2726
{
+#line 2726
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2726
+#line 2726
/* basic algorithm is:
+#line 2726
* - ensure sane alignment of input data
+#line 2726
* - copy (conversion happens automatically) input data
+#line 2726
* to output
+#line 2726
* - update xpp to point at next unconverted input, and tp to point
+#line 2726
* at next location for converted output
+#line 2726
*/
+#line 2726
long i, j, ni;
+#line 2726
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2726
short *xp;
+#line 2726
int nrange = 0; /* number of range errors */
+#line 2726
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2726
long cxp = (long) *((char**)xpp);
+#line 2726
+#line 2726
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2726
/* sjl: manually stripmine so we can limit amount of
+#line 2726
* vector work space reserved to LOOPCNT elements. Also
+#line 2726
* makes vectorisation easy */
+#line 2726
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2726
ni=Min(nelems-j,LOOPCNT);
+#line 2726
if (realign) {
+#line 2726
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2726
xp = tmp;
+#line 2726
} else {
+#line 2726
xp = (short *) *xpp;
+#line 2726
}
+#line 2726
/* copy the next block */
+#line 2726
#pragma cdir loopcnt=LOOPCNT
+#line 2726
#pragma cdir shortloop
+#line 2726
for (i=0; i<ni; i++) {
+#line 2726
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2726
/* test for range errors (not always needed but do it anyway) */
+#line 2726
nrange += xp[i] < UCHAR_MIN || xp[i] > UCHAR_MAX;
+#line 2726
}
+#line 2726
/* update xpp and tp */
+#line 2726
if (realign) xp = (short *) *xpp;
+#line 2726
xp += ni;
+#line 2726
tp += ni;
+#line 2726
*xpp = (void*)xp;
+#line 2726
}
+#line 2726
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2726
+#line 2726
#else /* not SX */
+#line 2726
const char *xp = (const char *) *xpp;
+#line 2726
int status = ENOERR;
+#line 2726
+#line 2726
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2726
{
+#line 2726
const int lstatus = ncx_get_short_uchar(xp, tp);
+#line 2726
if(lstatus != ENOERR)
+#line 2726
status = lstatus;
+#line 2726
}
+#line 2726
+#line 2726
*xpp = (const void *)xp;
+#line 2726
return status;
+#line 2726
# endif
+#line 2726
}
+#line 2726
#if X_SIZEOF_SHORT == SIZEOF_SHORT
/* optimized version */
@@ -2985,782 +4026,1539 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
}
#else
int
+#line 2741
ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
+#line 2741
{
+#line 2741
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2741
+#line 2741
/* basic algorithm is:
+#line 2741
* - ensure sane alignment of input data
+#line 2741
* - copy (conversion happens automatically) input data
+#line 2741
* to output
+#line 2741
* - update xpp to point at next unconverted input, and tp to point
+#line 2741
* at next location for converted output
+#line 2741
*/
+#line 2741
long i, j, ni;
+#line 2741
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2741
short *xp;
+#line 2741
int nrange = 0; /* number of range errors */
+#line 2741
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2741
long cxp = (long) *((char**)xpp);
+#line 2741
+#line 2741
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2741
/* sjl: manually stripmine so we can limit amount of
+#line 2741
* vector work space reserved to LOOPCNT elements. Also
+#line 2741
* makes vectorisation easy */
+#line 2741
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2741
ni=Min(nelems-j,LOOPCNT);
+#line 2741
if (realign) {
+#line 2741
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2741
xp = tmp;
+#line 2741
} else {
+#line 2741
xp = (short *) *xpp;
+#line 2741
}
+#line 2741
/* copy the next block */
+#line 2741
#pragma cdir loopcnt=LOOPCNT
+#line 2741
#pragma cdir shortloop
+#line 2741
for (i=0; i<ni; i++) {
+#line 2741
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2741
/* test for range errors (not always needed but do it anyway) */
+#line 2741
nrange += xp[i] < SHORT_MIN || xp[i] > SHORT_MAX;
+#line 2741
}
+#line 2741
/* update xpp and tp */
+#line 2741
if (realign) xp = (short *) *xpp;
+#line 2741
xp += ni;
+#line 2741
tp += ni;
+#line 2741
*xpp = (void*)xp;
+#line 2741
}
+#line 2741
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2741
+#line 2741
#else /* not SX */
+#line 2741
const char *xp = (const char *) *xpp;
+#line 2741
int status = ENOERR;
+#line 2741
+#line 2741
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2741
{
+#line 2741
const int lstatus = ncx_get_short_short(xp, tp);
+#line 2741
if(lstatus != ENOERR)
+#line 2741
status = lstatus;
+#line 2741
}
+#line 2741
+#line 2741
*xpp = (const void *)xp;
+#line 2741
return status;
+#line 2741
# endif
+#line 2741
}
+#line 2741
#endif
int
+#line 2743
ncx_getn_short_int(const void **xpp, size_t nelems, int *tp)
+#line 2743
{
+#line 2743
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2743
+#line 2743
/* basic algorithm is:
+#line 2743
* - ensure sane alignment of input data
+#line 2743
* - copy (conversion happens automatically) input data
+#line 2743
* to output
+#line 2743
* - update xpp to point at next unconverted input, and tp to point
+#line 2743
* at next location for converted output
+#line 2743
*/
+#line 2743
long i, j, ni;
+#line 2743
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2743
short *xp;
+#line 2743
int nrange = 0; /* number of range errors */
+#line 2743
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2743
long cxp = (long) *((char**)xpp);
+#line 2743
+#line 2743
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2743
/* sjl: manually stripmine so we can limit amount of
+#line 2743
* vector work space reserved to LOOPCNT elements. Also
+#line 2743
* makes vectorisation easy */
+#line 2743
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2743
ni=Min(nelems-j,LOOPCNT);
+#line 2743
if (realign) {
+#line 2743
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2743
xp = tmp;
+#line 2743
} else {
+#line 2743
xp = (short *) *xpp;
+#line 2743
}
+#line 2743
/* copy the next block */
+#line 2743
#pragma cdir loopcnt=LOOPCNT
+#line 2743
#pragma cdir shortloop
+#line 2743
for (i=0; i<ni; i++) {
+#line 2743
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2743
/* test for range errors (not always needed but do it anyway) */
+#line 2743
nrange += xp[i] < INT_MIN || xp[i] > INT_MAX;
+#line 2743
}
+#line 2743
/* update xpp and tp */
+#line 2743
if (realign) xp = (short *) *xpp;
+#line 2743
xp += ni;
+#line 2743
tp += ni;
+#line 2743
*xpp = (void*)xp;
+#line 2743
}
+#line 2743
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2743
+#line 2743
#else /* not SX */
+#line 2743
const char *xp = (const char *) *xpp;
+#line 2743
int status = ENOERR;
+#line 2743
+#line 2743
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2743
{
+#line 2743
const int lstatus = ncx_get_short_int(xp, tp);
+#line 2743
if(lstatus != ENOERR)
+#line 2743
status = lstatus;
+#line 2743
}
+#line 2743
+#line 2743
*xpp = (const void *)xp;
+#line 2743
return status;
+#line 2743
# endif
+#line 2743
}
+#line 2743
int
+#line 2744
ncx_getn_short_float(const void **xpp, size_t nelems, float *tp)
+#line 2744
{
+#line 2744
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2744
+#line 2744
/* basic algorithm is:
+#line 2744
* - ensure sane alignment of input data
+#line 2744
* - copy (conversion happens automatically) input data
+#line 2744
* to output
+#line 2744
* - update xpp to point at next unconverted input, and tp to point
+#line 2744
* at next location for converted output
+#line 2744
*/
+#line 2744
long i, j, ni;
+#line 2744
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2744
short *xp;
+#line 2744
int nrange = 0; /* number of range errors */
+#line 2744
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2744
long cxp = (long) *((char**)xpp);
+#line 2744
+#line 2744
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2744
/* sjl: manually stripmine so we can limit amount of
+#line 2744
* vector work space reserved to LOOPCNT elements. Also
+#line 2744
* makes vectorisation easy */
+#line 2744
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2744
ni=Min(nelems-j,LOOPCNT);
+#line 2744
if (realign) {
+#line 2744
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2744
xp = tmp;
+#line 2744
} else {
+#line 2744
xp = (short *) *xpp;
+#line 2744
}
+#line 2744
/* copy the next block */
+#line 2744
#pragma cdir loopcnt=LOOPCNT
+#line 2744
#pragma cdir shortloop
+#line 2744
for (i=0; i<ni; i++) {
+#line 2744
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2744
/* test for range errors (not always needed but do it anyway) */
+#line 2744
nrange += xp[i] < FLOAT_MIN || xp[i] > FLOAT_MAX;
+#line 2744
}
+#line 2744
/* update xpp and tp */
+#line 2744
if (realign) xp = (short *) *xpp;
+#line 2744
xp += ni;
+#line 2744
tp += ni;
+#line 2744
*xpp = (void*)xp;
+#line 2744
}
+#line 2744
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2744
+#line 2744
#else /* not SX */
+#line 2744
const char *xp = (const char *) *xpp;
+#line 2744
int status = ENOERR;
+#line 2744
+#line 2744
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2744
{
+#line 2744
const int lstatus = ncx_get_short_float(xp, tp);
+#line 2744
if(lstatus != ENOERR)
+#line 2744
status = lstatus;
+#line 2744
}
+#line 2744
+#line 2744
*xpp = (const void *)xp;
+#line 2744
return status;
+#line 2744
# endif
+#line 2744
}
+#line 2744
int
+#line 2745
ncx_getn_short_double(const void **xpp, size_t nelems, double *tp)
+#line 2745
{
+#line 2745
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2745
+#line 2745
/* basic algorithm is:
+#line 2745
* - ensure sane alignment of input data
+#line 2745
* - copy (conversion happens automatically) input data
+#line 2745
* to output
+#line 2745
* - update xpp to point at next unconverted input, and tp to point
+#line 2745
* at next location for converted output
+#line 2745
*/
+#line 2745
long i, j, ni;
+#line 2745
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2745
short *xp;
+#line 2745
int nrange = 0; /* number of range errors */
+#line 2745
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2745
long cxp = (long) *((char**)xpp);
+#line 2745
+#line 2745
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2745
/* sjl: manually stripmine so we can limit amount of
+#line 2745
* vector work space reserved to LOOPCNT elements. Also
+#line 2745
* makes vectorisation easy */
+#line 2745
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2745
ni=Min(nelems-j,LOOPCNT);
+#line 2745
if (realign) {
+#line 2745
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2745
xp = tmp;
+#line 2745
} else {
+#line 2745
xp = (short *) *xpp;
+#line 2745
}
+#line 2745
/* copy the next block */
+#line 2745
#pragma cdir loopcnt=LOOPCNT
+#line 2745
#pragma cdir shortloop
+#line 2745
for (i=0; i<ni; i++) {
+#line 2745
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2745
/* test for range errors (not always needed but do it anyway) */
+#line 2745
nrange += xp[i] < DOUBLE_MIN || xp[i] > DOUBLE_MAX;
+#line 2745
}
+#line 2745
/* update xpp and tp */
+#line 2745
if (realign) xp = (short *) *xpp;
+#line 2745
xp += ni;
+#line 2745
tp += ni;
+#line 2745
*xpp = (void*)xp;
+#line 2745
}
+#line 2745
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2745
+#line 2745
#else /* not SX */
+#line 2745
const char *xp = (const char *) *xpp;
+#line 2745
int status = ENOERR;
+#line 2745
+#line 2745
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2745
{
+#line 2745
const int lstatus = ncx_get_short_double(xp, tp);
+#line 2745
if(lstatus != ENOERR)
+#line 2745
status = lstatus;
+#line 2745
}
+#line 2745
+#line 2745
*xpp = (const void *)xp;
+#line 2745
return status;
+#line 2745
# endif
+#line 2745
}
+#line 2745
int
+#line 2746
ncx_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2746
{
+#line 2746
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2746
+#line 2746
/* basic algorithm is:
+#line 2746
* - ensure sane alignment of input data
+#line 2746
* - copy (conversion happens automatically) input data
+#line 2746
* to output
+#line 2746
* - update xpp to point at next unconverted input, and tp to point
+#line 2746
* at next location for converted output
+#line 2746
*/
+#line 2746
long i, j, ni;
+#line 2746
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2746
short *xp;
+#line 2746
int nrange = 0; /* number of range errors */
+#line 2746
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2746
long cxp = (long) *((char**)xpp);
+#line 2746
+#line 2746
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2746
/* sjl: manually stripmine so we can limit amount of
+#line 2746
* vector work space reserved to LOOPCNT elements. Also
+#line 2746
* makes vectorisation easy */
+#line 2746
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2746
ni=Min(nelems-j,LOOPCNT);
+#line 2746
if (realign) {
+#line 2746
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2746
xp = tmp;
+#line 2746
} else {
+#line 2746
xp = (short *) *xpp;
+#line 2746
}
+#line 2746
/* copy the next block */
+#line 2746
#pragma cdir loopcnt=LOOPCNT
+#line 2746
#pragma cdir shortloop
+#line 2746
for (i=0; i<ni; i++) {
+#line 2746
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2746
/* test for range errors (not always needed but do it anyway) */
+#line 2746
nrange += xp[i] < UINT_MIN || xp[i] > UINT_MAX;
+#line 2746
}
+#line 2746
/* update xpp and tp */
+#line 2746
if (realign) xp = (short *) *xpp;
+#line 2746
xp += ni;
+#line 2746
tp += ni;
+#line 2746
*xpp = (void*)xp;
+#line 2746
}
+#line 2746
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2746
+#line 2746
#else /* not SX */
+#line 2746
const char *xp = (const char *) *xpp;
+#line 2746
int status = ENOERR;
+#line 2746
+#line 2746
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2746
{
+#line 2746
const int lstatus = ncx_get_short_uint(xp, tp);
+#line 2746
if(lstatus != ENOERR)
+#line 2746
status = lstatus;
+#line 2746
}
+#line 2746
+#line 2746
*xpp = (const void *)xp;
+#line 2746
return status;
+#line 2746
# endif
+#line 2746
}
+#line 2746
int
+#line 2747
ncx_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2747
{
+#line 2747
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2747
+#line 2747
/* basic algorithm is:
+#line 2747
* - ensure sane alignment of input data
+#line 2747
* - copy (conversion happens automatically) input data
+#line 2747
* to output
+#line 2747
* - update xpp to point at next unconverted input, and tp to point
+#line 2747
* at next location for converted output
+#line 2747
*/
+#line 2747
long i, j, ni;
+#line 2747
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2747
short *xp;
+#line 2747
int nrange = 0; /* number of range errors */
+#line 2747
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2747
long cxp = (long) *((char**)xpp);
+#line 2747
+#line 2747
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2747
/* sjl: manually stripmine so we can limit amount of
+#line 2747
* vector work space reserved to LOOPCNT elements. Also
+#line 2747
* makes vectorisation easy */
+#line 2747
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2747
ni=Min(nelems-j,LOOPCNT);
+#line 2747
if (realign) {
+#line 2747
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2747
xp = tmp;
+#line 2747
} else {
+#line 2747
xp = (short *) *xpp;
+#line 2747
}
+#line 2747
/* copy the next block */
+#line 2747
#pragma cdir loopcnt=LOOPCNT
+#line 2747
#pragma cdir shortloop
+#line 2747
for (i=0; i<ni; i++) {
+#line 2747
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2747
/* test for range errors (not always needed but do it anyway) */
+#line 2747
nrange += xp[i] < LONGLONG_MIN || xp[i] > LONGLONG_MAX;
+#line 2747
}
+#line 2747
/* update xpp and tp */
+#line 2747
if (realign) xp = (short *) *xpp;
+#line 2747
xp += ni;
+#line 2747
tp += ni;
+#line 2747
*xpp = (void*)xp;
+#line 2747
}
+#line 2747
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2747
+#line 2747
#else /* not SX */
+#line 2747
const char *xp = (const char *) *xpp;
+#line 2747
int status = ENOERR;
+#line 2747
+#line 2747
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2747
{
+#line 2747
const int lstatus = ncx_get_short_longlong(xp, tp);
+#line 2747
if(lstatus != ENOERR)
+#line 2747
status = lstatus;
+#line 2747
}
+#line 2747
+#line 2747
*xpp = (const void *)xp;
+#line 2747
return status;
+#line 2747
# endif
+#line 2747
}
+#line 2747
int
+#line 2748
ncx_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2748
{
+#line 2748
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2748
+#line 2748
/* basic algorithm is:
+#line 2748
* - ensure sane alignment of input data
+#line 2748
* - copy (conversion happens automatically) input data
+#line 2748
* to output
+#line 2748
* - update xpp to point at next unconverted input, and tp to point
+#line 2748
* at next location for converted output
+#line 2748
*/
+#line 2748
long i, j, ni;
+#line 2748
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2748
short *xp;
+#line 2748
int nrange = 0; /* number of range errors */
+#line 2748
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2748
long cxp = (long) *((char**)xpp);
+#line 2748
+#line 2748
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2748
/* sjl: manually stripmine so we can limit amount of
+#line 2748
* vector work space reserved to LOOPCNT elements. Also
+#line 2748
* makes vectorisation easy */
+#line 2748
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2748
ni=Min(nelems-j,LOOPCNT);
+#line 2748
if (realign) {
+#line 2748
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2748
xp = tmp;
+#line 2748
} else {
+#line 2748
xp = (short *) *xpp;
+#line 2748
}
+#line 2748
/* copy the next block */
+#line 2748
#pragma cdir loopcnt=LOOPCNT
+#line 2748
#pragma cdir shortloop
+#line 2748
for (i=0; i<ni; i++) {
+#line 2748
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2748
/* test for range errors (not always needed but do it anyway) */
+#line 2748
nrange += xp[i] < ULONGLONG_MIN || xp[i] > ULONGLONG_MAX;
+#line 2748
}
+#line 2748
/* update xpp and tp */
+#line 2748
if (realign) xp = (short *) *xpp;
+#line 2748
xp += ni;
+#line 2748
tp += ni;
+#line 2748
*xpp = (void*)xp;
+#line 2748
}
+#line 2748
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2748
+#line 2748
#else /* not SX */
+#line 2748
const char *xp = (const char *) *xpp;
+#line 2748
int status = ENOERR;
+#line 2748
+#line 2748
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2748
{
+#line 2748
const int lstatus = ncx_get_short_ulonglong(xp, tp);
+#line 2748
if(lstatus != ENOERR)
+#line 2748
status = lstatus;
+#line 2748
}
+#line 2748
+#line 2748
*xpp = (const void *)xp;
+#line 2748
return status;
+#line 2748
# endif
+#line 2748
}
+#line 2748
int
+#line 2750
ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2750
{
+#line 2750
const size_t rndup = nelems % 2;
+#line 2750
+#line 2750
const char *xp = (const char *) *xpp;
+#line 2750
int status = ENOERR;
+#line 2750
+#line 2750
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2750
{
+#line 2750
const int lstatus = ncx_get_short_schar(xp, tp);
+#line 2750
if(lstatus != ENOERR)
+#line 2750
status = lstatus;
+#line 2750
}
+#line 2750
+#line 2750
if(rndup != 0)
+#line 2750
xp += X_SIZEOF_SHORT;
-
+#line 2750
+
+#line 2750
*xpp = (void *)xp;
+#line 2750
return status;
+#line 2750
}
+#line 2750
int
+#line 2751
ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2751
{
+#line 2751
const size_t rndup = nelems % 2;
+#line 2751
+#line 2751
const char *xp = (const char *) *xpp;
+#line 2751
int status = ENOERR;
+#line 2751
+#line 2751
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2751
{
+#line 2751
const int lstatus = ncx_get_short_uchar(xp, tp);
+#line 2751
if(lstatus != ENOERR)
+#line 2751
status = lstatus;
+#line 2751
}
+#line 2751
+#line 2751
if(rndup != 0)
+#line 2751
xp += X_SIZEOF_SHORT;
-
+#line 2751
+
+#line 2751
*xpp = (void *)xp;
+#line 2751
return status;
+#line 2751
}
+#line 2751
int
+#line 2752
ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *tp)
+#line 2752
{
+#line 2752
const size_t rndup = nelems % 2;
+#line 2752
+#line 2752
const char *xp = (const char *) *xpp;
+#line 2752
int status = ENOERR;
+#line 2752
+#line 2752
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2752
{
+#line 2752
const int lstatus = ncx_get_short_short(xp, tp);
+#line 2752
if(lstatus != ENOERR)
+#line 2752
status = lstatus;
+#line 2752
}
+#line 2752
+#line 2752
if(rndup != 0)
+#line 2752
xp += X_SIZEOF_SHORT;
-
+#line 2752
+
+#line 2752
*xpp = (void *)xp;
+#line 2752
return status;
+#line 2752
}
+#line 2752
int
+#line 2753
ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp)
+#line 2753
{
+#line 2753
const size_t rndup = nelems % 2;
+#line 2753
+#line 2753
const char *xp = (const char *) *xpp;
+#line 2753
int status = ENOERR;
+#line 2753
+#line 2753
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2753
{
+#line 2753
const int lstatus = ncx_get_short_int(xp, tp);
+#line 2753
if(lstatus != ENOERR)
+#line 2753
status = lstatus;
+#line 2753
}
+#line 2753
+#line 2753
if(rndup != 0)
+#line 2753
xp += X_SIZEOF_SHORT;
-
+#line 2753
+
+#line 2753
*xpp = (void *)xp;
+#line 2753
return status;
+#line 2753
}
+#line 2753
int
+#line 2754
ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp)
+#line 2754
{
+#line 2754
const size_t rndup = nelems % 2;
+#line 2754
+#line 2754
const char *xp = (const char *) *xpp;
+#line 2754
int status = ENOERR;
+#line 2754
+#line 2754
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2754
{
+#line 2754
const int lstatus = ncx_get_short_float(xp, tp);
+#line 2754
if(lstatus != ENOERR)
+#line 2754
status = lstatus;
+#line 2754
}
+#line 2754
+#line 2754
if(rndup != 0)
+#line 2754
xp += X_SIZEOF_SHORT;
-
+#line 2754
+
+#line 2754
*xpp = (void *)xp;
+#line 2754
return status;
+#line 2754
}
+#line 2754
int
+#line 2755
ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
+#line 2755
{
+#line 2755
const size_t rndup = nelems % 2;
+#line 2755
+#line 2755
const char *xp = (const char *) *xpp;
+#line 2755
int status = ENOERR;
+#line 2755
+#line 2755
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2755
{
+#line 2755
const int lstatus = ncx_get_short_double(xp, tp);
+#line 2755
if(lstatus != ENOERR)
+#line 2755
status = lstatus;
+#line 2755
}
+#line 2755
+#line 2755
if(rndup != 0)
+#line 2755
xp += X_SIZEOF_SHORT;
-
+#line 2755
+
+#line 2755
*xpp = (void *)xp;
+#line 2755
return status;
+#line 2755
}
+#line 2755
int
+#line 2756
ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2756
{
+#line 2756
const size_t rndup = nelems % 2;
+#line 2756
+#line 2756
const char *xp = (const char *) *xpp;
+#line 2756
int status = ENOERR;
+#line 2756
+#line 2756
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2756
{
+#line 2756
const int lstatus = ncx_get_short_uint(xp, tp);
+#line 2756
if(lstatus != ENOERR)
+#line 2756
status = lstatus;
+#line 2756
}
+#line 2756
+#line 2756
if(rndup != 0)
+#line 2756
xp += X_SIZEOF_SHORT;
-
+#line 2756
+
+#line 2756
*xpp = (void *)xp;
+#line 2756
return status;
+#line 2756
}
+#line 2756
int
+#line 2757
ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2757
{
+#line 2757
const size_t rndup = nelems % 2;
+#line 2757
+#line 2757
const char *xp = (const char *) *xpp;
+#line 2757
int status = ENOERR;
+#line 2757
+#line 2757
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2757
{
+#line 2757
const int lstatus = ncx_get_short_longlong(xp, tp);
+#line 2757
if(lstatus != ENOERR)
+#line 2757
status = lstatus;
+#line 2757
}
+#line 2757
+#line 2757
if(rndup != 0)
+#line 2757
xp += X_SIZEOF_SHORT;
-
+#line 2757
+
+#line 2757
*xpp = (void *)xp;
+#line 2757
return status;
+#line 2757
}
+#line 2757
int
+#line 2758
ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2758
{
+#line 2758
const size_t rndup = nelems % 2;
+#line 2758
+#line 2758
const char *xp = (const char *) *xpp;
+#line 2758
int status = ENOERR;
+#line 2758
+#line 2758
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2758
{
+#line 2758
const int lstatus = ncx_get_short_ulonglong(xp, tp);
+#line 2758
if(lstatus != ENOERR)
+#line 2758
status = lstatus;
+#line 2758
}
+#line 2758
+#line 2758
if(rndup != 0)
+#line 2758
xp += X_SIZEOF_SHORT;
-
+#line 2758
+
+#line 2758
*xpp = (void *)xp;
+#line 2758
return status;
+#line 2758
}
+#line 2758
int
+#line 2760
ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2760
{
+#line 2760
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2760
+#line 2760
/* basic algorithm is:
+#line 2760
* - ensure sane alignment of output data
+#line 2760
* - copy (conversion happens automatically) input data
+#line 2760
* to output
+#line 2760
* - update tp to point at next unconverted input, and xpp to point
+#line 2760
* at next location for converted output
+#line 2760
*/
+#line 2760
long i, j, ni;
+#line 2760
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2760
short *xp;
+#line 2760
int nrange = 0; /* number of range errors */
+#line 2760
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2760
long cxp = (long) *((char**)xpp);
+#line 2760
+#line 2760
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2760
/* sjl: manually stripmine so we can limit amount of
+#line 2760
* vector work space reserved to LOOPCNT elements. Also
+#line 2760
* makes vectorisation easy */
+#line 2760
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2760
ni=Min(nelems-j,LOOPCNT);
+#line 2760
if (realign) {
+#line 2760
xp = tmp;
+#line 2760
} else {
+#line 2760
xp = (short *) *xpp;
+#line 2760
}
+#line 2760
/* copy the next block */
+#line 2760
#pragma cdir loopcnt=LOOPCNT
+#line 2760
#pragma cdir shortloop
+#line 2760
for (i=0; i<ni; i++) {
+#line 2760
/* the normal case: */
+#line 2760
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2760
/* test for range errors (not always needed but do it anyway) */
+#line 2760
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2760
}
- /* copy workspace back if necessary */
+#line 2760
+ /* copy workspace back if necessary */
+#line 2760
if (realign) {
+#line 2760
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2760
xp = (short *) *xpp;
+#line 2760
}
+#line 2760
/* update xpp and tp */
+#line 2760
xp += ni;
+#line 2760
tp += ni;
+#line 2760
*xpp = (void*)xp;
+#line 2760
}
+#line 2760
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2760
+#line 2760
#else /* not SX */
+#line 2760
+#line 2760
char *xp = (char *) *xpp;
+#line 2760
int status = ENOERR;
+#line 2760
+#line 2760
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2760
{
+#line 2760
int lstatus = ncx_put_short_schar(xp, tp);
+#line 2760
if(lstatus != ENOERR)
+#line 2760
status = lstatus;
+#line 2760
}
+#line 2760
+#line 2760
*xpp = (void *)xp;
+#line 2760
return status;
+#line 2760
#endif
+#line 2760
}
+#line 2760
int
+#line 2761
ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2761
{
+#line 2761
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2761
+#line 2761
/* basic algorithm is:
+#line 2761
* - ensure sane alignment of output data
+#line 2761
* - copy (conversion happens automatically) input data
+#line 2761
* to output
+#line 2761
* - update tp to point at next unconverted input, and xpp to point
+#line 2761
* at next location for converted output
+#line 2761
*/
+#line 2761
long i, j, ni;
+#line 2761
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2761
short *xp;
+#line 2761
int nrange = 0; /* number of range errors */
+#line 2761
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2761
long cxp = (long) *((char**)xpp);
+#line 2761
+#line 2761
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2761
/* sjl: manually stripmine so we can limit amount of
+#line 2761
* vector work space reserved to LOOPCNT elements. Also
+#line 2761
* makes vectorisation easy */
+#line 2761
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2761
ni=Min(nelems-j,LOOPCNT);
+#line 2761
if (realign) {
+#line 2761
xp = tmp;
+#line 2761
} else {
+#line 2761
xp = (short *) *xpp;
+#line 2761
}
+#line 2761
/* copy the next block */
+#line 2761
#pragma cdir loopcnt=LOOPCNT
+#line 2761
#pragma cdir shortloop
+#line 2761
for (i=0; i<ni; i++) {
+#line 2761
/* the normal case: */
+#line 2761
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2761
/* test for range errors (not always needed but do it anyway) */
+#line 2761
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2761
}
- /* copy workspace back if necessary */
+#line 2761
+ /* copy workspace back if necessary */
+#line 2761
if (realign) {
+#line 2761
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2761
xp = (short *) *xpp;
+#line 2761
}
+#line 2761
/* update xpp and tp */
+#line 2761
xp += ni;
+#line 2761
tp += ni;
+#line 2761
*xpp = (void*)xp;
+#line 2761
}
+#line 2761
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2761
+#line 2761
#else /* not SX */
+#line 2761
+#line 2761
char *xp = (char *) *xpp;
+#line 2761
int status = ENOERR;
+#line 2761
+#line 2761
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2761
{
+#line 2761
int lstatus = ncx_put_short_uchar(xp, tp);
+#line 2761
if(lstatus != ENOERR)
+#line 2761
status = lstatus;
+#line 2761
}
+#line 2761
+#line 2761
*xpp = (void *)xp;
+#line 2761
return status;
+#line 2761
#endif
+#line 2761
}
+#line 2761
#if X_SIZEOF_SHORT == SIZEOF_SHORT
/* optimized version */
@@ -3777,900 +5575,1771 @@ ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
}
#else
int
+#line 2776
ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
+#line 2776
{
+#line 2776
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2776
+#line 2776
/* basic algorithm is:
+#line 2776
* - ensure sane alignment of output data
+#line 2776
* - copy (conversion happens automatically) input data
+#line 2776
* to output
+#line 2776
* - update tp to point at next unconverted input, and xpp to point
+#line 2776
* at next location for converted output
+#line 2776
*/
+#line 2776
long i, j, ni;
+#line 2776
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2776
short *xp;
+#line 2776
int nrange = 0; /* number of range errors */
+#line 2776
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2776
long cxp = (long) *((char**)xpp);
+#line 2776
+#line 2776
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2776
/* sjl: manually stripmine so we can limit amount of
+#line 2776
* vector work space reserved to LOOPCNT elements. Also
+#line 2776
* makes vectorisation easy */
+#line 2776
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2776
ni=Min(nelems-j,LOOPCNT);
+#line 2776
if (realign) {
+#line 2776
xp = tmp;
+#line 2776
} else {
+#line 2776
xp = (short *) *xpp;
+#line 2776
}
+#line 2776
/* copy the next block */
+#line 2776
#pragma cdir loopcnt=LOOPCNT
+#line 2776
#pragma cdir shortloop
+#line 2776
for (i=0; i<ni; i++) {
+#line 2776
/* the normal case: */
+#line 2776
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2776
/* test for range errors (not always needed but do it anyway) */
+#line 2776
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2776
}
- /* copy workspace back if necessary */
+#line 2776
+ /* copy workspace back if necessary */
+#line 2776
if (realign) {
+#line 2776
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2776
xp = (short *) *xpp;
+#line 2776
}
+#line 2776
/* update xpp and tp */
+#line 2776
xp += ni;
+#line 2776
tp += ni;
+#line 2776
*xpp = (void*)xp;
+#line 2776
}
+#line 2776
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2776
+#line 2776
#else /* not SX */
+#line 2776
+#line 2776
char *xp = (char *) *xpp;
+#line 2776
int status = ENOERR;
+#line 2776
+#line 2776
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2776
{
+#line 2776
int lstatus = ncx_put_short_short(xp, tp);
+#line 2776
if(lstatus != ENOERR)
+#line 2776
status = lstatus;
+#line 2776
}
+#line 2776
+#line 2776
*xpp = (void *)xp;
+#line 2776
return status;
+#line 2776
#endif
+#line 2776
}
+#line 2776
#endif
int
+#line 2778
ncx_putn_short_int(void **xpp, size_t nelems, const int *tp)
+#line 2778
{
+#line 2778
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2778
+#line 2778
/* basic algorithm is:
+#line 2778
* - ensure sane alignment of output data
+#line 2778
* - copy (conversion happens automatically) input data
+#line 2778
* to output
+#line 2778
* - update tp to point at next unconverted input, and xpp to point
+#line 2778
* at next location for converted output
+#line 2778
*/
+#line 2778
long i, j, ni;
+#line 2778
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2778
short *xp;
+#line 2778
int nrange = 0; /* number of range errors */
+#line 2778
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2778
long cxp = (long) *((char**)xpp);
+#line 2778
+#line 2778
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2778
/* sjl: manually stripmine so we can limit amount of
+#line 2778
* vector work space reserved to LOOPCNT elements. Also
+#line 2778
* makes vectorisation easy */
+#line 2778
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2778
ni=Min(nelems-j,LOOPCNT);
+#line 2778
if (realign) {
+#line 2778
xp = tmp;
+#line 2778
} else {
+#line 2778
xp = (short *) *xpp;
+#line 2778
}
+#line 2778
/* copy the next block */
+#line 2778
#pragma cdir loopcnt=LOOPCNT
+#line 2778
#pragma cdir shortloop
+#line 2778
for (i=0; i<ni; i++) {
+#line 2778
/* the normal case: */
+#line 2778
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2778
/* test for range errors (not always needed but do it anyway) */
+#line 2778
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2778
}
- /* copy workspace back if necessary */
+#line 2778
+ /* copy workspace back if necessary */
+#line 2778
if (realign) {
+#line 2778
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2778
xp = (short *) *xpp;
+#line 2778
}
+#line 2778
/* update xpp and tp */
+#line 2778
xp += ni;
+#line 2778
tp += ni;
+#line 2778
*xpp = (void*)xp;
+#line 2778
}
+#line 2778
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2778
+#line 2778
#else /* not SX */
+#line 2778
+#line 2778
char *xp = (char *) *xpp;
+#line 2778
int status = ENOERR;
+#line 2778
+#line 2778
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2778
{
+#line 2778
int lstatus = ncx_put_short_int(xp, tp);
+#line 2778
if(lstatus != ENOERR)
+#line 2778
status = lstatus;
+#line 2778
}
+#line 2778
+#line 2778
*xpp = (void *)xp;
+#line 2778
return status;
+#line 2778
#endif
+#line 2778
}
+#line 2778
int
+#line 2779
ncx_putn_short_float(void **xpp, size_t nelems, const float *tp)
+#line 2779
{
+#line 2779
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2779
+#line 2779
/* basic algorithm is:
+#line 2779
* - ensure sane alignment of output data
+#line 2779
* - copy (conversion happens automatically) input data
+#line 2779
* to output
+#line 2779
* - update tp to point at next unconverted input, and xpp to point
+#line 2779
* at next location for converted output
+#line 2779
*/
+#line 2779
long i, j, ni;
+#line 2779
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2779
short *xp;
+#line 2779
int nrange = 0; /* number of range errors */
+#line 2779
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2779
long cxp = (long) *((char**)xpp);
+#line 2779
+#line 2779
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2779
/* sjl: manually stripmine so we can limit amount of
+#line 2779
* vector work space reserved to LOOPCNT elements. Also
+#line 2779
* makes vectorisation easy */
+#line 2779
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2779
ni=Min(nelems-j,LOOPCNT);
+#line 2779
if (realign) {
+#line 2779
xp = tmp;
+#line 2779
} else {
+#line 2779
xp = (short *) *xpp;
+#line 2779
}
+#line 2779
/* copy the next block */
+#line 2779
#pragma cdir loopcnt=LOOPCNT
+#line 2779
#pragma cdir shortloop
+#line 2779
for (i=0; i<ni; i++) {
+#line 2779
/* the normal case: */
+#line 2779
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2779
/* test for range errors (not always needed but do it anyway) */
+#line 2779
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2779
}
- /* copy workspace back if necessary */
+#line 2779
+ /* copy workspace back if necessary */
+#line 2779
if (realign) {
+#line 2779
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2779
xp = (short *) *xpp;
+#line 2779
}
+#line 2779
/* update xpp and tp */
+#line 2779
xp += ni;
+#line 2779
tp += ni;
+#line 2779
*xpp = (void*)xp;
+#line 2779
}
+#line 2779
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2779
+#line 2779
#else /* not SX */
+#line 2779
+#line 2779
char *xp = (char *) *xpp;
+#line 2779
int status = ENOERR;
+#line 2779
+#line 2779
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2779
{
+#line 2779
int lstatus = ncx_put_short_float(xp, tp);
+#line 2779
if(lstatus != ENOERR)
+#line 2779
status = lstatus;
+#line 2779
}
+#line 2779
+#line 2779
*xpp = (void *)xp;
+#line 2779
return status;
+#line 2779
#endif
+#line 2779
}
+#line 2779
int
+#line 2780
ncx_putn_short_double(void **xpp, size_t nelems, const double *tp)
+#line 2780
{
+#line 2780
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2780
+#line 2780
/* basic algorithm is:
+#line 2780
* - ensure sane alignment of output data
+#line 2780
* - copy (conversion happens automatically) input data
+#line 2780
* to output
+#line 2780
* - update tp to point at next unconverted input, and xpp to point
+#line 2780
* at next location for converted output
+#line 2780
*/
+#line 2780
long i, j, ni;
+#line 2780
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2780
short *xp;
+#line 2780
int nrange = 0; /* number of range errors */
+#line 2780
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2780
long cxp = (long) *((char**)xpp);
+#line 2780
+#line 2780
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2780
/* sjl: manually stripmine so we can limit amount of
+#line 2780
* vector work space reserved to LOOPCNT elements. Also
+#line 2780
* makes vectorisation easy */
+#line 2780
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2780
ni=Min(nelems-j,LOOPCNT);
+#line 2780
if (realign) {
+#line 2780
xp = tmp;
+#line 2780
} else {
+#line 2780
xp = (short *) *xpp;
+#line 2780
}
+#line 2780
/* copy the next block */
+#line 2780
#pragma cdir loopcnt=LOOPCNT
+#line 2780
#pragma cdir shortloop
+#line 2780
for (i=0; i<ni; i++) {
+#line 2780
/* the normal case: */
+#line 2780
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2780
/* test for range errors (not always needed but do it anyway) */
+#line 2780
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2780
}
- /* copy workspace back if necessary */
+#line 2780
+ /* copy workspace back if necessary */
+#line 2780
if (realign) {
+#line 2780
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2780
xp = (short *) *xpp;
+#line 2780
}
+#line 2780
/* update xpp and tp */
+#line 2780
xp += ni;
+#line 2780
tp += ni;
+#line 2780
*xpp = (void*)xp;
+#line 2780
}
+#line 2780
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2780
+#line 2780
#else /* not SX */
+#line 2780
+#line 2780
char *xp = (char *) *xpp;
+#line 2780
int status = ENOERR;
+#line 2780
+#line 2780
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2780
{
+#line 2780
int lstatus = ncx_put_short_double(xp, tp);
+#line 2780
if(lstatus != ENOERR)
+#line 2780
status = lstatus;
+#line 2780
}
+#line 2780
+#line 2780
*xpp = (void *)xp;
+#line 2780
return status;
+#line 2780
#endif
+#line 2780
}
+#line 2780
int
+#line 2781
ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2781
{
+#line 2781
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2781
+#line 2781
/* basic algorithm is:
+#line 2781
* - ensure sane alignment of output data
+#line 2781
* - copy (conversion happens automatically) input data
+#line 2781
* to output
+#line 2781
* - update tp to point at next unconverted input, and xpp to point
+#line 2781
* at next location for converted output
+#line 2781
*/
+#line 2781
long i, j, ni;
+#line 2781
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2781
short *xp;
+#line 2781
int nrange = 0; /* number of range errors */
+#line 2781
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2781
long cxp = (long) *((char**)xpp);
+#line 2781
+#line 2781
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2781
/* sjl: manually stripmine so we can limit amount of
+#line 2781
* vector work space reserved to LOOPCNT elements. Also
+#line 2781
* makes vectorisation easy */
+#line 2781
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2781
ni=Min(nelems-j,LOOPCNT);
+#line 2781
if (realign) {
+#line 2781
xp = tmp;
+#line 2781
} else {
+#line 2781
xp = (short *) *xpp;
+#line 2781
}
+#line 2781
/* copy the next block */
+#line 2781
#pragma cdir loopcnt=LOOPCNT
+#line 2781
#pragma cdir shortloop
+#line 2781
for (i=0; i<ni; i++) {
+#line 2781
/* the normal case: */
+#line 2781
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2781
/* test for range errors (not always needed but do it anyway) */
+#line 2781
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2781
}
- /* copy workspace back if necessary */
+#line 2781
+ /* copy workspace back if necessary */
+#line 2781
if (realign) {
+#line 2781
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2781
xp = (short *) *xpp;
+#line 2781
}
+#line 2781
/* update xpp and tp */
+#line 2781
xp += ni;
+#line 2781
tp += ni;
+#line 2781
*xpp = (void*)xp;
+#line 2781
}
+#line 2781
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2781
+#line 2781
#else /* not SX */
+#line 2781
+#line 2781
char *xp = (char *) *xpp;
+#line 2781
int status = ENOERR;
+#line 2781
+#line 2781
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2781
{
+#line 2781
int lstatus = ncx_put_short_uint(xp, tp);
+#line 2781
if(lstatus != ENOERR)
+#line 2781
status = lstatus;
+#line 2781
}
+#line 2781
+#line 2781
*xpp = (void *)xp;
+#line 2781
return status;
+#line 2781
#endif
+#line 2781
}
+#line 2781
int
+#line 2782
ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2782
{
+#line 2782
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2782
+#line 2782
/* basic algorithm is:
+#line 2782
* - ensure sane alignment of output data
+#line 2782
* - copy (conversion happens automatically) input data
+#line 2782
* to output
+#line 2782
* - update tp to point at next unconverted input, and xpp to point
+#line 2782
* at next location for converted output
+#line 2782
*/
+#line 2782
long i, j, ni;
+#line 2782
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2782
short *xp;
+#line 2782
int nrange = 0; /* number of range errors */
+#line 2782
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2782
long cxp = (long) *((char**)xpp);
+#line 2782
+#line 2782
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2782
/* sjl: manually stripmine so we can limit amount of
+#line 2782
* vector work space reserved to LOOPCNT elements. Also
+#line 2782
* makes vectorisation easy */
+#line 2782
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2782
ni=Min(nelems-j,LOOPCNT);
+#line 2782
if (realign) {
+#line 2782
xp = tmp;
+#line 2782
} else {
+#line 2782
xp = (short *) *xpp;
+#line 2782
}
+#line 2782
/* copy the next block */
+#line 2782
#pragma cdir loopcnt=LOOPCNT
+#line 2782
#pragma cdir shortloop
+#line 2782
for (i=0; i<ni; i++) {
+#line 2782
/* the normal case: */
+#line 2782
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2782
/* test for range errors (not always needed but do it anyway) */
+#line 2782
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2782
}
- /* copy workspace back if necessary */
+#line 2782
+ /* copy workspace back if necessary */
+#line 2782
if (realign) {
+#line 2782
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2782
xp = (short *) *xpp;
+#line 2782
}
+#line 2782
/* update xpp and tp */
+#line 2782
xp += ni;
+#line 2782
tp += ni;
+#line 2782
*xpp = (void*)xp;
+#line 2782
}
+#line 2782
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2782
+#line 2782
#else /* not SX */
+#line 2782
+#line 2782
char *xp = (char *) *xpp;
+#line 2782
int status = ENOERR;
+#line 2782
+#line 2782
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2782
{
+#line 2782
int lstatus = ncx_put_short_longlong(xp, tp);
+#line 2782
if(lstatus != ENOERR)
+#line 2782
status = lstatus;
+#line 2782
}
+#line 2782
+#line 2782
*xpp = (void *)xp;
+#line 2782
return status;
+#line 2782
#endif
+#line 2782
}
+#line 2782
int
+#line 2783
ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2783
{
+#line 2783
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2783
+#line 2783
/* basic algorithm is:
+#line 2783
* - ensure sane alignment of output data
+#line 2783
* - copy (conversion happens automatically) input data
+#line 2783
* to output
+#line 2783
* - update tp to point at next unconverted input, and xpp to point
+#line 2783
* at next location for converted output
+#line 2783
*/
+#line 2783
long i, j, ni;
+#line 2783
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2783
short *xp;
+#line 2783
int nrange = 0; /* number of range errors */
+#line 2783
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2783
long cxp = (long) *((char**)xpp);
+#line 2783
+#line 2783
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2783
/* sjl: manually stripmine so we can limit amount of
+#line 2783
* vector work space reserved to LOOPCNT elements. Also
+#line 2783
* makes vectorisation easy */
+#line 2783
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2783
ni=Min(nelems-j,LOOPCNT);
+#line 2783
if (realign) {
+#line 2783
xp = tmp;
+#line 2783
} else {
+#line 2783
xp = (short *) *xpp;
+#line 2783
}
+#line 2783
/* copy the next block */
+#line 2783
#pragma cdir loopcnt=LOOPCNT
+#line 2783
#pragma cdir shortloop
+#line 2783
for (i=0; i<ni; i++) {
+#line 2783
/* the normal case: */
+#line 2783
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2783
/* test for range errors (not always needed but do it anyway) */
+#line 2783
nrange += tp[i] < X_SHORT_MIN || tp[i] > X_SHORT_MAX;
+#line 2783
}
- /* copy workspace back if necessary */
+#line 2783
+ /* copy workspace back if necessary */
+#line 2783
if (realign) {
+#line 2783
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2783
xp = (short *) *xpp;
+#line 2783
}
+#line 2783
/* update xpp and tp */
+#line 2783
xp += ni;
+#line 2783
tp += ni;
+#line 2783
*xpp = (void*)xp;
+#line 2783
}
+#line 2783
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2783
+#line 2783
#else /* not SX */
+#line 2783
+#line 2783
char *xp = (char *) *xpp;
+#line 2783
int status = ENOERR;
+#line 2783
+#line 2783
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2783
{
+#line 2783
int lstatus = ncx_put_short_ulonglong(xp, tp);
+#line 2783
if(lstatus != ENOERR)
+#line 2783
status = lstatus;
+#line 2783
}
+#line 2783
+#line 2783
*xpp = (void *)xp;
+#line 2783
return status;
+#line 2783
#endif
+#line 2783
}
+#line 2783
int
+#line 2785
ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2785
{
+#line 2785
const size_t rndup = nelems % 2;
+#line 2785
+#line 2785
char *xp = (char *) *xpp;
+#line 2785
int status = ENOERR;
+#line 2785
+#line 2785
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2785
{
+#line 2785
int lstatus = ncx_put_short_schar(xp, tp);
+#line 2785
if(lstatus != ENOERR)
+#line 2785
status = lstatus;
+#line 2785
}
+#line 2785
+#line 2785
if(rndup != 0)
+#line 2785
{
+#line 2785
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2785
+ xp += X_SIZEOF_SHORT;
+#line 2785
}
-
+#line 2785
+
+#line 2785
*xpp = (void *)xp;
+#line 2785
return status;
+#line 2785
}
+#line 2785
int
+#line 2786
ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2786
{
+#line 2786
const size_t rndup = nelems % 2;
+#line 2786
+#line 2786
char *xp = (char *) *xpp;
+#line 2786
int status = ENOERR;
+#line 2786
+#line 2786
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2786
{
+#line 2786
int lstatus = ncx_put_short_uchar(xp, tp);
+#line 2786
if(lstatus != ENOERR)
+#line 2786
status = lstatus;
+#line 2786
}
+#line 2786
+#line 2786
if(rndup != 0)
+#line 2786
{
+#line 2786
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2786
+ xp += X_SIZEOF_SHORT;
+#line 2786
}
-
+#line 2786
+
+#line 2786
*xpp = (void *)xp;
+#line 2786
return status;
+#line 2786
}
+#line 2786
int
+#line 2787
ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *tp)
+#line 2787
{
+#line 2787
const size_t rndup = nelems % 2;
+#line 2787
+#line 2787
char *xp = (char *) *xpp;
+#line 2787
int status = ENOERR;
+#line 2787
+#line 2787
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2787
{
+#line 2787
int lstatus = ncx_put_short_short(xp, tp);
+#line 2787
if(lstatus != ENOERR)
+#line 2787
status = lstatus;
+#line 2787
}
+#line 2787
+#line 2787
if(rndup != 0)
+#line 2787
{
+#line 2787
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2787
+ xp += X_SIZEOF_SHORT;
+#line 2787
}
-
+#line 2787
+
+#line 2787
*xpp = (void *)xp;
+#line 2787
return status;
+#line 2787
}
+#line 2787
int
+#line 2788
ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp)
+#line 2788
{
+#line 2788
const size_t rndup = nelems % 2;
+#line 2788
+#line 2788
char *xp = (char *) *xpp;
+#line 2788
int status = ENOERR;
+#line 2788
+#line 2788
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2788
{
+#line 2788
int lstatus = ncx_put_short_int(xp, tp);
+#line 2788
if(lstatus != ENOERR)
+#line 2788
status = lstatus;
+#line 2788
}
+#line 2788
+#line 2788
if(rndup != 0)
+#line 2788
{
+#line 2788
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2788
+ xp += X_SIZEOF_SHORT;
+#line 2788
}
-
+#line 2788
+
+#line 2788
*xpp = (void *)xp;
+#line 2788
return status;
+#line 2788
}
+#line 2788
int
+#line 2789
ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp)
+#line 2789
{
+#line 2789
const size_t rndup = nelems % 2;
+#line 2789
+#line 2789
char *xp = (char *) *xpp;
+#line 2789
int status = ENOERR;
+#line 2789
+#line 2789
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2789
{
+#line 2789
int lstatus = ncx_put_short_float(xp, tp);
+#line 2789
if(lstatus != ENOERR)
+#line 2789
status = lstatus;
+#line 2789
}
+#line 2789
+#line 2789
if(rndup != 0)
+#line 2789
{
+#line 2789
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2789
+ xp += X_SIZEOF_SHORT;
+#line 2789
}
-
+#line 2789
+
+#line 2789
*xpp = (void *)xp;
+#line 2789
return status;
+#line 2789
}
+#line 2789
int
+#line 2790
ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp)
+#line 2790
{
+#line 2790
const size_t rndup = nelems % 2;
+#line 2790
+#line 2790
char *xp = (char *) *xpp;
+#line 2790
int status = ENOERR;
+#line 2790
+#line 2790
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2790
{
+#line 2790
int lstatus = ncx_put_short_double(xp, tp);
+#line 2790
if(lstatus != ENOERR)
+#line 2790
status = lstatus;
+#line 2790
}
+#line 2790
+#line 2790
if(rndup != 0)
+#line 2790
{
+#line 2790
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2790
+ xp += X_SIZEOF_SHORT;
+#line 2790
}
-
+#line 2790
+
+#line 2790
*xpp = (void *)xp;
+#line 2790
return status;
+#line 2790
}
+#line 2790
int
+#line 2791
ncx_pad_putn_short_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2791
{
+#line 2791
const size_t rndup = nelems % 2;
+#line 2791
+#line 2791
char *xp = (char *) *xpp;
+#line 2791
int status = ENOERR;
+#line 2791
+#line 2791
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2791
{
+#line 2791
int lstatus = ncx_put_short_uint(xp, tp);
+#line 2791
if(lstatus != ENOERR)
+#line 2791
status = lstatus;
+#line 2791
}
+#line 2791
+#line 2791
if(rndup != 0)
+#line 2791
{
+#line 2791
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2791
+ xp += X_SIZEOF_SHORT;
+#line 2791
}
-
+#line 2791
+
+#line 2791
*xpp = (void *)xp;
+#line 2791
return status;
+#line 2791
}
+#line 2791
int
+#line 2792
ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2792
{
+#line 2792
const size_t rndup = nelems % 2;
+#line 2792
+#line 2792
char *xp = (char *) *xpp;
+#line 2792
int status = ENOERR;
+#line 2792
+#line 2792
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2792
{
+#line 2792
int lstatus = ncx_put_short_longlong(xp, tp);
+#line 2792
if(lstatus != ENOERR)
+#line 2792
status = lstatus;
+#line 2792
}
+#line 2792
+#line 2792
if(rndup != 0)
+#line 2792
{
+#line 2792
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2792
+ xp += X_SIZEOF_SHORT;
+#line 2792
}
-
+#line 2792
+
+#line 2792
*xpp = (void *)xp;
+#line 2792
return status;
+#line 2792
}
+#line 2792
int
+#line 2793
ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2793
{
+#line 2793
const size_t rndup = nelems % 2;
+#line 2793
+#line 2793
char *xp = (char *) *xpp;
+#line 2793
int status = ENOERR;
+#line 2793
+#line 2793
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2793
{
+#line 2793
int lstatus = ncx_put_short_ulonglong(xp, tp);
+#line 2793
if(lstatus != ENOERR)
+#line 2793
status = lstatus;
+#line 2793
}
+#line 2793
+#line 2793
if(rndup != 0)
+#line 2793
{
+#line 2793
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+#line 2793
+ xp += X_SIZEOF_SHORT;
+#line 2793
}
-
+#line 2793
+
+#line 2793
*xpp = (void *)xp;
+#line 2793
return status;
+#line 2793
}
+#line 2793
/* int */
int
+#line 2798
ncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2798
{
+#line 2798
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2798
+#line 2798
/* basic algorithm is:
+#line 2798
* - ensure sane alignment of input data
+#line 2798
* - copy (conversion happens automatically) input data
+#line 2798
* to output
+#line 2798
* - update xpp to point at next unconverted input, and tp to point
+#line 2798
* at next location for converted output
+#line 2798
*/
+#line 2798
long i, j, ni;
+#line 2798
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2798
int *xp;
+#line 2798
int nrange = 0; /* number of range errors */
+#line 2798
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2798
long cxp = (long) *((char**)xpp);
+#line 2798
+#line 2798
realign = (cxp & 7) % SIZEOF_INT;
+#line 2798
/* sjl: manually stripmine so we can limit amount of
+#line 2798
* vector work space reserved to LOOPCNT elements. Also
+#line 2798
* makes vectorisation easy */
+#line 2798
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2798
ni=Min(nelems-j,LOOPCNT);
+#line 2798
if (realign) {
+#line 2798
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2798
xp = tmp;
+#line 2798
} else {
+#line 2798
xp = (int *) *xpp;
+#line 2798
}
+#line 2798
/* copy the next block */
+#line 2798
#pragma cdir loopcnt=LOOPCNT
+#line 2798
#pragma cdir shortloop
+#line 2798
for (i=0; i<ni; i++) {
+#line 2798
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2798
/* test for range errors (not always needed but do it anyway) */
+#line 2798
nrange += xp[i] < SCHAR_MIN || xp[i] > SCHAR_MAX;
+#line 2798
}
+#line 2798
/* update xpp and tp */
+#line 2798
if (realign) xp = (int *) *xpp;
+#line 2798
xp += ni;
+#line 2798
tp += ni;
+#line 2798
*xpp = (void*)xp;
+#line 2798
}
+#line 2798
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2798
+#line 2798
#else /* not SX */
+#line 2798
const char *xp = (const char *) *xpp;
+#line 2798
int status = ENOERR;
+#line 2798
+#line 2798
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2798
{
+#line 2798
const int lstatus = ncx_get_int_schar(xp, tp);
+#line 2798
if(lstatus != ENOERR)
+#line 2798
status = lstatus;
+#line 2798
}
+#line 2798
+#line 2798
*xpp = (const void *)xp;
+#line 2798
return status;
+#line 2798
# endif
+#line 2798
}
+#line 2798
int
+#line 2799
ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2799
{
+#line 2799
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2799
+#line 2799
/* basic algorithm is:
+#line 2799
* - ensure sane alignment of input data
+#line 2799
* - copy (conversion happens automatically) input data
+#line 2799
* to output
+#line 2799
* - update xpp to point at next unconverted input, and tp to point
+#line 2799
* at next location for converted output
+#line 2799
*/
+#line 2799
long i, j, ni;
+#line 2799
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2799
int *xp;
+#line 2799
int nrange = 0; /* number of range errors */
+#line 2799
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2799
long cxp = (long) *((char**)xpp);
+#line 2799
+#line 2799
realign = (cxp & 7) % SIZEOF_INT;
+#line 2799
/* sjl: manually stripmine so we can limit amount of
+#line 2799
* vector work space reserved to LOOPCNT elements. Also
+#line 2799
* makes vectorisation easy */
+#line 2799
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2799
ni=Min(nelems-j,LOOPCNT);
+#line 2799
if (realign) {
+#line 2799
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2799
xp = tmp;
+#line 2799
} else {
+#line 2799
xp = (int *) *xpp;
+#line 2799
}
+#line 2799
/* copy the next block */
+#line 2799
#pragma cdir loopcnt=LOOPCNT
+#line 2799
#pragma cdir shortloop
+#line 2799
for (i=0; i<ni; i++) {
+#line 2799
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2799
/* test for range errors (not always needed but do it anyway) */
+#line 2799
nrange += xp[i] < UCHAR_MIN || xp[i] > UCHAR_MAX;
+#line 2799
}
+#line 2799
/* update xpp and tp */
+#line 2799
if (realign) xp = (int *) *xpp;
+#line 2799
xp += ni;
+#line 2799
tp += ni;
+#line 2799
*xpp = (void*)xp;
+#line 2799
}
+#line 2799
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2799
+#line 2799
#else /* not SX */
+#line 2799
const char *xp = (const char *) *xpp;
+#line 2799
int status = ENOERR;
+#line 2799
+#line 2799
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2799
{
+#line 2799
const int lstatus = ncx_get_int_uchar(xp, tp);
+#line 2799
if(lstatus != ENOERR)
+#line 2799
status = lstatus;
+#line 2799
}
+#line 2799
+#line 2799
*xpp = (const void *)xp;
+#line 2799
return status;
+#line 2799
# endif
+#line 2799
}
+#line 2799
int
+#line 2800
ncx_getn_int_short(const void **xpp, size_t nelems, short *tp)
+#line 2800
{
+#line 2800
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2800
+#line 2800
/* basic algorithm is:
+#line 2800
* - ensure sane alignment of input data
+#line 2800
* - copy (conversion happens automatically) input data
+#line 2800
* to output
+#line 2800
* - update xpp to point at next unconverted input, and tp to point
+#line 2800
* at next location for converted output
+#line 2800
*/
+#line 2800
long i, j, ni;
+#line 2800
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2800
int *xp;
+#line 2800
int nrange = 0; /* number of range errors */
+#line 2800
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2800
long cxp = (long) *((char**)xpp);
+#line 2800
+#line 2800
realign = (cxp & 7) % SIZEOF_INT;
+#line 2800
/* sjl: manually stripmine so we can limit amount of
+#line 2800
* vector work space reserved to LOOPCNT elements. Also
+#line 2800
* makes vectorisation easy */
+#line 2800
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2800
ni=Min(nelems-j,LOOPCNT);
+#line 2800
if (realign) {
+#line 2800
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2800
xp = tmp;
+#line 2800
} else {
+#line 2800
xp = (int *) *xpp;
+#line 2800
}
+#line 2800
/* copy the next block */
+#line 2800
#pragma cdir loopcnt=LOOPCNT
+#line 2800
#pragma cdir shortloop
+#line 2800
for (i=0; i<ni; i++) {
+#line 2800
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2800
/* test for range errors (not always needed but do it anyway) */
+#line 2800
nrange += xp[i] < SHORT_MIN || xp[i] > SHORT_MAX;
+#line 2800
}
+#line 2800
/* update xpp and tp */
+#line 2800
if (realign) xp = (int *) *xpp;
+#line 2800
xp += ni;
+#line 2800
tp += ni;
+#line 2800
*xpp = (void*)xp;
+#line 2800
}
+#line 2800
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2800
+#line 2800
#else /* not SX */
+#line 2800
const char *xp = (const char *) *xpp;
+#line 2800
int status = ENOERR;
+#line 2800
+#line 2800
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2800
{
+#line 2800
const int lstatus = ncx_get_int_short(xp, tp);
+#line 2800
if(lstatus != ENOERR)
+#line 2800
status = lstatus;
+#line 2800
}
+#line 2800
+#line 2800
*xpp = (const void *)xp;
+#line 2800
return status;
+#line 2800
# endif
+#line 2800
}
+#line 2800
#if X_SIZEOF_INT == SIZEOF_INT
/* optimized version */
@@ -4698,590 +7367,1163 @@ ncx_getn_int_uint(const void **xpp, size_t nelems, unsigned int *tp)
}
#else
int
+#line 2826
ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
+#line 2826
{
+#line 2826
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2826
+#line 2826
/* basic algorithm is:
+#line 2826
* - ensure sane alignment of input data
+#line 2826
* - copy (conversion happens automatically) input data
+#line 2826
* to output
+#line 2826
* - update xpp to point at next unconverted input, and tp to point
+#line 2826
* at next location for converted output
+#line 2826
*/
+#line 2826
long i, j, ni;
+#line 2826
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2826
int *xp;
+#line 2826
int nrange = 0; /* number of range errors */
+#line 2826
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2826
long cxp = (long) *((char**)xpp);
+#line 2826
+#line 2826
realign = (cxp & 7) % SIZEOF_INT;
+#line 2826
/* sjl: manually stripmine so we can limit amount of
+#line 2826
* vector work space reserved to LOOPCNT elements. Also
+#line 2826
* makes vectorisation easy */
+#line 2826
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2826
ni=Min(nelems-j,LOOPCNT);
+#line 2826
if (realign) {
+#line 2826
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2826
xp = tmp;
+#line 2826
} else {
+#line 2826
xp = (int *) *xpp;
+#line 2826
}
+#line 2826
/* copy the next block */
+#line 2826
#pragma cdir loopcnt=LOOPCNT
+#line 2826
#pragma cdir shortloop
+#line 2826
for (i=0; i<ni; i++) {
+#line 2826
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2826
/* test for range errors (not always needed but do it anyway) */
+#line 2826
nrange += xp[i] < INT_MIN || xp[i] > INT_MAX;
+#line 2826
}
+#line 2826
/* update xpp and tp */
+#line 2826
if (realign) xp = (int *) *xpp;
+#line 2826
xp += ni;
+#line 2826
tp += ni;
+#line 2826
*xpp = (void*)xp;
+#line 2826
}
+#line 2826
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2826
+#line 2826
#else /* not SX */
+#line 2826
const char *xp = (const char *) *xpp;
+#line 2826
int status = ENOERR;
+#line 2826
+#line 2826
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2826
{
+#line 2826
const int lstatus = ncx_get_int_int(xp, tp);
+#line 2826
if(lstatus != ENOERR)
+#line 2826
status = lstatus;
+#line 2826
}
+#line 2826
+#line 2826
*xpp = (const void *)xp;
+#line 2826
return status;
+#line 2826
# endif
+#line 2826
}
+#line 2826
int
+#line 2827
ncx_getn_int_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2827
{
+#line 2827
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2827
+#line 2827
/* basic algorithm is:
+#line 2827
* - ensure sane alignment of input data
+#line 2827
* - copy (conversion happens automatically) input data
+#line 2827
* to output
+#line 2827
* - update xpp to point at next unconverted input, and tp to point
+#line 2827
* at next location for converted output
+#line 2827
*/
+#line 2827
long i, j, ni;
+#line 2827
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2827
int *xp;
+#line 2827
int nrange = 0; /* number of range errors */
+#line 2827
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2827
long cxp = (long) *((char**)xpp);
+#line 2827
+#line 2827
realign = (cxp & 7) % SIZEOF_INT;
+#line 2827
/* sjl: manually stripmine so we can limit amount of
+#line 2827
* vector work space reserved to LOOPCNT elements. Also
+#line 2827
* makes vectorisation easy */
+#line 2827
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2827
ni=Min(nelems-j,LOOPCNT);
+#line 2827
if (realign) {
+#line 2827
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2827
xp = tmp;
+#line 2827
} else {
+#line 2827
xp = (int *) *xpp;
+#line 2827
}
+#line 2827
/* copy the next block */
+#line 2827
#pragma cdir loopcnt=LOOPCNT
+#line 2827
#pragma cdir shortloop
+#line 2827
for (i=0; i<ni; i++) {
+#line 2827
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2827
/* test for range errors (not always needed but do it anyway) */
+#line 2827
nrange += xp[i] < UINT_MIN || xp[i] > UINT_MAX;
+#line 2827
}
+#line 2827
/* update xpp and tp */
+#line 2827
if (realign) xp = (int *) *xpp;
+#line 2827
xp += ni;
+#line 2827
tp += ni;
+#line 2827
*xpp = (void*)xp;
+#line 2827
}
+#line 2827
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2827
+#line 2827
#else /* not SX */
+#line 2827
const char *xp = (const char *) *xpp;
+#line 2827
int status = ENOERR;
+#line 2827
+#line 2827
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2827
{
+#line 2827
const int lstatus = ncx_get_int_uint(xp, tp);
+#line 2827
if(lstatus != ENOERR)
+#line 2827
status = lstatus;
+#line 2827
}
+#line 2827
+#line 2827
*xpp = (const void *)xp;
+#line 2827
return status;
+#line 2827
# endif
+#line 2827
}
+#line 2827
#endif
int
+#line 2830
ncx_getn_int_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2830
{
+#line 2830
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2830
+#line 2830
/* basic algorithm is:
+#line 2830
* - ensure sane alignment of input data
+#line 2830
* - copy (conversion happens automatically) input data
+#line 2830
* to output
+#line 2830
* - update xpp to point at next unconverted input, and tp to point
+#line 2830
* at next location for converted output
+#line 2830
*/
+#line 2830
long i, j, ni;
+#line 2830
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2830
int *xp;
+#line 2830
int nrange = 0; /* number of range errors */
+#line 2830
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2830
long cxp = (long) *((char**)xpp);
+#line 2830
+#line 2830
realign = (cxp & 7) % SIZEOF_INT;
+#line 2830
/* sjl: manually stripmine so we can limit amount of
+#line 2830
* vector work space reserved to LOOPCNT elements. Also
+#line 2830
* makes vectorisation easy */
+#line 2830
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2830
ni=Min(nelems-j,LOOPCNT);
+#line 2830
if (realign) {
+#line 2830
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2830
xp = tmp;
+#line 2830
} else {
+#line 2830
xp = (int *) *xpp;
+#line 2830
}
+#line 2830
/* copy the next block */
+#line 2830
#pragma cdir loopcnt=LOOPCNT
+#line 2830
#pragma cdir shortloop
+#line 2830
for (i=0; i<ni; i++) {
+#line 2830
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2830
/* test for range errors (not always needed but do it anyway) */
+#line 2830
nrange += xp[i] < LONGLONG_MIN || xp[i] > LONGLONG_MAX;
+#line 2830
}
+#line 2830
/* update xpp and tp */
+#line 2830
if (realign) xp = (int *) *xpp;
+#line 2830
xp += ni;
+#line 2830
tp += ni;
+#line 2830
*xpp = (void*)xp;
+#line 2830
}
+#line 2830
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2830
+#line 2830
#else /* not SX */
+#line 2830
const char *xp = (const char *) *xpp;
+#line 2830
int status = ENOERR;
+#line 2830
+#line 2830
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2830
{
+#line 2830
const int lstatus = ncx_get_int_longlong(xp, tp);
+#line 2830
if(lstatus != ENOERR)
+#line 2830
status = lstatus;
+#line 2830
}
+#line 2830
+#line 2830
*xpp = (const void *)xp;
+#line 2830
return status;
+#line 2830
# endif
+#line 2830
}
+#line 2830
int
+#line 2831
ncx_getn_int_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2831
{
+#line 2831
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2831
+#line 2831
/* basic algorithm is:
+#line 2831
* - ensure sane alignment of input data
+#line 2831
* - copy (conversion happens automatically) input data
+#line 2831
* to output
+#line 2831
* - update xpp to point at next unconverted input, and tp to point
+#line 2831
* at next location for converted output
+#line 2831
*/
+#line 2831
long i, j, ni;
+#line 2831
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2831
int *xp;
+#line 2831
int nrange = 0; /* number of range errors */
+#line 2831
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2831
long cxp = (long) *((char**)xpp);
+#line 2831
+#line 2831
realign = (cxp & 7) % SIZEOF_INT;
+#line 2831
/* sjl: manually stripmine so we can limit amount of
+#line 2831
* vector work space reserved to LOOPCNT elements. Also
+#line 2831
* makes vectorisation easy */
+#line 2831
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2831
ni=Min(nelems-j,LOOPCNT);
+#line 2831
if (realign) {
+#line 2831
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2831
xp = tmp;
+#line 2831
} else {
+#line 2831
xp = (int *) *xpp;
+#line 2831
}
+#line 2831
/* copy the next block */
+#line 2831
#pragma cdir loopcnt=LOOPCNT
+#line 2831
#pragma cdir shortloop
+#line 2831
for (i=0; i<ni; i++) {
+#line 2831
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2831
/* test for range errors (not always needed but do it anyway) */
+#line 2831
nrange += xp[i] < ULONGLONG_MIN || xp[i] > ULONGLONG_MAX;
+#line 2831
}
+#line 2831
/* update xpp and tp */
+#line 2831
if (realign) xp = (int *) *xpp;
+#line 2831
xp += ni;
+#line 2831
tp += ni;
+#line 2831
*xpp = (void*)xp;
+#line 2831
}
+#line 2831
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2831
+#line 2831
#else /* not SX */
+#line 2831
const char *xp = (const char *) *xpp;
+#line 2831
int status = ENOERR;
+#line 2831
+#line 2831
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2831
{
+#line 2831
const int lstatus = ncx_get_int_ulonglong(xp, tp);
+#line 2831
if(lstatus != ENOERR)
+#line 2831
status = lstatus;
+#line 2831
}
+#line 2831
+#line 2831
*xpp = (const void *)xp;
+#line 2831
return status;
+#line 2831
# endif
+#line 2831
}
+#line 2831
int
+#line 2833
ncx_getn_int_float(const void **xpp, size_t nelems, float *tp)
+#line 2833
{
+#line 2833
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2833
+#line 2833
/* basic algorithm is:
+#line 2833
* - ensure sane alignment of input data
+#line 2833
* - copy (conversion happens automatically) input data
+#line 2833
* to output
+#line 2833
* - update xpp to point at next unconverted input, and tp to point
+#line 2833
* at next location for converted output
+#line 2833
*/
+#line 2833
long i, j, ni;
+#line 2833
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2833
int *xp;
+#line 2833
int nrange = 0; /* number of range errors */
+#line 2833
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2833
long cxp = (long) *((char**)xpp);
+#line 2833
+#line 2833
realign = (cxp & 7) % SIZEOF_INT;
+#line 2833
/* sjl: manually stripmine so we can limit amount of
+#line 2833
* vector work space reserved to LOOPCNT elements. Also
+#line 2833
* makes vectorisation easy */
+#line 2833
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2833
ni=Min(nelems-j,LOOPCNT);
+#line 2833
if (realign) {
+#line 2833
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2833
xp = tmp;
+#line 2833
} else {
+#line 2833
xp = (int *) *xpp;
+#line 2833
}
+#line 2833
/* copy the next block */
+#line 2833
#pragma cdir loopcnt=LOOPCNT
+#line 2833
#pragma cdir shortloop
+#line 2833
for (i=0; i<ni; i++) {
+#line 2833
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2833
/* test for range errors (not always needed but do it anyway) */
+#line 2833
nrange += xp[i] < FLOAT_MIN || xp[i] > FLOAT_MAX;
+#line 2833
}
+#line 2833
/* update xpp and tp */
+#line 2833
if (realign) xp = (int *) *xpp;
+#line 2833
xp += ni;
+#line 2833
tp += ni;
+#line 2833
*xpp = (void*)xp;
+#line 2833
}
+#line 2833
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2833
+#line 2833
#else /* not SX */
+#line 2833
const char *xp = (const char *) *xpp;
+#line 2833
int status = ENOERR;
+#line 2833
+#line 2833
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2833
{
+#line 2833
const int lstatus = ncx_get_int_float(xp, tp);
+#line 2833
if(lstatus != ENOERR)
+#line 2833
status = lstatus;
+#line 2833
}
+#line 2833
+#line 2833
*xpp = (const void *)xp;
+#line 2833
return status;
+#line 2833
# endif
+#line 2833
}
+#line 2833
int
+#line 2834
ncx_getn_int_double(const void **xpp, size_t nelems, double *tp)
+#line 2834
{
+#line 2834
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2834
+#line 2834
/* basic algorithm is:
+#line 2834
* - ensure sane alignment of input data
+#line 2834
* - copy (conversion happens automatically) input data
+#line 2834
* to output
+#line 2834
* - update xpp to point at next unconverted input, and tp to point
+#line 2834
* at next location for converted output
+#line 2834
*/
+#line 2834
long i, j, ni;
+#line 2834
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2834
int *xp;
+#line 2834
int nrange = 0; /* number of range errors */
+#line 2834
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2834
long cxp = (long) *((char**)xpp);
+#line 2834
+#line 2834
realign = (cxp & 7) % SIZEOF_INT;
+#line 2834
/* sjl: manually stripmine so we can limit amount of
+#line 2834
* vector work space reserved to LOOPCNT elements. Also
+#line 2834
* makes vectorisation easy */
+#line 2834
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2834
ni=Min(nelems-j,LOOPCNT);
+#line 2834
if (realign) {
+#line 2834
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2834
xp = tmp;
+#line 2834
} else {
+#line 2834
xp = (int *) *xpp;
+#line 2834
}
+#line 2834
/* copy the next block */
+#line 2834
#pragma cdir loopcnt=LOOPCNT
+#line 2834
#pragma cdir shortloop
+#line 2834
for (i=0; i<ni; i++) {
+#line 2834
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2834
/* test for range errors (not always needed but do it anyway) */
+#line 2834
nrange += xp[i] < DOUBLE_MIN || xp[i] > DOUBLE_MAX;
+#line 2834
}
+#line 2834
/* update xpp and tp */
+#line 2834
if (realign) xp = (int *) *xpp;
+#line 2834
xp += ni;
+#line 2834
tp += ni;
+#line 2834
*xpp = (void*)xp;
+#line 2834
}
+#line 2834
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2834
+#line 2834
#else /* not SX */
+#line 2834
const char *xp = (const char *) *xpp;
+#line 2834
int status = ENOERR;
+#line 2834
+#line 2834
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2834
{
+#line 2834
const int lstatus = ncx_get_int_double(xp, tp);
+#line 2834
if(lstatus != ENOERR)
+#line 2834
status = lstatus;
+#line 2834
}
+#line 2834
+#line 2834
*xpp = (const void *)xp;
+#line 2834
return status;
+#line 2834
# endif
+#line 2834
}
+#line 2834
int
+#line 2836
ncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2836
{
+#line 2836
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2836
+#line 2836
/* basic algorithm is:
+#line 2836
* - ensure sane alignment of output data
+#line 2836
* - copy (conversion happens automatically) input data
+#line 2836
* to output
+#line 2836
* - update tp to point at next unconverted input, and xpp to point
+#line 2836
* at next location for converted output
+#line 2836
*/
+#line 2836
long i, j, ni;
+#line 2836
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2836
int *xp;
+#line 2836
int nrange = 0; /* number of range errors */
+#line 2836
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2836
long cxp = (long) *((char**)xpp);
+#line 2836
+#line 2836
realign = (cxp & 7) % SIZEOF_INT;
+#line 2836
/* sjl: manually stripmine so we can limit amount of
+#line 2836
* vector work space reserved to LOOPCNT elements. Also
+#line 2836
* makes vectorisation easy */
+#line 2836
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2836
ni=Min(nelems-j,LOOPCNT);
+#line 2836
if (realign) {
+#line 2836
xp = tmp;
+#line 2836
} else {
+#line 2836
xp = (int *) *xpp;
+#line 2836
}
+#line 2836
/* copy the next block */
+#line 2836
#pragma cdir loopcnt=LOOPCNT
+#line 2836
#pragma cdir shortloop
+#line 2836
for (i=0; i<ni; i++) {
+#line 2836
/* the normal case: */
+#line 2836
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2836
/* test for range errors (not always needed but do it anyway) */
+#line 2836
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2836
}
- /* copy workspace back if necessary */
+#line 2836
+ /* copy workspace back if necessary */
+#line 2836
if (realign) {
+#line 2836
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2836
xp = (int *) *xpp;
+#line 2836
}
+#line 2836
/* update xpp and tp */
+#line 2836
xp += ni;
+#line 2836
tp += ni;
+#line 2836
*xpp = (void*)xp;
+#line 2836
}
+#line 2836
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2836
+#line 2836
#else /* not SX */
+#line 2836
+#line 2836
char *xp = (char *) *xpp;
+#line 2836
int status = ENOERR;
+#line 2836
+#line 2836
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2836
{
+#line 2836
int lstatus = ncx_put_int_schar(xp, tp);
+#line 2836
if(lstatus != ENOERR)
+#line 2836
status = lstatus;
+#line 2836
}
+#line 2836
+#line 2836
*xpp = (void *)xp;
+#line 2836
return status;
+#line 2836
#endif
+#line 2836
}
+#line 2836
int
+#line 2837
ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2837
{
+#line 2837
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2837
+#line 2837
/* basic algorithm is:
+#line 2837
* - ensure sane alignment of output data
+#line 2837
* - copy (conversion happens automatically) input data
+#line 2837
* to output
+#line 2837
* - update tp to point at next unconverted input, and xpp to point
+#line 2837
* at next location for converted output
+#line 2837
*/
+#line 2837
long i, j, ni;
+#line 2837
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2837
int *xp;
+#line 2837
int nrange = 0; /* number of range errors */
+#line 2837
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2837
long cxp = (long) *((char**)xpp);
+#line 2837
+#line 2837
realign = (cxp & 7) % SIZEOF_INT;
+#line 2837
/* sjl: manually stripmine so we can limit amount of
+#line 2837
* vector work space reserved to LOOPCNT elements. Also
+#line 2837
* makes vectorisation easy */
+#line 2837
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2837
ni=Min(nelems-j,LOOPCNT);
+#line 2837
if (realign) {
+#line 2837
xp = tmp;
+#line 2837
} else {
+#line 2837
xp = (int *) *xpp;
+#line 2837
}
+#line 2837
/* copy the next block */
+#line 2837
#pragma cdir loopcnt=LOOPCNT
+#line 2837
#pragma cdir shortloop
+#line 2837
for (i=0; i<ni; i++) {
+#line 2837
/* the normal case: */
+#line 2837
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2837
/* test for range errors (not always needed but do it anyway) */
+#line 2837
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2837
}
- /* copy workspace back if necessary */
+#line 2837
+ /* copy workspace back if necessary */
+#line 2837
if (realign) {
+#line 2837
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2837
xp = (int *) *xpp;
+#line 2837
}
+#line 2837
/* update xpp and tp */
+#line 2837
xp += ni;
+#line 2837
tp += ni;
+#line 2837
*xpp = (void*)xp;
+#line 2837
}
+#line 2837
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2837
+#line 2837
#else /* not SX */
+#line 2837
+#line 2837
char *xp = (char *) *xpp;
+#line 2837
int status = ENOERR;
+#line 2837
+#line 2837
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2837
{
+#line 2837
int lstatus = ncx_put_int_uchar(xp, tp);
+#line 2837
if(lstatus != ENOERR)
+#line 2837
status = lstatus;
+#line 2837
}
+#line 2837
+#line 2837
*xpp = (void *)xp;
+#line 2837
return status;
+#line 2837
#endif
+#line 2837
}
+#line 2837
int
+#line 2838
ncx_putn_int_short(void **xpp, size_t nelems, const short *tp)
+#line 2838
{
+#line 2838
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2838
+#line 2838
/* basic algorithm is:
+#line 2838
* - ensure sane alignment of output data
+#line 2838
* - copy (conversion happens automatically) input data
+#line 2838
* to output
+#line 2838
* - update tp to point at next unconverted input, and xpp to point
+#line 2838
* at next location for converted output
+#line 2838
*/
+#line 2838
long i, j, ni;
+#line 2838
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2838
int *xp;
+#line 2838
int nrange = 0; /* number of range errors */
+#line 2838
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2838
long cxp = (long) *((char**)xpp);
+#line 2838
+#line 2838
realign = (cxp & 7) % SIZEOF_INT;
+#line 2838
/* sjl: manually stripmine so we can limit amount of
+#line 2838
* vector work space reserved to LOOPCNT elements. Also
+#line 2838
* makes vectorisation easy */
+#line 2838
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2838
ni=Min(nelems-j,LOOPCNT);
+#line 2838
if (realign) {
+#line 2838
xp = tmp;
+#line 2838
} else {
+#line 2838
xp = (int *) *xpp;
+#line 2838
}
+#line 2838
/* copy the next block */
+#line 2838
#pragma cdir loopcnt=LOOPCNT
+#line 2838
#pragma cdir shortloop
+#line 2838
for (i=0; i<ni; i++) {
+#line 2838
/* the normal case: */
+#line 2838
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2838
/* test for range errors (not always needed but do it anyway) */
+#line 2838
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2838
}
- /* copy workspace back if necessary */
+#line 2838
+ /* copy workspace back if necessary */
+#line 2838
if (realign) {
+#line 2838
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2838
xp = (int *) *xpp;
+#line 2838
}
+#line 2838
/* update xpp and tp */
+#line 2838
xp += ni;
+#line 2838
tp += ni;
+#line 2838
*xpp = (void*)xp;
+#line 2838
}
+#line 2838
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2838
+#line 2838
#else /* not SX */
+#line 2838
+#line 2838
char *xp = (char *) *xpp;
+#line 2838
int status = ENOERR;
+#line 2838
+#line 2838
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2838
{
+#line 2838
int lstatus = ncx_put_int_short(xp, tp);
+#line 2838
if(lstatus != ENOERR)
+#line 2838
status = lstatus;
+#line 2838
}
+#line 2838
+#line 2838
*xpp = (void *)xp;
+#line 2838
return status;
+#line 2838
#endif
+#line 2838
}
+#line 2838
#if X_SIZEOF_INT == SIZEOF_INT
/* optimized version */
@@ -5309,671 +8551,1322 @@ ncx_putn_int_uint(void **xpp, size_t nelems, const unsigned int *tp)
}
#else
int
+#line 2864
ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
+#line 2864
{
+#line 2864
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2864
+#line 2864
/* basic algorithm is:
+#line 2864
* - ensure sane alignment of output data
+#line 2864
* - copy (conversion happens automatically) input data
+#line 2864
* to output
+#line 2864
* - update tp to point at next unconverted input, and xpp to point
+#line 2864
* at next location for converted output
+#line 2864
*/
+#line 2864
long i, j, ni;
+#line 2864
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2864
int *xp;
+#line 2864
int nrange = 0; /* number of range errors */
+#line 2864
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2864
long cxp = (long) *((char**)xpp);
+#line 2864
+#line 2864
realign = (cxp & 7) % SIZEOF_INT;
+#line 2864
/* sjl: manually stripmine so we can limit amount of
+#line 2864
* vector work space reserved to LOOPCNT elements. Also
+#line 2864
* makes vectorisation easy */
+#line 2864
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2864
ni=Min(nelems-j,LOOPCNT);
+#line 2864
if (realign) {
+#line 2864
xp = tmp;
+#line 2864
} else {
+#line 2864
xp = (int *) *xpp;
+#line 2864
}
+#line 2864
/* copy the next block */
+#line 2864
#pragma cdir loopcnt=LOOPCNT
+#line 2864
#pragma cdir shortloop
+#line 2864
for (i=0; i<ni; i++) {
+#line 2864
/* the normal case: */
+#line 2864
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2864
/* test for range errors (not always needed but do it anyway) */
+#line 2864
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2864
}
- /* copy workspace back if necessary */
+#line 2864
+ /* copy workspace back if necessary */
+#line 2864
if (realign) {
+#line 2864
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2864
xp = (int *) *xpp;
+#line 2864
}
+#line 2864
/* update xpp and tp */
+#line 2864
xp += ni;
+#line 2864
tp += ni;
+#line 2864
*xpp = (void*)xp;
+#line 2864
}
+#line 2864
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2864
+#line 2864
#else /* not SX */
+#line 2864
+#line 2864
char *xp = (char *) *xpp;
+#line 2864
int status = ENOERR;
+#line 2864
+#line 2864
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2864
{
+#line 2864
int lstatus = ncx_put_int_int(xp, tp);
+#line 2864
if(lstatus != ENOERR)
+#line 2864
status = lstatus;
+#line 2864
}
+#line 2864
+#line 2864
*xpp = (void *)xp;
+#line 2864
return status;
+#line 2864
#endif
+#line 2864
}
+#line 2864
int
+#line 2865
ncx_putn_int_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2865
{
+#line 2865
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2865
+#line 2865
/* basic algorithm is:
+#line 2865
* - ensure sane alignment of output data
+#line 2865
* - copy (conversion happens automatically) input data
+#line 2865
* to output
+#line 2865
* - update tp to point at next unconverted input, and xpp to point
+#line 2865
* at next location for converted output
+#line 2865
*/
+#line 2865
long i, j, ni;
+#line 2865
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2865
int *xp;
+#line 2865
int nrange = 0; /* number of range errors */
+#line 2865
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2865
long cxp = (long) *((char**)xpp);
+#line 2865
+#line 2865
realign = (cxp & 7) % SIZEOF_INT;
+#line 2865
/* sjl: manually stripmine so we can limit amount of
+#line 2865
* vector work space reserved to LOOPCNT elements. Also
+#line 2865
* makes vectorisation easy */
+#line 2865
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2865
ni=Min(nelems-j,LOOPCNT);
+#line 2865
if (realign) {
+#line 2865
xp = tmp;
+#line 2865
} else {
+#line 2865
xp = (int *) *xpp;
+#line 2865
}
+#line 2865
/* copy the next block */
+#line 2865
#pragma cdir loopcnt=LOOPCNT
+#line 2865
#pragma cdir shortloop
+#line 2865
for (i=0; i<ni; i++) {
+#line 2865
/* the normal case: */
+#line 2865
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2865
/* test for range errors (not always needed but do it anyway) */
+#line 2865
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2865
}
- /* copy workspace back if necessary */
+#line 2865
+ /* copy workspace back if necessary */
+#line 2865
if (realign) {
+#line 2865
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2865
xp = (int *) *xpp;
+#line 2865
}
+#line 2865
/* update xpp and tp */
+#line 2865
xp += ni;
+#line 2865
tp += ni;
+#line 2865
*xpp = (void*)xp;
+#line 2865
}
+#line 2865
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2865
+#line 2865
#else /* not SX */
+#line 2865
+#line 2865
char *xp = (char *) *xpp;
+#line 2865
int status = ENOERR;
+#line 2865
+#line 2865
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2865
{
+#line 2865
int lstatus = ncx_put_int_uint(xp, tp);
+#line 2865
if(lstatus != ENOERR)
+#line 2865
status = lstatus;
+#line 2865
}
+#line 2865
+#line 2865
*xpp = (void *)xp;
+#line 2865
return status;
+#line 2865
#endif
+#line 2865
}
+#line 2865
#endif
int
+#line 2868
ncx_putn_int_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2868
{
+#line 2868
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2868
+#line 2868
/* basic algorithm is:
+#line 2868
* - ensure sane alignment of output data
+#line 2868
* - copy (conversion happens automatically) input data
+#line 2868
* to output
+#line 2868
* - update tp to point at next unconverted input, and xpp to point
+#line 2868
* at next location for converted output
+#line 2868
*/
+#line 2868
long i, j, ni;
+#line 2868
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2868
int *xp;
+#line 2868
int nrange = 0; /* number of range errors */
+#line 2868
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2868
long cxp = (long) *((char**)xpp);
+#line 2868
+#line 2868
realign = (cxp & 7) % SIZEOF_INT;
+#line 2868
/* sjl: manually stripmine so we can limit amount of
+#line 2868
* vector work space reserved to LOOPCNT elements. Also
+#line 2868
* makes vectorisation easy */
+#line 2868
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2868
ni=Min(nelems-j,LOOPCNT);
+#line 2868
if (realign) {
+#line 2868
xp = tmp;
+#line 2868
} else {
+#line 2868
xp = (int *) *xpp;
+#line 2868
}
+#line 2868
/* copy the next block */
+#line 2868
#pragma cdir loopcnt=LOOPCNT
+#line 2868
#pragma cdir shortloop
+#line 2868
for (i=0; i<ni; i++) {
+#line 2868
/* the normal case: */
+#line 2868
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2868
/* test for range errors (not always needed but do it anyway) */
+#line 2868
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2868
}
- /* copy workspace back if necessary */
+#line 2868
+ /* copy workspace back if necessary */
+#line 2868
if (realign) {
+#line 2868
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2868
xp = (int *) *xpp;
+#line 2868
}
+#line 2868
/* update xpp and tp */
+#line 2868
xp += ni;
+#line 2868
tp += ni;
+#line 2868
*xpp = (void*)xp;
+#line 2868
}
+#line 2868
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2868
+#line 2868
#else /* not SX */
+#line 2868
+#line 2868
char *xp = (char *) *xpp;
+#line 2868
int status = ENOERR;
+#line 2868
+#line 2868
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2868
{
+#line 2868
int lstatus = ncx_put_int_longlong(xp, tp);
+#line 2868
if(lstatus != ENOERR)
+#line 2868
status = lstatus;
+#line 2868
}
+#line 2868
+#line 2868
*xpp = (void *)xp;
+#line 2868
return status;
+#line 2868
#endif
+#line 2868
}
+#line 2868
int
+#line 2869
ncx_putn_int_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2869
{
+#line 2869
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2869
+#line 2869
/* basic algorithm is:
+#line 2869
* - ensure sane alignment of output data
+#line 2869
* - copy (conversion happens automatically) input data
+#line 2869
* to output
+#line 2869
* - update tp to point at next unconverted input, and xpp to point
+#line 2869
* at next location for converted output
+#line 2869
*/
+#line 2869
long i, j, ni;
+#line 2869
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2869
int *xp;
+#line 2869
int nrange = 0; /* number of range errors */
+#line 2869
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2869
long cxp = (long) *((char**)xpp);
+#line 2869
+#line 2869
realign = (cxp & 7) % SIZEOF_INT;
+#line 2869
/* sjl: manually stripmine so we can limit amount of
+#line 2869
* vector work space reserved to LOOPCNT elements. Also
+#line 2869
* makes vectorisation easy */
+#line 2869
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2869
ni=Min(nelems-j,LOOPCNT);
+#line 2869
if (realign) {
+#line 2869
xp = tmp;
+#line 2869
} else {
+#line 2869
xp = (int *) *xpp;
+#line 2869
}
+#line 2869
/* copy the next block */
+#line 2869
#pragma cdir loopcnt=LOOPCNT
+#line 2869
#pragma cdir shortloop
+#line 2869
for (i=0; i<ni; i++) {
+#line 2869
/* the normal case: */
+#line 2869
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2869
/* test for range errors (not always needed but do it anyway) */
+#line 2869
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2869
}
- /* copy workspace back if necessary */
+#line 2869
+ /* copy workspace back if necessary */
+#line 2869
if (realign) {
+#line 2869
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2869
xp = (int *) *xpp;
+#line 2869
}
+#line 2869
/* update xpp and tp */
+#line 2869
xp += ni;
+#line 2869
tp += ni;
+#line 2869
*xpp = (void*)xp;
+#line 2869
}
+#line 2869
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2869
+#line 2869
#else /* not SX */
+#line 2869
+#line 2869
char *xp = (char *) *xpp;
+#line 2869
int status = ENOERR;
+#line 2869
+#line 2869
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2869
{
+#line 2869
int lstatus = ncx_put_int_ulonglong(xp, tp);
+#line 2869
if(lstatus != ENOERR)
+#line 2869
status = lstatus;
+#line 2869
}
+#line 2869
+#line 2869
*xpp = (void *)xp;
+#line 2869
return status;
+#line 2869
#endif
+#line 2869
}
+#line 2869
int
+#line 2870
ncx_putn_int_float(void **xpp, size_t nelems, const float *tp)
+#line 2870
{
+#line 2870
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2870
+#line 2870
/* basic algorithm is:
+#line 2870
* - ensure sane alignment of output data
+#line 2870
* - copy (conversion happens automatically) input data
+#line 2870
* to output
+#line 2870
* - update tp to point at next unconverted input, and xpp to point
+#line 2870
* at next location for converted output
+#line 2870
*/
+#line 2870
long i, j, ni;
+#line 2870
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2870
int *xp;
+#line 2870
double d; /* special case for ncx_putn_int_float */
+#line 2870
int nrange = 0; /* number of range errors */
+#line 2870
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2870
long cxp = (long) *((char**)xpp);
+#line 2870
+#line 2870
realign = (cxp & 7) % SIZEOF_INT;
+#line 2870
/* sjl: manually stripmine so we can limit amount of
+#line 2870
* vector work space reserved to LOOPCNT elements. Also
+#line 2870
* makes vectorisation easy */
+#line 2870
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2870
ni=Min(nelems-j,LOOPCNT);
+#line 2870
if (realign) {
+#line 2870
xp = tmp;
+#line 2870
} else {
+#line 2870
xp = (int *) *xpp;
+#line 2870
}
+#line 2870
/* copy the next block */
+#line 2870
#pragma cdir loopcnt=LOOPCNT
+#line 2870
#pragma cdir shortloop
+#line 2870
for (i=0; i<ni; i++) {
- /* for some reason int to float, for putn, requires a special case */
+#line 2870
+ /* for some reason int to float, for putn, requires a special case */
+#line 2870
d = tp[i];
+#line 2870
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) d));
+#line 2870
nrange += d < X_INT_MIN || d > X_INT_MAX;
+#line 2870
}
- /* copy workspace back if necessary */
+#line 2870
+ /* copy workspace back if necessary */
+#line 2870
if (realign) {
+#line 2870
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2870
xp = (int *) *xpp;
+#line 2870
}
+#line 2870
/* update xpp and tp */
+#line 2870
xp += ni;
+#line 2870
tp += ni;
+#line 2870
*xpp = (void*)xp;
+#line 2870
}
+#line 2870
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2870
+#line 2870
#else /* not SX */
+#line 2870
+#line 2870
char *xp = (char *) *xpp;
+#line 2870
int status = ENOERR;
+#line 2870
+#line 2870
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2870
{
+#line 2870
int lstatus = ncx_put_int_float(xp, tp);
+#line 2870
if(lstatus != ENOERR)
+#line 2870
status = lstatus;
+#line 2870
}
+#line 2870
+#line 2870
*xpp = (void *)xp;
+#line 2870
return status;
+#line 2870
#endif
+#line 2870
}
+#line 2870
int
+#line 2871
ncx_putn_int_double(void **xpp, size_t nelems, const double *tp)
+#line 2871
{
+#line 2871
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2871
+#line 2871
/* basic algorithm is:
+#line 2871
* - ensure sane alignment of output data
+#line 2871
* - copy (conversion happens automatically) input data
+#line 2871
* to output
+#line 2871
* - update tp to point at next unconverted input, and xpp to point
+#line 2871
* at next location for converted output
+#line 2871
*/
+#line 2871
long i, j, ni;
+#line 2871
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2871
int *xp;
+#line 2871
int nrange = 0; /* number of range errors */
+#line 2871
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2871
long cxp = (long) *((char**)xpp);
+#line 2871
+#line 2871
realign = (cxp & 7) % SIZEOF_INT;
+#line 2871
/* sjl: manually stripmine so we can limit amount of
+#line 2871
* vector work space reserved to LOOPCNT elements. Also
+#line 2871
* makes vectorisation easy */
+#line 2871
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2871
ni=Min(nelems-j,LOOPCNT);
+#line 2871
if (realign) {
+#line 2871
xp = tmp;
+#line 2871
} else {
+#line 2871
xp = (int *) *xpp;
+#line 2871
}
+#line 2871
/* copy the next block */
+#line 2871
#pragma cdir loopcnt=LOOPCNT
+#line 2871
#pragma cdir shortloop
+#line 2871
for (i=0; i<ni; i++) {
+#line 2871
/* the normal case: */
+#line 2871
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2871
/* test for range errors (not always needed but do it anyway) */
+#line 2871
nrange += tp[i] < X_INT_MIN || tp[i] > X_INT_MAX;
+#line 2871
}
- /* copy workspace back if necessary */
+#line 2871
+ /* copy workspace back if necessary */
+#line 2871
if (realign) {
+#line 2871
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2871
xp = (int *) *xpp;
+#line 2871
}
+#line 2871
/* update xpp and tp */
+#line 2871
xp += ni;
+#line 2871
tp += ni;
+#line 2871
*xpp = (void*)xp;
+#line 2871
}
+#line 2871
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2871
+#line 2871
#else /* not SX */
+#line 2871
+#line 2871
char *xp = (char *) *xpp;
+#line 2871
int status = ENOERR;
+#line 2871
+#line 2871
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2871
{
+#line 2871
int lstatus = ncx_put_int_double(xp, tp);
+#line 2871
if(lstatus != ENOERR)
+#line 2871
status = lstatus;
+#line 2871
}
+#line 2871
+#line 2871
*xpp = (void *)xp;
+#line 2871
return status;
+#line 2871
#endif
+#line 2871
}
+#line 2871
/* float */
int
+#line 2876
ncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2876
{
+#line 2876
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2876
+#line 2876
/* basic algorithm is:
+#line 2876
* - ensure sane alignment of input data
+#line 2876
* - copy (conversion happens automatically) input data
+#line 2876
* to output
+#line 2876
* - update xpp to point at next unconverted input, and tp to point
+#line 2876
* at next location for converted output
+#line 2876
*/
+#line 2876
long i, j, ni;
+#line 2876
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2876
float *xp;
+#line 2876
int nrange = 0; /* number of range errors */
+#line 2876
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2876
long cxp = (long) *((char**)xpp);
+#line 2876
+#line 2876
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2876
/* sjl: manually stripmine so we can limit amount of
+#line 2876
* vector work space reserved to LOOPCNT elements. Also
+#line 2876
* makes vectorisation easy */
+#line 2876
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2876
ni=Min(nelems-j,LOOPCNT);
+#line 2876
if (realign) {
+#line 2876
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2876
xp = tmp;
+#line 2876
} else {
+#line 2876
xp = (float *) *xpp;
+#line 2876
}
+#line 2876
/* copy the next block */
+#line 2876
#pragma cdir loopcnt=LOOPCNT
+#line 2876
#pragma cdir shortloop
+#line 2876
for (i=0; i<ni; i++) {
+#line 2876
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2876
/* test for range errors (not always needed but do it anyway) */
+#line 2876
nrange += xp[i] < SCHAR_MIN || xp[i] > SCHAR_MAX;
+#line 2876
}
+#line 2876
/* update xpp and tp */
+#line 2876
if (realign) xp = (float *) *xpp;
+#line 2876
xp += ni;
+#line 2876
tp += ni;
+#line 2876
*xpp = (void*)xp;
+#line 2876
}
+#line 2876
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2876
+#line 2876
#else /* not SX */
+#line 2876
const char *xp = (const char *) *xpp;
+#line 2876
int status = ENOERR;
+#line 2876
+#line 2876
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2876
{
+#line 2876
const int lstatus = ncx_get_float_schar(xp, tp);
+#line 2876
if(lstatus != ENOERR)
+#line 2876
status = lstatus;
+#line 2876
}
+#line 2876
+#line 2876
*xpp = (const void *)xp;
+#line 2876
return status;
+#line 2876
# endif
+#line 2876
}
+#line 2876
int
+#line 2877
ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2877
{
+#line 2877
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2877
+#line 2877
/* basic algorithm is:
+#line 2877
* - ensure sane alignment of input data
+#line 2877
* - copy (conversion happens automatically) input data
+#line 2877
* to output
+#line 2877
* - update xpp to point at next unconverted input, and tp to point
+#line 2877
* at next location for converted output
+#line 2877
*/
+#line 2877
long i, j, ni;
+#line 2877
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2877
float *xp;
+#line 2877
int nrange = 0; /* number of range errors */
+#line 2877
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2877
long cxp = (long) *((char**)xpp);
+#line 2877
+#line 2877
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2877
/* sjl: manually stripmine so we can limit amount of
+#line 2877
* vector work space reserved to LOOPCNT elements. Also
+#line 2877
* makes vectorisation easy */
+#line 2877
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2877
ni=Min(nelems-j,LOOPCNT);
+#line 2877
if (realign) {
+#line 2877
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2877
xp = tmp;
+#line 2877
} else {
+#line 2877
xp = (float *) *xpp;
+#line 2877
}
+#line 2877
/* copy the next block */
+#line 2877
#pragma cdir loopcnt=LOOPCNT
+#line 2877
#pragma cdir shortloop
+#line 2877
for (i=0; i<ni; i++) {
+#line 2877
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2877
/* test for range errors (not always needed but do it anyway) */
+#line 2877
nrange += xp[i] < UCHAR_MIN || xp[i] > UCHAR_MAX;
+#line 2877
}
+#line 2877
/* update xpp and tp */
+#line 2877
if (realign) xp = (float *) *xpp;
+#line 2877
xp += ni;
+#line 2877
tp += ni;
+#line 2877
*xpp = (void*)xp;
+#line 2877
}
+#line 2877
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2877
+#line 2877
#else /* not SX */
+#line 2877
const char *xp = (const char *) *xpp;
+#line 2877
int status = ENOERR;
+#line 2877
+#line 2877
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2877
{
+#line 2877
const int lstatus = ncx_get_float_uchar(xp, tp);
+#line 2877
if(lstatus != ENOERR)
+#line 2877
status = lstatus;
+#line 2877
}
+#line 2877
+#line 2877
*xpp = (const void *)xp;
+#line 2877
return status;
+#line 2877
# endif
+#line 2877
}
+#line 2877
int
+#line 2878
ncx_getn_float_short(const void **xpp, size_t nelems, short *tp)
+#line 2878
{
+#line 2878
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2878
+#line 2878
/* basic algorithm is:
+#line 2878
* - ensure sane alignment of input data
+#line 2878
* - copy (conversion happens automatically) input data
+#line 2878
* to output
+#line 2878
* - update xpp to point at next unconverted input, and tp to point
+#line 2878
* at next location for converted output
+#line 2878
*/
+#line 2878
long i, j, ni;
+#line 2878
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2878
float *xp;
+#line 2878
int nrange = 0; /* number of range errors */
+#line 2878
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2878
long cxp = (long) *((char**)xpp);
+#line 2878
+#line 2878
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2878
/* sjl: manually stripmine so we can limit amount of
+#line 2878
* vector work space reserved to LOOPCNT elements. Also
+#line 2878
* makes vectorisation easy */
+#line 2878
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2878
ni=Min(nelems-j,LOOPCNT);
+#line 2878
if (realign) {
+#line 2878
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2878
xp = tmp;
+#line 2878
} else {
+#line 2878
xp = (float *) *xpp;
+#line 2878
}
+#line 2878
/* copy the next block */
+#line 2878
#pragma cdir loopcnt=LOOPCNT
+#line 2878
#pragma cdir shortloop
+#line 2878
for (i=0; i<ni; i++) {
+#line 2878
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2878
/* test for range errors (not always needed but do it anyway) */
+#line 2878
nrange += xp[i] < SHORT_MIN || xp[i] > SHORT_MAX;
+#line 2878
}
+#line 2878
/* update xpp and tp */
+#line 2878
if (realign) xp = (float *) *xpp;
+#line 2878
xp += ni;
+#line 2878
tp += ni;
+#line 2878
*xpp = (void*)xp;
+#line 2878
}
+#line 2878
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2878
+#line 2878
#else /* not SX */
+#line 2878
const char *xp = (const char *) *xpp;
+#line 2878
int status = ENOERR;
+#line 2878
+#line 2878
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2878
{
+#line 2878
const int lstatus = ncx_get_float_short(xp, tp);
+#line 2878
if(lstatus != ENOERR)
+#line 2878
status = lstatus;
+#line 2878
}
+#line 2878
+#line 2878
*xpp = (const void *)xp;
+#line 2878
return status;
+#line 2878
# endif
+#line 2878
}
+#line 2878
int
+#line 2879
ncx_getn_float_int(const void **xpp, size_t nelems, int *tp)
+#line 2879
{
+#line 2879
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2879
+#line 2879
/* basic algorithm is:
+#line 2879
* - ensure sane alignment of input data
+#line 2879
* - copy (conversion happens automatically) input data
+#line 2879
* to output
+#line 2879
* - update xpp to point at next unconverted input, and tp to point
+#line 2879
* at next location for converted output
+#line 2879
*/
+#line 2879
long i, j, ni;
+#line 2879
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2879
float *xp;
+#line 2879
int nrange = 0; /* number of range errors */
+#line 2879
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2879
long cxp = (long) *((char**)xpp);
+#line 2879
+#line 2879
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2879
/* sjl: manually stripmine so we can limit amount of
+#line 2879
* vector work space reserved to LOOPCNT elements. Also
+#line 2879
* makes vectorisation easy */
+#line 2879
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2879
ni=Min(nelems-j,LOOPCNT);
+#line 2879
if (realign) {
+#line 2879
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2879
xp = tmp;
+#line 2879
} else {
+#line 2879
xp = (float *) *xpp;
+#line 2879
}
+#line 2879
/* copy the next block */
+#line 2879
#pragma cdir loopcnt=LOOPCNT
+#line 2879
#pragma cdir shortloop
+#line 2879
for (i=0; i<ni; i++) {
+#line 2879
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2879
/* test for range errors (not always needed but do it anyway) */
+#line 2879
nrange += xp[i] < INT_MIN || xp[i] > INT_MAX;
+#line 2879
}
+#line 2879
/* update xpp and tp */
+#line 2879
if (realign) xp = (float *) *xpp;
+#line 2879
xp += ni;
+#line 2879
tp += ni;
+#line 2879
*xpp = (void*)xp;
+#line 2879
}
+#line 2879
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2879
+#line 2879
#else /* not SX */
+#line 2879
const char *xp = (const char *) *xpp;
+#line 2879
int status = ENOERR;
+#line 2879
+#line 2879
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2879
{
+#line 2879
const int lstatus = ncx_get_float_int(xp, tp);
+#line 2879
if(lstatus != ENOERR)
+#line 2879
status = lstatus;
+#line 2879
}
+#line 2879
+#line 2879
*xpp = (const void *)xp;
+#line 2879
return status;
+#line 2879
# endif
+#line 2879
}
+#line 2879
#if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT)
/* optimized version */
@@ -5997,50 +9890,95 @@ ncx_getn_float_float(const void **xpp, size_t nfloats, float *ip)
while(ip < end)
{
struct vax_single *const vsp = (struct vax_single *) ip;
+#line 2901
const struct ieee_single *const isp =
+#line 2901
(const struct ieee_single *) (*xpp);
+#line 2901
unsigned exp = isp->exp_hi << 1 | isp->exp_lo;
+#line 2901
+#line 2901
switch(exp) {
+#line 2901
case 0 :
+#line 2901
/* ieee subnormal */
+#line 2901
if(isp->mant_hi == min.ieee.mant_hi
+#line 2901
&& isp->mant_lo_hi == min.ieee.mant_lo_hi
+#line 2901
&& isp->mant_lo_lo == min.ieee.mant_lo_lo)
+#line 2901
{
+#line 2901
*vsp = min.s;
+#line 2901
}
+#line 2901
else
+#line 2901
{
+#line 2901
unsigned mantissa = (isp->mant_hi << 16)
+#line 2901
| isp->mant_lo_hi << 8
+#line 2901
| isp->mant_lo_lo;
+#line 2901
unsigned tmp = mantissa >> 20;
+#line 2901
if(tmp >= 4) {
+#line 2901
vsp->exp = 2;
+#line 2901
} else if (tmp >= 2) {
+#line 2901
vsp->exp = 1;
+#line 2901
} else {
+#line 2901
*vsp = min.s;
+#line 2901
break;
+#line 2901
} /* else */
+#line 2901
tmp = mantissa - (1 << (20 + vsp->exp ));
+#line 2901
tmp <<= 3 - vsp->exp;
+#line 2901
vsp->mantissa2 = tmp;
+#line 2901
vsp->mantissa1 = (tmp >> 16);
+#line 2901
}
+#line 2901
break;
+#line 2901
case 0xfe :
+#line 2901
case 0xff :
+#line 2901
*vsp = max.s;
+#line 2901
break;
+#line 2901
default :
+#line 2901
vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
+#line 2901
vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo;
+#line 2901
vsp->mantissa1 = isp->mant_hi;
+#line 2901
}
+#line 2901
+#line 2901
vsp->sign = isp->sign;
+#line 2901
ip++;
@@ -6068,529 +10006,1045 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
#endif
int
+#line 2927
ncx_getn_float_double(const void **xpp, size_t nelems, double *tp)
+#line 2927
{
+#line 2927
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2927
+#line 2927
/* basic algorithm is:
+#line 2927
* - ensure sane alignment of input data
+#line 2927
* - copy (conversion happens automatically) input data
+#line 2927
* to output
+#line 2927
* - update xpp to point at next unconverted input, and tp to point
+#line 2927
* at next location for converted output
+#line 2927
*/
+#line 2927
long i, j, ni;
+#line 2927
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2927
float *xp;
+#line 2927
int nrange = 0; /* number of range errors */
+#line 2927
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2927
long cxp = (long) *((char**)xpp);
+#line 2927
+#line 2927
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2927
/* sjl: manually stripmine so we can limit amount of
+#line 2927
* vector work space reserved to LOOPCNT elements. Also
+#line 2927
* makes vectorisation easy */
+#line 2927
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2927
ni=Min(nelems-j,LOOPCNT);
+#line 2927
if (realign) {
+#line 2927
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2927
xp = tmp;
+#line 2927
} else {
+#line 2927
xp = (float *) *xpp;
+#line 2927
}
+#line 2927
/* copy the next block */
+#line 2927
#pragma cdir loopcnt=LOOPCNT
+#line 2927
#pragma cdir shortloop
+#line 2927
for (i=0; i<ni; i++) {
+#line 2927
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2927
/* test for range errors (not always needed but do it anyway) */
+#line 2927
nrange += xp[i] < DOUBLE_MIN || xp[i] > DOUBLE_MAX;
+#line 2927
}
+#line 2927
/* update xpp and tp */
+#line 2927
if (realign) xp = (float *) *xpp;
+#line 2927
xp += ni;
+#line 2927
tp += ni;
+#line 2927
*xpp = (void*)xp;
+#line 2927
}
+#line 2927
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2927
+#line 2927
#else /* not SX */
+#line 2927
const char *xp = (const char *) *xpp;
+#line 2927
int status = ENOERR;
+#line 2927
+#line 2927
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2927
{
+#line 2927
const int lstatus = ncx_get_float_double(xp, tp);
+#line 2927
if(lstatus != ENOERR)
+#line 2927
status = lstatus;
+#line 2927
}
+#line 2927
+#line 2927
*xpp = (const void *)xp;
+#line 2927
return status;
+#line 2927
# endif
+#line 2927
}
+#line 2927
int
+#line 2928
ncx_getn_float_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2928
{
+#line 2928
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2928
+#line 2928
/* basic algorithm is:
+#line 2928
* - ensure sane alignment of input data
+#line 2928
* - copy (conversion happens automatically) input data
+#line 2928
* to output
+#line 2928
* - update xpp to point at next unconverted input, and tp to point
+#line 2928
* at next location for converted output
+#line 2928
*/
+#line 2928
long i, j, ni;
+#line 2928
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2928
float *xp;
+#line 2928
int nrange = 0; /* number of range errors */
+#line 2928
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2928
long cxp = (long) *((char**)xpp);
+#line 2928
+#line 2928
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2928
/* sjl: manually stripmine so we can limit amount of
+#line 2928
* vector work space reserved to LOOPCNT elements. Also
+#line 2928
* makes vectorisation easy */
+#line 2928
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2928
ni=Min(nelems-j,LOOPCNT);
+#line 2928
if (realign) {
+#line 2928
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2928
xp = tmp;
+#line 2928
} else {
+#line 2928
xp = (float *) *xpp;
+#line 2928
}
+#line 2928
/* copy the next block */
+#line 2928
#pragma cdir loopcnt=LOOPCNT
+#line 2928
#pragma cdir shortloop
+#line 2928
for (i=0; i<ni; i++) {
+#line 2928
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2928
/* test for range errors (not always needed but do it anyway) */
+#line 2928
nrange += xp[i] < UINT_MIN || xp[i] > UINT_MAX;
+#line 2928
}
+#line 2928
/* update xpp and tp */
+#line 2928
if (realign) xp = (float *) *xpp;
+#line 2928
xp += ni;
+#line 2928
tp += ni;
+#line 2928
*xpp = (void*)xp;
+#line 2928
}
+#line 2928
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2928
+#line 2928
#else /* not SX */
+#line 2928
const char *xp = (const char *) *xpp;
+#line 2928
int status = ENOERR;
+#line 2928
+#line 2928
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2928
{
+#line 2928
const int lstatus = ncx_get_float_uint(xp, tp);
+#line 2928
if(lstatus != ENOERR)
+#line 2928
status = lstatus;
+#line 2928
}
+#line 2928
+#line 2928
*xpp = (const void *)xp;
+#line 2928
return status;
+#line 2928
# endif
+#line 2928
}
+#line 2928
int
+#line 2929
ncx_getn_float_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2929
{
+#line 2929
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2929
+#line 2929
/* basic algorithm is:
+#line 2929
* - ensure sane alignment of input data
+#line 2929
* - copy (conversion happens automatically) input data
+#line 2929
* to output
+#line 2929
* - update xpp to point at next unconverted input, and tp to point
+#line 2929
* at next location for converted output
+#line 2929
*/
+#line 2929
long i, j, ni;
+#line 2929
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2929
float *xp;
+#line 2929
int nrange = 0; /* number of range errors */
+#line 2929
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2929
long cxp = (long) *((char**)xpp);
+#line 2929
+#line 2929
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2929
/* sjl: manually stripmine so we can limit amount of
+#line 2929
* vector work space reserved to LOOPCNT elements. Also
+#line 2929
* makes vectorisation easy */
+#line 2929
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2929
ni=Min(nelems-j,LOOPCNT);
+#line 2929
if (realign) {
+#line 2929
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2929
xp = tmp;
+#line 2929
} else {
+#line 2929
xp = (float *) *xpp;
+#line 2929
}
+#line 2929
/* copy the next block */
+#line 2929
#pragma cdir loopcnt=LOOPCNT
+#line 2929
#pragma cdir shortloop
+#line 2929
for (i=0; i<ni; i++) {
+#line 2929
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2929
/* test for range errors (not always needed but do it anyway) */
+#line 2929
nrange += xp[i] < LONGLONG_MIN || xp[i] > LONGLONG_MAX;
+#line 2929
}
+#line 2929
/* update xpp and tp */
+#line 2929
if (realign) xp = (float *) *xpp;
+#line 2929
xp += ni;
+#line 2929
tp += ni;
+#line 2929
*xpp = (void*)xp;
+#line 2929
}
+#line 2929
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2929
+#line 2929
#else /* not SX */
+#line 2929
const char *xp = (const char *) *xpp;
+#line 2929
int status = ENOERR;
+#line 2929
+#line 2929
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2929
{
+#line 2929
const int lstatus = ncx_get_float_longlong(xp, tp);
+#line 2929
if(lstatus != ENOERR)
+#line 2929
status = lstatus;
+#line 2929
}
+#line 2929
+#line 2929
*xpp = (const void *)xp;
+#line 2929
return status;
+#line 2929
# endif
+#line 2929
}
+#line 2929
int
+#line 2930
ncx_getn_float_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2930
{
+#line 2930
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2930
+#line 2930
/* basic algorithm is:
+#line 2930
* - ensure sane alignment of input data
+#line 2930
* - copy (conversion happens automatically) input data
+#line 2930
* to output
+#line 2930
* - update xpp to point at next unconverted input, and tp to point
+#line 2930
* at next location for converted output
+#line 2930
*/
+#line 2930
long i, j, ni;
+#line 2930
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2930
float *xp;
+#line 2930
int nrange = 0; /* number of range errors */
+#line 2930
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2930
long cxp = (long) *((char**)xpp);
+#line 2930
+#line 2930
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2930
/* sjl: manually stripmine so we can limit amount of
+#line 2930
* vector work space reserved to LOOPCNT elements. Also
+#line 2930
* makes vectorisation easy */
+#line 2930
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2930
ni=Min(nelems-j,LOOPCNT);
+#line 2930
if (realign) {
+#line 2930
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 2930
xp = tmp;
+#line 2930
} else {
+#line 2930
xp = (float *) *xpp;
+#line 2930
}
+#line 2930
/* copy the next block */
+#line 2930
#pragma cdir loopcnt=LOOPCNT
+#line 2930
#pragma cdir shortloop
+#line 2930
for (i=0; i<ni; i++) {
+#line 2930
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2930
/* test for range errors (not always needed but do it anyway) */
+#line 2930
nrange += xp[i] < ULONGLONG_MIN || xp[i] > ULONGLONG_MAX;
+#line 2930
}
+#line 2930
/* update xpp and tp */
+#line 2930
if (realign) xp = (float *) *xpp;
+#line 2930
xp += ni;
+#line 2930
tp += ni;
+#line 2930
*xpp = (void*)xp;
+#line 2930
}
+#line 2930
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2930
+#line 2930
#else /* not SX */
+#line 2930
const char *xp = (const char *) *xpp;
+#line 2930
int status = ENOERR;
+#line 2930
+#line 2930
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2930
{
+#line 2930
const int lstatus = ncx_get_float_ulonglong(xp, tp);
+#line 2930
if(lstatus != ENOERR)
+#line 2930
status = lstatus;
+#line 2930
}
+#line 2930
+#line 2930
*xpp = (const void *)xp;
+#line 2930
return status;
+#line 2930
# endif
+#line 2930
}
+#line 2930
int
+#line 2932
ncx_putn_float_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2932
{
+#line 2932
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2932
+#line 2932
/* basic algorithm is:
+#line 2932
* - ensure sane alignment of output data
+#line 2932
* - copy (conversion happens automatically) input data
+#line 2932
* to output
+#line 2932
* - update tp to point at next unconverted input, and xpp to point
+#line 2932
* at next location for converted output
+#line 2932
*/
+#line 2932
long i, j, ni;
+#line 2932
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2932
float *xp;
+#line 2932
int nrange = 0; /* number of range errors */
+#line 2932
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2932
long cxp = (long) *((char**)xpp);
+#line 2932
+#line 2932
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2932
/* sjl: manually stripmine so we can limit amount of
+#line 2932
* vector work space reserved to LOOPCNT elements. Also
+#line 2932
* makes vectorisation easy */
+#line 2932
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2932
ni=Min(nelems-j,LOOPCNT);
+#line 2932
if (realign) {
+#line 2932
xp = tmp;
+#line 2932
} else {
+#line 2932
xp = (float *) *xpp;
+#line 2932
}
+#line 2932
/* copy the next block */
+#line 2932
#pragma cdir loopcnt=LOOPCNT
+#line 2932
#pragma cdir shortloop
+#line 2932
for (i=0; i<ni; i++) {
+#line 2932
/* the normal case: */
+#line 2932
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2932
/* test for range errors (not always needed but do it anyway) */
+#line 2932
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2932
}
- /* copy workspace back if necessary */
+#line 2932
+ /* copy workspace back if necessary */
+#line 2932
if (realign) {
+#line 2932
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2932
xp = (float *) *xpp;
+#line 2932
}
+#line 2932
/* update xpp and tp */
+#line 2932
xp += ni;
+#line 2932
tp += ni;
+#line 2932
*xpp = (void*)xp;
+#line 2932
}
+#line 2932
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2932
+#line 2932
#else /* not SX */
+#line 2932
+#line 2932
char *xp = (char *) *xpp;
+#line 2932
int status = ENOERR;
+#line 2932
+#line 2932
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2932
{
+#line 2932
int lstatus = ncx_put_float_schar(xp, tp);
+#line 2932
if(lstatus != ENOERR)
+#line 2932
status = lstatus;
+#line 2932
}
+#line 2932
+#line 2932
*xpp = (void *)xp;
+#line 2932
return status;
+#line 2932
#endif
+#line 2932
}
+#line 2932
int
+#line 2933
ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2933
{
+#line 2933
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2933
+#line 2933
/* basic algorithm is:
+#line 2933
* - ensure sane alignment of output data
+#line 2933
* - copy (conversion happens automatically) input data
+#line 2933
* to output
+#line 2933
* - update tp to point at next unconverted input, and xpp to point
+#line 2933
* at next location for converted output
+#line 2933
*/
+#line 2933
long i, j, ni;
+#line 2933
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2933
float *xp;
+#line 2933
int nrange = 0; /* number of range errors */
+#line 2933
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2933
long cxp = (long) *((char**)xpp);
+#line 2933
+#line 2933
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2933
/* sjl: manually stripmine so we can limit amount of
+#line 2933
* vector work space reserved to LOOPCNT elements. Also
+#line 2933
* makes vectorisation easy */
+#line 2933
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2933
ni=Min(nelems-j,LOOPCNT);
+#line 2933
if (realign) {
+#line 2933
xp = tmp;
+#line 2933
} else {
+#line 2933
xp = (float *) *xpp;
+#line 2933
}
+#line 2933
/* copy the next block */
+#line 2933
#pragma cdir loopcnt=LOOPCNT
+#line 2933
#pragma cdir shortloop
+#line 2933
for (i=0; i<ni; i++) {
+#line 2933
/* the normal case: */
+#line 2933
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2933
/* test for range errors (not always needed but do it anyway) */
+#line 2933
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2933
}
- /* copy workspace back if necessary */
+#line 2933
+ /* copy workspace back if necessary */
+#line 2933
if (realign) {
+#line 2933
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2933
xp = (float *) *xpp;
+#line 2933
}
+#line 2933
/* update xpp and tp */
+#line 2933
xp += ni;
+#line 2933
tp += ni;
+#line 2933
*xpp = (void*)xp;
+#line 2933
}
+#line 2933
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2933
+#line 2933
#else /* not SX */
+#line 2933
+#line 2933
char *xp = (char *) *xpp;
+#line 2933
int status = ENOERR;
+#line 2933
+#line 2933
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2933
{
+#line 2933
int lstatus = ncx_put_float_uchar(xp, tp);
+#line 2933
if(lstatus != ENOERR)
+#line 2933
status = lstatus;
+#line 2933
}
+#line 2933
+#line 2933
*xpp = (void *)xp;
+#line 2933
return status;
+#line 2933
#endif
+#line 2933
}
+#line 2933
int
+#line 2934
ncx_putn_float_short(void **xpp, size_t nelems, const short *tp)
+#line 2934
{
+#line 2934
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2934
+#line 2934
/* basic algorithm is:
+#line 2934
* - ensure sane alignment of output data
+#line 2934
* - copy (conversion happens automatically) input data
+#line 2934
* to output
+#line 2934
* - update tp to point at next unconverted input, and xpp to point
+#line 2934
* at next location for converted output
+#line 2934
*/
+#line 2934
long i, j, ni;
+#line 2934
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2934
float *xp;
+#line 2934
int nrange = 0; /* number of range errors */
+#line 2934
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2934
long cxp = (long) *((char**)xpp);
+#line 2934
+#line 2934
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2934
/* sjl: manually stripmine so we can limit amount of
+#line 2934
* vector work space reserved to LOOPCNT elements. Also
+#line 2934
* makes vectorisation easy */
+#line 2934
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2934
ni=Min(nelems-j,LOOPCNT);
+#line 2934
if (realign) {
+#line 2934
xp = tmp;
+#line 2934
} else {
+#line 2934
xp = (float *) *xpp;
+#line 2934
}
+#line 2934
/* copy the next block */
+#line 2934
#pragma cdir loopcnt=LOOPCNT
+#line 2934
#pragma cdir shortloop
+#line 2934
for (i=0; i<ni; i++) {
+#line 2934
/* the normal case: */
+#line 2934
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2934
/* test for range errors (not always needed but do it anyway) */
+#line 2934
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2934
}
- /* copy workspace back if necessary */
+#line 2934
+ /* copy workspace back if necessary */
+#line 2934
if (realign) {
+#line 2934
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2934
xp = (float *) *xpp;
+#line 2934
}
+#line 2934
/* update xpp and tp */
+#line 2934
xp += ni;
+#line 2934
tp += ni;
+#line 2934
*xpp = (void*)xp;
+#line 2934
}
+#line 2934
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2934
+#line 2934
#else /* not SX */
+#line 2934
+#line 2934
char *xp = (char *) *xpp;
+#line 2934
int status = ENOERR;
+#line 2934
+#line 2934
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2934
{
+#line 2934
int lstatus = ncx_put_float_short(xp, tp);
+#line 2934
if(lstatus != ENOERR)
+#line 2934
status = lstatus;
+#line 2934
}
+#line 2934
+#line 2934
*xpp = (void *)xp;
+#line 2934
return status;
+#line 2934
#endif
+#line 2934
}
+#line 2934
int
+#line 2935
ncx_putn_float_int(void **xpp, size_t nelems, const int *tp)
+#line 2935
{
+#line 2935
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2935
+#line 2935
/* basic algorithm is:
+#line 2935
* - ensure sane alignment of output data
+#line 2935
* - copy (conversion happens automatically) input data
+#line 2935
* to output
+#line 2935
* - update tp to point at next unconverted input, and xpp to point
+#line 2935
* at next location for converted output
+#line 2935
*/
+#line 2935
long i, j, ni;
+#line 2935
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2935
float *xp;
+#line 2935
int nrange = 0; /* number of range errors */
+#line 2935
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2935
long cxp = (long) *((char**)xpp);
+#line 2935
+#line 2935
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2935
/* sjl: manually stripmine so we can limit amount of
+#line 2935
* vector work space reserved to LOOPCNT elements. Also
+#line 2935
* makes vectorisation easy */
+#line 2935
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2935
ni=Min(nelems-j,LOOPCNT);
+#line 2935
if (realign) {
+#line 2935
xp = tmp;
+#line 2935
} else {
+#line 2935
xp = (float *) *xpp;
+#line 2935
}
+#line 2935
/* copy the next block */
+#line 2935
#pragma cdir loopcnt=LOOPCNT
+#line 2935
#pragma cdir shortloop
+#line 2935
for (i=0; i<ni; i++) {
+#line 2935
/* the normal case: */
+#line 2935
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2935
/* test for range errors (not always needed but do it anyway) */
+#line 2935
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2935
}
- /* copy workspace back if necessary */
+#line 2935
+ /* copy workspace back if necessary */
+#line 2935
if (realign) {
+#line 2935
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2935
xp = (float *) *xpp;
+#line 2935
}
+#line 2935
/* update xpp and tp */
+#line 2935
xp += ni;
+#line 2935
tp += ni;
+#line 2935
*xpp = (void*)xp;
+#line 2935
}
+#line 2935
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2935
+#line 2935
#else /* not SX */
+#line 2935
+#line 2935
char *xp = (char *) *xpp;
+#line 2935
int status = ENOERR;
+#line 2935
+#line 2935
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2935
{
+#line 2935
int lstatus = ncx_put_float_int(xp, tp);
+#line 2935
if(lstatus != ENOERR)
+#line 2935
status = lstatus;
+#line 2935
}
+#line 2935
+#line 2935
*xpp = (void *)xp;
+#line 2935
return status;
+#line 2935
#endif
+#line 2935
}
+#line 2935
#if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT)
/* optimized version */
@@ -6614,51 +11068,95 @@ ncx_putn_float_float(void **xpp, size_t nfloats, const float *ip)
while(ip < end)
{
const struct vax_single *const vsp =
+#line 2957
(const struct vax_single *)ip;
+#line 2957
struct ieee_single *const isp = (struct ieee_single *) (*xpp);
+#line 2957
+#line 2957
switch(vsp->exp){
+#line 2957
case 0 :
+#line 2957
/* all vax float with zero exponent map to zero */
+#line 2957
*isp = min.ieee;
+#line 2957
break;
+#line 2957
case 2 :
+#line 2957
case 1 :
+#line 2957
{
+#line 2957
/* These will map to subnormals */
+#line 2957
unsigned mantissa = (vsp->mantissa1 << 16)
+#line 2957
| vsp->mantissa2;
+#line 2957
mantissa >>= 3 - vsp->exp;
+#line 2957
mantissa += (1 << (20 + vsp->exp));
+#line 2957
isp->mant_lo_lo = mantissa;
+#line 2957
isp->mant_lo_hi = mantissa >> 8;
+#line 2957
isp->mant_hi = mantissa >> 16;
+#line 2957
isp->exp_lo = 0;
+#line 2957
isp->exp_hi = 0;
+#line 2957
}
+#line 2957
break;
+#line 2957
case 0xff : /* max.s.exp */
+#line 2957
if( vsp->mantissa2 == max.s.mantissa2
+#line 2957
&& vsp->mantissa1 == max.s.mantissa1)
+#line 2957
{
+#line 2957
/* map largest vax float to ieee infinity */
+#line 2957
*isp = max.ieee;
+#line 2957
break;
+#line 2957
} /* else, fall thru */
+#line 2957
default :
+#line 2957
{
+#line 2957
unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
+#line 2957
isp->exp_hi = exp >> 1;
+#line 2957
isp->exp_lo = exp;
+#line 2957
isp->mant_lo_lo = vsp->mantissa2;
+#line 2957
isp->mant_lo_hi = vsp->mantissa2 >> 8;
+#line 2957
isp->mant_hi = vsp->mantissa1;
+#line 2957
}
+#line 2957
}
+#line 2957
+#line 2957
isp->sign = vsp->sign;
+#line 2957
+
-
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
}
@@ -6684,783 +11182,1548 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
#endif
int
+#line 2983
ncx_putn_float_double(void **xpp, size_t nelems, const double *tp)
+#line 2983
{
+#line 2983
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2983
+#line 2983
/* basic algorithm is:
+#line 2983
* - ensure sane alignment of output data
+#line 2983
* - copy (conversion happens automatically) input data
+#line 2983
* to output
+#line 2983
* - update tp to point at next unconverted input, and xpp to point
+#line 2983
* at next location for converted output
+#line 2983
*/
+#line 2983
long i, j, ni;
+#line 2983
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2983
float *xp;
+#line 2983
int nrange = 0; /* number of range errors */
+#line 2983
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2983
long cxp = (long) *((char**)xpp);
+#line 2983
+#line 2983
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2983
/* sjl: manually stripmine so we can limit amount of
+#line 2983
* vector work space reserved to LOOPCNT elements. Also
+#line 2983
* makes vectorisation easy */
+#line 2983
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2983
ni=Min(nelems-j,LOOPCNT);
+#line 2983
if (realign) {
+#line 2983
xp = tmp;
+#line 2983
} else {
+#line 2983
xp = (float *) *xpp;
+#line 2983
}
+#line 2983
/* copy the next block */
+#line 2983
#pragma cdir loopcnt=LOOPCNT
+#line 2983
#pragma cdir shortloop
+#line 2983
for (i=0; i<ni; i++) {
+#line 2983
/* the normal case: */
+#line 2983
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2983
/* test for range errors (not always needed but do it anyway) */
+#line 2983
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2983
}
- /* copy workspace back if necessary */
+#line 2983
+ /* copy workspace back if necessary */
+#line 2983
if (realign) {
+#line 2983
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2983
xp = (float *) *xpp;
+#line 2983
}
+#line 2983
/* update xpp and tp */
+#line 2983
xp += ni;
+#line 2983
tp += ni;
+#line 2983
*xpp = (void*)xp;
+#line 2983
}
+#line 2983
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2983
+#line 2983
#else /* not SX */
+#line 2983
+#line 2983
char *xp = (char *) *xpp;
+#line 2983
int status = ENOERR;
+#line 2983
+#line 2983
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2983
{
+#line 2983
int lstatus = ncx_put_float_double(xp, tp);
+#line 2983
if(lstatus != ENOERR)
+#line 2983
status = lstatus;
+#line 2983
}
+#line 2983
+#line 2983
*xpp = (void *)xp;
+#line 2983
return status;
+#line 2983
#endif
+#line 2983
}
+#line 2983
int
+#line 2984
ncx_putn_float_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2984
{
+#line 2984
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2984
+#line 2984
/* basic algorithm is:
+#line 2984
* - ensure sane alignment of output data
+#line 2984
* - copy (conversion happens automatically) input data
+#line 2984
* to output
+#line 2984
* - update tp to point at next unconverted input, and xpp to point
+#line 2984
* at next location for converted output
+#line 2984
*/
+#line 2984
long i, j, ni;
+#line 2984
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2984
float *xp;
+#line 2984
int nrange = 0; /* number of range errors */
+#line 2984
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2984
long cxp = (long) *((char**)xpp);
+#line 2984
+#line 2984
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2984
/* sjl: manually stripmine so we can limit amount of
+#line 2984
* vector work space reserved to LOOPCNT elements. Also
+#line 2984
* makes vectorisation easy */
+#line 2984
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2984
ni=Min(nelems-j,LOOPCNT);
+#line 2984
if (realign) {
+#line 2984
xp = tmp;
+#line 2984
} else {
+#line 2984
xp = (float *) *xpp;
+#line 2984
}
+#line 2984
/* copy the next block */
+#line 2984
#pragma cdir loopcnt=LOOPCNT
+#line 2984
#pragma cdir shortloop
+#line 2984
for (i=0; i<ni; i++) {
+#line 2984
/* the normal case: */
+#line 2984
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2984
/* test for range errors (not always needed but do it anyway) */
+#line 2984
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2984
}
- /* copy workspace back if necessary */
+#line 2984
+ /* copy workspace back if necessary */
+#line 2984
if (realign) {
+#line 2984
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2984
xp = (float *) *xpp;
+#line 2984
}
+#line 2984
/* update xpp and tp */
+#line 2984
xp += ni;
+#line 2984
tp += ni;
+#line 2984
*xpp = (void*)xp;
+#line 2984
}
+#line 2984
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2984
+#line 2984
#else /* not SX */
+#line 2984
+#line 2984
char *xp = (char *) *xpp;
+#line 2984
int status = ENOERR;
+#line 2984
+#line 2984
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2984
{
+#line 2984
int lstatus = ncx_put_float_uint(xp, tp);
+#line 2984
if(lstatus != ENOERR)
+#line 2984
status = lstatus;
+#line 2984
}
+#line 2984
+#line 2984
*xpp = (void *)xp;
+#line 2984
return status;
+#line 2984
#endif
+#line 2984
}
+#line 2984
int
+#line 2985
ncx_putn_float_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2985
{
+#line 2985
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2985
+#line 2985
/* basic algorithm is:
+#line 2985
* - ensure sane alignment of output data
+#line 2985
* - copy (conversion happens automatically) input data
+#line 2985
* to output
+#line 2985
* - update tp to point at next unconverted input, and xpp to point
+#line 2985
* at next location for converted output
+#line 2985
*/
+#line 2985
long i, j, ni;
+#line 2985
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2985
float *xp;
+#line 2985
int nrange = 0; /* number of range errors */
+#line 2985
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2985
long cxp = (long) *((char**)xpp);
+#line 2985
+#line 2985
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2985
/* sjl: manually stripmine so we can limit amount of
+#line 2985
* vector work space reserved to LOOPCNT elements. Also
+#line 2985
* makes vectorisation easy */
+#line 2985
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2985
ni=Min(nelems-j,LOOPCNT);
+#line 2985
if (realign) {
+#line 2985
xp = tmp;
+#line 2985
} else {
+#line 2985
xp = (float *) *xpp;
+#line 2985
}
+#line 2985
/* copy the next block */
+#line 2985
#pragma cdir loopcnt=LOOPCNT
+#line 2985
#pragma cdir shortloop
+#line 2985
for (i=0; i<ni; i++) {
+#line 2985
/* the normal case: */
+#line 2985
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2985
/* test for range errors (not always needed but do it anyway) */
+#line 2985
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2985
}
- /* copy workspace back if necessary */
+#line 2985
+ /* copy workspace back if necessary */
+#line 2985
if (realign) {
+#line 2985
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2985
xp = (float *) *xpp;
+#line 2985
}
+#line 2985
/* update xpp and tp */
+#line 2985
xp += ni;
+#line 2985
tp += ni;
+#line 2985
*xpp = (void*)xp;
+#line 2985
}
+#line 2985
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2985
+#line 2985
#else /* not SX */
+#line 2985
+#line 2985
char *xp = (char *) *xpp;
+#line 2985
int status = ENOERR;
+#line 2985
+#line 2985
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2985
{
+#line 2985
int lstatus = ncx_put_float_longlong(xp, tp);
+#line 2985
if(lstatus != ENOERR)
+#line 2985
status = lstatus;
+#line 2985
}
+#line 2985
+#line 2985
*xpp = (void *)xp;
+#line 2985
return status;
+#line 2985
#endif
+#line 2985
}
+#line 2985
int
+#line 2986
ncx_putn_float_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2986
{
+#line 2986
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 2986
+#line 2986
/* basic algorithm is:
+#line 2986
* - ensure sane alignment of output data
+#line 2986
* - copy (conversion happens automatically) input data
+#line 2986
* to output
+#line 2986
* - update tp to point at next unconverted input, and xpp to point
+#line 2986
* at next location for converted output
+#line 2986
*/
+#line 2986
long i, j, ni;
+#line 2986
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2986
float *xp;
+#line 2986
int nrange = 0; /* number of range errors */
+#line 2986
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2986
long cxp = (long) *((char**)xpp);
+#line 2986
+#line 2986
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 2986
/* sjl: manually stripmine so we can limit amount of
+#line 2986
* vector work space reserved to LOOPCNT elements. Also
+#line 2986
* makes vectorisation easy */
+#line 2986
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2986
ni=Min(nelems-j,LOOPCNT);
+#line 2986
if (realign) {
+#line 2986
xp = tmp;
+#line 2986
} else {
+#line 2986
xp = (float *) *xpp;
+#line 2986
}
+#line 2986
/* copy the next block */
+#line 2986
#pragma cdir loopcnt=LOOPCNT
+#line 2986
#pragma cdir shortloop
+#line 2986
for (i=0; i<ni; i++) {
+#line 2986
/* the normal case: */
+#line 2986
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 2986
/* test for range errors (not always needed but do it anyway) */
+#line 2986
nrange += tp[i] < X_FLOAT_MIN || tp[i] > X_FLOAT_MAX;
+#line 2986
}
- /* copy workspace back if necessary */
+#line 2986
+ /* copy workspace back if necessary */
+#line 2986
if (realign) {
+#line 2986
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 2986
xp = (float *) *xpp;
+#line 2986
}
+#line 2986
/* update xpp and tp */
+#line 2986
xp += ni;
+#line 2986
tp += ni;
+#line 2986
*xpp = (void*)xp;
+#line 2986
}
+#line 2986
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2986
+#line 2986
#else /* not SX */
+#line 2986
+#line 2986
char *xp = (char *) *xpp;
+#line 2986
int status = ENOERR;
+#line 2986
+#line 2986
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 2986
{
+#line 2986
int lstatus = ncx_put_float_ulonglong(xp, tp);
+#line 2986
if(lstatus != ENOERR)
+#line 2986
status = lstatus;
+#line 2986
}
+#line 2986
+#line 2986
*xpp = (void *)xp;
+#line 2986
return status;
+#line 2986
#endif
+#line 2986
}
+#line 2986
/* double */
int
+#line 2990
ncx_getn_double_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2990
{
+#line 2990
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2990
+#line 2990
/* basic algorithm is:
+#line 2990
* - ensure sane alignment of input data
+#line 2990
* - copy (conversion happens automatically) input data
+#line 2990
* to output
+#line 2990
* - update xpp to point at next unconverted input, and tp to point
+#line 2990
* at next location for converted output
+#line 2990
*/
+#line 2990
long i, j, ni;
+#line 2990
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2990
double *xp;
+#line 2990
int nrange = 0; /* number of range errors */
+#line 2990
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2990
long cxp = (long) *((char**)xpp);
+#line 2990
+#line 2990
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2990
/* sjl: manually stripmine so we can limit amount of
+#line 2990
* vector work space reserved to LOOPCNT elements. Also
+#line 2990
* makes vectorisation easy */
+#line 2990
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2990
ni=Min(nelems-j,LOOPCNT);
+#line 2990
if (realign) {
+#line 2990
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2990
xp = tmp;
+#line 2990
} else {
+#line 2990
xp = (double *) *xpp;
+#line 2990
}
+#line 2990
/* copy the next block */
+#line 2990
#pragma cdir loopcnt=LOOPCNT
+#line 2990
#pragma cdir shortloop
+#line 2990
for (i=0; i<ni; i++) {
+#line 2990
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2990
/* test for range errors (not always needed but do it anyway) */
+#line 2990
nrange += xp[i] < SCHAR_MIN || xp[i] > SCHAR_MAX;
+#line 2990
}
+#line 2990
/* update xpp and tp */
+#line 2990
if (realign) xp = (double *) *xpp;
+#line 2990
xp += ni;
+#line 2990
tp += ni;
+#line 2990
*xpp = (void*)xp;
+#line 2990
}
+#line 2990
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2990
+#line 2990
#else /* not SX */
+#line 2990
const char *xp = (const char *) *xpp;
+#line 2990
int status = ENOERR;
+#line 2990
+#line 2990
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2990
{
+#line 2990
const int lstatus = ncx_get_double_schar(xp, tp);
+#line 2990
if(lstatus != ENOERR)
+#line 2990
status = lstatus;
+#line 2990
}
+#line 2990
+#line 2990
*xpp = (const void *)xp;
+#line 2990
return status;
+#line 2990
# endif
+#line 2990
}
+#line 2990
int
+#line 2991
ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2991
{
+#line 2991
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2991
+#line 2991
/* basic algorithm is:
+#line 2991
* - ensure sane alignment of input data
+#line 2991
* - copy (conversion happens automatically) input data
+#line 2991
* to output
+#line 2991
* - update xpp to point at next unconverted input, and tp to point
+#line 2991
* at next location for converted output
+#line 2991
*/
+#line 2991
long i, j, ni;
+#line 2991
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2991
double *xp;
+#line 2991
int nrange = 0; /* number of range errors */
+#line 2991
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2991
long cxp = (long) *((char**)xpp);
+#line 2991
+#line 2991
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2991
/* sjl: manually stripmine so we can limit amount of
+#line 2991
* vector work space reserved to LOOPCNT elements. Also
+#line 2991
* makes vectorisation easy */
+#line 2991
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2991
ni=Min(nelems-j,LOOPCNT);
+#line 2991
if (realign) {
+#line 2991
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2991
xp = tmp;
+#line 2991
} else {
+#line 2991
xp = (double *) *xpp;
+#line 2991
}
+#line 2991
/* copy the next block */
+#line 2991
#pragma cdir loopcnt=LOOPCNT
+#line 2991
#pragma cdir shortloop
+#line 2991
for (i=0; i<ni; i++) {
+#line 2991
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2991
/* test for range errors (not always needed but do it anyway) */
+#line 2991
nrange += xp[i] < UCHAR_MIN || xp[i] > UCHAR_MAX;
+#line 2991
}
+#line 2991
/* update xpp and tp */
+#line 2991
if (realign) xp = (double *) *xpp;
+#line 2991
xp += ni;
+#line 2991
tp += ni;
+#line 2991
*xpp = (void*)xp;
+#line 2991
}
+#line 2991
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2991
+#line 2991
#else /* not SX */
+#line 2991
const char *xp = (const char *) *xpp;
+#line 2991
int status = ENOERR;
+#line 2991
+#line 2991
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2991
{
+#line 2991
const int lstatus = ncx_get_double_uchar(xp, tp);
+#line 2991
if(lstatus != ENOERR)
+#line 2991
status = lstatus;
+#line 2991
}
+#line 2991
+#line 2991
*xpp = (const void *)xp;
+#line 2991
return status;
+#line 2991
# endif
+#line 2991
}
+#line 2991
int
+#line 2992
ncx_getn_double_short(const void **xpp, size_t nelems, short *tp)
+#line 2992
{
+#line 2992
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2992
+#line 2992
/* basic algorithm is:
+#line 2992
* - ensure sane alignment of input data
+#line 2992
* - copy (conversion happens automatically) input data
+#line 2992
* to output
+#line 2992
* - update xpp to point at next unconverted input, and tp to point
+#line 2992
* at next location for converted output
+#line 2992
*/
+#line 2992
long i, j, ni;
+#line 2992
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2992
double *xp;
+#line 2992
int nrange = 0; /* number of range errors */
+#line 2992
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2992
long cxp = (long) *((char**)xpp);
+#line 2992
+#line 2992
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2992
/* sjl: manually stripmine so we can limit amount of
+#line 2992
* vector work space reserved to LOOPCNT elements. Also
+#line 2992
* makes vectorisation easy */
+#line 2992
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2992
ni=Min(nelems-j,LOOPCNT);
+#line 2992
if (realign) {
+#line 2992
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2992
xp = tmp;
+#line 2992
} else {
+#line 2992
xp = (double *) *xpp;
+#line 2992
}
+#line 2992
/* copy the next block */
+#line 2992
#pragma cdir loopcnt=LOOPCNT
+#line 2992
#pragma cdir shortloop
+#line 2992
for (i=0; i<ni; i++) {
+#line 2992
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2992
/* test for range errors (not always needed but do it anyway) */
+#line 2992
nrange += xp[i] < SHORT_MIN || xp[i] > SHORT_MAX;
+#line 2992
}
+#line 2992
/* update xpp and tp */
+#line 2992
if (realign) xp = (double *) *xpp;
+#line 2992
xp += ni;
+#line 2992
tp += ni;
+#line 2992
*xpp = (void*)xp;
+#line 2992
}
+#line 2992
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2992
+#line 2992
#else /* not SX */
+#line 2992
const char *xp = (const char *) *xpp;
+#line 2992
int status = ENOERR;
+#line 2992
+#line 2992
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2992
{
+#line 2992
const int lstatus = ncx_get_double_short(xp, tp);
+#line 2992
if(lstatus != ENOERR)
+#line 2992
status = lstatus;
+#line 2992
}
+#line 2992
+#line 2992
*xpp = (const void *)xp;
+#line 2992
return status;
+#line 2992
# endif
+#line 2992
}
+#line 2992
int
+#line 2993
ncx_getn_double_int(const void **xpp, size_t nelems, int *tp)
+#line 2993
{
+#line 2993
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2993
+#line 2993
/* basic algorithm is:
+#line 2993
* - ensure sane alignment of input data
+#line 2993
* - copy (conversion happens automatically) input data
+#line 2993
* to output
+#line 2993
* - update xpp to point at next unconverted input, and tp to point
+#line 2993
* at next location for converted output
+#line 2993
*/
+#line 2993
long i, j, ni;
+#line 2993
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2993
double *xp;
+#line 2993
int nrange = 0; /* number of range errors */
+#line 2993
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2993
long cxp = (long) *((char**)xpp);
+#line 2993
+#line 2993
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2993
/* sjl: manually stripmine so we can limit amount of
+#line 2993
* vector work space reserved to LOOPCNT elements. Also
+#line 2993
* makes vectorisation easy */
+#line 2993
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2993
ni=Min(nelems-j,LOOPCNT);
+#line 2993
if (realign) {
+#line 2993
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2993
xp = tmp;
+#line 2993
} else {
+#line 2993
xp = (double *) *xpp;
+#line 2993
}
+#line 2993
/* copy the next block */
+#line 2993
#pragma cdir loopcnt=LOOPCNT
+#line 2993
#pragma cdir shortloop
+#line 2993
for (i=0; i<ni; i++) {
+#line 2993
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2993
/* test for range errors (not always needed but do it anyway) */
+#line 2993
nrange += xp[i] < INT_MIN || xp[i] > INT_MAX;
+#line 2993
}
+#line 2993
/* update xpp and tp */
+#line 2993
if (realign) xp = (double *) *xpp;
+#line 2993
xp += ni;
+#line 2993
tp += ni;
+#line 2993
*xpp = (void*)xp;
+#line 2993
}
+#line 2993
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2993
+#line 2993
#else /* not SX */
+#line 2993
const char *xp = (const char *) *xpp;
+#line 2993
int status = ENOERR;
+#line 2993
+#line 2993
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2993
{
+#line 2993
const int lstatus = ncx_get_double_int(xp, tp);
+#line 2993
if(lstatus != ENOERR)
+#line 2993
status = lstatus;
+#line 2993
}
+#line 2993
+#line 2993
*xpp = (const void *)xp;
+#line 2993
return status;
+#line 2993
# endif
+#line 2993
}
+#line 2993
int
+#line 2994
ncx_getn_double_float(const void **xpp, size_t nelems, float *tp)
+#line 2994
{
+#line 2994
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2994
+#line 2994
/* basic algorithm is:
+#line 2994
* - ensure sane alignment of input data
+#line 2994
* - copy (conversion happens automatically) input data
+#line 2994
* to output
+#line 2994
* - update xpp to point at next unconverted input, and tp to point
+#line 2994
* at next location for converted output
+#line 2994
*/
+#line 2994
long i, j, ni;
+#line 2994
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2994
double *xp;
+#line 2994
int nrange = 0; /* number of range errors */
+#line 2994
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2994
long cxp = (long) *((char**)xpp);
+#line 2994
+#line 2994
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2994
/* sjl: manually stripmine so we can limit amount of
+#line 2994
* vector work space reserved to LOOPCNT elements. Also
+#line 2994
* makes vectorisation easy */
+#line 2994
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2994
ni=Min(nelems-j,LOOPCNT);
+#line 2994
if (realign) {
+#line 2994
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2994
xp = tmp;
+#line 2994
} else {
+#line 2994
xp = (double *) *xpp;
+#line 2994
}
+#line 2994
/* copy the next block */
+#line 2994
#pragma cdir loopcnt=LOOPCNT
+#line 2994
#pragma cdir shortloop
+#line 2994
for (i=0; i<ni; i++) {
+#line 2994
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2994
/* test for range errors (not always needed but do it anyway) */
+#line 2994
nrange += xp[i] < FLOAT_MIN || xp[i] > FLOAT_MAX;
+#line 2994
}
+#line 2994
/* update xpp and tp */
+#line 2994
if (realign) xp = (double *) *xpp;
+#line 2994
xp += ni;
+#line 2994
tp += ni;
+#line 2994
*xpp = (void*)xp;
+#line 2994
}
+#line 2994
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2994
+#line 2994
#else /* not SX */
+#line 2994
const char *xp = (const char *) *xpp;
+#line 2994
int status = ENOERR;
+#line 2994
+#line 2994
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2994
{
+#line 2994
const int lstatus = ncx_get_double_float(xp, tp);
+#line 2994
if(lstatus != ENOERR)
+#line 2994
status = lstatus;
+#line 2994
}
+#line 2994
+#line 2994
*xpp = (const void *)xp;
+#line 2994
return status;
+#line 2994
# endif
+#line 2994
}
+#line 2994
+#line 2996
int
+#line 2996
ncx_getn_double_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2996
{
+#line 2996
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2996
+#line 2996
/* basic algorithm is:
+#line 2996
* - ensure sane alignment of input data
+#line 2996
* - copy (conversion happens automatically) input data
+#line 2996
* to output
+#line 2996
* - update xpp to point at next unconverted input, and tp to point
+#line 2996
* at next location for converted output
+#line 2996
*/
+#line 2996
long i, j, ni;
+#line 2996
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2996
double *xp;
+#line 2996
int nrange = 0; /* number of range errors */
+#line 2996
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2996
long cxp = (long) *((char**)xpp);
+#line 2996
+#line 2996
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2996
/* sjl: manually stripmine so we can limit amount of
+#line 2996
* vector work space reserved to LOOPCNT elements. Also
+#line 2996
* makes vectorisation easy */
+#line 2996
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2996
ni=Min(nelems-j,LOOPCNT);
+#line 2996
if (realign) {
+#line 2996
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2996
xp = tmp;
+#line 2996
} else {
+#line 2996
xp = (double *) *xpp;
+#line 2996
}
+#line 2996
/* copy the next block */
+#line 2996
#pragma cdir loopcnt=LOOPCNT
+#line 2996
#pragma cdir shortloop
+#line 2996
for (i=0; i<ni; i++) {
+#line 2996
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2996
/* test for range errors (not always needed but do it anyway) */
+#line 2996
nrange += xp[i] < UINT_MIN || xp[i] > UINT_MAX;
+#line 2996
}
+#line 2996
/* update xpp and tp */
+#line 2996
if (realign) xp = (double *) *xpp;
+#line 2996
xp += ni;
+#line 2996
tp += ni;
+#line 2996
*xpp = (void*)xp;
+#line 2996
}
+#line 2996
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2996
+#line 2996
#else /* not SX */
+#line 2996
const char *xp = (const char *) *xpp;
+#line 2996
int status = ENOERR;
+#line 2996
+#line 2996
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2996
{
+#line 2996
const int lstatus = ncx_get_double_uint(xp, tp);
+#line 2996
if(lstatus != ENOERR)
+#line 2996
status = lstatus;
+#line 2996
}
+#line 2996
+#line 2996
*xpp = (const void *)xp;
+#line 2996
return status;
+#line 2996
# endif
+#line 2996
}
+#line 2996
int
+#line 2997
ncx_getn_double_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2997
{
+#line 2997
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2997
+#line 2997
/* basic algorithm is:
+#line 2997
* - ensure sane alignment of input data
+#line 2997
* - copy (conversion happens automatically) input data
+#line 2997
* to output
+#line 2997
* - update xpp to point at next unconverted input, and tp to point
+#line 2997
* at next location for converted output
+#line 2997
*/
+#line 2997
long i, j, ni;
+#line 2997
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2997
double *xp;
+#line 2997
int nrange = 0; /* number of range errors */
+#line 2997
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2997
long cxp = (long) *((char**)xpp);
+#line 2997
+#line 2997
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2997
/* sjl: manually stripmine so we can limit amount of
+#line 2997
* vector work space reserved to LOOPCNT elements. Also
+#line 2997
* makes vectorisation easy */
+#line 2997
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2997
ni=Min(nelems-j,LOOPCNT);
+#line 2997
if (realign) {
+#line 2997
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2997
xp = tmp;
+#line 2997
} else {
+#line 2997
xp = (double *) *xpp;
+#line 2997
}
+#line 2997
/* copy the next block */
+#line 2997
#pragma cdir loopcnt=LOOPCNT
+#line 2997
#pragma cdir shortloop
+#line 2997
for (i=0; i<ni; i++) {
+#line 2997
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2997
/* test for range errors (not always needed but do it anyway) */
+#line 2997
nrange += xp[i] < LONGLONG_MIN || xp[i] > LONGLONG_MAX;
+#line 2997
}
+#line 2997
/* update xpp and tp */
+#line 2997
if (realign) xp = (double *) *xpp;
+#line 2997
xp += ni;
+#line 2997
tp += ni;
+#line 2997
*xpp = (void*)xp;
+#line 2997
}
+#line 2997
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2997
+#line 2997
#else /* not SX */
+#line 2997
const char *xp = (const char *) *xpp;
+#line 2997
int status = ENOERR;
+#line 2997
+#line 2997
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2997
{
+#line 2997
const int lstatus = ncx_get_double_longlong(xp, tp);
+#line 2997
if(lstatus != ENOERR)
+#line 2997
status = lstatus;
+#line 2997
}
+#line 2997
+#line 2997
*xpp = (const void *)xp;
+#line 2997
return status;
+#line 2997
# endif
+#line 2997
}
+#line 2997
int
+#line 2998
ncx_getn_double_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2998
{
+#line 2998
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 2998
+#line 2998
/* basic algorithm is:
+#line 2998
* - ensure sane alignment of input data
+#line 2998
* - copy (conversion happens automatically) input data
+#line 2998
* to output
+#line 2998
* - update xpp to point at next unconverted input, and tp to point
+#line 2998
* at next location for converted output
+#line 2998
*/
+#line 2998
long i, j, ni;
+#line 2998
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2998
double *xp;
+#line 2998
int nrange = 0; /* number of range errors */
+#line 2998
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2998
long cxp = (long) *((char**)xpp);
+#line 2998
+#line 2998
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 2998
/* sjl: manually stripmine so we can limit amount of
+#line 2998
* vector work space reserved to LOOPCNT elements. Also
+#line 2998
* makes vectorisation easy */
+#line 2998
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2998
ni=Min(nelems-j,LOOPCNT);
+#line 2998
if (realign) {
+#line 2998
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 2998
xp = tmp;
+#line 2998
} else {
+#line 2998
xp = (double *) *xpp;
+#line 2998
}
+#line 2998
/* copy the next block */
+#line 2998
#pragma cdir loopcnt=LOOPCNT
+#line 2998
#pragma cdir shortloop
+#line 2998
for (i=0; i<ni; i++) {
+#line 2998
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2998
/* test for range errors (not always needed but do it anyway) */
+#line 2998
nrange += xp[i] < ULONGLONG_MIN || xp[i] > ULONGLONG_MAX;
+#line 2998
}
+#line 2998
/* update xpp and tp */
+#line 2998
if (realign) xp = (double *) *xpp;
+#line 2998
xp += ni;
+#line 2998
tp += ni;
+#line 2998
*xpp = (void*)xp;
+#line 2998
}
+#line 2998
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2998
+#line 2998
#else /* not SX */
+#line 2998
const char *xp = (const char *) *xpp;
+#line 2998
int status = ENOERR;
+#line 2998
+#line 2998
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 2998
{
+#line 2998
const int lstatus = ncx_get_double_ulonglong(xp, tp);
+#line 2998
if(lstatus != ENOERR)
+#line 2998
status = lstatus;
+#line 2998
}
+#line 2998
+#line 2998
*xpp = (const void *)xp;
+#line 2998
return status;
+#line 2998
# endif
+#line 2998
}
+#line 2998
#if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT)
/* optimized version */
@@ -7484,46 +12747,87 @@ ncx_getn_double_double(const void **xpp, size_t ndoubles, double *ip)
while(ip < end)
{
struct vax_double *const vdp =
+#line 3020
(struct vax_double *)ip;
+#line 3020
const struct ieee_double *const idp =
+#line 3020
(const struct ieee_double *) (*xpp);
+#line 3020
{
+#line 3020
const struct dbl_limits *lim;
+#line 3020
int ii;
+#line 3020
for (ii = 0, lim = dbl_limits;
+#line 3020
ii < sizeof(dbl_limits)/sizeof(struct dbl_limits);
+#line 3020
ii++, lim++)
+#line 3020
{
+#line 3020
if ((idp->mant_lo == lim->ieee.mant_lo)
+#line 3020
&& (idp->mant_4 == lim->ieee.mant_4)
+#line 3020
&& (idp->mant_5 == lim->ieee.mant_5)
+#line 3020
&& (idp->mant_6 == lim->ieee.mant_6)
+#line 3020
&& (idp->exp_lo == lim->ieee.exp_lo)
+#line 3020
&& (idp->exp_hi == lim->ieee.exp_hi)
+#line 3020
)
+#line 3020
{
+#line 3020
*vdp = lim->d;
+#line 3020
goto doneit;
+#line 3020
}
+#line 3020
}
+#line 3020
}
+#line 3020
{
+#line 3020
unsigned exp = idp->exp_hi << 4 | idp->exp_lo;
+#line 3020
vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
+#line 3020
}
+#line 3020
{
+#line 3020
unsigned mant_hi = ((idp->mant_6 << 16)
+#line 3020
| (idp->mant_5 << 8)
+#line 3020
| idp->mant_4);
+#line 3020
unsigned mant_lo = SWAP4(idp->mant_lo);
+#line 3020
vdp->mantissa1 = (mant_hi >> 13);
+#line 3020
vdp->mantissa2 = ((mant_hi & MASK(13)) << 3)
+#line 3020
| (mant_lo >> 29);
+#line 3020
vdp->mantissa3 = (mant_lo >> 13);
+#line 3020
vdp->mantissa4 = (mant_lo << 3);
+#line 3020
}
+#line 3020
doneit:
+#line 3020
vdp->sign = idp->sign;
+#line 3020
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
@@ -7552,548 +12856,1085 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
#endif
int
+#line 3047
ncx_putn_double_schar(void **xpp, size_t nelems, const schar *tp)
+#line 3047
{
+#line 3047
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3047
+#line 3047
/* basic algorithm is:
+#line 3047
* - ensure sane alignment of output data
+#line 3047
* - copy (conversion happens automatically) input data
+#line 3047
* to output
+#line 3047
* - update tp to point at next unconverted input, and xpp to point
+#line 3047
* at next location for converted output
+#line 3047
*/
+#line 3047
long i, j, ni;
+#line 3047
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3047
double *xp;
+#line 3047
int nrange = 0; /* number of range errors */
+#line 3047
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3047
long cxp = (long) *((char**)xpp);
+#line 3047
+#line 3047
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3047
/* sjl: manually stripmine so we can limit amount of
+#line 3047
* vector work space reserved to LOOPCNT elements. Also
+#line 3047
* makes vectorisation easy */
+#line 3047
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3047
ni=Min(nelems-j,LOOPCNT);
+#line 3047
if (realign) {
+#line 3047
xp = tmp;
+#line 3047
} else {
+#line 3047
xp = (double *) *xpp;
+#line 3047
}
+#line 3047
/* copy the next block */
+#line 3047
#pragma cdir loopcnt=LOOPCNT
+#line 3047
#pragma cdir shortloop
+#line 3047
for (i=0; i<ni; i++) {
+#line 3047
/* the normal case: */
+#line 3047
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3047
/* test for range errors (not always needed but do it anyway) */
+#line 3047
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3047
}
- /* copy workspace back if necessary */
+#line 3047
+ /* copy workspace back if necessary */
+#line 3047
if (realign) {
+#line 3047
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3047
xp = (double *) *xpp;
+#line 3047
}
+#line 3047
/* update xpp and tp */
+#line 3047
xp += ni;
+#line 3047
tp += ni;
+#line 3047
*xpp = (void*)xp;
+#line 3047
}
+#line 3047
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3047
+#line 3047
#else /* not SX */
+#line 3047
+#line 3047
char *xp = (char *) *xpp;
+#line 3047
int status = ENOERR;
+#line 3047
+#line 3047
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3047
{
+#line 3047
int lstatus = ncx_put_double_schar(xp, tp);
+#line 3047
if(lstatus != ENOERR)
+#line 3047
status = lstatus;
+#line 3047
}
+#line 3047
+#line 3047
*xpp = (void *)xp;
+#line 3047
return status;
+#line 3047
#endif
+#line 3047
}
+#line 3047
int
+#line 3048
ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 3048
{
+#line 3048
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3048
+#line 3048
/* basic algorithm is:
+#line 3048
* - ensure sane alignment of output data
+#line 3048
* - copy (conversion happens automatically) input data
+#line 3048
* to output
+#line 3048
* - update tp to point at next unconverted input, and xpp to point
+#line 3048
* at next location for converted output
+#line 3048
*/
+#line 3048
long i, j, ni;
+#line 3048
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3048
double *xp;
+#line 3048
int nrange = 0; /* number of range errors */
+#line 3048
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3048
long cxp = (long) *((char**)xpp);
+#line 3048
+#line 3048
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3048
/* sjl: manually stripmine so we can limit amount of
+#line 3048
* vector work space reserved to LOOPCNT elements. Also
+#line 3048
* makes vectorisation easy */
+#line 3048
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3048
ni=Min(nelems-j,LOOPCNT);
+#line 3048
if (realign) {
+#line 3048
xp = tmp;
+#line 3048
} else {
+#line 3048
xp = (double *) *xpp;
+#line 3048
}
+#line 3048
/* copy the next block */
+#line 3048
#pragma cdir loopcnt=LOOPCNT
+#line 3048
#pragma cdir shortloop
+#line 3048
for (i=0; i<ni; i++) {
+#line 3048
/* the normal case: */
+#line 3048
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3048
/* test for range errors (not always needed but do it anyway) */
+#line 3048
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3048
}
- /* copy workspace back if necessary */
+#line 3048
+ /* copy workspace back if necessary */
+#line 3048
if (realign) {
+#line 3048
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3048
xp = (double *) *xpp;
+#line 3048
}
+#line 3048
/* update xpp and tp */
+#line 3048
xp += ni;
+#line 3048
tp += ni;
+#line 3048
*xpp = (void*)xp;
+#line 3048
}
+#line 3048
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3048
+#line 3048
#else /* not SX */
+#line 3048
+#line 3048
char *xp = (char *) *xpp;
+#line 3048
int status = ENOERR;
+#line 3048
+#line 3048
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3048
{
+#line 3048
int lstatus = ncx_put_double_uchar(xp, tp);
+#line 3048
if(lstatus != ENOERR)
+#line 3048
status = lstatus;
+#line 3048
}
+#line 3048
+#line 3048
*xpp = (void *)xp;
+#line 3048
return status;
+#line 3048
#endif
+#line 3048
}
+#line 3048
int
+#line 3049
ncx_putn_double_short(void **xpp, size_t nelems, const short *tp)
+#line 3049
{
+#line 3049
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3049
+#line 3049
/* basic algorithm is:
+#line 3049
* - ensure sane alignment of output data
+#line 3049
* - copy (conversion happens automatically) input data
+#line 3049
* to output
+#line 3049
* - update tp to point at next unconverted input, and xpp to point
+#line 3049
* at next location for converted output
+#line 3049
*/
+#line 3049
long i, j, ni;
+#line 3049
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3049
double *xp;
+#line 3049
int nrange = 0; /* number of range errors */
+#line 3049
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3049
long cxp = (long) *((char**)xpp);
+#line 3049
+#line 3049
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3049
/* sjl: manually stripmine so we can limit amount of
+#line 3049
* vector work space reserved to LOOPCNT elements. Also
+#line 3049
* makes vectorisation easy */
+#line 3049
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3049
ni=Min(nelems-j,LOOPCNT);
+#line 3049
if (realign) {
+#line 3049
xp = tmp;
+#line 3049
} else {
+#line 3049
xp = (double *) *xpp;
+#line 3049
}
+#line 3049
/* copy the next block */
+#line 3049
#pragma cdir loopcnt=LOOPCNT
+#line 3049
#pragma cdir shortloop
+#line 3049
for (i=0; i<ni; i++) {
+#line 3049
/* the normal case: */
+#line 3049
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3049
/* test for range errors (not always needed but do it anyway) */
+#line 3049
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3049
}
- /* copy workspace back if necessary */
+#line 3049
+ /* copy workspace back if necessary */
+#line 3049
if (realign) {
+#line 3049
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3049
xp = (double *) *xpp;
+#line 3049
}
+#line 3049
/* update xpp and tp */
+#line 3049
xp += ni;
+#line 3049
tp += ni;
+#line 3049
*xpp = (void*)xp;
+#line 3049
}
+#line 3049
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3049
+#line 3049
#else /* not SX */
+#line 3049
+#line 3049
char *xp = (char *) *xpp;
+#line 3049
int status = ENOERR;
+#line 3049
+#line 3049
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3049
{
+#line 3049
int lstatus = ncx_put_double_short(xp, tp);
+#line 3049
if(lstatus != ENOERR)
+#line 3049
status = lstatus;
+#line 3049
}
+#line 3049
+#line 3049
*xpp = (void *)xp;
+#line 3049
return status;
+#line 3049
#endif
+#line 3049
}
+#line 3049
int
+#line 3050
ncx_putn_double_int(void **xpp, size_t nelems, const int *tp)
+#line 3050
{
+#line 3050
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3050
+#line 3050
/* basic algorithm is:
+#line 3050
* - ensure sane alignment of output data
+#line 3050
* - copy (conversion happens automatically) input data
+#line 3050
* to output
+#line 3050
* - update tp to point at next unconverted input, and xpp to point
+#line 3050
* at next location for converted output
+#line 3050
*/
+#line 3050
long i, j, ni;
+#line 3050
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3050
double *xp;
+#line 3050
int nrange = 0; /* number of range errors */
+#line 3050
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3050
long cxp = (long) *((char**)xpp);
+#line 3050
+#line 3050
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3050
/* sjl: manually stripmine so we can limit amount of
+#line 3050
* vector work space reserved to LOOPCNT elements. Also
+#line 3050
* makes vectorisation easy */
+#line 3050
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3050
ni=Min(nelems-j,LOOPCNT);
+#line 3050
if (realign) {
+#line 3050
xp = tmp;
+#line 3050
} else {
+#line 3050
xp = (double *) *xpp;
+#line 3050
}
+#line 3050
/* copy the next block */
+#line 3050
#pragma cdir loopcnt=LOOPCNT
+#line 3050
#pragma cdir shortloop
+#line 3050
for (i=0; i<ni; i++) {
+#line 3050
/* the normal case: */
+#line 3050
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3050
/* test for range errors (not always needed but do it anyway) */
+#line 3050
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3050
}
- /* copy workspace back if necessary */
+#line 3050
+ /* copy workspace back if necessary */
+#line 3050
if (realign) {
+#line 3050
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3050
xp = (double *) *xpp;
+#line 3050
}
+#line 3050
/* update xpp and tp */
+#line 3050
xp += ni;
+#line 3050
tp += ni;
+#line 3050
*xpp = (void*)xp;
+#line 3050
}
+#line 3050
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3050
+#line 3050
#else /* not SX */
+#line 3050
+#line 3050
char *xp = (char *) *xpp;
+#line 3050
int status = ENOERR;
+#line 3050
+#line 3050
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3050
{
+#line 3050
int lstatus = ncx_put_double_int(xp, tp);
+#line 3050
if(lstatus != ENOERR)
+#line 3050
status = lstatus;
+#line 3050
}
+#line 3050
+#line 3050
*xpp = (void *)xp;
+#line 3050
return status;
+#line 3050
#endif
+#line 3050
}
+#line 3050
int
+#line 3051
ncx_putn_double_float(void **xpp, size_t nelems, const float *tp)
+#line 3051
{
+#line 3051
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3051
+#line 3051
/* basic algorithm is:
+#line 3051
* - ensure sane alignment of output data
+#line 3051
* - copy (conversion happens automatically) input data
+#line 3051
* to output
+#line 3051
* - update tp to point at next unconverted input, and xpp to point
+#line 3051
* at next location for converted output
+#line 3051
*/
+#line 3051
long i, j, ni;
+#line 3051
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3051
double *xp;
+#line 3051
int nrange = 0; /* number of range errors */
+#line 3051
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3051
long cxp = (long) *((char**)xpp);
+#line 3051
+#line 3051
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3051
/* sjl: manually stripmine so we can limit amount of
+#line 3051
* vector work space reserved to LOOPCNT elements. Also
+#line 3051
* makes vectorisation easy */
+#line 3051
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3051
ni=Min(nelems-j,LOOPCNT);
+#line 3051
if (realign) {
+#line 3051
xp = tmp;
+#line 3051
} else {
+#line 3051
xp = (double *) *xpp;
+#line 3051
}
+#line 3051
/* copy the next block */
+#line 3051
#pragma cdir loopcnt=LOOPCNT
+#line 3051
#pragma cdir shortloop
+#line 3051
for (i=0; i<ni; i++) {
+#line 3051
/* the normal case: */
+#line 3051
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3051
/* test for range errors (not always needed but do it anyway) */
+#line 3051
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3051
}
- /* copy workspace back if necessary */
+#line 3051
+ /* copy workspace back if necessary */
+#line 3051
if (realign) {
+#line 3051
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3051
xp = (double *) *xpp;
+#line 3051
}
+#line 3051
/* update xpp and tp */
+#line 3051
xp += ni;
+#line 3051
tp += ni;
+#line 3051
*xpp = (void*)xp;
+#line 3051
}
+#line 3051
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3051
+#line 3051
#else /* not SX */
+#line 3051
+#line 3051
char *xp = (char *) *xpp;
+#line 3051
int status = ENOERR;
+#line 3051
+#line 3051
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3051
{
+#line 3051
int lstatus = ncx_put_double_float(xp, tp);
+#line 3051
if(lstatus != ENOERR)
+#line 3051
status = lstatus;
+#line 3051
}
+#line 3051
+#line 3051
*xpp = (void *)xp;
+#line 3051
return status;
+#line 3051
#endif
+#line 3051
}
+#line 3051
+#line 3053
int
+#line 3053
ncx_putn_double_uint(void **xpp, size_t nelems, const uint *tp)
+#line 3053
{
+#line 3053
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3053
+#line 3053
/* basic algorithm is:
+#line 3053
* - ensure sane alignment of output data
+#line 3053
* - copy (conversion happens automatically) input data
+#line 3053
* to output
+#line 3053
* - update tp to point at next unconverted input, and xpp to point
+#line 3053
* at next location for converted output
+#line 3053
*/
+#line 3053
long i, j, ni;
+#line 3053
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3053
double *xp;
+#line 3053
int nrange = 0; /* number of range errors */
+#line 3053
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3053
long cxp = (long) *((char**)xpp);
+#line 3053
+#line 3053
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3053
/* sjl: manually stripmine so we can limit amount of
+#line 3053
* vector work space reserved to LOOPCNT elements. Also
+#line 3053
* makes vectorisation easy */
+#line 3053
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3053
ni=Min(nelems-j,LOOPCNT);
+#line 3053
if (realign) {
+#line 3053
xp = tmp;
+#line 3053
} else {
+#line 3053
xp = (double *) *xpp;
+#line 3053
}
+#line 3053
/* copy the next block */
+#line 3053
#pragma cdir loopcnt=LOOPCNT
+#line 3053
#pragma cdir shortloop
+#line 3053
for (i=0; i<ni; i++) {
+#line 3053
/* the normal case: */
+#line 3053
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3053
/* test for range errors (not always needed but do it anyway) */
+#line 3053
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3053
}
- /* copy workspace back if necessary */
+#line 3053
+ /* copy workspace back if necessary */
+#line 3053
if (realign) {
+#line 3053
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3053
xp = (double *) *xpp;
+#line 3053
}
+#line 3053
/* update xpp and tp */
+#line 3053
xp += ni;
+#line 3053
tp += ni;
+#line 3053
*xpp = (void*)xp;
+#line 3053
}
+#line 3053
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3053
+#line 3053
#else /* not SX */
+#line 3053
+#line 3053
char *xp = (char *) *xpp;
+#line 3053
int status = ENOERR;
+#line 3053
+#line 3053
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3053
{
+#line 3053
int lstatus = ncx_put_double_uint(xp, tp);
+#line 3053
if(lstatus != ENOERR)
+#line 3053
status = lstatus;
+#line 3053
}
+#line 3053
+#line 3053
*xpp = (void *)xp;
+#line 3053
return status;
+#line 3053
#endif
+#line 3053
}
+#line 3053
int
+#line 3054
ncx_putn_double_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 3054
{
+#line 3054
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3054
+#line 3054
/* basic algorithm is:
+#line 3054
* - ensure sane alignment of output data
+#line 3054
* - copy (conversion happens automatically) input data
+#line 3054
* to output
+#line 3054
* - update tp to point at next unconverted input, and xpp to point
+#line 3054
* at next location for converted output
+#line 3054
*/
+#line 3054
long i, j, ni;
+#line 3054
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3054
double *xp;
+#line 3054
int nrange = 0; /* number of range errors */
+#line 3054
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3054
long cxp = (long) *((char**)xpp);
+#line 3054
+#line 3054
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3054
/* sjl: manually stripmine so we can limit amount of
+#line 3054
* vector work space reserved to LOOPCNT elements. Also
+#line 3054
* makes vectorisation easy */
+#line 3054
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3054
ni=Min(nelems-j,LOOPCNT);
+#line 3054
if (realign) {
+#line 3054
xp = tmp;
+#line 3054
} else {
+#line 3054
xp = (double *) *xpp;
+#line 3054
}
+#line 3054
/* copy the next block */
+#line 3054
#pragma cdir loopcnt=LOOPCNT
+#line 3054
#pragma cdir shortloop
+#line 3054
for (i=0; i<ni; i++) {
+#line 3054
/* the normal case: */
+#line 3054
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3054
/* test for range errors (not always needed but do it anyway) */
+#line 3054
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3054
}
- /* copy workspace back if necessary */
+#line 3054
+ /* copy workspace back if necessary */
+#line 3054
if (realign) {
+#line 3054
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3054
xp = (double *) *xpp;
+#line 3054
}
+#line 3054
/* update xpp and tp */
+#line 3054
xp += ni;
+#line 3054
tp += ni;
+#line 3054
*xpp = (void*)xp;
+#line 3054
}
+#line 3054
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3054
+#line 3054
#else /* not SX */
+#line 3054
+#line 3054
char *xp = (char *) *xpp;
+#line 3054
int status = ENOERR;
+#line 3054
+#line 3054
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3054
{
+#line 3054
int lstatus = ncx_put_double_longlong(xp, tp);
+#line 3054
if(lstatus != ENOERR)
+#line 3054
status = lstatus;
+#line 3054
}
+#line 3054
+#line 3054
*xpp = (void *)xp;
+#line 3054
return status;
+#line 3054
#endif
+#line 3054
}
+#line 3054
int
+#line 3055
ncx_putn_double_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 3055
{
+#line 3055
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3055
+#line 3055
/* basic algorithm is:
+#line 3055
* - ensure sane alignment of output data
+#line 3055
* - copy (conversion happens automatically) input data
+#line 3055
* to output
+#line 3055
* - update tp to point at next unconverted input, and xpp to point
+#line 3055
* at next location for converted output
+#line 3055
*/
+#line 3055
long i, j, ni;
+#line 3055
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3055
double *xp;
+#line 3055
int nrange = 0; /* number of range errors */
+#line 3055
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3055
long cxp = (long) *((char**)xpp);
+#line 3055
+#line 3055
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3055
/* sjl: manually stripmine so we can limit amount of
+#line 3055
* vector work space reserved to LOOPCNT elements. Also
+#line 3055
* makes vectorisation easy */
+#line 3055
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3055
ni=Min(nelems-j,LOOPCNT);
+#line 3055
if (realign) {
+#line 3055
xp = tmp;
+#line 3055
} else {
+#line 3055
xp = (double *) *xpp;
+#line 3055
}
+#line 3055
/* copy the next block */
+#line 3055
#pragma cdir loopcnt=LOOPCNT
+#line 3055
#pragma cdir shortloop
+#line 3055
for (i=0; i<ni; i++) {
+#line 3055
/* the normal case: */
+#line 3055
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3055
/* test for range errors (not always needed but do it anyway) */
+#line 3055
nrange += tp[i] < X_DOUBLE_MIN || tp[i] > X_DOUBLE_MAX;
+#line 3055
}
- /* copy workspace back if necessary */
+#line 3055
+ /* copy workspace back if necessary */
+#line 3055
if (realign) {
+#line 3055
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3055
xp = (double *) *xpp;
+#line 3055
}
+#line 3055
/* update xpp and tp */
+#line 3055
xp += ni;
+#line 3055
tp += ni;
+#line 3055
*xpp = (void*)xp;
+#line 3055
}
+#line 3055
return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3055
+#line 3055
#else /* not SX */
+#line 3055
+#line 3055
char *xp = (char *) *xpp;
+#line 3055
int status = ENOERR;
+#line 3055
+#line 3055
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3055
{
+#line 3055
int lstatus = ncx_put_double_ulonglong(xp, tp);
+#line 3055
if(lstatus != ENOERR)
+#line 3055
status = lstatus;
+#line 3055
}
+#line 3055
+#line 3055
*xpp = (void *)xp;
+#line 3055
return status;
+#line 3055
#endif
+#line 3055
}
+#line 3055
#if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT)
/* optimized version */
@@ -8116,65 +13957,124 @@ ncx_putn_double_double(void **xpp, size_t ndoubles, const double *ip)
while(ip < end)
{
- const struct vax_double *const vdp =
+ const struct vax_double *const vdp =
+#line 3077
(const struct vax_double *)ip;
+#line 3077
struct ieee_double *const idp =
+#line 3077
(struct ieee_double *) (*xpp);
+#line 3077
+#line 3077
if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) &&
+#line 3077
(vdp->mantissa3 == dbl_limits[0].d.mantissa3) &&
+#line 3077
(vdp->mantissa2 == dbl_limits[0].d.mantissa2) &&
+#line 3077
(vdp->mantissa1 == dbl_limits[0].d.mantissa1) &&
+#line 3077
(vdp->exp == dbl_limits[0].d.exp))
+#line 3077
{
+#line 3077
*idp = dbl_limits[0].ieee;
+#line 3077
goto shipit;
+#line 3077
}
+#line 3077
if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) &&
+#line 3077
(vdp->mantissa3 == dbl_limits[1].d.mantissa3) &&
+#line 3077
(vdp->mantissa2 == dbl_limits[1].d.mantissa2) &&
+#line 3077
(vdp->mantissa1 == dbl_limits[1].d.mantissa1) &&
+#line 3077
(vdp->exp == dbl_limits[1].d.exp))
+#line 3077
{
+#line 3077
*idp = dbl_limits[1].ieee;
+#line 3077
goto shipit;
+#line 3077
}
+#line 3077
+#line 3077
{
+#line 3077
unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
+#line 3077
+#line 3077
unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) |
+#line 3077
(vdp->mantissa3 << 13) |
+#line 3077
((vdp->mantissa4 >> 3) & MASK(13));
+#line 3077
+#line 3077
unsigned mant_hi = (vdp->mantissa1 << 13)
+#line 3077
| (vdp->mantissa2 >> 3);
+#line 3077
+#line 3077
if((vdp->mantissa4 & 7) > 4)
+#line 3077
{
+#line 3077
/* round up */
+#line 3077
mant_lo++;
+#line 3077
if(mant_lo == 0)
+#line 3077
{
+#line 3077
mant_hi++;
+#line 3077
if(mant_hi > 0xffffff)
+#line 3077
{
+#line 3077
mant_hi = 0;
+#line 3077
exp++;
+#line 3077
}
+#line 3077
}
+#line 3077
}
+#line 3077
+#line 3077
idp->mant_lo = SWAP4(mant_lo);
+#line 3077
idp->mant_6 = mant_hi >> 16;
+#line 3077
idp->mant_5 = (mant_hi & 0xff00) >> 8;
+#line 3077
idp->mant_4 = mant_hi;
+#line 3077
idp->exp_hi = exp >> 4;
+#line 3077
idp->exp_lo = exp;
+#line 3077
}
-
+#line 3077
+
+#line 3077
shipit:
+#line 3077
idp->sign = vdp->sign;
+#line 3077
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
@@ -8213,8 +14113,11 @@ int
ncx_getn_text(const void **xpp, size_t nelems, char *tp)
{
(void) memcpy(tp, *xpp, nelems);
+#line 3114
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3114
return ENOERR;
+#line 3114
}
@@ -8222,14 +14125,23 @@ int
ncx_pad_getn_text(const void **xpp, size_t nelems, char *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 3120
+#line 3120
if(rndup)
+#line 3120
rndup = X_ALIGN - rndup;
+#line 3120
+#line 3120
(void) memcpy(tp, *xpp, nelems);
+#line 3120
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 3120
+#line 3120
return ENOERR;
+#line 3120
}
@@ -8237,9 +14149,13 @@ int
ncx_putn_text(void **xpp, size_t nelems, const char *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 3126
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3126
+#line 3126
return ENOERR;
+#line 3126
}
@@ -8247,20 +14163,35 @@ int
ncx_pad_putn_text(void **xpp, size_t nelems, const char *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 3132
+#line 3132
if(rndup)
+#line 3132
rndup = X_ALIGN - rndup;
+#line 3132
+#line 3132
(void) memcpy(*xpp, tp, nelems);
+#line 3132
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3132
+#line 3132
if(rndup)
+#line 3132
{
+#line 3132
(void) memcpy(*xpp, nada, rndup);
+#line 3132
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 3132
}
-
+#line 3132
+
+#line 3132
return ENOERR;
+#line 3132
}
@@ -8271,8 +14202,11 @@ int
ncx_getn_void(const void **xpp, size_t nelems, void *tp)
{
(void) memcpy(tp, *xpp, nelems);
+#line 3141
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3141
return ENOERR;
+#line 3141
}
@@ -8280,14 +14214,23 @@ int
ncx_pad_getn_void(const void **xpp, size_t nelems, void *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 3147
+#line 3147
if(rndup)
+#line 3147
rndup = X_ALIGN - rndup;
+#line 3147
+#line 3147
(void) memcpy(tp, *xpp, nelems);
+#line 3147
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 3147
+#line 3147
return ENOERR;
+#line 3147
}
@@ -8295,9 +14238,13 @@ int
ncx_putn_void(void **xpp, size_t nelems, const void *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 3153
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3153
+#line 3153
return ENOERR;
+#line 3153
}
@@ -8305,19 +14252,34 @@ int
ncx_pad_putn_void(void **xpp, size_t nelems, const void *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 3159
+#line 3159
if(rndup)
+#line 3159
rndup = X_ALIGN - rndup;
+#line 3159
+#line 3159
(void) memcpy(*xpp, tp, nelems);
+#line 3159
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3159
+#line 3159
if(rndup)
+#line 3159
{
+#line 3159
(void) memcpy(*xpp, nada, rndup);
+#line 3159
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 3159
}
-
+#line 3159
+
+#line 3159
return ENOERR;
+#line 3159
}
diff --git a/libsrc/ncx.m4 b/libsrc/ncx.m4
index 52c97a7..71668e4 100644
--- a/libsrc/ncx.m4
+++ b/libsrc/ncx.m4
@@ -13,7 +13,7 @@ dnl
/*
* Copyright 1996, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
- *
+ *
* This file contains some routines derived from code
* which is copyrighted by Sun Microsystems, Inc.
* The "#ifdef vax" versions of
@@ -144,7 +144,7 @@ swapn2b(void *dst, const void *src, size_t nn)
* {
* *op++ = *(++ip);
* *op++ = *(ip++ -1);
- * }
+ * }
*/
while(nn > 3)
{
@@ -166,15 +166,22 @@ swapn2b(void *dst, const void *src, size_t nn)
}
# ifndef vax
-static void
+void
swap4b(void *dst, const void *src)
{
- char *op = dst;
- const char *ip = src;
- op[0] = ip[3];
- op[1] = ip[2];
- op[2] = ip[1];
- op[3] = ip[0];
+ unsigned int *op = dst;
+ const char *ip = src;
+ unsigned int tempIn;
+ unsigned int tempOut;
+
+ tempIn = *(unsigned int *)(ip+0);
+ tempOut =
+ ( tempIn << 24) |
+ ((tempIn & 0x0000ff00) << 8) |
+ ((tempIn & 0x00ff0000) >> 8) |
+ ( tempIn >> 24);
+
+ *(float *)op = *(float *)(&tempOut);
}
# endif /* !vax */
@@ -378,7 +385,7 @@ get_ix_short(const void *xp, ix_short *ip)
*ip |= (~(0xffff)); /* N.B. Assumes "twos complement" */
}
#endif
- *ip |= *cp;
+ *ip |= *cp;
}
static void
@@ -681,7 +688,7 @@ get_ix_int(const void *xp, ix_int *ip)
#endif
*ip |= (*cp++ << 16);
*ip |= (*cp++ << 8);
- *ip |= *cp;
+ *ip |= *cp;
}
static void
@@ -941,7 +948,7 @@ ncx_put_int_double(void *xp, const double *ip)
return NC_ERANGE;
return ENOERR;
}
-
+
/* x_float */
@@ -1671,7 +1678,7 @@ dnl PUT_VAX_DDOUBLE_Body(xp) (body for put_ix_double)
dnl
define(`PUT_VAX_DDOUBLE_Body',dnl
`dnl
- const struct vax_double *const vdp =
+ const struct vax_double *const vdp =
(const struct vax_double *)ip;
struct ieee_double *const idp =
(struct ieee_double *) $1;
@@ -1727,7 +1734,7 @@ define(`PUT_VAX_DDOUBLE_Body',dnl
idp->exp_hi = exp >> 4;
idp->exp_lo = exp;
}
-
+
shipit:
idp->sign = vdp->sign;
')dnl
@@ -1895,7 +1902,7 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip)
{
double xx;
get_ix_double(xp, &xx);
- *ip = (unsigned longlong) xx;
+ *ip = (unsigned long long) xx;
if(xx > ULONG_LONG_MAX || xx < 0)
return NC_ERANGE;
return ENOERR;
@@ -2061,7 +2068,7 @@ ncx_get_size_t(const void **xpp, size_t *ulp)
*ulp = (unsigned)(*cp++ << 24);
*ulp |= (*cp++ << 16);
*ulp |= (*cp++ << 8);
- *ulp |= *cp;
+ *ulp |= *cp;
*xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_SIZE_T);
return ENOERR;
@@ -2079,7 +2086,7 @@ ncx_put_off_t(void **xpp, const off_t *lp, size_t sizeof_off_t)
/* Assume this is an overflow of a 32-bit int... */
return ERANGE;
}
-
+
assert(sizeof_off_t == 4 || sizeof_off_t == 8);
if (sizeof_off_t == 4) {
@@ -2125,7 +2132,7 @@ ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t)
*lp = (off_t)(*cp++ << 24);
*lp |= (off_t)(*cp++ << 16);
*lp |= (off_t)(*cp++ << 8);
- *lp |= (off_t)*cp;
+ *lp |= (off_t)*cp;
} else {
#if SIZEOF_OFF_T == 4
/* Read a 64-bit offset on a system with only a 32-bit offset */
@@ -2381,7 +2388,7 @@ ncx_pad_getn_short_$1(const void **xpp, size_t nelems, $1 *tp)
if(rndup != 0)
xp += X_SIZEOF_SHORT;
-
+
*xpp = (void *)xp;
return status;
}
@@ -2415,7 +2422,7 @@ define(`NCX_PAD_PUTN_Byte_Body',dnl
(void) memcpy(*xpp, nada, rndup);
*xpp = (void *)((char *)(*xpp) + rndup);
}
-
+
return ENOERR;
`dnl
')dnl
@@ -2550,7 +2557,7 @@ ifelse( $1$2, intfloat,dnl
for (i=0; i<ni; i++) {
ifelse( $1$2, intfloat,dnl
`dnl
- /* for some reason int to float, for putn, requires a special case */
+ /* for some reason int to float, for putn, requires a special case */
d = tp[i];
xp[i] = ($1) Max( Xmin($1), Min(Xmax($1), ($1) d));
nrange += d < Xmin($1) || d > Xmax($1);
@@ -2562,7 +2569,7 @@ ifelse( $1$2, intfloat,dnl
nrange += tp[i] < Xmin($1) || tp[i] > Xmax($1);
')dnl
}
- /* copy workspace back if necessary */
+ /* copy workspace back if necessary */
if (realign) {
memcpy(*xpp, tmp, ni*Xsizeof($1));
xp = ($1 *) *xpp;
@@ -2615,9 +2622,9 @@ ncx_pad_putn_short_$1(void **xpp, size_t nelems, const $1 *tp)
if(rndup != 0)
{
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
- xp += X_SIZEOF_SHORT;
+ xp += X_SIZEOF_SHORT;
}
-
+
*xpp = (void *)xp;
return status;
}
@@ -2948,7 +2955,7 @@ ncx_putn_float_float(void **xpp, size_t nfloats, const float *ip)
while(ip < end)
{
PUT_VAX_DFLOAT_Body(`(*xpp)')
-
+
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
}
diff --git a/libsrc/posixio.c b/libsrc/posixio.c
index 0bb1e04..cf24ad6 100644
--- a/libsrc/posixio.c
+++ b/libsrc/posixio.c
@@ -282,7 +282,9 @@ px_pgin(ncio *const nciop,
{
int status;
ssize_t nread;
-
+ size_t read_count = 0;
+ ssize_t bytes_xfered = 0;
+ void *p = vp;
#ifdef X_ALIGN
assert(offset % X_ALIGN == 0);
assert(extent % X_ALIGN == 0);
@@ -309,16 +311,34 @@ px_pgin(ncio *const nciop,
}
errno = 0;
- nread = read(nciop->fd, vp, extent);
- if(nread != (ssize_t) extent)
- {
- status = errno;
- if(nread == -1 || status != ENOERR)
- return status;
- /* else it's okay we read less than asked for */
- (void) memset((char *)vp + nread, 0, (ssize_t)extent - nread);
- }
- *nreadp = nread;
+ /* Handle the case where the read is interrupted
+ by a signal (see NCF-337,
+ http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html)
+
+ When this happens, nread will (should) be the bytes read, and
+ errno will be set to EINTR. On older systems nread might be -1.
+ If this is the case, there's not a whole lot we can do about it
+ as we can't compute any offsets, so we will attempt to read again.
+ This *feels* like it could lead to an infinite loop, but it shouldn't
+ unless the read is being constantly interrupted by a signal, and is
+ on an older system which returns -1 instead of bytexs read.
+
+ The case where it's a short read is already handled by the function
+ (according to the comment below, at least). */
+ do {
+ nread = read(nciop->fd,vp,extent);
+ } while (nread == -1 && errno == EINTR);
+
+
+ if(nread != (ssize_t)extent) {
+ status = errno;
+ if( nread == -1 || (status != EINTR && status != ENOERR))
+ return status;
+ /* else it's okay we read less than asked for */
+ (void) memset((char *)vp + nread, 0, (ssize_t)extent - nread);
+ }
+
+ *nreadp = nread;
*posp += nread;
return ENOERR;
@@ -1145,9 +1165,9 @@ ncio_spx_get(ncio *const nciop,
}
{
- const size_t rndup = extent % X_ALIGN;
- if(rndup != 0)
- extent += X_ALIGN - rndup;
+ const size_t rndup = extent % X_ALIGN;
+ if(rndup != 0)
+ extent += X_ALIGN - rndup;
}
assert(offset % X_ALIGN == 0);
@@ -1163,7 +1183,7 @@ ncio_spx_get(ncio *const nciop,
pxp->bf_extent = 0;
}
assert(pxp->bf_extent == 0);
- pxp->bf_base = malloc(extent);
+ pxp->bf_base = malloc(extent+1);
if(pxp->bf_base == NULL)
return ENOMEM;
pxp->bf_extent = extent;
diff --git a/libsrc/putget.c b/libsrc/putget.c
index 3add44a..b308d8e 100644
--- a/libsrc/putget.c
+++ b/libsrc/putget.c
@@ -46,10 +46,10 @@ void
arrayp(const char *label, size_t count, const size_t *array)
{
(void) fprintf(stderr, "%s", label);
- (void) fputc('\t',stderr);
+ (void) fputc('\t',stderr);
for(; count > 0; count--, array++)
(void) fprintf(stderr," %lu", (unsigned long)*array);
- (void) fputc('\n',stderr);
+ (void) fputc('\n',stderr);
}
#endif /* ODEBUG */
@@ -58,7 +58,7 @@ arrayp(const char *label, size_t count, const size_t *array)
/*
* This is tunable parameter.
* It essentially controls the tradeoff between the number of times
- * memcpy() gets called to copy the external data to fill
+ * memcpy() gets called to copy the external data to fill
* a large buffer vs the number of times its called to
* prepare the external data.
*/
@@ -228,7 +228,7 @@ NC_fill_double(
-/*
+/*
* Fill the external space for variable 'varp' values at 'recno' with
* the appropriate value. If 'varp' is not a record variable, fill the
* whole thing. For the special case when 'varp' is the only record
@@ -279,12 +279,12 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
else
{
/* use the default */
-
+
assert(xsz % X_ALIGN == 0);
assert(xsz <= sizeof(xfillp));
-
+
xp = xfillp;
-
+
switch(varp->type){
case NC_BYTE :
status = NC_fill_schar(&xp, nelems);
@@ -301,7 +301,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
case NC_FLOAT :
status = NC_fill_float(&xp, nelems);
break;
- case NC_DOUBLE :
+ case NC_DOUBLE :
status = NC_fill_double(&xp, nelems);
break;
default :
@@ -311,7 +311,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
}
if(status != NC_NOERR)
return status;
-
+
assert(xp == xfillp + xsz);
}
@@ -338,7 +338,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
size_t ii;
status = ncio_get(ncp->nciop, offset, chunksz,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(status != NC_NOERR)
{
return status;
@@ -438,7 +438,7 @@ NCtouchlast(NC3_INFO* ncp, const NC_var *const *varpp, size_t recno)
{
int status = NC_NOERR;
const NC_var *varp = NULL;
-
+
{
size_t ii = 0;
for(; ii < ncp->vars.nelems; ii++, varpp++)
@@ -460,7 +460,7 @@ NCtouchlast(NC3_INFO* ncp, const NC_var *const *varpp, size_t recno)
status = ncio_get(ncp->nciop, offset, varp->xsz,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(status != NC_NOERR)
return status;
(void)memset(xp, 0, varp->xsz);
@@ -500,7 +500,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
#endif
/* work-around for non-unique tickets */
if (nowserving > myticket && nowserving < myticket + numpe ) {
- /* get a new ticket ... you've been bypassed */
+ /* get a new ticket ... you've been bypassed */
/* and handle the unlikely wrap-around effect */
myticket = shmem_short_finc(
(shmem_t *) ncp->lock + LOCKNUMREC_LOCK,
@@ -535,9 +535,9 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
}
else
{
- /* Treat two cases differently:
+ /* Treat two cases differently:
- exactly one record variable (no padding)
- - multiple record variables (each record padded
+ - multiple record variables (each record padded
to 4-byte alignment)
*/
NC_var **vpp = (NC_var **)ncp->vars.value;
@@ -545,7 +545,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
NC_var *recvarp = NULL; /* last record var */
int numrecvars = 0;
size_t cur_nrecs;
-
+
/* determine how many record variables */
for( /*NADA*/; vpp < end; vpp++) {
if(IS_RECVAR(*vpp)) {
@@ -553,7 +553,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
numrecvars++;
}
}
-
+
if (numrecvars != 1) { /* usual case */
/* Fill each record out to numrecs */
while((cur_nrecs = NC_get_numrecs(ncp)) < numrecs)
@@ -584,7 +584,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
}
if(status != NC_NOERR)
goto common_return;
-
+
}
}
@@ -604,7 +604,7 @@ common_return:
}
-/*
+/*
* Check whether 'coord' values are valid for the variable.
*/
static int
@@ -642,7 +642,7 @@ NCcoordck(NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
ip = coord;
up = varp->shape;
}
-
+
#ifdef CDEBUG
fprintf(stderr," NCcoordck: coord %ld, count %d, ip %ld\n",
coord, varp->ndims, ip );
@@ -665,7 +665,7 @@ fprintf(stderr," NCcoordck: ip %p, *ip %ld, up %p, *up %lu\n",
}
-/*
+/*
* Check whether 'edges' are valid for the variable and 'start'
*/
/*ARGSUSED*/
@@ -699,7 +699,7 @@ NCedgeck(const NC3_INFO* ncp, const NC_var *varp,
}
-/*
+/*
* Translate the (variable, coord) pair into a seek index
*/
static off_t
@@ -723,7 +723,7 @@ NC_varoffset(const NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
off_t *up = varp->dsizes +1;
const size_t *ip = coord;
const off_t *const end = varp->dsizes + varp->ndims;
-
+
if(IS_RECVAR(varp))
up++, ip++;
@@ -731,10 +731,10 @@ NC_varoffset(const NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
lcoord += (off_t)(*up) * (off_t)(*ip);
lcoord *= varp->xsz;
-
+
if(IS_RECVAR(varp))
lcoord += (off_t)(*coord) * ncp->recsize;
-
+
lcoord += varp->begin;
return lcoord;
}
@@ -762,10 +762,10 @@ putNCvx_char_char(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_char_char(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -774,7 +774,7 @@ putNCvx_char_char(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -808,10 +808,10 @@ putNCvx_schar_schar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_schar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -820,7 +820,7 @@ putNCvx_schar_schar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -853,10 +853,10 @@ putNCvx_schar_uchar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_uchar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -865,7 +865,7 @@ putNCvx_schar_uchar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -898,10 +898,10 @@ putNCvx_schar_short(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_short(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -910,7 +910,7 @@ putNCvx_schar_short(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -943,10 +943,10 @@ putNCvx_schar_int(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_int(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -955,7 +955,7 @@ putNCvx_schar_int(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -988,10 +988,10 @@ putNCvx_schar_float(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_float(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1000,7 +1000,7 @@ putNCvx_schar_float(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1033,10 +1033,10 @@ putNCvx_schar_double(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_double(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1045,7 +1045,7 @@ putNCvx_schar_double(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1078,10 +1078,10 @@ putNCvx_schar_longlong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_longlong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1090,7 +1090,7 @@ putNCvx_schar_longlong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1124,10 +1124,10 @@ putNCvx_short_schar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_schar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1136,7 +1136,7 @@ putNCvx_short_schar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1169,10 +1169,10 @@ putNCvx_short_uchar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_uchar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1181,7 +1181,7 @@ putNCvx_short_uchar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1214,10 +1214,10 @@ putNCvx_short_short(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_short(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1226,7 +1226,7 @@ putNCvx_short_short(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1259,10 +1259,10 @@ putNCvx_short_int(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_int(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1271,7 +1271,7 @@ putNCvx_short_int(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1304,10 +1304,10 @@ putNCvx_short_float(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_float(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1316,7 +1316,7 @@ putNCvx_short_float(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1349,10 +1349,10 @@ putNCvx_short_double(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_double(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1361,7 +1361,7 @@ putNCvx_short_double(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1394,10 +1394,10 @@ putNCvx_short_longlong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_longlong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1406,7 +1406,7 @@ putNCvx_short_longlong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1440,10 +1440,10 @@ putNCvx_int_schar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_schar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1452,7 +1452,7 @@ putNCvx_int_schar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1485,10 +1485,10 @@ putNCvx_int_uchar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_uchar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1497,7 +1497,7 @@ putNCvx_int_uchar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1530,10 +1530,10 @@ putNCvx_int_short(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_short(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1542,7 +1542,7 @@ putNCvx_int_short(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1575,10 +1575,10 @@ putNCvx_int_int(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_int(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1587,7 +1587,7 @@ putNCvx_int_int(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1620,10 +1620,10 @@ putNCvx_int_float(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_float(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1632,7 +1632,7 @@ putNCvx_int_float(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1665,10 +1665,10 @@ putNCvx_int_double(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_double(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1677,7 +1677,7 @@ putNCvx_int_double(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1710,10 +1710,10 @@ putNCvx_int_longlong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_longlong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1722,7 +1722,7 @@ putNCvx_int_longlong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1756,10 +1756,10 @@ putNCvx_float_schar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_schar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1768,7 +1768,7 @@ putNCvx_float_schar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1801,10 +1801,10 @@ putNCvx_float_uchar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_uchar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1813,7 +1813,7 @@ putNCvx_float_uchar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1846,10 +1846,10 @@ putNCvx_float_short(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_short(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1858,7 +1858,7 @@ putNCvx_float_short(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1891,10 +1891,10 @@ putNCvx_float_int(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_int(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1903,7 +1903,7 @@ putNCvx_float_int(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1936,10 +1936,10 @@ putNCvx_float_float(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_float(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1948,7 +1948,7 @@ putNCvx_float_float(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -1981,10 +1981,10 @@ putNCvx_float_double(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_double(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -1993,7 +1993,7 @@ putNCvx_float_double(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2026,10 +2026,10 @@ putNCvx_float_longlong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_longlong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2038,7 +2038,7 @@ putNCvx_float_longlong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2072,10 +2072,10 @@ putNCvx_double_schar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_schar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2084,7 +2084,7 @@ putNCvx_double_schar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2117,10 +2117,10 @@ putNCvx_double_uchar(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_uchar(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2129,7 +2129,7 @@ putNCvx_double_uchar(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2162,10 +2162,10 @@ putNCvx_double_short(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_short(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2174,7 +2174,7 @@ putNCvx_double_short(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2207,10 +2207,10 @@ putNCvx_double_int(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_int(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2219,7 +2219,7 @@ putNCvx_double_int(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2252,10 +2252,10 @@ putNCvx_double_float(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_float(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2264,7 +2264,7 @@ putNCvx_double_float(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2297,10 +2297,10 @@ putNCvx_double_double(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_double(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2309,7 +2309,7 @@ putNCvx_double_double(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2342,10 +2342,10 @@ putNCvx_double_longlong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_longlong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2354,7 +2354,7 @@ putNCvx_double_longlong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2389,10 +2389,10 @@ putNCvx_schar_uint(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_uint(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2401,7 +2401,7 @@ putNCvx_schar_uint(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2434,10 +2434,10 @@ putNCvx_schar_ulonglong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_schar_ulonglong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2446,7 +2446,7 @@ putNCvx_schar_ulonglong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2479,10 +2479,10 @@ putNCvx_short_uint(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_uint(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2491,7 +2491,7 @@ putNCvx_short_uint(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2524,10 +2524,10 @@ putNCvx_short_ulonglong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_short_ulonglong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2536,7 +2536,7 @@ putNCvx_short_ulonglong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2569,10 +2569,10 @@ putNCvx_int_uint(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_uint(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2581,7 +2581,7 @@ putNCvx_int_uint(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2614,10 +2614,10 @@ putNCvx_int_ulonglong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_int_ulonglong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2626,7 +2626,7 @@ putNCvx_int_ulonglong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2659,10 +2659,10 @@ putNCvx_float_uint(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_uint(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2671,7 +2671,7 @@ putNCvx_float_uint(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2704,10 +2704,10 @@ putNCvx_float_ulonglong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_float_ulonglong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2716,7 +2716,7 @@ putNCvx_float_ulonglong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2749,10 +2749,10 @@ putNCvx_double_uint(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_uint(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2761,7 +2761,7 @@ putNCvx_double_uint(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2794,10 +2794,10 @@ putNCvx_double_ulonglong(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_double_ulonglong(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -2806,7 +2806,7 @@ putNCvx_double_ulonglong(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -2845,12 +2845,12 @@ getNCvx_char_char(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_char_char(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -2886,12 +2886,12 @@ getNCvx_schar_schar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_schar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -2926,12 +2926,12 @@ getNCvx_schar_short(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_short(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -2966,12 +2966,12 @@ getNCvx_schar_int(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_int(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3006,12 +3006,12 @@ getNCvx_schar_float(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_float(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3046,12 +3046,12 @@ getNCvx_schar_double(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_double(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3086,12 +3086,12 @@ getNCvx_schar_longlong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_longlong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3126,12 +3126,12 @@ getNCvx_schar_uint(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_uint(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3166,12 +3166,12 @@ getNCvx_schar_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_ulonglong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3207,12 +3207,12 @@ getNCvx_short_schar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_schar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3247,12 +3247,12 @@ getNCvx_short_uchar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_uchar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3287,12 +3287,12 @@ getNCvx_short_short(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_short(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3327,12 +3327,12 @@ getNCvx_short_int(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_int(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3367,12 +3367,12 @@ getNCvx_short_float(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_float(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3407,12 +3407,12 @@ getNCvx_short_double(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_double(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3447,12 +3447,12 @@ getNCvx_short_longlong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_longlong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3487,12 +3487,12 @@ getNCvx_short_uint(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_uint(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3527,12 +3527,12 @@ getNCvx_short_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_short_ulonglong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3568,12 +3568,12 @@ getNCvx_int_schar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_schar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3608,12 +3608,12 @@ getNCvx_int_uchar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_uchar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3648,12 +3648,12 @@ getNCvx_int_short(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_short(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3688,12 +3688,12 @@ getNCvx_int_int(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_int(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3728,12 +3728,12 @@ getNCvx_int_float(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_float(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3768,12 +3768,12 @@ getNCvx_int_double(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_double(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3808,12 +3808,12 @@ getNCvx_int_longlong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_longlong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3848,12 +3848,12 @@ getNCvx_int_uint(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_uint(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3888,12 +3888,12 @@ getNCvx_int_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_int_ulonglong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3929,12 +3929,12 @@ getNCvx_float_schar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_schar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -3969,12 +3969,12 @@ getNCvx_float_uchar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_uchar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4009,12 +4009,12 @@ getNCvx_float_short(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_short(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4049,12 +4049,12 @@ getNCvx_float_int(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_int(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4089,12 +4089,12 @@ getNCvx_float_float(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_float(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4129,12 +4129,12 @@ getNCvx_float_double(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_double(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4169,12 +4169,12 @@ getNCvx_float_longlong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_longlong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4209,12 +4209,12 @@ getNCvx_float_uint(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_uint(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4249,12 +4249,12 @@ getNCvx_float_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_float_ulonglong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4290,12 +4290,12 @@ getNCvx_double_schar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_schar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4330,12 +4330,12 @@ getNCvx_double_uchar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_uchar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4370,12 +4370,12 @@ getNCvx_double_short(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_short(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4410,12 +4410,12 @@ getNCvx_double_int(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_int(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4450,12 +4450,12 @@ getNCvx_double_float(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_float(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4490,12 +4490,12 @@ getNCvx_double_double(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_double(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4530,12 +4530,12 @@ getNCvx_double_longlong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_longlong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4570,12 +4570,12 @@ getNCvx_double_uint(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_uint(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4610,12 +4610,12 @@ getNCvx_double_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_double_ulonglong(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4652,12 +4652,12 @@ getNCvx_schar_uchar(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_schar_uchar(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -4736,7 +4736,7 @@ NCiocount(const NC3_INFO* const ncp, const NC_var *const varp,
* If there is only one dimension and and it is a "record dimension",
* edp is &edges[1] (out of bounds) and we will return 0;
*/
- assert(shp >= varp->shape + varp->ndims -1
+ assert(shp >= varp->shape + varp->ndims -1
|| *(edp +1) == *(shp +1));
/* now accumulate max count for a single io operation */
@@ -4778,7 +4778,7 @@ set_upper(size_t *upp, /* modified on return */
* For some ii,
* upp == &upper[ii]
* cdp == &coord[ii]
- *
+ *
* Running this routine increments *cdp.
*
* If after the increment, *cdp is equal to *upp
@@ -4786,7 +4786,7 @@ set_upper(size_t *upp, /* modified on return */
* *cdp is "zeroed" to the starting value and
* we need to "carry", eg, increment one place to
* the left.
- *
+ *
* TODO: Some architectures hate recursion?
* Reimplement non-recursively.
*/
@@ -4799,7 +4799,7 @@ odo1(const size_t *const start, const size_t *const upper,
assert(coord <= cdp && cdp <= coord + NC_MAX_VAR_DIMS);
assert(upper <= upp && upp <= upper + NC_MAX_VAR_DIMS);
assert(upp - upper == cdp - coord);
-
+
assert(*cdp <= *upp);
(*cdp)++;
@@ -5123,7 +5123,7 @@ NC3_get_vara(int ncid, int varid,
const size_t* edges = edges0; /* so we can modify for special cases */
size_t modedges[NC_MAX_VAR_DIMS];
- status = NC_check_id(ncid, &nc);
+ status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
@@ -5131,15 +5131,15 @@ NC3_get_vara(int ncid, int varid,
if(NC_indef(nc3))
return NC_EINDEFINE;
- varp = NC_lookupvar(nc3, varid);
- if(varp == NULL)
- return NC_ENOTVAR;
+ status = NC_lookupvar(nc3, varid, &varp);
+ if(status != NC_NOERR)
+ return status;
if(memtype == NC_NAT) memtype=varp->type;
if(memtype == NC_CHAR && varp->type != NC_CHAR)
return NC_ECHAR;
- else if(memtype != NC_CHAR && varp->type == NC_CHAR)
+ else if(memtype != NC_CHAR && varp->type == NC_CHAR)
return NC_ECHAR;
/* If edges is NULL, then this was called from nc_get_var() */
@@ -5147,7 +5147,7 @@ NC3_get_vara(int ncid, int varid,
/* If this is a record variable, then we have to
substitute the number of records into dimension 0. */
if(varp->shape[0] == 0) {
- (void*)memcpy((void*)modedges,(void*)varp->shape,
+ (void)memcpy((void*)modedges,(void*)varp->shape,
sizeof(size_t)*varp->ndims);
modedges[0] = NC_get_numrecs(nc3);
edges = modedges;
@@ -5250,7 +5250,7 @@ NC3_put_vara(int ncid, int varid,
const size_t* edges = edges0; /* so we can modify for special cases */
size_t modedges[NC_MAX_VAR_DIMS];
- status = NC_check_id(ncid, &nc);
+ status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
@@ -5261,15 +5261,16 @@ NC3_put_vara(int ncid, int varid,
if(NC_indef(nc3))
return NC_EINDEFINE;
- varp = NC_lookupvar(nc3, varid);
- if(varp == NULL)
- return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
+ status = NC_lookupvar(nc3, varid, &varp);
+ if(status != NC_NOERR)
+ return status; /*invalid varid */
+
if(memtype == NC_NAT) memtype=varp->type;
if(memtype == NC_CHAR && varp->type != NC_CHAR)
return NC_ECHAR;
- else if(memtype != NC_CHAR && varp->type == NC_CHAR)
+ else if(memtype != NC_CHAR && varp->type == NC_CHAR)
return NC_ECHAR;
/* Get the size of the memtype */
@@ -5280,7 +5281,7 @@ NC3_put_vara(int ncid, int varid,
/* If this is a record variable, then we have to
substitute the number of records into dimension 0. */
if(varp->shape[0] == 0) {
- (void*)memcpy((void*)modedges,(void*)varp->shape,
+ (void)memcpy((void*)modedges,(void*)varp->shape,
sizeof(size_t)*varp->ndims);
modedges[0] = NC_get_numrecs(nc3);
edges = modedges;
diff --git a/libsrc/putget.m4 b/libsrc/putget.m4
index 0129e88..9f4bc52 100644
--- a/libsrc/putget.m4
+++ b/libsrc/putget.m4
@@ -55,10 +55,10 @@ void
arrayp(const char *label, size_t count, const size_t *array)
{
(void) fprintf(stderr, "%s", label);
- (void) fputc('\t',stderr);
+ (void) fputc('\t',stderr);
for(; count > 0; count--, array++)
(void) fprintf(stderr," %lu", (unsigned long)*array);
- (void) fputc('\n',stderr);
+ (void) fputc('\n',stderr);
}
#endif /* ODEBUG */
@@ -67,7 +67,7 @@ arrayp(const char *label, size_t count, const size_t *array)
/*
* This is tunable parameter.
* It essentially controls the tradeoff between the number of times
- * memcpy() gets called to copy the external data to fill
+ * memcpy() gets called to copy the external data to fill
* a large buffer vs the number of times its called to
* prepare the external data.
*/
@@ -129,7 +129,7 @@ NCFILL(double, double, X_SIZEOF_DOUBLE, NC_FILL_DOUBLE)
-/*
+/*
* Fill the external space for variable 'varp' values at 'recno' with
* the appropriate value. If 'varp' is not a record variable, fill the
* whole thing. For the special case when 'varp' is the only record
@@ -180,12 +180,12 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
else
{
/* use the default */
-
+
assert(xsz % X_ALIGN == 0);
assert(xsz <= sizeof(xfillp));
-
+
xp = xfillp;
-
+
switch(varp->type){
case NC_BYTE :
status = NC_fill_schar(&xp, nelems);
@@ -202,7 +202,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
case NC_FLOAT :
status = NC_fill_float(&xp, nelems);
break;
- case NC_DOUBLE :
+ case NC_DOUBLE :
status = NC_fill_double(&xp, nelems);
break;
default :
@@ -212,7 +212,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
}
if(status != NC_NOERR)
return status;
-
+
assert(xp == xfillp + xsz);
}
@@ -239,7 +239,7 @@ fill_NC_var(NC3_INFO* ncp, const NC_var *varp, size_t varsize, size_t recno)
size_t ii;
status = ncio_get(ncp->nciop, offset, chunksz,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(status != NC_NOERR)
{
return status;
@@ -339,7 +339,7 @@ NCtouchlast(NC3_INFO* ncp, const NC_var *const *varpp, size_t recno)
{
int status = NC_NOERR;
const NC_var *varp = NULL;
-
+
{
size_t ii = 0;
for(; ii < ncp->vars.nelems; ii++, varpp++)
@@ -361,7 +361,7 @@ NCtouchlast(NC3_INFO* ncp, const NC_var *const *varpp, size_t recno)
status = ncio_get(ncp->nciop, offset, varp->xsz,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(status != NC_NOERR)
return status;
(void)memset(xp, 0, varp->xsz);
@@ -401,7 +401,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
#endif
/* work-around for non-unique tickets */
if (nowserving > myticket && nowserving < myticket + numpe ) {
- /* get a new ticket ... you've been bypassed */
+ /* get a new ticket ... you've been bypassed */
/* and handle the unlikely wrap-around effect */
myticket = shmem_short_finc(
(shmem_t *) ncp->lock + LOCKNUMREC_LOCK,
@@ -436,9 +436,9 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
}
else
{
- /* Treat two cases differently:
+ /* Treat two cases differently:
- exactly one record variable (no padding)
- - multiple record variables (each record padded
+ - multiple record variables (each record padded
to 4-byte alignment)
*/
NC_var **vpp = (NC_var **)ncp->vars.value;
@@ -446,7 +446,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
NC_var *recvarp = NULL; /* last record var */
int numrecvars = 0;
size_t cur_nrecs;
-
+
/* determine how many record variables */
for( /*NADA*/; vpp < end; vpp++) {
if(IS_RECVAR(*vpp)) {
@@ -454,7 +454,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
numrecvars++;
}
}
-
+
if (numrecvars != 1) { /* usual case */
/* Fill each record out to numrecs */
while((cur_nrecs = NC_get_numrecs(ncp)) < numrecs)
@@ -485,7 +485,7 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
}
if(status != NC_NOERR)
goto common_return;
-
+
}
}
@@ -505,7 +505,7 @@ common_return:
}
-/*
+/*
* Check whether 'coord' values are valid for the variable.
*/
static int
@@ -543,7 +543,7 @@ NCcoordck(NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
ip = coord;
up = varp->shape;
}
-
+
#ifdef CDEBUG
fprintf(stderr," NCcoordck: coord %ld, count %d, ip %ld\n",
coord, varp->ndims, ip );
@@ -566,7 +566,7 @@ fprintf(stderr," NCcoordck: ip %p, *ip %ld, up %p, *up %lu\n",
}
-/*
+/*
* Check whether 'edges' are valid for the variable and 'start'
*/
/*ARGSUSED*/
@@ -600,7 +600,7 @@ NCedgeck(const NC3_INFO* ncp, const NC_var *varp,
}
-/*
+/*
* Translate the (variable, coord) pair into a seek index
*/
static off_t
@@ -624,7 +624,7 @@ NC_varoffset(const NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
off_t *up = varp->dsizes +1;
const size_t *ip = coord;
const off_t *const end = varp->dsizes + varp->ndims;
-
+
if(IS_RECVAR(varp))
up++, ip++;
@@ -632,10 +632,10 @@ NC_varoffset(const NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
lcoord += (off_t)(*up) * (off_t)(*ip);
lcoord *= varp->xsz;
-
+
if(IS_RECVAR(varp))
lcoord += (off_t)(*coord) * ncp->recsize;
-
+
lcoord += varp->begin;
return lcoord;
}
@@ -672,10 +672,10 @@ putNCvx_$1_$2(NC3_INFO* ncp, const NC_var *varp,
size_t nput = ncx_howmany(varp->type, extent);
int lstatus = ncio_get(ncp->nciop, offset, extent,
- RGN_WRITE, &xp);
+ RGN_WRITE, &xp);
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_putn_$1_$2(&xp, nput, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
{
@@ -684,7 +684,7 @@ putNCvx_$1_$2(NC3_INFO* ncp, const NC_var *varp,
}
(void) ncio_rel(ncp->nciop, offset,
- RGN_MODIFIED);
+ RGN_MODIFIED);
remaining -= extent;
if(remaining == 0)
@@ -782,12 +782,12 @@ getNCvx_$1_$2(const NC3_INFO* ncp, const NC_var *varp,
0, (void **)&xp); /* cast away const */
if(lstatus != NC_NOERR)
return lstatus;
-
+
lstatus = ncx_getn_$1_$2(&xp, nget, value);
if(lstatus != NC_NOERR && status == NC_NOERR)
status = lstatus;
- (void) ncio_rel(ncp->nciop, offset, 0);
+ (void) ncio_rel(ncp->nciop, offset, 0);
remaining -= extent;
if(remaining == 0)
@@ -921,7 +921,7 @@ NCiocount(const NC3_INFO* const ncp, const NC_var *const varp,
* If there is only one dimension and and it is a "record dimension",
* edp is &edges[1] (out of bounds) and we will return 0;
*/
- assert(shp >= varp->shape + varp->ndims -1
+ assert(shp >= varp->shape + varp->ndims -1
|| *(edp +1) == *(shp +1));
/* now accumulate max count for a single io operation */
@@ -963,7 +963,7 @@ set_upper(size_t *upp, /* modified on return */
* For some ii,
* upp == &upper[ii]
* cdp == &coord[ii]
- *
+ *
* Running this routine increments *cdp.
*
* If after the increment, *cdp is equal to *upp
@@ -971,7 +971,7 @@ set_upper(size_t *upp, /* modified on return */
* *cdp is "zeroed" to the starting value and
* we need to "carry", eg, increment one place to
* the left.
- *
+ *
* TODO: Some architectures hate recursion?
* Reimplement non-recursively.
*/
@@ -984,7 +984,7 @@ odo1(const size_t *const start, const size_t *const upper,
assert(coord <= cdp && cdp <= coord + NC_MAX_VAR_DIMS);
assert(upper <= upp && upp <= upper + NC_MAX_VAR_DIMS);
assert(upp - upper == cdp - coord);
-
+
assert(*cdp <= *upp);
(*cdp)++;
@@ -1324,7 +1324,7 @@ NC3_get_vara(int ncid, int varid,
const size_t* edges = edges0; /* so we can modify for special cases */
size_t modedges[NC_MAX_VAR_DIMS];
- status = NC_check_id(ncid, &nc);
+ status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
@@ -1332,15 +1332,15 @@ NC3_get_vara(int ncid, int varid,
if(NC_indef(nc3))
return NC_EINDEFINE;
- varp = NC_lookupvar(nc3, varid);
- if(varp == NULL)
- return NC_ENOTVAR;
+ status = NC_lookupvar(nc3, varid, &varp);
+ if(status != NC_NOERR)
+ return status;
if(memtype == NC_NAT) memtype=varp->type;
if(memtype == NC_CHAR && varp->type != NC_CHAR)
return NC_ECHAR;
- else if(memtype != NC_CHAR && varp->type == NC_CHAR)
+ else if(memtype != NC_CHAR && varp->type == NC_CHAR)
return NC_ECHAR;
/* If edges is NULL, then this was called from nc_get_var() */
@@ -1348,7 +1348,7 @@ NC3_get_vara(int ncid, int varid,
/* If this is a record variable, then we have to
substitute the number of records into dimension 0. */
if(varp->shape[0] == 0) {
- (void*)memcpy((void*)modedges,(void*)varp->shape,
+ (void)memcpy((void*)modedges,(void*)varp->shape,
sizeof(size_t)*varp->ndims);
modedges[0] = NC_get_numrecs(nc3);
edges = modedges;
@@ -1451,7 +1451,7 @@ NC3_put_vara(int ncid, int varid,
const size_t* edges = edges0; /* so we can modify for special cases */
size_t modedges[NC_MAX_VAR_DIMS];
- status = NC_check_id(ncid, &nc);
+ status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
@@ -1462,15 +1462,16 @@ NC3_put_vara(int ncid, int varid,
if(NC_indef(nc3))
return NC_EINDEFINE;
- varp = NC_lookupvar(nc3, varid);
- if(varp == NULL)
- return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
+ status = NC_lookupvar(nc3, varid, &varp);
+ if(status != NC_NOERR)
+ return status; /*invalid varid */
+
if(memtype == NC_NAT) memtype=varp->type;
if(memtype == NC_CHAR && varp->type != NC_CHAR)
return NC_ECHAR;
- else if(memtype != NC_CHAR && varp->type == NC_CHAR)
+ else if(memtype != NC_CHAR && varp->type == NC_CHAR)
return NC_ECHAR;
/* Get the size of the memtype */
@@ -1481,7 +1482,7 @@ NC3_put_vara(int ncid, int varid,
/* If this is a record variable, then we have to
substitute the number of records into dimension 0. */
if(varp->shape[0] == 0) {
- (void*)memcpy((void*)modedges,(void*)varp->shape,
+ (void)memcpy((void*)modedges,(void*)varp->shape,
sizeof(size_t)*varp->ndims);
modedges[0] = NC_get_numrecs(nc3);
edges = modedges;
diff --git a/libsrc/var.c b/libsrc/var.c
index 1caac85..f47c404 100644
--- a/libsrc/var.c
+++ b/libsrc/var.c
@@ -509,32 +509,36 @@ NC_check_vlen(NC_var *varp, size_t vlen_max) {
}
-/*
- * Given valid ncp and varid, return var
- * else NULL on error
- * Formerly
-NC_hlookupvar()
+/*! Look up a variable by varid.
+ *
+ * Given a valid ncp structure and varid, return the var.
+ *
+ * Formerly NC_hlookupvar()
+ *
+ * @param[in] ncp NC3_INFO data structure.
+ * @param[in] varid The varid key for the var we are looking up.
+ * @param[out] varp Data structure to contain the varp pointer.
+ * @return Error code, if one exists, 0 otherwise.
*/
-NC_var *
-NC_lookupvar(NC3_INFO* ncp, int varid)
-{
- NC_var *varp;
- if(varid == NC_GLOBAL)
+int NC_lookupvar(NC3_INFO* ncp, int varid, NC_var **varp)
+{
+ if(varid == NC_GLOBAL)
{
- /* Global is error in this context */
- return(NULL);
+ /* Global is error in this context */
+ return NC_EGLOBAL;
}
- varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
- if(varp == NULL)
- {
- return NULL;
- }
+ if(varp)
+ *varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
+ else
+ return NC_ENOTVAR;
- assert(varp != NULL);
+ if(*varp == NULL)
+ return NC_ENOTVAR;
+
+ return NC_NOERR;
- return(varp);
}
@@ -717,11 +721,11 @@ NC3_rename_var(int ncid, int varid, const char *unewname)
return NC_ENAMEINUSE;
}
- varp = NC_lookupvar(ncp, varid);
- if(varp == NULL)
+ status = NC_lookupvar(ncp, varid, &varp);
+ if(status != NC_NOERR)
{
/* invalid varid */
- return NC_ENOTVAR; /* TODO: is this the right error code? */
+ return status;
}
old = varp->name;
diff --git a/libsrc/winceio.c b/libsrc/winceio.c
index 0dda5b9..274dbd4 100644
--- a/libsrc/winceio.c
+++ b/libsrc/winceio.c
@@ -402,7 +402,7 @@ static void
ncio_fileio_init(ncio *const nciop)
{
ncio_ffio *ffp = (ncio_ffio *)nciop->pvt;
-
+p
*((ncio_relfunc **)&nciop->rel) = ncio_fileio_rel; /* cast away const */
*((ncio_getfunc **)&nciop->get) = ncio_fileio_get; /* cast away const */
*((ncio_movefunc **)&nciop->move) = ncio_fileio_move; /* cast away const */
diff --git a/libsrc4/Makefile.in b/libsrc4/Makefile.in
index 3e95b86..5b297b7 100644
--- a/libsrc4/Makefile.in
+++ b/libsrc4/Makefile.in
@@ -226,6 +226,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -301,7 +304,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c
index 81de2b4..4c037bd 100644
--- a/libsrc4/nc4hdf.c
+++ b/libsrc4/nc4hdf.c
@@ -19,8 +19,8 @@
#include <H5DSpublic.h>
#include <math.h>
-#if 0 /*def USE_PNETCDF*/
-#include <pnetcdf.h>
+#ifdef USE_PARALLEL
+#include "netcdf_par.h"
#endif
#define NC3_STRICT_ATT_NAME "_nc3_strict"
@@ -293,6 +293,8 @@ nc4_get_hdf_typeid(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
return NC_EHDFERR;
if (H5Tset_strpad(typeid, H5T_STR_NULLTERM) < 0)
BAIL(NC_EVARMETA);
+ if(H5Tset_cset(typeid, H5T_CSET_UTF8) < 0)
+ BAIL(NC_EVARMETA);
/* Take ownership of the newly created HDF5 datatype */
*hdf_typeid = typeid;
@@ -304,6 +306,8 @@ nc4_get_hdf_typeid(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
return NC_EHDFERR;
if (H5Tset_size(typeid, H5T_VARIABLE) < 0)
BAIL(NC_EVARMETA);
+ if(H5Tset_cset(typeid, H5T_CSET_UTF8) < 0)
+ BAIL(NC_EVARMETA);
/* Take ownership of the newly created HDF5 datatype */
*hdf_typeid = typeid;
diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c
index 9616e56..1d282ad 100644
--- a/libsrc4/nc4var.c
+++ b/libsrc4/nc4var.c
@@ -266,8 +266,22 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
var->chunksizes[d] = 1; /* overwritten below, if all dims are unlimited */
}
}
-
- if (var->ndims > 0 && var->ndims == num_unlim) { /* all dims unlimited */
+ /* Special case to avoid 1D vars with unlim dim taking huge amount
+ of space (DEFAULT_CHUNK_SIZE bytes). Instead we limit to about
+ 4KB */
+#define DEFAULT_1D_UNLIM_SIZE (4096) /* TODO: make build-time parameter? */
+ if (var->ndims == 1 && num_unlim == 1) {
+ if (DEFAULT_CHUNK_SIZE / type_size <= 0)
+ suggested_size = 1;
+ else if (DEFAULT_CHUNK_SIZE / type_size > DEFAULT_1D_UNLIM_SIZE)
+ suggested_size = DEFAULT_1D_UNLIM_SIZE;
+ else
+ suggested_size = DEFAULT_CHUNK_SIZE / type_size;
+ var->chunksizes[0] = suggested_size / type_size;
+ LOG((4, "%s: name %s dim %d DEFAULT_CHUNK_SIZE %d num_values %f type_size %d "
+ "chunksize %ld", __func__, var->name, d, DEFAULT_CHUNK_SIZE, num_values, type_size, var->chunksizes[0]));
+ }
+ if (var->ndims > 1 && var->ndims == num_unlim) { /* all dims unlimited */
suggested_size = pow((double)DEFAULT_CHUNK_SIZE/type_size, 1.0/(double)(var->ndims));
for (d = 0; d < var->ndims; d++)
{
@@ -878,7 +892,7 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
var->contiguous = NC_FALSE;
}
- /* Fltcher32 checksum error protection? */
+ /* Fletcher32 checksum error protection? */
if (fletcher32)
{
var->fletcher32 = *fletcher32;
@@ -995,7 +1009,7 @@ NC4_def_var_fletcher32(int ncid, int varid, int fletcher32)
and before nc_enddef.
Chunking is required in any dataset with one or more unlimited
- dimension in HDF5, or any dataset using a filter.
+ dimensions in HDF5, or any dataset using a filter.
Where chunksize is a pointer to an array of size ndims, with the
chunksize in each dimension.
diff --git a/libsrc5/CMakeLists.txt b/libsrc5/CMakeLists.txt
deleted file mode 100644
index 5859425..0000000
--- a/libsrc5/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-SET(libsrc5_SOURCES nc5dispatch.c)
-
-add_library(netcdf5 OBJECT ${libsrc5_SOURCES})
-
-ADD_EXTRA_DIST(${libsrc5_SOURCES} CMakeLists.txt)
diff --git a/libsrcp/CMakeLists.txt b/libsrcp/CMakeLists.txt
new file mode 100644
index 0000000..7d8ab9c
--- /dev/null
+++ b/libsrcp/CMakeLists.txt
@@ -0,0 +1,5 @@
+SET(libsrcp_SOURCES ncpdispatch.c)
+
+add_library(netcdfp OBJECT ${libsrcp_SOURCES})
+
+ADD_EXTRA_DIST(${libsrcp_SOURCES} CMakeLists.txt)
diff --git a/libsrc5/Makefile.am b/libsrcp/Makefile.am
similarity index 78%
rename from libsrc5/Makefile.am
rename to libsrcp/Makefile.am
index 8ba7431..9e59f0c 100644
--- a/libsrc5/Makefile.am
+++ b/libsrcp/Makefile.am
@@ -6,19 +6,19 @@
include $(top_srcdir)/lib_flags.am
-libnetcdf5_la_CPPFLAGS = ${AM_CPPFLAGS}
+libnetcdfp_la_CPPFLAGS = ${AM_CPPFLAGS}
# This is the code for a dispatch table for pnetcdf
# (which has CDF5 as its magic number)
# Turn on a pre-processor flag when building a DLL for windows.
if BUILD_DLL
-libnetcdf5_la_CPPFLAGS += -DDLL_EXPORT
+libnetcdfp_la_CPPFLAGS += -DDLL_EXPORT
endif # BUILD_DLL
# These files comprise the pnetcdf dispatch library code.
-libnetcdf5_la_SOURCES = nc5dispatch.c
+libnetcdfp_la_SOURCES = ncpdispatch.c
-noinst_LTLIBRARIES = libnetcdf5.la
+noinst_LTLIBRARIES = libnetcdfp.la
EXTRA_DIST = CMakeLists.txt
diff --git a/libsrc5/Makefile.in b/libsrcp/Makefile.in
similarity index 92%
rename from libsrc5/Makefile.in
rename to libsrcp/Makefile.in
index d723787..d804bbc 100644
--- a/libsrc5/Makefile.in
+++ b/libsrcp/Makefile.in
@@ -112,7 +112,7 @@ target_triplet = @target@
# Turn on a pre-processor flag when building a DLL for windows.
@BUILD_DLL_TRUE at am__append_3 = -DDLL_EXPORT
-subdir = libsrc5
+subdir = libsrcp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -126,9 +126,9 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libnetcdf5_la_LIBADD =
-am_libnetcdf5_la_OBJECTS = libnetcdf5_la-nc5dispatch.lo
-libnetcdf5_la_OBJECTS = $(am_libnetcdf5_la_OBJECTS)
+libnetcdfp_la_LIBADD =
+am_libnetcdfp_la_OBJECTS = libnetcdfp_la-ncpdispatch.lo
+libnetcdfp_la_OBJECTS = $(am_libnetcdfp_la_OBJECTS)
AM_V_lt = $(am__v_lt_ at AM_V@)
am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
am__v_lt_0 = --silent
@@ -167,8 +167,8 @@ AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = $(libnetcdf5_la_SOURCES)
-DIST_SOURCES = $(libnetcdf5_la_SOURCES)
+SOURCES = $(libnetcdfp_la_SOURCES)
+DIST_SOURCES = $(libnetcdfp_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -224,6 +224,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -299,7 +302,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
@@ -363,11 +365,11 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-libnetcdf5_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_3)
+libnetcdfp_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_3)
# These files comprise the pnetcdf dispatch library code.
-libnetcdf5_la_SOURCES = nc5dispatch.c
-noinst_LTLIBRARIES = libnetcdf5.la
+libnetcdfp_la_SOURCES = ncpdispatch.c
+noinst_LTLIBRARIES = libnetcdfp.la
EXTRA_DIST = CMakeLists.txt
all: all-am
@@ -382,9 +384,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrc5/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrcp/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign libsrc5/Makefile
+ $(AUTOMAKE) --foreign libsrcp/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -415,8 +417,8 @@ clean-noinstLTLIBRARIES:
rm -f $${locs}; \
}
-libnetcdf5.la: $(libnetcdf5_la_OBJECTS) $(libnetcdf5_la_DEPENDENCIES) $(EXTRA_libnetcdf5_la_DEPENDENCIES)
- $(AM_V_CCLD)$(LINK) $(libnetcdf5_la_OBJECTS) $(libnetcdf5_la_LIBADD) $(LIBS)
+libnetcdfp.la: $(libnetcdfp_la_OBJECTS) $(libnetcdfp_la_DEPENDENCIES) $(EXTRA_libnetcdfp_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(libnetcdfp_la_OBJECTS) $(libnetcdfp_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -424,7 +426,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf5_la-nc5dispatch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo at am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -450,12 +452,12 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
-libnetcdf5_la-nc5dispatch.lo: nc5dispatch.c
- at am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetcdf5_la-nc5dispatch.lo -MD -MP -MF $(DEPDIR)/libnetcdf5_la-nc5dispatch.Tpo -c -o libnetcdf5_la-nc5dispatch.lo `test -f 'nc5dispatch.c' || echo '$(srcdir)/'`nc5dispatch.c
- at am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdf5_la-nc5dispatch.Tpo $(DEPDIR)/libnetcdf5_la-nc5dispatch.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nc5dispatch.c' object='libnetcdf5_la-nc5dispatch.lo' libtool=yes @AMDEPBACKSLASH@
+libnetcdfp_la-ncpdispatch.lo: ncpdispatch.c
+ at am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdfp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetcdfp_la-ncpdispatch.lo -MD -MP -MF $(DEPDIR)/libnetcdfp_la-ncpdispatch.Tpo -c -o libnetcdfp_la-ncpdispatch.lo `test -f 'ncpdispatch.c' || echo '$(srcdir)/'`ncpdispatch.c
+ at am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdfp_la-ncpdispatch.Tpo $(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ncpdispatch.c' object='libnetcdfp_la-ncpdispatch.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetcdf5_la-nc5dispatch.lo `test -f 'nc5dispatch.c' || echo '$(srcdir)/'`nc5dispatch.c
+ at am__fastdepCC_FALSE@ $(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdfp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetcdfp_la-ncpdispatch.lo `test -f 'ncpdispatch.c' || echo '$(srcdir)/'`ncpdispatch.c
mostlyclean-libtool:
-rm -f *.lo
diff --git a/libsrc5/nc5dispatch.c b/libsrcp/ncpdispatch.c
similarity index 76%
rename from libsrc5/nc5dispatch.c
rename to libsrcp/ncpdispatch.c
index cba9cbe..c3a9494 100644
--- a/libsrc5/nc5dispatch.c
+++ b/libsrcp/ncpdispatch.c
@@ -1,6 +1,6 @@
/********************************************************************* * Copyright 1993, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
- * $Header: /upc/share/CVS/netcdf-3/libsrc4/NC5dispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $
+ * $Header: /upc/share/CVS/netcdf-3/libsrc4/NCPdispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $
*********************************************************************/
/* WARNING: Order of mpi.h, nc.h, and pnetcdf.h is important */
@@ -12,7 +12,7 @@
/* Must follow netcdf.h */
#include <pnetcdf.h>
-typedef struct NC5_INFO
+typedef struct NCP_INFO
{
/* pnetcdf_file will be true if the file is created/opened with the
* parallel-netcdf library. pnetcdf_access_mode keeps track of
@@ -23,11 +23,11 @@ typedef struct NC5_INFO
* to find out the number of dims, because these are collective in
* pnetcdf.) */
int pnetcdf_access_mode;
-} NC5_INFO;
+} NCP_INFO;
/* Define accessors for the dispatchdata */
-#define NC5_DATA(nc) ((NC5_INFO*)(nc)->dispatchdata)
-#define NC5_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data))
+#define NCP_DATA(nc) ((NCP_INFO*)(nc)->dispatchdata)
+#define NCP_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data))
#define LEGAL_CREATE_FLAGS (NC_NOCLOBBER | NC_64BIT_OFFSET | NC_CLASSIC_MODEL | NC_SHARE | NC_MPIIO | NC_MPIPOSIX | NC_LOCK | NC_PNETCDF)
@@ -37,13 +37,13 @@ typedef struct NC5_INFO
/**************************************************/
static int
-NC5_create(const char *path, int cmode,
+NCP_create(const char *path, int cmode,
size_t initialsz, int basepe, size_t *chunksizehintp,
int use_parallel, void* mpidata,
struct NC_Dispatch* table, NC* nc)
{
int res;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
@@ -62,12 +62,12 @@ NC5_create(const char *path, int cmode,
comm = ((NC_MPI_INFO *)mpidata)->comm;
info = ((NC_MPI_INFO *)mpidata)->info;
- /* Create our specific NC5_INFO instance */
- nc5 = (NC5_INFO*)calloc(1,sizeof(NC5_INFO));
- if(nc5 == NULL) return NC_ENOMEM;
+ /* Create our specific NCP_INFO instance */
+ ncp = (NCP_INFO*)calloc(1,sizeof(NCP_INFO));
+ if(ncp == NULL) return NC_ENOMEM;
- /* Link nc5 and nc */
- NC5_DATA_SET(nc,nc5);
+ /* Link ncp and nc */
+ NCP_DATA_SET(nc,ncp);
/* Fix up the cmode by keeping only essential flags;
these are the flags that are the same in netcf.h and pnetcdf.h
@@ -90,18 +90,18 @@ NC5_create(const char *path, int cmode,
cmode |= (NC_NETCDF4);
res = ncmpi_create(comm, path, cmode, info, &(nc->int_ncid));
- if(res && nc5 != NULL) free(nc5); /* reclaim allocated space */
+ if(res && ncp != NULL) free(ncp); /* reclaim allocated space */
return res;
}
static int
-NC5_open(const char *path, int cmode,
+NCP_open(const char *path, int cmode,
int basepe, size_t *chunksizehintp,
int use_parallel, void* mpidata,
struct NC_Dispatch* table, NC* nc)
{
int res;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
@@ -130,28 +130,28 @@ NC5_open(const char *path, int cmode,
*/
cmode &= (NC_WRITE | NC_NOCLOBBER | NC_LOCK | NC_SHARE | NC_64BIT_OFFSET);
- cmode |= (NC_NETCDF4); /* see comment in NC5_create */
+ cmode |= (NC_NETCDF4); /* see comment in NCP_create */
- /* Create our specific NC5_INFO instance */
- nc5 = (NC5_INFO*)calloc(1,sizeof(NC5_INFO));
- if(nc5 == NULL) return NC_ENOMEM;
+ /* Create our specific NCP_INFO instance */
+ ncp = (NCP_INFO*)calloc(1,sizeof(NCP_INFO));
+ if(ncp == NULL) return NC_ENOMEM;
- /* Link nc5 and nc */
- NC5_DATA_SET(nc,nc5);
+ /* Link ncp and nc */
+ NCP_DATA_SET(nc,ncp);
res = ncmpi_open(comm, path, cmode, info, &(nc->int_ncid));
/* Default to independent access, like netCDF-4/HDF5 files. */
if(!res) {
res = ncmpi_begin_indep_data(nc->int_ncid);
- nc5->pnetcdf_access_mode = NC_INDEPENDENT;
+ ncp->pnetcdf_access_mode = NC_INDEPENDENT;
}
return res;
}
static int
-NC5_redef(int ncid)
+NCP_redef(int ncid)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -160,35 +160,35 @@ NC5_redef(int ncid)
}
static int
-NC5_enddef(int ncid)
+NCP_enddef(int ncid)
{
int status;
NC* nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
- nc5 = NC5_DATA(nc);
- assert(nc5);
+ ncp = NCP_DATA(nc);
+ assert(ncp);
status = ncmpi_enddef(nc->int_ncid);
if(!status) {
- if (nc5->pnetcdf_access_mode == NC_INDEPENDENT)
+ if (ncp->pnetcdf_access_mode == NC_INDEPENDENT)
status = ncmpi_begin_indep_data(nc->int_ncid);
}
return status;
}
static int
-NC5__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align)
+NCP__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align)
{
- return NC5_enddef(ncid);
+ return NCP_enddef(ncid);
}
static int
-NC5_sync(int ncid)
+NCP_sync(int ncid)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -197,40 +197,40 @@ NC5_sync(int ncid)
}
static int
-NC5_abort(int ncid)
+NCP_abort(int ncid)
{
NC* nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
int status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) goto done;
status = ncmpi_abort(nc->int_ncid);
done:
- nc5 = NC5_DATA(nc);
- if(nc5 != NULL) free(nc5); /* reclaim allocated space */
+ ncp = NCP_DATA(nc);
+ if(ncp != NULL) free(ncp); /* reclaim allocated space */
return status;
}
static int
-NC5_close(int ncid)
+NCP_close(int ncid)
{
NC* nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
int status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) goto done;
status = ncmpi_close(nc->int_ncid);
done:
- nc5 = NC5_DATA(nc);
- if(nc5 != NULL) free(nc5); /* reclaim allocated space */
+ ncp = NCP_DATA(nc);
+ if(ncp != NULL) free(ncp); /* reclaim allocated space */
return status;
}
static int
-NC5_set_fill(int ncid, int fillmode, int *old_mode_ptr)
+NCP_set_fill(int ncid, int fillmode, int *old_mode_ptr)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -239,20 +239,20 @@ NC5_set_fill(int ncid, int fillmode, int *old_mode_ptr)
}
static int
-NC5_inq_base_pe(int ncid, int* pep)
+NCP_inq_base_pe(int ncid, int* pep)
{
if(pep) *pep = 0;
return NC_NOERR;
}
static int
-NC5_set_base_pe(int ncid, int pe)
+NCP_set_base_pe(int ncid, int pe)
{
return NC_NOERR;
}
static int
-NC5_inq_format(int ncid, int* formatp)
+NCP_inq_format(int ncid, int* formatp)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -261,7 +261,7 @@ NC5_inq_format(int ncid, int* formatp)
}
static int
-NC5_inq_format_extended(int ncid, int* formatp, int *modep)
+NCP_inq_format_extended(int ncid, int* formatp, int *modep)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -272,7 +272,7 @@ NC5_inq_format_extended(int ncid, int* formatp, int *modep)
}
static int
-NC5_inq(int ncid,
+NCP_inq(int ncid,
int *ndimsp,
int *nvarsp,
int *nattsp,
@@ -294,7 +294,7 @@ atomic_name[6][NC_MAX_NAME + 1] = {
};
static int
-NC5_inq_type(int ncid, nc_type typeid, char* name, size_t* size)
+NCP_inq_type(int ncid, nc_type typeid, char* name, size_t* size)
{
if(typeid < NC_BYTE || typeid > NC_DOUBLE)
return NC_EBADTYPE;
@@ -310,24 +310,24 @@ NC5_inq_type(int ncid, nc_type typeid, char* name, size_t* size)
}
static int
-NC5_def_dim(int ncid, const char* name, size_t len, int* idp)
+NCP_def_dim(int ncid, const char* name, size_t len, int* idp)
{
int status;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
NC* nc;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
- nc5 = NC5_DATA(nc);
- assert(nc5);
+ ncp = NCP_DATA(nc);
+ assert(ncp);
return ncmpi_def_dim(nc->int_ncid, name, len, idp);
}
static int
-NC5_inq_dimid(int ncid, const char *name, int *idp)
+NCP_inq_dimid(int ncid, const char *name, int *idp)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -336,7 +336,7 @@ NC5_inq_dimid(int ncid, const char *name, int *idp)
}
static int
-NC5_inq_dim(int ncid, int dimid, char *name, size_t* lenp)
+NCP_inq_dim(int ncid, int dimid, char *name, size_t* lenp)
{
int status;
NC* nc;
@@ -349,7 +349,7 @@ NC5_inq_dim(int ncid, int dimid, char *name, size_t* lenp)
}
static int
-NC5_inq_unlimdim(int ncid, int *unlimdimidp)
+NCP_inq_unlimdim(int ncid, int *unlimdimidp)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -358,7 +358,7 @@ NC5_inq_unlimdim(int ncid, int *unlimdimidp)
}
static int
-NC5_rename_dim(int ncid, int dimid, const char* newname)
+NCP_rename_dim(int ncid, int dimid, const char* newname)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -367,7 +367,7 @@ NC5_rename_dim(int ncid, int dimid, const char* newname)
}
static int
-NC5_inq_att(int ncid, int varid, const char* name, nc_type* xtypep, size_t* lenp)
+NCP_inq_att(int ncid, int varid, const char* name, nc_type* xtypep, size_t* lenp)
{
NC* nc;
MPI_Offset mpilen;
@@ -379,7 +379,7 @@ NC5_inq_att(int ncid, int varid, const char* name, nc_type* xtypep, size_t* lenp
}
static int
-NC5_inq_attid(int ncid, int varid, const char *name, int *idp)
+NCP_inq_attid(int ncid, int varid, const char *name, int *idp)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -388,7 +388,7 @@ NC5_inq_attid(int ncid, int varid, const char *name, int *idp)
}
static int
-NC5_inq_attname(int ncid, int varid, int attnum, char *name)
+NCP_inq_attname(int ncid, int varid, int attnum, char *name)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -398,7 +398,7 @@ NC5_inq_attname(int ncid, int varid, int attnum, char *name)
}
static int
-NC5_rename_att(int ncid, int varid, const char *name,
+NCP_rename_att(int ncid, int varid, const char *name,
const char *newname)
{
NC* nc;
@@ -408,7 +408,7 @@ NC5_rename_att(int ncid, int varid, const char *name,
}
static int
-NC5_del_att(int ncid, int varid, const char *name)
+NCP_del_att(int ncid, int varid, const char *name)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -417,7 +417,7 @@ NC5_del_att(int ncid, int varid, const char *name)
}
int
-NC5_get_att(
+NCP_get_att(
int ncid,
int varid,
const char *name,
@@ -431,7 +431,7 @@ NC5_get_att(
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) return status;
- status = NC5_inq_att(ncid,varid,name,&xtype,NULL);
+ status = NCP_inq_att(ncid,varid,name,&xtype,NULL);
if(memtype == NC_NAT) memtype = xtype;
@@ -459,7 +459,7 @@ NC5_get_att(
}
int
-NC5_put_att(
+NCP_put_att(
int ncid,
int varid,
const char *name,
@@ -509,24 +509,24 @@ NC5_put_att(
}
static int
-NC5_def_var(int ncid, const char *name, nc_type xtype,
+NCP_def_var(int ncid, const char *name, nc_type xtype,
int ndims, const int *dimidsp, int *varidp)
{
NC* nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
int status;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) return status;
- nc5 = NC5_DATA(nc);
- assert(nc5);
+ ncp = NCP_DATA(nc);
+ assert(ncp);
status = ncmpi_def_var(nc->int_ncid,name,xtype,ndims,dimidsp,varidp);
return status;
}
static int
-NC5_inq_varid(int ncid, const char *name, int *varidp)
+NCP_inq_varid(int ncid, const char *name, int *varidp)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -535,7 +535,7 @@ NC5_inq_varid(int ncid, const char *name, int *varidp)
}
static int
-NC5_rename_var(int ncid, int varid, const char *name)
+NCP_rename_var(int ncid, int varid, const char *name)
{
NC* nc;
int status = NC_check_id(ncid, &nc);
@@ -544,7 +544,7 @@ NC5_rename_var(int ncid, int varid, const char *name)
}
static int
-NC5_get_vara(int ncid,
+NCP_get_vara(int ncid,
int varid,
const size_t* startp,
const size_t* countp,
@@ -552,7 +552,7 @@ NC5_get_vara(int ncid,
nc_type memtype)
{
NC* nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
int status;
MPI_Offset mpi_start[NC_MAX_VAR_DIMS], mpi_count[NC_MAX_VAR_DIMS];
int d;
@@ -561,8 +561,8 @@ NC5_get_vara(int ncid,
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) return status;
- nc5 = NC5_DATA(nc);
- assert(nc5);
+ ncp = NCP_DATA(nc);
+ assert(ncp);
/* get variable's rank */
status= ncmpi_inq_varndims(nc->int_ncid, varid, &rank);
@@ -574,7 +574,7 @@ NC5_get_vara(int ncid,
mpi_count[d] = countp[d];
}
- if(nc5->pnetcdf_access_mode == NC_INDEPENDENT) {
+ if(ncp->pnetcdf_access_mode == NC_INDEPENDENT) {
switch(memtype) {
case NC_BYTE:
status=ncmpi_get_vara_schar(nc->int_ncid, varid, mpi_start, mpi_count, ip); break;
@@ -621,7 +621,7 @@ NC5_get_vara(int ncid,
}
static int
-NC5_put_vara(int ncid,
+NCP_put_vara(int ncid,
int varid,
const size_t* startp,
const size_t* countp,
@@ -629,7 +629,7 @@ NC5_put_vara(int ncid,
nc_type memtype)
{
NC* nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
int status;
MPI_Offset mpi_start[NC_MAX_VAR_DIMS], mpi_count[NC_MAX_VAR_DIMS];
int d;
@@ -638,8 +638,8 @@ NC5_put_vara(int ncid,
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) return status;
- nc5 = NC5_DATA(nc);
- assert(nc5);
+ ncp = NCP_DATA(nc);
+ assert(ncp);
/* get variable's rank */
status = ncmpi_inq_varndims(nc->int_ncid, varid, &rank);
@@ -651,7 +651,7 @@ NC5_put_vara(int ncid,
mpi_count[d] = countp[d];
}
- if(nc5->pnetcdf_access_mode == NC_INDEPENDENT) {
+ if(ncp->pnetcdf_access_mode == NC_INDEPENDENT) {
switch(memtype) {
case NC_BYTE:
status = ncmpi_put_vara_schar(nc->int_ncid, varid, mpi_start, mpi_count, ip); break;
@@ -698,7 +698,7 @@ NC5_put_vara(int ncid,
}
static int
-NC5_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
+NCP_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
int *ndimsp, int *dimidsp, int *nattsp,
int *shufflep, int *deflatep, int *deflate_levelp,
int *fletcher32p, int *contiguousp, size_t *chunksizesp,
@@ -724,10 +724,10 @@ NC5_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
}
static int
-NC5_var_par_access(int ncid, int varid, int par_access)
+NCP_var_par_access(int ncid, int varid, int par_access)
{
NC *nc;
- NC5_INFO* nc5;
+ NCP_INFO* ncp;
int status;
if (par_access != NC_INDEPENDENT && par_access != NC_COLLECTIVE)
@@ -736,12 +736,12 @@ NC5_var_par_access(int ncid, int varid, int par_access)
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR) return status;
- nc5 = NC5_DATA(nc);
- assert(nc5);
+ ncp = NCP_DATA(nc);
+ assert(ncp);
- if(par_access == nc5->pnetcdf_access_mode)
+ if(par_access == ncp->pnetcdf_access_mode)
return NC_NOERR;
- nc5->pnetcdf_access_mode = par_access;
+ ncp->pnetcdf_access_mode = par_access;
if (par_access == NC_INDEPENDENT)
return ncmpi_begin_indep_data(nc->int_ncid);
else
@@ -751,18 +751,18 @@ NC5_var_par_access(int ncid, int varid, int par_access)
#ifdef USE_NETCDF4
static int
-NC5_show_metadata(int ncid)
+NCP_show_metadata(int ncid)
{
return NC_NOERR;
}
static int
-NC5_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp)
+NCP_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp)
{
int retval;
int unlimid;
- if((retval = NC5_inq_unlimdim(ncid, &unlimid)))
+ if((retval = NCP_inq_unlimdim(ncid, &unlimid)))
return retval;
if(unlimid != -1) {
if(ndimsp) *ndimsp = 1;
@@ -774,7 +774,7 @@ NC5_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp)
}
static int
-NC5_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int* equalp)
+NCP_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int* equalp)
{
/* Check input. */
if(equalp == NULL) return NC_NOERR;
@@ -805,26 +805,26 @@ NC5_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int*
}
static int
-NC5_def_grp(int parent_ncid, const char *name, int *new_ncid)
+NCP_def_grp(int parent_ncid, const char *name, int *new_ncid)
{
return NC_ENOTNC4;
}
static int
-NC5_rename_grp(int ncid, const char *name)
+NCP_rename_grp(int ncid, const char *name)
{
return NC_ENOTNC4;
}
static int
-NC5_inq_ncid(int ncid, const char *name, int *grp_ncid)
+NCP_inq_ncid(int ncid, const char *name, int *grp_ncid)
{
if(grp_ncid) *grp_ncid = ncid;
return NC_NOERR;
}
static int
-NC5_inq_grps(int ncid, int *numgrps, int *ncids)
+NCP_inq_grps(int ncid, int *numgrps, int *ncids)
{
if(numgrps)
*numgrps = 0;
@@ -832,7 +832,7 @@ NC5_inq_grps(int ncid, int *numgrps, int *ncids)
}
static int
-NC5_inq_grpname(int ncid, char *name)
+NCP_inq_grpname(int ncid, char *name)
{
if(name)
strcpy(name, "/");
@@ -840,7 +840,7 @@ NC5_inq_grpname(int ncid, char *name)
}
static int
-NC5_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
+NCP_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
{
if(full_name)
strcpy(full_name, "/");
@@ -849,24 +849,24 @@ NC5_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
}
static int
-NC5_inq_grp_parent(int ncid, int *parent_ncid)
+NCP_inq_grp_parent(int ncid, int *parent_ncid)
{
return NC_ENOGRP;
}
static int
-NC5_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
+NCP_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
{
return NC_ENOGRP;
}
static int
-NC5_inq_varids(int ncid, int *nvarsp, int *varids)
+NCP_inq_varids(int ncid, int *nvarsp, int *varids)
{
int retval,v,nvars;
/* This is, effectively, a netcdf-3 file, there is only one group, the root
group, and its vars have ids 0 thru nvars - 1. */
- if((retval = NC5_inq(ncid, NULL, &nvars, NULL, NULL)))
+ if((retval = NCP_inq(ncid, NULL, &nvars, NULL, NULL)))
return retval;
if(nvarsp) *nvarsp = nvars;
if(varids)
@@ -876,12 +876,12 @@ NC5_inq_varids(int ncid, int *nvarsp, int *varids)
}
static int
-NC5_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents)
+NCP_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents)
{
int retval,d,ndims;
/* If this is like a netcdf-3 file, then the dimids are going to be 0
thru ndims-1, so just provide them. */
- if((retval = NC5_inq(ncid, &ndims, NULL, NULL, NULL)))
+ if((retval = NCP_inq(ncid, &ndims, NULL, NULL, NULL)))
return retval;
if(ndimsp) *ndimsp = ndims;
if(dimids)
@@ -891,7 +891,7 @@ NC5_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents)
}
static int
-NC5_inq_typeid(int ncid, const char *name, nc_type *typeidp)
+NCP_inq_typeid(int ncid, const char *name, nc_type *typeidp)
{
int i;
for (i = 0; i <= ATOMICTYPEMAX; i++)
@@ -903,34 +903,34 @@ NC5_inq_typeid(int ncid, const char *name, nc_type *typeidp)
}
static int
-NC5_inq_typeids(int ncid, int *ntypes, int *typeids)
+NCP_inq_typeids(int ncid, int *ntypes, int *typeids)
{
if(ntypes) *ntypes = 0;
return NC_NOERR;
}
static int
-NC5_inq_user_type(int ncid, nc_type typeid, char *name, size_t *size,
+NCP_inq_user_type(int ncid, nc_type typeid, char *name, size_t *size,
nc_type *base_nc_typep, size_t *nfieldsp, int *classp)
{
return NC_ENOTNC4;
}
static int
-NC5_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
+NCP_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
{
return NC_ENOTNC4;
}
static int
-NC5_insert_compound(int ncid, nc_type typeid, const char *name, size_t offset,
+NCP_insert_compound(int ncid, nc_type typeid, const char *name, size_t offset,
nc_type field_typeid)
{
return NC_ENOTNC4;
}
static int
-NC5_insert_array_compound(int ncid, nc_type typeid, const char *name,
+NCP_insert_array_compound(int ncid, nc_type typeid, const char *name,
size_t offset, nc_type field_typeid,
int ndims, const int *dim_sizes)
{
@@ -939,7 +939,7 @@ NC5_insert_array_compound(int ncid, nc_type typeid, const char *name,
static int
-NC5_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name,
+NCP_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name,
size_t *offsetp, nc_type *field_typeidp, int *ndimsp,
int *dim_sizesp)
{
@@ -947,103 +947,103 @@ NC5_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name,
}
static int
-NC5_inq_compound_fieldindex(int ncid, nc_type typeid, const char *name, int *fieldidp)
+NCP_inq_compound_fieldindex(int ncid, nc_type typeid, const char *name, int *fieldidp)
{
return NC_ENOTNC4;
}
static int
-NC5_def_opaque(int ncid, size_t datum_size, const char *name, nc_type* xtypep)
+NCP_def_opaque(int ncid, size_t datum_size, const char *name, nc_type* xtypep)
{
return NC_ENOTNC4;
}
static int
-NC5_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type* xtypep)
+NCP_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type* xtypep)
{
return NC_ENOTNC4;
}
static int
-NC5_def_enum(int ncid, nc_type base_typeid, const char *name,
+NCP_def_enum(int ncid, nc_type base_typeid, const char *name,
nc_type *typeidp)
{
return NC_ENOTNC4;
}
static int
-NC5_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
+NCP_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
{
return NC_ENOTNC4;
}
static int
-NC5_inq_enum_member(int ncid, nc_type typeid, int idx, char *identifier,
+NCP_inq_enum_member(int ncid, nc_type typeid, int idx, char *identifier,
void *value)
{
return NC_ENOTNC4;
}
static int
-NC5_insert_enum(int ncid, nc_type typeid, const char *identifier,
+NCP_insert_enum(int ncid, nc_type typeid, const char *identifier,
const void *value)
{
return NC_ENOTNC4;
}
static int
-NC5_put_vlen_element(int ncid, int typeid, void *vlen_element,
+NCP_put_vlen_element(int ncid, int typeid, void *vlen_element,
size_t len, const void *data)
{
return NC_ENOTNC4;
}
static int
-NC5_get_vlen_element(int ncid, int typeid, const void *vlen_element,
+NCP_get_vlen_element(int ncid, int typeid, const void *vlen_element,
size_t *len, void *data)
{
return NC_ENOTNC4;
}
static int
-NC5_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption)
+NCP_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption)
{
return NC_ENOTNC4;
}
static int
-NC5_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp)
+NCP_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp)
{
return NC_ENOTNC4;
}
static int
-NC5_def_var_deflate(int ncid, int varid, int shuffle, int deflate,
+NCP_def_var_deflate(int ncid, int varid, int shuffle, int deflate,
int deflate_level)
{
return NC_ENOTNC4;
}
static int
-NC5_def_var_fletcher32(int ncid, int varid, int fletcher32)
+NCP_def_var_fletcher32(int ncid, int varid, int fletcher32)
{
return NC_ENOTNC4;
}
static int
-NC5_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp)
+NCP_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp)
{
return NC_ENOTNC4;
}
static int
-NC5_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
+NCP_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
{
return NC_ENOTNC4;
}
static int
-NC5_def_var_endian(int ncid, int varid, int endianness)
+NCP_def_var_endian(int ncid, int varid, int endianness)
{
return NC_ENOTNC4;
}
@@ -1053,103 +1053,103 @@ NC5_def_var_endian(int ncid, int varid, int endianness)
/**************************************************/
/* Pnetcdf Dispatch table */
-NC_Dispatch NC5_dispatcher = {
-
-NC_DISPATCH_NC5,
-
-NC5_create,
-NC5_open,
-
-NC5_redef,
-NC5__enddef,
-NC5_sync,
-NC5_abort,
-NC5_close,
-NC5_set_fill,
-NC5_inq_base_pe,
-NC5_set_base_pe,
-NC5_inq_format,
-NC5_inq_format_extended,
-
-NC5_inq,
-NC5_inq_type,
-
-NC5_def_dim,
-NC5_inq_dimid,
-NC5_inq_dim,
-NC5_inq_unlimdim,
-NC5_rename_dim,
-
-NC5_inq_att,
-NC5_inq_attid,
-NC5_inq_attname,
-NC5_rename_att,
-NC5_del_att,
-NC5_get_att,
-NC5_put_att,
-
-NC5_def_var,
-NC5_inq_varid,
-NC5_rename_var,
-NC5_get_vara,
-NC5_put_vara,
+NC_Dispatch NCP_dispatcher = {
+
+NC_DISPATCH_NCP,
+
+NCP_create,
+NCP_open,
+
+NCP_redef,
+NCP__enddef,
+NCP_sync,
+NCP_abort,
+NCP_close,
+NCP_set_fill,
+NCP_inq_base_pe,
+NCP_set_base_pe,
+NCP_inq_format,
+NCP_inq_format_extended,
+
+NCP_inq,
+NCP_inq_type,
+
+NCP_def_dim,
+NCP_inq_dimid,
+NCP_inq_dim,
+NCP_inq_unlimdim,
+NCP_rename_dim,
+
+NCP_inq_att,
+NCP_inq_attid,
+NCP_inq_attname,
+NCP_rename_att,
+NCP_del_att,
+NCP_get_att,
+NCP_put_att,
+
+NCP_def_var,
+NCP_inq_varid,
+NCP_rename_var,
+NCP_get_vara,
+NCP_put_vara,
NCDEFAULT_get_vars,
NCDEFAULT_put_vars,
NCDEFAULT_get_varm,
NCDEFAULT_put_varm,
-NC5_inq_var_all,
+NCP_inq_var_all,
-NC5_var_par_access,
+NCP_var_par_access,
#ifdef USE_NETCDF4
-NC5_show_metadata,
-NC5_inq_unlimdims,
-
-NC5_inq_ncid,
-NC5_inq_grps,
-NC5_inq_grpname,
-NC5_inq_grpname_full,
-NC5_inq_grp_parent,
-NC5_inq_grp_full_ncid,
-NC5_inq_varids,
-NC5_inq_dimids,
-NC5_inq_typeids,
-NC5_inq_type_equal,
-NC5_def_grp,
-NC5_rename_grp,
-NC5_inq_user_type,
-NC5_inq_typeid,
-
-NC5_def_compound,
-NC5_insert_compound,
-NC5_insert_array_compound,
-NC5_inq_compound_field,
-NC5_inq_compound_fieldindex,
-NC5_def_vlen,
-NC5_put_vlen_element,
-NC5_get_vlen_element,
-NC5_def_enum,
-NC5_insert_enum,
-NC5_inq_enum_member,
-NC5_inq_enum_ident,
-NC5_def_opaque,
-NC5_def_var_deflate,
-NC5_def_var_fletcher32,
-NC5_def_var_chunking,
-NC5_def_var_fill,
-NC5_def_var_endian,
-NC5_set_var_chunk_cache,
-NC5_get_var_chunk_cache,
+NCP_show_metadata,
+NCP_inq_unlimdims,
+
+NCP_inq_ncid,
+NCP_inq_grps,
+NCP_inq_grpname,
+NCP_inq_grpname_full,
+NCP_inq_grp_parent,
+NCP_inq_grp_full_ncid,
+NCP_inq_varids,
+NCP_inq_dimids,
+NCP_inq_typeids,
+NCP_inq_type_equal,
+NCP_def_grp,
+NCP_rename_grp,
+NCP_inq_user_type,
+NCP_inq_typeid,
+
+NCP_def_compound,
+NCP_insert_compound,
+NCP_insert_array_compound,
+NCP_inq_compound_field,
+NCP_inq_compound_fieldindex,
+NCP_def_vlen,
+NCP_put_vlen_element,
+NCP_get_vlen_element,
+NCP_def_enum,
+NCP_insert_enum,
+NCP_inq_enum_member,
+NCP_inq_enum_ident,
+NCP_def_opaque,
+NCP_def_var_deflate,
+NCP_def_var_fletcher32,
+NCP_def_var_chunking,
+NCP_def_var_fill,
+NCP_def_var_endian,
+NCP_set_var_chunk_cache,
+NCP_get_var_chunk_cache,
#endif /*USE_NETCDF4*/
};
-NC_Dispatch* NC5_dispatch_table = NULL; /* moved here from ddispatch.c */
+NC_Dispatch* NCP_dispatch_table = NULL; /* moved here from ddispatch.c */
int
-NC5_initialize(void)
+NCP_initialize(void)
{
- NC5_dispatch_table = &NC5_dispatcher;
+ NCP_dispatch_table = &NCP_dispatcher;
return NC_NOERR;
}
diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt
index 00d4f82..3831cbe 100644
--- a/nc_test/CMakeLists.txt
+++ b/nc_test/CMakeLists.txt
@@ -17,11 +17,10 @@ SET (nc_test_SRC
ADD_EXECUTABLE(nc_test ${nc_test_SRC})
TARGET_LINK_LIBRARIES(nc_test
netcdf
- # util.c explicitly uses libm
${HAVE_LIBM}
)
-# Some extra tests
+# Some extra stand-alone tests
SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta)
IF(NOT HAVE_BASH)
diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am
index 612d1ca..6060034 100644
--- a/nc_test/Makefile.am
+++ b/nc_test/Makefile.am
@@ -12,11 +12,12 @@ CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
tst_*.nc t_nc.nc large_files.nc quick_large_files.nc \
tst_diskless.nc tst_diskless2.nc \
tst_diskless3.nc tst_diskless3_file.cdl tst_diskless3_memory.cdl \
-tst_diskless4.cdl tst_diskless4.nc tst_formatx.nc unlim.nc
+tst_diskless4.cdl tst_diskless4.nc tst_formatx.nc unlim.nc ncx.c
# These are the tests which are always run.
-TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names \
-tst_nofill tst_nofill2 tst_nofill3 tst_atts3 tst_meta
+TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm \
+ tst_names tst_nofill tst_nofill2 tst_nofill3 tst_atts3 \
+ tst_meta
if USE_NETCDF4
TESTPROGRAMS += tst_atts tst_put_vars
@@ -26,17 +27,13 @@ if USE_PNETCDF
TESTPROGRAMS += tst_parallel2 tst_pnetcdf tst_formatx_pnetcdf
endif
-# if EXTRA_TESTS
-# TESTPROGRAMS +=
-# endif # EXTRA_TESTS
-
# These are the source files for the main workhorse test program,
# nc_test. If you pass nc_test, you are doing well.
nc_test_SOURCES = nc_test.c error.c test_get.c test_put.c \
test_read.c test_write.c util.c error.h tests.h
LDADD = ${top_builddir}/liblib/libnetcdf.la
-AM_CPPFLAGS += -I$(top_builddir)/liblib -I$(top_builddir)/include
+AM_CPPFLAGS += -I$(top_builddir)/liblib -I$(top_builddir)/include -I$(top_srcdir)/libsrc
# If the user asked for large file tests, then add them.
if LARGE_FILE_TESTS
@@ -50,7 +47,6 @@ testnc3perf_SOURCES = testnc3perf.c
CLEANFILES += benchmark.nc
endif
-
# Set up the tests.
check_PROGRAMS = $(TESTPROGRAMS)
@@ -94,16 +90,16 @@ endif # USE_VALGRIND_TESTS
EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh \
run_diskless.sh run_diskless2.sh run_mmap.sh run_pnetcdf_test.sh
-
# ref_tst_diskless2.cdl is for diff comparison and to produce tst_diskless2.c
EXTRA_DIST += ref_tst_diskless2.cdl CMakeLists.txt
-#EXTRA_DIST += ${nc_test_SOURCES}
-
# Only clean these on mainatiner-clean, because they require m4 to
# regenerate.
#MAINTAINERCLEANFILES = test_get.c test_put.c
+all:
+ cp $(top_srcdir)/libsrc/ncx.c .
+
# This rule tells make how to turn our .m4 files into .c files.
.m4.c:
m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >$@
diff --git a/nc_test/Makefile.in b/nc_test/Makefile.in
index c964905..058b676 100644
--- a/nc_test/Makefile.in
+++ b/nc_test/Makefile.in
@@ -567,7 +567,8 @@ ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_CPPFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) \
- -I$(top_builddir)/liblib -I$(top_builddir)/include
+ -I$(top_builddir)/liblib -I$(top_builddir)/include \
+ -I$(top_srcdir)/libsrc
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_LDFLAGS =
AR = @AR@
@@ -591,6 +592,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -666,7 +670,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
@@ -739,7 +742,7 @@ CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
tst_diskless.nc tst_diskless2.nc tst_diskless3.nc \
tst_diskless3_file.cdl tst_diskless3_memory.cdl \
tst_diskless4.cdl tst_diskless4.nc tst_formatx.nc unlim.nc \
- $(am__append_7)
+ ncx.c $(am__append_7)
# These are the tests which are always run.
TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names \
@@ -747,10 +750,6 @@ TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names \
$(am__append_3) $(am__append_4) $(am__append_5) \
$(am__append_6)
-# if EXTRA_TESTS
-# TESTPROGRAMS +=
-# endif # EXTRA_TESTS
-
# These are the source files for the main workhorse test program,
# nc_test. If you pass nc_test, you are doing well.
nc_test_SOURCES = nc_test.c error.c test_get.c test_put.c \
@@ -1569,12 +1568,13 @@ uninstall-am:
.PRECIOUS: Makefile
-#EXTRA_DIST += ${nc_test_SOURCES}
-
# Only clean these on mainatiner-clean, because they require m4 to
# regenerate.
#MAINTAINERCLEANFILES = test_get.c test_put.c
+all:
+ cp $(top_srcdir)/libsrc/ncx.c .
+
# This rule tells make how to turn our .m4 files into .c files.
.m4.c:
m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >$@
diff --git a/nc_test/test_get.c b/nc_test/test_get.c
index d22a990..0395438 100644
--- a/nc_test/test_get.c
+++ b/nc_test/test_get.c
@@ -1,6227 +1,12388 @@
+#line 5 "test_get.m4"
/* Do not edit this file. It is produced from the corresponding .m4 source */
+#line 7
/*********************************************************************
* Copyright 1996, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
* $Id: test_get.m4,v 1.16 2005/03/08 03:04:19 ed Exp $
*********************************************************************/
+#line 31
#include "tests.h"
+#line 116
void
+#line 117
test_nc_get_var1_text(void)
+#line 117
{
+#line 117
int ncid;
+#line 117
int i;
+#line 117
int j;
+#line 117
int err;
+#line 117
int nok = 0; /* count of valid comparisons */
+#line 117
size_t index[MAX_RANK];
+#line 117
double expect;
+#line 117
int canConvert; /* Both text or both numeric */
+#line 117
text value;
+#line 117
+#line 117
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 117
IF (err)
+#line 117
error("nc_open: %s", nc_strerror(err));
+#line 117
for (i = 0; i < NVARS; i++) {
+#line 117
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 117
for (j = 0; j < var_rank[i]; j++)
+#line 117
index[j] = 0;
+#line 117
err = nc_get_var1_text(BAD_ID, i, index, &value);
+#line 117
IF (err != NC_EBADID)
+#line 117
error("bad ncid: status = %d", err);
+#line 117
err = nc_get_var1_text(ncid, BAD_VARID, index, &value);
+#line 117
IF (err != NC_ENOTVAR)
+#line 117
error("bad var id: status = %d", err);
+#line 117
for (j = 0; j < var_rank[i]; j++) {
+#line 117
index[j] = var_shape[i][j];
+#line 117
err = nc_get_var1_text(ncid, i, index, &value);
+#line 117
if(!canConvert) {
+#line 117
IF(err != NC_ECHAR)
+#line 117
error("conversion: status = %d", err);
+#line 117
} else IF (err != NC_EINVALCOORDS)
+#line 117
error("bad index: status = %d", err);
+#line 117
index[j] = 0;
+#line 117
}
+#line 117
for (j = 0; j < var_nels[i]; j++) {
+#line 117
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 117
IF (err)
+#line 117
error("error in toMixedBase 1");
+#line 117
expect = hash4( var_type[i], var_rank[i], index, NCT_TEXT );
+#line 117
if (var_rank[i] == 0 && i%2 )
+#line 117
err = nc_get_var1_text(ncid, i, NULL, &value);
+#line 117
else
+#line 117
err = nc_get_var1_text(ncid, i, index, &value);
+#line 117
if (canConvert) {
+#line 117
if (inRange3(expect,var_type[i], NCT_TEXT)) {
+#line 117
if (expect >= text_min && expect <= text_max) {
+#line 117
IF (err) {
+#line 117
error("%s", nc_strerror(err));
+#line 117
} else {
+#line 117
IF (!equal(value,expect,var_type[i],NCT_TEXT)) {
+#line 117
error("expected: %G, got: %G", expect,
+#line 117
(double) value);
+#line 117
} else {
+#line 117
nok++;
+#line 117
}
+#line 117
}
+#line 117
} else {
+#line 117
IF (err != NC_ERANGE)
+#line 117
error("Range error: status = %d", err);
+#line 117
}
+#line 117
} else {
+#line 117
IF (err != 0 && err != NC_ERANGE)
+#line 117
error("OK or Range error: status = %d", err);
+#line 117
}
+#line 117
} else {
+#line 117
IF (err != NC_ECHAR)
+#line 117
error("wrong type: status = %d", err);
+#line 117
}
+#line 117
}
+#line 117
}
+#line 117
err = nc_close(ncid);
+#line 117
IF (err)
+#line 117
error("nc_close: %s", nc_strerror(err));
+#line 117
print_nok(nok);
+#line 117
}
+#line 117
void
+#line 118
test_nc_get_var1_uchar(void)
+#line 118
{
+#line 118
int ncid;
+#line 118
int i;
+#line 118
int j;
+#line 118
int err;
+#line 118
int nok = 0; /* count of valid comparisons */
+#line 118
size_t index[MAX_RANK];
+#line 118
double expect;
+#line 118
int canConvert; /* Both text or both numeric */
+#line 118
uchar value;
+#line 118
+#line 118
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 118
IF (err)
+#line 118
error("nc_open: %s", nc_strerror(err));
+#line 118
for (i = 0; i < NVARS; i++) {
+#line 118
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 118
for (j = 0; j < var_rank[i]; j++)
+#line 118
index[j] = 0;
+#line 118
err = nc_get_var1_uchar(BAD_ID, i, index, &value);
+#line 118
IF (err != NC_EBADID)
+#line 118
error("bad ncid: status = %d", err);
+#line 118
err = nc_get_var1_uchar(ncid, BAD_VARID, index, &value);
+#line 118
IF (err != NC_ENOTVAR)
+#line 118
error("bad var id: status = %d", err);
+#line 118
for (j = 0; j < var_rank[i]; j++) {
+#line 118
index[j] = var_shape[i][j];
+#line 118
err = nc_get_var1_uchar(ncid, i, index, &value);
+#line 118
if(!canConvert) {
+#line 118
IF(err != NC_ECHAR)
+#line 118
error("conversion: status = %d", err);
+#line 118
} else IF (err != NC_EINVALCOORDS)
+#line 118
error("bad index: status = %d", err);
+#line 118
index[j] = 0;
+#line 118
}
+#line 118
for (j = 0; j < var_nels[i]; j++) {
+#line 118
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 118
IF (err)
+#line 118
error("error in toMixedBase 1");
+#line 118
expect = hash4( var_type[i], var_rank[i], index, NCT_UCHAR );
+#line 118
if (var_rank[i] == 0 && i%2 )
+#line 118
err = nc_get_var1_uchar(ncid, i, NULL, &value);
+#line 118
else
+#line 118
err = nc_get_var1_uchar(ncid, i, index, &value);
+#line 118
if (canConvert) {
+#line 118
if (inRange3(expect,var_type[i], NCT_UCHAR)) {
+#line 118
if (expect >= uchar_min && expect <= uchar_max) {
+#line 118
IF (err) {
+#line 118
error("%s", nc_strerror(err));
+#line 118
} else {
+#line 118
IF (!equal(value,expect,var_type[i],NCT_UCHAR)) {
+#line 118
error("expected: %G, got: %G", expect,
+#line 118
(double) value);
+#line 118
} else {
+#line 118
nok++;
+#line 118
}
+#line 118
}
+#line 118
} else {
+#line 118
IF (err != NC_ERANGE)
+#line 118
error("Range error: status = %d", err);
+#line 118
}
+#line 118
} else {
+#line 118
IF (err != 0 && err != NC_ERANGE)
+#line 118
error("OK or Range error: status = %d", err);
+#line 118
}
+#line 118
} else {
+#line 118
IF (err != NC_ECHAR)
+#line 118
error("wrong type: status = %d", err);
+#line 118
}
+#line 118
}
+#line 118
}
+#line 118
err = nc_close(ncid);
+#line 118
IF (err)
+#line 118
error("nc_close: %s", nc_strerror(err));
+#line 118
print_nok(nok);
+#line 118
}
+#line 118
void
+#line 119
test_nc_get_var1_schar(void)
+#line 119
{
+#line 119
int ncid;
+#line 119
int i;
+#line 119
int j;
+#line 119
int err;
+#line 119
int nok = 0; /* count of valid comparisons */
+#line 119
size_t index[MAX_RANK];
+#line 119
double expect;
+#line 119
int canConvert; /* Both text or both numeric */
+#line 119
schar value;
+#line 119
+#line 119
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 119
IF (err)
+#line 119
error("nc_open: %s", nc_strerror(err));
+#line 119
for (i = 0; i < NVARS; i++) {
+#line 119
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 119
for (j = 0; j < var_rank[i]; j++)
+#line 119
index[j] = 0;
+#line 119
err = nc_get_var1_schar(BAD_ID, i, index, &value);
+#line 119
IF (err != NC_EBADID)
+#line 119
error("bad ncid: status = %d", err);
+#line 119
err = nc_get_var1_schar(ncid, BAD_VARID, index, &value);
+#line 119
IF (err != NC_ENOTVAR)
+#line 119
error("bad var id: status = %d", err);
+#line 119
for (j = 0; j < var_rank[i]; j++) {
+#line 119
index[j] = var_shape[i][j];
+#line 119
err = nc_get_var1_schar(ncid, i, index, &value);
+#line 119
if(!canConvert) {
+#line 119
IF(err != NC_ECHAR)
+#line 119
error("conversion: status = %d", err);
+#line 119
} else IF (err != NC_EINVALCOORDS)
+#line 119
error("bad index: status = %d", err);
+#line 119
index[j] = 0;
+#line 119
}
+#line 119
for (j = 0; j < var_nels[i]; j++) {
+#line 119
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 119
IF (err)
+#line 119
error("error in toMixedBase 1");
+#line 119
expect = hash4( var_type[i], var_rank[i], index, NCT_SCHAR );
+#line 119
if (var_rank[i] == 0 && i%2 )
+#line 119
err = nc_get_var1_schar(ncid, i, NULL, &value);
+#line 119
else
+#line 119
err = nc_get_var1_schar(ncid, i, index, &value);
+#line 119
if (canConvert) {
+#line 119
if (inRange3(expect,var_type[i], NCT_SCHAR)) {
+#line 119
if (expect >= schar_min && expect <= schar_max) {
+#line 119
IF (err) {
+#line 119
error("%s", nc_strerror(err));
+#line 119
} else {
+#line 119
IF (!equal(value,expect,var_type[i],NCT_SCHAR)) {
+#line 119
error("expected: %G, got: %G", expect,
+#line 119
(double) value);
+#line 119
} else {
+#line 119
nok++;
+#line 119
}
+#line 119
}
+#line 119
} else {
+#line 119
IF (err != NC_ERANGE)
+#line 119
error("Range error: status = %d", err);
+#line 119
}
+#line 119
} else {
+#line 119
IF (err != 0 && err != NC_ERANGE)
+#line 119
error("OK or Range error: status = %d", err);
+#line 119
}
+#line 119
} else {
+#line 119
IF (err != NC_ECHAR)
+#line 119
error("wrong type: status = %d", err);
+#line 119
}
+#line 119
}
+#line 119
}
+#line 119
err = nc_close(ncid);
+#line 119
IF (err)
+#line 119
error("nc_close: %s", nc_strerror(err));
+#line 119
print_nok(nok);
+#line 119
}
+#line 119
void
+#line 120
test_nc_get_var1_short(void)
+#line 120
{
+#line 120
int ncid;
+#line 120
int i;
+#line 120
int j;
+#line 120
int err;
+#line 120
int nok = 0; /* count of valid comparisons */
+#line 120
size_t index[MAX_RANK];
+#line 120
double expect;
+#line 120
int canConvert; /* Both text or both numeric */
+#line 120
short value;
+#line 120
+#line 120
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 120
IF (err)
+#line 120
error("nc_open: %s", nc_strerror(err));
+#line 120
for (i = 0; i < NVARS; i++) {
+#line 120
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 120
for (j = 0; j < var_rank[i]; j++)
+#line 120
index[j] = 0;
+#line 120
err = nc_get_var1_short(BAD_ID, i, index, &value);
+#line 120
IF (err != NC_EBADID)
+#line 120
error("bad ncid: status = %d", err);
+#line 120
err = nc_get_var1_short(ncid, BAD_VARID, index, &value);
+#line 120
IF (err != NC_ENOTVAR)
+#line 120
error("bad var id: status = %d", err);
+#line 120
for (j = 0; j < var_rank[i]; j++) {
+#line 120
index[j] = var_shape[i][j];
+#line 120
err = nc_get_var1_short(ncid, i, index, &value);
+#line 120
if(!canConvert) {
+#line 120
IF(err != NC_ECHAR)
+#line 120
error("conversion: status = %d", err);
+#line 120
} else IF (err != NC_EINVALCOORDS)
+#line 120
error("bad index: status = %d", err);
+#line 120
index[j] = 0;
+#line 120
}
+#line 120
for (j = 0; j < var_nels[i]; j++) {
+#line 120
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 120
IF (err)
+#line 120
error("error in toMixedBase 1");
+#line 120
expect = hash4( var_type[i], var_rank[i], index, NCT_SHORT );
+#line 120
if (var_rank[i] == 0 && i%2 )
+#line 120
err = nc_get_var1_short(ncid, i, NULL, &value);
+#line 120
else
+#line 120
err = nc_get_var1_short(ncid, i, index, &value);
+#line 120
if (canConvert) {
+#line 120
if (inRange3(expect,var_type[i], NCT_SHORT)) {
+#line 120
if (expect >= short_min && expect <= short_max) {
+#line 120
IF (err) {
+#line 120
error("%s", nc_strerror(err));
+#line 120
} else {
+#line 120
IF (!equal(value,expect,var_type[i],NCT_SHORT)) {
+#line 120
error("expected: %G, got: %G", expect,
+#line 120
(double) value);
+#line 120
} else {
+#line 120
nok++;
+#line 120
}
+#line 120
}
+#line 120
} else {
+#line 120
IF (err != NC_ERANGE)
+#line 120
error("Range error: status = %d", err);
+#line 120
}
+#line 120
} else {
+#line 120
IF (err != 0 && err != NC_ERANGE)
+#line 120
error("OK or Range error: status = %d", err);
+#line 120
}
+#line 120
} else {
+#line 120
IF (err != NC_ECHAR)
+#line 120
error("wrong type: status = %d", err);
+#line 120
}
+#line 120
}
+#line 120
}
+#line 120
err = nc_close(ncid);
+#line 120
IF (err)
+#line 120
error("nc_close: %s", nc_strerror(err));
+#line 120
print_nok(nok);
+#line 120
}
+#line 120
void
+#line 121
test_nc_get_var1_int(void)
+#line 121
{
+#line 121
int ncid;
+#line 121
int i;
+#line 121
int j;
+#line 121
int err;
+#line 121
int nok = 0; /* count of valid comparisons */
+#line 121
size_t index[MAX_RANK];
+#line 121
double expect;
+#line 121
int canConvert; /* Both text or both numeric */
+#line 121
int value;
+#line 121
+#line 121
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 121
IF (err)
+#line 121
error("nc_open: %s", nc_strerror(err));
+#line 121
for (i = 0; i < NVARS; i++) {
+#line 121
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 121
for (j = 0; j < var_rank[i]; j++)
+#line 121
index[j] = 0;
+#line 121
err = nc_get_var1_int(BAD_ID, i, index, &value);
+#line 121
IF (err != NC_EBADID)
+#line 121
error("bad ncid: status = %d", err);
+#line 121
err = nc_get_var1_int(ncid, BAD_VARID, index, &value);
+#line 121
IF (err != NC_ENOTVAR)
+#line 121
error("bad var id: status = %d", err);
+#line 121
for (j = 0; j < var_rank[i]; j++) {
+#line 121
index[j] = var_shape[i][j];
+#line 121
err = nc_get_var1_int(ncid, i, index, &value);
+#line 121
if(!canConvert) {
+#line 121
IF(err != NC_ECHAR)
+#line 121
error("conversion: status = %d", err);
+#line 121
} else IF (err != NC_EINVALCOORDS)
+#line 121
error("bad index: status = %d", err);
+#line 121
index[j] = 0;
+#line 121
}
+#line 121
for (j = 0; j < var_nels[i]; j++) {
+#line 121
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 121
IF (err)
+#line 121
error("error in toMixedBase 1");
+#line 121
expect = hash4( var_type[i], var_rank[i], index, NCT_INT );
+#line 121
if (var_rank[i] == 0 && i%2 )
+#line 121
err = nc_get_var1_int(ncid, i, NULL, &value);
+#line 121
else
+#line 121
err = nc_get_var1_int(ncid, i, index, &value);
+#line 121
if (canConvert) {
+#line 121
if (inRange3(expect,var_type[i], NCT_INT)) {
+#line 121
if (expect >= int_min && expect <= int_max) {
+#line 121
IF (err) {
+#line 121
error("%s", nc_strerror(err));
+#line 121
} else {
+#line 121
IF (!equal(value,expect,var_type[i],NCT_INT)) {
+#line 121
error("expected: %G, got: %G", expect,
+#line 121
(double) value);
+#line 121
} else {
+#line 121
nok++;
+#line 121
}
+#line 121
}
+#line 121
} else {
+#line 121
IF (err != NC_ERANGE)
+#line 121
error("Range error: status = %d", err);
+#line 121
}
+#line 121
} else {
+#line 121
IF (err != 0 && err != NC_ERANGE)
+#line 121
error("OK or Range error: status = %d", err);
+#line 121
}
+#line 121
} else {
+#line 121
IF (err != NC_ECHAR)
+#line 121
error("wrong type: status = %d", err);
+#line 121
}
+#line 121
}
+#line 121
}
+#line 121
err = nc_close(ncid);
+#line 121
IF (err)
+#line 121
error("nc_close: %s", nc_strerror(err));
+#line 121
print_nok(nok);
+#line 121
}
+#line 121
void
+#line 122
test_nc_get_var1_long(void)
+#line 122
{
+#line 122
int ncid;
+#line 122
int i;
+#line 122
int j;
+#line 122
int err;
+#line 122
int nok = 0; /* count of valid comparisons */
+#line 122
size_t index[MAX_RANK];
+#line 122
double expect;
+#line 122
int canConvert; /* Both text or both numeric */
+#line 122
long value;
+#line 122
+#line 122
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 122
IF (err)
+#line 122
error("nc_open: %s", nc_strerror(err));
+#line 122
for (i = 0; i < NVARS; i++) {
+#line 122
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 122
for (j = 0; j < var_rank[i]; j++)
+#line 122
index[j] = 0;
+#line 122
err = nc_get_var1_long(BAD_ID, i, index, &value);
+#line 122
IF (err != NC_EBADID)
+#line 122
error("bad ncid: status = %d", err);
+#line 122
err = nc_get_var1_long(ncid, BAD_VARID, index, &value);
+#line 122
IF (err != NC_ENOTVAR)
+#line 122
error("bad var id: status = %d", err);
+#line 122
for (j = 0; j < var_rank[i]; j++) {
+#line 122
index[j] = var_shape[i][j];
+#line 122
err = nc_get_var1_long(ncid, i, index, &value);
+#line 122
if(!canConvert) {
+#line 122
IF(err != NC_ECHAR)
+#line 122
error("conversion: status = %d", err);
+#line 122
} else IF (err != NC_EINVALCOORDS)
+#line 122
error("bad index: status = %d", err);
+#line 122
index[j] = 0;
+#line 122
}
+#line 122
for (j = 0; j < var_nels[i]; j++) {
+#line 122
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 122
IF (err)
+#line 122
error("error in toMixedBase 1");
+#line 122
expect = hash4( var_type[i], var_rank[i], index, NCT_LONG );
+#line 122
if (var_rank[i] == 0 && i%2 )
+#line 122
err = nc_get_var1_long(ncid, i, NULL, &value);
+#line 122
else
+#line 122
err = nc_get_var1_long(ncid, i, index, &value);
+#line 122
if (canConvert) {
+#line 122
if (inRange3(expect,var_type[i], NCT_LONG)) {
+#line 122
if (expect >= long_min && expect <= long_max) {
+#line 122
IF (err) {
+#line 122
error("%s", nc_strerror(err));
+#line 122
} else {
+#line 122
IF (!equal(value,expect,var_type[i],NCT_LONG)) {
+#line 122
error("expected: %G, got: %G", expect,
+#line 122
(double) value);
+#line 122
} else {
+#line 122
nok++;
+#line 122
}
+#line 122
}
+#line 122
} else {
+#line 122
IF (err != NC_ERANGE)
+#line 122
error("Range error: status = %d", err);
+#line 122
}
+#line 122
} else {
+#line 122
IF (err != 0 && err != NC_ERANGE)
+#line 122
error("OK or Range error: status = %d", err);
+#line 122
}
+#line 122
} else {
+#line 122
IF (err != NC_ECHAR)
+#line 122
error("wrong type: status = %d", err);
+#line 122
}
+#line 122
}
+#line 122
}
+#line 122
err = nc_close(ncid);
+#line 122
IF (err)
+#line 122
error("nc_close: %s", nc_strerror(err));
+#line 122
print_nok(nok);
+#line 122
}
+#line 122
void
+#line 123
test_nc_get_var1_float(void)
+#line 123
{
+#line 123
int ncid;
+#line 123
int i;
+#line 123
int j;
+#line 123
int err;
+#line 123
int nok = 0; /* count of valid comparisons */
+#line 123
size_t index[MAX_RANK];
+#line 123
double expect;
+#line 123
int canConvert; /* Both text or both numeric */
+#line 123
float value;
+#line 123
+#line 123
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 123
IF (err)
+#line 123
error("nc_open: %s", nc_strerror(err));
+#line 123
for (i = 0; i < NVARS; i++) {
+#line 123
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 123
for (j = 0; j < var_rank[i]; j++)
+#line 123
index[j] = 0;
+#line 123
err = nc_get_var1_float(BAD_ID, i, index, &value);
+#line 123
IF (err != NC_EBADID)
+#line 123
error("bad ncid: status = %d", err);
+#line 123
err = nc_get_var1_float(ncid, BAD_VARID, index, &value);
+#line 123
IF (err != NC_ENOTVAR)
+#line 123
error("bad var id: status = %d", err);
+#line 123
for (j = 0; j < var_rank[i]; j++) {
+#line 123
index[j] = var_shape[i][j];
+#line 123
err = nc_get_var1_float(ncid, i, index, &value);
+#line 123
if(!canConvert) {
+#line 123
IF(err != NC_ECHAR)
+#line 123
error("conversion: status = %d", err);
+#line 123
} else IF (err != NC_EINVALCOORDS)
+#line 123
error("bad index: status = %d", err);
+#line 123
index[j] = 0;
+#line 123
}
+#line 123
for (j = 0; j < var_nels[i]; j++) {
+#line 123
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 123
IF (err)
+#line 123
error("error in toMixedBase 1");
+#line 123
expect = hash4( var_type[i], var_rank[i], index, NCT_FLOAT );
+#line 123
if (var_rank[i] == 0 && i%2 )
+#line 123
err = nc_get_var1_float(ncid, i, NULL, &value);
+#line 123
else
+#line 123
err = nc_get_var1_float(ncid, i, index, &value);
+#line 123
if (canConvert) {
+#line 123
if (inRange3(expect,var_type[i], NCT_FLOAT)) {
+#line 123
if (expect >= float_min && expect <= float_max) {
+#line 123
IF (err) {
+#line 123
error("%s", nc_strerror(err));
+#line 123
} else {
+#line 123
IF (!equal(value,expect,var_type[i],NCT_FLOAT)) {
+#line 123
error("expected: %G, got: %G", expect,
+#line 123
(double) value);
+#line 123
} else {
+#line 123
nok++;
+#line 123
}
+#line 123
}
+#line 123
} else {
+#line 123
IF (err != NC_ERANGE)
+#line 123
error("Range error: status = %d", err);
+#line 123
}
+#line 123
} else {
+#line 123
IF (err != 0 && err != NC_ERANGE)
+#line 123
error("OK or Range error: status = %d", err);
+#line 123
}
+#line 123
} else {
+#line 123
IF (err != NC_ECHAR)
+#line 123
error("wrong type: status = %d", err);
+#line 123
}
+#line 123
}
+#line 123
}
+#line 123
err = nc_close(ncid);
+#line 123
IF (err)
+#line 123
error("nc_close: %s", nc_strerror(err));
+#line 123
print_nok(nok);
+#line 123
}
+#line 123
void
+#line 124
test_nc_get_var1_double(void)
+#line 124
{
+#line 124
int ncid;
+#line 124
int i;
+#line 124
int j;
+#line 124
int err;
+#line 124
int nok = 0; /* count of valid comparisons */
+#line 124
size_t index[MAX_RANK];
+#line 124
double expect;
+#line 124
int canConvert; /* Both text or both numeric */
+#line 124
double value;
+#line 124
+#line 124
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 124
IF (err)
+#line 124
error("nc_open: %s", nc_strerror(err));
+#line 124
for (i = 0; i < NVARS; i++) {
+#line 124
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 124
for (j = 0; j < var_rank[i]; j++)
+#line 124
index[j] = 0;
+#line 124
err = nc_get_var1_double(BAD_ID, i, index, &value);
+#line 124
IF (err != NC_EBADID)
+#line 124
error("bad ncid: status = %d", err);
+#line 124
err = nc_get_var1_double(ncid, BAD_VARID, index, &value);
+#line 124
IF (err != NC_ENOTVAR)
+#line 124
error("bad var id: status = %d", err);
+#line 124
for (j = 0; j < var_rank[i]; j++) {
+#line 124
index[j] = var_shape[i][j];
+#line 124
err = nc_get_var1_double(ncid, i, index, &value);
+#line 124
if(!canConvert) {
+#line 124
IF(err != NC_ECHAR)
+#line 124
error("conversion: status = %d", err);
+#line 124
} else IF (err != NC_EINVALCOORDS)
+#line 124
error("bad index: status = %d", err);
+#line 124
index[j] = 0;
+#line 124
}
+#line 124
for (j = 0; j < var_nels[i]; j++) {
+#line 124
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 124
IF (err)
+#line 124
error("error in toMixedBase 1");
+#line 124
expect = hash4( var_type[i], var_rank[i], index, NCT_DOUBLE );
+#line 124
if (var_rank[i] == 0 && i%2 )
+#line 124
err = nc_get_var1_double(ncid, i, NULL, &value);
+#line 124
else
+#line 124
err = nc_get_var1_double(ncid, i, index, &value);
+#line 124
if (canConvert) {
+#line 124
if (inRange3(expect,var_type[i], NCT_DOUBLE)) {
+#line 124
if (expect >= double_min && expect <= double_max) {
+#line 124
IF (err) {
+#line 124
error("%s", nc_strerror(err));
+#line 124
} else {
+#line 124
IF (!equal(value,expect,var_type[i],NCT_DOUBLE)) {
+#line 124
error("expected: %G, got: %G", expect,
+#line 124
(double) value);
+#line 124
} else {
+#line 124
nok++;
+#line 124
}
+#line 124
}
+#line 124
} else {
+#line 124
IF (err != NC_ERANGE)
+#line 124
error("Range error: status = %d", err);
+#line 124
}
+#line 124
} else {
+#line 124
IF (err != 0 && err != NC_ERANGE)
+#line 124
error("OK or Range error: status = %d", err);
+#line 124
}
+#line 124
} else {
+#line 124
IF (err != NC_ECHAR)
+#line 124
error("wrong type: status = %d", err);
+#line 124
}
+#line 124
}
+#line 124
}
+#line 124
err = nc_close(ncid);
+#line 124
IF (err)
+#line 124
error("nc_close: %s", nc_strerror(err));
+#line 124
print_nok(nok);
+#line 124
}
+#line 124
+#line 221
void
+#line 222
test_nc_get_var_text(void)
+#line 222
{
+#line 222
int ncid;
+#line 222
int i;
+#line 222
int j;
+#line 222
int err;
+#line 222
int allInExtRange; /* all values within external range? */
+#line 222
int allInIntRange; /* all values within internal range? */
+#line 222
int nels;
+#line 222
int nok = 0; /* count of valid comparisons */
+#line 222
size_t index[MAX_RANK];
+#line 222
int canConvert; /* Both text or both numeric */
+#line 222
text value[MAX_NELS];
+#line 222
double expect[MAX_NELS];
+#line 222
+#line 222
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 222
IF (err)
+#line 222
error("nc_open: %s", nc_strerror(err));
+#line 222
for (i = 0; i < NVARS; i++) {
+#line 222
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 222
assert(var_rank[i] <= MAX_RANK);
+#line 222
assert(var_nels[i] <= MAX_NELS);
+#line 222
err = nc_get_var_text(BAD_ID, i, value);
+#line 222
IF (err != NC_EBADID)
+#line 222
error("bad ncid: status = %d", err);
+#line 222
err = nc_get_var_text(ncid, BAD_VARID, value);
+#line 222
IF (err != NC_ENOTVAR)
+#line 222
error("bad var id: status = %d", err);
+#line 222
+#line 222
nels = 1;
+#line 222
for (j = 0; j < var_rank[i]; j++) {
+#line 222
nels *= var_shape[i][j];
+#line 222
}
+#line 222
allInExtRange = allInIntRange = 1;
+#line 222
for (j = 0; j < nels; j++) {
+#line 222
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 222
IF (err)
+#line 222
error("error in toMixedBase 1");
+#line 222
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_TEXT);
+#line 222
if (inRange3(expect[j],var_type[i], NCT_TEXT)) {
+#line 222
allInIntRange = allInIntRange && expect[j] >= text_min
+#line 222
&& expect[j] <= text_max;
+#line 222
} else {
+#line 222
allInExtRange = 0;
+#line 222
}
+#line 222
}
+#line 222
err = nc_get_var_text(ncid, i, value);
+#line 222
if (canConvert) {
+#line 222
if (allInExtRange) {
+#line 222
if (allInIntRange) {
+#line 222
IF (err)
+#line 222
error("%s", nc_strerror(err));
+#line 222
} else {
+#line 222
IF (err != NC_ERANGE)
+#line 222
error("Range error: status = %d", err);
+#line 222
}
+#line 222
} else {
+#line 222
IF (err != 0 && err != NC_ERANGE)
+#line 222
error("OK or Range error: status = %d", err);
+#line 222
}
+#line 222
for (j = 0; j < nels; j++) {
+#line 222
if (inRange3(expect[j],var_type[i],NCT_TEXT)
+#line 222
&& expect[j] >= text_min && expect[j] <= text_max) {
+#line 222
IF (!equal(value[j],expect[j],var_type[i],NCT_TEXT)){
+#line 222
error("value read not that expected");
+#line 222
if (verbose) {
+#line 222
error("\n");
+#line 222
error("varid: %d, ", i);
+#line 222
error("var_name: %s, ", var_name[i]);
+#line 222
error("element number: %d ", j);
+#line 222
error("expect: %g", expect[j]);
+#line 222
error("got: %g", (double) value[j]);
+#line 222
}
+#line 222
} else {
+#line 222
nok++;
+#line 222
}
+#line 222
}
+#line 222
}
+#line 222
} else {
+#line 222
IF (nels > 0 && err != NC_ECHAR)
+#line 222
error("wrong type: status = %d", err);
+#line 222
}
+#line 222
}
+#line 222
err = nc_close(ncid);
+#line 222
IF (err)
+#line 222
error("nc_close: %s", nc_strerror(err));
+#line 222
print_nok(nok);
+#line 222
}
+#line 222
void
+#line 223
test_nc_get_var_uchar(void)
+#line 223
{
+#line 223
int ncid;
+#line 223
int i;
+#line 223
int j;
+#line 223
int err;
+#line 223
int allInExtRange; /* all values within external range? */
+#line 223
int allInIntRange; /* all values within internal range? */
+#line 223
int nels;
+#line 223
int nok = 0; /* count of valid comparisons */
+#line 223
size_t index[MAX_RANK];
+#line 223
int canConvert; /* Both text or both numeric */
+#line 223
uchar value[MAX_NELS];
+#line 223
double expect[MAX_NELS];
+#line 223
+#line 223
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 223
IF (err)
+#line 223
error("nc_open: %s", nc_strerror(err));
+#line 223
for (i = 0; i < NVARS; i++) {
+#line 223
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 223
assert(var_rank[i] <= MAX_RANK);
+#line 223
assert(var_nels[i] <= MAX_NELS);
+#line 223
err = nc_get_var_uchar(BAD_ID, i, value);
+#line 223
IF (err != NC_EBADID)
+#line 223
error("bad ncid: status = %d", err);
+#line 223
err = nc_get_var_uchar(ncid, BAD_VARID, value);
+#line 223
IF (err != NC_ENOTVAR)
+#line 223
error("bad var id: status = %d", err);
+#line 223
+#line 223
nels = 1;
+#line 223
for (j = 0; j < var_rank[i]; j++) {
+#line 223
nels *= var_shape[i][j];
+#line 223
}
+#line 223
allInExtRange = allInIntRange = 1;
+#line 223
for (j = 0; j < nels; j++) {
+#line 223
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 223
IF (err)
+#line 223
error("error in toMixedBase 1");
+#line 223
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 223
if (inRange3(expect[j],var_type[i], NCT_UCHAR)) {
+#line 223
allInIntRange = allInIntRange && expect[j] >= uchar_min
+#line 223
&& expect[j] <= uchar_max;
+#line 223
} else {
+#line 223
allInExtRange = 0;
+#line 223
}
+#line 223
}
+#line 223
err = nc_get_var_uchar(ncid, i, value);
+#line 223
if (canConvert) {
+#line 223
if (allInExtRange) {
+#line 223
if (allInIntRange) {
+#line 223
IF (err)
+#line 223
error("%s", nc_strerror(err));
+#line 223
} else {
+#line 223
IF (err != NC_ERANGE)
+#line 223
error("Range error: status = %d", err);
+#line 223
}
+#line 223
} else {
+#line 223
IF (err != 0 && err != NC_ERANGE)
+#line 223
error("OK or Range error: status = %d", err);
+#line 223
}
+#line 223
for (j = 0; j < nels; j++) {
+#line 223
if (inRange3(expect[j],var_type[i],NCT_UCHAR)
+#line 223
&& expect[j] >= uchar_min && expect[j] <= uchar_max) {
+#line 223
IF (!equal(value[j],expect[j],var_type[i],NCT_UCHAR)){
+#line 223
error("value read not that expected");
+#line 223
if (verbose) {
+#line 223
error("\n");
+#line 223
error("varid: %d, ", i);
+#line 223
error("var_name: %s, ", var_name[i]);
+#line 223
error("element number: %d ", j);
+#line 223
error("expect: %g", expect[j]);
+#line 223
error("got: %g", (double) value[j]);
+#line 223
}
+#line 223
} else {
+#line 223
nok++;
+#line 223
}
+#line 223
}
+#line 223
}
+#line 223
} else {
+#line 223
IF (nels > 0 && err != NC_ECHAR)
+#line 223
error("wrong type: status = %d", err);
+#line 223
}
+#line 223
}
+#line 223
err = nc_close(ncid);
+#line 223
IF (err)
+#line 223
error("nc_close: %s", nc_strerror(err));
+#line 223
print_nok(nok);
+#line 223
}
+#line 223
void
+#line 224
test_nc_get_var_schar(void)
+#line 224
{
+#line 224
int ncid;
+#line 224
int i;
+#line 224
int j;
+#line 224
int err;
+#line 224
int allInExtRange; /* all values within external range? */
+#line 224
int allInIntRange; /* all values within internal range? */
+#line 224
int nels;
+#line 224
int nok = 0; /* count of valid comparisons */
+#line 224
size_t index[MAX_RANK];
+#line 224
int canConvert; /* Both text or both numeric */
+#line 224
schar value[MAX_NELS];
+#line 224
double expect[MAX_NELS];
+#line 224
+#line 224
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 224
IF (err)
+#line 224
error("nc_open: %s", nc_strerror(err));
+#line 224
for (i = 0; i < NVARS; i++) {
+#line 224
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 224
assert(var_rank[i] <= MAX_RANK);
+#line 224
assert(var_nels[i] <= MAX_NELS);
+#line 224
err = nc_get_var_schar(BAD_ID, i, value);
+#line 224
IF (err != NC_EBADID)
+#line 224
error("bad ncid: status = %d", err);
+#line 224
err = nc_get_var_schar(ncid, BAD_VARID, value);
+#line 224
IF (err != NC_ENOTVAR)
+#line 224
error("bad var id: status = %d", err);
+#line 224
+#line 224
nels = 1;
+#line 224
for (j = 0; j < var_rank[i]; j++) {
+#line 224
nels *= var_shape[i][j];
+#line 224
}
+#line 224
allInExtRange = allInIntRange = 1;
+#line 224
for (j = 0; j < nels; j++) {
+#line 224
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 224
IF (err)
+#line 224
error("error in toMixedBase 1");
+#line 224
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 224
if (inRange3(expect[j],var_type[i], NCT_SCHAR)) {
+#line 224
allInIntRange = allInIntRange && expect[j] >= schar_min
+#line 224
&& expect[j] <= schar_max;
+#line 224
} else {
+#line 224
allInExtRange = 0;
+#line 224
}
+#line 224
}
+#line 224
err = nc_get_var_schar(ncid, i, value);
+#line 224
if (canConvert) {
+#line 224
if (allInExtRange) {
+#line 224
if (allInIntRange) {
+#line 224
IF (err)
+#line 224
error("%s", nc_strerror(err));
+#line 224
} else {
+#line 224
IF (err != NC_ERANGE)
+#line 224
error("Range error: status = %d", err);
+#line 224
}
+#line 224
} else {
+#line 224
IF (err != 0 && err != NC_ERANGE)
+#line 224
error("OK or Range error: status = %d", err);
+#line 224
}
+#line 224
for (j = 0; j < nels; j++) {
+#line 224
if (inRange3(expect[j],var_type[i],NCT_SCHAR)
+#line 224
&& expect[j] >= schar_min && expect[j] <= schar_max) {
+#line 224
IF (!equal(value[j],expect[j],var_type[i],NCT_SCHAR)){
+#line 224
error("value read not that expected");
+#line 224
if (verbose) {
+#line 224
error("\n");
+#line 224
error("varid: %d, ", i);
+#line 224
error("var_name: %s, ", var_name[i]);
+#line 224
error("element number: %d ", j);
+#line 224
error("expect: %g", expect[j]);
+#line 224
error("got: %g", (double) value[j]);
+#line 224
}
+#line 224
} else {
+#line 224
nok++;
+#line 224
}
+#line 224
}
+#line 224
}
+#line 224
} else {
+#line 224
IF (nels > 0 && err != NC_ECHAR)
+#line 224
error("wrong type: status = %d", err);
+#line 224
}
+#line 224
}
+#line 224
err = nc_close(ncid);
+#line 224
IF (err)
+#line 224
error("nc_close: %s", nc_strerror(err));
+#line 224
print_nok(nok);
+#line 224
}
+#line 224
void
+#line 225
test_nc_get_var_short(void)
+#line 225
{
+#line 225
int ncid;
+#line 225
int i;
+#line 225
int j;
+#line 225
int err;
+#line 225
int allInExtRange; /* all values within external range? */
+#line 225
int allInIntRange; /* all values within internal range? */
+#line 225
int nels;
+#line 225
int nok = 0; /* count of valid comparisons */
+#line 225
size_t index[MAX_RANK];
+#line 225
int canConvert; /* Both text or both numeric */
+#line 225
short value[MAX_NELS];
+#line 225
double expect[MAX_NELS];
+#line 225
+#line 225
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 225
IF (err)
+#line 225
error("nc_open: %s", nc_strerror(err));
+#line 225
for (i = 0; i < NVARS; i++) {
+#line 225
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 225
assert(var_rank[i] <= MAX_RANK);
+#line 225
assert(var_nels[i] <= MAX_NELS);
+#line 225
err = nc_get_var_short(BAD_ID, i, value);
+#line 225
IF (err != NC_EBADID)
+#line 225
error("bad ncid: status = %d", err);
+#line 225
err = nc_get_var_short(ncid, BAD_VARID, value);
+#line 225
IF (err != NC_ENOTVAR)
+#line 225
error("bad var id: status = %d", err);
+#line 225
+#line 225
nels = 1;
+#line 225
for (j = 0; j < var_rank[i]; j++) {
+#line 225
nels *= var_shape[i][j];
+#line 225
}
+#line 225
allInExtRange = allInIntRange = 1;
+#line 225
for (j = 0; j < nels; j++) {
+#line 225
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 225
IF (err)
+#line 225
error("error in toMixedBase 1");
+#line 225
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SHORT);
+#line 225
if (inRange3(expect[j],var_type[i], NCT_SHORT)) {
+#line 225
allInIntRange = allInIntRange && expect[j] >= short_min
+#line 225
&& expect[j] <= short_max;
+#line 225
} else {
+#line 225
allInExtRange = 0;
+#line 225
}
+#line 225
}
+#line 225
err = nc_get_var_short(ncid, i, value);
+#line 225
if (canConvert) {
+#line 225
if (allInExtRange) {
+#line 225
if (allInIntRange) {
+#line 225
IF (err)
+#line 225
error("%s", nc_strerror(err));
+#line 225
} else {
+#line 225
IF (err != NC_ERANGE)
+#line 225
error("Range error: status = %d", err);
+#line 225
}
+#line 225
} else {
+#line 225
IF (err != 0 && err != NC_ERANGE)
+#line 225
error("OK or Range error: status = %d", err);
+#line 225
}
+#line 225
for (j = 0; j < nels; j++) {
+#line 225
if (inRange3(expect[j],var_type[i],NCT_SHORT)
+#line 225
&& expect[j] >= short_min && expect[j] <= short_max) {
+#line 225
IF (!equal(value[j],expect[j],var_type[i],NCT_SHORT)){
+#line 225
error("value read not that expected");
+#line 225
if (verbose) {
+#line 225
error("\n");
+#line 225
error("varid: %d, ", i);
+#line 225
error("var_name: %s, ", var_name[i]);
+#line 225
error("element number: %d ", j);
+#line 225
error("expect: %g", expect[j]);
+#line 225
error("got: %g", (double) value[j]);
+#line 225
}
+#line 225
} else {
+#line 225
nok++;
+#line 225
}
+#line 225
}
+#line 225
}
+#line 225
} else {
+#line 225
IF (nels > 0 && err != NC_ECHAR)
+#line 225
error("wrong type: status = %d", err);
+#line 225
}
+#line 225
}
+#line 225
err = nc_close(ncid);
+#line 225
IF (err)
+#line 225
error("nc_close: %s", nc_strerror(err));
+#line 225
print_nok(nok);
+#line 225
}
+#line 225
void
+#line 226
test_nc_get_var_int(void)
+#line 226
{
+#line 226
int ncid;
+#line 226
int i;
+#line 226
int j;
+#line 226
int err;
+#line 226
int allInExtRange; /* all values within external range? */
+#line 226
int allInIntRange; /* all values within internal range? */
+#line 226
int nels;
+#line 226
int nok = 0; /* count of valid comparisons */
+#line 226
size_t index[MAX_RANK];
+#line 226
int canConvert; /* Both text or both numeric */
+#line 226
int value[MAX_NELS];
+#line 226
double expect[MAX_NELS];
+#line 226
+#line 226
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 226
IF (err)
+#line 226
error("nc_open: %s", nc_strerror(err));
+#line 226
for (i = 0; i < NVARS; i++) {
+#line 226
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 226
assert(var_rank[i] <= MAX_RANK);
+#line 226
assert(var_nels[i] <= MAX_NELS);
+#line 226
err = nc_get_var_int(BAD_ID, i, value);
+#line 226
IF (err != NC_EBADID)
+#line 226
error("bad ncid: status = %d", err);
+#line 226
err = nc_get_var_int(ncid, BAD_VARID, value);
+#line 226
IF (err != NC_ENOTVAR)
+#line 226
error("bad var id: status = %d", err);
+#line 226
+#line 226
nels = 1;
+#line 226
for (j = 0; j < var_rank[i]; j++) {
+#line 226
nels *= var_shape[i][j];
+#line 226
}
+#line 226
allInExtRange = allInIntRange = 1;
+#line 226
for (j = 0; j < nels; j++) {
+#line 226
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 226
IF (err)
+#line 226
error("error in toMixedBase 1");
+#line 226
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_INT);
+#line 226
if (inRange3(expect[j],var_type[i], NCT_INT)) {
+#line 226
allInIntRange = allInIntRange && expect[j] >= int_min
+#line 226
&& expect[j] <= int_max;
+#line 226
} else {
+#line 226
allInExtRange = 0;
+#line 226
}
+#line 226
}
+#line 226
err = nc_get_var_int(ncid, i, value);
+#line 226
if (canConvert) {
+#line 226
if (allInExtRange) {
+#line 226
if (allInIntRange) {
+#line 226
IF (err)
+#line 226
error("%s", nc_strerror(err));
+#line 226
} else {
+#line 226
IF (err != NC_ERANGE)
+#line 226
error("Range error: status = %d", err);
+#line 226
}
+#line 226
} else {
+#line 226
IF (err != 0 && err != NC_ERANGE)
+#line 226
error("OK or Range error: status = %d", err);
+#line 226
}
+#line 226
for (j = 0; j < nels; j++) {
+#line 226
if (inRange3(expect[j],var_type[i],NCT_INT)
+#line 226
&& expect[j] >= int_min && expect[j] <= int_max) {
+#line 226
IF (!equal(value[j],expect[j],var_type[i],NCT_INT)){
+#line 226
error("value read not that expected");
+#line 226
if (verbose) {
+#line 226
error("\n");
+#line 226
error("varid: %d, ", i);
+#line 226
error("var_name: %s, ", var_name[i]);
+#line 226
error("element number: %d ", j);
+#line 226
error("expect: %g", expect[j]);
+#line 226
error("got: %g", (double) value[j]);
+#line 226
}
+#line 226
} else {
+#line 226
nok++;
+#line 226
}
+#line 226
}
+#line 226
}
+#line 226
} else {
+#line 226
IF (nels > 0 && err != NC_ECHAR)
+#line 226
error("wrong type: status = %d", err);
+#line 226
}
+#line 226
}
+#line 226
err = nc_close(ncid);
+#line 226
IF (err)
+#line 226
error("nc_close: %s", nc_strerror(err));
+#line 226
print_nok(nok);
+#line 226
}
+#line 226
void
+#line 227
test_nc_get_var_long(void)
+#line 227
{
+#line 227
int ncid;
+#line 227
int i;
+#line 227
int j;
+#line 227
int err;
+#line 227
int allInExtRange; /* all values within external range? */
+#line 227
int allInIntRange; /* all values within internal range? */
+#line 227
int nels;
+#line 227
int nok = 0; /* count of valid comparisons */
+#line 227
size_t index[MAX_RANK];
+#line 227
int canConvert; /* Both text or both numeric */
+#line 227
long value[MAX_NELS];
+#line 227
double expect[MAX_NELS];
+#line 227
+#line 227
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 227
IF (err)
+#line 227
error("nc_open: %s", nc_strerror(err));
+#line 227
for (i = 0; i < NVARS; i++) {
+#line 227
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 227
assert(var_rank[i] <= MAX_RANK);
+#line 227
assert(var_nels[i] <= MAX_NELS);
+#line 227
err = nc_get_var_long(BAD_ID, i, value);
+#line 227
IF (err != NC_EBADID)
+#line 227
error("bad ncid: status = %d", err);
+#line 227
err = nc_get_var_long(ncid, BAD_VARID, value);
+#line 227
IF (err != NC_ENOTVAR)
+#line 227
error("bad var id: status = %d", err);
+#line 227
+#line 227
nels = 1;
+#line 227
for (j = 0; j < var_rank[i]; j++) {
+#line 227
nels *= var_shape[i][j];
+#line 227
}
+#line 227
allInExtRange = allInIntRange = 1;
+#line 227
for (j = 0; j < nels; j++) {
+#line 227
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 227
IF (err)
+#line 227
error("error in toMixedBase 1");
+#line 227
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONG);
+#line 227
if (inRange3(expect[j],var_type[i], NCT_LONG)) {
+#line 227
allInIntRange = allInIntRange && expect[j] >= long_min
+#line 227
&& expect[j] <= long_max;
+#line 227
} else {
+#line 227
allInExtRange = 0;
+#line 227
}
+#line 227
}
+#line 227
err = nc_get_var_long(ncid, i, value);
+#line 227
if (canConvert) {
+#line 227
if (allInExtRange) {
+#line 227
if (allInIntRange) {
+#line 227
IF (err)
+#line 227
error("%s", nc_strerror(err));
+#line 227
} else {
+#line 227
IF (err != NC_ERANGE)
+#line 227
error("Range error: status = %d", err);
+#line 227
}
+#line 227
} else {
+#line 227
IF (err != 0 && err != NC_ERANGE)
+#line 227
error("OK or Range error: status = %d", err);
+#line 227
}
+#line 227
for (j = 0; j < nels; j++) {
+#line 227
if (inRange3(expect[j],var_type[i],NCT_LONG)
+#line 227
&& expect[j] >= long_min && expect[j] <= long_max) {
+#line 227
IF (!equal(value[j],expect[j],var_type[i],NCT_LONG)){
+#line 227
error("value read not that expected");
+#line 227
if (verbose) {
+#line 227
error("\n");
+#line 227
error("varid: %d, ", i);
+#line 227
error("var_name: %s, ", var_name[i]);
+#line 227
error("element number: %d ", j);
+#line 227
error("expect: %g", expect[j]);
+#line 227
error("got: %g", (double) value[j]);
+#line 227
}
+#line 227
} else {
+#line 227
nok++;
+#line 227
}
+#line 227
}
+#line 227
}
+#line 227
} else {
+#line 227
IF (nels > 0 && err != NC_ECHAR)
+#line 227
error("wrong type: status = %d", err);
+#line 227
}
+#line 227
}
+#line 227
err = nc_close(ncid);
+#line 227
IF (err)
+#line 227
error("nc_close: %s", nc_strerror(err));
+#line 227
print_nok(nok);
+#line 227
}
+#line 227
void
+#line 228
test_nc_get_var_float(void)
+#line 228
{
+#line 228
int ncid;
+#line 228
int i;
+#line 228
int j;
+#line 228
int err;
+#line 228
int allInExtRange; /* all values within external range? */
+#line 228
int allInIntRange; /* all values within internal range? */
+#line 228
int nels;
+#line 228
int nok = 0; /* count of valid comparisons */
+#line 228
size_t index[MAX_RANK];
+#line 228
int canConvert; /* Both text or both numeric */
+#line 228
float value[MAX_NELS];
+#line 228
double expect[MAX_NELS];
+#line 228
+#line 228
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 228
IF (err)
+#line 228
error("nc_open: %s", nc_strerror(err));
+#line 228
for (i = 0; i < NVARS; i++) {
+#line 228
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 228
assert(var_rank[i] <= MAX_RANK);
+#line 228
assert(var_nels[i] <= MAX_NELS);
+#line 228
err = nc_get_var_float(BAD_ID, i, value);
+#line 228
IF (err != NC_EBADID)
+#line 228
error("bad ncid: status = %d", err);
+#line 228
err = nc_get_var_float(ncid, BAD_VARID, value);
+#line 228
IF (err != NC_ENOTVAR)
+#line 228
error("bad var id: status = %d", err);
+#line 228
+#line 228
nels = 1;
+#line 228
for (j = 0; j < var_rank[i]; j++) {
+#line 228
nels *= var_shape[i][j];
+#line 228
}
+#line 228
allInExtRange = allInIntRange = 1;
+#line 228
for (j = 0; j < nels; j++) {
+#line 228
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 228
IF (err)
+#line 228
error("error in toMixedBase 1");
+#line 228
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 228
if (inRange3(expect[j],var_type[i], NCT_FLOAT)) {
+#line 228
allInIntRange = allInIntRange && expect[j] >= float_min
+#line 228
&& expect[j] <= float_max;
+#line 228
} else {
+#line 228
allInExtRange = 0;
+#line 228
}
+#line 228
}
+#line 228
err = nc_get_var_float(ncid, i, value);
+#line 228
if (canConvert) {
+#line 228
if (allInExtRange) {
+#line 228
if (allInIntRange) {
+#line 228
IF (err)
+#line 228
error("%s", nc_strerror(err));
+#line 228
} else {
+#line 228
IF (err != NC_ERANGE)
+#line 228
error("Range error: status = %d", err);
+#line 228
}
+#line 228
} else {
+#line 228
IF (err != 0 && err != NC_ERANGE)
+#line 228
error("OK or Range error: status = %d", err);
+#line 228
}
+#line 228
for (j = 0; j < nels; j++) {
+#line 228
if (inRange3(expect[j],var_type[i],NCT_FLOAT)
+#line 228
&& expect[j] >= float_min && expect[j] <= float_max) {
+#line 228
IF (!equal(value[j],expect[j],var_type[i],NCT_FLOAT)){
+#line 228
error("value read not that expected");
+#line 228
if (verbose) {
+#line 228
error("\n");
+#line 228
error("varid: %d, ", i);
+#line 228
error("var_name: %s, ", var_name[i]);
+#line 228
error("element number: %d ", j);
+#line 228
error("expect: %g", expect[j]);
+#line 228
error("got: %g", (double) value[j]);
+#line 228
}
+#line 228
} else {
+#line 228
nok++;
+#line 228
}
+#line 228
}
+#line 228
}
+#line 228
} else {
+#line 228
IF (nels > 0 && err != NC_ECHAR)
+#line 228
error("wrong type: status = %d", err);
+#line 228
}
+#line 228
}
+#line 228
err = nc_close(ncid);
+#line 228
IF (err)
+#line 228
error("nc_close: %s", nc_strerror(err));
+#line 228
print_nok(nok);
+#line 228
}
+#line 228
void
+#line 229
test_nc_get_var_double(void)
+#line 229
{
+#line 229
int ncid;
+#line 229
int i;
+#line 229
int j;
+#line 229
int err;
+#line 229
int allInExtRange; /* all values within external range? */
+#line 229
int allInIntRange; /* all values within internal range? */
+#line 229
int nels;
+#line 229
int nok = 0; /* count of valid comparisons */
+#line 229
size_t index[MAX_RANK];
+#line 229
int canConvert; /* Both text or both numeric */
+#line 229
double value[MAX_NELS];
+#line 229
double expect[MAX_NELS];
+#line 229
+#line 229
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 229
IF (err)
+#line 229
error("nc_open: %s", nc_strerror(err));
+#line 229
for (i = 0; i < NVARS; i++) {
+#line 229
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 229
assert(var_rank[i] <= MAX_RANK);
+#line 229
assert(var_nels[i] <= MAX_NELS);
+#line 229
err = nc_get_var_double(BAD_ID, i, value);
+#line 229
IF (err != NC_EBADID)
+#line 229
error("bad ncid: status = %d", err);
+#line 229
err = nc_get_var_double(ncid, BAD_VARID, value);
+#line 229
IF (err != NC_ENOTVAR)
+#line 229
error("bad var id: status = %d", err);
+#line 229
+#line 229
nels = 1;
+#line 229
for (j = 0; j < var_rank[i]; j++) {
+#line 229
nels *= var_shape[i][j];
+#line 229
}
+#line 229
allInExtRange = allInIntRange = 1;
+#line 229
for (j = 0; j < nels; j++) {
+#line 229
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 229
IF (err)
+#line 229
error("error in toMixedBase 1");
+#line 229
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 229
if (inRange3(expect[j],var_type[i], NCT_DOUBLE)) {
+#line 229
allInIntRange = allInIntRange && expect[j] >= double_min
+#line 229
&& expect[j] <= double_max;
+#line 229
} else {
+#line 229
allInExtRange = 0;
+#line 229
}
+#line 229
}
+#line 229
err = nc_get_var_double(ncid, i, value);
+#line 229
if (canConvert) {
+#line 229
if (allInExtRange) {
+#line 229
if (allInIntRange) {
+#line 229
IF (err)
+#line 229
error("%s", nc_strerror(err));
+#line 229
} else {
+#line 229
IF (err != NC_ERANGE)
+#line 229
error("Range error: status = %d", err);
+#line 229
}
+#line 229
} else {
+#line 229
IF (err != 0 && err != NC_ERANGE)
+#line 229
error("OK or Range error: status = %d", err);
+#line 229
}
+#line 229
for (j = 0; j < nels; j++) {
+#line 229
if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
+#line 229
&& expect[j] >= double_min && expect[j] <= double_max) {
+#line 229
IF (!equal(value[j],expect[j],var_type[i],NCT_DOUBLE)){
+#line 229
error("value read not that expected");
+#line 229
if (verbose) {
+#line 229
error("\n");
+#line 229
error("varid: %d, ", i);
+#line 229
error("var_name: %s, ", var_name[i]);
+#line 229
error("element number: %d ", j);
+#line 229
error("expect: %g", expect[j]);
+#line 229
error("got: %g", (double) value[j]);
+#line 229
}
+#line 229
} else {
+#line 229
nok++;
+#line 229
}
+#line 229
}
+#line 229
}
+#line 229
} else {
+#line 229
IF (nels > 0 && err != NC_ECHAR)
+#line 229
error("wrong type: status = %d", err);
+#line 229
}
+#line 229
}
+#line 229
err = nc_close(ncid);
+#line 229
IF (err)
+#line 229
error("nc_close: %s", nc_strerror(err));
+#line 229
print_nok(nok);
+#line 229
}
+#line 229
+#line 401
void
+#line 402
test_nc_get_vara_text(void)
+#line 402
{
+#line 402
int ncid;
+#line 402
int d;
+#line 402
int i;
+#line 402
int j;
+#line 402
int k;
+#line 402
int err;
+#line 402
int allInExtRange; /* all values within external range? */
+#line 402
int allInIntRange; /* all values within internal range? */
+#line 402
int nels;
+#line 402
int nslabs;
+#line 402
int nok = 0; /* count of valid comparisons */
+#line 402
size_t start[MAX_RANK];
+#line 402
size_t edge[MAX_RANK];
+#line 402
size_t index[MAX_RANK];
+#line 402
size_t mid[MAX_RANK];
+#line 402
int canConvert; /* Both text or both numeric */
+#line 402
text value[MAX_NELS];
+#line 402
double expect[MAX_NELS];
+#line 402
+#line 402
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 402
IF (err)
+#line 402
error("nc_open: %s", nc_strerror(err));
+#line 402
for (i = 0; i < NVARS; i++) {
+#line 402
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 402
assert(var_rank[i] <= MAX_RANK);
+#line 402
assert(var_nels[i] <= MAX_NELS);
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
start[j] = 0;
+#line 402
edge[j] = 1;
+#line 402
}
+#line 402
err = nc_get_vara_text(BAD_ID, i, start, edge, value);
+#line 402
IF (err != NC_EBADID)
+#line 402
error("bad ncid: status = %d", err);
+#line 402
err = nc_get_vara_text(ncid, BAD_VARID, start, edge, value);
+#line 402
IF (err != NC_ENOTVAR)
+#line 402
error("bad var id: status = %d", err);
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
start[j] = var_shape[i][j];
+#line 402
err = nc_get_vara_text(ncid, i, start, edge, value);
+#line 402
IF (canConvert && err != NC_EINVALCOORDS)
+#line 402
error("bad index: status = %d", err);
+#line 402
start[j] = 0;
+#line 402
edge[j] = var_shape[i][j] + 1;
+#line 402
err = nc_get_vara_text(ncid, i, start, edge, value);
+#line 402
IF (canConvert && err != NC_EEDGE)
+#line 402
error("bad edge: status = %d", err);
+#line 402
edge[j] = 1;
+#line 402
}
+#line 402
/* Check non-scalars for correct error returned even when */
+#line 402
/* there is nothing to get (edge[j]==0) */
+#line 402
if(var_rank[i] > 0) {
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
edge[j] = 0;
+#line 402
}
+#line 402
err = nc_get_vara_text(BAD_ID, i, start, edge, value);
+#line 402
IF (err != NC_EBADID)
+#line 402
error("bad ncid: status = %d", err);
+#line 402
err = nc_get_vara_text(ncid, BAD_VARID, start, edge, value);
+#line 402
IF (err != NC_ENOTVAR)
+#line 402
error("bad var id: status = %d", err);
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 402
start[j] = var_shape[i][j];
+#line 402
err = nc_get_vara_text(ncid, i, start, edge, value);
+#line 402
IF (canConvert && err != NC_EINVALCOORDS)
+#line 402
error("bad start: status = %d", err);
+#line 402
start[j] = 0;
+#line 402
}
+#line 402
}
+#line 402
err = nc_get_vara_text(ncid, i, start, edge, value);
+#line 402
if (canConvert) {
+#line 402
IF (err)
+#line 402
error("%s", nc_strerror(err));
+#line 402
} else {
+#line 402
IF (err != NC_ECHAR)
+#line 402
error("wrong type: status = %d", err);
+#line 402
}
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
edge[j] = 1;
+#line 402
}
+#line 402
} /* Choose a random point dividing each dim into 2 parts */
+#line 402
/* get 2^rank (nslabs) slabs so defined */
+#line 402
nslabs = 1;
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
mid[j] = roll( var_shape[i][j] );
+#line 402
nslabs *= 2;
+#line 402
}
+#line 402
/* bits of k determine whether to get lower or upper part of dim */
+#line 402
for (k = 0; k < nslabs; k++) {
+#line 402
nels = 1;
+#line 402
for (j = 0; j < var_rank[i]; j++) {
+#line 402
if ((k >> j) & 1) {
+#line 402
start[j] = 0;
+#line 402
edge[j] = mid[j];
+#line 402
}else{
+#line 402
start[j] = mid[j];
+#line 402
edge[j] = var_shape[i][j] - mid[j];
+#line 402
}
+#line 402
nels *= edge[j];
+#line 402
}
+#line 402
allInExtRange = allInIntRange = 1;
+#line 402
for (j = 0; j < nels; j++) {
+#line 402
err = toMixedBase(j, var_rank[i], edge, index);
+#line 402
IF (err)
+#line 402
error("error in toMixedBase 1");
+#line 402
for (d = 0; d < var_rank[i]; d++)
+#line 402
index[d] += start[d];
+#line 402
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_TEXT);
+#line 402
if (inRange3(expect[j],var_type[i], NCT_TEXT)) {
+#line 402
allInIntRange = allInIntRange && expect[j] >= text_min
+#line 402
&& expect[j] <= text_max;
+#line 402
} else {
+#line 402
allInExtRange = 0;
+#line 402
}
+#line 402
}
+#line 402
if (var_rank[i] == 0 && i%2)
+#line 402
err = nc_get_vara_text(ncid, i, NULL, NULL, value);
+#line 402
else
+#line 402
err = nc_get_vara_text(ncid, i, start, edge, value);
+#line 402
if (canConvert) {
+#line 402
if (allInExtRange) {
+#line 402
if (allInIntRange) {
+#line 402
IF (err)
+#line 402
error("%s", nc_strerror(err));
+#line 402
} else {
+#line 402
IF (err != NC_ERANGE)
+#line 402
error("Range error: status = %d", err);
+#line 402
}
+#line 402
} else {
+#line 402
IF (err != 0 && err != NC_ERANGE)
+#line 402
error("OK or Range error: status = %d", err);
+#line 402
}
+#line 402
for (j = 0; j < nels; j++) {
+#line 402
if (inRange3(expect[j],var_type[i],NCT_TEXT)
+#line 402
&& expect[j] >= text_min && expect[j] <= text_max) {
+#line 402
IF (!equal(value[j],expect[j],var_type[i],NCT_TEXT)){
+#line 402
error("value read not that expected");
+#line 402
if (verbose) {
+#line 402
error("\n");
+#line 402
error("varid: %d, ", i);
+#line 402
error("var_name: %s, ", var_name[i]);
+#line 402
error("element number: %d ", j);
+#line 402
error("expect: %g", expect[j]);
+#line 402
error("got: %g", (double) value[j]);
+#line 402
}
+#line 402
} else {
+#line 402
nok++;
+#line 402
}
+#line 402
}
+#line 402
}
+#line 402
} else {
+#line 402
IF (nels > 0 && err != NC_ECHAR)
+#line 402
error("wrong type: status = %d", err);
+#line 402
}
+#line 402
}
+#line 402
}
+#line 402
err = nc_close(ncid);
+#line 402
IF (err)
+#line 402
error("nc_close: %s", nc_strerror(err));
+#line 402
print_nok(nok);
+#line 402
}
+#line 402
void
+#line 403
test_nc_get_vara_uchar(void)
+#line 403
{
+#line 403
int ncid;
+#line 403
int d;
+#line 403
int i;
+#line 403
int j;
+#line 403
int k;
+#line 403
int err;
+#line 403
int allInExtRange; /* all values within external range? */
+#line 403
int allInIntRange; /* all values within internal range? */
+#line 403
int nels;
+#line 403
int nslabs;
+#line 403
int nok = 0; /* count of valid comparisons */
+#line 403
size_t start[MAX_RANK];
+#line 403
size_t edge[MAX_RANK];
+#line 403
size_t index[MAX_RANK];
+#line 403
size_t mid[MAX_RANK];
+#line 403
int canConvert; /* Both text or both numeric */
+#line 403
uchar value[MAX_NELS];
+#line 403
double expect[MAX_NELS];
+#line 403
+#line 403
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 403
IF (err)
+#line 403
error("nc_open: %s", nc_strerror(err));
+#line 403
for (i = 0; i < NVARS; i++) {
+#line 403
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 403
assert(var_rank[i] <= MAX_RANK);
+#line 403
assert(var_nels[i] <= MAX_NELS);
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
start[j] = 0;
+#line 403
edge[j] = 1;
+#line 403
}
+#line 403
err = nc_get_vara_uchar(BAD_ID, i, start, edge, value);
+#line 403
IF (err != NC_EBADID)
+#line 403
error("bad ncid: status = %d", err);
+#line 403
err = nc_get_vara_uchar(ncid, BAD_VARID, start, edge, value);
+#line 403
IF (err != NC_ENOTVAR)
+#line 403
error("bad var id: status = %d", err);
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
start[j] = var_shape[i][j];
+#line 403
err = nc_get_vara_uchar(ncid, i, start, edge, value);
+#line 403
IF (canConvert && err != NC_EINVALCOORDS)
+#line 403
error("bad index: status = %d", err);
+#line 403
start[j] = 0;
+#line 403
edge[j] = var_shape[i][j] + 1;
+#line 403
err = nc_get_vara_uchar(ncid, i, start, edge, value);
+#line 403
IF (canConvert && err != NC_EEDGE)
+#line 403
error("bad edge: status = %d", err);
+#line 403
edge[j] = 1;
+#line 403
}
+#line 403
/* Check non-scalars for correct error returned even when */
+#line 403
/* there is nothing to get (edge[j]==0) */
+#line 403
if(var_rank[i] > 0) {
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
edge[j] = 0;
+#line 403
}
+#line 403
err = nc_get_vara_uchar(BAD_ID, i, start, edge, value);
+#line 403
IF (err != NC_EBADID)
+#line 403
error("bad ncid: status = %d", err);
+#line 403
err = nc_get_vara_uchar(ncid, BAD_VARID, start, edge, value);
+#line 403
IF (err != NC_ENOTVAR)
+#line 403
error("bad var id: status = %d", err);
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 403
start[j] = var_shape[i][j];
+#line 403
err = nc_get_vara_uchar(ncid, i, start, edge, value);
+#line 403
IF (canConvert && err != NC_EINVALCOORDS)
+#line 403
error("bad start: status = %d", err);
+#line 403
start[j] = 0;
+#line 403
}
+#line 403
}
+#line 403
err = nc_get_vara_uchar(ncid, i, start, edge, value);
+#line 403
if (canConvert) {
+#line 403
IF (err)
+#line 403
error("%s", nc_strerror(err));
+#line 403
} else {
+#line 403
IF (err != NC_ECHAR)
+#line 403
error("wrong type: status = %d", err);
+#line 403
}
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
edge[j] = 1;
+#line 403
}
+#line 403
} /* Choose a random point dividing each dim into 2 parts */
+#line 403
/* get 2^rank (nslabs) slabs so defined */
+#line 403
nslabs = 1;
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
mid[j] = roll( var_shape[i][j] );
+#line 403
nslabs *= 2;
+#line 403
}
+#line 403
/* bits of k determine whether to get lower or upper part of dim */
+#line 403
for (k = 0; k < nslabs; k++) {
+#line 403
nels = 1;
+#line 403
for (j = 0; j < var_rank[i]; j++) {
+#line 403
if ((k >> j) & 1) {
+#line 403
start[j] = 0;
+#line 403
edge[j] = mid[j];
+#line 403
}else{
+#line 403
start[j] = mid[j];
+#line 403
edge[j] = var_shape[i][j] - mid[j];
+#line 403
}
+#line 403
nels *= edge[j];
+#line 403
}
+#line 403
allInExtRange = allInIntRange = 1;
+#line 403
for (j = 0; j < nels; j++) {
+#line 403
err = toMixedBase(j, var_rank[i], edge, index);
+#line 403
IF (err)
+#line 403
error("error in toMixedBase 1");
+#line 403
for (d = 0; d < var_rank[i]; d++)
+#line 403
index[d] += start[d];
+#line 403
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 403
if (inRange3(expect[j],var_type[i], NCT_UCHAR)) {
+#line 403
allInIntRange = allInIntRange && expect[j] >= uchar_min
+#line 403
&& expect[j] <= uchar_max;
+#line 403
} else {
+#line 403
allInExtRange = 0;
+#line 403
}
+#line 403
}
+#line 403
if (var_rank[i] == 0 && i%2)
+#line 403
err = nc_get_vara_uchar(ncid, i, NULL, NULL, value);
+#line 403
else
+#line 403
err = nc_get_vara_uchar(ncid, i, start, edge, value);
+#line 403
if (canConvert) {
+#line 403
if (allInExtRange) {
+#line 403
if (allInIntRange) {
+#line 403
IF (err)
+#line 403
error("%s", nc_strerror(err));
+#line 403
} else {
+#line 403
IF (err != NC_ERANGE)
+#line 403
error("Range error: status = %d", err);
+#line 403
}
+#line 403
} else {
+#line 403
IF (err != 0 && err != NC_ERANGE)
+#line 403
error("OK or Range error: status = %d", err);
+#line 403
}
+#line 403
for (j = 0; j < nels; j++) {
+#line 403
if (inRange3(expect[j],var_type[i],NCT_UCHAR)
+#line 403
&& expect[j] >= uchar_min && expect[j] <= uchar_max) {
+#line 403
IF (!equal(value[j],expect[j],var_type[i],NCT_UCHAR)){
+#line 403
error("value read not that expected");
+#line 403
if (verbose) {
+#line 403
error("\n");
+#line 403
error("varid: %d, ", i);
+#line 403
error("var_name: %s, ", var_name[i]);
+#line 403
error("element number: %d ", j);
+#line 403
error("expect: %g", expect[j]);
+#line 403
error("got: %g", (double) value[j]);
+#line 403
}
+#line 403
} else {
+#line 403
nok++;
+#line 403
}
+#line 403
}
+#line 403
}
+#line 403
} else {
+#line 403
IF (nels > 0 && err != NC_ECHAR)
+#line 403
error("wrong type: status = %d", err);
+#line 403
}
+#line 403
}
+#line 403
}
+#line 403
err = nc_close(ncid);
+#line 403
IF (err)
+#line 403
error("nc_close: %s", nc_strerror(err));
+#line 403
print_nok(nok);
+#line 403
}
+#line 403
void
+#line 404
test_nc_get_vara_schar(void)
+#line 404
{
+#line 404
int ncid;
+#line 404
int d;
+#line 404
int i;
+#line 404
int j;
+#line 404
int k;
+#line 404
int err;
+#line 404
int allInExtRange; /* all values within external range? */
+#line 404
int allInIntRange; /* all values within internal range? */
+#line 404
int nels;
+#line 404
int nslabs;
+#line 404
int nok = 0; /* count of valid comparisons */
+#line 404
size_t start[MAX_RANK];
+#line 404
size_t edge[MAX_RANK];
+#line 404
size_t index[MAX_RANK];
+#line 404
size_t mid[MAX_RANK];
+#line 404
int canConvert; /* Both text or both numeric */
+#line 404
schar value[MAX_NELS];
+#line 404
double expect[MAX_NELS];
+#line 404
+#line 404
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 404
IF (err)
+#line 404
error("nc_open: %s", nc_strerror(err));
+#line 404
for (i = 0; i < NVARS; i++) {
+#line 404
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 404
assert(var_rank[i] <= MAX_RANK);
+#line 404
assert(var_nels[i] <= MAX_NELS);
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
start[j] = 0;
+#line 404
edge[j] = 1;
+#line 404
}
+#line 404
err = nc_get_vara_schar(BAD_ID, i, start, edge, value);
+#line 404
IF (err != NC_EBADID)
+#line 404
error("bad ncid: status = %d", err);
+#line 404
err = nc_get_vara_schar(ncid, BAD_VARID, start, edge, value);
+#line 404
IF (err != NC_ENOTVAR)
+#line 404
error("bad var id: status = %d", err);
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
start[j] = var_shape[i][j];
+#line 404
err = nc_get_vara_schar(ncid, i, start, edge, value);
+#line 404
IF (canConvert && err != NC_EINVALCOORDS)
+#line 404
error("bad index: status = %d", err);
+#line 404
start[j] = 0;
+#line 404
edge[j] = var_shape[i][j] + 1;
+#line 404
err = nc_get_vara_schar(ncid, i, start, edge, value);
+#line 404
IF (canConvert && err != NC_EEDGE)
+#line 404
error("bad edge: status = %d", err);
+#line 404
edge[j] = 1;
+#line 404
}
+#line 404
/* Check non-scalars for correct error returned even when */
+#line 404
/* there is nothing to get (edge[j]==0) */
+#line 404
if(var_rank[i] > 0) {
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
edge[j] = 0;
+#line 404
}
+#line 404
err = nc_get_vara_schar(BAD_ID, i, start, edge, value);
+#line 404
IF (err != NC_EBADID)
+#line 404
error("bad ncid: status = %d", err);
+#line 404
err = nc_get_vara_schar(ncid, BAD_VARID, start, edge, value);
+#line 404
IF (err != NC_ENOTVAR)
+#line 404
error("bad var id: status = %d", err);
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 404
start[j] = var_shape[i][j];
+#line 404
err = nc_get_vara_schar(ncid, i, start, edge, value);
+#line 404
IF (canConvert && err != NC_EINVALCOORDS)
+#line 404
error("bad start: status = %d", err);
+#line 404
start[j] = 0;
+#line 404
}
+#line 404
}
+#line 404
err = nc_get_vara_schar(ncid, i, start, edge, value);
+#line 404
if (canConvert) {
+#line 404
IF (err)
+#line 404
error("%s", nc_strerror(err));
+#line 404
} else {
+#line 404
IF (err != NC_ECHAR)
+#line 404
error("wrong type: status = %d", err);
+#line 404
}
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
edge[j] = 1;
+#line 404
}
+#line 404
} /* Choose a random point dividing each dim into 2 parts */
+#line 404
/* get 2^rank (nslabs) slabs so defined */
+#line 404
nslabs = 1;
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
mid[j] = roll( var_shape[i][j] );
+#line 404
nslabs *= 2;
+#line 404
}
+#line 404
/* bits of k determine whether to get lower or upper part of dim */
+#line 404
for (k = 0; k < nslabs; k++) {
+#line 404
nels = 1;
+#line 404
for (j = 0; j < var_rank[i]; j++) {
+#line 404
if ((k >> j) & 1) {
+#line 404
start[j] = 0;
+#line 404
edge[j] = mid[j];
+#line 404
}else{
+#line 404
start[j] = mid[j];
+#line 404
edge[j] = var_shape[i][j] - mid[j];
+#line 404
}
+#line 404
nels *= edge[j];
+#line 404
}
+#line 404
allInExtRange = allInIntRange = 1;
+#line 404
for (j = 0; j < nels; j++) {
+#line 404
err = toMixedBase(j, var_rank[i], edge, index);
+#line 404
IF (err)
+#line 404
error("error in toMixedBase 1");
+#line 404
for (d = 0; d < var_rank[i]; d++)
+#line 404
index[d] += start[d];
+#line 404
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 404
if (inRange3(expect[j],var_type[i], NCT_SCHAR)) {
+#line 404
allInIntRange = allInIntRange && expect[j] >= schar_min
+#line 404
&& expect[j] <= schar_max;
+#line 404
} else {
+#line 404
allInExtRange = 0;
+#line 404
}
+#line 404
}
+#line 404
if (var_rank[i] == 0 && i%2)
+#line 404
err = nc_get_vara_schar(ncid, i, NULL, NULL, value);
+#line 404
else
+#line 404
err = nc_get_vara_schar(ncid, i, start, edge, value);
+#line 404
if (canConvert) {
+#line 404
if (allInExtRange) {
+#line 404
if (allInIntRange) {
+#line 404
IF (err)
+#line 404
error("%s", nc_strerror(err));
+#line 404
} else {
+#line 404
IF (err != NC_ERANGE)
+#line 404
error("Range error: status = %d", err);
+#line 404
}
+#line 404
} else {
+#line 404
IF (err != 0 && err != NC_ERANGE)
+#line 404
error("OK or Range error: status = %d", err);
+#line 404
}
+#line 404
for (j = 0; j < nels; j++) {
+#line 404
if (inRange3(expect[j],var_type[i],NCT_SCHAR)
+#line 404
&& expect[j] >= schar_min && expect[j] <= schar_max) {
+#line 404
IF (!equal(value[j],expect[j],var_type[i],NCT_SCHAR)){
+#line 404
error("value read not that expected");
+#line 404
if (verbose) {
+#line 404
error("\n");
+#line 404
error("varid: %d, ", i);
+#line 404
error("var_name: %s, ", var_name[i]);
+#line 404
error("element number: %d ", j);
+#line 404
error("expect: %g", expect[j]);
+#line 404
error("got: %g", (double) value[j]);
+#line 404
}
+#line 404
} else {
+#line 404
nok++;
+#line 404
}
+#line 404
}
+#line 404
}
+#line 404
} else {
+#line 404
IF (nels > 0 && err != NC_ECHAR)
+#line 404
error("wrong type: status = %d", err);
+#line 404
}
+#line 404
}
+#line 404
}
+#line 404
err = nc_close(ncid);
+#line 404
IF (err)
+#line 404
error("nc_close: %s", nc_strerror(err));
+#line 404
print_nok(nok);
+#line 404
}
+#line 404
void
+#line 405
test_nc_get_vara_short(void)
+#line 405
{
+#line 405
int ncid;
+#line 405
int d;
+#line 405
int i;
+#line 405
int j;
+#line 405
int k;
+#line 405
int err;
+#line 405
int allInExtRange; /* all values within external range? */
+#line 405
int allInIntRange; /* all values within internal range? */
+#line 405
int nels;
+#line 405
int nslabs;
+#line 405
int nok = 0; /* count of valid comparisons */
+#line 405
size_t start[MAX_RANK];
+#line 405
size_t edge[MAX_RANK];
+#line 405
size_t index[MAX_RANK];
+#line 405
size_t mid[MAX_RANK];
+#line 405
int canConvert; /* Both text or both numeric */
+#line 405
short value[MAX_NELS];
+#line 405
double expect[MAX_NELS];
+#line 405
+#line 405
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 405
IF (err)
+#line 405
error("nc_open: %s", nc_strerror(err));
+#line 405
for (i = 0; i < NVARS; i++) {
+#line 405
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 405
assert(var_rank[i] <= MAX_RANK);
+#line 405
assert(var_nels[i] <= MAX_NELS);
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
start[j] = 0;
+#line 405
edge[j] = 1;
+#line 405
}
+#line 405
err = nc_get_vara_short(BAD_ID, i, start, edge, value);
+#line 405
IF (err != NC_EBADID)
+#line 405
error("bad ncid: status = %d", err);
+#line 405
err = nc_get_vara_short(ncid, BAD_VARID, start, edge, value);
+#line 405
IF (err != NC_ENOTVAR)
+#line 405
error("bad var id: status = %d", err);
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
start[j] = var_shape[i][j];
+#line 405
err = nc_get_vara_short(ncid, i, start, edge, value);
+#line 405
IF (canConvert && err != NC_EINVALCOORDS)
+#line 405
error("bad index: status = %d", err);
+#line 405
start[j] = 0;
+#line 405
edge[j] = var_shape[i][j] + 1;
+#line 405
err = nc_get_vara_short(ncid, i, start, edge, value);
+#line 405
IF (canConvert && err != NC_EEDGE)
+#line 405
error("bad edge: status = %d", err);
+#line 405
edge[j] = 1;
+#line 405
}
+#line 405
/* Check non-scalars for correct error returned even when */
+#line 405
/* there is nothing to get (edge[j]==0) */
+#line 405
if(var_rank[i] > 0) {
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
edge[j] = 0;
+#line 405
}
+#line 405
err = nc_get_vara_short(BAD_ID, i, start, edge, value);
+#line 405
IF (err != NC_EBADID)
+#line 405
error("bad ncid: status = %d", err);
+#line 405
err = nc_get_vara_short(ncid, BAD_VARID, start, edge, value);
+#line 405
IF (err != NC_ENOTVAR)
+#line 405
error("bad var id: status = %d", err);
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 405
start[j] = var_shape[i][j];
+#line 405
err = nc_get_vara_short(ncid, i, start, edge, value);
+#line 405
IF (canConvert && err != NC_EINVALCOORDS)
+#line 405
error("bad start: status = %d", err);
+#line 405
start[j] = 0;
+#line 405
}
+#line 405
}
+#line 405
err = nc_get_vara_short(ncid, i, start, edge, value);
+#line 405
if (canConvert) {
+#line 405
IF (err)
+#line 405
error("%s", nc_strerror(err));
+#line 405
} else {
+#line 405
IF (err != NC_ECHAR)
+#line 405
error("wrong type: status = %d", err);
+#line 405
}
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
edge[j] = 1;
+#line 405
}
+#line 405
} /* Choose a random point dividing each dim into 2 parts */
+#line 405
/* get 2^rank (nslabs) slabs so defined */
+#line 405
nslabs = 1;
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
mid[j] = roll( var_shape[i][j] );
+#line 405
nslabs *= 2;
+#line 405
}
+#line 405
/* bits of k determine whether to get lower or upper part of dim */
+#line 405
for (k = 0; k < nslabs; k++) {
+#line 405
nels = 1;
+#line 405
for (j = 0; j < var_rank[i]; j++) {
+#line 405
if ((k >> j) & 1) {
+#line 405
start[j] = 0;
+#line 405
edge[j] = mid[j];
+#line 405
}else{
+#line 405
start[j] = mid[j];
+#line 405
edge[j] = var_shape[i][j] - mid[j];
+#line 405
}
+#line 405
nels *= edge[j];
+#line 405
}
+#line 405
allInExtRange = allInIntRange = 1;
+#line 405
for (j = 0; j < nels; j++) {
+#line 405
err = toMixedBase(j, var_rank[i], edge, index);
+#line 405
IF (err)
+#line 405
error("error in toMixedBase 1");
+#line 405
for (d = 0; d < var_rank[i]; d++)
+#line 405
index[d] += start[d];
+#line 405
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SHORT);
+#line 405
if (inRange3(expect[j],var_type[i], NCT_SHORT)) {
+#line 405
allInIntRange = allInIntRange && expect[j] >= short_min
+#line 405
&& expect[j] <= short_max;
+#line 405
} else {
+#line 405
allInExtRange = 0;
+#line 405
}
+#line 405
}
+#line 405
if (var_rank[i] == 0 && i%2)
+#line 405
err = nc_get_vara_short(ncid, i, NULL, NULL, value);
+#line 405
else
+#line 405
err = nc_get_vara_short(ncid, i, start, edge, value);
+#line 405
if (canConvert) {
+#line 405
if (allInExtRange) {
+#line 405
if (allInIntRange) {
+#line 405
IF (err)
+#line 405
error("%s", nc_strerror(err));
+#line 405
} else {
+#line 405
IF (err != NC_ERANGE)
+#line 405
error("Range error: status = %d", err);
+#line 405
}
+#line 405
} else {
+#line 405
IF (err != 0 && err != NC_ERANGE)
+#line 405
error("OK or Range error: status = %d", err);
+#line 405
}
+#line 405
for (j = 0; j < nels; j++) {
+#line 405
if (inRange3(expect[j],var_type[i],NCT_SHORT)
+#line 405
&& expect[j] >= short_min && expect[j] <= short_max) {
+#line 405
IF (!equal(value[j],expect[j],var_type[i],NCT_SHORT)){
+#line 405
error("value read not that expected");
+#line 405
if (verbose) {
+#line 405
error("\n");
+#line 405
error("varid: %d, ", i);
+#line 405
error("var_name: %s, ", var_name[i]);
+#line 405
error("element number: %d ", j);
+#line 405
error("expect: %g", expect[j]);
+#line 405
error("got: %g", (double) value[j]);
+#line 405
}
+#line 405
} else {
+#line 405
nok++;
+#line 405
}
+#line 405
}
+#line 405
}
+#line 405
} else {
+#line 405
IF (nels > 0 && err != NC_ECHAR)
+#line 405
error("wrong type: status = %d", err);
+#line 405
}
+#line 405
}
+#line 405
}
+#line 405
err = nc_close(ncid);
+#line 405
IF (err)
+#line 405
error("nc_close: %s", nc_strerror(err));
+#line 405
print_nok(nok);
+#line 405
}
+#line 405
void
+#line 406
test_nc_get_vara_int(void)
+#line 406
{
+#line 406
int ncid;
+#line 406
int d;
+#line 406
int i;
+#line 406
int j;
+#line 406
int k;
+#line 406
int err;
+#line 406
int allInExtRange; /* all values within external range? */
+#line 406
int allInIntRange; /* all values within internal range? */
+#line 406
int nels;
+#line 406
int nslabs;
+#line 406
int nok = 0; /* count of valid comparisons */
+#line 406
size_t start[MAX_RANK];
+#line 406
size_t edge[MAX_RANK];
+#line 406
size_t index[MAX_RANK];
+#line 406
size_t mid[MAX_RANK];
+#line 406
int canConvert; /* Both text or both numeric */
+#line 406
int value[MAX_NELS];
+#line 406
double expect[MAX_NELS];
+#line 406
+#line 406
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 406
IF (err)
+#line 406
error("nc_open: %s", nc_strerror(err));
+#line 406
for (i = 0; i < NVARS; i++) {
+#line 406
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 406
assert(var_rank[i] <= MAX_RANK);
+#line 406
assert(var_nels[i] <= MAX_NELS);
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
start[j] = 0;
+#line 406
edge[j] = 1;
+#line 406
}
+#line 406
err = nc_get_vara_int(BAD_ID, i, start, edge, value);
+#line 406
IF (err != NC_EBADID)
+#line 406
error("bad ncid: status = %d", err);
+#line 406
err = nc_get_vara_int(ncid, BAD_VARID, start, edge, value);
+#line 406
IF (err != NC_ENOTVAR)
+#line 406
error("bad var id: status = %d", err);
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
start[j] = var_shape[i][j];
+#line 406
err = nc_get_vara_int(ncid, i, start, edge, value);
+#line 406
IF (canConvert && err != NC_EINVALCOORDS)
+#line 406
error("bad index: status = %d", err);
+#line 406
start[j] = 0;
+#line 406
edge[j] = var_shape[i][j] + 1;
+#line 406
err = nc_get_vara_int(ncid, i, start, edge, value);
+#line 406
IF (canConvert && err != NC_EEDGE)
+#line 406
error("bad edge: status = %d", err);
+#line 406
edge[j] = 1;
+#line 406
}
+#line 406
/* Check non-scalars for correct error returned even when */
+#line 406
/* there is nothing to get (edge[j]==0) */
+#line 406
if(var_rank[i] > 0) {
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
edge[j] = 0;
+#line 406
}
+#line 406
err = nc_get_vara_int(BAD_ID, i, start, edge, value);
+#line 406
IF (err != NC_EBADID)
+#line 406
error("bad ncid: status = %d", err);
+#line 406
err = nc_get_vara_int(ncid, BAD_VARID, start, edge, value);
+#line 406
IF (err != NC_ENOTVAR)
+#line 406
error("bad var id: status = %d", err);
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 406
start[j] = var_shape[i][j];
+#line 406
err = nc_get_vara_int(ncid, i, start, edge, value);
+#line 406
IF (canConvert && err != NC_EINVALCOORDS)
+#line 406
error("bad start: status = %d", err);
+#line 406
start[j] = 0;
+#line 406
}
+#line 406
}
+#line 406
err = nc_get_vara_int(ncid, i, start, edge, value);
+#line 406
if (canConvert) {
+#line 406
IF (err)
+#line 406
error("%s", nc_strerror(err));
+#line 406
} else {
+#line 406
IF (err != NC_ECHAR)
+#line 406
error("wrong type: status = %d", err);
+#line 406
}
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
edge[j] = 1;
+#line 406
}
+#line 406
} /* Choose a random point dividing each dim into 2 parts */
+#line 406
/* get 2^rank (nslabs) slabs so defined */
+#line 406
nslabs = 1;
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
mid[j] = roll( var_shape[i][j] );
+#line 406
nslabs *= 2;
+#line 406
}
+#line 406
/* bits of k determine whether to get lower or upper part of dim */
+#line 406
for (k = 0; k < nslabs; k++) {
+#line 406
nels = 1;
+#line 406
for (j = 0; j < var_rank[i]; j++) {
+#line 406
if ((k >> j) & 1) {
+#line 406
start[j] = 0;
+#line 406
edge[j] = mid[j];
+#line 406
}else{
+#line 406
start[j] = mid[j];
+#line 406
edge[j] = var_shape[i][j] - mid[j];
+#line 406
}
+#line 406
nels *= edge[j];
+#line 406
}
+#line 406
allInExtRange = allInIntRange = 1;
+#line 406
for (j = 0; j < nels; j++) {
+#line 406
err = toMixedBase(j, var_rank[i], edge, index);
+#line 406
IF (err)
+#line 406
error("error in toMixedBase 1");
+#line 406
for (d = 0; d < var_rank[i]; d++)
+#line 406
index[d] += start[d];
+#line 406
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_INT);
+#line 406
if (inRange3(expect[j],var_type[i], NCT_INT)) {
+#line 406
allInIntRange = allInIntRange && expect[j] >= int_min
+#line 406
&& expect[j] <= int_max;
+#line 406
} else {
+#line 406
allInExtRange = 0;
+#line 406
}
+#line 406
}
+#line 406
if (var_rank[i] == 0 && i%2)
+#line 406
err = nc_get_vara_int(ncid, i, NULL, NULL, value);
+#line 406
else
+#line 406
err = nc_get_vara_int(ncid, i, start, edge, value);
+#line 406
if (canConvert) {
+#line 406
if (allInExtRange) {
+#line 406
if (allInIntRange) {
+#line 406
IF (err)
+#line 406
error("%s", nc_strerror(err));
+#line 406
} else {
+#line 406
IF (err != NC_ERANGE)
+#line 406
error("Range error: status = %d", err);
+#line 406
}
+#line 406
} else {
+#line 406
IF (err != 0 && err != NC_ERANGE)
+#line 406
error("OK or Range error: status = %d", err);
+#line 406
}
+#line 406
for (j = 0; j < nels; j++) {
+#line 406
if (inRange3(expect[j],var_type[i],NCT_INT)
+#line 406
&& expect[j] >= int_min && expect[j] <= int_max) {
+#line 406
IF (!equal(value[j],expect[j],var_type[i],NCT_INT)){
+#line 406
error("value read not that expected");
+#line 406
if (verbose) {
+#line 406
error("\n");
+#line 406
error("varid: %d, ", i);
+#line 406
error("var_name: %s, ", var_name[i]);
+#line 406
error("element number: %d ", j);
+#line 406
error("expect: %g", expect[j]);
+#line 406
error("got: %g", (double) value[j]);
+#line 406
}
+#line 406
} else {
+#line 406
nok++;
+#line 406
}
+#line 406
}
+#line 406
}
+#line 406
} else {
+#line 406
IF (nels > 0 && err != NC_ECHAR)
+#line 406
error("wrong type: status = %d", err);
+#line 406
}
+#line 406
}
+#line 406
}
+#line 406
err = nc_close(ncid);
+#line 406
IF (err)
+#line 406
error("nc_close: %s", nc_strerror(err));
+#line 406
print_nok(nok);
+#line 406
}
+#line 406
void
+#line 407
test_nc_get_vara_long(void)
+#line 407
{
+#line 407
int ncid;
+#line 407
int d;
+#line 407
int i;
+#line 407
int j;
+#line 407
int k;
+#line 407
int err;
+#line 407
int allInExtRange; /* all values within external range? */
+#line 407
int allInIntRange; /* all values within internal range? */
+#line 407
int nels;
+#line 407
int nslabs;
+#line 407
int nok = 0; /* count of valid comparisons */
+#line 407
size_t start[MAX_RANK];
+#line 407
size_t edge[MAX_RANK];
+#line 407
size_t index[MAX_RANK];
+#line 407
size_t mid[MAX_RANK];
+#line 407
int canConvert; /* Both text or both numeric */
+#line 407
long value[MAX_NELS];
+#line 407
double expect[MAX_NELS];
+#line 407
+#line 407
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 407
IF (err)
+#line 407
error("nc_open: %s", nc_strerror(err));
+#line 407
for (i = 0; i < NVARS; i++) {
+#line 407
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 407
assert(var_rank[i] <= MAX_RANK);
+#line 407
assert(var_nels[i] <= MAX_NELS);
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
start[j] = 0;
+#line 407
edge[j] = 1;
+#line 407
}
+#line 407
err = nc_get_vara_long(BAD_ID, i, start, edge, value);
+#line 407
IF (err != NC_EBADID)
+#line 407
error("bad ncid: status = %d", err);
+#line 407
err = nc_get_vara_long(ncid, BAD_VARID, start, edge, value);
+#line 407
IF (err != NC_ENOTVAR)
+#line 407
error("bad var id: status = %d", err);
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
start[j] = var_shape[i][j];
+#line 407
err = nc_get_vara_long(ncid, i, start, edge, value);
+#line 407
IF (canConvert && err != NC_EINVALCOORDS)
+#line 407
error("bad index: status = %d", err);
+#line 407
start[j] = 0;
+#line 407
edge[j] = var_shape[i][j] + 1;
+#line 407
err = nc_get_vara_long(ncid, i, start, edge, value);
+#line 407
IF (canConvert && err != NC_EEDGE)
+#line 407
error("bad edge: status = %d", err);
+#line 407
edge[j] = 1;
+#line 407
}
+#line 407
/* Check non-scalars for correct error returned even when */
+#line 407
/* there is nothing to get (edge[j]==0) */
+#line 407
if(var_rank[i] > 0) {
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
edge[j] = 0;
+#line 407
}
+#line 407
err = nc_get_vara_long(BAD_ID, i, start, edge, value);
+#line 407
IF (err != NC_EBADID)
+#line 407
error("bad ncid: status = %d", err);
+#line 407
err = nc_get_vara_long(ncid, BAD_VARID, start, edge, value);
+#line 407
IF (err != NC_ENOTVAR)
+#line 407
error("bad var id: status = %d", err);
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 407
start[j] = var_shape[i][j];
+#line 407
err = nc_get_vara_long(ncid, i, start, edge, value);
+#line 407
IF (canConvert && err != NC_EINVALCOORDS)
+#line 407
error("bad start: status = %d", err);
+#line 407
start[j] = 0;
+#line 407
}
+#line 407
}
+#line 407
err = nc_get_vara_long(ncid, i, start, edge, value);
+#line 407
if (canConvert) {
+#line 407
IF (err)
+#line 407
error("%s", nc_strerror(err));
+#line 407
} else {
+#line 407
IF (err != NC_ECHAR)
+#line 407
error("wrong type: status = %d", err);
+#line 407
}
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
edge[j] = 1;
+#line 407
}
+#line 407
} /* Choose a random point dividing each dim into 2 parts */
+#line 407
/* get 2^rank (nslabs) slabs so defined */
+#line 407
nslabs = 1;
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
mid[j] = roll( var_shape[i][j] );
+#line 407
nslabs *= 2;
+#line 407
}
+#line 407
/* bits of k determine whether to get lower or upper part of dim */
+#line 407
for (k = 0; k < nslabs; k++) {
+#line 407
nels = 1;
+#line 407
for (j = 0; j < var_rank[i]; j++) {
+#line 407
if ((k >> j) & 1) {
+#line 407
start[j] = 0;
+#line 407
edge[j] = mid[j];
+#line 407
}else{
+#line 407
start[j] = mid[j];
+#line 407
edge[j] = var_shape[i][j] - mid[j];
+#line 407
}
+#line 407
nels *= edge[j];
+#line 407
}
+#line 407
allInExtRange = allInIntRange = 1;
+#line 407
for (j = 0; j < nels; j++) {
+#line 407
err = toMixedBase(j, var_rank[i], edge, index);
+#line 407
IF (err)
+#line 407
error("error in toMixedBase 1");
+#line 407
for (d = 0; d < var_rank[i]; d++)
+#line 407
index[d] += start[d];
+#line 407
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONG);
+#line 407
if (inRange3(expect[j],var_type[i], NCT_LONG)) {
+#line 407
allInIntRange = allInIntRange && expect[j] >= long_min
+#line 407
&& expect[j] <= long_max;
+#line 407
} else {
+#line 407
allInExtRange = 0;
+#line 407
}
+#line 407
}
+#line 407
if (var_rank[i] == 0 && i%2)
+#line 407
err = nc_get_vara_long(ncid, i, NULL, NULL, value);
+#line 407
else
+#line 407
err = nc_get_vara_long(ncid, i, start, edge, value);
+#line 407
if (canConvert) {
+#line 407
if (allInExtRange) {
+#line 407
if (allInIntRange) {
+#line 407
IF (err)
+#line 407
error("%s", nc_strerror(err));
+#line 407
} else {
+#line 407
IF (err != NC_ERANGE)
+#line 407
error("Range error: status = %d", err);
+#line 407
}
+#line 407
} else {
+#line 407
IF (err != 0 && err != NC_ERANGE)
+#line 407
error("OK or Range error: status = %d", err);
+#line 407
}
+#line 407
for (j = 0; j < nels; j++) {
+#line 407
if (inRange3(expect[j],var_type[i],NCT_LONG)
+#line 407
&& expect[j] >= long_min && expect[j] <= long_max) {
+#line 407
IF (!equal(value[j],expect[j],var_type[i],NCT_LONG)){
+#line 407
error("value read not that expected");
+#line 407
if (verbose) {
+#line 407
error("\n");
+#line 407
error("varid: %d, ", i);
+#line 407
error("var_name: %s, ", var_name[i]);
+#line 407
error("element number: %d ", j);
+#line 407
error("expect: %g", expect[j]);
+#line 407
error("got: %g", (double) value[j]);
+#line 407
}
+#line 407
} else {
+#line 407
nok++;
+#line 407
}
+#line 407
}
+#line 407
}
+#line 407
} else {
+#line 407
IF (nels > 0 && err != NC_ECHAR)
+#line 407
error("wrong type: status = %d", err);
+#line 407
}
+#line 407
}
+#line 407
}
+#line 407
err = nc_close(ncid);
+#line 407
IF (err)
+#line 407
error("nc_close: %s", nc_strerror(err));
+#line 407
print_nok(nok);
+#line 407
}
+#line 407
void
+#line 408
test_nc_get_vara_float(void)
+#line 408
{
+#line 408
int ncid;
+#line 408
int d;
+#line 408
int i;
+#line 408
int j;
+#line 408
int k;
+#line 408
int err;
+#line 408
int allInExtRange; /* all values within external range? */
+#line 408
int allInIntRange; /* all values within internal range? */
+#line 408
int nels;
+#line 408
int nslabs;
+#line 408
int nok = 0; /* count of valid comparisons */
+#line 408
size_t start[MAX_RANK];
+#line 408
size_t edge[MAX_RANK];
+#line 408
size_t index[MAX_RANK];
+#line 408
size_t mid[MAX_RANK];
+#line 408
int canConvert; /* Both text or both numeric */
+#line 408
float value[MAX_NELS];
+#line 408
double expect[MAX_NELS];
+#line 408
+#line 408
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 408
IF (err)
+#line 408
error("nc_open: %s", nc_strerror(err));
+#line 408
for (i = 0; i < NVARS; i++) {
+#line 408
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 408
assert(var_rank[i] <= MAX_RANK);
+#line 408
assert(var_nels[i] <= MAX_NELS);
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
start[j] = 0;
+#line 408
edge[j] = 1;
+#line 408
}
+#line 408
err = nc_get_vara_float(BAD_ID, i, start, edge, value);
+#line 408
IF (err != NC_EBADID)
+#line 408
error("bad ncid: status = %d", err);
+#line 408
err = nc_get_vara_float(ncid, BAD_VARID, start, edge, value);
+#line 408
IF (err != NC_ENOTVAR)
+#line 408
error("bad var id: status = %d", err);
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
start[j] = var_shape[i][j];
+#line 408
err = nc_get_vara_float(ncid, i, start, edge, value);
+#line 408
IF (canConvert && err != NC_EINVALCOORDS)
+#line 408
error("bad index: status = %d", err);
+#line 408
start[j] = 0;
+#line 408
edge[j] = var_shape[i][j] + 1;
+#line 408
err = nc_get_vara_float(ncid, i, start, edge, value);
+#line 408
IF (canConvert && err != NC_EEDGE)
+#line 408
error("bad edge: status = %d", err);
+#line 408
edge[j] = 1;
+#line 408
}
+#line 408
/* Check non-scalars for correct error returned even when */
+#line 408
/* there is nothing to get (edge[j]==0) */
+#line 408
if(var_rank[i] > 0) {
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
edge[j] = 0;
+#line 408
}
+#line 408
err = nc_get_vara_float(BAD_ID, i, start, edge, value);
+#line 408
IF (err != NC_EBADID)
+#line 408
error("bad ncid: status = %d", err);
+#line 408
err = nc_get_vara_float(ncid, BAD_VARID, start, edge, value);
+#line 408
IF (err != NC_ENOTVAR)
+#line 408
error("bad var id: status = %d", err);
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 408
start[j] = var_shape[i][j];
+#line 408
err = nc_get_vara_float(ncid, i, start, edge, value);
+#line 408
IF (canConvert && err != NC_EINVALCOORDS)
+#line 408
error("bad start: status = %d", err);
+#line 408
start[j] = 0;
+#line 408
}
+#line 408
}
+#line 408
err = nc_get_vara_float(ncid, i, start, edge, value);
+#line 408
if (canConvert) {
+#line 408
IF (err)
+#line 408
error("%s", nc_strerror(err));
+#line 408
} else {
+#line 408
IF (err != NC_ECHAR)
+#line 408
error("wrong type: status = %d", err);
+#line 408
}
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
edge[j] = 1;
+#line 408
}
+#line 408
} /* Choose a random point dividing each dim into 2 parts */
+#line 408
/* get 2^rank (nslabs) slabs so defined */
+#line 408
nslabs = 1;
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
mid[j] = roll( var_shape[i][j] );
+#line 408
nslabs *= 2;
+#line 408
}
+#line 408
/* bits of k determine whether to get lower or upper part of dim */
+#line 408
for (k = 0; k < nslabs; k++) {
+#line 408
nels = 1;
+#line 408
for (j = 0; j < var_rank[i]; j++) {
+#line 408
if ((k >> j) & 1) {
+#line 408
start[j] = 0;
+#line 408
edge[j] = mid[j];
+#line 408
}else{
+#line 408
start[j] = mid[j];
+#line 408
edge[j] = var_shape[i][j] - mid[j];
+#line 408
}
+#line 408
nels *= edge[j];
+#line 408
}
+#line 408
allInExtRange = allInIntRange = 1;
+#line 408
for (j = 0; j < nels; j++) {
+#line 408
err = toMixedBase(j, var_rank[i], edge, index);
+#line 408
IF (err)
+#line 408
error("error in toMixedBase 1");
+#line 408
for (d = 0; d < var_rank[i]; d++)
+#line 408
index[d] += start[d];
+#line 408
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 408
if (inRange3(expect[j],var_type[i], NCT_FLOAT)) {
+#line 408
allInIntRange = allInIntRange && expect[j] >= float_min
+#line 408
&& expect[j] <= float_max;
+#line 408
} else {
+#line 408
allInExtRange = 0;
+#line 408
}
+#line 408
}
+#line 408
if (var_rank[i] == 0 && i%2)
+#line 408
err = nc_get_vara_float(ncid, i, NULL, NULL, value);
+#line 408
else
+#line 408
err = nc_get_vara_float(ncid, i, start, edge, value);
+#line 408
if (canConvert) {
+#line 408
if (allInExtRange) {
+#line 408
if (allInIntRange) {
+#line 408
IF (err)
+#line 408
error("%s", nc_strerror(err));
+#line 408
} else {
+#line 408
IF (err != NC_ERANGE)
+#line 408
error("Range error: status = %d", err);
+#line 408
}
+#line 408
} else {
+#line 408
IF (err != 0 && err != NC_ERANGE)
+#line 408
error("OK or Range error: status = %d", err);
+#line 408
}
+#line 408
for (j = 0; j < nels; j++) {
+#line 408
if (inRange3(expect[j],var_type[i],NCT_FLOAT)
+#line 408
&& expect[j] >= float_min && expect[j] <= float_max) {
+#line 408
IF (!equal(value[j],expect[j],var_type[i],NCT_FLOAT)){
+#line 408
error("value read not that expected");
+#line 408
if (verbose) {
+#line 408
error("\n");
+#line 408
error("varid: %d, ", i);
+#line 408
error("var_name: %s, ", var_name[i]);
+#line 408
error("element number: %d ", j);
+#line 408
error("expect: %g", expect[j]);
+#line 408
error("got: %g", (double) value[j]);
+#line 408
}
+#line 408
} else {
+#line 408
nok++;
+#line 408
}
+#line 408
}
+#line 408
}
+#line 408
} else {
+#line 408
IF (nels > 0 && err != NC_ECHAR)
+#line 408
error("wrong type: status = %d", err);
+#line 408
}
+#line 408
}
+#line 408
}
+#line 408
err = nc_close(ncid);
+#line 408
IF (err)
+#line 408
error("nc_close: %s", nc_strerror(err));
+#line 408
print_nok(nok);
+#line 408
}
+#line 408
void
+#line 409
test_nc_get_vara_double(void)
+#line 409
{
+#line 409
int ncid;
+#line 409
int d;
+#line 409
int i;
+#line 409
int j;
+#line 409
int k;
+#line 409
int err;
+#line 409
int allInExtRange; /* all values within external range? */
+#line 409
int allInIntRange; /* all values within internal range? */
+#line 409
int nels;
+#line 409
int nslabs;
+#line 409
int nok = 0; /* count of valid comparisons */
+#line 409
size_t start[MAX_RANK];
+#line 409
size_t edge[MAX_RANK];
+#line 409
size_t index[MAX_RANK];
+#line 409
size_t mid[MAX_RANK];
+#line 409
int canConvert; /* Both text or both numeric */
+#line 409
double value[MAX_NELS];
+#line 409
double expect[MAX_NELS];
+#line 409
+#line 409
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 409
IF (err)
+#line 409
error("nc_open: %s", nc_strerror(err));
+#line 409
for (i = 0; i < NVARS; i++) {
+#line 409
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 409
assert(var_rank[i] <= MAX_RANK);
+#line 409
assert(var_nels[i] <= MAX_NELS);
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
start[j] = 0;
+#line 409
edge[j] = 1;
+#line 409
}
+#line 409
err = nc_get_vara_double(BAD_ID, i, start, edge, value);
+#line 409
IF (err != NC_EBADID)
+#line 409
error("bad ncid: status = %d", err);
+#line 409
err = nc_get_vara_double(ncid, BAD_VARID, start, edge, value);
+#line 409
IF (err != NC_ENOTVAR)
+#line 409
error("bad var id: status = %d", err);
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
start[j] = var_shape[i][j];
+#line 409
err = nc_get_vara_double(ncid, i, start, edge, value);
+#line 409
IF (canConvert && err != NC_EINVALCOORDS)
+#line 409
error("bad index: status = %d", err);
+#line 409
start[j] = 0;
+#line 409
edge[j] = var_shape[i][j] + 1;
+#line 409
err = nc_get_vara_double(ncid, i, start, edge, value);
+#line 409
IF (canConvert && err != NC_EEDGE)
+#line 409
error("bad edge: status = %d", err);
+#line 409
edge[j] = 1;
+#line 409
}
+#line 409
/* Check non-scalars for correct error returned even when */
+#line 409
/* there is nothing to get (edge[j]==0) */
+#line 409
if(var_rank[i] > 0) {
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
edge[j] = 0;
+#line 409
}
+#line 409
err = nc_get_vara_double(BAD_ID, i, start, edge, value);
+#line 409
IF (err != NC_EBADID)
+#line 409
error("bad ncid: status = %d", err);
+#line 409
err = nc_get_vara_double(ncid, BAD_VARID, start, edge, value);
+#line 409
IF (err != NC_ENOTVAR)
+#line 409
error("bad var id: status = %d", err);
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 409
start[j] = var_shape[i][j];
+#line 409
err = nc_get_vara_double(ncid, i, start, edge, value);
+#line 409
IF (canConvert && err != NC_EINVALCOORDS)
+#line 409
error("bad start: status = %d", err);
+#line 409
start[j] = 0;
+#line 409
}
+#line 409
}
+#line 409
err = nc_get_vara_double(ncid, i, start, edge, value);
+#line 409
if (canConvert) {
+#line 409
IF (err)
+#line 409
error("%s", nc_strerror(err));
+#line 409
} else {
+#line 409
IF (err != NC_ECHAR)
+#line 409
error("wrong type: status = %d", err);
+#line 409
}
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
edge[j] = 1;
+#line 409
}
+#line 409
} /* Choose a random point dividing each dim into 2 parts */
+#line 409
/* get 2^rank (nslabs) slabs so defined */
+#line 409
nslabs = 1;
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
mid[j] = roll( var_shape[i][j] );
+#line 409
nslabs *= 2;
+#line 409
}
+#line 409
/* bits of k determine whether to get lower or upper part of dim */
+#line 409
for (k = 0; k < nslabs; k++) {
+#line 409
nels = 1;
+#line 409
for (j = 0; j < var_rank[i]; j++) {
+#line 409
if ((k >> j) & 1) {
+#line 409
start[j] = 0;
+#line 409
edge[j] = mid[j];
+#line 409
}else{
+#line 409
start[j] = mid[j];
+#line 409
edge[j] = var_shape[i][j] - mid[j];
+#line 409
}
+#line 409
nels *= edge[j];
+#line 409
}
+#line 409
allInExtRange = allInIntRange = 1;
+#line 409
for (j = 0; j < nels; j++) {
+#line 409
err = toMixedBase(j, var_rank[i], edge, index);
+#line 409
IF (err)
+#line 409
error("error in toMixedBase 1");
+#line 409
for (d = 0; d < var_rank[i]; d++)
+#line 409
index[d] += start[d];
+#line 409
expect[j] = hash4(var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 409
if (inRange3(expect[j],var_type[i], NCT_DOUBLE)) {
+#line 409
allInIntRange = allInIntRange && expect[j] >= double_min
+#line 409
&& expect[j] <= double_max;
+#line 409
} else {
+#line 409
allInExtRange = 0;
+#line 409
}
+#line 409
}
+#line 409
if (var_rank[i] == 0 && i%2)
+#line 409
err = nc_get_vara_double(ncid, i, NULL, NULL, value);
+#line 409
else
+#line 409
err = nc_get_vara_double(ncid, i, start, edge, value);
+#line 409
if (canConvert) {
+#line 409
if (allInExtRange) {
+#line 409
if (allInIntRange) {
+#line 409
IF (err)
+#line 409
error("%s", nc_strerror(err));
+#line 409
} else {
+#line 409
IF (err != NC_ERANGE)
+#line 409
error("Range error: status = %d", err);
+#line 409
}
+#line 409
} else {
+#line 409
IF (err != 0 && err != NC_ERANGE)
+#line 409
error("OK or Range error: status = %d", err);
+#line 409
}
+#line 409
for (j = 0; j < nels; j++) {
+#line 409
if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
+#line 409
&& expect[j] >= double_min && expect[j] <= double_max) {
+#line 409
IF (!equal(value[j],expect[j],var_type[i],NCT_DOUBLE)){
+#line 409
error("value read not that expected");
+#line 409
if (verbose) {
+#line 409
error("\n");
+#line 409
error("varid: %d, ", i);
+#line 409
error("var_name: %s, ", var_name[i]);
+#line 409
error("element number: %d ", j);
+#line 409
error("expect: %g", expect[j]);
+#line 409
error("got: %g", (double) value[j]);
+#line 409
}
+#line 409
} else {
+#line 409
nok++;
+#line 409
}
+#line 409
}
+#line 409
}
+#line 409
} else {
+#line 409
IF (nels > 0 && err != NC_ECHAR)
+#line 409
error("wrong type: status = %d", err);
+#line 409
}
+#line 409
}
+#line 409
}
+#line 409
err = nc_close(ncid);
+#line 409
IF (err)
+#line 409
error("nc_close: %s", nc_strerror(err));
+#line 409
print_nok(nok);
+#line 409
}
+#line 409
+#line 590
void
+#line 591
test_nc_get_vars_text(void)
+#line 591
{
+#line 591
int ncid;
+#line 591
int d;
+#line 591
int i;
+#line 591
int j;
+#line 591
int k;
+#line 591
int m;
+#line 591
int err;
+#line 591
int allInExtRange; /* all values within external range? */
+#line 591
int allInIntRange; /* all values within internal range? */
+#line 591
int nels;
+#line 591
int nslabs;
+#line 591
int nstarts; /* number of different starts */
+#line 591
int nok = 0; /* count of valid comparisons */
+#line 591
size_t start[MAX_RANK];
+#line 591
size_t edge[MAX_RANK];
+#line 591
size_t index[MAX_RANK];
+#line 591
size_t index2[MAX_RANK];
+#line 591
size_t mid[MAX_RANK];
+#line 591
size_t count[MAX_RANK];
+#line 591
size_t sstride[MAX_RANK];
+#line 591
ptrdiff_t stride[MAX_RANK];
+#line 591
int canConvert; /* Both text or both numeric */
+#line 591
text value[MAX_NELS];
+#line 591
double expect[MAX_NELS];
+#line 591
+#line 591
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 591
IF (err)
+#line 591
error("nc_open: %s", nc_strerror(err));
+#line 591
for (i = 0; i < NVARS; i++) {
+#line 591
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 591
assert(var_rank[i] <= MAX_RANK);
+#line 591
assert(var_nels[i] <= MAX_NELS);
+#line 591
for (j = 0; j < var_rank[i]; j++) {
+#line 591
start[j] = 0;
+#line 591
edge[j] = 1;
+#line 591
stride[j] = 1;
+#line 591
}
+#line 591
err = nc_get_vars_text(BAD_ID, i, start, edge, stride, value);
+#line 591
IF (err != NC_EBADID)
+#line 591
error("bad ncid: status = %d", err);
+#line 591
err = nc_get_vars_text(ncid, BAD_VARID, start, edge, stride, value);
+#line 591
IF (err != NC_ENOTVAR)
+#line 591
error("bad var id: status = %d", err);
+#line 591
for (j = 0; j < var_rank[i]; j++) {
+#line 591
start[j] = var_shape[i][j];
+#line 591
err = nc_get_vars_text(ncid, i, start, edge, stride, value);
+#line 591
if(!canConvert) {
+#line 591
IF (err != NC_ECHAR)
+#line 591
error("conversion: status = %d", err);
+#line 591
} else {
+#line 591
IF (err != NC_EINVALCOORDS)
+#line 591
error("bad index: status = %d", err);
+#line 591
start[j] = 0;
+#line 591
edge[j] = var_shape[i][j] + 1;
+#line 591
err = nc_get_vars_text(ncid, i, start, edge, stride, value);
+#line 591
IF (err != NC_EEDGE)
+#line 591
error("bad edge: status = %d", err);
+#line 591
edge[j] = 1;
+#line 591
stride[j] = 0;
+#line 591
err = nc_get_vars_text(ncid, i, start, edge, stride, value);
+#line 591
IF (err != NC_ESTRIDE)
+#line 591
error("bad stride: status = %d", err);
+#line 591
stride[j] = 1;
+#line 591
}
+#line 591
}
+#line 591
/* Choose a random point dividing each dim into 2 parts */
+#line 591
/* get 2^rank (nslabs) slabs so defined */
+#line 591
nslabs = 1;
+#line 591
for (j = 0; j < var_rank[i]; j++) {
+#line 591
mid[j] = roll( var_shape[i][j] );
+#line 591
nslabs *= 2;
+#line 591
}
+#line 591
/* bits of k determine whether to get lower or upper part of dim */
+#line 591
/* choose random stride from 1 to edge */
+#line 591
for (k = 0; k < nslabs; k++) {
+#line 591
nstarts = 1;
+#line 591
for (j = 0; j < var_rank[i]; j++) {
+#line 591
if ((k >> j) & 1) {
+#line 591
start[j] = 0;
+#line 591
edge[j] = mid[j];
+#line 591
}else{
+#line 591
start[j] = mid[j];
+#line 591
edge[j] = var_shape[i][j] - mid[j];
+#line 591
}
+#line 591
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 591
nstarts *= stride[j];
+#line 591
}
+#line 591
for (m = 0; m < nstarts; m++) {
+#line 591
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 591
IF (err)
+#line 591
error("error in toMixedBase");
+#line 591
nels = 1;
+#line 591
for (j = 0; j < var_rank[i]; j++) {
+#line 591
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 591
nels *= count[j];
+#line 591
index[j] += start[j];
+#line 591
}
+#line 591
/* Random choice of forward or backward */
+#line 591
/* TODO
+#line 591
if ( roll(2) ) {
+#line 591
for (j = 0; j < var_rank[i]; j++) {
+#line 591
index[j] += (count[j] - 1) * stride[j];
+#line 591
stride[j] = -stride[j];
+#line 591
}
+#line 591
}
+#line 591
*/
+#line 591
allInExtRange = allInIntRange = 1;
+#line 591
for (j = 0; j < nels; j++) {
+#line 591
err = toMixedBase(j, var_rank[i], count, index2);
+#line 591
IF (err)
+#line 591
error("error in toMixedBase 1");
+#line 591
for (d = 0; d < var_rank[i]; d++)
+#line 591
index2[d] = index[d] + index2[d] * stride[d];
+#line 591
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 591
NCT_TEXT);
+#line 591
if (inRange3(expect[j],var_type[i],NCT_TEXT)) {
+#line 591
allInIntRange = allInIntRange && expect[j] >= text_min
+#line 591
&& expect[j] <= text_max;
+#line 591
} else {
+#line 591
allInExtRange = 0;
+#line 591
}
+#line 591
}
+#line 591
if (var_rank[i] == 0 && i%2 )
+#line 591
err = nc_get_vars_text(ncid, i, NULL, NULL, NULL, value);
+#line 591
else
+#line 591
err = nc_get_vars_text(ncid, i, index, count, stride, value);
+#line 591
if (canConvert) {
+#line 591
if (allInExtRange) {
+#line 591
if (allInIntRange) {
+#line 591
IF (err)
+#line 591
error("%s", nc_strerror(err));
+#line 591
} else {
+#line 591
IF (err != NC_ERANGE)
+#line 591
error("Range error: status = %d", err);
+#line 591
}
+#line 591
} else {
+#line 591
IF (err != 0 && err != NC_ERANGE)
+#line 591
error("OK or Range error: status = %d", err);
+#line 591
}
+#line 591
for (j = 0; j < nels; j++) {
+#line 591
if (inRange3(expect[j],var_type[i],NCT_TEXT)
+#line 591
&& expect[j] >= text_min && expect[j] <= text_max) {
+#line 591
IF (!equal(value[j],expect[j],var_type[i], NCT_TEXT)){
+#line 591
error("value read not that expected");
+#line 591
if (verbose) {
+#line 591
error("\n");
+#line 591
error("varid: %d, ", i);
+#line 591
error("var_name: %s, ", var_name[i]);
+#line 591
error("element number: %d ", j);
+#line 591
error("expect: %g, ", expect[j]);
+#line 591
error("got: %g", (double) value[j]);
+#line 591
}
+#line 591
} else {
+#line 591
nok++;
+#line 591
}
+#line 591
}
+#line 591
}
+#line 591
} else {
+#line 591
IF (nels > 0 && err != NC_ECHAR)
+#line 591
error("wrong type: status = %d", err);
+#line 591
}
+#line 591
}
+#line 591
}
+#line 591
+#line 591
}
+#line 591
err = nc_close(ncid);
+#line 591
IF (err)
+#line 591
error("nc_close: %s", nc_strerror(err));
+#line 591
print_nok(nok);
+#line 591
}
+#line 591
void
+#line 592
test_nc_get_vars_uchar(void)
+#line 592
{
+#line 592
int ncid;
+#line 592
int d;
+#line 592
int i;
+#line 592
int j;
+#line 592
int k;
+#line 592
int m;
+#line 592
int err;
+#line 592
int allInExtRange; /* all values within external range? */
+#line 592
int allInIntRange; /* all values within internal range? */
+#line 592
int nels;
+#line 592
int nslabs;
+#line 592
int nstarts; /* number of different starts */
+#line 592
int nok = 0; /* count of valid comparisons */
+#line 592
size_t start[MAX_RANK];
+#line 592
size_t edge[MAX_RANK];
+#line 592
size_t index[MAX_RANK];
+#line 592
size_t index2[MAX_RANK];
+#line 592
size_t mid[MAX_RANK];
+#line 592
size_t count[MAX_RANK];
+#line 592
size_t sstride[MAX_RANK];
+#line 592
ptrdiff_t stride[MAX_RANK];
+#line 592
int canConvert; /* Both text or both numeric */
+#line 592
uchar value[MAX_NELS];
+#line 592
double expect[MAX_NELS];
+#line 592
+#line 592
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 592
IF (err)
+#line 592
error("nc_open: %s", nc_strerror(err));
+#line 592
for (i = 0; i < NVARS; i++) {
+#line 592
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 592
assert(var_rank[i] <= MAX_RANK);
+#line 592
assert(var_nels[i] <= MAX_NELS);
+#line 592
for (j = 0; j < var_rank[i]; j++) {
+#line 592
start[j] = 0;
+#line 592
edge[j] = 1;
+#line 592
stride[j] = 1;
+#line 592
}
+#line 592
err = nc_get_vars_uchar(BAD_ID, i, start, edge, stride, value);
+#line 592
IF (err != NC_EBADID)
+#line 592
error("bad ncid: status = %d", err);
+#line 592
err = nc_get_vars_uchar(ncid, BAD_VARID, start, edge, stride, value);
+#line 592
IF (err != NC_ENOTVAR)
+#line 592
error("bad var id: status = %d", err);
+#line 592
for (j = 0; j < var_rank[i]; j++) {
+#line 592
start[j] = var_shape[i][j];
+#line 592
err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
+#line 592
if(!canConvert) {
+#line 592
IF (err != NC_ECHAR)
+#line 592
error("conversion: status = %d", err);
+#line 592
} else {
+#line 592
IF (err != NC_EINVALCOORDS)
+#line 592
error("bad index: status = %d", err);
+#line 592
start[j] = 0;
+#line 592
edge[j] = var_shape[i][j] + 1;
+#line 592
err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
+#line 592
IF (err != NC_EEDGE)
+#line 592
error("bad edge: status = %d", err);
+#line 592
edge[j] = 1;
+#line 592
stride[j] = 0;
+#line 592
err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
+#line 592
IF (err != NC_ESTRIDE)
+#line 592
error("bad stride: status = %d", err);
+#line 592
stride[j] = 1;
+#line 592
}
+#line 592
}
+#line 592
/* Choose a random point dividing each dim into 2 parts */
+#line 592
/* get 2^rank (nslabs) slabs so defined */
+#line 592
nslabs = 1;
+#line 592
for (j = 0; j < var_rank[i]; j++) {
+#line 592
mid[j] = roll( var_shape[i][j] );
+#line 592
nslabs *= 2;
+#line 592
}
+#line 592
/* bits of k determine whether to get lower or upper part of dim */
+#line 592
/* choose random stride from 1 to edge */
+#line 592
for (k = 0; k < nslabs; k++) {
+#line 592
nstarts = 1;
+#line 592
for (j = 0; j < var_rank[i]; j++) {
+#line 592
if ((k >> j) & 1) {
+#line 592
start[j] = 0;
+#line 592
edge[j] = mid[j];
+#line 592
}else{
+#line 592
start[j] = mid[j];
+#line 592
edge[j] = var_shape[i][j] - mid[j];
+#line 592
}
+#line 592
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 592
nstarts *= stride[j];
+#line 592
}
+#line 592
for (m = 0; m < nstarts; m++) {
+#line 592
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 592
IF (err)
+#line 592
error("error in toMixedBase");
+#line 592
nels = 1;
+#line 592
for (j = 0; j < var_rank[i]; j++) {
+#line 592
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 592
nels *= count[j];
+#line 592
index[j] += start[j];
+#line 592
}
+#line 592
/* Random choice of forward or backward */
+#line 592
/* TODO
+#line 592
if ( roll(2) ) {
+#line 592
for (j = 0; j < var_rank[i]; j++) {
+#line 592
index[j] += (count[j] - 1) * stride[j];
+#line 592
stride[j] = -stride[j];
+#line 592
}
+#line 592
}
+#line 592
*/
+#line 592
allInExtRange = allInIntRange = 1;
+#line 592
for (j = 0; j < nels; j++) {
+#line 592
err = toMixedBase(j, var_rank[i], count, index2);
+#line 592
IF (err)
+#line 592
error("error in toMixedBase 1");
+#line 592
for (d = 0; d < var_rank[i]; d++)
+#line 592
index2[d] = index[d] + index2[d] * stride[d];
+#line 592
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 592
NCT_UCHAR);
+#line 592
if (inRange3(expect[j],var_type[i],NCT_UCHAR)) {
+#line 592
allInIntRange = allInIntRange && expect[j] >= uchar_min
+#line 592
&& expect[j] <= uchar_max;
+#line 592
} else {
+#line 592
allInExtRange = 0;
+#line 592
}
+#line 592
}
+#line 592
if (var_rank[i] == 0 && i%2 )
+#line 592
err = nc_get_vars_uchar(ncid, i, NULL, NULL, NULL, value);
+#line 592
else
+#line 592
err = nc_get_vars_uchar(ncid, i, index, count, stride, value);
+#line 592
if (canConvert) {
+#line 592
if (allInExtRange) {
+#line 592
if (allInIntRange) {
+#line 592
IF (err)
+#line 592
error("%s", nc_strerror(err));
+#line 592
} else {
+#line 592
IF (err != NC_ERANGE)
+#line 592
error("Range error: status = %d", err);
+#line 592
}
+#line 592
} else {
+#line 592
IF (err != 0 && err != NC_ERANGE)
+#line 592
error("OK or Range error: status = %d", err);
+#line 592
}
+#line 592
for (j = 0; j < nels; j++) {
+#line 592
if (inRange3(expect[j],var_type[i],NCT_UCHAR)
+#line 592
&& expect[j] >= uchar_min && expect[j] <= uchar_max) {
+#line 592
IF (!equal(value[j],expect[j],var_type[i], NCT_UCHAR)){
+#line 592
error("value read not that expected");
+#line 592
if (verbose) {
+#line 592
error("\n");
+#line 592
error("varid: %d, ", i);
+#line 592
error("var_name: %s, ", var_name[i]);
+#line 592
error("element number: %d ", j);
+#line 592
error("expect: %g, ", expect[j]);
+#line 592
error("got: %g", (double) value[j]);
+#line 592
}
+#line 592
} else {
+#line 592
nok++;
+#line 592
}
+#line 592
}
+#line 592
}
+#line 592
} else {
+#line 592
IF (nels > 0 && err != NC_ECHAR)
+#line 592
error("wrong type: status = %d", err);
+#line 592
}
+#line 592
}
+#line 592
}
+#line 592
+#line 592
}
+#line 592
err = nc_close(ncid);
+#line 592
IF (err)
+#line 592
error("nc_close: %s", nc_strerror(err));
+#line 592
print_nok(nok);
+#line 592
}
+#line 592
void
+#line 593
test_nc_get_vars_schar(void)
+#line 593
{
+#line 593
int ncid;
+#line 593
int d;
+#line 593
int i;
+#line 593
int j;
+#line 593
int k;
+#line 593
int m;
+#line 593
int err;
+#line 593
int allInExtRange; /* all values within external range? */
+#line 593
int allInIntRange; /* all values within internal range? */
+#line 593
int nels;
+#line 593
int nslabs;
+#line 593
int nstarts; /* number of different starts */
+#line 593
int nok = 0; /* count of valid comparisons */
+#line 593
size_t start[MAX_RANK];
+#line 593
size_t edge[MAX_RANK];
+#line 593
size_t index[MAX_RANK];
+#line 593
size_t index2[MAX_RANK];
+#line 593
size_t mid[MAX_RANK];
+#line 593
size_t count[MAX_RANK];
+#line 593
size_t sstride[MAX_RANK];
+#line 593
ptrdiff_t stride[MAX_RANK];
+#line 593
int canConvert; /* Both text or both numeric */
+#line 593
schar value[MAX_NELS];
+#line 593
double expect[MAX_NELS];
+#line 593
+#line 593
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 593
IF (err)
+#line 593
error("nc_open: %s", nc_strerror(err));
+#line 593
for (i = 0; i < NVARS; i++) {
+#line 593
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 593
assert(var_rank[i] <= MAX_RANK);
+#line 593
assert(var_nels[i] <= MAX_NELS);
+#line 593
for (j = 0; j < var_rank[i]; j++) {
+#line 593
start[j] = 0;
+#line 593
edge[j] = 1;
+#line 593
stride[j] = 1;
+#line 593
}
+#line 593
err = nc_get_vars_schar(BAD_ID, i, start, edge, stride, value);
+#line 593
IF (err != NC_EBADID)
+#line 593
error("bad ncid: status = %d", err);
+#line 593
err = nc_get_vars_schar(ncid, BAD_VARID, start, edge, stride, value);
+#line 593
IF (err != NC_ENOTVAR)
+#line 593
error("bad var id: status = %d", err);
+#line 593
for (j = 0; j < var_rank[i]; j++) {
+#line 593
start[j] = var_shape[i][j];
+#line 593
err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
+#line 593
if(!canConvert) {
+#line 593
IF (err != NC_ECHAR)
+#line 593
error("conversion: status = %d", err);
+#line 593
} else {
+#line 593
IF (err != NC_EINVALCOORDS)
+#line 593
error("bad index: status = %d", err);
+#line 593
start[j] = 0;
+#line 593
edge[j] = var_shape[i][j] + 1;
+#line 593
err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
+#line 593
IF (err != NC_EEDGE)
+#line 593
error("bad edge: status = %d", err);
+#line 593
edge[j] = 1;
+#line 593
stride[j] = 0;
+#line 593
err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
+#line 593
IF (err != NC_ESTRIDE)
+#line 593
error("bad stride: status = %d", err);
+#line 593
stride[j] = 1;
+#line 593
}
+#line 593
}
+#line 593
/* Choose a random point dividing each dim into 2 parts */
+#line 593
/* get 2^rank (nslabs) slabs so defined */
+#line 593
nslabs = 1;
+#line 593
for (j = 0; j < var_rank[i]; j++) {
+#line 593
mid[j] = roll( var_shape[i][j] );
+#line 593
nslabs *= 2;
+#line 593
}
+#line 593
/* bits of k determine whether to get lower or upper part of dim */
+#line 593
/* choose random stride from 1 to edge */
+#line 593
for (k = 0; k < nslabs; k++) {
+#line 593
nstarts = 1;
+#line 593
for (j = 0; j < var_rank[i]; j++) {
+#line 593
if ((k >> j) & 1) {
+#line 593
start[j] = 0;
+#line 593
edge[j] = mid[j];
+#line 593
}else{
+#line 593
start[j] = mid[j];
+#line 593
edge[j] = var_shape[i][j] - mid[j];
+#line 593
}
+#line 593
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 593
nstarts *= stride[j];
+#line 593
}
+#line 593
for (m = 0; m < nstarts; m++) {
+#line 593
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 593
IF (err)
+#line 593
error("error in toMixedBase");
+#line 593
nels = 1;
+#line 593
for (j = 0; j < var_rank[i]; j++) {
+#line 593
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 593
nels *= count[j];
+#line 593
index[j] += start[j];
+#line 593
}
+#line 593
/* Random choice of forward or backward */
+#line 593
/* TODO
+#line 593
if ( roll(2) ) {
+#line 593
for (j = 0; j < var_rank[i]; j++) {
+#line 593
index[j] += (count[j] - 1) * stride[j];
+#line 593
stride[j] = -stride[j];
+#line 593
}
+#line 593
}
+#line 593
*/
+#line 593
allInExtRange = allInIntRange = 1;
+#line 593
for (j = 0; j < nels; j++) {
+#line 593
err = toMixedBase(j, var_rank[i], count, index2);
+#line 593
IF (err)
+#line 593
error("error in toMixedBase 1");
+#line 593
for (d = 0; d < var_rank[i]; d++)
+#line 593
index2[d] = index[d] + index2[d] * stride[d];
+#line 593
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 593
NCT_SCHAR);
+#line 593
if (inRange3(expect[j],var_type[i],NCT_SCHAR)) {
+#line 593
allInIntRange = allInIntRange && expect[j] >= schar_min
+#line 593
&& expect[j] <= schar_max;
+#line 593
} else {
+#line 593
allInExtRange = 0;
+#line 593
}
+#line 593
}
+#line 593
if (var_rank[i] == 0 && i%2 )
+#line 593
err = nc_get_vars_schar(ncid, i, NULL, NULL, NULL, value);
+#line 593
else
+#line 593
err = nc_get_vars_schar(ncid, i, index, count, stride, value);
+#line 593
if (canConvert) {
+#line 593
if (allInExtRange) {
+#line 593
if (allInIntRange) {
+#line 593
IF (err)
+#line 593
error("%s", nc_strerror(err));
+#line 593
} else {
+#line 593
IF (err != NC_ERANGE)
+#line 593
error("Range error: status = %d", err);
+#line 593
}
+#line 593
} else {
+#line 593
IF (err != 0 && err != NC_ERANGE)
+#line 593
error("OK or Range error: status = %d", err);
+#line 593
}
+#line 593
for (j = 0; j < nels; j++) {
+#line 593
if (inRange3(expect[j],var_type[i],NCT_SCHAR)
+#line 593
&& expect[j] >= schar_min && expect[j] <= schar_max) {
+#line 593
IF (!equal(value[j],expect[j],var_type[i], NCT_SCHAR)){
+#line 593
error("value read not that expected");
+#line 593
if (verbose) {
+#line 593
error("\n");
+#line 593
error("varid: %d, ", i);
+#line 593
error("var_name: %s, ", var_name[i]);
+#line 593
error("element number: %d ", j);
+#line 593
error("expect: %g, ", expect[j]);
+#line 593
error("got: %g", (double) value[j]);
+#line 593
}
+#line 593
} else {
+#line 593
nok++;
+#line 593
}
+#line 593
}
+#line 593
}
+#line 593
} else {
+#line 593
IF (nels > 0 && err != NC_ECHAR)
+#line 593
error("wrong type: status = %d", err);
+#line 593
}
+#line 593
}
+#line 593
}
+#line 593
+#line 593
}
+#line 593
err = nc_close(ncid);
+#line 593
IF (err)
+#line 593
error("nc_close: %s", nc_strerror(err));
+#line 593
print_nok(nok);
+#line 593
}
+#line 593
void
+#line 594
test_nc_get_vars_short(void)
+#line 594
{
+#line 594
int ncid;
+#line 594
int d;
+#line 594
int i;
+#line 594
int j;
+#line 594
int k;
+#line 594
int m;
+#line 594
int err;
+#line 594
int allInExtRange; /* all values within external range? */
+#line 594
int allInIntRange; /* all values within internal range? */
+#line 594
int nels;
+#line 594
int nslabs;
+#line 594
int nstarts; /* number of different starts */
+#line 594
int nok = 0; /* count of valid comparisons */
+#line 594
size_t start[MAX_RANK];
+#line 594
size_t edge[MAX_RANK];
+#line 594
size_t index[MAX_RANK];
+#line 594
size_t index2[MAX_RANK];
+#line 594
size_t mid[MAX_RANK];
+#line 594
size_t count[MAX_RANK];
+#line 594
size_t sstride[MAX_RANK];
+#line 594
ptrdiff_t stride[MAX_RANK];
+#line 594
int canConvert; /* Both text or both numeric */
+#line 594
short value[MAX_NELS];
+#line 594
double expect[MAX_NELS];
+#line 594
+#line 594
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 594
IF (err)
+#line 594
error("nc_open: %s", nc_strerror(err));
+#line 594
for (i = 0; i < NVARS; i++) {
+#line 594
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 594
assert(var_rank[i] <= MAX_RANK);
+#line 594
assert(var_nels[i] <= MAX_NELS);
+#line 594
for (j = 0; j < var_rank[i]; j++) {
+#line 594
start[j] = 0;
+#line 594
edge[j] = 1;
+#line 594
stride[j] = 1;
+#line 594
}
+#line 594
err = nc_get_vars_short(BAD_ID, i, start, edge, stride, value);
+#line 594
IF (err != NC_EBADID)
+#line 594
error("bad ncid: status = %d", err);
+#line 594
err = nc_get_vars_short(ncid, BAD_VARID, start, edge, stride, value);
+#line 594
IF (err != NC_ENOTVAR)
+#line 594
error("bad var id: status = %d", err);
+#line 594
for (j = 0; j < var_rank[i]; j++) {
+#line 594
start[j] = var_shape[i][j];
+#line 594
err = nc_get_vars_short(ncid, i, start, edge, stride, value);
+#line 594
if(!canConvert) {
+#line 594
IF (err != NC_ECHAR)
+#line 594
error("conversion: status = %d", err);
+#line 594
} else {
+#line 594
IF (err != NC_EINVALCOORDS)
+#line 594
error("bad index: status = %d", err);
+#line 594
start[j] = 0;
+#line 594
edge[j] = var_shape[i][j] + 1;
+#line 594
err = nc_get_vars_short(ncid, i, start, edge, stride, value);
+#line 594
IF (err != NC_EEDGE)
+#line 594
error("bad edge: status = %d", err);
+#line 594
edge[j] = 1;
+#line 594
stride[j] = 0;
+#line 594
err = nc_get_vars_short(ncid, i, start, edge, stride, value);
+#line 594
IF (err != NC_ESTRIDE)
+#line 594
error("bad stride: status = %d", err);
+#line 594
stride[j] = 1;
+#line 594
}
+#line 594
}
+#line 594
/* Choose a random point dividing each dim into 2 parts */
+#line 594
/* get 2^rank (nslabs) slabs so defined */
+#line 594
nslabs = 1;
+#line 594
for (j = 0; j < var_rank[i]; j++) {
+#line 594
mid[j] = roll( var_shape[i][j] );
+#line 594
nslabs *= 2;
+#line 594
}
+#line 594
/* bits of k determine whether to get lower or upper part of dim */
+#line 594
/* choose random stride from 1 to edge */
+#line 594
for (k = 0; k < nslabs; k++) {
+#line 594
nstarts = 1;
+#line 594
for (j = 0; j < var_rank[i]; j++) {
+#line 594
if ((k >> j) & 1) {
+#line 594
start[j] = 0;
+#line 594
edge[j] = mid[j];
+#line 594
}else{
+#line 594
start[j] = mid[j];
+#line 594
edge[j] = var_shape[i][j] - mid[j];
+#line 594
}
+#line 594
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 594
nstarts *= stride[j];
+#line 594
}
+#line 594
for (m = 0; m < nstarts; m++) {
+#line 594
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 594
IF (err)
+#line 594
error("error in toMixedBase");
+#line 594
nels = 1;
+#line 594
for (j = 0; j < var_rank[i]; j++) {
+#line 594
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 594
nels *= count[j];
+#line 594
index[j] += start[j];
+#line 594
}
+#line 594
/* Random choice of forward or backward */
+#line 594
/* TODO
+#line 594
if ( roll(2) ) {
+#line 594
for (j = 0; j < var_rank[i]; j++) {
+#line 594
index[j] += (count[j] - 1) * stride[j];
+#line 594
stride[j] = -stride[j];
+#line 594
}
+#line 594
}
+#line 594
*/
+#line 594
allInExtRange = allInIntRange = 1;
+#line 594
for (j = 0; j < nels; j++) {
+#line 594
err = toMixedBase(j, var_rank[i], count, index2);
+#line 594
IF (err)
+#line 594
error("error in toMixedBase 1");
+#line 594
for (d = 0; d < var_rank[i]; d++)
+#line 594
index2[d] = index[d] + index2[d] * stride[d];
+#line 594
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 594
NCT_SHORT);
+#line 594
if (inRange3(expect[j],var_type[i],NCT_SHORT)) {
+#line 594
allInIntRange = allInIntRange && expect[j] >= short_min
+#line 594
&& expect[j] <= short_max;
+#line 594
} else {
+#line 594
allInExtRange = 0;
+#line 594
}
+#line 594
}
+#line 594
if (var_rank[i] == 0 && i%2 )
+#line 594
err = nc_get_vars_short(ncid, i, NULL, NULL, NULL, value);
+#line 594
else
+#line 594
err = nc_get_vars_short(ncid, i, index, count, stride, value);
+#line 594
if (canConvert) {
+#line 594
if (allInExtRange) {
+#line 594
if (allInIntRange) {
+#line 594
IF (err)
+#line 594
error("%s", nc_strerror(err));
+#line 594
} else {
+#line 594
IF (err != NC_ERANGE)
+#line 594
error("Range error: status = %d", err);
+#line 594
}
+#line 594
} else {
+#line 594
IF (err != 0 && err != NC_ERANGE)
+#line 594
error("OK or Range error: status = %d", err);
+#line 594
}
+#line 594
for (j = 0; j < nels; j++) {
+#line 594
if (inRange3(expect[j],var_type[i],NCT_SHORT)
+#line 594
&& expect[j] >= short_min && expect[j] <= short_max) {
+#line 594
IF (!equal(value[j],expect[j],var_type[i], NCT_SHORT)){
+#line 594
error("value read not that expected");
+#line 594
if (verbose) {
+#line 594
error("\n");
+#line 594
error("varid: %d, ", i);
+#line 594
error("var_name: %s, ", var_name[i]);
+#line 594
error("element number: %d ", j);
+#line 594
error("expect: %g, ", expect[j]);
+#line 594
error("got: %g", (double) value[j]);
+#line 594
}
+#line 594
} else {
+#line 594
nok++;
+#line 594
}
+#line 594
}
+#line 594
}
+#line 594
} else {
+#line 594
IF (nels > 0 && err != NC_ECHAR)
+#line 594
error("wrong type: status = %d", err);
+#line 594
}
+#line 594
}
+#line 594
}
+#line 594
+#line 594
}
+#line 594
err = nc_close(ncid);
+#line 594
IF (err)
+#line 594
error("nc_close: %s", nc_strerror(err));
+#line 594
print_nok(nok);
+#line 594
}
+#line 594
void
+#line 595
test_nc_get_vars_int(void)
+#line 595
{
+#line 595
int ncid;
+#line 595
int d;
+#line 595
int i;
+#line 595
int j;
+#line 595
int k;
+#line 595
int m;
+#line 595
int err;
+#line 595
int allInExtRange; /* all values within external range? */
+#line 595
int allInIntRange; /* all values within internal range? */
+#line 595
int nels;
+#line 595
int nslabs;
+#line 595
int nstarts; /* number of different starts */
+#line 595
int nok = 0; /* count of valid comparisons */
+#line 595
size_t start[MAX_RANK];
+#line 595
size_t edge[MAX_RANK];
+#line 595
size_t index[MAX_RANK];
+#line 595
size_t index2[MAX_RANK];
+#line 595
size_t mid[MAX_RANK];
+#line 595
size_t count[MAX_RANK];
+#line 595
size_t sstride[MAX_RANK];
+#line 595
ptrdiff_t stride[MAX_RANK];
+#line 595
int canConvert; /* Both text or both numeric */
+#line 595
int value[MAX_NELS];
+#line 595
double expect[MAX_NELS];
+#line 595
+#line 595
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 595
IF (err)
+#line 595
error("nc_open: %s", nc_strerror(err));
+#line 595
for (i = 0; i < NVARS; i++) {
+#line 595
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 595
assert(var_rank[i] <= MAX_RANK);
+#line 595
assert(var_nels[i] <= MAX_NELS);
+#line 595
for (j = 0; j < var_rank[i]; j++) {
+#line 595
start[j] = 0;
+#line 595
edge[j] = 1;
+#line 595
stride[j] = 1;
+#line 595
}
+#line 595
err = nc_get_vars_int(BAD_ID, i, start, edge, stride, value);
+#line 595
IF (err != NC_EBADID)
+#line 595
error("bad ncid: status = %d", err);
+#line 595
err = nc_get_vars_int(ncid, BAD_VARID, start, edge, stride, value);
+#line 595
IF (err != NC_ENOTVAR)
+#line 595
error("bad var id: status = %d", err);
+#line 595
for (j = 0; j < var_rank[i]; j++) {
+#line 595
start[j] = var_shape[i][j];
+#line 595
err = nc_get_vars_int(ncid, i, start, edge, stride, value);
+#line 595
if(!canConvert) {
+#line 595
IF (err != NC_ECHAR)
+#line 595
error("conversion: status = %d", err);
+#line 595
} else {
+#line 595
IF (err != NC_EINVALCOORDS)
+#line 595
error("bad index: status = %d", err);
+#line 595
start[j] = 0;
+#line 595
edge[j] = var_shape[i][j] + 1;
+#line 595
err = nc_get_vars_int(ncid, i, start, edge, stride, value);
+#line 595
IF (err != NC_EEDGE)
+#line 595
error("bad edge: status = %d", err);
+#line 595
edge[j] = 1;
+#line 595
stride[j] = 0;
+#line 595
err = nc_get_vars_int(ncid, i, start, edge, stride, value);
+#line 595
IF (err != NC_ESTRIDE)
+#line 595
error("bad stride: status = %d", err);
+#line 595
stride[j] = 1;
+#line 595
}
+#line 595
}
+#line 595
/* Choose a random point dividing each dim into 2 parts */
+#line 595
/* get 2^rank (nslabs) slabs so defined */
+#line 595
nslabs = 1;
+#line 595
for (j = 0; j < var_rank[i]; j++) {
+#line 595
mid[j] = roll( var_shape[i][j] );
+#line 595
nslabs *= 2;
+#line 595
}
+#line 595
/* bits of k determine whether to get lower or upper part of dim */
+#line 595
/* choose random stride from 1 to edge */
+#line 595
for (k = 0; k < nslabs; k++) {
+#line 595
nstarts = 1;
+#line 595
for (j = 0; j < var_rank[i]; j++) {
+#line 595
if ((k >> j) & 1) {
+#line 595
start[j] = 0;
+#line 595
edge[j] = mid[j];
+#line 595
}else{
+#line 595
start[j] = mid[j];
+#line 595
edge[j] = var_shape[i][j] - mid[j];
+#line 595
}
+#line 595
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 595
nstarts *= stride[j];
+#line 595
}
+#line 595
for (m = 0; m < nstarts; m++) {
+#line 595
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 595
IF (err)
+#line 595
error("error in toMixedBase");
+#line 595
nels = 1;
+#line 595
for (j = 0; j < var_rank[i]; j++) {
+#line 595
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 595
nels *= count[j];
+#line 595
index[j] += start[j];
+#line 595
}
+#line 595
/* Random choice of forward or backward */
+#line 595
/* TODO
+#line 595
if ( roll(2) ) {
+#line 595
for (j = 0; j < var_rank[i]; j++) {
+#line 595
index[j] += (count[j] - 1) * stride[j];
+#line 595
stride[j] = -stride[j];
+#line 595
}
+#line 595
}
+#line 595
*/
+#line 595
allInExtRange = allInIntRange = 1;
+#line 595
for (j = 0; j < nels; j++) {
+#line 595
err = toMixedBase(j, var_rank[i], count, index2);
+#line 595
IF (err)
+#line 595
error("error in toMixedBase 1");
+#line 595
for (d = 0; d < var_rank[i]; d++)
+#line 595
index2[d] = index[d] + index2[d] * stride[d];
+#line 595
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 595
NCT_INT);
+#line 595
if (inRange3(expect[j],var_type[i],NCT_INT)) {
+#line 595
allInIntRange = allInIntRange && expect[j] >= int_min
+#line 595
&& expect[j] <= int_max;
+#line 595
} else {
+#line 595
allInExtRange = 0;
+#line 595
}
+#line 595
}
+#line 595
if (var_rank[i] == 0 && i%2 )
+#line 595
err = nc_get_vars_int(ncid, i, NULL, NULL, NULL, value);
+#line 595
else
+#line 595
err = nc_get_vars_int(ncid, i, index, count, stride, value);
+#line 595
if (canConvert) {
+#line 595
if (allInExtRange) {
+#line 595
if (allInIntRange) {
+#line 595
IF (err)
+#line 595
error("%s", nc_strerror(err));
+#line 595
} else {
+#line 595
IF (err != NC_ERANGE)
+#line 595
error("Range error: status = %d", err);
+#line 595
}
+#line 595
} else {
+#line 595
IF (err != 0 && err != NC_ERANGE)
+#line 595
error("OK or Range error: status = %d", err);
+#line 595
}
+#line 595
for (j = 0; j < nels; j++) {
+#line 595
if (inRange3(expect[j],var_type[i],NCT_INT)
+#line 595
&& expect[j] >= int_min && expect[j] <= int_max) {
+#line 595
IF (!equal(value[j],expect[j],var_type[i], NCT_INT)){
+#line 595
error("value read not that expected");
+#line 595
if (verbose) {
+#line 595
error("\n");
+#line 595
error("varid: %d, ", i);
+#line 595
error("var_name: %s, ", var_name[i]);
+#line 595
error("element number: %d ", j);
+#line 595
error("expect: %g, ", expect[j]);
+#line 595
error("got: %g", (double) value[j]);
+#line 595
}
+#line 595
} else {
+#line 595
nok++;
+#line 595
}
+#line 595
}
+#line 595
}
+#line 595
} else {
+#line 595
IF (nels > 0 && err != NC_ECHAR)
+#line 595
error("wrong type: status = %d", err);
+#line 595
}
+#line 595
}
+#line 595
}
+#line 595
+#line 595
}
+#line 595
err = nc_close(ncid);
+#line 595
IF (err)
+#line 595
error("nc_close: %s", nc_strerror(err));
+#line 595
print_nok(nok);
+#line 595
}
+#line 595
void
+#line 596
test_nc_get_vars_long(void)
+#line 596
{
+#line 596
int ncid;
+#line 596
int d;
+#line 596
int i;
+#line 596
int j;
+#line 596
int k;
+#line 596
int m;
+#line 596
int err;
+#line 596
int allInExtRange; /* all values within external range? */
+#line 596
int allInIntRange; /* all values within internal range? */
+#line 596
int nels;
+#line 596
int nslabs;
+#line 596
int nstarts; /* number of different starts */
+#line 596
int nok = 0; /* count of valid comparisons */
+#line 596
size_t start[MAX_RANK];
+#line 596
size_t edge[MAX_RANK];
+#line 596
size_t index[MAX_RANK];
+#line 596
size_t index2[MAX_RANK];
+#line 596
size_t mid[MAX_RANK];
+#line 596
size_t count[MAX_RANK];
+#line 596
size_t sstride[MAX_RANK];
+#line 596
ptrdiff_t stride[MAX_RANK];
+#line 596
int canConvert; /* Both text or both numeric */
+#line 596
long value[MAX_NELS];
+#line 596
double expect[MAX_NELS];
+#line 596
+#line 596
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 596
IF (err)
+#line 596
error("nc_open: %s", nc_strerror(err));
+#line 596
for (i = 0; i < NVARS; i++) {
+#line 596
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 596
assert(var_rank[i] <= MAX_RANK);
+#line 596
assert(var_nels[i] <= MAX_NELS);
+#line 596
for (j = 0; j < var_rank[i]; j++) {
+#line 596
start[j] = 0;
+#line 596
edge[j] = 1;
+#line 596
stride[j] = 1;
+#line 596
}
+#line 596
err = nc_get_vars_long(BAD_ID, i, start, edge, stride, value);
+#line 596
IF (err != NC_EBADID)
+#line 596
error("bad ncid: status = %d", err);
+#line 596
err = nc_get_vars_long(ncid, BAD_VARID, start, edge, stride, value);
+#line 596
IF (err != NC_ENOTVAR)
+#line 596
error("bad var id: status = %d", err);
+#line 596
for (j = 0; j < var_rank[i]; j++) {
+#line 596
start[j] = var_shape[i][j];
+#line 596
err = nc_get_vars_long(ncid, i, start, edge, stride, value);
+#line 596
if(!canConvert) {
+#line 596
IF (err != NC_ECHAR)
+#line 596
error("conversion: status = %d", err);
+#line 596
} else {
+#line 596
IF (err != NC_EINVALCOORDS)
+#line 596
error("bad index: status = %d", err);
+#line 596
start[j] = 0;
+#line 596
edge[j] = var_shape[i][j] + 1;
+#line 596
err = nc_get_vars_long(ncid, i, start, edge, stride, value);
+#line 596
IF (err != NC_EEDGE)
+#line 596
error("bad edge: status = %d", err);
+#line 596
edge[j] = 1;
+#line 596
stride[j] = 0;
+#line 596
err = nc_get_vars_long(ncid, i, start, edge, stride, value);
+#line 596
IF (err != NC_ESTRIDE)
+#line 596
error("bad stride: status = %d", err);
+#line 596
stride[j] = 1;
+#line 596
}
+#line 596
}
+#line 596
/* Choose a random point dividing each dim into 2 parts */
+#line 596
/* get 2^rank (nslabs) slabs so defined */
+#line 596
nslabs = 1;
+#line 596
for (j = 0; j < var_rank[i]; j++) {
+#line 596
mid[j] = roll( var_shape[i][j] );
+#line 596
nslabs *= 2;
+#line 596
}
+#line 596
/* bits of k determine whether to get lower or upper part of dim */
+#line 596
/* choose random stride from 1 to edge */
+#line 596
for (k = 0; k < nslabs; k++) {
+#line 596
nstarts = 1;
+#line 596
for (j = 0; j < var_rank[i]; j++) {
+#line 596
if ((k >> j) & 1) {
+#line 596
start[j] = 0;
+#line 596
edge[j] = mid[j];
+#line 596
}else{
+#line 596
start[j] = mid[j];
+#line 596
edge[j] = var_shape[i][j] - mid[j];
+#line 596
}
+#line 596
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 596
nstarts *= stride[j];
+#line 596
}
+#line 596
for (m = 0; m < nstarts; m++) {
+#line 596
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 596
IF (err)
+#line 596
error("error in toMixedBase");
+#line 596
nels = 1;
+#line 596
for (j = 0; j < var_rank[i]; j++) {
+#line 596
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 596
nels *= count[j];
+#line 596
index[j] += start[j];
+#line 596
}
+#line 596
/* Random choice of forward or backward */
+#line 596
/* TODO
+#line 596
if ( roll(2) ) {
+#line 596
for (j = 0; j < var_rank[i]; j++) {
+#line 596
index[j] += (count[j] - 1) * stride[j];
+#line 596
stride[j] = -stride[j];
+#line 596
}
+#line 596
}
+#line 596
*/
+#line 596
allInExtRange = allInIntRange = 1;
+#line 596
for (j = 0; j < nels; j++) {
+#line 596
err = toMixedBase(j, var_rank[i], count, index2);
+#line 596
IF (err)
+#line 596
error("error in toMixedBase 1");
+#line 596
for (d = 0; d < var_rank[i]; d++)
+#line 596
index2[d] = index[d] + index2[d] * stride[d];
+#line 596
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 596
NCT_LONG);
+#line 596
if (inRange3(expect[j],var_type[i],NCT_LONG)) {
+#line 596
allInIntRange = allInIntRange && expect[j] >= long_min
+#line 596
&& expect[j] <= long_max;
+#line 596
} else {
+#line 596
allInExtRange = 0;
+#line 596
}
+#line 596
}
+#line 596
if (var_rank[i] == 0 && i%2 )
+#line 596
err = nc_get_vars_long(ncid, i, NULL, NULL, NULL, value);
+#line 596
else
+#line 596
err = nc_get_vars_long(ncid, i, index, count, stride, value);
+#line 596
if (canConvert) {
+#line 596
if (allInExtRange) {
+#line 596
if (allInIntRange) {
+#line 596
IF (err)
+#line 596
error("%s", nc_strerror(err));
+#line 596
} else {
+#line 596
IF (err != NC_ERANGE)
+#line 596
error("Range error: status = %d", err);
+#line 596
}
+#line 596
} else {
+#line 596
IF (err != 0 && err != NC_ERANGE)
+#line 596
error("OK or Range error: status = %d", err);
+#line 596
}
+#line 596
for (j = 0; j < nels; j++) {
+#line 596
if (inRange3(expect[j],var_type[i],NCT_LONG)
+#line 596
&& expect[j] >= long_min && expect[j] <= long_max) {
+#line 596
IF (!equal(value[j],expect[j],var_type[i], NCT_LONG)){
+#line 596
error("value read not that expected");
+#line 596
if (verbose) {
+#line 596
error("\n");
+#line 596
error("varid: %d, ", i);
+#line 596
error("var_name: %s, ", var_name[i]);
+#line 596
error("element number: %d ", j);
+#line 596
error("expect: %g, ", expect[j]);
+#line 596
error("got: %g", (double) value[j]);
+#line 596
}
+#line 596
} else {
+#line 596
nok++;
+#line 596
}
+#line 596
}
+#line 596
}
+#line 596
} else {
+#line 596
IF (nels > 0 && err != NC_ECHAR)
+#line 596
error("wrong type: status = %d", err);
+#line 596
}
+#line 596
}
+#line 596
}
+#line 596
+#line 596
}
+#line 596
err = nc_close(ncid);
+#line 596
IF (err)
+#line 596
error("nc_close: %s", nc_strerror(err));
+#line 596
print_nok(nok);
+#line 596
}
+#line 596
void
+#line 597
test_nc_get_vars_float(void)
+#line 597
{
+#line 597
int ncid;
+#line 597
int d;
+#line 597
int i;
+#line 597
int j;
+#line 597
int k;
+#line 597
int m;
+#line 597
int err;
+#line 597
int allInExtRange; /* all values within external range? */
+#line 597
int allInIntRange; /* all values within internal range? */
+#line 597
int nels;
+#line 597
int nslabs;
+#line 597
int nstarts; /* number of different starts */
+#line 597
int nok = 0; /* count of valid comparisons */
+#line 597
size_t start[MAX_RANK];
+#line 597
size_t edge[MAX_RANK];
+#line 597
size_t index[MAX_RANK];
+#line 597
size_t index2[MAX_RANK];
+#line 597
size_t mid[MAX_RANK];
+#line 597
size_t count[MAX_RANK];
+#line 597
size_t sstride[MAX_RANK];
+#line 597
ptrdiff_t stride[MAX_RANK];
+#line 597
int canConvert; /* Both text or both numeric */
+#line 597
float value[MAX_NELS];
+#line 597
double expect[MAX_NELS];
+#line 597
+#line 597
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 597
IF (err)
+#line 597
error("nc_open: %s", nc_strerror(err));
+#line 597
for (i = 0; i < NVARS; i++) {
+#line 597
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 597
assert(var_rank[i] <= MAX_RANK);
+#line 597
assert(var_nels[i] <= MAX_NELS);
+#line 597
for (j = 0; j < var_rank[i]; j++) {
+#line 597
start[j] = 0;
+#line 597
edge[j] = 1;
+#line 597
stride[j] = 1;
+#line 597
}
+#line 597
err = nc_get_vars_float(BAD_ID, i, start, edge, stride, value);
+#line 597
IF (err != NC_EBADID)
+#line 597
error("bad ncid: status = %d", err);
+#line 597
err = nc_get_vars_float(ncid, BAD_VARID, start, edge, stride, value);
+#line 597
IF (err != NC_ENOTVAR)
+#line 597
error("bad var id: status = %d", err);
+#line 597
for (j = 0; j < var_rank[i]; j++) {
+#line 597
start[j] = var_shape[i][j];
+#line 597
err = nc_get_vars_float(ncid, i, start, edge, stride, value);
+#line 597
if(!canConvert) {
+#line 597
IF (err != NC_ECHAR)
+#line 597
error("conversion: status = %d", err);
+#line 597
} else {
+#line 597
IF (err != NC_EINVALCOORDS)
+#line 597
error("bad index: status = %d", err);
+#line 597
start[j] = 0;
+#line 597
edge[j] = var_shape[i][j] + 1;
+#line 597
err = nc_get_vars_float(ncid, i, start, edge, stride, value);
+#line 597
IF (err != NC_EEDGE)
+#line 597
error("bad edge: status = %d", err);
+#line 597
edge[j] = 1;
+#line 597
stride[j] = 0;
+#line 597
err = nc_get_vars_float(ncid, i, start, edge, stride, value);
+#line 597
IF (err != NC_ESTRIDE)
+#line 597
error("bad stride: status = %d", err);
+#line 597
stride[j] = 1;
+#line 597
}
+#line 597
}
+#line 597
/* Choose a random point dividing each dim into 2 parts */
+#line 597
/* get 2^rank (nslabs) slabs so defined */
+#line 597
nslabs = 1;
+#line 597
for (j = 0; j < var_rank[i]; j++) {
+#line 597
mid[j] = roll( var_shape[i][j] );
+#line 597
nslabs *= 2;
+#line 597
}
+#line 597
/* bits of k determine whether to get lower or upper part of dim */
+#line 597
/* choose random stride from 1 to edge */
+#line 597
for (k = 0; k < nslabs; k++) {
+#line 597
nstarts = 1;
+#line 597
for (j = 0; j < var_rank[i]; j++) {
+#line 597
if ((k >> j) & 1) {
+#line 597
start[j] = 0;
+#line 597
edge[j] = mid[j];
+#line 597
}else{
+#line 597
start[j] = mid[j];
+#line 597
edge[j] = var_shape[i][j] - mid[j];
+#line 597
}
+#line 597
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 597
nstarts *= stride[j];
+#line 597
}
+#line 597
for (m = 0; m < nstarts; m++) {
+#line 597
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 597
IF (err)
+#line 597
error("error in toMixedBase");
+#line 597
nels = 1;
+#line 597
for (j = 0; j < var_rank[i]; j++) {
+#line 597
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 597
nels *= count[j];
+#line 597
index[j] += start[j];
+#line 597
}
+#line 597
/* Random choice of forward or backward */
+#line 597
/* TODO
+#line 597
if ( roll(2) ) {
+#line 597
for (j = 0; j < var_rank[i]; j++) {
+#line 597
index[j] += (count[j] - 1) * stride[j];
+#line 597
stride[j] = -stride[j];
+#line 597
}
+#line 597
}
+#line 597
*/
+#line 597
allInExtRange = allInIntRange = 1;
+#line 597
for (j = 0; j < nels; j++) {
+#line 597
err = toMixedBase(j, var_rank[i], count, index2);
+#line 597
IF (err)
+#line 597
error("error in toMixedBase 1");
+#line 597
for (d = 0; d < var_rank[i]; d++)
+#line 597
index2[d] = index[d] + index2[d] * stride[d];
+#line 597
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 597
NCT_FLOAT);
+#line 597
if (inRange3(expect[j],var_type[i],NCT_FLOAT)) {
+#line 597
allInIntRange = allInIntRange && expect[j] >= float_min
+#line 597
&& expect[j] <= float_max;
+#line 597
} else {
+#line 597
allInExtRange = 0;
+#line 597
}
+#line 597
}
+#line 597
if (var_rank[i] == 0 && i%2 )
+#line 597
err = nc_get_vars_float(ncid, i, NULL, NULL, NULL, value);
+#line 597
else
+#line 597
err = nc_get_vars_float(ncid, i, index, count, stride, value);
+#line 597
if (canConvert) {
+#line 597
if (allInExtRange) {
+#line 597
if (allInIntRange) {
+#line 597
IF (err)
+#line 597
error("%s", nc_strerror(err));
+#line 597
} else {
+#line 597
IF (err != NC_ERANGE)
+#line 597
error("Range error: status = %d", err);
+#line 597
}
+#line 597
} else {
+#line 597
IF (err != 0 && err != NC_ERANGE)
+#line 597
error("OK or Range error: status = %d", err);
+#line 597
}
+#line 597
for (j = 0; j < nels; j++) {
+#line 597
if (inRange3(expect[j],var_type[i],NCT_FLOAT)
+#line 597
&& expect[j] >= float_min && expect[j] <= float_max) {
+#line 597
IF (!equal(value[j],expect[j],var_type[i], NCT_FLOAT)){
+#line 597
error("value read not that expected");
+#line 597
if (verbose) {
+#line 597
error("\n");
+#line 597
error("varid: %d, ", i);
+#line 597
error("var_name: %s, ", var_name[i]);
+#line 597
error("element number: %d ", j);
+#line 597
error("expect: %g, ", expect[j]);
+#line 597
error("got: %g", (double) value[j]);
+#line 597
}
+#line 597
} else {
+#line 597
nok++;
+#line 597
}
+#line 597
}
+#line 597
}
+#line 597
} else {
+#line 597
IF (nels > 0 && err != NC_ECHAR)
+#line 597
error("wrong type: status = %d", err);
+#line 597
}
+#line 597
}
+#line 597
}
+#line 597
+#line 597
}
+#line 597
err = nc_close(ncid);
+#line 597
IF (err)
+#line 597
error("nc_close: %s", nc_strerror(err));
+#line 597
print_nok(nok);
+#line 597
}
+#line 597
void
+#line 598
test_nc_get_vars_double(void)
+#line 598
{
+#line 598
int ncid;
+#line 598
int d;
+#line 598
int i;
+#line 598
int j;
+#line 598
int k;
+#line 598
int m;
+#line 598
int err;
+#line 598
int allInExtRange; /* all values within external range? */
+#line 598
int allInIntRange; /* all values within internal range? */
+#line 598
int nels;
+#line 598
int nslabs;
+#line 598
int nstarts; /* number of different starts */
+#line 598
int nok = 0; /* count of valid comparisons */
+#line 598
size_t start[MAX_RANK];
+#line 598
size_t edge[MAX_RANK];
+#line 598
size_t index[MAX_RANK];
+#line 598
size_t index2[MAX_RANK];
+#line 598
size_t mid[MAX_RANK];
+#line 598
size_t count[MAX_RANK];
+#line 598
size_t sstride[MAX_RANK];
+#line 598
ptrdiff_t stride[MAX_RANK];
+#line 598
int canConvert; /* Both text or both numeric */
+#line 598
double value[MAX_NELS];
+#line 598
double expect[MAX_NELS];
+#line 598
+#line 598
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 598
IF (err)
+#line 598
error("nc_open: %s", nc_strerror(err));
+#line 598
for (i = 0; i < NVARS; i++) {
+#line 598
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 598
assert(var_rank[i] <= MAX_RANK);
+#line 598
assert(var_nels[i] <= MAX_NELS);
+#line 598
for (j = 0; j < var_rank[i]; j++) {
+#line 598
start[j] = 0;
+#line 598
edge[j] = 1;
+#line 598
stride[j] = 1;
+#line 598
}
+#line 598
err = nc_get_vars_double(BAD_ID, i, start, edge, stride, value);
+#line 598
IF (err != NC_EBADID)
+#line 598
error("bad ncid: status = %d", err);
+#line 598
err = nc_get_vars_double(ncid, BAD_VARID, start, edge, stride, value);
+#line 598
IF (err != NC_ENOTVAR)
+#line 598
error("bad var id: status = %d", err);
+#line 598
for (j = 0; j < var_rank[i]; j++) {
+#line 598
start[j] = var_shape[i][j];
+#line 598
err = nc_get_vars_double(ncid, i, start, edge, stride, value);
+#line 598
if(!canConvert) {
+#line 598
IF (err != NC_ECHAR)
+#line 598
error("conversion: status = %d", err);
+#line 598
} else {
+#line 598
IF (err != NC_EINVALCOORDS)
+#line 598
error("bad index: status = %d", err);
+#line 598
start[j] = 0;
+#line 598
edge[j] = var_shape[i][j] + 1;
+#line 598
err = nc_get_vars_double(ncid, i, start, edge, stride, value);
+#line 598
IF (err != NC_EEDGE)
+#line 598
error("bad edge: status = %d", err);
+#line 598
edge[j] = 1;
+#line 598
stride[j] = 0;
+#line 598
err = nc_get_vars_double(ncid, i, start, edge, stride, value);
+#line 598
IF (err != NC_ESTRIDE)
+#line 598
error("bad stride: status = %d", err);
+#line 598
stride[j] = 1;
+#line 598
}
+#line 598
}
+#line 598
/* Choose a random point dividing each dim into 2 parts */
+#line 598
/* get 2^rank (nslabs) slabs so defined */
+#line 598
nslabs = 1;
+#line 598
for (j = 0; j < var_rank[i]; j++) {
+#line 598
mid[j] = roll( var_shape[i][j] );
+#line 598
nslabs *= 2;
+#line 598
}
+#line 598
/* bits of k determine whether to get lower or upper part of dim */
+#line 598
/* choose random stride from 1 to edge */
+#line 598
for (k = 0; k < nslabs; k++) {
+#line 598
nstarts = 1;
+#line 598
for (j = 0; j < var_rank[i]; j++) {
+#line 598
if ((k >> j) & 1) {
+#line 598
start[j] = 0;
+#line 598
edge[j] = mid[j];
+#line 598
}else{
+#line 598
start[j] = mid[j];
+#line 598
edge[j] = var_shape[i][j] - mid[j];
+#line 598
}
+#line 598
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 598
nstarts *= stride[j];
+#line 598
}
+#line 598
for (m = 0; m < nstarts; m++) {
+#line 598
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 598
IF (err)
+#line 598
error("error in toMixedBase");
+#line 598
nels = 1;
+#line 598
for (j = 0; j < var_rank[i]; j++) {
+#line 598
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 598
nels *= count[j];
+#line 598
index[j] += start[j];
+#line 598
}
+#line 598
/* Random choice of forward or backward */
+#line 598
/* TODO
+#line 598
if ( roll(2) ) {
+#line 598
for (j = 0; j < var_rank[i]; j++) {
+#line 598
index[j] += (count[j] - 1) * stride[j];
+#line 598
stride[j] = -stride[j];
+#line 598
}
+#line 598
}
+#line 598
*/
+#line 598
allInExtRange = allInIntRange = 1;
+#line 598
for (j = 0; j < nels; j++) {
+#line 598
err = toMixedBase(j, var_rank[i], count, index2);
+#line 598
IF (err)
+#line 598
error("error in toMixedBase 1");
+#line 598
for (d = 0; d < var_rank[i]; d++)
+#line 598
index2[d] = index[d] + index2[d] * stride[d];
+#line 598
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 598
NCT_DOUBLE);
+#line 598
if (inRange3(expect[j],var_type[i],NCT_DOUBLE)) {
+#line 598
allInIntRange = allInIntRange && expect[j] >= double_min
+#line 598
&& expect[j] <= double_max;
+#line 598
} else {
+#line 598
allInExtRange = 0;
+#line 598
}
+#line 598
}
+#line 598
if (var_rank[i] == 0 && i%2 )
+#line 598
err = nc_get_vars_double(ncid, i, NULL, NULL, NULL, value);
+#line 598
else
+#line 598
err = nc_get_vars_double(ncid, i, index, count, stride, value);
+#line 598
if (canConvert) {
+#line 598
if (allInExtRange) {
+#line 598
if (allInIntRange) {
+#line 598
IF (err)
+#line 598
error("%s", nc_strerror(err));
+#line 598
} else {
+#line 598
IF (err != NC_ERANGE)
+#line 598
error("Range error: status = %d", err);
+#line 598
}
+#line 598
} else {
+#line 598
IF (err != 0 && err != NC_ERANGE)
+#line 598
error("OK or Range error: status = %d", err);
+#line 598
}
+#line 598
for (j = 0; j < nels; j++) {
+#line 598
if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
+#line 598
&& expect[j] >= double_min && expect[j] <= double_max) {
+#line 598
IF (!equal(value[j],expect[j],var_type[i], NCT_DOUBLE)){
+#line 598
error("value read not that expected");
+#line 598
if (verbose) {
+#line 598
error("\n");
+#line 598
error("varid: %d, ", i);
+#line 598
error("var_name: %s, ", var_name[i]);
+#line 598
error("element number: %d ", j);
+#line 598
error("expect: %g, ", expect[j]);
+#line 598
error("got: %g", (double) value[j]);
+#line 598
}
+#line 598
} else {
+#line 598
nok++;
+#line 598
}
+#line 598
}
+#line 598
}
+#line 598
} else {
+#line 598
IF (nels > 0 && err != NC_ECHAR)
+#line 598
error("wrong type: status = %d", err);
+#line 598
}
+#line 598
}
+#line 598
}
+#line 598
+#line 598
}
+#line 598
err = nc_close(ncid);
+#line 598
IF (err)
+#line 598
error("nc_close: %s", nc_strerror(err));
+#line 598
print_nok(nok);
+#line 598
}
+#line 598
+#line 787
void
+#line 788
test_nc_get_varm_text(void)
+#line 788
{
+#line 788
int ncid;
+#line 788
int d;
+#line 788
int i;
+#line 788
int j;
+#line 788
int k;
+#line 788
int m;
+#line 788
int err;
+#line 788
int allInExtRange; /* all values within external range? */
+#line 788
int allInIntRange; /* all values within internal range? */
+#line 788
int nels;
+#line 788
int nslabs;
+#line 788
int nstarts; /* number of different starts */
+#line 788
int nok = 0; /* count of valid comparisons */
+#line 788
size_t start[MAX_RANK];
+#line 788
size_t edge[MAX_RANK];
+#line 788
size_t index[MAX_RANK];
+#line 788
size_t index2[MAX_RANK];
+#line 788
size_t mid[MAX_RANK];
+#line 788
size_t count[MAX_RANK];
+#line 788
size_t sstride[MAX_RANK];
+#line 788
ptrdiff_t stride[MAX_RANK];
+#line 788
ptrdiff_t imap[MAX_RANK];
+#line 788
int canConvert; /* Both text or both numeric */
+#line 788
text value[MAX_NELS];
+#line 788
double expect[MAX_NELS];
+#line 788
+#line 788
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 788
IF (err)
+#line 788
error("nc_open: %s", nc_strerror(err));
+#line 788
for (i = 0; i < NVARS; i++) {
+#line 788
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 788
assert(var_rank[i] <= MAX_RANK);
+#line 788
assert(var_nels[i] <= MAX_NELS);
+#line 788
for (j = 0; j < var_rank[i]; j++) {
+#line 788
start[j] = 0;
+#line 788
edge[j] = 1;
+#line 788
stride[j] = 1;
+#line 788
imap[j] = 1;
+#line 788
}
+#line 788
err = nc_get_varm_text(BAD_ID, i, start, edge, stride, imap, value);
+#line 788
IF (err != NC_EBADID)
+#line 788
error("bad ncid: status = %d", err);
+#line 788
err = nc_get_varm_text(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 788
IF (err != NC_ENOTVAR)
+#line 788
error("bad var id: status = %d", err);
+#line 788
for (j = 0; j < var_rank[i]; j++) {
+#line 788
start[j] = var_shape[i][j];
+#line 788
err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
+#line 788
if(!canConvert) {
+#line 788
IF (err != NC_ECHAR)
+#line 788
error("conversion: status = %d", err);
+#line 788
} else {
+#line 788
IF (err != NC_EINVALCOORDS)
+#line 788
error("bad index: status = %d", err);
+#line 788
start[j] = 0;
+#line 788
edge[j] = var_shape[i][j] + 1;
+#line 788
err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
+#line 788
IF (err != NC_EEDGE)
+#line 788
error("bad edge: status = %d", err);
+#line 788
edge[j] = 1;
+#line 788
stride[j] = 0;
+#line 788
err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
+#line 788
IF (err != NC_ESTRIDE)
+#line 788
error("bad stride: status = %d", err);
+#line 788
stride[j] = 1;
+#line 788
}
+#line 788
}
+#line 788
/* Choose a random point dividing each dim into 2 parts */
+#line 788
/* get 2^rank (nslabs) slabs so defined */
+#line 788
nslabs = 1;
+#line 788
for (j = 0; j < var_rank[i]; j++) {
+#line 788
mid[j] = roll( var_shape[i][j] );
+#line 788
nslabs *= 2;
+#line 788
}
+#line 788
/* bits of k determine whether to get lower or upper part of dim */
+#line 788
/* choose random stride from 1 to edge */
+#line 788
for (k = 0; k < nslabs; k++) {
+#line 788
nstarts = 1;
+#line 788
for (j = 0; j < var_rank[i]; j++) {
+#line 788
if ((k >> j) & 1) {
+#line 788
start[j] = 0;
+#line 788
edge[j] = mid[j];
+#line 788
}else{
+#line 788
start[j] = mid[j];
+#line 788
edge[j] = var_shape[i][j] - mid[j];
+#line 788
}
+#line 788
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 788
nstarts *= stride[j];
+#line 788
}
+#line 788
for (m = 0; m < nstarts; m++) {
+#line 788
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 788
IF (err)
+#line 788
error("error in toMixedBase");
+#line 788
nels = 1;
+#line 788
for (j = 0; j < var_rank[i]; j++) {
+#line 788
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 788
nels *= count[j];
+#line 788
index[j] += start[j];
+#line 788
}
+#line 788
/* Random choice of forward or backward */
+#line 788
/* TODO
+#line 788
if ( roll(2) ) {
+#line 788
for (j = 0; j < var_rank[i]; j++) {
+#line 788
index[j] += (count[j] - 1) * stride[j];
+#line 788
stride[j] = -stride[j];
+#line 788
}
+#line 788
}
+#line 788
*/
+#line 788
if (var_rank[i] > 0) {
+#line 788
j = var_rank[i] - 1;
+#line 788
imap[j] = 1;
+#line 788
for (; j > 0; j--)
+#line 788
imap[j-1] = imap[j] * count[j];
+#line 788
}
+#line 788
allInExtRange = allInIntRange = 1;
+#line 788
for (j = 0; j < nels; j++) {
+#line 788
err = toMixedBase(j, var_rank[i], count, index2);
+#line 788
IF (err)
+#line 788
error("error in toMixedBase 1");
+#line 788
for (d = 0; d < var_rank[i]; d++)
+#line 788
index2[d] = index[d] + index2[d] * stride[d];
+#line 788
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 788
NCT_TEXT);
+#line 788
if (inRange3(expect[j],var_type[i],NCT_TEXT)) {
+#line 788
allInIntRange = allInIntRange && expect[j] >= text_min
+#line 788
&& expect[j] <= text_max;
+#line 788
} else {
+#line 788
allInExtRange = 0;
+#line 788
}
+#line 788
}
+#line 788
if (var_rank[i] == 0 && i%2 )
+#line 788
err = nc_get_varm_text(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 788
else
+#line 788
err = nc_get_varm_text(ncid,i,index,count,stride,imap,value);
+#line 788
if (canConvert) {
+#line 788
if (allInExtRange) {
+#line 788
if (allInIntRange) {
+#line 788
IF (err)
+#line 788
error("%s", nc_strerror(err));
+#line 788
} else {
+#line 788
IF (err != NC_ERANGE)
+#line 788
error("Range error: status = %d", err);
+#line 788
}
+#line 788
} else {
+#line 788
IF (err != 0 && err != NC_ERANGE)
+#line 788
error("OK or Range error: status = %d", err);
+#line 788
}
+#line 788
for (j = 0; j < nels; j++) {
+#line 788
if (inRange3(expect[j],var_type[i],NCT_TEXT)
+#line 788
&& expect[j] >= text_min
+#line 788
&& expect[j] <= text_max) {
+#line 788
IF (!equal(value[j],expect[j],var_type[i], NCT_TEXT)){
+#line 788
error("value read not that expected");
+#line 788
if (verbose) {
+#line 788
error("\n");
+#line 788
error("varid: %d, ", i);
+#line 788
error("var_name: %s, ", var_name[i]);
+#line 788
error("element number: %d ", j);
+#line 788
error("expect: %g, ", expect[j]);
+#line 788
error("got: %g", (double) value[j]);
+#line 788
}
+#line 788
} else {
+#line 788
nok++;
+#line 788
}
+#line 788
}
+#line 788
}
+#line 788
} else {
+#line 788
IF (nels > 0 && err != NC_ECHAR)
+#line 788
error("wrong type: status = %d", err);
+#line 788
}
+#line 788
}
+#line 788
}
+#line 788
}
+#line 788
err = nc_close(ncid);
+#line 788
IF (err)
+#line 788
error("nc_close: %s", nc_strerror(err));
+#line 788
print_nok(nok);
+#line 788
}
+#line 788
void
+#line 789
test_nc_get_varm_uchar(void)
+#line 789
{
+#line 789
int ncid;
+#line 789
int d;
+#line 789
int i;
+#line 789
int j;
+#line 789
int k;
+#line 789
int m;
+#line 789
int err;
+#line 789
int allInExtRange; /* all values within external range? */
+#line 789
int allInIntRange; /* all values within internal range? */
+#line 789
int nels;
+#line 789
int nslabs;
+#line 789
int nstarts; /* number of different starts */
+#line 789
int nok = 0; /* count of valid comparisons */
+#line 789
size_t start[MAX_RANK];
+#line 789
size_t edge[MAX_RANK];
+#line 789
size_t index[MAX_RANK];
+#line 789
size_t index2[MAX_RANK];
+#line 789
size_t mid[MAX_RANK];
+#line 789
size_t count[MAX_RANK];
+#line 789
size_t sstride[MAX_RANK];
+#line 789
ptrdiff_t stride[MAX_RANK];
+#line 789
ptrdiff_t imap[MAX_RANK];
+#line 789
int canConvert; /* Both text or both numeric */
+#line 789
uchar value[MAX_NELS];
+#line 789
double expect[MAX_NELS];
+#line 789
+#line 789
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 789
IF (err)
+#line 789
error("nc_open: %s", nc_strerror(err));
+#line 789
for (i = 0; i < NVARS; i++) {
+#line 789
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 789
assert(var_rank[i] <= MAX_RANK);
+#line 789
assert(var_nels[i] <= MAX_NELS);
+#line 789
for (j = 0; j < var_rank[i]; j++) {
+#line 789
start[j] = 0;
+#line 789
edge[j] = 1;
+#line 789
stride[j] = 1;
+#line 789
imap[j] = 1;
+#line 789
}
+#line 789
err = nc_get_varm_uchar(BAD_ID, i, start, edge, stride, imap, value);
+#line 789
IF (err != NC_EBADID)
+#line 789
error("bad ncid: status = %d", err);
+#line 789
err = nc_get_varm_uchar(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 789
IF (err != NC_ENOTVAR)
+#line 789
error("bad var id: status = %d", err);
+#line 789
for (j = 0; j < var_rank[i]; j++) {
+#line 789
start[j] = var_shape[i][j];
+#line 789
err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
+#line 789
if(!canConvert) {
+#line 789
IF (err != NC_ECHAR)
+#line 789
error("conversion: status = %d", err);
+#line 789
} else {
+#line 789
IF (err != NC_EINVALCOORDS)
+#line 789
error("bad index: status = %d", err);
+#line 789
start[j] = 0;
+#line 789
edge[j] = var_shape[i][j] + 1;
+#line 789
err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
+#line 789
IF (err != NC_EEDGE)
+#line 789
error("bad edge: status = %d", err);
+#line 789
edge[j] = 1;
+#line 789
stride[j] = 0;
+#line 789
err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
+#line 789
IF (err != NC_ESTRIDE)
+#line 789
error("bad stride: status = %d", err);
+#line 789
stride[j] = 1;
+#line 789
}
+#line 789
}
+#line 789
/* Choose a random point dividing each dim into 2 parts */
+#line 789
/* get 2^rank (nslabs) slabs so defined */
+#line 789
nslabs = 1;
+#line 789
for (j = 0; j < var_rank[i]; j++) {
+#line 789
mid[j] = roll( var_shape[i][j] );
+#line 789
nslabs *= 2;
+#line 789
}
+#line 789
/* bits of k determine whether to get lower or upper part of dim */
+#line 789
/* choose random stride from 1 to edge */
+#line 789
for (k = 0; k < nslabs; k++) {
+#line 789
nstarts = 1;
+#line 789
for (j = 0; j < var_rank[i]; j++) {
+#line 789
if ((k >> j) & 1) {
+#line 789
start[j] = 0;
+#line 789
edge[j] = mid[j];
+#line 789
}else{
+#line 789
start[j] = mid[j];
+#line 789
edge[j] = var_shape[i][j] - mid[j];
+#line 789
}
+#line 789
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 789
nstarts *= stride[j];
+#line 789
}
+#line 789
for (m = 0; m < nstarts; m++) {
+#line 789
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 789
IF (err)
+#line 789
error("error in toMixedBase");
+#line 789
nels = 1;
+#line 789
for (j = 0; j < var_rank[i]; j++) {
+#line 789
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 789
nels *= count[j];
+#line 789
index[j] += start[j];
+#line 789
}
+#line 789
/* Random choice of forward or backward */
+#line 789
/* TODO
+#line 789
if ( roll(2) ) {
+#line 789
for (j = 0; j < var_rank[i]; j++) {
+#line 789
index[j] += (count[j] - 1) * stride[j];
+#line 789
stride[j] = -stride[j];
+#line 789
}
+#line 789
}
+#line 789
*/
+#line 789
if (var_rank[i] > 0) {
+#line 789
j = var_rank[i] - 1;
+#line 789
imap[j] = 1;
+#line 789
for (; j > 0; j--)
+#line 789
imap[j-1] = imap[j] * count[j];
+#line 789
}
+#line 789
allInExtRange = allInIntRange = 1;
+#line 789
for (j = 0; j < nels; j++) {
+#line 789
err = toMixedBase(j, var_rank[i], count, index2);
+#line 789
IF (err)
+#line 789
error("error in toMixedBase 1");
+#line 789
for (d = 0; d < var_rank[i]; d++)
+#line 789
index2[d] = index[d] + index2[d] * stride[d];
+#line 789
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 789
NCT_UCHAR);
+#line 789
if (inRange3(expect[j],var_type[i],NCT_UCHAR)) {
+#line 789
allInIntRange = allInIntRange && expect[j] >= uchar_min
+#line 789
&& expect[j] <= uchar_max;
+#line 789
} else {
+#line 789
allInExtRange = 0;
+#line 789
}
+#line 789
}
+#line 789
if (var_rank[i] == 0 && i%2 )
+#line 789
err = nc_get_varm_uchar(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 789
else
+#line 789
err = nc_get_varm_uchar(ncid,i,index,count,stride,imap,value);
+#line 789
if (canConvert) {
+#line 789
if (allInExtRange) {
+#line 789
if (allInIntRange) {
+#line 789
IF (err)
+#line 789
error("%s", nc_strerror(err));
+#line 789
} else {
+#line 789
IF (err != NC_ERANGE)
+#line 789
error("Range error: status = %d", err);
+#line 789
}
+#line 789
} else {
+#line 789
IF (err != 0 && err != NC_ERANGE)
+#line 789
error("OK or Range error: status = %d", err);
+#line 789
}
+#line 789
for (j = 0; j < nels; j++) {
+#line 789
if (inRange3(expect[j],var_type[i],NCT_UCHAR)
+#line 789
&& expect[j] >= uchar_min
+#line 789
&& expect[j] <= uchar_max) {
+#line 789
IF (!equal(value[j],expect[j],var_type[i], NCT_UCHAR)){
+#line 789
error("value read not that expected");
+#line 789
if (verbose) {
+#line 789
error("\n");
+#line 789
error("varid: %d, ", i);
+#line 789
error("var_name: %s, ", var_name[i]);
+#line 789
error("element number: %d ", j);
+#line 789
error("expect: %g, ", expect[j]);
+#line 789
error("got: %g", (double) value[j]);
+#line 789
}
+#line 789
} else {
+#line 789
nok++;
+#line 789
}
+#line 789
}
+#line 789
}
+#line 789
} else {
+#line 789
IF (nels > 0 && err != NC_ECHAR)
+#line 789
error("wrong type: status = %d", err);
+#line 789
}
+#line 789
}
+#line 789
}
+#line 789
}
+#line 789
err = nc_close(ncid);
+#line 789
IF (err)
+#line 789
error("nc_close: %s", nc_strerror(err));
+#line 789
print_nok(nok);
+#line 789
}
+#line 789
void
+#line 790
test_nc_get_varm_schar(void)
+#line 790
{
+#line 790
int ncid;
+#line 790
int d;
+#line 790
int i;
+#line 790
int j;
+#line 790
int k;
+#line 790
int m;
+#line 790
int err;
+#line 790
int allInExtRange; /* all values within external range? */
+#line 790
int allInIntRange; /* all values within internal range? */
+#line 790
int nels;
+#line 790
int nslabs;
+#line 790
int nstarts; /* number of different starts */
+#line 790
int nok = 0; /* count of valid comparisons */
+#line 790
size_t start[MAX_RANK];
+#line 790
size_t edge[MAX_RANK];
+#line 790
size_t index[MAX_RANK];
+#line 790
size_t index2[MAX_RANK];
+#line 790
size_t mid[MAX_RANK];
+#line 790
size_t count[MAX_RANK];
+#line 790
size_t sstride[MAX_RANK];
+#line 790
ptrdiff_t stride[MAX_RANK];
+#line 790
ptrdiff_t imap[MAX_RANK];
+#line 790
int canConvert; /* Both text or both numeric */
+#line 790
schar value[MAX_NELS];
+#line 790
double expect[MAX_NELS];
+#line 790
+#line 790
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 790
IF (err)
+#line 790
error("nc_open: %s", nc_strerror(err));
+#line 790
for (i = 0; i < NVARS; i++) {
+#line 790
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 790
assert(var_rank[i] <= MAX_RANK);
+#line 790
assert(var_nels[i] <= MAX_NELS);
+#line 790
for (j = 0; j < var_rank[i]; j++) {
+#line 790
start[j] = 0;
+#line 790
edge[j] = 1;
+#line 790
stride[j] = 1;
+#line 790
imap[j] = 1;
+#line 790
}
+#line 790
err = nc_get_varm_schar(BAD_ID, i, start, edge, stride, imap, value);
+#line 790
IF (err != NC_EBADID)
+#line 790
error("bad ncid: status = %d", err);
+#line 790
err = nc_get_varm_schar(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 790
IF (err != NC_ENOTVAR)
+#line 790
error("bad var id: status = %d", err);
+#line 790
for (j = 0; j < var_rank[i]; j++) {
+#line 790
start[j] = var_shape[i][j];
+#line 790
err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
+#line 790
if(!canConvert) {
+#line 790
IF (err != NC_ECHAR)
+#line 790
error("conversion: status = %d", err);
+#line 790
} else {
+#line 790
IF (err != NC_EINVALCOORDS)
+#line 790
error("bad index: status = %d", err);
+#line 790
start[j] = 0;
+#line 790
edge[j] = var_shape[i][j] + 1;
+#line 790
err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
+#line 790
IF (err != NC_EEDGE)
+#line 790
error("bad edge: status = %d", err);
+#line 790
edge[j] = 1;
+#line 790
stride[j] = 0;
+#line 790
err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
+#line 790
IF (err != NC_ESTRIDE)
+#line 790
error("bad stride: status = %d", err);
+#line 790
stride[j] = 1;
+#line 790
}
+#line 790
}
+#line 790
/* Choose a random point dividing each dim into 2 parts */
+#line 790
/* get 2^rank (nslabs) slabs so defined */
+#line 790
nslabs = 1;
+#line 790
for (j = 0; j < var_rank[i]; j++) {
+#line 790
mid[j] = roll( var_shape[i][j] );
+#line 790
nslabs *= 2;
+#line 790
}
+#line 790
/* bits of k determine whether to get lower or upper part of dim */
+#line 790
/* choose random stride from 1 to edge */
+#line 790
for (k = 0; k < nslabs; k++) {
+#line 790
nstarts = 1;
+#line 790
for (j = 0; j < var_rank[i]; j++) {
+#line 790
if ((k >> j) & 1) {
+#line 790
start[j] = 0;
+#line 790
edge[j] = mid[j];
+#line 790
}else{
+#line 790
start[j] = mid[j];
+#line 790
edge[j] = var_shape[i][j] - mid[j];
+#line 790
}
+#line 790
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 790
nstarts *= stride[j];
+#line 790
}
+#line 790
for (m = 0; m < nstarts; m++) {
+#line 790
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 790
IF (err)
+#line 790
error("error in toMixedBase");
+#line 790
nels = 1;
+#line 790
for (j = 0; j < var_rank[i]; j++) {
+#line 790
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 790
nels *= count[j];
+#line 790
index[j] += start[j];
+#line 790
}
+#line 790
/* Random choice of forward or backward */
+#line 790
/* TODO
+#line 790
if ( roll(2) ) {
+#line 790
for (j = 0; j < var_rank[i]; j++) {
+#line 790
index[j] += (count[j] - 1) * stride[j];
+#line 790
stride[j] = -stride[j];
+#line 790
}
+#line 790
}
+#line 790
*/
+#line 790
if (var_rank[i] > 0) {
+#line 790
j = var_rank[i] - 1;
+#line 790
imap[j] = 1;
+#line 790
for (; j > 0; j--)
+#line 790
imap[j-1] = imap[j] * count[j];
+#line 790
}
+#line 790
allInExtRange = allInIntRange = 1;
+#line 790
for (j = 0; j < nels; j++) {
+#line 790
err = toMixedBase(j, var_rank[i], count, index2);
+#line 790
IF (err)
+#line 790
error("error in toMixedBase 1");
+#line 790
for (d = 0; d < var_rank[i]; d++)
+#line 790
index2[d] = index[d] + index2[d] * stride[d];
+#line 790
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 790
NCT_SCHAR);
+#line 790
if (inRange3(expect[j],var_type[i],NCT_SCHAR)) {
+#line 790
allInIntRange = allInIntRange && expect[j] >= schar_min
+#line 790
&& expect[j] <= schar_max;
+#line 790
} else {
+#line 790
allInExtRange = 0;
+#line 790
}
+#line 790
}
+#line 790
if (var_rank[i] == 0 && i%2 )
+#line 790
err = nc_get_varm_schar(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 790
else
+#line 790
err = nc_get_varm_schar(ncid,i,index,count,stride,imap,value);
+#line 790
if (canConvert) {
+#line 790
if (allInExtRange) {
+#line 790
if (allInIntRange) {
+#line 790
IF (err)
+#line 790
error("%s", nc_strerror(err));
+#line 790
} else {
+#line 790
IF (err != NC_ERANGE)
+#line 790
error("Range error: status = %d", err);
+#line 790
}
+#line 790
} else {
+#line 790
IF (err != 0 && err != NC_ERANGE)
+#line 790
error("OK or Range error: status = %d", err);
+#line 790
}
+#line 790
for (j = 0; j < nels; j++) {
+#line 790
if (inRange3(expect[j],var_type[i],NCT_SCHAR)
+#line 790
&& expect[j] >= schar_min
+#line 790
&& expect[j] <= schar_max) {
+#line 790
IF (!equal(value[j],expect[j],var_type[i], NCT_SCHAR)){
+#line 790
error("value read not that expected");
+#line 790
if (verbose) {
+#line 790
error("\n");
+#line 790
error("varid: %d, ", i);
+#line 790
error("var_name: %s, ", var_name[i]);
+#line 790
error("element number: %d ", j);
+#line 790
error("expect: %g, ", expect[j]);
+#line 790
error("got: %g", (double) value[j]);
+#line 790
}
+#line 790
} else {
+#line 790
nok++;
+#line 790
}
+#line 790
}
+#line 790
}
+#line 790
} else {
+#line 790
IF (nels > 0 && err != NC_ECHAR)
+#line 790
error("wrong type: status = %d", err);
+#line 790
}
+#line 790
}
+#line 790
}
+#line 790
}
+#line 790
err = nc_close(ncid);
+#line 790
IF (err)
+#line 790
error("nc_close: %s", nc_strerror(err));
+#line 790
print_nok(nok);
+#line 790
}
+#line 790
void
+#line 791
test_nc_get_varm_short(void)
+#line 791
{
+#line 791
int ncid;
+#line 791
int d;
+#line 791
int i;
+#line 791
int j;
+#line 791
int k;
+#line 791
int m;
+#line 791
int err;
+#line 791
int allInExtRange; /* all values within external range? */
+#line 791
int allInIntRange; /* all values within internal range? */
+#line 791
int nels;
+#line 791
int nslabs;
+#line 791
int nstarts; /* number of different starts */
+#line 791
int nok = 0; /* count of valid comparisons */
+#line 791
size_t start[MAX_RANK];
+#line 791
size_t edge[MAX_RANK];
+#line 791
size_t index[MAX_RANK];
+#line 791
size_t index2[MAX_RANK];
+#line 791
size_t mid[MAX_RANK];
+#line 791
size_t count[MAX_RANK];
+#line 791
size_t sstride[MAX_RANK];
+#line 791
ptrdiff_t stride[MAX_RANK];
+#line 791
ptrdiff_t imap[MAX_RANK];
+#line 791
int canConvert; /* Both text or both numeric */
+#line 791
short value[MAX_NELS];
+#line 791
double expect[MAX_NELS];
+#line 791
+#line 791
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 791
IF (err)
+#line 791
error("nc_open: %s", nc_strerror(err));
+#line 791
for (i = 0; i < NVARS; i++) {
+#line 791
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 791
assert(var_rank[i] <= MAX_RANK);
+#line 791
assert(var_nels[i] <= MAX_NELS);
+#line 791
for (j = 0; j < var_rank[i]; j++) {
+#line 791
start[j] = 0;
+#line 791
edge[j] = 1;
+#line 791
stride[j] = 1;
+#line 791
imap[j] = 1;
+#line 791
}
+#line 791
err = nc_get_varm_short(BAD_ID, i, start, edge, stride, imap, value);
+#line 791
IF (err != NC_EBADID)
+#line 791
error("bad ncid: status = %d", err);
+#line 791
err = nc_get_varm_short(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 791
IF (err != NC_ENOTVAR)
+#line 791
error("bad var id: status = %d", err);
+#line 791
for (j = 0; j < var_rank[i]; j++) {
+#line 791
start[j] = var_shape[i][j];
+#line 791
err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
+#line 791
if(!canConvert) {
+#line 791
IF (err != NC_ECHAR)
+#line 791
error("conversion: status = %d", err);
+#line 791
} else {
+#line 791
IF (err != NC_EINVALCOORDS)
+#line 791
error("bad index: status = %d", err);
+#line 791
start[j] = 0;
+#line 791
edge[j] = var_shape[i][j] + 1;
+#line 791
err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
+#line 791
IF (err != NC_EEDGE)
+#line 791
error("bad edge: status = %d", err);
+#line 791
edge[j] = 1;
+#line 791
stride[j] = 0;
+#line 791
err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
+#line 791
IF (err != NC_ESTRIDE)
+#line 791
error("bad stride: status = %d", err);
+#line 791
stride[j] = 1;
+#line 791
}
+#line 791
}
+#line 791
/* Choose a random point dividing each dim into 2 parts */
+#line 791
/* get 2^rank (nslabs) slabs so defined */
+#line 791
nslabs = 1;
+#line 791
for (j = 0; j < var_rank[i]; j++) {
+#line 791
mid[j] = roll( var_shape[i][j] );
+#line 791
nslabs *= 2;
+#line 791
}
+#line 791
/* bits of k determine whether to get lower or upper part of dim */
+#line 791
/* choose random stride from 1 to edge */
+#line 791
for (k = 0; k < nslabs; k++) {
+#line 791
nstarts = 1;
+#line 791
for (j = 0; j < var_rank[i]; j++) {
+#line 791
if ((k >> j) & 1) {
+#line 791
start[j] = 0;
+#line 791
edge[j] = mid[j];
+#line 791
}else{
+#line 791
start[j] = mid[j];
+#line 791
edge[j] = var_shape[i][j] - mid[j];
+#line 791
}
+#line 791
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 791
nstarts *= stride[j];
+#line 791
}
+#line 791
for (m = 0; m < nstarts; m++) {
+#line 791
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 791
IF (err)
+#line 791
error("error in toMixedBase");
+#line 791
nels = 1;
+#line 791
for (j = 0; j < var_rank[i]; j++) {
+#line 791
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 791
nels *= count[j];
+#line 791
index[j] += start[j];
+#line 791
}
+#line 791
/* Random choice of forward or backward */
+#line 791
/* TODO
+#line 791
if ( roll(2) ) {
+#line 791
for (j = 0; j < var_rank[i]; j++) {
+#line 791
index[j] += (count[j] - 1) * stride[j];
+#line 791
stride[j] = -stride[j];
+#line 791
}
+#line 791
}
+#line 791
*/
+#line 791
if (var_rank[i] > 0) {
+#line 791
j = var_rank[i] - 1;
+#line 791
imap[j] = 1;
+#line 791
for (; j > 0; j--)
+#line 791
imap[j-1] = imap[j] * count[j];
+#line 791
}
+#line 791
allInExtRange = allInIntRange = 1;
+#line 791
for (j = 0; j < nels; j++) {
+#line 791
err = toMixedBase(j, var_rank[i], count, index2);
+#line 791
IF (err)
+#line 791
error("error in toMixedBase 1");
+#line 791
for (d = 0; d < var_rank[i]; d++)
+#line 791
index2[d] = index[d] + index2[d] * stride[d];
+#line 791
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 791
NCT_SHORT);
+#line 791
if (inRange3(expect[j],var_type[i],NCT_SHORT)) {
+#line 791
allInIntRange = allInIntRange && expect[j] >= short_min
+#line 791
&& expect[j] <= short_max;
+#line 791
} else {
+#line 791
allInExtRange = 0;
+#line 791
}
+#line 791
}
+#line 791
if (var_rank[i] == 0 && i%2 )
+#line 791
err = nc_get_varm_short(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 791
else
+#line 791
err = nc_get_varm_short(ncid,i,index,count,stride,imap,value);
+#line 791
if (canConvert) {
+#line 791
if (allInExtRange) {
+#line 791
if (allInIntRange) {
+#line 791
IF (err)
+#line 791
error("%s", nc_strerror(err));
+#line 791
} else {
+#line 791
IF (err != NC_ERANGE)
+#line 791
error("Range error: status = %d", err);
+#line 791
}
+#line 791
} else {
+#line 791
IF (err != 0 && err != NC_ERANGE)
+#line 791
error("OK or Range error: status = %d", err);
+#line 791
}
+#line 791
for (j = 0; j < nels; j++) {
+#line 791
if (inRange3(expect[j],var_type[i],NCT_SHORT)
+#line 791
&& expect[j] >= short_min
+#line 791
&& expect[j] <= short_max) {
+#line 791
IF (!equal(value[j],expect[j],var_type[i], NCT_SHORT)){
+#line 791
error("value read not that expected");
+#line 791
if (verbose) {
+#line 791
error("\n");
+#line 791
error("varid: %d, ", i);
+#line 791
error("var_name: %s, ", var_name[i]);
+#line 791
error("element number: %d ", j);
+#line 791
error("expect: %g, ", expect[j]);
+#line 791
error("got: %g", (double) value[j]);
+#line 791
}
+#line 791
} else {
+#line 791
nok++;
+#line 791
}
+#line 791
}
+#line 791
}
+#line 791
} else {
+#line 791
IF (nels > 0 && err != NC_ECHAR)
+#line 791
error("wrong type: status = %d", err);
+#line 791
}
+#line 791
}
+#line 791
}
+#line 791
}
+#line 791
err = nc_close(ncid);
+#line 791
IF (err)
+#line 791
error("nc_close: %s", nc_strerror(err));
+#line 791
print_nok(nok);
+#line 791
}
+#line 791
void
+#line 792
test_nc_get_varm_int(void)
+#line 792
{
+#line 792
int ncid;
+#line 792
int d;
+#line 792
int i;
+#line 792
int j;
+#line 792
int k;
+#line 792
int m;
+#line 792
int err;
+#line 792
int allInExtRange; /* all values within external range? */
+#line 792
int allInIntRange; /* all values within internal range? */
+#line 792
int nels;
+#line 792
int nslabs;
+#line 792
int nstarts; /* number of different starts */
+#line 792
int nok = 0; /* count of valid comparisons */
+#line 792
size_t start[MAX_RANK];
+#line 792
size_t edge[MAX_RANK];
+#line 792
size_t index[MAX_RANK];
+#line 792
size_t index2[MAX_RANK];
+#line 792
size_t mid[MAX_RANK];
+#line 792
size_t count[MAX_RANK];
+#line 792
size_t sstride[MAX_RANK];
+#line 792
ptrdiff_t stride[MAX_RANK];
+#line 792
ptrdiff_t imap[MAX_RANK];
+#line 792
int canConvert; /* Both text or both numeric */
+#line 792
int value[MAX_NELS];
+#line 792
double expect[MAX_NELS];
+#line 792
+#line 792
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 792
IF (err)
+#line 792
error("nc_open: %s", nc_strerror(err));
+#line 792
for (i = 0; i < NVARS; i++) {
+#line 792
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 792
assert(var_rank[i] <= MAX_RANK);
+#line 792
assert(var_nels[i] <= MAX_NELS);
+#line 792
for (j = 0; j < var_rank[i]; j++) {
+#line 792
start[j] = 0;
+#line 792
edge[j] = 1;
+#line 792
stride[j] = 1;
+#line 792
imap[j] = 1;
+#line 792
}
+#line 792
err = nc_get_varm_int(BAD_ID, i, start, edge, stride, imap, value);
+#line 792
IF (err != NC_EBADID)
+#line 792
error("bad ncid: status = %d", err);
+#line 792
err = nc_get_varm_int(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 792
IF (err != NC_ENOTVAR)
+#line 792
error("bad var id: status = %d", err);
+#line 792
for (j = 0; j < var_rank[i]; j++) {
+#line 792
start[j] = var_shape[i][j];
+#line 792
err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
+#line 792
if(!canConvert) {
+#line 792
IF (err != NC_ECHAR)
+#line 792
error("conversion: status = %d", err);
+#line 792
} else {
+#line 792
IF (err != NC_EINVALCOORDS)
+#line 792
error("bad index: status = %d", err);
+#line 792
start[j] = 0;
+#line 792
edge[j] = var_shape[i][j] + 1;
+#line 792
err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
+#line 792
IF (err != NC_EEDGE)
+#line 792
error("bad edge: status = %d", err);
+#line 792
edge[j] = 1;
+#line 792
stride[j] = 0;
+#line 792
err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
+#line 792
IF (err != NC_ESTRIDE)
+#line 792
error("bad stride: status = %d", err);
+#line 792
stride[j] = 1;
+#line 792
}
+#line 792
}
+#line 792
/* Choose a random point dividing each dim into 2 parts */
+#line 792
/* get 2^rank (nslabs) slabs so defined */
+#line 792
nslabs = 1;
+#line 792
for (j = 0; j < var_rank[i]; j++) {
+#line 792
mid[j] = roll( var_shape[i][j] );
+#line 792
nslabs *= 2;
+#line 792
}
+#line 792
/* bits of k determine whether to get lower or upper part of dim */
+#line 792
/* choose random stride from 1 to edge */
+#line 792
for (k = 0; k < nslabs; k++) {
+#line 792
nstarts = 1;
+#line 792
for (j = 0; j < var_rank[i]; j++) {
+#line 792
if ((k >> j) & 1) {
+#line 792
start[j] = 0;
+#line 792
edge[j] = mid[j];
+#line 792
}else{
+#line 792
start[j] = mid[j];
+#line 792
edge[j] = var_shape[i][j] - mid[j];
+#line 792
}
+#line 792
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 792
nstarts *= stride[j];
+#line 792
}
+#line 792
for (m = 0; m < nstarts; m++) {
+#line 792
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 792
IF (err)
+#line 792
error("error in toMixedBase");
+#line 792
nels = 1;
+#line 792
for (j = 0; j < var_rank[i]; j++) {
+#line 792
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 792
nels *= count[j];
+#line 792
index[j] += start[j];
+#line 792
}
+#line 792
/* Random choice of forward or backward */
+#line 792
/* TODO
+#line 792
if ( roll(2) ) {
+#line 792
for (j = 0; j < var_rank[i]; j++) {
+#line 792
index[j] += (count[j] - 1) * stride[j];
+#line 792
stride[j] = -stride[j];
+#line 792
}
+#line 792
}
+#line 792
*/
+#line 792
if (var_rank[i] > 0) {
+#line 792
j = var_rank[i] - 1;
+#line 792
imap[j] = 1;
+#line 792
for (; j > 0; j--)
+#line 792
imap[j-1] = imap[j] * count[j];
+#line 792
}
+#line 792
allInExtRange = allInIntRange = 1;
+#line 792
for (j = 0; j < nels; j++) {
+#line 792
err = toMixedBase(j, var_rank[i], count, index2);
+#line 792
IF (err)
+#line 792
error("error in toMixedBase 1");
+#line 792
for (d = 0; d < var_rank[i]; d++)
+#line 792
index2[d] = index[d] + index2[d] * stride[d];
+#line 792
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 792
NCT_INT);
+#line 792
if (inRange3(expect[j],var_type[i],NCT_INT)) {
+#line 792
allInIntRange = allInIntRange && expect[j] >= int_min
+#line 792
&& expect[j] <= int_max;
+#line 792
} else {
+#line 792
allInExtRange = 0;
+#line 792
}
+#line 792
}
+#line 792
if (var_rank[i] == 0 && i%2 )
+#line 792
err = nc_get_varm_int(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 792
else
+#line 792
err = nc_get_varm_int(ncid,i,index,count,stride,imap,value);
+#line 792
if (canConvert) {
+#line 792
if (allInExtRange) {
+#line 792
if (allInIntRange) {
+#line 792
IF (err)
+#line 792
error("%s", nc_strerror(err));
+#line 792
} else {
+#line 792
IF (err != NC_ERANGE)
+#line 792
error("Range error: status = %d", err);
+#line 792
}
+#line 792
} else {
+#line 792
IF (err != 0 && err != NC_ERANGE)
+#line 792
error("OK or Range error: status = %d", err);
+#line 792
}
+#line 792
for (j = 0; j < nels; j++) {
+#line 792
if (inRange3(expect[j],var_type[i],NCT_INT)
+#line 792
&& expect[j] >= int_min
+#line 792
&& expect[j] <= int_max) {
+#line 792
IF (!equal(value[j],expect[j],var_type[i], NCT_INT)){
+#line 792
error("value read not that expected");
+#line 792
if (verbose) {
+#line 792
error("\n");
+#line 792
error("varid: %d, ", i);
+#line 792
error("var_name: %s, ", var_name[i]);
+#line 792
error("element number: %d ", j);
+#line 792
error("expect: %g, ", expect[j]);
+#line 792
error("got: %g", (double) value[j]);
+#line 792
}
+#line 792
} else {
+#line 792
nok++;
+#line 792
}
+#line 792
}
+#line 792
}
+#line 792
} else {
+#line 792
IF (nels > 0 && err != NC_ECHAR)
+#line 792
error("wrong type: status = %d", err);
+#line 792
}
+#line 792
}
+#line 792
}
+#line 792
}
+#line 792
err = nc_close(ncid);
+#line 792
IF (err)
+#line 792
error("nc_close: %s", nc_strerror(err));
+#line 792
print_nok(nok);
+#line 792
}
+#line 792
void
+#line 793
test_nc_get_varm_long(void)
+#line 793
{
+#line 793
int ncid;
+#line 793
int d;
+#line 793
int i;
+#line 793
int j;
+#line 793
int k;
+#line 793
int m;
+#line 793
int err;
+#line 793
int allInExtRange; /* all values within external range? */
+#line 793
int allInIntRange; /* all values within internal range? */
+#line 793
int nels;
+#line 793
int nslabs;
+#line 793
int nstarts; /* number of different starts */
+#line 793
int nok = 0; /* count of valid comparisons */
+#line 793
size_t start[MAX_RANK];
+#line 793
size_t edge[MAX_RANK];
+#line 793
size_t index[MAX_RANK];
+#line 793
size_t index2[MAX_RANK];
+#line 793
size_t mid[MAX_RANK];
+#line 793
size_t count[MAX_RANK];
+#line 793
size_t sstride[MAX_RANK];
+#line 793
ptrdiff_t stride[MAX_RANK];
+#line 793
ptrdiff_t imap[MAX_RANK];
+#line 793
int canConvert; /* Both text or both numeric */
+#line 793
long value[MAX_NELS];
+#line 793
double expect[MAX_NELS];
+#line 793
+#line 793
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 793
IF (err)
+#line 793
error("nc_open: %s", nc_strerror(err));
+#line 793
for (i = 0; i < NVARS; i++) {
+#line 793
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 793
assert(var_rank[i] <= MAX_RANK);
+#line 793
assert(var_nels[i] <= MAX_NELS);
+#line 793
for (j = 0; j < var_rank[i]; j++) {
+#line 793
start[j] = 0;
+#line 793
edge[j] = 1;
+#line 793
stride[j] = 1;
+#line 793
imap[j] = 1;
+#line 793
}
+#line 793
err = nc_get_varm_long(BAD_ID, i, start, edge, stride, imap, value);
+#line 793
IF (err != NC_EBADID)
+#line 793
error("bad ncid: status = %d", err);
+#line 793
err = nc_get_varm_long(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 793
IF (err != NC_ENOTVAR)
+#line 793
error("bad var id: status = %d", err);
+#line 793
for (j = 0; j < var_rank[i]; j++) {
+#line 793
start[j] = var_shape[i][j];
+#line 793
err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
+#line 793
if(!canConvert) {
+#line 793
IF (err != NC_ECHAR)
+#line 793
error("conversion: status = %d", err);
+#line 793
} else {
+#line 793
IF (err != NC_EINVALCOORDS)
+#line 793
error("bad index: status = %d", err);
+#line 793
start[j] = 0;
+#line 793
edge[j] = var_shape[i][j] + 1;
+#line 793
err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
+#line 793
IF (err != NC_EEDGE)
+#line 793
error("bad edge: status = %d", err);
+#line 793
edge[j] = 1;
+#line 793
stride[j] = 0;
+#line 793
err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
+#line 793
IF (err != NC_ESTRIDE)
+#line 793
error("bad stride: status = %d", err);
+#line 793
stride[j] = 1;
+#line 793
}
+#line 793
}
+#line 793
/* Choose a random point dividing each dim into 2 parts */
+#line 793
/* get 2^rank (nslabs) slabs so defined */
+#line 793
nslabs = 1;
+#line 793
for (j = 0; j < var_rank[i]; j++) {
+#line 793
mid[j] = roll( var_shape[i][j] );
+#line 793
nslabs *= 2;
+#line 793
}
+#line 793
/* bits of k determine whether to get lower or upper part of dim */
+#line 793
/* choose random stride from 1 to edge */
+#line 793
for (k = 0; k < nslabs; k++) {
+#line 793
nstarts = 1;
+#line 793
for (j = 0; j < var_rank[i]; j++) {
+#line 793
if ((k >> j) & 1) {
+#line 793
start[j] = 0;
+#line 793
edge[j] = mid[j];
+#line 793
}else{
+#line 793
start[j] = mid[j];
+#line 793
edge[j] = var_shape[i][j] - mid[j];
+#line 793
}
+#line 793
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 793
nstarts *= stride[j];
+#line 793
}
+#line 793
for (m = 0; m < nstarts; m++) {
+#line 793
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 793
IF (err)
+#line 793
error("error in toMixedBase");
+#line 793
nels = 1;
+#line 793
for (j = 0; j < var_rank[i]; j++) {
+#line 793
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 793
nels *= count[j];
+#line 793
index[j] += start[j];
+#line 793
}
+#line 793
/* Random choice of forward or backward */
+#line 793
/* TODO
+#line 793
if ( roll(2) ) {
+#line 793
for (j = 0; j < var_rank[i]; j++) {
+#line 793
index[j] += (count[j] - 1) * stride[j];
+#line 793
stride[j] = -stride[j];
+#line 793
}
+#line 793
}
+#line 793
*/
+#line 793
if (var_rank[i] > 0) {
+#line 793
j = var_rank[i] - 1;
+#line 793
imap[j] = 1;
+#line 793
for (; j > 0; j--)
+#line 793
imap[j-1] = imap[j] * count[j];
+#line 793
}
+#line 793
allInExtRange = allInIntRange = 1;
+#line 793
for (j = 0; j < nels; j++) {
+#line 793
err = toMixedBase(j, var_rank[i], count, index2);
+#line 793
IF (err)
+#line 793
error("error in toMixedBase 1");
+#line 793
for (d = 0; d < var_rank[i]; d++)
+#line 793
index2[d] = index[d] + index2[d] * stride[d];
+#line 793
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 793
NCT_LONG);
+#line 793
if (inRange3(expect[j],var_type[i],NCT_LONG)) {
+#line 793
allInIntRange = allInIntRange && expect[j] >= long_min
+#line 793
&& expect[j] <= long_max;
+#line 793
} else {
+#line 793
allInExtRange = 0;
+#line 793
}
+#line 793
}
+#line 793
if (var_rank[i] == 0 && i%2 )
+#line 793
err = nc_get_varm_long(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 793
else
+#line 793
err = nc_get_varm_long(ncid,i,index,count,stride,imap,value);
+#line 793
if (canConvert) {
+#line 793
if (allInExtRange) {
+#line 793
if (allInIntRange) {
+#line 793
IF (err)
+#line 793
error("%s", nc_strerror(err));
+#line 793
} else {
+#line 793
IF (err != NC_ERANGE)
+#line 793
error("Range error: status = %d", err);
+#line 793
}
+#line 793
} else {
+#line 793
IF (err != 0 && err != NC_ERANGE)
+#line 793
error("OK or Range error: status = %d", err);
+#line 793
}
+#line 793
for (j = 0; j < nels; j++) {
+#line 793
if (inRange3(expect[j],var_type[i],NCT_LONG)
+#line 793
&& expect[j] >= long_min
+#line 793
&& expect[j] <= long_max) {
+#line 793
IF (!equal(value[j],expect[j],var_type[i], NCT_LONG)){
+#line 793
error("value read not that expected");
+#line 793
if (verbose) {
+#line 793
error("\n");
+#line 793
error("varid: %d, ", i);
+#line 793
error("var_name: %s, ", var_name[i]);
+#line 793
error("element number: %d ", j);
+#line 793
error("expect: %g, ", expect[j]);
+#line 793
error("got: %g", (double) value[j]);
+#line 793
}
+#line 793
} else {
+#line 793
nok++;
+#line 793
}
+#line 793
}
+#line 793
}
+#line 793
} else {
+#line 793
IF (nels > 0 && err != NC_ECHAR)
+#line 793
error("wrong type: status = %d", err);
+#line 793
}
+#line 793
}
+#line 793
}
+#line 793
}
+#line 793
err = nc_close(ncid);
+#line 793
IF (err)
+#line 793
error("nc_close: %s", nc_strerror(err));
+#line 793
print_nok(nok);
+#line 793
}
+#line 793
void
+#line 794
test_nc_get_varm_float(void)
+#line 794
{
+#line 794
int ncid;
+#line 794
int d;
+#line 794
int i;
+#line 794
int j;
+#line 794
int k;
+#line 794
int m;
+#line 794
int err;
+#line 794
int allInExtRange; /* all values within external range? */
+#line 794
int allInIntRange; /* all values within internal range? */
+#line 794
int nels;
+#line 794
int nslabs;
+#line 794
int nstarts; /* number of different starts */
+#line 794
int nok = 0; /* count of valid comparisons */
+#line 794
size_t start[MAX_RANK];
+#line 794
size_t edge[MAX_RANK];
+#line 794
size_t index[MAX_RANK];
+#line 794
size_t index2[MAX_RANK];
+#line 794
size_t mid[MAX_RANK];
+#line 794
size_t count[MAX_RANK];
+#line 794
size_t sstride[MAX_RANK];
+#line 794
ptrdiff_t stride[MAX_RANK];
+#line 794
ptrdiff_t imap[MAX_RANK];
+#line 794
int canConvert; /* Both text or both numeric */
+#line 794
float value[MAX_NELS];
+#line 794
double expect[MAX_NELS];
+#line 794
+#line 794
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 794
IF (err)
+#line 794
error("nc_open: %s", nc_strerror(err));
+#line 794
for (i = 0; i < NVARS; i++) {
+#line 794
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 794
assert(var_rank[i] <= MAX_RANK);
+#line 794
assert(var_nels[i] <= MAX_NELS);
+#line 794
for (j = 0; j < var_rank[i]; j++) {
+#line 794
start[j] = 0;
+#line 794
edge[j] = 1;
+#line 794
stride[j] = 1;
+#line 794
imap[j] = 1;
+#line 794
}
+#line 794
err = nc_get_varm_float(BAD_ID, i, start, edge, stride, imap, value);
+#line 794
IF (err != NC_EBADID)
+#line 794
error("bad ncid: status = %d", err);
+#line 794
err = nc_get_varm_float(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 794
IF (err != NC_ENOTVAR)
+#line 794
error("bad var id: status = %d", err);
+#line 794
for (j = 0; j < var_rank[i]; j++) {
+#line 794
start[j] = var_shape[i][j];
+#line 794
err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
+#line 794
if(!canConvert) {
+#line 794
IF (err != NC_ECHAR)
+#line 794
error("conversion: status = %d", err);
+#line 794
} else {
+#line 794
IF (err != NC_EINVALCOORDS)
+#line 794
error("bad index: status = %d", err);
+#line 794
start[j] = 0;
+#line 794
edge[j] = var_shape[i][j] + 1;
+#line 794
err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
+#line 794
IF (err != NC_EEDGE)
+#line 794
error("bad edge: status = %d", err);
+#line 794
edge[j] = 1;
+#line 794
stride[j] = 0;
+#line 794
err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
+#line 794
IF (err != NC_ESTRIDE)
+#line 794
error("bad stride: status = %d", err);
+#line 794
stride[j] = 1;
+#line 794
}
+#line 794
}
+#line 794
/* Choose a random point dividing each dim into 2 parts */
+#line 794
/* get 2^rank (nslabs) slabs so defined */
+#line 794
nslabs = 1;
+#line 794
for (j = 0; j < var_rank[i]; j++) {
+#line 794
mid[j] = roll( var_shape[i][j] );
+#line 794
nslabs *= 2;
+#line 794
}
+#line 794
/* bits of k determine whether to get lower or upper part of dim */
+#line 794
/* choose random stride from 1 to edge */
+#line 794
for (k = 0; k < nslabs; k++) {
+#line 794
nstarts = 1;
+#line 794
for (j = 0; j < var_rank[i]; j++) {
+#line 794
if ((k >> j) & 1) {
+#line 794
start[j] = 0;
+#line 794
edge[j] = mid[j];
+#line 794
}else{
+#line 794
start[j] = mid[j];
+#line 794
edge[j] = var_shape[i][j] - mid[j];
+#line 794
}
+#line 794
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 794
nstarts *= stride[j];
+#line 794
}
+#line 794
for (m = 0; m < nstarts; m++) {
+#line 794
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 794
IF (err)
+#line 794
error("error in toMixedBase");
+#line 794
nels = 1;
+#line 794
for (j = 0; j < var_rank[i]; j++) {
+#line 794
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 794
nels *= count[j];
+#line 794
index[j] += start[j];
+#line 794
}
+#line 794
/* Random choice of forward or backward */
+#line 794
/* TODO
+#line 794
if ( roll(2) ) {
+#line 794
for (j = 0; j < var_rank[i]; j++) {
+#line 794
index[j] += (count[j] - 1) * stride[j];
+#line 794
stride[j] = -stride[j];
+#line 794
}
+#line 794
}
+#line 794
*/
+#line 794
if (var_rank[i] > 0) {
+#line 794
j = var_rank[i] - 1;
+#line 794
imap[j] = 1;
+#line 794
for (; j > 0; j--)
+#line 794
imap[j-1] = imap[j] * count[j];
+#line 794
}
+#line 794
allInExtRange = allInIntRange = 1;
+#line 794
for (j = 0; j < nels; j++) {
+#line 794
err = toMixedBase(j, var_rank[i], count, index2);
+#line 794
IF (err)
+#line 794
error("error in toMixedBase 1");
+#line 794
for (d = 0; d < var_rank[i]; d++)
+#line 794
index2[d] = index[d] + index2[d] * stride[d];
+#line 794
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 794
NCT_FLOAT);
+#line 794
if (inRange3(expect[j],var_type[i],NCT_FLOAT)) {
+#line 794
allInIntRange = allInIntRange && expect[j] >= float_min
+#line 794
&& expect[j] <= float_max;
+#line 794
} else {
+#line 794
allInExtRange = 0;
+#line 794
}
+#line 794
}
+#line 794
if (var_rank[i] == 0 && i%2 )
+#line 794
err = nc_get_varm_float(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 794
else
+#line 794
err = nc_get_varm_float(ncid,i,index,count,stride,imap,value);
+#line 794
if (canConvert) {
+#line 794
if (allInExtRange) {
+#line 794
if (allInIntRange) {
+#line 794
IF (err)
+#line 794
error("%s", nc_strerror(err));
+#line 794
} else {
+#line 794
IF (err != NC_ERANGE)
+#line 794
error("Range error: status = %d", err);
+#line 794
}
+#line 794
} else {
+#line 794
IF (err != 0 && err != NC_ERANGE)
+#line 794
error("OK or Range error: status = %d", err);
+#line 794
}
+#line 794
for (j = 0; j < nels; j++) {
+#line 794
if (inRange3(expect[j],var_type[i],NCT_FLOAT)
+#line 794
&& expect[j] >= float_min
+#line 794
&& expect[j] <= float_max) {
+#line 794
IF (!equal(value[j],expect[j],var_type[i], NCT_FLOAT)){
+#line 794
error("value read not that expected");
+#line 794
if (verbose) {
+#line 794
error("\n");
+#line 794
error("varid: %d, ", i);
+#line 794
error("var_name: %s, ", var_name[i]);
+#line 794
error("element number: %d ", j);
+#line 794
error("expect: %g, ", expect[j]);
+#line 794
error("got: %g", (double) value[j]);
+#line 794
}
+#line 794
} else {
+#line 794
nok++;
+#line 794
}
+#line 794
}
+#line 794
}
+#line 794
} else {
+#line 794
IF (nels > 0 && err != NC_ECHAR)
+#line 794
error("wrong type: status = %d", err);
+#line 794
}
+#line 794
}
+#line 794
}
+#line 794
}
+#line 794
err = nc_close(ncid);
+#line 794
IF (err)
+#line 794
error("nc_close: %s", nc_strerror(err));
+#line 794
print_nok(nok);
+#line 794
}
+#line 794
void
+#line 795
test_nc_get_varm_double(void)
+#line 795
{
+#line 795
int ncid;
+#line 795
int d;
+#line 795
int i;
+#line 795
int j;
+#line 795
int k;
+#line 795
int m;
+#line 795
int err;
+#line 795
int allInExtRange; /* all values within external range? */
+#line 795
int allInIntRange; /* all values within internal range? */
+#line 795
int nels;
+#line 795
int nslabs;
+#line 795
int nstarts; /* number of different starts */
+#line 795
int nok = 0; /* count of valid comparisons */
+#line 795
size_t start[MAX_RANK];
+#line 795
size_t edge[MAX_RANK];
+#line 795
size_t index[MAX_RANK];
+#line 795
size_t index2[MAX_RANK];
+#line 795
size_t mid[MAX_RANK];
+#line 795
size_t count[MAX_RANK];
+#line 795
size_t sstride[MAX_RANK];
+#line 795
ptrdiff_t stride[MAX_RANK];
+#line 795
ptrdiff_t imap[MAX_RANK];
+#line 795
int canConvert; /* Both text or both numeric */
+#line 795
double value[MAX_NELS];
+#line 795
double expect[MAX_NELS];
+#line 795
+#line 795
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 795
IF (err)
+#line 795
error("nc_open: %s", nc_strerror(err));
+#line 795
for (i = 0; i < NVARS; i++) {
+#line 795
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 795
assert(var_rank[i] <= MAX_RANK);
+#line 795
assert(var_nels[i] <= MAX_NELS);
+#line 795
for (j = 0; j < var_rank[i]; j++) {
+#line 795
start[j] = 0;
+#line 795
edge[j] = 1;
+#line 795
stride[j] = 1;
+#line 795
imap[j] = 1;
+#line 795
}
+#line 795
err = nc_get_varm_double(BAD_ID, i, start, edge, stride, imap, value);
+#line 795
IF (err != NC_EBADID)
+#line 795
error("bad ncid: status = %d", err);
+#line 795
err = nc_get_varm_double(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 795
IF (err != NC_ENOTVAR)
+#line 795
error("bad var id: status = %d", err);
+#line 795
for (j = 0; j < var_rank[i]; j++) {
+#line 795
start[j] = var_shape[i][j];
+#line 795
err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
+#line 795
if(!canConvert) {
+#line 795
IF (err != NC_ECHAR)
+#line 795
error("conversion: status = %d", err);
+#line 795
} else {
+#line 795
IF (err != NC_EINVALCOORDS)
+#line 795
error("bad index: status = %d", err);
+#line 795
start[j] = 0;
+#line 795
edge[j] = var_shape[i][j] + 1;
+#line 795
err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
+#line 795
IF (err != NC_EEDGE)
+#line 795
error("bad edge: status = %d", err);
+#line 795
edge[j] = 1;
+#line 795
stride[j] = 0;
+#line 795
err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
+#line 795
IF (err != NC_ESTRIDE)
+#line 795
error("bad stride: status = %d", err);
+#line 795
stride[j] = 1;
+#line 795
}
+#line 795
}
+#line 795
/* Choose a random point dividing each dim into 2 parts */
+#line 795
/* get 2^rank (nslabs) slabs so defined */
+#line 795
nslabs = 1;
+#line 795
for (j = 0; j < var_rank[i]; j++) {
+#line 795
mid[j] = roll( var_shape[i][j] );
+#line 795
nslabs *= 2;
+#line 795
}
+#line 795
/* bits of k determine whether to get lower or upper part of dim */
+#line 795
/* choose random stride from 1 to edge */
+#line 795
for (k = 0; k < nslabs; k++) {
+#line 795
nstarts = 1;
+#line 795
for (j = 0; j < var_rank[i]; j++) {
+#line 795
if ((k >> j) & 1) {
+#line 795
start[j] = 0;
+#line 795
edge[j] = mid[j];
+#line 795
}else{
+#line 795
start[j] = mid[j];
+#line 795
edge[j] = var_shape[i][j] - mid[j];
+#line 795
}
+#line 795
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 795
nstarts *= stride[j];
+#line 795
}
+#line 795
for (m = 0; m < nstarts; m++) {
+#line 795
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 795
IF (err)
+#line 795
error("error in toMixedBase");
+#line 795
nels = 1;
+#line 795
for (j = 0; j < var_rank[i]; j++) {
+#line 795
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 795
nels *= count[j];
+#line 795
index[j] += start[j];
+#line 795
}
+#line 795
/* Random choice of forward or backward */
+#line 795
/* TODO
+#line 795
if ( roll(2) ) {
+#line 795
for (j = 0; j < var_rank[i]; j++) {
+#line 795
index[j] += (count[j] - 1) * stride[j];
+#line 795
stride[j] = -stride[j];
+#line 795
}
+#line 795
}
+#line 795
*/
+#line 795
if (var_rank[i] > 0) {
+#line 795
j = var_rank[i] - 1;
+#line 795
imap[j] = 1;
+#line 795
for (; j > 0; j--)
+#line 795
imap[j-1] = imap[j] * count[j];
+#line 795
}
+#line 795
allInExtRange = allInIntRange = 1;
+#line 795
for (j = 0; j < nels; j++) {
+#line 795
err = toMixedBase(j, var_rank[i], count, index2);
+#line 795
IF (err)
+#line 795
error("error in toMixedBase 1");
+#line 795
for (d = 0; d < var_rank[i]; d++)
+#line 795
index2[d] = index[d] + index2[d] * stride[d];
+#line 795
expect[j] = hash4(var_type[i], var_rank[i], index2,
+#line 795
NCT_DOUBLE);
+#line 795
if (inRange3(expect[j],var_type[i],NCT_DOUBLE)) {
+#line 795
allInIntRange = allInIntRange && expect[j] >= double_min
+#line 795
&& expect[j] <= double_max;
+#line 795
} else {
+#line 795
allInExtRange = 0;
+#line 795
}
+#line 795
}
+#line 795
if (var_rank[i] == 0 && i%2 )
+#line 795
err = nc_get_varm_double(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 795
else
+#line 795
err = nc_get_varm_double(ncid,i,index,count,stride,imap,value);
+#line 795
if (canConvert) {
+#line 795
if (allInExtRange) {
+#line 795
if (allInIntRange) {
+#line 795
IF (err)
+#line 795
error("%s", nc_strerror(err));
+#line 795
} else {
+#line 795
IF (err != NC_ERANGE)
+#line 795
error("Range error: status = %d", err);
+#line 795
}
+#line 795
} else {
+#line 795
IF (err != 0 && err != NC_ERANGE)
+#line 795
error("OK or Range error: status = %d", err);
+#line 795
}
+#line 795
for (j = 0; j < nels; j++) {
+#line 795
if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
+#line 795
&& expect[j] >= double_min
+#line 795
&& expect[j] <= double_max) {
+#line 795
IF (!equal(value[j],expect[j],var_type[i], NCT_DOUBLE)){
+#line 795
error("value read not that expected");
+#line 795
if (verbose) {
+#line 795
error("\n");
+#line 795
error("varid: %d, ", i);
+#line 795
error("var_name: %s, ", var_name[i]);
+#line 795
error("element number: %d ", j);
+#line 795
error("expect: %g, ", expect[j]);
+#line 795
error("got: %g", (double) value[j]);
+#line 795
}
+#line 795
} else {
+#line 795
nok++;
+#line 795
}
+#line 795
}
+#line 795
}
+#line 795
} else {
+#line 795
IF (nels > 0 && err != NC_ECHAR)
+#line 795
error("wrong type: status = %d", err);
+#line 795
}
+#line 795
}
+#line 795
}
+#line 795
}
+#line 795
err = nc_close(ncid);
+#line 795
IF (err)
+#line 795
error("nc_close: %s", nc_strerror(err));
+#line 795
print_nok(nok);
+#line 795
}
+#line 795
+#line 888
void
+#line 889
test_nc_get_att_text(void)
+#line 889
{
+#line 889
int ncid;
+#line 889
int i;
+#line 889
int j;
+#line 889
size_t k;
+#line 889
int err;
+#line 889
int allInExtRange;
+#line 889
int allInIntRange;
+#line 889
int canConvert; /* Both text or both numeric */
+#line 889
text value[MAX_NELS];
+#line 889
double expect[MAX_NELS];
+#line 889
int nok = 0; /* count of valid comparisons */
+#line 889
+#line 889
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 889
IF (err)
+#line 889
error("nc_open: %s", nc_strerror(err));
+#line 889
+#line 889
for (i = -1; i < NVARS; i++) {
+#line 889
for (j = 0; j < NATTS(i); j++) {
+#line 889
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 889
err = nc_get_att_text(BAD_ID, i, ATT_NAME(i,j), value);
+#line 889
IF (err != NC_EBADID)
+#line 889
error("bad ncid: status = %d", err);
+#line 889
err = nc_get_att_text(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 889
IF (err != NC_ENOTVAR)
+#line 889
error("bad var id: status = %d", err);
+#line 889
err = nc_get_att_text(ncid, i, "noSuch", value);
+#line 889
IF (err != NC_ENOTATT)
+#line 889
error("Bad attribute name: status = %d", err);
+#line 889
allInExtRange = allInIntRange = 1;
+#line 889
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 889
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_TEXT);
+#line 889
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_TEXT)) {
+#line 889
allInIntRange = allInIntRange && expect[k] >= text_min
+#line 889
&& expect[k] <= text_max;
+#line 889
} else {
+#line 889
allInExtRange = 0;
+#line 889
}
+#line 889
}
+#line 889
err = nc_get_att_text(ncid, i, ATT_NAME(i,j), value);
+#line 889
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 889
if (allInExtRange) {
+#line 889
if (allInIntRange) {
+#line 889
IF (err)
+#line 889
error("%s", nc_strerror(err));
+#line 889
} else {
+#line 889
IF (err != NC_ERANGE)
+#line 889
error("Range error: status = %d", err);
+#line 889
}
+#line 889
} else {
+#line 889
IF (err != 0 && err != NC_ERANGE)
+#line 889
error("OK or Range error: status = %d", err);
+#line 889
}
+#line 889
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 889
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_TEXT)
+#line 889
&& expect[k] >= text_min && expect[k] <= text_max) {
+#line 889
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_TEXT)){
+#line 889
error("value read not that expected");
+#line 889
if (verbose) {
+#line 889
error("\n");
+#line 889
error("varid: %d, ", i);
+#line 889
error("att_name: %s, ", ATT_NAME(i,j));
+#line 889
error("element number: %d ", k);
+#line 889
error("expect: %g", expect[k]);
+#line 889
error("got: %g", (double) value[k]);
+#line 889
}
+#line 889
} else {
+#line 889
nok++;
+#line 889
}
+#line 889
}
+#line 889
}
+#line 889
} else {
+#line 889
IF (err != NC_ECHAR)
+#line 889
error("wrong type: status = %d", err);
+#line 889
}
+#line 889
}
+#line 889
}
+#line 889
+#line 889
err = nc_close(ncid);
+#line 889
IF (err)
+#line 889
error("nc_close: %s", nc_strerror(err));
+#line 889
print_nok(nok);
+#line 889
}
+#line 889
void
+#line 890
test_nc_get_att_uchar(void)
+#line 890
{
+#line 890
int ncid;
+#line 890
int i;
+#line 890
int j;
+#line 890
size_t k;
+#line 890
int err;
+#line 890
int allInExtRange;
+#line 890
int allInIntRange;
+#line 890
int canConvert; /* Both text or both numeric */
+#line 890
uchar value[MAX_NELS];
+#line 890
double expect[MAX_NELS];
+#line 890
int nok = 0; /* count of valid comparisons */
+#line 890
+#line 890
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 890
IF (err)
+#line 890
error("nc_open: %s", nc_strerror(err));
+#line 890
+#line 890
for (i = -1; i < NVARS; i++) {
+#line 890
for (j = 0; j < NATTS(i); j++) {
+#line 890
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 890
err = nc_get_att_uchar(BAD_ID, i, ATT_NAME(i,j), value);
+#line 890
IF (err != NC_EBADID)
+#line 890
error("bad ncid: status = %d", err);
+#line 890
err = nc_get_att_uchar(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 890
IF (err != NC_ENOTVAR)
+#line 890
error("bad var id: status = %d", err);
+#line 890
err = nc_get_att_uchar(ncid, i, "noSuch", value);
+#line 890
IF (err != NC_ENOTATT)
+#line 890
error("Bad attribute name: status = %d", err);
+#line 890
allInExtRange = allInIntRange = 1;
+#line 890
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 890
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_UCHAR);
+#line 890
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UCHAR)) {
+#line 890
allInIntRange = allInIntRange && expect[k] >= uchar_min
+#line 890
&& expect[k] <= uchar_max;
+#line 890
} else {
+#line 890
allInExtRange = 0;
+#line 890
}
+#line 890
}
+#line 890
err = nc_get_att_uchar(ncid, i, ATT_NAME(i,j), value);
+#line 890
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 890
if (allInExtRange) {
+#line 890
if (allInIntRange) {
+#line 890
IF (err)
+#line 890
error("%s", nc_strerror(err));
+#line 890
} else {
+#line 890
IF (err != NC_ERANGE)
+#line 890
error("Range error: status = %d", err);
+#line 890
}
+#line 890
} else {
+#line 890
IF (err != 0 && err != NC_ERANGE)
+#line 890
error("OK or Range error: status = %d", err);
+#line 890
}
+#line 890
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 890
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UCHAR)
+#line 890
&& expect[k] >= uchar_min && expect[k] <= uchar_max) {
+#line 890
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_UCHAR)){
+#line 890
error("value read not that expected");
+#line 890
if (verbose) {
+#line 890
error("\n");
+#line 890
error("varid: %d, ", i);
+#line 890
error("att_name: %s, ", ATT_NAME(i,j));
+#line 890
error("element number: %d ", k);
+#line 890
error("expect: %g", expect[k]);
+#line 890
error("got: %g", (double) value[k]);
+#line 890
}
+#line 890
} else {
+#line 890
nok++;
+#line 890
}
+#line 890
}
+#line 890
}
+#line 890
} else {
+#line 890
IF (err != NC_ECHAR)
+#line 890
error("wrong type: status = %d", err);
+#line 890
}
+#line 890
}
+#line 890
}
+#line 890
+#line 890
err = nc_close(ncid);
+#line 890
IF (err)
+#line 890
error("nc_close: %s", nc_strerror(err));
+#line 890
print_nok(nok);
+#line 890
}
+#line 890
void
+#line 891
test_nc_get_att_schar(void)
+#line 891
{
+#line 891
int ncid;
+#line 891
int i;
+#line 891
int j;
+#line 891
size_t k;
+#line 891
int err;
+#line 891
int allInExtRange;
+#line 891
int allInIntRange;
+#line 891
int canConvert; /* Both text or both numeric */
+#line 891
schar value[MAX_NELS];
+#line 891
double expect[MAX_NELS];
+#line 891
int nok = 0; /* count of valid comparisons */
+#line 891
+#line 891
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 891
IF (err)
+#line 891
error("nc_open: %s", nc_strerror(err));
+#line 891
+#line 891
for (i = -1; i < NVARS; i++) {
+#line 891
for (j = 0; j < NATTS(i); j++) {
+#line 891
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 891
err = nc_get_att_schar(BAD_ID, i, ATT_NAME(i,j), value);
+#line 891
IF (err != NC_EBADID)
+#line 891
error("bad ncid: status = %d", err);
+#line 891
err = nc_get_att_schar(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 891
IF (err != NC_ENOTVAR)
+#line 891
error("bad var id: status = %d", err);
+#line 891
err = nc_get_att_schar(ncid, i, "noSuch", value);
+#line 891
IF (err != NC_ENOTATT)
+#line 891
error("Bad attribute name: status = %d", err);
+#line 891
allInExtRange = allInIntRange = 1;
+#line 891
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 891
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_SCHAR);
+#line 891
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SCHAR)) {
+#line 891
allInIntRange = allInIntRange && expect[k] >= schar_min
+#line 891
&& expect[k] <= schar_max;
+#line 891
} else {
+#line 891
allInExtRange = 0;
+#line 891
}
+#line 891
}
+#line 891
err = nc_get_att_schar(ncid, i, ATT_NAME(i,j), value);
+#line 891
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 891
if (allInExtRange) {
+#line 891
if (allInIntRange) {
+#line 891
IF (err)
+#line 891
error("%s", nc_strerror(err));
+#line 891
} else {
+#line 891
IF (err != NC_ERANGE)
+#line 891
error("Range error: status = %d", err);
+#line 891
}
+#line 891
} else {
+#line 891
IF (err != 0 && err != NC_ERANGE)
+#line 891
error("OK or Range error: status = %d", err);
+#line 891
}
+#line 891
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 891
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SCHAR)
+#line 891
&& expect[k] >= schar_min && expect[k] <= schar_max) {
+#line 891
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_SCHAR)){
+#line 891
error("value read not that expected");
+#line 891
if (verbose) {
+#line 891
error("\n");
+#line 891
error("varid: %d, ", i);
+#line 891
error("att_name: %s, ", ATT_NAME(i,j));
+#line 891
error("element number: %d ", k);
+#line 891
error("expect: %g", expect[k]);
+#line 891
error("got: %g", (double) value[k]);
+#line 891
}
+#line 891
} else {
+#line 891
nok++;
+#line 891
}
+#line 891
}
+#line 891
}
+#line 891
} else {
+#line 891
IF (err != NC_ECHAR)
+#line 891
error("wrong type: status = %d", err);
+#line 891
}
+#line 891
}
+#line 891
}
+#line 891
+#line 891
err = nc_close(ncid);
+#line 891
IF (err)
+#line 891
error("nc_close: %s", nc_strerror(err));
+#line 891
print_nok(nok);
+#line 891
}
+#line 891
void
+#line 892
test_nc_get_att_short(void)
+#line 892
{
+#line 892
int ncid;
+#line 892
int i;
+#line 892
int j;
+#line 892
size_t k;
+#line 892
int err;
+#line 892
int allInExtRange;
+#line 892
int allInIntRange;
+#line 892
int canConvert; /* Both text or both numeric */
+#line 892
short value[MAX_NELS];
+#line 892
double expect[MAX_NELS];
+#line 892
int nok = 0; /* count of valid comparisons */
+#line 892
+#line 892
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 892
IF (err)
+#line 892
error("nc_open: %s", nc_strerror(err));
+#line 892
+#line 892
for (i = -1; i < NVARS; i++) {
+#line 892
for (j = 0; j < NATTS(i); j++) {
+#line 892
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 892
err = nc_get_att_short(BAD_ID, i, ATT_NAME(i,j), value);
+#line 892
IF (err != NC_EBADID)
+#line 892
error("bad ncid: status = %d", err);
+#line 892
err = nc_get_att_short(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 892
IF (err != NC_ENOTVAR)
+#line 892
error("bad var id: status = %d", err);
+#line 892
err = nc_get_att_short(ncid, i, "noSuch", value);
+#line 892
IF (err != NC_ENOTATT)
+#line 892
error("Bad attribute name: status = %d", err);
+#line 892
allInExtRange = allInIntRange = 1;
+#line 892
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 892
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_SHORT);
+#line 892
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SHORT)) {
+#line 892
allInIntRange = allInIntRange && expect[k] >= short_min
+#line 892
&& expect[k] <= short_max;
+#line 892
} else {
+#line 892
allInExtRange = 0;
+#line 892
}
+#line 892
}
+#line 892
err = nc_get_att_short(ncid, i, ATT_NAME(i,j), value);
+#line 892
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 892
if (allInExtRange) {
+#line 892
if (allInIntRange) {
+#line 892
IF (err)
+#line 892
error("%s", nc_strerror(err));
+#line 892
} else {
+#line 892
IF (err != NC_ERANGE)
+#line 892
error("Range error: status = %d", err);
+#line 892
}
+#line 892
} else {
+#line 892
IF (err != 0 && err != NC_ERANGE)
+#line 892
error("OK or Range error: status = %d", err);
+#line 892
}
+#line 892
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 892
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SHORT)
+#line 892
&& expect[k] >= short_min && expect[k] <= short_max) {
+#line 892
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_SHORT)){
+#line 892
error("value read not that expected");
+#line 892
if (verbose) {
+#line 892
error("\n");
+#line 892
error("varid: %d, ", i);
+#line 892
error("att_name: %s, ", ATT_NAME(i,j));
+#line 892
error("element number: %d ", k);
+#line 892
error("expect: %g", expect[k]);
+#line 892
error("got: %g", (double) value[k]);
+#line 892
}
+#line 892
} else {
+#line 892
nok++;
+#line 892
}
+#line 892
}
+#line 892
}
+#line 892
} else {
+#line 892
IF (err != NC_ECHAR)
+#line 892
error("wrong type: status = %d", err);
+#line 892
}
+#line 892
}
+#line 892
}
+#line 892
+#line 892
err = nc_close(ncid);
+#line 892
IF (err)
+#line 892
error("nc_close: %s", nc_strerror(err));
+#line 892
print_nok(nok);
+#line 892
}
+#line 892
void
+#line 893
test_nc_get_att_int(void)
+#line 893
{
+#line 893
int ncid;
+#line 893
int i;
+#line 893
int j;
+#line 893
size_t k;
+#line 893
int err;
+#line 893
int allInExtRange;
+#line 893
int allInIntRange;
+#line 893
int canConvert; /* Both text or both numeric */
+#line 893
int value[MAX_NELS];
+#line 893
double expect[MAX_NELS];
+#line 893
int nok = 0; /* count of valid comparisons */
+#line 893
+#line 893
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 893
IF (err)
+#line 893
error("nc_open: %s", nc_strerror(err));
+#line 893
+#line 893
for (i = -1; i < NVARS; i++) {
+#line 893
for (j = 0; j < NATTS(i); j++) {
+#line 893
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 893
err = nc_get_att_int(BAD_ID, i, ATT_NAME(i,j), value);
+#line 893
IF (err != NC_EBADID)
+#line 893
error("bad ncid: status = %d", err);
+#line 893
err = nc_get_att_int(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 893
IF (err != NC_ENOTVAR)
+#line 893
error("bad var id: status = %d", err);
+#line 893
err = nc_get_att_int(ncid, i, "noSuch", value);
+#line 893
IF (err != NC_ENOTATT)
+#line 893
error("Bad attribute name: status = %d", err);
+#line 893
allInExtRange = allInIntRange = 1;
+#line 893
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 893
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_INT);
+#line 893
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_INT)) {
+#line 893
allInIntRange = allInIntRange && expect[k] >= int_min
+#line 893
&& expect[k] <= int_max;
+#line 893
} else {
+#line 893
allInExtRange = 0;
+#line 893
}
+#line 893
}
+#line 893
err = nc_get_att_int(ncid, i, ATT_NAME(i,j), value);
+#line 893
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 893
if (allInExtRange) {
+#line 893
if (allInIntRange) {
+#line 893
IF (err)
+#line 893
error("%s", nc_strerror(err));
+#line 893
} else {
+#line 893
IF (err != NC_ERANGE)
+#line 893
error("Range error: status = %d", err);
+#line 893
}
+#line 893
} else {
+#line 893
IF (err != 0 && err != NC_ERANGE)
+#line 893
error("OK or Range error: status = %d", err);
+#line 893
}
+#line 893
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 893
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_INT)
+#line 893
&& expect[k] >= int_min && expect[k] <= int_max) {
+#line 893
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_INT)){
+#line 893
error("value read not that expected");
+#line 893
if (verbose) {
+#line 893
error("\n");
+#line 893
error("varid: %d, ", i);
+#line 893
error("att_name: %s, ", ATT_NAME(i,j));
+#line 893
error("element number: %d ", k);
+#line 893
error("expect: %g", expect[k]);
+#line 893
error("got: %g", (double) value[k]);
+#line 893
}
+#line 893
} else {
+#line 893
nok++;
+#line 893
}
+#line 893
}
+#line 893
}
+#line 893
} else {
+#line 893
IF (err != NC_ECHAR)
+#line 893
error("wrong type: status = %d", err);
+#line 893
}
+#line 893
}
+#line 893
}
+#line 893
+#line 893
err = nc_close(ncid);
+#line 893
IF (err)
+#line 893
error("nc_close: %s", nc_strerror(err));
+#line 893
print_nok(nok);
+#line 893
}
+#line 893
void
+#line 894
test_nc_get_att_long(void)
+#line 894
{
+#line 894
int ncid;
+#line 894
int i;
+#line 894
int j;
+#line 894
size_t k;
+#line 894
int err;
+#line 894
int allInExtRange;
+#line 894
int allInIntRange;
+#line 894
int canConvert; /* Both text or both numeric */
+#line 894
long value[MAX_NELS];
+#line 894
double expect[MAX_NELS];
+#line 894
int nok = 0; /* count of valid comparisons */
+#line 894
+#line 894
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 894
IF (err)
+#line 894
error("nc_open: %s", nc_strerror(err));
+#line 894
+#line 894
for (i = -1; i < NVARS; i++) {
+#line 894
for (j = 0; j < NATTS(i); j++) {
+#line 894
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 894
err = nc_get_att_long(BAD_ID, i, ATT_NAME(i,j), value);
+#line 894
IF (err != NC_EBADID)
+#line 894
error("bad ncid: status = %d", err);
+#line 894
err = nc_get_att_long(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 894
IF (err != NC_ENOTVAR)
+#line 894
error("bad var id: status = %d", err);
+#line 894
err = nc_get_att_long(ncid, i, "noSuch", value);
+#line 894
IF (err != NC_ENOTATT)
+#line 894
error("Bad attribute name: status = %d", err);
+#line 894
allInExtRange = allInIntRange = 1;
+#line 894
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 894
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_LONG);
+#line 894
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONG)) {
+#line 894
allInIntRange = allInIntRange && expect[k] >= long_min
+#line 894
&& expect[k] <= long_max;
+#line 894
} else {
+#line 894
allInExtRange = 0;
+#line 894
}
+#line 894
}
+#line 894
err = nc_get_att_long(ncid, i, ATT_NAME(i,j), value);
+#line 894
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 894
if (allInExtRange) {
+#line 894
if (allInIntRange) {
+#line 894
IF (err)
+#line 894
error("%s", nc_strerror(err));
+#line 894
} else {
+#line 894
IF (err != NC_ERANGE)
+#line 894
error("Range error: status = %d", err);
+#line 894
}
+#line 894
} else {
+#line 894
IF (err != 0 && err != NC_ERANGE)
+#line 894
error("OK or Range error: status = %d", err);
+#line 894
}
+#line 894
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 894
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONG)
+#line 894
&& expect[k] >= long_min && expect[k] <= long_max) {
+#line 894
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_LONG)){
+#line 894
error("value read not that expected");
+#line 894
if (verbose) {
+#line 894
error("\n");
+#line 894
error("varid: %d, ", i);
+#line 894
error("att_name: %s, ", ATT_NAME(i,j));
+#line 894
error("element number: %d ", k);
+#line 894
error("expect: %g", expect[k]);
+#line 894
error("got: %g", (double) value[k]);
+#line 894
}
+#line 894
} else {
+#line 894
nok++;
+#line 894
}
+#line 894
}
+#line 894
}
+#line 894
} else {
+#line 894
IF (err != NC_ECHAR)
+#line 894
error("wrong type: status = %d", err);
+#line 894
}
+#line 894
}
+#line 894
}
+#line 894
+#line 894
err = nc_close(ncid);
+#line 894
IF (err)
+#line 894
error("nc_close: %s", nc_strerror(err));
+#line 894
print_nok(nok);
+#line 894
}
+#line 894
void
+#line 895
test_nc_get_att_float(void)
+#line 895
{
+#line 895
int ncid;
+#line 895
int i;
+#line 895
int j;
+#line 895
size_t k;
+#line 895
int err;
+#line 895
int allInExtRange;
+#line 895
int allInIntRange;
+#line 895
int canConvert; /* Both text or both numeric */
+#line 895
float value[MAX_NELS];
+#line 895
double expect[MAX_NELS];
+#line 895
int nok = 0; /* count of valid comparisons */
+#line 895
+#line 895
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 895
IF (err)
+#line 895
error("nc_open: %s", nc_strerror(err));
+#line 895
+#line 895
for (i = -1; i < NVARS; i++) {
+#line 895
for (j = 0; j < NATTS(i); j++) {
+#line 895
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 895
err = nc_get_att_float(BAD_ID, i, ATT_NAME(i,j), value);
+#line 895
IF (err != NC_EBADID)
+#line 895
error("bad ncid: status = %d", err);
+#line 895
err = nc_get_att_float(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 895
IF (err != NC_ENOTVAR)
+#line 895
error("bad var id: status = %d", err);
+#line 895
err = nc_get_att_float(ncid, i, "noSuch", value);
+#line 895
IF (err != NC_ENOTATT)
+#line 895
error("Bad attribute name: status = %d", err);
+#line 895
allInExtRange = allInIntRange = 1;
+#line 895
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 895
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_FLOAT);
+#line 895
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_FLOAT)) {
+#line 895
allInIntRange = allInIntRange && expect[k] >= float_min
+#line 895
&& expect[k] <= float_max;
+#line 895
} else {
+#line 895
allInExtRange = 0;
+#line 895
}
+#line 895
}
+#line 895
err = nc_get_att_float(ncid, i, ATT_NAME(i,j), value);
+#line 895
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 895
if (allInExtRange) {
+#line 895
if (allInIntRange) {
+#line 895
IF (err)
+#line 895
error("%s", nc_strerror(err));
+#line 895
} else {
+#line 895
IF (err != NC_ERANGE)
+#line 895
error("Range error: status = %d", err);
+#line 895
}
+#line 895
} else {
+#line 895
IF (err != 0 && err != NC_ERANGE)
+#line 895
error("OK or Range error: status = %d", err);
+#line 895
}
+#line 895
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 895
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_FLOAT)
+#line 895
&& expect[k] >= float_min && expect[k] <= float_max) {
+#line 895
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_FLOAT)){
+#line 895
error("value read not that expected");
+#line 895
if (verbose) {
+#line 895
error("\n");
+#line 895
error("varid: %d, ", i);
+#line 895
error("att_name: %s, ", ATT_NAME(i,j));
+#line 895
error("element number: %d ", k);
+#line 895
error("expect: %g", expect[k]);
+#line 895
error("got: %g", (double) value[k]);
+#line 895
}
+#line 895
} else {
+#line 895
nok++;
+#line 895
}
+#line 895
}
+#line 895
}
+#line 895
} else {
+#line 895
IF (err != NC_ECHAR)
+#line 895
error("wrong type: status = %d", err);
+#line 895
}
+#line 895
}
+#line 895
}
+#line 895
+#line 895
err = nc_close(ncid);
+#line 895
IF (err)
+#line 895
error("nc_close: %s", nc_strerror(err));
+#line 895
print_nok(nok);
+#line 895
}
+#line 895
void
+#line 896
test_nc_get_att_double(void)
+#line 896
{
+#line 896
int ncid;
+#line 896
int i;
+#line 896
int j;
+#line 896
size_t k;
+#line 896
int err;
+#line 896
int allInExtRange;
+#line 896
int allInIntRange;
+#line 896
int canConvert; /* Both text or both numeric */
+#line 896
double value[MAX_NELS];
+#line 896
double expect[MAX_NELS];
+#line 896
int nok = 0; /* count of valid comparisons */
+#line 896
+#line 896
err = nc_open(testfile, NC_NOWRITE, &ncid);
+#line 896
IF (err)
+#line 896
error("nc_open: %s", nc_strerror(err));
+#line 896
+#line 896
for (i = -1; i < NVARS; i++) {
+#line 896
for (j = 0; j < NATTS(i); j++) {
+#line 896
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 896
err = nc_get_att_double(BAD_ID, i, ATT_NAME(i,j), value);
+#line 896
IF (err != NC_EBADID)
+#line 896
error("bad ncid: status = %d", err);
+#line 896
err = nc_get_att_double(ncid, BAD_VARID, ATT_NAME(i,j), value);
+#line 896
IF (err != NC_ENOTVAR)
+#line 896
error("bad var id: status = %d", err);
+#line 896
err = nc_get_att_double(ncid, i, "noSuch", value);
+#line 896
IF (err != NC_ENOTATT)
+#line 896
error("Bad attribute name: status = %d", err);
+#line 896
allInExtRange = allInIntRange = 1;
+#line 896
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 896
expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_DOUBLE);
+#line 896
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_DOUBLE)) {
+#line 896
allInIntRange = allInIntRange && expect[k] >= double_min
+#line 896
&& expect[k] <= double_max;
+#line 896
} else {
+#line 896
allInExtRange = 0;
+#line 896
}
+#line 896
}
+#line 896
err = nc_get_att_double(ncid, i, ATT_NAME(i,j), value);
+#line 896
if (canConvert || ATT_LEN(i,j) == 0) {
+#line 896
if (allInExtRange) {
+#line 896
if (allInIntRange) {
+#line 896
IF (err)
+#line 896
error("%s", nc_strerror(err));
+#line 896
} else {
+#line 896
IF (err != NC_ERANGE)
+#line 896
error("Range error: status = %d", err);
+#line 896
}
+#line 896
} else {
+#line 896
IF (err != 0 && err != NC_ERANGE)
+#line 896
error("OK or Range error: status = %d", err);
+#line 896
}
+#line 896
for (k = 0; k < ATT_LEN(i,j); k++) {
+#line 896
if (inRange3(expect[k],ATT_TYPE(i,j),NCT_DOUBLE)
+#line 896
&& expect[k] >= double_min && expect[k] <= double_max) {
+#line 896
IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_DOUBLE)){
+#line 896
error("value read not that expected");
+#line 896
if (verbose) {
+#line 896
error("\n");
+#line 896
error("varid: %d, ", i);
+#line 896
error("att_name: %s, ", ATT_NAME(i,j));
+#line 896
error("element number: %d ", k);
+#line 896
error("expect: %g", expect[k]);
+#line 896
error("got: %g", (double) value[k]);
+#line 896
}
+#line 896
} else {
+#line 896
nok++;
+#line 896
}
+#line 896
}
+#line 896
}
+#line 896
} else {
+#line 896
IF (err != NC_ECHAR)
+#line 896
error("wrong type: status = %d", err);
+#line 896
}
+#line 896
}
+#line 896
}
+#line 896
+#line 896
err = nc_close(ncid);
+#line 896
IF (err)
+#line 896
error("nc_close: %s", nc_strerror(err));
+#line 896
print_nok(nok);
+#line 896
}
+#line 896
diff --git a/nc_test/test_put.c b/nc_test/test_put.c
index d24cc12..39e5e2d 100644
--- a/nc_test/test_put.c
+++ b/nc_test/test_put.c
@@ -1,6858 +1,13629 @@
+#line 5 "test_put.m4"
/* Do not edit this file. It is produced from the corresponding .m4 source */
+#line 7
/*********************************************************************
* Copyright 1996, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
* $Id: test_put.m4,v 1.25 2005/03/08 03:04:19 ed Exp $
*********************************************************************/
+#line 31
#include "tests.h"
+#line 55
/*
+#line 56
* ensure hash value within range for internal TYPE
+#line 56
*/
+#line 56
static
+#line 56
double
+#line 56
hash_text(
+#line 56
const nc_type type,
+#line 56
const int rank,
+#line 56
const size_t *index,
+#line 56
const nct_itype itype)
+#line 56
{
+#line 56
const double min = text_min;
+#line 56
const double max = text_max;
+#line 56
+#line 56
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 56
}
+#line 56
/*
+#line 57
* ensure hash value within range for internal TYPE
+#line 57
*/
+#line 57
static
+#line 57
double
+#line 57
hash_uchar(
+#line 57
const nc_type type,
+#line 57
const int rank,
+#line 57
const size_t *index,
+#line 57
const nct_itype itype)
+#line 57
{
+#line 57
const double min = uchar_min;
+#line 57
const double max = uchar_max;
+#line 57
+#line 57
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 57
}
+#line 57
/*
+#line 58
* ensure hash value within range for internal TYPE
+#line 58
*/
+#line 58
static
+#line 58
double
+#line 58
hash_schar(
+#line 58
const nc_type type,
+#line 58
const int rank,
+#line 58
const size_t *index,
+#line 58
const nct_itype itype)
+#line 58
{
+#line 58
const double min = schar_min;
+#line 58
const double max = schar_max;
+#line 58
+#line 58
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 58
}
+#line 58
/*
+#line 59
* ensure hash value within range for internal TYPE
+#line 59
*/
+#line 59
static
+#line 59
double
+#line 59
hash_short(
+#line 59
const nc_type type,
+#line 59
const int rank,
+#line 59
const size_t *index,
+#line 59
const nct_itype itype)
+#line 59
{
+#line 59
const double min = short_min;
+#line 59
const double max = short_max;
+#line 59
+#line 59
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 59
}
+#line 59
/*
+#line 60
* ensure hash value within range for internal TYPE
+#line 60
*/
+#line 60
static
+#line 60
double
+#line 60
hash_int(
+#line 60
const nc_type type,
+#line 60
const int rank,
+#line 60
const size_t *index,
+#line 60
const nct_itype itype)
+#line 60
{
+#line 60
const double min = int_min;
+#line 60
const double max = int_max;
+#line 60
+#line 60
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 60
}
+#line 60
/*
+#line 61
* ensure hash value within range for internal TYPE
+#line 61
*/
+#line 61
static
+#line 61
double
+#line 61
hash_long(
+#line 61
const nc_type type,
+#line 61
const int rank,
+#line 61
const size_t *index,
+#line 61
const nct_itype itype)
+#line 61
{
+#line 61
const double min = long_min;
+#line 61
const double max = long_max;
+#line 61
+#line 61
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 61
}
+#line 61
/*
+#line 62
* ensure hash value within range for internal TYPE
+#line 62
*/
+#line 62
static
+#line 62
double
+#line 62
hash_float(
+#line 62
const nc_type type,
+#line 62
const int rank,
+#line 62
const size_t *index,
+#line 62
const nct_itype itype)
+#line 62
{
+#line 62
const double min = float_min;
+#line 62
const double max = float_max;
+#line 62
+#line 62
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 62
}
+#line 62
/*
+#line 63
* ensure hash value within range for internal TYPE
+#line 63
*/
+#line 63
static
+#line 63
double
+#line 63
hash_double(
+#line 63
const nc_type type,
+#line 63
const int rank,
+#line 63
const size_t *index,
+#line 63
const nct_itype itype)
+#line 63
{
+#line 63
const double min = double_min;
+#line 63
const double max = double_max;
+#line 63
+#line 63
return MAX(min, MIN(max, hash4( type, rank, index, itype)));
+#line 63
}
+#line 63
+#line 154
/*
+#line 155
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 155
*/
+#line 155
static
+#line 155
void
+#line 155
check_vars_text(const char *filename)
+#line 155
{
+#line 155
int ncid; /* netCDF id */
+#line 155
size_t index[MAX_RANK];
+#line 155
int err; /* status */
+#line 155
int d;
+#line 155
int i;
+#line 155
size_t j;
+#line 155
text value;
+#line 155
nc_type datatype;
+#line 155
int ndims;
+#line 155
int dimids[MAX_RANK];
+#line 155
double expect;
+#line 155
char name[NC_MAX_NAME];
+#line 155
size_t length;
+#line 155
int canConvert; /* Both text or both numeric */
+#line 155
int nok = 0; /* count of valid comparisons */
+#line 155
+#line 155
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 155
IF (err)
+#line 155
error("nc_open: %s", nc_strerror(err));
+#line 155
+#line 155
for (i = 0; i < NVARS; i++) {
+#line 155
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 155
if (canConvert) {
+#line 155
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 155
IF (err)
+#line 155
error("nc_inq_var: %s", nc_strerror(err));
+#line 155
IF (strcmp(name, var_name[i]) != 0)
+#line 155
error("Unexpected var_name");
+#line 155
IF (datatype != var_type[i])
+#line 155
error("Unexpected type");
+#line 155
IF (ndims != var_rank[i])
+#line 155
error("Unexpected rank");
+#line 155
for (j = 0; j < ndims; j++) {
+#line 155
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 155
IF (err)
+#line 155
error("nc_inq_dim: %s", nc_strerror(err));
+#line 155
IF (length != var_shape[i][j])
+#line 155
error("Unexpected shape");
+#line 155
}
+#line 155
for (j = 0; j < var_nels[i]; j++) {
+#line 155
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 155
IF (err)
+#line 155
error("error in toMixedBase 2");
+#line 155
expect = hash4( var_type[i], var_rank[i], index, NCT_TEXT);
+#line 155
err = nc_get_var1_text(ncid, i, index, &value);
+#line 155
if (inRange3(expect,datatype,NCT_TEXT)) {
+#line 155
if (expect >= text_min && expect <= text_max) {
+#line 155
IF (err) {
+#line 155
error("nc_get_var1_text: %s", nc_strerror(err));
+#line 155
} else {
+#line 155
IF (!equal(value,expect,var_type[i],NCT_TEXT)) {
+#line 155
error("Var value read not that expected");
+#line 155
if (verbose) {
+#line 155
error("\n");
+#line 155
error("varid: %d, ", i);
+#line 155
error("var_name: %s, ", var_name[i]);
+#line 155
error("index:");
+#line 155
for (d = 0; d < var_rank[i]; d++)
+#line 155
error(" %d", index[d]);
+#line 155
error(", expect: %g, ", expect);
+#line 155
error("got: %g", (double) value);
+#line 155
}
+#line 155
} else {
+#line 155
++nok;
+#line 155
}
+#line 155
}
+#line 155
}
+#line 155
}
+#line 155
}
+#line 155
}
+#line 155
}
+#line 155
err = nc_close (ncid);
+#line 155
IF (err)
+#line 155
error("nc_close: %s", nc_strerror(err));
+#line 155
print_nok(nok);
+#line 155
}
+#line 155
/*
+#line 156
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 156
*/
+#line 156
static
+#line 156
void
+#line 156
check_vars_uchar(const char *filename)
+#line 156
{
+#line 156
int ncid; /* netCDF id */
+#line 156
size_t index[MAX_RANK];
+#line 156
int err; /* status */
+#line 156
int d;
+#line 156
int i;
+#line 156
size_t j;
+#line 156
uchar value;
+#line 156
nc_type datatype;
+#line 156
int ndims;
+#line 156
int dimids[MAX_RANK];
+#line 156
double expect;
+#line 156
char name[NC_MAX_NAME];
+#line 156
size_t length;
+#line 156
int canConvert; /* Both text or both numeric */
+#line 156
int nok = 0; /* count of valid comparisons */
+#line 156
+#line 156
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 156
IF (err)
+#line 156
error("nc_open: %s", nc_strerror(err));
+#line 156
+#line 156
for (i = 0; i < NVARS; i++) {
+#line 156
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 156
if (canConvert) {
+#line 156
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 156
IF (err)
+#line 156
error("nc_inq_var: %s", nc_strerror(err));
+#line 156
IF (strcmp(name, var_name[i]) != 0)
+#line 156
error("Unexpected var_name");
+#line 156
IF (datatype != var_type[i])
+#line 156
error("Unexpected type");
+#line 156
IF (ndims != var_rank[i])
+#line 156
error("Unexpected rank");
+#line 156
for (j = 0; j < ndims; j++) {
+#line 156
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 156
IF (err)
+#line 156
error("nc_inq_dim: %s", nc_strerror(err));
+#line 156
IF (length != var_shape[i][j])
+#line 156
error("Unexpected shape");
+#line 156
}
+#line 156
for (j = 0; j < var_nels[i]; j++) {
+#line 156
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 156
IF (err)
+#line 156
error("error in toMixedBase 2");
+#line 156
expect = hash4( var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 156
err = nc_get_var1_uchar(ncid, i, index, &value);
+#line 156
if (inRange3(expect,datatype,NCT_UCHAR)) {
+#line 156
if (expect >= uchar_min && expect <= uchar_max) {
+#line 156
IF (err) {
+#line 156
error("nc_get_var1_uchar: %s", nc_strerror(err));
+#line 156
} else {
+#line 156
IF (!equal(value,expect,var_type[i],NCT_UCHAR)) {
+#line 156
error("Var value read not that expected");
+#line 156
if (verbose) {
+#line 156
error("\n");
+#line 156
error("varid: %d, ", i);
+#line 156
error("var_name: %s, ", var_name[i]);
+#line 156
error("index:");
+#line 156
for (d = 0; d < var_rank[i]; d++)
+#line 156
error(" %d", index[d]);
+#line 156
error(", expect: %g, ", expect);
+#line 156
error("got: %g", (double) value);
+#line 156
}
+#line 156
} else {
+#line 156
++nok;
+#line 156
}
+#line 156
}
+#line 156
}
+#line 156
}
+#line 156
}
+#line 156
}
+#line 156
}
+#line 156
err = nc_close (ncid);
+#line 156
IF (err)
+#line 156
error("nc_close: %s", nc_strerror(err));
+#line 156
print_nok(nok);
+#line 156
}
+#line 156
/*
+#line 157
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 157
*/
+#line 157
static
+#line 157
void
+#line 157
check_vars_schar(const char *filename)
+#line 157
{
+#line 157
int ncid; /* netCDF id */
+#line 157
size_t index[MAX_RANK];
+#line 157
int err; /* status */
+#line 157
int d;
+#line 157
int i;
+#line 157
size_t j;
+#line 157
schar value;
+#line 157
nc_type datatype;
+#line 157
int ndims;
+#line 157
int dimids[MAX_RANK];
+#line 157
double expect;
+#line 157
char name[NC_MAX_NAME];
+#line 157
size_t length;
+#line 157
int canConvert; /* Both text or both numeric */
+#line 157
int nok = 0; /* count of valid comparisons */
+#line 157
+#line 157
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 157
IF (err)
+#line 157
error("nc_open: %s", nc_strerror(err));
+#line 157
+#line 157
for (i = 0; i < NVARS; i++) {
+#line 157
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 157
if (canConvert) {
+#line 157
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 157
IF (err)
+#line 157
error("nc_inq_var: %s", nc_strerror(err));
+#line 157
IF (strcmp(name, var_name[i]) != 0)
+#line 157
error("Unexpected var_name");
+#line 157
IF (datatype != var_type[i])
+#line 157
error("Unexpected type");
+#line 157
IF (ndims != var_rank[i])
+#line 157
error("Unexpected rank");
+#line 157
for (j = 0; j < ndims; j++) {
+#line 157
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 157
IF (err)
+#line 157
error("nc_inq_dim: %s", nc_strerror(err));
+#line 157
IF (length != var_shape[i][j])
+#line 157
error("Unexpected shape");
+#line 157
}
+#line 157
for (j = 0; j < var_nels[i]; j++) {
+#line 157
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 157
IF (err)
+#line 157
error("error in toMixedBase 2");
+#line 157
expect = hash4( var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 157
err = nc_get_var1_schar(ncid, i, index, &value);
+#line 157
if (inRange3(expect,datatype,NCT_SCHAR)) {
+#line 157
if (expect >= schar_min && expect <= schar_max) {
+#line 157
IF (err) {
+#line 157
error("nc_get_var1_schar: %s", nc_strerror(err));
+#line 157
} else {
+#line 157
IF (!equal(value,expect,var_type[i],NCT_SCHAR)) {
+#line 157
error("Var value read not that expected");
+#line 157
if (verbose) {
+#line 157
error("\n");
+#line 157
error("varid: %d, ", i);
+#line 157
error("var_name: %s, ", var_name[i]);
+#line 157
error("index:");
+#line 157
for (d = 0; d < var_rank[i]; d++)
+#line 157
error(" %d", index[d]);
+#line 157
error(", expect: %g, ", expect);
+#line 157
error("got: %g", (double) value);
+#line 157
}
+#line 157
} else {
+#line 157
++nok;
+#line 157
}
+#line 157
}
+#line 157
}
+#line 157
}
+#line 157
}
+#line 157
}
+#line 157
}
+#line 157
err = nc_close (ncid);
+#line 157
IF (err)
+#line 157
error("nc_close: %s", nc_strerror(err));
+#line 157
print_nok(nok);
+#line 157
}
+#line 157
/*
+#line 158
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 158
*/
+#line 158
static
+#line 158
void
+#line 158
check_vars_short(const char *filename)
+#line 158
{
+#line 158
int ncid; /* netCDF id */
+#line 158
size_t index[MAX_RANK];
+#line 158
int err; /* status */
+#line 158
int d;
+#line 158
int i;
+#line 158
size_t j;
+#line 158
short value;
+#line 158
nc_type datatype;
+#line 158
int ndims;
+#line 158
int dimids[MAX_RANK];
+#line 158
double expect;
+#line 158
char name[NC_MAX_NAME];
+#line 158
size_t length;
+#line 158
int canConvert; /* Both text or both numeric */
+#line 158
int nok = 0; /* count of valid comparisons */
+#line 158
+#line 158
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 158
IF (err)
+#line 158
error("nc_open: %s", nc_strerror(err));
+#line 158
+#line 158
for (i = 0; i < NVARS; i++) {
+#line 158
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 158
if (canConvert) {
+#line 158
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 158
IF (err)
+#line 158
error("nc_inq_var: %s", nc_strerror(err));
+#line 158
IF (strcmp(name, var_name[i]) != 0)
+#line 158
error("Unexpected var_name");
+#line 158
IF (datatype != var_type[i])
+#line 158
error("Unexpected type");
+#line 158
IF (ndims != var_rank[i])
+#line 158
error("Unexpected rank");
+#line 158
for (j = 0; j < ndims; j++) {
+#line 158
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 158
IF (err)
+#line 158
error("nc_inq_dim: %s", nc_strerror(err));
+#line 158
IF (length != var_shape[i][j])
+#line 158
error("Unexpected shape");
+#line 158
}
+#line 158
for (j = 0; j < var_nels[i]; j++) {
+#line 158
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 158
IF (err)
+#line 158
error("error in toMixedBase 2");
+#line 158
expect = hash4( var_type[i], var_rank[i], index, NCT_SHORT);
+#line 158
err = nc_get_var1_short(ncid, i, index, &value);
+#line 158
if (inRange3(expect,datatype,NCT_SHORT)) {
+#line 158
if (expect >= short_min && expect <= short_max) {
+#line 158
IF (err) {
+#line 158
error("nc_get_var1_short: %s", nc_strerror(err));
+#line 158
} else {
+#line 158
IF (!equal(value,expect,var_type[i],NCT_SHORT)) {
+#line 158
error("Var value read not that expected");
+#line 158
if (verbose) {
+#line 158
error("\n");
+#line 158
error("varid: %d, ", i);
+#line 158
error("var_name: %s, ", var_name[i]);
+#line 158
error("index:");
+#line 158
for (d = 0; d < var_rank[i]; d++)
+#line 158
error(" %d", index[d]);
+#line 158
error(", expect: %g, ", expect);
+#line 158
error("got: %g", (double) value);
+#line 158
}
+#line 158
} else {
+#line 158
++nok;
+#line 158
}
+#line 158
}
+#line 158
}
+#line 158
}
+#line 158
}
+#line 158
}
+#line 158
}
+#line 158
err = nc_close (ncid);
+#line 158
IF (err)
+#line 158
error("nc_close: %s", nc_strerror(err));
+#line 158
print_nok(nok);
+#line 158
}
+#line 158
/*
+#line 159
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 159
*/
+#line 159
static
+#line 159
void
+#line 159
check_vars_int(const char *filename)
+#line 159
{
+#line 159
int ncid; /* netCDF id */
+#line 159
size_t index[MAX_RANK];
+#line 159
int err; /* status */
+#line 159
int d;
+#line 159
int i;
+#line 159
size_t j;
+#line 159
int value;
+#line 159
nc_type datatype;
+#line 159
int ndims;
+#line 159
int dimids[MAX_RANK];
+#line 159
double expect;
+#line 159
char name[NC_MAX_NAME];
+#line 159
size_t length;
+#line 159
int canConvert; /* Both text or both numeric */
+#line 159
int nok = 0; /* count of valid comparisons */
+#line 159
+#line 159
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 159
IF (err)
+#line 159
error("nc_open: %s", nc_strerror(err));
+#line 159
+#line 159
for (i = 0; i < NVARS; i++) {
+#line 159
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 159
if (canConvert) {
+#line 159
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 159
IF (err)
+#line 159
error("nc_inq_var: %s", nc_strerror(err));
+#line 159
IF (strcmp(name, var_name[i]) != 0)
+#line 159
error("Unexpected var_name");
+#line 159
IF (datatype != var_type[i])
+#line 159
error("Unexpected type");
+#line 159
IF (ndims != var_rank[i])
+#line 159
error("Unexpected rank");
+#line 159
for (j = 0; j < ndims; j++) {
+#line 159
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 159
IF (err)
+#line 159
error("nc_inq_dim: %s", nc_strerror(err));
+#line 159
IF (length != var_shape[i][j])
+#line 159
error("Unexpected shape");
+#line 159
}
+#line 159
for (j = 0; j < var_nels[i]; j++) {
+#line 159
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 159
IF (err)
+#line 159
error("error in toMixedBase 2");
+#line 159
expect = hash4( var_type[i], var_rank[i], index, NCT_INT);
+#line 159
err = nc_get_var1_int(ncid, i, index, &value);
+#line 159
if (inRange3(expect,datatype,NCT_INT)) {
+#line 159
if (expect >= int_min && expect <= int_max) {
+#line 159
IF (err) {
+#line 159
error("nc_get_var1_int: %s", nc_strerror(err));
+#line 159
} else {
+#line 159
IF (!equal(value,expect,var_type[i],NCT_INT)) {
+#line 159
error("Var value read not that expected");
+#line 159
if (verbose) {
+#line 159
error("\n");
+#line 159
error("varid: %d, ", i);
+#line 159
error("var_name: %s, ", var_name[i]);
+#line 159
error("index:");
+#line 159
for (d = 0; d < var_rank[i]; d++)
+#line 159
error(" %d", index[d]);
+#line 159
error(", expect: %g, ", expect);
+#line 159
error("got: %g", (double) value);
+#line 159
}
+#line 159
} else {
+#line 159
++nok;
+#line 159
}
+#line 159
}
+#line 159
}
+#line 159
}
+#line 159
}
+#line 159
}
+#line 159
}
+#line 159
err = nc_close (ncid);
+#line 159
IF (err)
+#line 159
error("nc_close: %s", nc_strerror(err));
+#line 159
print_nok(nok);
+#line 159
}
+#line 159
/*
+#line 160
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 160
*/
+#line 160
static
+#line 160
void
+#line 160
check_vars_long(const char *filename)
+#line 160
{
+#line 160
int ncid; /* netCDF id */
+#line 160
size_t index[MAX_RANK];
+#line 160
int err; /* status */
+#line 160
int d;
+#line 160
int i;
+#line 160
size_t j;
+#line 160
long value;
+#line 160
nc_type datatype;
+#line 160
int ndims;
+#line 160
int dimids[MAX_RANK];
+#line 160
double expect;
+#line 160
char name[NC_MAX_NAME];
+#line 160
size_t length;
+#line 160
int canConvert; /* Both text or both numeric */
+#line 160
int nok = 0; /* count of valid comparisons */
+#line 160
+#line 160
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 160
IF (err)
+#line 160
error("nc_open: %s", nc_strerror(err));
+#line 160
+#line 160
for (i = 0; i < NVARS; i++) {
+#line 160
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 160
if (canConvert) {
+#line 160
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 160
IF (err)
+#line 160
error("nc_inq_var: %s", nc_strerror(err));
+#line 160
IF (strcmp(name, var_name[i]) != 0)
+#line 160
error("Unexpected var_name");
+#line 160
IF (datatype != var_type[i])
+#line 160
error("Unexpected type");
+#line 160
IF (ndims != var_rank[i])
+#line 160
error("Unexpected rank");
+#line 160
for (j = 0; j < ndims; j++) {
+#line 160
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 160
IF (err)
+#line 160
error("nc_inq_dim: %s", nc_strerror(err));
+#line 160
IF (length != var_shape[i][j])
+#line 160
error("Unexpected shape");
+#line 160
}
+#line 160
for (j = 0; j < var_nels[i]; j++) {
+#line 160
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 160
IF (err)
+#line 160
error("error in toMixedBase 2");
+#line 160
expect = hash4( var_type[i], var_rank[i], index, NCT_LONG);
+#line 160
err = nc_get_var1_long(ncid, i, index, &value);
+#line 160
if (inRange3(expect,datatype,NCT_LONG)) {
+#line 160
if (expect >= long_min && expect <= long_max) {
+#line 160
IF (err) {
+#line 160
error("nc_get_var1_long: %s", nc_strerror(err));
+#line 160
} else {
+#line 160
IF (!equal(value,expect,var_type[i],NCT_LONG)) {
+#line 160
error("Var value read not that expected");
+#line 160
if (verbose) {
+#line 160
error("\n");
+#line 160
error("varid: %d, ", i);
+#line 160
error("var_name: %s, ", var_name[i]);
+#line 160
error("index:");
+#line 160
for (d = 0; d < var_rank[i]; d++)
+#line 160
error(" %d", index[d]);
+#line 160
error(", expect: %g, ", expect);
+#line 160
error("got: %g", (double) value);
+#line 160
}
+#line 160
} else {
+#line 160
++nok;
+#line 160
}
+#line 160
}
+#line 160
}
+#line 160
}
+#line 160
}
+#line 160
}
+#line 160
}
+#line 160
err = nc_close (ncid);
+#line 160
IF (err)
+#line 160
error("nc_close: %s", nc_strerror(err));
+#line 160
print_nok(nok);
+#line 160
}
+#line 160
/*
+#line 161
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 161
*/
+#line 161
static
+#line 161
void
+#line 161
check_vars_float(const char *filename)
+#line 161
{
+#line 161
int ncid; /* netCDF id */
+#line 161
size_t index[MAX_RANK];
+#line 161
int err; /* status */
+#line 161
int d;
+#line 161
int i;
+#line 161
size_t j;
+#line 161
float value;
+#line 161
nc_type datatype;
+#line 161
int ndims;
+#line 161
int dimids[MAX_RANK];
+#line 161
double expect;
+#line 161
char name[NC_MAX_NAME];
+#line 161
size_t length;
+#line 161
int canConvert; /* Both text or both numeric */
+#line 161
int nok = 0; /* count of valid comparisons */
+#line 161
+#line 161
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 161
IF (err)
+#line 161
error("nc_open: %s", nc_strerror(err));
+#line 161
+#line 161
for (i = 0; i < NVARS; i++) {
+#line 161
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 161
if (canConvert) {
+#line 161
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 161
IF (err)
+#line 161
error("nc_inq_var: %s", nc_strerror(err));
+#line 161
IF (strcmp(name, var_name[i]) != 0)
+#line 161
error("Unexpected var_name");
+#line 161
IF (datatype != var_type[i])
+#line 161
error("Unexpected type");
+#line 161
IF (ndims != var_rank[i])
+#line 161
error("Unexpected rank");
+#line 161
for (j = 0; j < ndims; j++) {
+#line 161
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 161
IF (err)
+#line 161
error("nc_inq_dim: %s", nc_strerror(err));
+#line 161
IF (length != var_shape[i][j])
+#line 161
error("Unexpected shape");
+#line 161
}
+#line 161
for (j = 0; j < var_nels[i]; j++) {
+#line 161
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 161
IF (err)
+#line 161
error("error in toMixedBase 2");
+#line 161
expect = hash4( var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 161
err = nc_get_var1_float(ncid, i, index, &value);
+#line 161
if (inRange3(expect,datatype,NCT_FLOAT)) {
+#line 161
if (expect >= float_min && expect <= float_max) {
+#line 161
IF (err) {
+#line 161
error("nc_get_var1_float: %s", nc_strerror(err));
+#line 161
} else {
+#line 161
IF (!equal(value,expect,var_type[i],NCT_FLOAT)) {
+#line 161
error("Var value read not that expected");
+#line 161
if (verbose) {
+#line 161
error("\n");
+#line 161
error("varid: %d, ", i);
+#line 161
error("var_name: %s, ", var_name[i]);
+#line 161
error("index:");
+#line 161
for (d = 0; d < var_rank[i]; d++)
+#line 161
error(" %d", index[d]);
+#line 161
error(", expect: %g, ", expect);
+#line 161
error("got: %g", (double) value);
+#line 161
}
+#line 161
} else {
+#line 161
++nok;
+#line 161
}
+#line 161
}
+#line 161
}
+#line 161
}
+#line 161
}
+#line 161
}
+#line 161
}
+#line 161
err = nc_close (ncid);
+#line 161
IF (err)
+#line 161
error("nc_close: %s", nc_strerror(err));
+#line 161
print_nok(nok);
+#line 161
}
+#line 161
/*
+#line 162
* check all vars in file which are (text/numeric) compatible with TYPE
+#line 162
*/
+#line 162
static
+#line 162
void
+#line 162
check_vars_double(const char *filename)
+#line 162
{
+#line 162
int ncid; /* netCDF id */
+#line 162
size_t index[MAX_RANK];
+#line 162
int err; /* status */
+#line 162
int d;
+#line 162
int i;
+#line 162
size_t j;
+#line 162
double value;
+#line 162
nc_type datatype;
+#line 162
int ndims;
+#line 162
int dimids[MAX_RANK];
+#line 162
double expect;
+#line 162
char name[NC_MAX_NAME];
+#line 162
size_t length;
+#line 162
int canConvert; /* Both text or both numeric */
+#line 162
int nok = 0; /* count of valid comparisons */
+#line 162
+#line 162
err = nc_open(filename, NC_NOWRITE, &ncid);
+#line 162
IF (err)
+#line 162
error("nc_open: %s", nc_strerror(err));
+#line 162
+#line 162
for (i = 0; i < NVARS; i++) {
+#line 162
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 162
if (canConvert) {
+#line 162
err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
+#line 162
IF (err)
+#line 162
error("nc_inq_var: %s", nc_strerror(err));
+#line 162
IF (strcmp(name, var_name[i]) != 0)
+#line 162
error("Unexpected var_name");
+#line 162
IF (datatype != var_type[i])
+#line 162
error("Unexpected type");
+#line 162
IF (ndims != var_rank[i])
+#line 162
error("Unexpected rank");
+#line 162
for (j = 0; j < ndims; j++) {
+#line 162
err = nc_inq_dim(ncid, dimids[j], 0, &length);
+#line 162
IF (err)
+#line 162
error("nc_inq_dim: %s", nc_strerror(err));
+#line 162
IF (length != var_shape[i][j])
+#line 162
error("Unexpected shape");
+#line 162
}
+#line 162
for (j = 0; j < var_nels[i]; j++) {
+#line 162
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 162
IF (err)
+#line 162
error("error in toMixedBase 2");
+#line 162
expect = hash4( var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 162
err = nc_get_var1_double(ncid, i, index, &value);
+#line 162
if (inRange3(expect,datatype,NCT_DOUBLE)) {
+#line 162
if (expect >= double_min && expect <= double_max) {
+#line 162
IF (err) {
+#line 162
error("nc_get_var1_double: %s", nc_strerror(err));
+#line 162
} else {
+#line 162
IF (!equal(value,expect,var_type[i],NCT_DOUBLE)) {
+#line 162
error("Var value read not that expected");
+#line 162
if (verbose) {
+#line 162
error("\n");
+#line 162
error("varid: %d, ", i);
+#line 162
error("var_name: %s, ", var_name[i]);
+#line 162
error("index:");
+#line 162
for (d = 0; d < var_rank[i]; d++)
+#line 162
error(" %d", index[d]);
+#line 162
error(", expect: %g, ", expect);
+#line 162
error("got: %g", (double) value);
+#line 162
}
+#line 162
} else {
+#line 162
++nok;
+#line 162
}
+#line 162
}
+#line 162
}
+#line 162
}
+#line 162
}
+#line 162
}
+#line 162
}
+#line 162
err = nc_close (ncid);
+#line 162
IF (err)
+#line 162
error("nc_close: %s", nc_strerror(err));
+#line 162
print_nok(nok);
+#line 162
}
+#line 162
+#line 244
/*
+#line 245
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 245
* ignore any attributes containing values outside range of TYPE
+#line 245
*/
+#line 245
static
+#line 245
void
+#line 245
check_atts_text(int ncid)
+#line 245
{
+#line 245
int err; /* status */
+#line 245
int i;
+#line 245
int j;
+#line 245
size_t k;
+#line 245
text value[MAX_NELS];
+#line 245
nc_type datatype;
+#line 245
double expect[MAX_NELS];
+#line 245
size_t length;
+#line 245
size_t nInExtRange; /* number values within external range */
+#line 245
size_t nInIntRange; /* number values within internal range */
+#line 245
int canConvert; /* Both text or both numeric */
+#line 245
int nok = 0; /* count of valid comparisons */
+#line 245
+#line 245
for (i = -1; i < NVARS; i++) {
+#line 245
for (j = 0; j < NATTS(i); j++) {
+#line 245
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 245
if (canConvert) {
+#line 245
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 245
IF (err)
+#line 245
error("nc_inq_att: %s", nc_strerror(err));
+#line 245
IF (datatype != ATT_TYPE(i,j))
+#line 245
error("nc_inq_att: unexpected type");
+#line 245
IF (length != ATT_LEN(i,j))
+#line 245
error("nc_inq_att: unexpected length");
+#line 245
assert(length <= MAX_NELS);
+#line 245
nInIntRange = nInExtRange = 0;
+#line 245
for (k = 0; k < length; k++) {
+#line 245
expect[k] = hash4( datatype, -1, &k, NCT_TEXT);
+#line 245
if (inRange3(expect[k], datatype, NCT_TEXT)) {
+#line 245
++nInExtRange;
+#line 245
if (expect[k] >= text_min && expect[k] <= text_max)
+#line 245
++nInIntRange;
+#line 245
}
+#line 245
}
+#line 245
err = nc_get_att_text(ncid, i, ATT_NAME(i,j), value);
+#line 245
if (nInExtRange == length && nInIntRange == length) {
+#line 245
IF (err)
+#line 245
error("%s", nc_strerror(err));
+#line 245
} else {
+#line 245
IF (err != 0 && err != NC_ERANGE)
+#line 245
error("OK or Range error: status = %d", err);
+#line 245
}
+#line 245
for (k = 0; k < length; k++) {
+#line 245
if (inRange3(expect[k],datatype,NCT_TEXT)
+#line 245
&& expect[k] >= text_min && expect[k] <= text_max) {
+#line 245
IF (!equal(value[k],expect[k],datatype,NCT_TEXT)) {
+#line 245
error("att. value read not that expected");
+#line 245
if (verbose) {
+#line 245
error("\n");
+#line 245
error("varid: %d, ", i);
+#line 245
error("att_name: %s, ", ATT_NAME(i,j));
+#line 245
error("element number: %d ", k);
+#line 245
error("expect: %g, ", expect[k]);
+#line 245
error("got: %g", (double) value[k]);
+#line 245
}
+#line 245
} else {
+#line 245
nok++;
+#line 245
}
+#line 245
}
+#line 245
}
+#line 245
}
+#line 245
}
+#line 245
}
+#line 245
+#line 245
print_nok(nok);
+#line 245
}
+#line 245
/*
+#line 246
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 246
* ignore any attributes containing values outside range of TYPE
+#line 246
*/
+#line 246
static
+#line 246
void
+#line 246
check_atts_uchar(int ncid)
+#line 246
{
+#line 246
int err; /* status */
+#line 246
int i;
+#line 246
int j;
+#line 246
size_t k;
+#line 246
uchar value[MAX_NELS];
+#line 246
nc_type datatype;
+#line 246
double expect[MAX_NELS];
+#line 246
size_t length;
+#line 246
size_t nInExtRange; /* number values within external range */
+#line 246
size_t nInIntRange; /* number values within internal range */
+#line 246
int canConvert; /* Both text or both numeric */
+#line 246
int nok = 0; /* count of valid comparisons */
+#line 246
+#line 246
for (i = -1; i < NVARS; i++) {
+#line 246
for (j = 0; j < NATTS(i); j++) {
+#line 246
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 246
if (canConvert) {
+#line 246
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 246
IF (err)
+#line 246
error("nc_inq_att: %s", nc_strerror(err));
+#line 246
IF (datatype != ATT_TYPE(i,j))
+#line 246
error("nc_inq_att: unexpected type");
+#line 246
IF (length != ATT_LEN(i,j))
+#line 246
error("nc_inq_att: unexpected length");
+#line 246
assert(length <= MAX_NELS);
+#line 246
nInIntRange = nInExtRange = 0;
+#line 246
for (k = 0; k < length; k++) {
+#line 246
expect[k] = hash4( datatype, -1, &k, NCT_UCHAR);
+#line 246
if (inRange3(expect[k], datatype, NCT_UCHAR)) {
+#line 246
++nInExtRange;
+#line 246
if (expect[k] >= uchar_min && expect[k] <= uchar_max)
+#line 246
++nInIntRange;
+#line 246
}
+#line 246
}
+#line 246
err = nc_get_att_uchar(ncid, i, ATT_NAME(i,j), value);
+#line 246
if (nInExtRange == length && nInIntRange == length) {
+#line 246
IF (err)
+#line 246
error("%s", nc_strerror(err));
+#line 246
} else {
+#line 246
IF (err != 0 && err != NC_ERANGE)
+#line 246
error("OK or Range error: status = %d", err);
+#line 246
}
+#line 246
for (k = 0; k < length; k++) {
+#line 246
if (inRange3(expect[k],datatype,NCT_UCHAR)
+#line 246
&& expect[k] >= uchar_min && expect[k] <= uchar_max) {
+#line 246
IF (!equal(value[k],expect[k],datatype,NCT_UCHAR)) {
+#line 246
error("att. value read not that expected");
+#line 246
if (verbose) {
+#line 246
error("\n");
+#line 246
error("varid: %d, ", i);
+#line 246
error("att_name: %s, ", ATT_NAME(i,j));
+#line 246
error("element number: %d ", k);
+#line 246
error("expect: %g, ", expect[k]);
+#line 246
error("got: %g", (double) value[k]);
+#line 246
}
+#line 246
} else {
+#line 246
nok++;
+#line 246
}
+#line 246
}
+#line 246
}
+#line 246
}
+#line 246
}
+#line 246
}
+#line 246
+#line 246
print_nok(nok);
+#line 246
}
+#line 246
/*
+#line 247
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 247
* ignore any attributes containing values outside range of TYPE
+#line 247
*/
+#line 247
static
+#line 247
void
+#line 247
check_atts_schar(int ncid)
+#line 247
{
+#line 247
int err; /* status */
+#line 247
int i;
+#line 247
int j;
+#line 247
size_t k;
+#line 247
schar value[MAX_NELS];
+#line 247
nc_type datatype;
+#line 247
double expect[MAX_NELS];
+#line 247
size_t length;
+#line 247
size_t nInExtRange; /* number values within external range */
+#line 247
size_t nInIntRange; /* number values within internal range */
+#line 247
int canConvert; /* Both text or both numeric */
+#line 247
int nok = 0; /* count of valid comparisons */
+#line 247
+#line 247
for (i = -1; i < NVARS; i++) {
+#line 247
for (j = 0; j < NATTS(i); j++) {
+#line 247
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 247
if (canConvert) {
+#line 247
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 247
IF (err)
+#line 247
error("nc_inq_att: %s", nc_strerror(err));
+#line 247
IF (datatype != ATT_TYPE(i,j))
+#line 247
error("nc_inq_att: unexpected type");
+#line 247
IF (length != ATT_LEN(i,j))
+#line 247
error("nc_inq_att: unexpected length");
+#line 247
assert(length <= MAX_NELS);
+#line 247
nInIntRange = nInExtRange = 0;
+#line 247
for (k = 0; k < length; k++) {
+#line 247
expect[k] = hash4( datatype, -1, &k, NCT_SCHAR);
+#line 247
if (inRange3(expect[k], datatype, NCT_SCHAR)) {
+#line 247
++nInExtRange;
+#line 247
if (expect[k] >= schar_min && expect[k] <= schar_max)
+#line 247
++nInIntRange;
+#line 247
}
+#line 247
}
+#line 247
err = nc_get_att_schar(ncid, i, ATT_NAME(i,j), value);
+#line 247
if (nInExtRange == length && nInIntRange == length) {
+#line 247
IF (err)
+#line 247
error("%s", nc_strerror(err));
+#line 247
} else {
+#line 247
IF (err != 0 && err != NC_ERANGE)
+#line 247
error("OK or Range error: status = %d", err);
+#line 247
}
+#line 247
for (k = 0; k < length; k++) {
+#line 247
if (inRange3(expect[k],datatype,NCT_SCHAR)
+#line 247
&& expect[k] >= schar_min && expect[k] <= schar_max) {
+#line 247
IF (!equal(value[k],expect[k],datatype,NCT_SCHAR)) {
+#line 247
error("att. value read not that expected");
+#line 247
if (verbose) {
+#line 247
error("\n");
+#line 247
error("varid: %d, ", i);
+#line 247
error("att_name: %s, ", ATT_NAME(i,j));
+#line 247
error("element number: %d ", k);
+#line 247
error("expect: %g, ", expect[k]);
+#line 247
error("got: %g", (double) value[k]);
+#line 247
}
+#line 247
} else {
+#line 247
nok++;
+#line 247
}
+#line 247
}
+#line 247
}
+#line 247
}
+#line 247
}
+#line 247
}
+#line 247
+#line 247
print_nok(nok);
+#line 247
}
+#line 247
/*
+#line 248
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 248
* ignore any attributes containing values outside range of TYPE
+#line 248
*/
+#line 248
static
+#line 248
void
+#line 248
check_atts_short(int ncid)
+#line 248
{
+#line 248
int err; /* status */
+#line 248
int i;
+#line 248
int j;
+#line 248
size_t k;
+#line 248
short value[MAX_NELS];
+#line 248
nc_type datatype;
+#line 248
double expect[MAX_NELS];
+#line 248
size_t length;
+#line 248
size_t nInExtRange; /* number values within external range */
+#line 248
size_t nInIntRange; /* number values within internal range */
+#line 248
int canConvert; /* Both text or both numeric */
+#line 248
int nok = 0; /* count of valid comparisons */
+#line 248
+#line 248
for (i = -1; i < NVARS; i++) {
+#line 248
for (j = 0; j < NATTS(i); j++) {
+#line 248
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 248
if (canConvert) {
+#line 248
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 248
IF (err)
+#line 248
error("nc_inq_att: %s", nc_strerror(err));
+#line 248
IF (datatype != ATT_TYPE(i,j))
+#line 248
error("nc_inq_att: unexpected type");
+#line 248
IF (length != ATT_LEN(i,j))
+#line 248
error("nc_inq_att: unexpected length");
+#line 248
assert(length <= MAX_NELS);
+#line 248
nInIntRange = nInExtRange = 0;
+#line 248
for (k = 0; k < length; k++) {
+#line 248
expect[k] = hash4( datatype, -1, &k, NCT_SHORT);
+#line 248
if (inRange3(expect[k], datatype, NCT_SHORT)) {
+#line 248
++nInExtRange;
+#line 248
if (expect[k] >= short_min && expect[k] <= short_max)
+#line 248
++nInIntRange;
+#line 248
}
+#line 248
}
+#line 248
err = nc_get_att_short(ncid, i, ATT_NAME(i,j), value);
+#line 248
if (nInExtRange == length && nInIntRange == length) {
+#line 248
IF (err)
+#line 248
error("%s", nc_strerror(err));
+#line 248
} else {
+#line 248
IF (err != 0 && err != NC_ERANGE)
+#line 248
error("OK or Range error: status = %d", err);
+#line 248
}
+#line 248
for (k = 0; k < length; k++) {
+#line 248
if (inRange3(expect[k],datatype,NCT_SHORT)
+#line 248
&& expect[k] >= short_min && expect[k] <= short_max) {
+#line 248
IF (!equal(value[k],expect[k],datatype,NCT_SHORT)) {
+#line 248
error("att. value read not that expected");
+#line 248
if (verbose) {
+#line 248
error("\n");
+#line 248
error("varid: %d, ", i);
+#line 248
error("att_name: %s, ", ATT_NAME(i,j));
+#line 248
error("element number: %d ", k);
+#line 248
error("expect: %g, ", expect[k]);
+#line 248
error("got: %g", (double) value[k]);
+#line 248
}
+#line 248
} else {
+#line 248
nok++;
+#line 248
}
+#line 248
}
+#line 248
}
+#line 248
}
+#line 248
}
+#line 248
}
+#line 248
+#line 248
print_nok(nok);
+#line 248
}
+#line 248
/*
+#line 249
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 249
* ignore any attributes containing values outside range of TYPE
+#line 249
*/
+#line 249
static
+#line 249
void
+#line 249
check_atts_int(int ncid)
+#line 249
{
+#line 249
int err; /* status */
+#line 249
int i;
+#line 249
int j;
+#line 249
size_t k;
+#line 249
int value[MAX_NELS];
+#line 249
nc_type datatype;
+#line 249
double expect[MAX_NELS];
+#line 249
size_t length;
+#line 249
size_t nInExtRange; /* number values within external range */
+#line 249
size_t nInIntRange; /* number values within internal range */
+#line 249
int canConvert; /* Both text or both numeric */
+#line 249
int nok = 0; /* count of valid comparisons */
+#line 249
+#line 249
for (i = -1; i < NVARS; i++) {
+#line 249
for (j = 0; j < NATTS(i); j++) {
+#line 249
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 249
if (canConvert) {
+#line 249
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 249
IF (err)
+#line 249
error("nc_inq_att: %s", nc_strerror(err));
+#line 249
IF (datatype != ATT_TYPE(i,j))
+#line 249
error("nc_inq_att: unexpected type");
+#line 249
IF (length != ATT_LEN(i,j))
+#line 249
error("nc_inq_att: unexpected length");
+#line 249
assert(length <= MAX_NELS);
+#line 249
nInIntRange = nInExtRange = 0;
+#line 249
for (k = 0; k < length; k++) {
+#line 249
expect[k] = hash4( datatype, -1, &k, NCT_INT);
+#line 249
if (inRange3(expect[k], datatype, NCT_INT)) {
+#line 249
++nInExtRange;
+#line 249
if (expect[k] >= int_min && expect[k] <= int_max)
+#line 249
++nInIntRange;
+#line 249
}
+#line 249
}
+#line 249
err = nc_get_att_int(ncid, i, ATT_NAME(i,j), value);
+#line 249
if (nInExtRange == length && nInIntRange == length) {
+#line 249
IF (err)
+#line 249
error("%s", nc_strerror(err));
+#line 249
} else {
+#line 249
IF (err != 0 && err != NC_ERANGE)
+#line 249
error("OK or Range error: status = %d", err);
+#line 249
}
+#line 249
for (k = 0; k < length; k++) {
+#line 249
if (inRange3(expect[k],datatype,NCT_INT)
+#line 249
&& expect[k] >= int_min && expect[k] <= int_max) {
+#line 249
IF (!equal(value[k],expect[k],datatype,NCT_INT)) {
+#line 249
error("att. value read not that expected");
+#line 249
if (verbose) {
+#line 249
error("\n");
+#line 249
error("varid: %d, ", i);
+#line 249
error("att_name: %s, ", ATT_NAME(i,j));
+#line 249
error("element number: %d ", k);
+#line 249
error("expect: %g, ", expect[k]);
+#line 249
error("got: %g", (double) value[k]);
+#line 249
}
+#line 249
} else {
+#line 249
nok++;
+#line 249
}
+#line 249
}
+#line 249
}
+#line 249
}
+#line 249
}
+#line 249
}
+#line 249
+#line 249
print_nok(nok);
+#line 249
}
+#line 249
/*
+#line 250
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 250
* ignore any attributes containing values outside range of TYPE
+#line 250
*/
+#line 250
static
+#line 250
void
+#line 250
check_atts_long(int ncid)
+#line 250
{
+#line 250
int err; /* status */
+#line 250
int i;
+#line 250
int j;
+#line 250
size_t k;
+#line 250
long value[MAX_NELS];
+#line 250
nc_type datatype;
+#line 250
double expect[MAX_NELS];
+#line 250
size_t length;
+#line 250
size_t nInExtRange; /* number values within external range */
+#line 250
size_t nInIntRange; /* number values within internal range */
+#line 250
int canConvert; /* Both text or both numeric */
+#line 250
int nok = 0; /* count of valid comparisons */
+#line 250
+#line 250
for (i = -1; i < NVARS; i++) {
+#line 250
for (j = 0; j < NATTS(i); j++) {
+#line 250
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 250
if (canConvert) {
+#line 250
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 250
IF (err)
+#line 250
error("nc_inq_att: %s", nc_strerror(err));
+#line 250
IF (datatype != ATT_TYPE(i,j))
+#line 250
error("nc_inq_att: unexpected type");
+#line 250
IF (length != ATT_LEN(i,j))
+#line 250
error("nc_inq_att: unexpected length");
+#line 250
assert(length <= MAX_NELS);
+#line 250
nInIntRange = nInExtRange = 0;
+#line 250
for (k = 0; k < length; k++) {
+#line 250
expect[k] = hash4( datatype, -1, &k, NCT_LONG);
+#line 250
if (inRange3(expect[k], datatype, NCT_LONG)) {
+#line 250
++nInExtRange;
+#line 250
if (expect[k] >= long_min && expect[k] <= long_max)
+#line 250
++nInIntRange;
+#line 250
}
+#line 250
}
+#line 250
err = nc_get_att_long(ncid, i, ATT_NAME(i,j), value);
+#line 250
if (nInExtRange == length && nInIntRange == length) {
+#line 250
IF (err)
+#line 250
error("%s", nc_strerror(err));
+#line 250
} else {
+#line 250
IF (err != 0 && err != NC_ERANGE)
+#line 250
error("OK or Range error: status = %d", err);
+#line 250
}
+#line 250
for (k = 0; k < length; k++) {
+#line 250
if (inRange3(expect[k],datatype,NCT_LONG)
+#line 250
&& expect[k] >= long_min && expect[k] <= long_max) {
+#line 250
IF (!equal(value[k],expect[k],datatype,NCT_LONG)) {
+#line 250
error("att. value read not that expected");
+#line 250
if (verbose) {
+#line 250
error("\n");
+#line 250
error("varid: %d, ", i);
+#line 250
error("att_name: %s, ", ATT_NAME(i,j));
+#line 250
error("element number: %d ", k);
+#line 250
error("expect: %g, ", expect[k]);
+#line 250
error("got: %g", (double) value[k]);
+#line 250
}
+#line 250
} else {
+#line 250
nok++;
+#line 250
}
+#line 250
}
+#line 250
}
+#line 250
}
+#line 250
}
+#line 250
}
+#line 250
+#line 250
print_nok(nok);
+#line 250
}
+#line 250
/*
+#line 251
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 251
* ignore any attributes containing values outside range of TYPE
+#line 251
*/
+#line 251
static
+#line 251
void
+#line 251
check_atts_float(int ncid)
+#line 251
{
+#line 251
int err; /* status */
+#line 251
int i;
+#line 251
int j;
+#line 251
size_t k;
+#line 251
float value[MAX_NELS];
+#line 251
nc_type datatype;
+#line 251
double expect[MAX_NELS];
+#line 251
size_t length;
+#line 251
size_t nInExtRange; /* number values within external range */
+#line 251
size_t nInIntRange; /* number values within internal range */
+#line 251
int canConvert; /* Both text or both numeric */
+#line 251
int nok = 0; /* count of valid comparisons */
+#line 251
+#line 251
for (i = -1; i < NVARS; i++) {
+#line 251
for (j = 0; j < NATTS(i); j++) {
+#line 251
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 251
if (canConvert) {
+#line 251
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 251
IF (err)
+#line 251
error("nc_inq_att: %s", nc_strerror(err));
+#line 251
IF (datatype != ATT_TYPE(i,j))
+#line 251
error("nc_inq_att: unexpected type");
+#line 251
IF (length != ATT_LEN(i,j))
+#line 251
error("nc_inq_att: unexpected length");
+#line 251
assert(length <= MAX_NELS);
+#line 251
nInIntRange = nInExtRange = 0;
+#line 251
for (k = 0; k < length; k++) {
+#line 251
expect[k] = hash4( datatype, -1, &k, NCT_FLOAT);
+#line 251
if (inRange3(expect[k], datatype, NCT_FLOAT)) {
+#line 251
++nInExtRange;
+#line 251
if (expect[k] >= float_min && expect[k] <= float_max)
+#line 251
++nInIntRange;
+#line 251
}
+#line 251
}
+#line 251
err = nc_get_att_float(ncid, i, ATT_NAME(i,j), value);
+#line 251
if (nInExtRange == length && nInIntRange == length) {
+#line 251
IF (err)
+#line 251
error("%s", nc_strerror(err));
+#line 251
} else {
+#line 251
IF (err != 0 && err != NC_ERANGE)
+#line 251
error("OK or Range error: status = %d", err);
+#line 251
}
+#line 251
for (k = 0; k < length; k++) {
+#line 251
if (inRange3(expect[k],datatype,NCT_FLOAT)
+#line 251
&& expect[k] >= float_min && expect[k] <= float_max) {
+#line 251
IF (!equal(value[k],expect[k],datatype,NCT_FLOAT)) {
+#line 251
error("att. value read not that expected");
+#line 251
if (verbose) {
+#line 251
error("\n");
+#line 251
error("varid: %d, ", i);
+#line 251
error("att_name: %s, ", ATT_NAME(i,j));
+#line 251
error("element number: %d ", k);
+#line 251
error("expect: %g, ", expect[k]);
+#line 251
error("got: %g", (double) value[k]);
+#line 251
}
+#line 251
} else {
+#line 251
nok++;
+#line 251
}
+#line 251
}
+#line 251
}
+#line 251
}
+#line 251
}
+#line 251
}
+#line 251
+#line 251
print_nok(nok);
+#line 251
}
+#line 251
/*
+#line 252
* check all attributes in file which are (text/numeric) compatible with TYPE
+#line 252
* ignore any attributes containing values outside range of TYPE
+#line 252
*/
+#line 252
static
+#line 252
void
+#line 252
check_atts_double(int ncid)
+#line 252
{
+#line 252
int err; /* status */
+#line 252
int i;
+#line 252
int j;
+#line 252
size_t k;
+#line 252
double value[MAX_NELS];
+#line 252
nc_type datatype;
+#line 252
double expect[MAX_NELS];
+#line 252
size_t length;
+#line 252
size_t nInExtRange; /* number values within external range */
+#line 252
size_t nInIntRange; /* number values within internal range */
+#line 252
int canConvert; /* Both text or both numeric */
+#line 252
int nok = 0; /* count of valid comparisons */
+#line 252
+#line 252
for (i = -1; i < NVARS; i++) {
+#line 252
for (j = 0; j < NATTS(i); j++) {
+#line 252
canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 252
if (canConvert) {
+#line 252
err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
+#line 252
IF (err)
+#line 252
error("nc_inq_att: %s", nc_strerror(err));
+#line 252
IF (datatype != ATT_TYPE(i,j))
+#line 252
error("nc_inq_att: unexpected type");
+#line 252
IF (length != ATT_LEN(i,j))
+#line 252
error("nc_inq_att: unexpected length");
+#line 252
assert(length <= MAX_NELS);
+#line 252
nInIntRange = nInExtRange = 0;
+#line 252
for (k = 0; k < length; k++) {
+#line 252
expect[k] = hash4( datatype, -1, &k, NCT_DOUBLE);
+#line 252
if (inRange3(expect[k], datatype, NCT_DOUBLE)) {
+#line 252
++nInExtRange;
+#line 252
if (expect[k] >= double_min && expect[k] <= double_max)
+#line 252
++nInIntRange;
+#line 252
}
+#line 252
}
+#line 252
err = nc_get_att_double(ncid, i, ATT_NAME(i,j), value);
+#line 252
if (nInExtRange == length && nInIntRange == length) {
+#line 252
IF (err)
+#line 252
error("%s", nc_strerror(err));
+#line 252
} else {
+#line 252
IF (err != 0 && err != NC_ERANGE)
+#line 252
error("OK or Range error: status = %d", err);
+#line 252
}
+#line 252
for (k = 0; k < length; k++) {
+#line 252
if (inRange3(expect[k],datatype,NCT_DOUBLE)
+#line 252
&& expect[k] >= double_min && expect[k] <= double_max) {
+#line 252
IF (!equal(value[k],expect[k],datatype,NCT_DOUBLE)) {
+#line 252
error("att. value read not that expected");
+#line 252
if (verbose) {
+#line 252
error("\n");
+#line 252
error("varid: %d, ", i);
+#line 252
error("att_name: %s, ", ATT_NAME(i,j));
+#line 252
error("element number: %d ", k);
+#line 252
error("expect: %g, ", expect[k]);
+#line 252
error("got: %g", (double) value[k]);
+#line 252
}
+#line 252
} else {
+#line 252
nok++;
+#line 252
}
+#line 252
}
+#line 252
}
+#line 252
}
+#line 252
}
+#line 252
}
+#line 252
+#line 252
print_nok(nok);
+#line 252
}
+#line 252
+#line 339
void
+#line 340
test_nc_put_var1_text(void)
+#line 340
{
+#line 340
int ncid;
+#line 340
int i;
+#line 340
int j;
+#line 340
int err;
+#line 340
size_t index[MAX_RANK];
+#line 340
int canConvert; /* Both text or both numeric */
+#line 340
text value = 5; /* any value would do - only for error cases */
+#line 340
+#line 340
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 340
IF (err) {
+#line 340
error("nc_create: %s", nc_strerror(err));
+#line 340
return;
+#line 340
}
+#line 340
def_dims(ncid);
+#line 340
def_vars(ncid);
+#line 340
err = nc_enddef(ncid);
+#line 340
IF (err)
+#line 340
error("nc_enddef: %s", nc_strerror(err));
+#line 340
+#line 340
for (i = 0; i < NVARS; i++) {
+#line 340
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 340
for (j = 0; j < var_rank[i]; j++)
+#line 340
index[j] = 0;
+#line 340
err = nc_put_var1_text(BAD_ID, i, index, &value);
+#line 340
IF (err != NC_EBADID)
+#line 340
error("bad ncid: status = %d", err);
+#line 340
err = nc_put_var1_text(ncid, BAD_VARID, index, &value);
+#line 340
IF (err != NC_ENOTVAR)
+#line 340
error("bad var id: status = %d", err);
+#line 340
for (j = 0; j < var_rank[i]; j++) {
+#line 340
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 340
index[j] = var_shape[i][j];
+#line 340
err = nc_put_var1_text(ncid, i, index, &value);
+#line 340
IF (canConvert && err != NC_EINVALCOORDS)
+#line 340
error("bad index: status = %d", err);
+#line 340
index[j] = 0;
+#line 340
}
+#line 340
}
+#line 340
for (j = 0; j < var_nels[i]; j++) {
+#line 340
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 340
IF (err)
+#line 340
error("error in toMixedBase 1");
+#line 340
value = hash_text( var_type[i], var_rank[i], index, NCT_TEXT);
+#line 340
if (var_rank[i] == 0 && i%2 == 0)
+#line 340
err = nc_put_var1_text(ncid, i, NULL, &value);
+#line 340
else
+#line 340
err = nc_put_var1_text(ncid, i, index, &value);
+#line 340
if (canConvert) {
+#line 340
if (inRange3(value, var_type[i],NCT_TEXT)) {
+#line 340
IF (err)
+#line 340
error("%s", nc_strerror(err));
+#line 340
} else {
+#line 340
IF (err != NC_ERANGE) {
+#line 340
error("Range error: status = %d", err);
+#line 340
error("\n\t\tfor type %s value %.17e %ld",
+#line 340
s_nc_type(var_type[i]),
+#line 340
(double)value, (long)value);
+#line 340
}
+#line 340
}
+#line 340
} else {
+#line 340
IF (err != NC_ECHAR)
+#line 340
error("wrong type: status = %d", err);
+#line 340
}
+#line 340
}
+#line 340
}
+#line 340
+#line 340
err = nc_close(ncid);
+#line 340
IF (err)
+#line 340
error("nc_close: %s", nc_strerror(err));
+#line 340
+#line 340
check_vars_text(scratch);
+#line 340
+#line 340
err = remove(scratch);
+#line 340
IF (err)
+#line 340
error("remove of %s failed", scratch);
+#line 340
}
+#line 340
void
+#line 341
test_nc_put_var1_uchar(void)
+#line 341
{
+#line 341
int ncid;
+#line 341
int i;
+#line 341
int j;
+#line 341
int err;
+#line 341
size_t index[MAX_RANK];
+#line 341
int canConvert; /* Both text or both numeric */
+#line 341
uchar value = 5; /* any value would do - only for error cases */
+#line 341
+#line 341
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 341
IF (err) {
+#line 341
error("nc_create: %s", nc_strerror(err));
+#line 341
return;
+#line 341
}
+#line 341
def_dims(ncid);
+#line 341
def_vars(ncid);
+#line 341
err = nc_enddef(ncid);
+#line 341
IF (err)
+#line 341
error("nc_enddef: %s", nc_strerror(err));
+#line 341
+#line 341
for (i = 0; i < NVARS; i++) {
+#line 341
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 341
for (j = 0; j < var_rank[i]; j++)
+#line 341
index[j] = 0;
+#line 341
err = nc_put_var1_uchar(BAD_ID, i, index, &value);
+#line 341
IF (err != NC_EBADID)
+#line 341
error("bad ncid: status = %d", err);
+#line 341
err = nc_put_var1_uchar(ncid, BAD_VARID, index, &value);
+#line 341
IF (err != NC_ENOTVAR)
+#line 341
error("bad var id: status = %d", err);
+#line 341
for (j = 0; j < var_rank[i]; j++) {
+#line 341
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 341
index[j] = var_shape[i][j];
+#line 341
err = nc_put_var1_uchar(ncid, i, index, &value);
+#line 341
IF (canConvert && err != NC_EINVALCOORDS)
+#line 341
error("bad index: status = %d", err);
+#line 341
index[j] = 0;
+#line 341
}
+#line 341
}
+#line 341
for (j = 0; j < var_nels[i]; j++) {
+#line 341
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 341
IF (err)
+#line 341
error("error in toMixedBase 1");
+#line 341
value = hash_uchar( var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 341
if (var_rank[i] == 0 && i%2 == 0)
+#line 341
err = nc_put_var1_uchar(ncid, i, NULL, &value);
+#line 341
else
+#line 341
err = nc_put_var1_uchar(ncid, i, index, &value);
+#line 341
if (canConvert) {
+#line 341
if (inRange3(value, var_type[i],NCT_UCHAR)) {
+#line 341
IF (err)
+#line 341
error("%s", nc_strerror(err));
+#line 341
} else {
+#line 341
IF (err != NC_ERANGE) {
+#line 341
error("Range error: status = %d", err);
+#line 341
error("\n\t\tfor type %s value %.17e %ld",
+#line 341
s_nc_type(var_type[i]),
+#line 341
(double)value, (long)value);
+#line 341
}
+#line 341
}
+#line 341
} else {
+#line 341
IF (err != NC_ECHAR)
+#line 341
error("wrong type: status = %d", err);
+#line 341
}
+#line 341
}
+#line 341
}
+#line 341
+#line 341
err = nc_close(ncid);
+#line 341
IF (err)
+#line 341
error("nc_close: %s", nc_strerror(err));
+#line 341
+#line 341
check_vars_uchar(scratch);
+#line 341
+#line 341
err = remove(scratch);
+#line 341
IF (err)
+#line 341
error("remove of %s failed", scratch);
+#line 341
}
+#line 341
void
+#line 342
test_nc_put_var1_schar(void)
+#line 342
{
+#line 342
int ncid;
+#line 342
int i;
+#line 342
int j;
+#line 342
int err;
+#line 342
size_t index[MAX_RANK];
+#line 342
int canConvert; /* Both text or both numeric */
+#line 342
schar value = 5; /* any value would do - only for error cases */
+#line 342
+#line 342
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 342
IF (err) {
+#line 342
error("nc_create: %s", nc_strerror(err));
+#line 342
return;
+#line 342
}
+#line 342
def_dims(ncid);
+#line 342
def_vars(ncid);
+#line 342
err = nc_enddef(ncid);
+#line 342
IF (err)
+#line 342
error("nc_enddef: %s", nc_strerror(err));
+#line 342
+#line 342
for (i = 0; i < NVARS; i++) {
+#line 342
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 342
for (j = 0; j < var_rank[i]; j++)
+#line 342
index[j] = 0;
+#line 342
err = nc_put_var1_schar(BAD_ID, i, index, &value);
+#line 342
IF (err != NC_EBADID)
+#line 342
error("bad ncid: status = %d", err);
+#line 342
err = nc_put_var1_schar(ncid, BAD_VARID, index, &value);
+#line 342
IF (err != NC_ENOTVAR)
+#line 342
error("bad var id: status = %d", err);
+#line 342
for (j = 0; j < var_rank[i]; j++) {
+#line 342
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 342
index[j] = var_shape[i][j];
+#line 342
err = nc_put_var1_schar(ncid, i, index, &value);
+#line 342
IF (canConvert && err != NC_EINVALCOORDS)
+#line 342
error("bad index: status = %d", err);
+#line 342
index[j] = 0;
+#line 342
}
+#line 342
}
+#line 342
for (j = 0; j < var_nels[i]; j++) {
+#line 342
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 342
IF (err)
+#line 342
error("error in toMixedBase 1");
+#line 342
value = hash_schar( var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 342
if (var_rank[i] == 0 && i%2 == 0)
+#line 342
err = nc_put_var1_schar(ncid, i, NULL, &value);
+#line 342
else
+#line 342
err = nc_put_var1_schar(ncid, i, index, &value);
+#line 342
if (canConvert) {
+#line 342
if (inRange3(value, var_type[i],NCT_SCHAR)) {
+#line 342
IF (err)
+#line 342
error("%s", nc_strerror(err));
+#line 342
} else {
+#line 342
IF (err != NC_ERANGE) {
+#line 342
error("Range error: status = %d", err);
+#line 342
error("\n\t\tfor type %s value %.17e %ld",
+#line 342
s_nc_type(var_type[i]),
+#line 342
(double)value, (long)value);
+#line 342
}
+#line 342
}
+#line 342
} else {
+#line 342
IF (err != NC_ECHAR)
+#line 342
error("wrong type: status = %d", err);
+#line 342
}
+#line 342
}
+#line 342
}
+#line 342
+#line 342
err = nc_close(ncid);
+#line 342
IF (err)
+#line 342
error("nc_close: %s", nc_strerror(err));
+#line 342
+#line 342
check_vars_schar(scratch);
+#line 342
+#line 342
err = remove(scratch);
+#line 342
IF (err)
+#line 342
error("remove of %s failed", scratch);
+#line 342
}
+#line 342
void
+#line 343
test_nc_put_var1_short(void)
+#line 343
{
+#line 343
int ncid;
+#line 343
int i;
+#line 343
int j;
+#line 343
int err;
+#line 343
size_t index[MAX_RANK];
+#line 343
int canConvert; /* Both text or both numeric */
+#line 343
short value = 5; /* any value would do - only for error cases */
+#line 343
+#line 343
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 343
IF (err) {
+#line 343
error("nc_create: %s", nc_strerror(err));
+#line 343
return;
+#line 343
}
+#line 343
def_dims(ncid);
+#line 343
def_vars(ncid);
+#line 343
err = nc_enddef(ncid);
+#line 343
IF (err)
+#line 343
error("nc_enddef: %s", nc_strerror(err));
+#line 343
+#line 343
for (i = 0; i < NVARS; i++) {
+#line 343
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 343
for (j = 0; j < var_rank[i]; j++)
+#line 343
index[j] = 0;
+#line 343
err = nc_put_var1_short(BAD_ID, i, index, &value);
+#line 343
IF (err != NC_EBADID)
+#line 343
error("bad ncid: status = %d", err);
+#line 343
err = nc_put_var1_short(ncid, BAD_VARID, index, &value);
+#line 343
IF (err != NC_ENOTVAR)
+#line 343
error("bad var id: status = %d", err);
+#line 343
for (j = 0; j < var_rank[i]; j++) {
+#line 343
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 343
index[j] = var_shape[i][j];
+#line 343
err = nc_put_var1_short(ncid, i, index, &value);
+#line 343
IF (canConvert && err != NC_EINVALCOORDS)
+#line 343
error("bad index: status = %d", err);
+#line 343
index[j] = 0;
+#line 343
}
+#line 343
}
+#line 343
for (j = 0; j < var_nels[i]; j++) {
+#line 343
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 343
IF (err)
+#line 343
error("error in toMixedBase 1");
+#line 343
value = hash_short( var_type[i], var_rank[i], index, NCT_SHORT);
+#line 343
if (var_rank[i] == 0 && i%2 == 0)
+#line 343
err = nc_put_var1_short(ncid, i, NULL, &value);
+#line 343
else
+#line 343
err = nc_put_var1_short(ncid, i, index, &value);
+#line 343
if (canConvert) {
+#line 343
if (inRange3(value, var_type[i],NCT_SHORT)) {
+#line 343
IF (err)
+#line 343
error("%s", nc_strerror(err));
+#line 343
} else {
+#line 343
IF (err != NC_ERANGE) {
+#line 343
error("Range error: status = %d", err);
+#line 343
error("\n\t\tfor type %s value %.17e %ld",
+#line 343
s_nc_type(var_type[i]),
+#line 343
(double)value, (long)value);
+#line 343
}
+#line 343
}
+#line 343
} else {
+#line 343
IF (err != NC_ECHAR)
+#line 343
error("wrong type: status = %d", err);
+#line 343
}
+#line 343
}
+#line 343
}
+#line 343
+#line 343
err = nc_close(ncid);
+#line 343
IF (err)
+#line 343
error("nc_close: %s", nc_strerror(err));
+#line 343
+#line 343
check_vars_short(scratch);
+#line 343
+#line 343
err = remove(scratch);
+#line 343
IF (err)
+#line 343
error("remove of %s failed", scratch);
+#line 343
}
+#line 343
void
+#line 344
test_nc_put_var1_int(void)
+#line 344
{
+#line 344
int ncid;
+#line 344
int i;
+#line 344
int j;
+#line 344
int err;
+#line 344
size_t index[MAX_RANK];
+#line 344
int canConvert; /* Both text or both numeric */
+#line 344
int value = 5; /* any value would do - only for error cases */
+#line 344
+#line 344
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 344
IF (err) {
+#line 344
error("nc_create: %s", nc_strerror(err));
+#line 344
return;
+#line 344
}
+#line 344
def_dims(ncid);
+#line 344
def_vars(ncid);
+#line 344
err = nc_enddef(ncid);
+#line 344
IF (err)
+#line 344
error("nc_enddef: %s", nc_strerror(err));
+#line 344
+#line 344
for (i = 0; i < NVARS; i++) {
+#line 344
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 344
for (j = 0; j < var_rank[i]; j++)
+#line 344
index[j] = 0;
+#line 344
err = nc_put_var1_int(BAD_ID, i, index, &value);
+#line 344
IF (err != NC_EBADID)
+#line 344
error("bad ncid: status = %d", err);
+#line 344
err = nc_put_var1_int(ncid, BAD_VARID, index, &value);
+#line 344
IF (err != NC_ENOTVAR)
+#line 344
error("bad var id: status = %d", err);
+#line 344
for (j = 0; j < var_rank[i]; j++) {
+#line 344
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 344
index[j] = var_shape[i][j];
+#line 344
err = nc_put_var1_int(ncid, i, index, &value);
+#line 344
IF (canConvert && err != NC_EINVALCOORDS)
+#line 344
error("bad index: status = %d", err);
+#line 344
index[j] = 0;
+#line 344
}
+#line 344
}
+#line 344
for (j = 0; j < var_nels[i]; j++) {
+#line 344
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 344
IF (err)
+#line 344
error("error in toMixedBase 1");
+#line 344
value = hash_int( var_type[i], var_rank[i], index, NCT_INT);
+#line 344
if (var_rank[i] == 0 && i%2 == 0)
+#line 344
err = nc_put_var1_int(ncid, i, NULL, &value);
+#line 344
else
+#line 344
err = nc_put_var1_int(ncid, i, index, &value);
+#line 344
if (canConvert) {
+#line 344
if (inRange3(value, var_type[i],NCT_INT)) {
+#line 344
IF (err)
+#line 344
error("%s", nc_strerror(err));
+#line 344
} else {
+#line 344
IF (err != NC_ERANGE) {
+#line 344
error("Range error: status = %d", err);
+#line 344
error("\n\t\tfor type %s value %.17e %ld",
+#line 344
s_nc_type(var_type[i]),
+#line 344
(double)value, (long)value);
+#line 344
}
+#line 344
}
+#line 344
} else {
+#line 344
IF (err != NC_ECHAR)
+#line 344
error("wrong type: status = %d", err);
+#line 344
}
+#line 344
}
+#line 344
}
+#line 344
+#line 344
err = nc_close(ncid);
+#line 344
IF (err)
+#line 344
error("nc_close: %s", nc_strerror(err));
+#line 344
+#line 344
check_vars_int(scratch);
+#line 344
+#line 344
err = remove(scratch);
+#line 344
IF (err)
+#line 344
error("remove of %s failed", scratch);
+#line 344
}
+#line 344
void
+#line 345
test_nc_put_var1_long(void)
+#line 345
{
+#line 345
int ncid;
+#line 345
int i;
+#line 345
int j;
+#line 345
int err;
+#line 345
size_t index[MAX_RANK];
+#line 345
int canConvert; /* Both text or both numeric */
+#line 345
long value = 5; /* any value would do - only for error cases */
+#line 345
+#line 345
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 345
IF (err) {
+#line 345
error("nc_create: %s", nc_strerror(err));
+#line 345
return;
+#line 345
}
+#line 345
def_dims(ncid);
+#line 345
def_vars(ncid);
+#line 345
err = nc_enddef(ncid);
+#line 345
IF (err)
+#line 345
error("nc_enddef: %s", nc_strerror(err));
+#line 345
+#line 345
for (i = 0; i < NVARS; i++) {
+#line 345
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 345
for (j = 0; j < var_rank[i]; j++)
+#line 345
index[j] = 0;
+#line 345
err = nc_put_var1_long(BAD_ID, i, index, &value);
+#line 345
IF (err != NC_EBADID)
+#line 345
error("bad ncid: status = %d", err);
+#line 345
err = nc_put_var1_long(ncid, BAD_VARID, index, &value);
+#line 345
IF (err != NC_ENOTVAR)
+#line 345
error("bad var id: status = %d", err);
+#line 345
for (j = 0; j < var_rank[i]; j++) {
+#line 345
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 345
index[j] = var_shape[i][j];
+#line 345
err = nc_put_var1_long(ncid, i, index, &value);
+#line 345
IF (canConvert && err != NC_EINVALCOORDS)
+#line 345
error("bad index: status = %d", err);
+#line 345
index[j] = 0;
+#line 345
}
+#line 345
}
+#line 345
for (j = 0; j < var_nels[i]; j++) {
+#line 345
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 345
IF (err)
+#line 345
error("error in toMixedBase 1");
+#line 345
value = hash_long( var_type[i], var_rank[i], index, NCT_LONG);
+#line 345
if (var_rank[i] == 0 && i%2 == 0)
+#line 345
err = nc_put_var1_long(ncid, i, NULL, &value);
+#line 345
else
+#line 345
err = nc_put_var1_long(ncid, i, index, &value);
+#line 345
if (canConvert) {
+#line 345
if (inRange3(value, var_type[i],NCT_LONG)) {
+#line 345
IF (err)
+#line 345
error("%s", nc_strerror(err));
+#line 345
} else {
+#line 345
IF (err != NC_ERANGE) {
+#line 345
error("Range error: status = %d", err);
+#line 345
error("\n\t\tfor type %s value %.17e %ld",
+#line 345
s_nc_type(var_type[i]),
+#line 345
(double)value, (long)value);
+#line 345
}
+#line 345
}
+#line 345
} else {
+#line 345
IF (err != NC_ECHAR)
+#line 345
error("wrong type: status = %d", err);
+#line 345
}
+#line 345
}
+#line 345
}
+#line 345
+#line 345
err = nc_close(ncid);
+#line 345
IF (err)
+#line 345
error("nc_close: %s", nc_strerror(err));
+#line 345
+#line 345
check_vars_long(scratch);
+#line 345
+#line 345
err = remove(scratch);
+#line 345
IF (err)
+#line 345
error("remove of %s failed", scratch);
+#line 345
}
+#line 345
void
+#line 346
test_nc_put_var1_float(void)
+#line 346
{
+#line 346
int ncid;
+#line 346
int i;
+#line 346
int j;
+#line 346
int err;
+#line 346
size_t index[MAX_RANK];
+#line 346
int canConvert; /* Both text or both numeric */
+#line 346
float value = 5; /* any value would do - only for error cases */
+#line 346
+#line 346
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 346
IF (err) {
+#line 346
error("nc_create: %s", nc_strerror(err));
+#line 346
return;
+#line 346
}
+#line 346
def_dims(ncid);
+#line 346
def_vars(ncid);
+#line 346
err = nc_enddef(ncid);
+#line 346
IF (err)
+#line 346
error("nc_enddef: %s", nc_strerror(err));
+#line 346
+#line 346
for (i = 0; i < NVARS; i++) {
+#line 346
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 346
for (j = 0; j < var_rank[i]; j++)
+#line 346
index[j] = 0;
+#line 346
err = nc_put_var1_float(BAD_ID, i, index, &value);
+#line 346
IF (err != NC_EBADID)
+#line 346
error("bad ncid: status = %d", err);
+#line 346
err = nc_put_var1_float(ncid, BAD_VARID, index, &value);
+#line 346
IF (err != NC_ENOTVAR)
+#line 346
error("bad var id: status = %d", err);
+#line 346
for (j = 0; j < var_rank[i]; j++) {
+#line 346
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 346
index[j] = var_shape[i][j];
+#line 346
err = nc_put_var1_float(ncid, i, index, &value);
+#line 346
IF (canConvert && err != NC_EINVALCOORDS)
+#line 346
error("bad index: status = %d", err);
+#line 346
index[j] = 0;
+#line 346
}
+#line 346
}
+#line 346
for (j = 0; j < var_nels[i]; j++) {
+#line 346
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 346
IF (err)
+#line 346
error("error in toMixedBase 1");
+#line 346
value = hash_float( var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 346
if (var_rank[i] == 0 && i%2 == 0)
+#line 346
err = nc_put_var1_float(ncid, i, NULL, &value);
+#line 346
else
+#line 346
err = nc_put_var1_float(ncid, i, index, &value);
+#line 346
if (canConvert) {
+#line 346
if (inRange3(value, var_type[i],NCT_FLOAT)) {
+#line 346
IF (err)
+#line 346
error("%s", nc_strerror(err));
+#line 346
} else {
+#line 346
IF (err != NC_ERANGE) {
+#line 346
error("Range error: status = %d", err);
+#line 346
error("\n\t\tfor type %s value %.17e %ld",
+#line 346
s_nc_type(var_type[i]),
+#line 346
(double)value, (long)value);
+#line 346
}
+#line 346
}
+#line 346
} else {
+#line 346
IF (err != NC_ECHAR)
+#line 346
error("wrong type: status = %d", err);
+#line 346
}
+#line 346
}
+#line 346
}
+#line 346
+#line 346
err = nc_close(ncid);
+#line 346
IF (err)
+#line 346
error("nc_close: %s", nc_strerror(err));
+#line 346
+#line 346
check_vars_float(scratch);
+#line 346
+#line 346
err = remove(scratch);
+#line 346
IF (err)
+#line 346
error("remove of %s failed", scratch);
+#line 346
}
+#line 346
void
+#line 347
test_nc_put_var1_double(void)
+#line 347
{
+#line 347
int ncid;
+#line 347
int i;
+#line 347
int j;
+#line 347
int err;
+#line 347
size_t index[MAX_RANK];
+#line 347
int canConvert; /* Both text or both numeric */
+#line 347
double value = 5; /* any value would do - only for error cases */
+#line 347
+#line 347
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 347
IF (err) {
+#line 347
error("nc_create: %s", nc_strerror(err));
+#line 347
return;
+#line 347
}
+#line 347
def_dims(ncid);
+#line 347
def_vars(ncid);
+#line 347
err = nc_enddef(ncid);
+#line 347
IF (err)
+#line 347
error("nc_enddef: %s", nc_strerror(err));
+#line 347
+#line 347
for (i = 0; i < NVARS; i++) {
+#line 347
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 347
for (j = 0; j < var_rank[i]; j++)
+#line 347
index[j] = 0;
+#line 347
err = nc_put_var1_double(BAD_ID, i, index, &value);
+#line 347
IF (err != NC_EBADID)
+#line 347
error("bad ncid: status = %d", err);
+#line 347
err = nc_put_var1_double(ncid, BAD_VARID, index, &value);
+#line 347
IF (err != NC_ENOTVAR)
+#line 347
error("bad var id: status = %d", err);
+#line 347
for (j = 0; j < var_rank[i]; j++) {
+#line 347
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 347
index[j] = var_shape[i][j];
+#line 347
err = nc_put_var1_double(ncid, i, index, &value);
+#line 347
IF (canConvert && err != NC_EINVALCOORDS)
+#line 347
error("bad index: status = %d", err);
+#line 347
index[j] = 0;
+#line 347
}
+#line 347
}
+#line 347
for (j = 0; j < var_nels[i]; j++) {
+#line 347
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 347
IF (err)
+#line 347
error("error in toMixedBase 1");
+#line 347
value = hash_double( var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 347
if (var_rank[i] == 0 && i%2 == 0)
+#line 347
err = nc_put_var1_double(ncid, i, NULL, &value);
+#line 347
else
+#line 347
err = nc_put_var1_double(ncid, i, index, &value);
+#line 347
if (canConvert) {
+#line 347
if (inRange3(value, var_type[i],NCT_DOUBLE)) {
+#line 347
IF (err)
+#line 347
error("%s", nc_strerror(err));
+#line 347
} else {
+#line 347
IF (err != NC_ERANGE) {
+#line 347
error("Range error: status = %d", err);
+#line 347
error("\n\t\tfor type %s value %.17e %ld",
+#line 347
s_nc_type(var_type[i]),
+#line 347
(double)value, (long)value);
+#line 347
}
+#line 347
}
+#line 347
} else {
+#line 347
IF (err != NC_ECHAR)
+#line 347
error("wrong type: status = %d", err);
+#line 347
}
+#line 347
}
+#line 347
}
+#line 347
+#line 347
err = nc_close(ncid);
+#line 347
IF (err)
+#line 347
error("nc_close: %s", nc_strerror(err));
+#line 347
+#line 347
check_vars_double(scratch);
+#line 347
+#line 347
err = remove(scratch);
+#line 347
IF (err)
+#line 347
error("remove of %s failed", scratch);
+#line 347
}
+#line 347
+#line 477
void
+#line 478
test_nc_put_var_text(void)
+#line 478
{
+#line 478
int ncid;
+#line 478
int varid;
+#line 478
int i;
+#line 478
int j;
+#line 478
int err;
+#line 478
int nels;
+#line 478
size_t index[MAX_RANK];
+#line 478
int canConvert; /* Both text or both numeric */
+#line 478
int allInExtRange; /* all values within external range? */
+#line 478
text value[MAX_NELS];
+#line 478
+#line 478
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 478
IF (err) {
+#line 478
error("nc_create: %s", nc_strerror(err));
+#line 478
return;
+#line 478
}
+#line 478
def_dims(ncid);
+#line 478
def_vars(ncid);
+#line 478
err = nc_enddef(ncid);
+#line 478
IF (err)
+#line 478
error("nc_enddef: %s", nc_strerror(err));
+#line 478
+#line 478
for (i = 0; i < NVARS; i++) {
+#line 478
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 478
assert(var_rank[i] <= MAX_RANK);
+#line 478
assert(var_nels[i] <= MAX_NELS);
+#line 478
err = nc_put_var_text(BAD_ID, i, value);
+#line 478
IF (err != NC_EBADID)
+#line 478
error("bad ncid: status = %d", err);
+#line 478
err = nc_put_var_text(ncid, BAD_VARID, value);
+#line 478
IF (err != NC_ENOTVAR)
+#line 478
error("bad var id: status = %d", err);
+#line 478
+#line 478
nels = 1;
+#line 478
for (j = 0; j < var_rank[i]; j++) {
+#line 478
nels *= var_shape[i][j];
+#line 478
}
+#line 478
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 478
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 478
IF (err)
+#line 478
error("error in toMixedBase 1");
+#line 478
value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT);
+#line 478
allInExtRange = allInExtRange
+#line 478
&& inRange3(value[j], var_type[i], NCT_TEXT);
+#line 478
}
+#line 478
err = nc_put_var_text(ncid, i, value);
+#line 478
if (canConvert) {
+#line 478
if (allInExtRange) {
+#line 478
IF (err)
+#line 478
error("%s", nc_strerror(err));
+#line 478
} else {
+#line 478
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 478
error("range error: status = %d", err);
+#line 478
}
+#line 478
} else { /* should flag wrong type even if nothing to write */
+#line 478
IF (nels > 0 && err != NC_ECHAR)
+#line 478
error("wrong type: status = %d", err);
+#line 478
}
+#line 478
}
+#line 478
+#line 478
/* Preceeding has written nothing for record variables, now try */
+#line 478
/* again with more than 0 records */
+#line 478
+#line 478
/* Write record number NRECS to force writing of preceding records */
+#line 478
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 478
err = nc_inq_varid(ncid, "cr", &varid);
+#line 478
IF (err)
+#line 478
error("nc_inq_varid: %s", nc_strerror(err));
+#line 478
index[0] = NRECS-1;
+#line 478
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 478
IF (err)
+#line 478
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 478
+#line 478
for (i = 0; i < NVARS; i++) {
+#line 478
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 478
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 478
assert(var_rank[i] <= MAX_RANK);
+#line 478
assert(var_nels[i] <= MAX_NELS);
+#line 478
err = nc_put_var_text(BAD_ID, i, value);
+#line 478
IF (err != NC_EBADID)
+#line 478
error("bad ncid: status = %d", err);
+#line 478
nels = 1;
+#line 478
for (j = 0; j < var_rank[i]; j++) {
+#line 478
nels *= var_shape[i][j];
+#line 478
}
+#line 478
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 478
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 478
IF (err)
+#line 478
error("error in toMixedBase 1");
+#line 478
value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT);
+#line 478
allInExtRange = allInExtRange
+#line 478
&& inRange3(value[j], var_type[i], NCT_TEXT);
+#line 478
}
+#line 478
err = nc_put_var_text(ncid, i, value);
+#line 478
if (canConvert) {
+#line 478
if (allInExtRange) {
+#line 478
IF (err)
+#line 478
error("%s", nc_strerror(err));
+#line 478
} else {
+#line 478
IF (err != NC_ERANGE)
+#line 478
error("range error: status = %d", err);
+#line 478
}
+#line 478
} else {
+#line 478
IF (nels > 0 && err != NC_ECHAR)
+#line 478
error("wrong type: status = %d", err);
+#line 478
}
+#line 478
}
+#line 478
}
+#line 478
+#line 478
err = nc_close(ncid);
+#line 478
IF (err)
+#line 478
error("nc_close: %s", nc_strerror(err));
+#line 478
+#line 478
check_vars_text(scratch);
+#line 478
+#line 478
err = remove(scratch);
+#line 478
IF (err)
+#line 478
error("remove of %s failed", scratch);
+#line 478
}
+#line 478
void
+#line 479
test_nc_put_var_uchar(void)
+#line 479
{
+#line 479
int ncid;
+#line 479
int varid;
+#line 479
int i;
+#line 479
int j;
+#line 479
int err;
+#line 479
int nels;
+#line 479
size_t index[MAX_RANK];
+#line 479
int canConvert; /* Both text or both numeric */
+#line 479
int allInExtRange; /* all values within external range? */
+#line 479
uchar value[MAX_NELS];
+#line 479
+#line 479
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 479
IF (err) {
+#line 479
error("nc_create: %s", nc_strerror(err));
+#line 479
return;
+#line 479
}
+#line 479
def_dims(ncid);
+#line 479
def_vars(ncid);
+#line 479
err = nc_enddef(ncid);
+#line 479
IF (err)
+#line 479
error("nc_enddef: %s", nc_strerror(err));
+#line 479
+#line 479
for (i = 0; i < NVARS; i++) {
+#line 479
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 479
assert(var_rank[i] <= MAX_RANK);
+#line 479
assert(var_nels[i] <= MAX_NELS);
+#line 479
err = nc_put_var_uchar(BAD_ID, i, value);
+#line 479
IF (err != NC_EBADID)
+#line 479
error("bad ncid: status = %d", err);
+#line 479
err = nc_put_var_uchar(ncid, BAD_VARID, value);
+#line 479
IF (err != NC_ENOTVAR)
+#line 479
error("bad var id: status = %d", err);
+#line 479
+#line 479
nels = 1;
+#line 479
for (j = 0; j < var_rank[i]; j++) {
+#line 479
nels *= var_shape[i][j];
+#line 479
}
+#line 479
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 479
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 479
IF (err)
+#line 479
error("error in toMixedBase 1");
+#line 479
value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 479
allInExtRange = allInExtRange
+#line 479
&& inRange3(value[j], var_type[i], NCT_UCHAR);
+#line 479
}
+#line 479
err = nc_put_var_uchar(ncid, i, value);
+#line 479
if (canConvert) {
+#line 479
if (allInExtRange) {
+#line 479
IF (err)
+#line 479
error("%s", nc_strerror(err));
+#line 479
} else {
+#line 479
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 479
error("range error: status = %d", err);
+#line 479
}
+#line 479
} else { /* should flag wrong type even if nothing to write */
+#line 479
IF (nels > 0 && err != NC_ECHAR)
+#line 479
error("wrong type: status = %d", err);
+#line 479
}
+#line 479
}
+#line 479
+#line 479
/* Preceeding has written nothing for record variables, now try */
+#line 479
/* again with more than 0 records */
+#line 479
+#line 479
/* Write record number NRECS to force writing of preceding records */
+#line 479
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 479
err = nc_inq_varid(ncid, "cr", &varid);
+#line 479
IF (err)
+#line 479
error("nc_inq_varid: %s", nc_strerror(err));
+#line 479
index[0] = NRECS-1;
+#line 479
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 479
IF (err)
+#line 479
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 479
+#line 479
for (i = 0; i < NVARS; i++) {
+#line 479
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 479
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 479
assert(var_rank[i] <= MAX_RANK);
+#line 479
assert(var_nels[i] <= MAX_NELS);
+#line 479
err = nc_put_var_uchar(BAD_ID, i, value);
+#line 479
IF (err != NC_EBADID)
+#line 479
error("bad ncid: status = %d", err);
+#line 479
nels = 1;
+#line 479
for (j = 0; j < var_rank[i]; j++) {
+#line 479
nels *= var_shape[i][j];
+#line 479
}
+#line 479
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 479
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 479
IF (err)
+#line 479
error("error in toMixedBase 1");
+#line 479
value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 479
allInExtRange = allInExtRange
+#line 479
&& inRange3(value[j], var_type[i], NCT_UCHAR);
+#line 479
}
+#line 479
err = nc_put_var_uchar(ncid, i, value);
+#line 479
if (canConvert) {
+#line 479
if (allInExtRange) {
+#line 479
IF (err)
+#line 479
error("%s", nc_strerror(err));
+#line 479
} else {
+#line 479
IF (err != NC_ERANGE)
+#line 479
error("range error: status = %d", err);
+#line 479
}
+#line 479
} else {
+#line 479
IF (nels > 0 && err != NC_ECHAR)
+#line 479
error("wrong type: status = %d", err);
+#line 479
}
+#line 479
}
+#line 479
}
+#line 479
+#line 479
err = nc_close(ncid);
+#line 479
IF (err)
+#line 479
error("nc_close: %s", nc_strerror(err));
+#line 479
+#line 479
check_vars_uchar(scratch);
+#line 479
+#line 479
err = remove(scratch);
+#line 479
IF (err)
+#line 479
error("remove of %s failed", scratch);
+#line 479
}
+#line 479
void
+#line 480
test_nc_put_var_schar(void)
+#line 480
{
+#line 480
int ncid;
+#line 480
int varid;
+#line 480
int i;
+#line 480
int j;
+#line 480
int err;
+#line 480
int nels;
+#line 480
size_t index[MAX_RANK];
+#line 480
int canConvert; /* Both text or both numeric */
+#line 480
int allInExtRange; /* all values within external range? */
+#line 480
schar value[MAX_NELS];
+#line 480
+#line 480
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 480
IF (err) {
+#line 480
error("nc_create: %s", nc_strerror(err));
+#line 480
return;
+#line 480
}
+#line 480
def_dims(ncid);
+#line 480
def_vars(ncid);
+#line 480
err = nc_enddef(ncid);
+#line 480
IF (err)
+#line 480
error("nc_enddef: %s", nc_strerror(err));
+#line 480
+#line 480
for (i = 0; i < NVARS; i++) {
+#line 480
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 480
assert(var_rank[i] <= MAX_RANK);
+#line 480
assert(var_nels[i] <= MAX_NELS);
+#line 480
err = nc_put_var_schar(BAD_ID, i, value);
+#line 480
IF (err != NC_EBADID)
+#line 480
error("bad ncid: status = %d", err);
+#line 480
err = nc_put_var_schar(ncid, BAD_VARID, value);
+#line 480
IF (err != NC_ENOTVAR)
+#line 480
error("bad var id: status = %d", err);
+#line 480
+#line 480
nels = 1;
+#line 480
for (j = 0; j < var_rank[i]; j++) {
+#line 480
nels *= var_shape[i][j];
+#line 480
}
+#line 480
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 480
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 480
IF (err)
+#line 480
error("error in toMixedBase 1");
+#line 480
value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 480
allInExtRange = allInExtRange
+#line 480
&& inRange3(value[j], var_type[i], NCT_SCHAR);
+#line 480
}
+#line 480
err = nc_put_var_schar(ncid, i, value);
+#line 480
if (canConvert) {
+#line 480
if (allInExtRange) {
+#line 480
IF (err)
+#line 480
error("%s", nc_strerror(err));
+#line 480
} else {
+#line 480
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 480
error("range error: status = %d", err);
+#line 480
}
+#line 480
} else { /* should flag wrong type even if nothing to write */
+#line 480
IF (nels > 0 && err != NC_ECHAR)
+#line 480
error("wrong type: status = %d", err);
+#line 480
}
+#line 480
}
+#line 480
+#line 480
/* Preceeding has written nothing for record variables, now try */
+#line 480
/* again with more than 0 records */
+#line 480
+#line 480
/* Write record number NRECS to force writing of preceding records */
+#line 480
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 480
err = nc_inq_varid(ncid, "cr", &varid);
+#line 480
IF (err)
+#line 480
error("nc_inq_varid: %s", nc_strerror(err));
+#line 480
index[0] = NRECS-1;
+#line 480
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 480
IF (err)
+#line 480
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 480
+#line 480
for (i = 0; i < NVARS; i++) {
+#line 480
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 480
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 480
assert(var_rank[i] <= MAX_RANK);
+#line 480
assert(var_nels[i] <= MAX_NELS);
+#line 480
err = nc_put_var_schar(BAD_ID, i, value);
+#line 480
IF (err != NC_EBADID)
+#line 480
error("bad ncid: status = %d", err);
+#line 480
nels = 1;
+#line 480
for (j = 0; j < var_rank[i]; j++) {
+#line 480
nels *= var_shape[i][j];
+#line 480
}
+#line 480
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 480
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 480
IF (err)
+#line 480
error("error in toMixedBase 1");
+#line 480
value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 480
allInExtRange = allInExtRange
+#line 480
&& inRange3(value[j], var_type[i], NCT_SCHAR);
+#line 480
}
+#line 480
err = nc_put_var_schar(ncid, i, value);
+#line 480
if (canConvert) {
+#line 480
if (allInExtRange) {
+#line 480
IF (err)
+#line 480
error("%s", nc_strerror(err));
+#line 480
} else {
+#line 480
IF (err != NC_ERANGE)
+#line 480
error("range error: status = %d", err);
+#line 480
}
+#line 480
} else {
+#line 480
IF (nels > 0 && err != NC_ECHAR)
+#line 480
error("wrong type: status = %d", err);
+#line 480
}
+#line 480
}
+#line 480
}
+#line 480
+#line 480
err = nc_close(ncid);
+#line 480
IF (err)
+#line 480
error("nc_close: %s", nc_strerror(err));
+#line 480
+#line 480
check_vars_schar(scratch);
+#line 480
+#line 480
err = remove(scratch);
+#line 480
IF (err)
+#line 480
error("remove of %s failed", scratch);
+#line 480
}
+#line 480
void
+#line 481
test_nc_put_var_short(void)
+#line 481
{
+#line 481
int ncid;
+#line 481
int varid;
+#line 481
int i;
+#line 481
int j;
+#line 481
int err;
+#line 481
int nels;
+#line 481
size_t index[MAX_RANK];
+#line 481
int canConvert; /* Both text or both numeric */
+#line 481
int allInExtRange; /* all values within external range? */
+#line 481
short value[MAX_NELS];
+#line 481
+#line 481
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 481
IF (err) {
+#line 481
error("nc_create: %s", nc_strerror(err));
+#line 481
return;
+#line 481
}
+#line 481
def_dims(ncid);
+#line 481
def_vars(ncid);
+#line 481
err = nc_enddef(ncid);
+#line 481
IF (err)
+#line 481
error("nc_enddef: %s", nc_strerror(err));
+#line 481
+#line 481
for (i = 0; i < NVARS; i++) {
+#line 481
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 481
assert(var_rank[i] <= MAX_RANK);
+#line 481
assert(var_nels[i] <= MAX_NELS);
+#line 481
err = nc_put_var_short(BAD_ID, i, value);
+#line 481
IF (err != NC_EBADID)
+#line 481
error("bad ncid: status = %d", err);
+#line 481
err = nc_put_var_short(ncid, BAD_VARID, value);
+#line 481
IF (err != NC_ENOTVAR)
+#line 481
error("bad var id: status = %d", err);
+#line 481
+#line 481
nels = 1;
+#line 481
for (j = 0; j < var_rank[i]; j++) {
+#line 481
nels *= var_shape[i][j];
+#line 481
}
+#line 481
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 481
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 481
IF (err)
+#line 481
error("error in toMixedBase 1");
+#line 481
value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT);
+#line 481
allInExtRange = allInExtRange
+#line 481
&& inRange3(value[j], var_type[i], NCT_SHORT);
+#line 481
}
+#line 481
err = nc_put_var_short(ncid, i, value);
+#line 481
if (canConvert) {
+#line 481
if (allInExtRange) {
+#line 481
IF (err)
+#line 481
error("%s", nc_strerror(err));
+#line 481
} else {
+#line 481
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 481
error("range error: status = %d", err);
+#line 481
}
+#line 481
} else { /* should flag wrong type even if nothing to write */
+#line 481
IF (nels > 0 && err != NC_ECHAR)
+#line 481
error("wrong type: status = %d", err);
+#line 481
}
+#line 481
}
+#line 481
+#line 481
/* Preceeding has written nothing for record variables, now try */
+#line 481
/* again with more than 0 records */
+#line 481
+#line 481
/* Write record number NRECS to force writing of preceding records */
+#line 481
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 481
err = nc_inq_varid(ncid, "cr", &varid);
+#line 481
IF (err)
+#line 481
error("nc_inq_varid: %s", nc_strerror(err));
+#line 481
index[0] = NRECS-1;
+#line 481
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 481
IF (err)
+#line 481
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 481
+#line 481
for (i = 0; i < NVARS; i++) {
+#line 481
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 481
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 481
assert(var_rank[i] <= MAX_RANK);
+#line 481
assert(var_nels[i] <= MAX_NELS);
+#line 481
err = nc_put_var_short(BAD_ID, i, value);
+#line 481
IF (err != NC_EBADID)
+#line 481
error("bad ncid: status = %d", err);
+#line 481
nels = 1;
+#line 481
for (j = 0; j < var_rank[i]; j++) {
+#line 481
nels *= var_shape[i][j];
+#line 481
}
+#line 481
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 481
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 481
IF (err)
+#line 481
error("error in toMixedBase 1");
+#line 481
value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT);
+#line 481
allInExtRange = allInExtRange
+#line 481
&& inRange3(value[j], var_type[i], NCT_SHORT);
+#line 481
}
+#line 481
err = nc_put_var_short(ncid, i, value);
+#line 481
if (canConvert) {
+#line 481
if (allInExtRange) {
+#line 481
IF (err)
+#line 481
error("%s", nc_strerror(err));
+#line 481
} else {
+#line 481
IF (err != NC_ERANGE)
+#line 481
error("range error: status = %d", err);
+#line 481
}
+#line 481
} else {
+#line 481
IF (nels > 0 && err != NC_ECHAR)
+#line 481
error("wrong type: status = %d", err);
+#line 481
}
+#line 481
}
+#line 481
}
+#line 481
+#line 481
err = nc_close(ncid);
+#line 481
IF (err)
+#line 481
error("nc_close: %s", nc_strerror(err));
+#line 481
+#line 481
check_vars_short(scratch);
+#line 481
+#line 481
err = remove(scratch);
+#line 481
IF (err)
+#line 481
error("remove of %s failed", scratch);
+#line 481
}
+#line 481
void
+#line 482
test_nc_put_var_int(void)
+#line 482
{
+#line 482
int ncid;
+#line 482
int varid;
+#line 482
int i;
+#line 482
int j;
+#line 482
int err;
+#line 482
int nels;
+#line 482
size_t index[MAX_RANK];
+#line 482
int canConvert; /* Both text or both numeric */
+#line 482
int allInExtRange; /* all values within external range? */
+#line 482
int value[MAX_NELS];
+#line 482
+#line 482
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 482
IF (err) {
+#line 482
error("nc_create: %s", nc_strerror(err));
+#line 482
return;
+#line 482
}
+#line 482
def_dims(ncid);
+#line 482
def_vars(ncid);
+#line 482
err = nc_enddef(ncid);
+#line 482
IF (err)
+#line 482
error("nc_enddef: %s", nc_strerror(err));
+#line 482
+#line 482
for (i = 0; i < NVARS; i++) {
+#line 482
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 482
assert(var_rank[i] <= MAX_RANK);
+#line 482
assert(var_nels[i] <= MAX_NELS);
+#line 482
err = nc_put_var_int(BAD_ID, i, value);
+#line 482
IF (err != NC_EBADID)
+#line 482
error("bad ncid: status = %d", err);
+#line 482
err = nc_put_var_int(ncid, BAD_VARID, value);
+#line 482
IF (err != NC_ENOTVAR)
+#line 482
error("bad var id: status = %d", err);
+#line 482
+#line 482
nels = 1;
+#line 482
for (j = 0; j < var_rank[i]; j++) {
+#line 482
nels *= var_shape[i][j];
+#line 482
}
+#line 482
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 482
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 482
IF (err)
+#line 482
error("error in toMixedBase 1");
+#line 482
value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT);
+#line 482
allInExtRange = allInExtRange
+#line 482
&& inRange3(value[j], var_type[i], NCT_INT);
+#line 482
}
+#line 482
err = nc_put_var_int(ncid, i, value);
+#line 482
if (canConvert) {
+#line 482
if (allInExtRange) {
+#line 482
IF (err)
+#line 482
error("%s", nc_strerror(err));
+#line 482
} else {
+#line 482
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 482
error("range error: status = %d", err);
+#line 482
}
+#line 482
} else { /* should flag wrong type even if nothing to write */
+#line 482
IF (nels > 0 && err != NC_ECHAR)
+#line 482
error("wrong type: status = %d", err);
+#line 482
}
+#line 482
}
+#line 482
+#line 482
/* Preceeding has written nothing for record variables, now try */
+#line 482
/* again with more than 0 records */
+#line 482
+#line 482
/* Write record number NRECS to force writing of preceding records */
+#line 482
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 482
err = nc_inq_varid(ncid, "cr", &varid);
+#line 482
IF (err)
+#line 482
error("nc_inq_varid: %s", nc_strerror(err));
+#line 482
index[0] = NRECS-1;
+#line 482
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 482
IF (err)
+#line 482
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 482
+#line 482
for (i = 0; i < NVARS; i++) {
+#line 482
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 482
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 482
assert(var_rank[i] <= MAX_RANK);
+#line 482
assert(var_nels[i] <= MAX_NELS);
+#line 482
err = nc_put_var_int(BAD_ID, i, value);
+#line 482
IF (err != NC_EBADID)
+#line 482
error("bad ncid: status = %d", err);
+#line 482
nels = 1;
+#line 482
for (j = 0; j < var_rank[i]; j++) {
+#line 482
nels *= var_shape[i][j];
+#line 482
}
+#line 482
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 482
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 482
IF (err)
+#line 482
error("error in toMixedBase 1");
+#line 482
value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT);
+#line 482
allInExtRange = allInExtRange
+#line 482
&& inRange3(value[j], var_type[i], NCT_INT);
+#line 482
}
+#line 482
err = nc_put_var_int(ncid, i, value);
+#line 482
if (canConvert) {
+#line 482
if (allInExtRange) {
+#line 482
IF (err)
+#line 482
error("%s", nc_strerror(err));
+#line 482
} else {
+#line 482
IF (err != NC_ERANGE)
+#line 482
error("range error: status = %d", err);
+#line 482
}
+#line 482
} else {
+#line 482
IF (nels > 0 && err != NC_ECHAR)
+#line 482
error("wrong type: status = %d", err);
+#line 482
}
+#line 482
}
+#line 482
}
+#line 482
+#line 482
err = nc_close(ncid);
+#line 482
IF (err)
+#line 482
error("nc_close: %s", nc_strerror(err));
+#line 482
+#line 482
check_vars_int(scratch);
+#line 482
+#line 482
err = remove(scratch);
+#line 482
IF (err)
+#line 482
error("remove of %s failed", scratch);
+#line 482
}
+#line 482
void
+#line 483
test_nc_put_var_long(void)
+#line 483
{
+#line 483
int ncid;
+#line 483
int varid;
+#line 483
int i;
+#line 483
int j;
+#line 483
int err;
+#line 483
int nels;
+#line 483
size_t index[MAX_RANK];
+#line 483
int canConvert; /* Both text or both numeric */
+#line 483
int allInExtRange; /* all values within external range? */
+#line 483
long value[MAX_NELS];
+#line 483
+#line 483
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 483
IF (err) {
+#line 483
error("nc_create: %s", nc_strerror(err));
+#line 483
return;
+#line 483
}
+#line 483
def_dims(ncid);
+#line 483
def_vars(ncid);
+#line 483
err = nc_enddef(ncid);
+#line 483
IF (err)
+#line 483
error("nc_enddef: %s", nc_strerror(err));
+#line 483
+#line 483
for (i = 0; i < NVARS; i++) {
+#line 483
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 483
assert(var_rank[i] <= MAX_RANK);
+#line 483
assert(var_nels[i] <= MAX_NELS);
+#line 483
err = nc_put_var_long(BAD_ID, i, value);
+#line 483
IF (err != NC_EBADID)
+#line 483
error("bad ncid: status = %d", err);
+#line 483
err = nc_put_var_long(ncid, BAD_VARID, value);
+#line 483
IF (err != NC_ENOTVAR)
+#line 483
error("bad var id: status = %d", err);
+#line 483
+#line 483
nels = 1;
+#line 483
for (j = 0; j < var_rank[i]; j++) {
+#line 483
nels *= var_shape[i][j];
+#line 483
}
+#line 483
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 483
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 483
IF (err)
+#line 483
error("error in toMixedBase 1");
+#line 483
value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG);
+#line 483
allInExtRange = allInExtRange
+#line 483
&& inRange3(value[j], var_type[i], NCT_LONG);
+#line 483
}
+#line 483
err = nc_put_var_long(ncid, i, value);
+#line 483
if (canConvert) {
+#line 483
if (allInExtRange) {
+#line 483
IF (err)
+#line 483
error("%s", nc_strerror(err));
+#line 483
} else {
+#line 483
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 483
error("range error: status = %d", err);
+#line 483
}
+#line 483
} else { /* should flag wrong type even if nothing to write */
+#line 483
IF (nels > 0 && err != NC_ECHAR)
+#line 483
error("wrong type: status = %d", err);
+#line 483
}
+#line 483
}
+#line 483
+#line 483
/* Preceeding has written nothing for record variables, now try */
+#line 483
/* again with more than 0 records */
+#line 483
+#line 483
/* Write record number NRECS to force writing of preceding records */
+#line 483
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 483
err = nc_inq_varid(ncid, "cr", &varid);
+#line 483
IF (err)
+#line 483
error("nc_inq_varid: %s", nc_strerror(err));
+#line 483
index[0] = NRECS-1;
+#line 483
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 483
IF (err)
+#line 483
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 483
+#line 483
for (i = 0; i < NVARS; i++) {
+#line 483
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 483
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 483
assert(var_rank[i] <= MAX_RANK);
+#line 483
assert(var_nels[i] <= MAX_NELS);
+#line 483
err = nc_put_var_long(BAD_ID, i, value);
+#line 483
IF (err != NC_EBADID)
+#line 483
error("bad ncid: status = %d", err);
+#line 483
nels = 1;
+#line 483
for (j = 0; j < var_rank[i]; j++) {
+#line 483
nels *= var_shape[i][j];
+#line 483
}
+#line 483
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 483
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 483
IF (err)
+#line 483
error("error in toMixedBase 1");
+#line 483
value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG);
+#line 483
allInExtRange = allInExtRange
+#line 483
&& inRange3(value[j], var_type[i], NCT_LONG);
+#line 483
}
+#line 483
err = nc_put_var_long(ncid, i, value);
+#line 483
if (canConvert) {
+#line 483
if (allInExtRange) {
+#line 483
IF (err)
+#line 483
error("%s", nc_strerror(err));
+#line 483
} else {
+#line 483
IF (err != NC_ERANGE)
+#line 483
error("range error: status = %d", err);
+#line 483
}
+#line 483
} else {
+#line 483
IF (nels > 0 && err != NC_ECHAR)
+#line 483
error("wrong type: status = %d", err);
+#line 483
}
+#line 483
}
+#line 483
}
+#line 483
+#line 483
err = nc_close(ncid);
+#line 483
IF (err)
+#line 483
error("nc_close: %s", nc_strerror(err));
+#line 483
+#line 483
check_vars_long(scratch);
+#line 483
+#line 483
err = remove(scratch);
+#line 483
IF (err)
+#line 483
error("remove of %s failed", scratch);
+#line 483
}
+#line 483
void
+#line 484
test_nc_put_var_float(void)
+#line 484
{
+#line 484
int ncid;
+#line 484
int varid;
+#line 484
int i;
+#line 484
int j;
+#line 484
int err;
+#line 484
int nels;
+#line 484
size_t index[MAX_RANK];
+#line 484
int canConvert; /* Both text or both numeric */
+#line 484
int allInExtRange; /* all values within external range? */
+#line 484
float value[MAX_NELS];
+#line 484
+#line 484
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 484
IF (err) {
+#line 484
error("nc_create: %s", nc_strerror(err));
+#line 484
return;
+#line 484
}
+#line 484
def_dims(ncid);
+#line 484
def_vars(ncid);
+#line 484
err = nc_enddef(ncid);
+#line 484
IF (err)
+#line 484
error("nc_enddef: %s", nc_strerror(err));
+#line 484
+#line 484
for (i = 0; i < NVARS; i++) {
+#line 484
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 484
assert(var_rank[i] <= MAX_RANK);
+#line 484
assert(var_nels[i] <= MAX_NELS);
+#line 484
err = nc_put_var_float(BAD_ID, i, value);
+#line 484
IF (err != NC_EBADID)
+#line 484
error("bad ncid: status = %d", err);
+#line 484
err = nc_put_var_float(ncid, BAD_VARID, value);
+#line 484
IF (err != NC_ENOTVAR)
+#line 484
error("bad var id: status = %d", err);
+#line 484
+#line 484
nels = 1;
+#line 484
for (j = 0; j < var_rank[i]; j++) {
+#line 484
nels *= var_shape[i][j];
+#line 484
}
+#line 484
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 484
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 484
IF (err)
+#line 484
error("error in toMixedBase 1");
+#line 484
value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 484
allInExtRange = allInExtRange
+#line 484
&& inRange3(value[j], var_type[i], NCT_FLOAT);
+#line 484
}
+#line 484
err = nc_put_var_float(ncid, i, value);
+#line 484
if (canConvert) {
+#line 484
if (allInExtRange) {
+#line 484
IF (err)
+#line 484
error("%s", nc_strerror(err));
+#line 484
} else {
+#line 484
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 484
error("range error: status = %d", err);
+#line 484
}
+#line 484
} else { /* should flag wrong type even if nothing to write */
+#line 484
IF (nels > 0 && err != NC_ECHAR)
+#line 484
error("wrong type: status = %d", err);
+#line 484
}
+#line 484
}
+#line 484
+#line 484
/* Preceeding has written nothing for record variables, now try */
+#line 484
/* again with more than 0 records */
+#line 484
+#line 484
/* Write record number NRECS to force writing of preceding records */
+#line 484
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 484
err = nc_inq_varid(ncid, "cr", &varid);
+#line 484
IF (err)
+#line 484
error("nc_inq_varid: %s", nc_strerror(err));
+#line 484
index[0] = NRECS-1;
+#line 484
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 484
IF (err)
+#line 484
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 484
+#line 484
for (i = 0; i < NVARS; i++) {
+#line 484
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 484
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 484
assert(var_rank[i] <= MAX_RANK);
+#line 484
assert(var_nels[i] <= MAX_NELS);
+#line 484
err = nc_put_var_float(BAD_ID, i, value);
+#line 484
IF (err != NC_EBADID)
+#line 484
error("bad ncid: status = %d", err);
+#line 484
nels = 1;
+#line 484
for (j = 0; j < var_rank[i]; j++) {
+#line 484
nels *= var_shape[i][j];
+#line 484
}
+#line 484
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 484
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 484
IF (err)
+#line 484
error("error in toMixedBase 1");
+#line 484
value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 484
allInExtRange = allInExtRange
+#line 484
&& inRange3(value[j], var_type[i], NCT_FLOAT);
+#line 484
}
+#line 484
err = nc_put_var_float(ncid, i, value);
+#line 484
if (canConvert) {
+#line 484
if (allInExtRange) {
+#line 484
IF (err)
+#line 484
error("%s", nc_strerror(err));
+#line 484
} else {
+#line 484
IF (err != NC_ERANGE)
+#line 484
error("range error: status = %d", err);
+#line 484
}
+#line 484
} else {
+#line 484
IF (nels > 0 && err != NC_ECHAR)
+#line 484
error("wrong type: status = %d", err);
+#line 484
}
+#line 484
}
+#line 484
}
+#line 484
+#line 484
err = nc_close(ncid);
+#line 484
IF (err)
+#line 484
error("nc_close: %s", nc_strerror(err));
+#line 484
+#line 484
check_vars_float(scratch);
+#line 484
+#line 484
err = remove(scratch);
+#line 484
IF (err)
+#line 484
error("remove of %s failed", scratch);
+#line 484
}
+#line 484
void
+#line 485
test_nc_put_var_double(void)
+#line 485
{
+#line 485
int ncid;
+#line 485
int varid;
+#line 485
int i;
+#line 485
int j;
+#line 485
int err;
+#line 485
int nels;
+#line 485
size_t index[MAX_RANK];
+#line 485
int canConvert; /* Both text or both numeric */
+#line 485
int allInExtRange; /* all values within external range? */
+#line 485
double value[MAX_NELS];
+#line 485
+#line 485
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 485
IF (err) {
+#line 485
error("nc_create: %s", nc_strerror(err));
+#line 485
return;
+#line 485
}
+#line 485
def_dims(ncid);
+#line 485
def_vars(ncid);
+#line 485
err = nc_enddef(ncid);
+#line 485
IF (err)
+#line 485
error("nc_enddef: %s", nc_strerror(err));
+#line 485
+#line 485
for (i = 0; i < NVARS; i++) {
+#line 485
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 485
assert(var_rank[i] <= MAX_RANK);
+#line 485
assert(var_nels[i] <= MAX_NELS);
+#line 485
err = nc_put_var_double(BAD_ID, i, value);
+#line 485
IF (err != NC_EBADID)
+#line 485
error("bad ncid: status = %d", err);
+#line 485
err = nc_put_var_double(ncid, BAD_VARID, value);
+#line 485
IF (err != NC_ENOTVAR)
+#line 485
error("bad var id: status = %d", err);
+#line 485
+#line 485
nels = 1;
+#line 485
for (j = 0; j < var_rank[i]; j++) {
+#line 485
nels *= var_shape[i][j];
+#line 485
}
+#line 485
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 485
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 485
IF (err)
+#line 485
error("error in toMixedBase 1");
+#line 485
value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 485
allInExtRange = allInExtRange
+#line 485
&& inRange3(value[j], var_type[i], NCT_DOUBLE);
+#line 485
}
+#line 485
err = nc_put_var_double(ncid, i, value);
+#line 485
if (canConvert) {
+#line 485
if (allInExtRange) {
+#line 485
IF (err)
+#line 485
error("%s", nc_strerror(err));
+#line 485
} else {
+#line 485
IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
+#line 485
error("range error: status = %d", err);
+#line 485
}
+#line 485
} else { /* should flag wrong type even if nothing to write */
+#line 485
IF (nels > 0 && err != NC_ECHAR)
+#line 485
error("wrong type: status = %d", err);
+#line 485
}
+#line 485
}
+#line 485
+#line 485
/* Preceeding has written nothing for record variables, now try */
+#line 485
/* again with more than 0 records */
+#line 485
+#line 485
/* Write record number NRECS to force writing of preceding records */
+#line 485
/* Assumes variable cr is char vector with UNLIMITED dimension */
+#line 485
err = nc_inq_varid(ncid, "cr", &varid);
+#line 485
IF (err)
+#line 485
error("nc_inq_varid: %s", nc_strerror(err));
+#line 485
index[0] = NRECS-1;
+#line 485
err = nc_put_var1_text(ncid, varid, index, "x");
+#line 485
IF (err)
+#line 485
error("nc_put_var1_text: %s", nc_strerror(err));
+#line 485
+#line 485
for (i = 0; i < NVARS; i++) {
+#line 485
if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
+#line 485
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 485
assert(var_rank[i] <= MAX_RANK);
+#line 485
assert(var_nels[i] <= MAX_NELS);
+#line 485
err = nc_put_var_double(BAD_ID, i, value);
+#line 485
IF (err != NC_EBADID)
+#line 485
error("bad ncid: status = %d", err);
+#line 485
nels = 1;
+#line 485
for (j = 0; j < var_rank[i]; j++) {
+#line 485
nels *= var_shape[i][j];
+#line 485
}
+#line 485
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 485
err = toMixedBase(j, var_rank[i], var_shape[i], index);
+#line 485
IF (err)
+#line 485
error("error in toMixedBase 1");
+#line 485
value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 485
allInExtRange = allInExtRange
+#line 485
&& inRange3(value[j], var_type[i], NCT_DOUBLE);
+#line 485
}
+#line 485
err = nc_put_var_double(ncid, i, value);
+#line 485
if (canConvert) {
+#line 485
if (allInExtRange) {
+#line 485
IF (err)
+#line 485
error("%s", nc_strerror(err));
+#line 485
} else {
+#line 485
IF (err != NC_ERANGE)
+#line 485
error("range error: status = %d", err);
+#line 485
}
+#line 485
} else {
+#line 485
IF (nels > 0 && err != NC_ECHAR)
+#line 485
error("wrong type: status = %d", err);
+#line 485
}
+#line 485
}
+#line 485
}
+#line 485
+#line 485
err = nc_close(ncid);
+#line 485
IF (err)
+#line 485
error("nc_close: %s", nc_strerror(err));
+#line 485
+#line 485
check_vars_double(scratch);
+#line 485
+#line 485
err = remove(scratch);
+#line 485
IF (err)
+#line 485
error("remove of %s failed", scratch);
+#line 485
}
+#line 485
+#line 642
void
+#line 643
test_nc_put_vara_text(void)
+#line 643
{
+#line 643
int ncid;
+#line 643
int d;
+#line 643
int i;
+#line 643
int j;
+#line 643
int k;
+#line 643
int err;
+#line 643
int nslabs;
+#line 643
int nels;
+#line 643
size_t start[MAX_RANK];
+#line 643
size_t edge[MAX_RANK];
+#line 643
size_t mid[MAX_RANK];
+#line 643
size_t index[MAX_RANK];
+#line 643
int canConvert; /* Both text or both numeric */
+#line 643
int allInExtRange; /* all values within external range? */
+#line 643
text value[MAX_NELS];
+#line 643
+#line 643
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 643
IF (err) {
+#line 643
error("nc_create: %s", nc_strerror(err));
+#line 643
return;
+#line 643
}
+#line 643
def_dims(ncid);
+#line 643
def_vars(ncid);
+#line 643
err = nc_enddef(ncid);
+#line 643
IF (err)
+#line 643
error("nc_enddef: %s", nc_strerror(err));
+#line 643
+#line 643
value[0] = 0;
+#line 643
for (i = 0; i < NVARS; i++) {
+#line 643
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 643
assert(var_rank[i] <= MAX_RANK);
+#line 643
assert(var_nels[i] <= MAX_NELS);
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
start[j] = 0;
+#line 643
edge[j] = 1;
+#line 643
}
+#line 643
err = nc_put_vara_text(BAD_ID, i, start, edge, value);
+#line 643
IF (err != NC_EBADID)
+#line 643
error("bad ncid: status = %d", err);
+#line 643
err = nc_put_vara_text(ncid, BAD_VARID, start, edge, value);
+#line 643
IF (err != NC_ENOTVAR)
+#line 643
error("bad var id: status = %d", err);
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 643
start[j] = var_shape[i][j];
+#line 643
err = nc_put_vara_text(ncid, i, start, edge, value);
+#line 643
IF (canConvert && err != NC_EINVALCOORDS)
+#line 643
error("bad start: status = %d", err);
+#line 643
start[j] = 0;
+#line 643
edge[j] = var_shape[i][j] + 1;
+#line 643
err = nc_put_vara_text(ncid, i, start, edge, value);
+#line 643
IF (canConvert && err != NC_EEDGE)
+#line 643
error("bad edge: status = %d", err);
+#line 643
edge[j] = 1;
+#line 643
}
+#line 643
}
+#line 643
/* Check correct error returned even when nothing to put */
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
edge[j] = 0;
+#line 643
}
+#line 643
err = nc_put_vara_text(BAD_ID, i, start, edge, value);
+#line 643
IF (err != NC_EBADID)
+#line 643
error("bad ncid: status = %d", err);
+#line 643
err = nc_put_vara_text(ncid, BAD_VARID, start, edge, value);
+#line 643
IF (err != NC_ENOTVAR)
+#line 643
error("bad var id: status = %d", err);
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 643
start[j] = var_shape[i][j];
+#line 643
err = nc_put_vara_text(ncid, i, start, edge, value);
+#line 643
IF (canConvert && err != NC_EINVALCOORDS)
+#line 643
error("bad start: status = %d", err);
+#line 643
start[j] = 0;
+#line 643
}
+#line 643
}
+#line 643
err = nc_put_vara_text(ncid, i, start, edge, value);
+#line 643
if (canConvert) {
+#line 643
IF (err)
+#line 643
error("%s", nc_strerror(err));
+#line 643
} else {
+#line 643
IF (err != NC_ECHAR)
+#line 643
error("wrong type: status = %d", err);
+#line 643
}
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
edge[j] = 1;
+#line 643
}
+#line 643
+#line 643
/* Choose a random point dividing each dim into 2 parts */
+#line 643
/* Put 2^rank (nslabs) slabs so defined */
+#line 643
nslabs = 1;
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
mid[j] = roll( var_shape[i][j] );
+#line 643
nslabs *= 2;
+#line 643
}
+#line 643
/* bits of k determine whether to put lower or upper part of dim */
+#line 643
for (k = 0; k < nslabs; k++) {
+#line 643
nels = 1;
+#line 643
for (j = 0; j < var_rank[i]; j++) {
+#line 643
if ((k >> j) & 1) {
+#line 643
start[j] = 0;
+#line 643
edge[j] = mid[j];
+#line 643
}else{
+#line 643
start[j] = mid[j];
+#line 643
edge[j] = var_shape[i][j] - mid[j];
+#line 643
}
+#line 643
nels *= edge[j];
+#line 643
}
+#line 643
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 643
err = toMixedBase(j, var_rank[i], edge, index);
+#line 643
IF (err)
+#line 643
error("error in toMixedBase 1");
+#line 643
for (d = 0; d < var_rank[i]; d++)
+#line 643
index[d] += start[d];
+#line 643
value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT);
+#line 643
allInExtRange = allInExtRange
+#line 643
&& inRange3(value[j], var_type[i], NCT_TEXT);
+#line 643
}
+#line 643
if (var_rank[i] == 0 && i%2 == 0)
+#line 643
err = nc_put_vara_text(ncid, i, NULL, NULL, value);
+#line 643
else
+#line 643
err = nc_put_vara_text(ncid, i, start, edge, value);
+#line 643
if (canConvert) {
+#line 643
if (allInExtRange) {
+#line 643
IF (err)
+#line 643
error("%s", nc_strerror(err));
+#line 643
} else {
+#line 643
IF (err != NC_ERANGE)
+#line 643
error("range error: status = %d", err);
+#line 643
}
+#line 643
} else {
+#line 643
IF (nels > 0 && err != NC_ECHAR)
+#line 643
error("wrong type: status = %d", err);
+#line 643
}
+#line 643
}
+#line 643
}
+#line 643
+#line 643
err = nc_close(ncid);
+#line 643
IF (err)
+#line 643
error("nc_close: %s", nc_strerror(err));
+#line 643
+#line 643
check_vars_text(scratch);
+#line 643
+#line 643
err = remove(scratch);
+#line 643
IF (err)
+#line 643
error("remove of %s failed", scratch);
+#line 643
}
+#line 643
void
+#line 644
test_nc_put_vara_uchar(void)
+#line 644
{
+#line 644
int ncid;
+#line 644
int d;
+#line 644
int i;
+#line 644
int j;
+#line 644
int k;
+#line 644
int err;
+#line 644
int nslabs;
+#line 644
int nels;
+#line 644
size_t start[MAX_RANK];
+#line 644
size_t edge[MAX_RANK];
+#line 644
size_t mid[MAX_RANK];
+#line 644
size_t index[MAX_RANK];
+#line 644
int canConvert; /* Both text or both numeric */
+#line 644
int allInExtRange; /* all values within external range? */
+#line 644
uchar value[MAX_NELS];
+#line 644
+#line 644
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 644
IF (err) {
+#line 644
error("nc_create: %s", nc_strerror(err));
+#line 644
return;
+#line 644
}
+#line 644
def_dims(ncid);
+#line 644
def_vars(ncid);
+#line 644
err = nc_enddef(ncid);
+#line 644
IF (err)
+#line 644
error("nc_enddef: %s", nc_strerror(err));
+#line 644
+#line 644
value[0] = 0;
+#line 644
for (i = 0; i < NVARS; i++) {
+#line 644
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 644
assert(var_rank[i] <= MAX_RANK);
+#line 644
assert(var_nels[i] <= MAX_NELS);
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
start[j] = 0;
+#line 644
edge[j] = 1;
+#line 644
}
+#line 644
err = nc_put_vara_uchar(BAD_ID, i, start, edge, value);
+#line 644
IF (err != NC_EBADID)
+#line 644
error("bad ncid: status = %d", err);
+#line 644
err = nc_put_vara_uchar(ncid, BAD_VARID, start, edge, value);
+#line 644
IF (err != NC_ENOTVAR)
+#line 644
error("bad var id: status = %d", err);
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 644
start[j] = var_shape[i][j];
+#line 644
err = nc_put_vara_uchar(ncid, i, start, edge, value);
+#line 644
IF (canConvert && err != NC_EINVALCOORDS)
+#line 644
error("bad start: status = %d", err);
+#line 644
start[j] = 0;
+#line 644
edge[j] = var_shape[i][j] + 1;
+#line 644
err = nc_put_vara_uchar(ncid, i, start, edge, value);
+#line 644
IF (canConvert && err != NC_EEDGE)
+#line 644
error("bad edge: status = %d", err);
+#line 644
edge[j] = 1;
+#line 644
}
+#line 644
}
+#line 644
/* Check correct error returned even when nothing to put */
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
edge[j] = 0;
+#line 644
}
+#line 644
err = nc_put_vara_uchar(BAD_ID, i, start, edge, value);
+#line 644
IF (err != NC_EBADID)
+#line 644
error("bad ncid: status = %d", err);
+#line 644
err = nc_put_vara_uchar(ncid, BAD_VARID, start, edge, value);
+#line 644
IF (err != NC_ENOTVAR)
+#line 644
error("bad var id: status = %d", err);
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 644
start[j] = var_shape[i][j];
+#line 644
err = nc_put_vara_uchar(ncid, i, start, edge, value);
+#line 644
IF (canConvert && err != NC_EINVALCOORDS)
+#line 644
error("bad start: status = %d", err);
+#line 644
start[j] = 0;
+#line 644
}
+#line 644
}
+#line 644
err = nc_put_vara_uchar(ncid, i, start, edge, value);
+#line 644
if (canConvert) {
+#line 644
IF (err)
+#line 644
error("%s", nc_strerror(err));
+#line 644
} else {
+#line 644
IF (err != NC_ECHAR)
+#line 644
error("wrong type: status = %d", err);
+#line 644
}
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
edge[j] = 1;
+#line 644
}
+#line 644
+#line 644
/* Choose a random point dividing each dim into 2 parts */
+#line 644
/* Put 2^rank (nslabs) slabs so defined */
+#line 644
nslabs = 1;
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
mid[j] = roll( var_shape[i][j] );
+#line 644
nslabs *= 2;
+#line 644
}
+#line 644
/* bits of k determine whether to put lower or upper part of dim */
+#line 644
for (k = 0; k < nslabs; k++) {
+#line 644
nels = 1;
+#line 644
for (j = 0; j < var_rank[i]; j++) {
+#line 644
if ((k >> j) & 1) {
+#line 644
start[j] = 0;
+#line 644
edge[j] = mid[j];
+#line 644
}else{
+#line 644
start[j] = mid[j];
+#line 644
edge[j] = var_shape[i][j] - mid[j];
+#line 644
}
+#line 644
nels *= edge[j];
+#line 644
}
+#line 644
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 644
err = toMixedBase(j, var_rank[i], edge, index);
+#line 644
IF (err)
+#line 644
error("error in toMixedBase 1");
+#line 644
for (d = 0; d < var_rank[i]; d++)
+#line 644
index[d] += start[d];
+#line 644
value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR);
+#line 644
allInExtRange = allInExtRange
+#line 644
&& inRange3(value[j], var_type[i], NCT_UCHAR);
+#line 644
}
+#line 644
if (var_rank[i] == 0 && i%2 == 0)
+#line 644
err = nc_put_vara_uchar(ncid, i, NULL, NULL, value);
+#line 644
else
+#line 644
err = nc_put_vara_uchar(ncid, i, start, edge, value);
+#line 644
if (canConvert) {
+#line 644
if (allInExtRange) {
+#line 644
IF (err)
+#line 644
error("%s", nc_strerror(err));
+#line 644
} else {
+#line 644
IF (err != NC_ERANGE)
+#line 644
error("range error: status = %d", err);
+#line 644
}
+#line 644
} else {
+#line 644
IF (nels > 0 && err != NC_ECHAR)
+#line 644
error("wrong type: status = %d", err);
+#line 644
}
+#line 644
}
+#line 644
}
+#line 644
+#line 644
err = nc_close(ncid);
+#line 644
IF (err)
+#line 644
error("nc_close: %s", nc_strerror(err));
+#line 644
+#line 644
check_vars_uchar(scratch);
+#line 644
+#line 644
err = remove(scratch);
+#line 644
IF (err)
+#line 644
error("remove of %s failed", scratch);
+#line 644
}
+#line 644
void
+#line 645
test_nc_put_vara_schar(void)
+#line 645
{
+#line 645
int ncid;
+#line 645
int d;
+#line 645
int i;
+#line 645
int j;
+#line 645
int k;
+#line 645
int err;
+#line 645
int nslabs;
+#line 645
int nels;
+#line 645
size_t start[MAX_RANK];
+#line 645
size_t edge[MAX_RANK];
+#line 645
size_t mid[MAX_RANK];
+#line 645
size_t index[MAX_RANK];
+#line 645
int canConvert; /* Both text or both numeric */
+#line 645
int allInExtRange; /* all values within external range? */
+#line 645
schar value[MAX_NELS];
+#line 645
+#line 645
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 645
IF (err) {
+#line 645
error("nc_create: %s", nc_strerror(err));
+#line 645
return;
+#line 645
}
+#line 645
def_dims(ncid);
+#line 645
def_vars(ncid);
+#line 645
err = nc_enddef(ncid);
+#line 645
IF (err)
+#line 645
error("nc_enddef: %s", nc_strerror(err));
+#line 645
+#line 645
value[0] = 0;
+#line 645
for (i = 0; i < NVARS; i++) {
+#line 645
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 645
assert(var_rank[i] <= MAX_RANK);
+#line 645
assert(var_nels[i] <= MAX_NELS);
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
start[j] = 0;
+#line 645
edge[j] = 1;
+#line 645
}
+#line 645
err = nc_put_vara_schar(BAD_ID, i, start, edge, value);
+#line 645
IF (err != NC_EBADID)
+#line 645
error("bad ncid: status = %d", err);
+#line 645
err = nc_put_vara_schar(ncid, BAD_VARID, start, edge, value);
+#line 645
IF (err != NC_ENOTVAR)
+#line 645
error("bad var id: status = %d", err);
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 645
start[j] = var_shape[i][j];
+#line 645
err = nc_put_vara_schar(ncid, i, start, edge, value);
+#line 645
IF (canConvert && err != NC_EINVALCOORDS)
+#line 645
error("bad start: status = %d", err);
+#line 645
start[j] = 0;
+#line 645
edge[j] = var_shape[i][j] + 1;
+#line 645
err = nc_put_vara_schar(ncid, i, start, edge, value);
+#line 645
IF (canConvert && err != NC_EEDGE)
+#line 645
error("bad edge: status = %d", err);
+#line 645
edge[j] = 1;
+#line 645
}
+#line 645
}
+#line 645
/* Check correct error returned even when nothing to put */
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
edge[j] = 0;
+#line 645
}
+#line 645
err = nc_put_vara_schar(BAD_ID, i, start, edge, value);
+#line 645
IF (err != NC_EBADID)
+#line 645
error("bad ncid: status = %d", err);
+#line 645
err = nc_put_vara_schar(ncid, BAD_VARID, start, edge, value);
+#line 645
IF (err != NC_ENOTVAR)
+#line 645
error("bad var id: status = %d", err);
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 645
start[j] = var_shape[i][j];
+#line 645
err = nc_put_vara_schar(ncid, i, start, edge, value);
+#line 645
IF (canConvert && err != NC_EINVALCOORDS)
+#line 645
error("bad start: status = %d", err);
+#line 645
start[j] = 0;
+#line 645
}
+#line 645
}
+#line 645
err = nc_put_vara_schar(ncid, i, start, edge, value);
+#line 645
if (canConvert) {
+#line 645
IF (err)
+#line 645
error("%s", nc_strerror(err));
+#line 645
} else {
+#line 645
IF (err != NC_ECHAR)
+#line 645
error("wrong type: status = %d", err);
+#line 645
}
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
edge[j] = 1;
+#line 645
}
+#line 645
+#line 645
/* Choose a random point dividing each dim into 2 parts */
+#line 645
/* Put 2^rank (nslabs) slabs so defined */
+#line 645
nslabs = 1;
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
mid[j] = roll( var_shape[i][j] );
+#line 645
nslabs *= 2;
+#line 645
}
+#line 645
/* bits of k determine whether to put lower or upper part of dim */
+#line 645
for (k = 0; k < nslabs; k++) {
+#line 645
nels = 1;
+#line 645
for (j = 0; j < var_rank[i]; j++) {
+#line 645
if ((k >> j) & 1) {
+#line 645
start[j] = 0;
+#line 645
edge[j] = mid[j];
+#line 645
}else{
+#line 645
start[j] = mid[j];
+#line 645
edge[j] = var_shape[i][j] - mid[j];
+#line 645
}
+#line 645
nels *= edge[j];
+#line 645
}
+#line 645
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 645
err = toMixedBase(j, var_rank[i], edge, index);
+#line 645
IF (err)
+#line 645
error("error in toMixedBase 1");
+#line 645
for (d = 0; d < var_rank[i]; d++)
+#line 645
index[d] += start[d];
+#line 645
value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR);
+#line 645
allInExtRange = allInExtRange
+#line 645
&& inRange3(value[j], var_type[i], NCT_SCHAR);
+#line 645
}
+#line 645
if (var_rank[i] == 0 && i%2 == 0)
+#line 645
err = nc_put_vara_schar(ncid, i, NULL, NULL, value);
+#line 645
else
+#line 645
err = nc_put_vara_schar(ncid, i, start, edge, value);
+#line 645
if (canConvert) {
+#line 645
if (allInExtRange) {
+#line 645
IF (err)
+#line 645
error("%s", nc_strerror(err));
+#line 645
} else {
+#line 645
IF (err != NC_ERANGE)
+#line 645
error("range error: status = %d", err);
+#line 645
}
+#line 645
} else {
+#line 645
IF (nels > 0 && err != NC_ECHAR)
+#line 645
error("wrong type: status = %d", err);
+#line 645
}
+#line 645
}
+#line 645
}
+#line 645
+#line 645
err = nc_close(ncid);
+#line 645
IF (err)
+#line 645
error("nc_close: %s", nc_strerror(err));
+#line 645
+#line 645
check_vars_schar(scratch);
+#line 645
+#line 645
err = remove(scratch);
+#line 645
IF (err)
+#line 645
error("remove of %s failed", scratch);
+#line 645
}
+#line 645
void
+#line 646
test_nc_put_vara_short(void)
+#line 646
{
+#line 646
int ncid;
+#line 646
int d;
+#line 646
int i;
+#line 646
int j;
+#line 646
int k;
+#line 646
int err;
+#line 646
int nslabs;
+#line 646
int nels;
+#line 646
size_t start[MAX_RANK];
+#line 646
size_t edge[MAX_RANK];
+#line 646
size_t mid[MAX_RANK];
+#line 646
size_t index[MAX_RANK];
+#line 646
int canConvert; /* Both text or both numeric */
+#line 646
int allInExtRange; /* all values within external range? */
+#line 646
short value[MAX_NELS];
+#line 646
+#line 646
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 646
IF (err) {
+#line 646
error("nc_create: %s", nc_strerror(err));
+#line 646
return;
+#line 646
}
+#line 646
def_dims(ncid);
+#line 646
def_vars(ncid);
+#line 646
err = nc_enddef(ncid);
+#line 646
IF (err)
+#line 646
error("nc_enddef: %s", nc_strerror(err));
+#line 646
+#line 646
value[0] = 0;
+#line 646
for (i = 0; i < NVARS; i++) {
+#line 646
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 646
assert(var_rank[i] <= MAX_RANK);
+#line 646
assert(var_nels[i] <= MAX_NELS);
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
start[j] = 0;
+#line 646
edge[j] = 1;
+#line 646
}
+#line 646
err = nc_put_vara_short(BAD_ID, i, start, edge, value);
+#line 646
IF (err != NC_EBADID)
+#line 646
error("bad ncid: status = %d", err);
+#line 646
err = nc_put_vara_short(ncid, BAD_VARID, start, edge, value);
+#line 646
IF (err != NC_ENOTVAR)
+#line 646
error("bad var id: status = %d", err);
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 646
start[j] = var_shape[i][j];
+#line 646
err = nc_put_vara_short(ncid, i, start, edge, value);
+#line 646
IF (canConvert && err != NC_EINVALCOORDS)
+#line 646
error("bad start: status = %d", err);
+#line 646
start[j] = 0;
+#line 646
edge[j] = var_shape[i][j] + 1;
+#line 646
err = nc_put_vara_short(ncid, i, start, edge, value);
+#line 646
IF (canConvert && err != NC_EEDGE)
+#line 646
error("bad edge: status = %d", err);
+#line 646
edge[j] = 1;
+#line 646
}
+#line 646
}
+#line 646
/* Check correct error returned even when nothing to put */
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
edge[j] = 0;
+#line 646
}
+#line 646
err = nc_put_vara_short(BAD_ID, i, start, edge, value);
+#line 646
IF (err != NC_EBADID)
+#line 646
error("bad ncid: status = %d", err);
+#line 646
err = nc_put_vara_short(ncid, BAD_VARID, start, edge, value);
+#line 646
IF (err != NC_ENOTVAR)
+#line 646
error("bad var id: status = %d", err);
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 646
start[j] = var_shape[i][j];
+#line 646
err = nc_put_vara_short(ncid, i, start, edge, value);
+#line 646
IF (canConvert && err != NC_EINVALCOORDS)
+#line 646
error("bad start: status = %d", err);
+#line 646
start[j] = 0;
+#line 646
}
+#line 646
}
+#line 646
err = nc_put_vara_short(ncid, i, start, edge, value);
+#line 646
if (canConvert) {
+#line 646
IF (err)
+#line 646
error("%s", nc_strerror(err));
+#line 646
} else {
+#line 646
IF (err != NC_ECHAR)
+#line 646
error("wrong type: status = %d", err);
+#line 646
}
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
edge[j] = 1;
+#line 646
}
+#line 646
+#line 646
/* Choose a random point dividing each dim into 2 parts */
+#line 646
/* Put 2^rank (nslabs) slabs so defined */
+#line 646
nslabs = 1;
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
mid[j] = roll( var_shape[i][j] );
+#line 646
nslabs *= 2;
+#line 646
}
+#line 646
/* bits of k determine whether to put lower or upper part of dim */
+#line 646
for (k = 0; k < nslabs; k++) {
+#line 646
nels = 1;
+#line 646
for (j = 0; j < var_rank[i]; j++) {
+#line 646
if ((k >> j) & 1) {
+#line 646
start[j] = 0;
+#line 646
edge[j] = mid[j];
+#line 646
}else{
+#line 646
start[j] = mid[j];
+#line 646
edge[j] = var_shape[i][j] - mid[j];
+#line 646
}
+#line 646
nels *= edge[j];
+#line 646
}
+#line 646
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 646
err = toMixedBase(j, var_rank[i], edge, index);
+#line 646
IF (err)
+#line 646
error("error in toMixedBase 1");
+#line 646
for (d = 0; d < var_rank[i]; d++)
+#line 646
index[d] += start[d];
+#line 646
value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT);
+#line 646
allInExtRange = allInExtRange
+#line 646
&& inRange3(value[j], var_type[i], NCT_SHORT);
+#line 646
}
+#line 646
if (var_rank[i] == 0 && i%2 == 0)
+#line 646
err = nc_put_vara_short(ncid, i, NULL, NULL, value);
+#line 646
else
+#line 646
err = nc_put_vara_short(ncid, i, start, edge, value);
+#line 646
if (canConvert) {
+#line 646
if (allInExtRange) {
+#line 646
IF (err)
+#line 646
error("%s", nc_strerror(err));
+#line 646
} else {
+#line 646
IF (err != NC_ERANGE)
+#line 646
error("range error: status = %d", err);
+#line 646
}
+#line 646
} else {
+#line 646
IF (nels > 0 && err != NC_ECHAR)
+#line 646
error("wrong type: status = %d", err);
+#line 646
}
+#line 646
}
+#line 646
}
+#line 646
+#line 646
err = nc_close(ncid);
+#line 646
IF (err)
+#line 646
error("nc_close: %s", nc_strerror(err));
+#line 646
+#line 646
check_vars_short(scratch);
+#line 646
+#line 646
err = remove(scratch);
+#line 646
IF (err)
+#line 646
error("remove of %s failed", scratch);
+#line 646
}
+#line 646
void
+#line 647
test_nc_put_vara_int(void)
+#line 647
{
+#line 647
int ncid;
+#line 647
int d;
+#line 647
int i;
+#line 647
int j;
+#line 647
int k;
+#line 647
int err;
+#line 647
int nslabs;
+#line 647
int nels;
+#line 647
size_t start[MAX_RANK];
+#line 647
size_t edge[MAX_RANK];
+#line 647
size_t mid[MAX_RANK];
+#line 647
size_t index[MAX_RANK];
+#line 647
int canConvert; /* Both text or both numeric */
+#line 647
int allInExtRange; /* all values within external range? */
+#line 647
int value[MAX_NELS];
+#line 647
+#line 647
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 647
IF (err) {
+#line 647
error("nc_create: %s", nc_strerror(err));
+#line 647
return;
+#line 647
}
+#line 647
def_dims(ncid);
+#line 647
def_vars(ncid);
+#line 647
err = nc_enddef(ncid);
+#line 647
IF (err)
+#line 647
error("nc_enddef: %s", nc_strerror(err));
+#line 647
+#line 647
value[0] = 0;
+#line 647
for (i = 0; i < NVARS; i++) {
+#line 647
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 647
assert(var_rank[i] <= MAX_RANK);
+#line 647
assert(var_nels[i] <= MAX_NELS);
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
start[j] = 0;
+#line 647
edge[j] = 1;
+#line 647
}
+#line 647
err = nc_put_vara_int(BAD_ID, i, start, edge, value);
+#line 647
IF (err != NC_EBADID)
+#line 647
error("bad ncid: status = %d", err);
+#line 647
err = nc_put_vara_int(ncid, BAD_VARID, start, edge, value);
+#line 647
IF (err != NC_ENOTVAR)
+#line 647
error("bad var id: status = %d", err);
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 647
start[j] = var_shape[i][j];
+#line 647
err = nc_put_vara_int(ncid, i, start, edge, value);
+#line 647
IF (canConvert && err != NC_EINVALCOORDS)
+#line 647
error("bad start: status = %d", err);
+#line 647
start[j] = 0;
+#line 647
edge[j] = var_shape[i][j] + 1;
+#line 647
err = nc_put_vara_int(ncid, i, start, edge, value);
+#line 647
IF (canConvert && err != NC_EEDGE)
+#line 647
error("bad edge: status = %d", err);
+#line 647
edge[j] = 1;
+#line 647
}
+#line 647
}
+#line 647
/* Check correct error returned even when nothing to put */
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
edge[j] = 0;
+#line 647
}
+#line 647
err = nc_put_vara_int(BAD_ID, i, start, edge, value);
+#line 647
IF (err != NC_EBADID)
+#line 647
error("bad ncid: status = %d", err);
+#line 647
err = nc_put_vara_int(ncid, BAD_VARID, start, edge, value);
+#line 647
IF (err != NC_ENOTVAR)
+#line 647
error("bad var id: status = %d", err);
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 647
start[j] = var_shape[i][j];
+#line 647
err = nc_put_vara_int(ncid, i, start, edge, value);
+#line 647
IF (canConvert && err != NC_EINVALCOORDS)
+#line 647
error("bad start: status = %d", err);
+#line 647
start[j] = 0;
+#line 647
}
+#line 647
}
+#line 647
err = nc_put_vara_int(ncid, i, start, edge, value);
+#line 647
if (canConvert) {
+#line 647
IF (err)
+#line 647
error("%s", nc_strerror(err));
+#line 647
} else {
+#line 647
IF (err != NC_ECHAR)
+#line 647
error("wrong type: status = %d", err);
+#line 647
}
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
edge[j] = 1;
+#line 647
}
+#line 647
+#line 647
/* Choose a random point dividing each dim into 2 parts */
+#line 647
/* Put 2^rank (nslabs) slabs so defined */
+#line 647
nslabs = 1;
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
mid[j] = roll( var_shape[i][j] );
+#line 647
nslabs *= 2;
+#line 647
}
+#line 647
/* bits of k determine whether to put lower or upper part of dim */
+#line 647
for (k = 0; k < nslabs; k++) {
+#line 647
nels = 1;
+#line 647
for (j = 0; j < var_rank[i]; j++) {
+#line 647
if ((k >> j) & 1) {
+#line 647
start[j] = 0;
+#line 647
edge[j] = mid[j];
+#line 647
}else{
+#line 647
start[j] = mid[j];
+#line 647
edge[j] = var_shape[i][j] - mid[j];
+#line 647
}
+#line 647
nels *= edge[j];
+#line 647
}
+#line 647
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 647
err = toMixedBase(j, var_rank[i], edge, index);
+#line 647
IF (err)
+#line 647
error("error in toMixedBase 1");
+#line 647
for (d = 0; d < var_rank[i]; d++)
+#line 647
index[d] += start[d];
+#line 647
value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT);
+#line 647
allInExtRange = allInExtRange
+#line 647
&& inRange3(value[j], var_type[i], NCT_INT);
+#line 647
}
+#line 647
if (var_rank[i] == 0 && i%2 == 0)
+#line 647
err = nc_put_vara_int(ncid, i, NULL, NULL, value);
+#line 647
else
+#line 647
err = nc_put_vara_int(ncid, i, start, edge, value);
+#line 647
if (canConvert) {
+#line 647
if (allInExtRange) {
+#line 647
IF (err)
+#line 647
error("%s", nc_strerror(err));
+#line 647
} else {
+#line 647
IF (err != NC_ERANGE)
+#line 647
error("range error: status = %d", err);
+#line 647
}
+#line 647
} else {
+#line 647
IF (nels > 0 && err != NC_ECHAR)
+#line 647
error("wrong type: status = %d", err);
+#line 647
}
+#line 647
}
+#line 647
}
+#line 647
+#line 647
err = nc_close(ncid);
+#line 647
IF (err)
+#line 647
error("nc_close: %s", nc_strerror(err));
+#line 647
+#line 647
check_vars_int(scratch);
+#line 647
+#line 647
err = remove(scratch);
+#line 647
IF (err)
+#line 647
error("remove of %s failed", scratch);
+#line 647
}
+#line 647
void
+#line 648
test_nc_put_vara_long(void)
+#line 648
{
+#line 648
int ncid;
+#line 648
int d;
+#line 648
int i;
+#line 648
int j;
+#line 648
int k;
+#line 648
int err;
+#line 648
int nslabs;
+#line 648
int nels;
+#line 648
size_t start[MAX_RANK];
+#line 648
size_t edge[MAX_RANK];
+#line 648
size_t mid[MAX_RANK];
+#line 648
size_t index[MAX_RANK];
+#line 648
int canConvert; /* Both text or both numeric */
+#line 648
int allInExtRange; /* all values within external range? */
+#line 648
long value[MAX_NELS];
+#line 648
+#line 648
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 648
IF (err) {
+#line 648
error("nc_create: %s", nc_strerror(err));
+#line 648
return;
+#line 648
}
+#line 648
def_dims(ncid);
+#line 648
def_vars(ncid);
+#line 648
err = nc_enddef(ncid);
+#line 648
IF (err)
+#line 648
error("nc_enddef: %s", nc_strerror(err));
+#line 648
+#line 648
value[0] = 0;
+#line 648
for (i = 0; i < NVARS; i++) {
+#line 648
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 648
assert(var_rank[i] <= MAX_RANK);
+#line 648
assert(var_nels[i] <= MAX_NELS);
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
start[j] = 0;
+#line 648
edge[j] = 1;
+#line 648
}
+#line 648
err = nc_put_vara_long(BAD_ID, i, start, edge, value);
+#line 648
IF (err != NC_EBADID)
+#line 648
error("bad ncid: status = %d", err);
+#line 648
err = nc_put_vara_long(ncid, BAD_VARID, start, edge, value);
+#line 648
IF (err != NC_ENOTVAR)
+#line 648
error("bad var id: status = %d", err);
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 648
start[j] = var_shape[i][j];
+#line 648
err = nc_put_vara_long(ncid, i, start, edge, value);
+#line 648
IF (canConvert && err != NC_EINVALCOORDS)
+#line 648
error("bad start: status = %d", err);
+#line 648
start[j] = 0;
+#line 648
edge[j] = var_shape[i][j] + 1;
+#line 648
err = nc_put_vara_long(ncid, i, start, edge, value);
+#line 648
IF (canConvert && err != NC_EEDGE)
+#line 648
error("bad edge: status = %d", err);
+#line 648
edge[j] = 1;
+#line 648
}
+#line 648
}
+#line 648
/* Check correct error returned even when nothing to put */
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
edge[j] = 0;
+#line 648
}
+#line 648
err = nc_put_vara_long(BAD_ID, i, start, edge, value);
+#line 648
IF (err != NC_EBADID)
+#line 648
error("bad ncid: status = %d", err);
+#line 648
err = nc_put_vara_long(ncid, BAD_VARID, start, edge, value);
+#line 648
IF (err != NC_ENOTVAR)
+#line 648
error("bad var id: status = %d", err);
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 648
start[j] = var_shape[i][j];
+#line 648
err = nc_put_vara_long(ncid, i, start, edge, value);
+#line 648
IF (canConvert && err != NC_EINVALCOORDS)
+#line 648
error("bad start: status = %d", err);
+#line 648
start[j] = 0;
+#line 648
}
+#line 648
}
+#line 648
err = nc_put_vara_long(ncid, i, start, edge, value);
+#line 648
if (canConvert) {
+#line 648
IF (err)
+#line 648
error("%s", nc_strerror(err));
+#line 648
} else {
+#line 648
IF (err != NC_ECHAR)
+#line 648
error("wrong type: status = %d", err);
+#line 648
}
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
edge[j] = 1;
+#line 648
}
+#line 648
+#line 648
/* Choose a random point dividing each dim into 2 parts */
+#line 648
/* Put 2^rank (nslabs) slabs so defined */
+#line 648
nslabs = 1;
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
mid[j] = roll( var_shape[i][j] );
+#line 648
nslabs *= 2;
+#line 648
}
+#line 648
/* bits of k determine whether to put lower or upper part of dim */
+#line 648
for (k = 0; k < nslabs; k++) {
+#line 648
nels = 1;
+#line 648
for (j = 0; j < var_rank[i]; j++) {
+#line 648
if ((k >> j) & 1) {
+#line 648
start[j] = 0;
+#line 648
edge[j] = mid[j];
+#line 648
}else{
+#line 648
start[j] = mid[j];
+#line 648
edge[j] = var_shape[i][j] - mid[j];
+#line 648
}
+#line 648
nels *= edge[j];
+#line 648
}
+#line 648
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 648
err = toMixedBase(j, var_rank[i], edge, index);
+#line 648
IF (err)
+#line 648
error("error in toMixedBase 1");
+#line 648
for (d = 0; d < var_rank[i]; d++)
+#line 648
index[d] += start[d];
+#line 648
value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG);
+#line 648
allInExtRange = allInExtRange
+#line 648
&& inRange3(value[j], var_type[i], NCT_LONG);
+#line 648
}
+#line 648
if (var_rank[i] == 0 && i%2 == 0)
+#line 648
err = nc_put_vara_long(ncid, i, NULL, NULL, value);
+#line 648
else
+#line 648
err = nc_put_vara_long(ncid, i, start, edge, value);
+#line 648
if (canConvert) {
+#line 648
if (allInExtRange) {
+#line 648
IF (err)
+#line 648
error("%s", nc_strerror(err));
+#line 648
} else {
+#line 648
IF (err != NC_ERANGE)
+#line 648
error("range error: status = %d", err);
+#line 648
}
+#line 648
} else {
+#line 648
IF (nels > 0 && err != NC_ECHAR)
+#line 648
error("wrong type: status = %d", err);
+#line 648
}
+#line 648
}
+#line 648
}
+#line 648
+#line 648
err = nc_close(ncid);
+#line 648
IF (err)
+#line 648
error("nc_close: %s", nc_strerror(err));
+#line 648
+#line 648
check_vars_long(scratch);
+#line 648
+#line 648
err = remove(scratch);
+#line 648
IF (err)
+#line 648
error("remove of %s failed", scratch);
+#line 648
}
+#line 648
void
+#line 649
test_nc_put_vara_float(void)
+#line 649
{
+#line 649
int ncid;
+#line 649
int d;
+#line 649
int i;
+#line 649
int j;
+#line 649
int k;
+#line 649
int err;
+#line 649
int nslabs;
+#line 649
int nels;
+#line 649
size_t start[MAX_RANK];
+#line 649
size_t edge[MAX_RANK];
+#line 649
size_t mid[MAX_RANK];
+#line 649
size_t index[MAX_RANK];
+#line 649
int canConvert; /* Both text or both numeric */
+#line 649
int allInExtRange; /* all values within external range? */
+#line 649
float value[MAX_NELS];
+#line 649
+#line 649
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 649
IF (err) {
+#line 649
error("nc_create: %s", nc_strerror(err));
+#line 649
return;
+#line 649
}
+#line 649
def_dims(ncid);
+#line 649
def_vars(ncid);
+#line 649
err = nc_enddef(ncid);
+#line 649
IF (err)
+#line 649
error("nc_enddef: %s", nc_strerror(err));
+#line 649
+#line 649
value[0] = 0;
+#line 649
for (i = 0; i < NVARS; i++) {
+#line 649
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 649
assert(var_rank[i] <= MAX_RANK);
+#line 649
assert(var_nels[i] <= MAX_NELS);
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
start[j] = 0;
+#line 649
edge[j] = 1;
+#line 649
}
+#line 649
err = nc_put_vara_float(BAD_ID, i, start, edge, value);
+#line 649
IF (err != NC_EBADID)
+#line 649
error("bad ncid: status = %d", err);
+#line 649
err = nc_put_vara_float(ncid, BAD_VARID, start, edge, value);
+#line 649
IF (err != NC_ENOTVAR)
+#line 649
error("bad var id: status = %d", err);
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 649
start[j] = var_shape[i][j];
+#line 649
err = nc_put_vara_float(ncid, i, start, edge, value);
+#line 649
IF (canConvert && err != NC_EINVALCOORDS)
+#line 649
error("bad start: status = %d", err);
+#line 649
start[j] = 0;
+#line 649
edge[j] = var_shape[i][j] + 1;
+#line 649
err = nc_put_vara_float(ncid, i, start, edge, value);
+#line 649
IF (canConvert && err != NC_EEDGE)
+#line 649
error("bad edge: status = %d", err);
+#line 649
edge[j] = 1;
+#line 649
}
+#line 649
}
+#line 649
/* Check correct error returned even when nothing to put */
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
edge[j] = 0;
+#line 649
}
+#line 649
err = nc_put_vara_float(BAD_ID, i, start, edge, value);
+#line 649
IF (err != NC_EBADID)
+#line 649
error("bad ncid: status = %d", err);
+#line 649
err = nc_put_vara_float(ncid, BAD_VARID, start, edge, value);
+#line 649
IF (err != NC_ENOTVAR)
+#line 649
error("bad var id: status = %d", err);
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 649
start[j] = var_shape[i][j];
+#line 649
err = nc_put_vara_float(ncid, i, start, edge, value);
+#line 649
IF (canConvert && err != NC_EINVALCOORDS)
+#line 649
error("bad start: status = %d", err);
+#line 649
start[j] = 0;
+#line 649
}
+#line 649
}
+#line 649
err = nc_put_vara_float(ncid, i, start, edge, value);
+#line 649
if (canConvert) {
+#line 649
IF (err)
+#line 649
error("%s", nc_strerror(err));
+#line 649
} else {
+#line 649
IF (err != NC_ECHAR)
+#line 649
error("wrong type: status = %d", err);
+#line 649
}
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
edge[j] = 1;
+#line 649
}
+#line 649
+#line 649
/* Choose a random point dividing each dim into 2 parts */
+#line 649
/* Put 2^rank (nslabs) slabs so defined */
+#line 649
nslabs = 1;
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
mid[j] = roll( var_shape[i][j] );
+#line 649
nslabs *= 2;
+#line 649
}
+#line 649
/* bits of k determine whether to put lower or upper part of dim */
+#line 649
for (k = 0; k < nslabs; k++) {
+#line 649
nels = 1;
+#line 649
for (j = 0; j < var_rank[i]; j++) {
+#line 649
if ((k >> j) & 1) {
+#line 649
start[j] = 0;
+#line 649
edge[j] = mid[j];
+#line 649
}else{
+#line 649
start[j] = mid[j];
+#line 649
edge[j] = var_shape[i][j] - mid[j];
+#line 649
}
+#line 649
nels *= edge[j];
+#line 649
}
+#line 649
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 649
err = toMixedBase(j, var_rank[i], edge, index);
+#line 649
IF (err)
+#line 649
error("error in toMixedBase 1");
+#line 649
for (d = 0; d < var_rank[i]; d++)
+#line 649
index[d] += start[d];
+#line 649
value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT);
+#line 649
allInExtRange = allInExtRange
+#line 649
&& inRange3(value[j], var_type[i], NCT_FLOAT);
+#line 649
}
+#line 649
if (var_rank[i] == 0 && i%2 == 0)
+#line 649
err = nc_put_vara_float(ncid, i, NULL, NULL, value);
+#line 649
else
+#line 649
err = nc_put_vara_float(ncid, i, start, edge, value);
+#line 649
if (canConvert) {
+#line 649
if (allInExtRange) {
+#line 649
IF (err)
+#line 649
error("%s", nc_strerror(err));
+#line 649
} else {
+#line 649
IF (err != NC_ERANGE)
+#line 649
error("range error: status = %d", err);
+#line 649
}
+#line 649
} else {
+#line 649
IF (nels > 0 && err != NC_ECHAR)
+#line 649
error("wrong type: status = %d", err);
+#line 649
}
+#line 649
}
+#line 649
}
+#line 649
+#line 649
err = nc_close(ncid);
+#line 649
IF (err)
+#line 649
error("nc_close: %s", nc_strerror(err));
+#line 649
+#line 649
check_vars_float(scratch);
+#line 649
+#line 649
err = remove(scratch);
+#line 649
IF (err)
+#line 649
error("remove of %s failed", scratch);
+#line 649
}
+#line 649
void
+#line 650
test_nc_put_vara_double(void)
+#line 650
{
+#line 650
int ncid;
+#line 650
int d;
+#line 650
int i;
+#line 650
int j;
+#line 650
int k;
+#line 650
int err;
+#line 650
int nslabs;
+#line 650
int nels;
+#line 650
size_t start[MAX_RANK];
+#line 650
size_t edge[MAX_RANK];
+#line 650
size_t mid[MAX_RANK];
+#line 650
size_t index[MAX_RANK];
+#line 650
int canConvert; /* Both text or both numeric */
+#line 650
int allInExtRange; /* all values within external range? */
+#line 650
double value[MAX_NELS];
+#line 650
+#line 650
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 650
IF (err) {
+#line 650
error("nc_create: %s", nc_strerror(err));
+#line 650
return;
+#line 650
}
+#line 650
def_dims(ncid);
+#line 650
def_vars(ncid);
+#line 650
err = nc_enddef(ncid);
+#line 650
IF (err)
+#line 650
error("nc_enddef: %s", nc_strerror(err));
+#line 650
+#line 650
value[0] = 0;
+#line 650
for (i = 0; i < NVARS; i++) {
+#line 650
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 650
assert(var_rank[i] <= MAX_RANK);
+#line 650
assert(var_nels[i] <= MAX_NELS);
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
start[j] = 0;
+#line 650
edge[j] = 1;
+#line 650
}
+#line 650
err = nc_put_vara_double(BAD_ID, i, start, edge, value);
+#line 650
IF (err != NC_EBADID)
+#line 650
error("bad ncid: status = %d", err);
+#line 650
err = nc_put_vara_double(ncid, BAD_VARID, start, edge, value);
+#line 650
IF (err != NC_ENOTVAR)
+#line 650
error("bad var id: status = %d", err);
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 650
start[j] = var_shape[i][j];
+#line 650
err = nc_put_vara_double(ncid, i, start, edge, value);
+#line 650
IF (canConvert && err != NC_EINVALCOORDS)
+#line 650
error("bad start: status = %d", err);
+#line 650
start[j] = 0;
+#line 650
edge[j] = var_shape[i][j] + 1;
+#line 650
err = nc_put_vara_double(ncid, i, start, edge, value);
+#line 650
IF (canConvert && err != NC_EEDGE)
+#line 650
error("bad edge: status = %d", err);
+#line 650
edge[j] = 1;
+#line 650
}
+#line 650
}
+#line 650
/* Check correct error returned even when nothing to put */
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
edge[j] = 0;
+#line 650
}
+#line 650
err = nc_put_vara_double(BAD_ID, i, start, edge, value);
+#line 650
IF (err != NC_EBADID)
+#line 650
error("bad ncid: status = %d", err);
+#line 650
err = nc_put_vara_double(ncid, BAD_VARID, start, edge, value);
+#line 650
IF (err != NC_ENOTVAR)
+#line 650
error("bad var id: status = %d", err);
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 650
start[j] = var_shape[i][j];
+#line 650
err = nc_put_vara_double(ncid, i, start, edge, value);
+#line 650
IF (canConvert && err != NC_EINVALCOORDS)
+#line 650
error("bad start: status = %d", err);
+#line 650
start[j] = 0;
+#line 650
}
+#line 650
}
+#line 650
err = nc_put_vara_double(ncid, i, start, edge, value);
+#line 650
if (canConvert) {
+#line 650
IF (err)
+#line 650
error("%s", nc_strerror(err));
+#line 650
} else {
+#line 650
IF (err != NC_ECHAR)
+#line 650
error("wrong type: status = %d", err);
+#line 650
}
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
edge[j] = 1;
+#line 650
}
+#line 650
+#line 650
/* Choose a random point dividing each dim into 2 parts */
+#line 650
/* Put 2^rank (nslabs) slabs so defined */
+#line 650
nslabs = 1;
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
mid[j] = roll( var_shape[i][j] );
+#line 650
nslabs *= 2;
+#line 650
}
+#line 650
/* bits of k determine whether to put lower or upper part of dim */
+#line 650
for (k = 0; k < nslabs; k++) {
+#line 650
nels = 1;
+#line 650
for (j = 0; j < var_rank[i]; j++) {
+#line 650
if ((k >> j) & 1) {
+#line 650
start[j] = 0;
+#line 650
edge[j] = mid[j];
+#line 650
}else{
+#line 650
start[j] = mid[j];
+#line 650
edge[j] = var_shape[i][j] - mid[j];
+#line 650
}
+#line 650
nels *= edge[j];
+#line 650
}
+#line 650
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 650
err = toMixedBase(j, var_rank[i], edge, index);
+#line 650
IF (err)
+#line 650
error("error in toMixedBase 1");
+#line 650
for (d = 0; d < var_rank[i]; d++)
+#line 650
index[d] += start[d];
+#line 650
value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE);
+#line 650
allInExtRange = allInExtRange
+#line 650
&& inRange3(value[j], var_type[i], NCT_DOUBLE);
+#line 650
}
+#line 650
if (var_rank[i] == 0 && i%2 == 0)
+#line 650
err = nc_put_vara_double(ncid, i, NULL, NULL, value);
+#line 650
else
+#line 650
err = nc_put_vara_double(ncid, i, start, edge, value);
+#line 650
if (canConvert) {
+#line 650
if (allInExtRange) {
+#line 650
IF (err)
+#line 650
error("%s", nc_strerror(err));
+#line 650
} else {
+#line 650
IF (err != NC_ERANGE)
+#line 650
error("range error: status = %d", err);
+#line 650
}
+#line 650
} else {
+#line 650
IF (nels > 0 && err != NC_ECHAR)
+#line 650
error("wrong type: status = %d", err);
+#line 650
}
+#line 650
}
+#line 650
}
+#line 650
+#line 650
err = nc_close(ncid);
+#line 650
IF (err)
+#line 650
error("nc_close: %s", nc_strerror(err));
+#line 650
+#line 650
check_vars_double(scratch);
+#line 650
+#line 650
err = remove(scratch);
+#line 650
IF (err)
+#line 650
error("remove of %s failed", scratch);
+#line 650
}
+#line 650
+#line 815
void
+#line 816
test_nc_put_vars_text(void)
+#line 816
{
+#line 816
int ncid;
+#line 816
int d;
+#line 816
int i;
+#line 816
int j;
+#line 816
int k;
+#line 816
int m;
+#line 816
int err;
+#line 816
int nels;
+#line 816
int nslabs;
+#line 816
int nstarts; /* number of different starts */
+#line 816
size_t start[MAX_RANK];
+#line 816
size_t edge[MAX_RANK];
+#line 816
size_t index[MAX_RANK];
+#line 816
size_t index2[MAX_RANK];
+#line 816
size_t mid[MAX_RANK];
+#line 816
size_t count[MAX_RANK];
+#line 816
size_t sstride[MAX_RANK];
+#line 816
ptrdiff_t stride[MAX_RANK];
+#line 816
int canConvert; /* Both text or both numeric */
+#line 816
int allInExtRange; /* all values within external range? */
+#line 816
text value[MAX_NELS];
+#line 816
+#line 816
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 816
IF (err) {
+#line 816
error("nc_create: %s", nc_strerror(err));
+#line 816
return;
+#line 816
}
+#line 816
def_dims(ncid);
+#line 816
def_vars(ncid);
+#line 816
err = nc_enddef(ncid);
+#line 816
IF (err)
+#line 816
error("nc_enddef: %s", nc_strerror(err));
+#line 816
+#line 816
for (i = 0; i < NVARS; i++) {
+#line 816
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 816
assert(var_rank[i] <= MAX_RANK);
+#line 816
assert(var_nels[i] <= MAX_NELS);
+#line 816
for (j = 0; j < var_rank[i]; j++) {
+#line 816
start[j] = 0;
+#line 816
edge[j] = 1;
+#line 816
stride[j] = 1;
+#line 816
}
+#line 816
err = nc_put_vars_text(BAD_ID, i, start, edge, stride, value);
+#line 816
IF (err != NC_EBADID)
+#line 816
error("bad ncid: status = %d", err);
+#line 816
err = nc_put_vars_text(ncid, BAD_VARID, start, edge, stride, value);
+#line 816
IF (err != NC_ENOTVAR)
+#line 816
error("bad var id: status = %d", err);
+#line 816
for (j = 0; j < var_rank[i]; j++) {
+#line 816
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 816
start[j] = var_shape[i][j] + 1;
+#line 816
err = nc_put_vars_text(ncid, i, start, edge, stride, value);
+#line 816
if(!canConvert) {
+#line 816
IF(err != NC_ECHAR)
+#line 816
error("conversion: status = %d", err);
+#line 816
} else {
+#line 816
IF(err != NC_EINVALCOORDS)
+#line 816
error("bad start: status = %d", err);
+#line 816
start[j] = 0;
+#line 816
edge[j] = var_shape[i][j] + 1;
+#line 816
err = nc_put_vars_text(ncid, i, start, edge, stride, value);
+#line 816
IF (err != NC_EEDGE)
+#line 816
error("bad edge: status = %d", err);
+#line 816
edge[j] = 1;
+#line 816
stride[j] = 0;
+#line 816
err = nc_put_vars_text(ncid, i, start, edge, stride, value);
+#line 816
IF (err != NC_ESTRIDE)
+#line 816
error("bad stride: status = %d", err);
+#line 816
stride[j] = 1;
+#line 816
}
+#line 816
}
+#line 816
}
+#line 816
/* Choose a random point dividing each dim into 2 parts */
+#line 816
/* Put 2^rank (nslabs) slabs so defined */
+#line 816
nslabs = 1;
+#line 816
for (j = 0; j < var_rank[i]; j++) {
+#line 816
mid[j] = roll( var_shape[i][j] );
+#line 816
nslabs *= 2;
+#line 816
}
+#line 816
/* bits of k determine whether to put lower or upper part of dim */
+#line 816
/* choose random stride from 1 to edge */
+#line 816
for (k = 0; k < nslabs; k++) {
+#line 816
nstarts = 1;
+#line 816
for (j = 0; j < var_rank[i]; j++) {
+#line 816
if ((k >> j) & 1) {
+#line 816
start[j] = 0;
+#line 816
edge[j] = mid[j];
+#line 816
}else{
+#line 816
start[j] = mid[j];
+#line 816
edge[j] = var_shape[i][j] - mid[j];
+#line 816
}
+#line 816
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 816
nstarts *= stride[j];
+#line 816
}
+#line 816
for (m = 0; m < nstarts; m++) {
+#line 816
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 816
IF (err)
+#line 816
error("error in toMixedBase");
+#line 816
nels = 1;
+#line 816
for (j = 0; j < var_rank[i]; j++) {
+#line 816
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 816
nels *= count[j];
+#line 816
index[j] += start[j];
+#line 816
}
+#line 816
/* Random choice of forward or backward */
+#line 816
/* TODO
+#line 816
if ( roll(2) ) {
+#line 816
for (j = 0; j < var_rank[i]; j++) {
+#line 816
index[j] += (count[j] - 1) * stride[j];
+#line 816
stride[j] = -stride[j];
+#line 816
}
+#line 816
}
+#line 816
*/
+#line 816
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 816
err = toMixedBase(j, var_rank[i], count, index2);
+#line 816
IF (err)
+#line 816
error("error in toMixedBase");
+#line 816
for (d = 0; d < var_rank[i]; d++)
+#line 816
index2[d] = index[d] + index2[d] * stride[d];
+#line 816
value[j] = hash_text(var_type[i], var_rank[i], index2,
+#line 816
NCT_TEXT);
+#line 816
allInExtRange = allInExtRange
+#line 816
&& inRange3(value[j], var_type[i], NCT_TEXT);
+#line 816
}
+#line 816
if (var_rank[i] == 0 && i%2 == 0)
+#line 816
err = nc_put_vars_text(ncid, i, NULL, NULL, stride, value);
+#line 816
else
+#line 816
err = nc_put_vars_text(ncid, i, index, count, stride, value);
+#line 816
if (canConvert) {
+#line 816
if (allInExtRange) {
+#line 816
IF (err)
+#line 816
error("%s", nc_strerror(err));
+#line 816
} else {
+#line 816
IF (err != NC_ERANGE)
+#line 816
error("range error: status = %d", err);
+#line 816
}
+#line 816
} else {
+#line 816
IF (nels > 0 && err != NC_ECHAR)
+#line 816
error("wrong type: status = %d", err);
+#line 816
}
+#line 816
}
+#line 816
}
+#line 816
}
+#line 816
+#line 816
err = nc_close(ncid);
+#line 816
IF (err)
+#line 816
error("nc_close: %s", nc_strerror(err));
+#line 816
+#line 816
check_vars_text(scratch);
+#line 816
+#line 816
err = remove(scratch);
+#line 816
IF (err)
+#line 816
error("remove of %s failed", scratch);
+#line 816
}
+#line 816
void
+#line 817
test_nc_put_vars_uchar(void)
+#line 817
{
+#line 817
int ncid;
+#line 817
int d;
+#line 817
int i;
+#line 817
int j;
+#line 817
int k;
+#line 817
int m;
+#line 817
int err;
+#line 817
int nels;
+#line 817
int nslabs;
+#line 817
int nstarts; /* number of different starts */
+#line 817
size_t start[MAX_RANK];
+#line 817
size_t edge[MAX_RANK];
+#line 817
size_t index[MAX_RANK];
+#line 817
size_t index2[MAX_RANK];
+#line 817
size_t mid[MAX_RANK];
+#line 817
size_t count[MAX_RANK];
+#line 817
size_t sstride[MAX_RANK];
+#line 817
ptrdiff_t stride[MAX_RANK];
+#line 817
int canConvert; /* Both text or both numeric */
+#line 817
int allInExtRange; /* all values within external range? */
+#line 817
uchar value[MAX_NELS];
+#line 817
+#line 817
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 817
IF (err) {
+#line 817
error("nc_create: %s", nc_strerror(err));
+#line 817
return;
+#line 817
}
+#line 817
def_dims(ncid);
+#line 817
def_vars(ncid);
+#line 817
err = nc_enddef(ncid);
+#line 817
IF (err)
+#line 817
error("nc_enddef: %s", nc_strerror(err));
+#line 817
+#line 817
for (i = 0; i < NVARS; i++) {
+#line 817
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 817
assert(var_rank[i] <= MAX_RANK);
+#line 817
assert(var_nels[i] <= MAX_NELS);
+#line 817
for (j = 0; j < var_rank[i]; j++) {
+#line 817
start[j] = 0;
+#line 817
edge[j] = 1;
+#line 817
stride[j] = 1;
+#line 817
}
+#line 817
err = nc_put_vars_uchar(BAD_ID, i, start, edge, stride, value);
+#line 817
IF (err != NC_EBADID)
+#line 817
error("bad ncid: status = %d", err);
+#line 817
err = nc_put_vars_uchar(ncid, BAD_VARID, start, edge, stride, value);
+#line 817
IF (err != NC_ENOTVAR)
+#line 817
error("bad var id: status = %d", err);
+#line 817
for (j = 0; j < var_rank[i]; j++) {
+#line 817
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 817
start[j] = var_shape[i][j] + 1;
+#line 817
err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
+#line 817
if(!canConvert) {
+#line 817
IF(err != NC_ECHAR)
+#line 817
error("conversion: status = %d", err);
+#line 817
} else {
+#line 817
IF(err != NC_EINVALCOORDS)
+#line 817
error("bad start: status = %d", err);
+#line 817
start[j] = 0;
+#line 817
edge[j] = var_shape[i][j] + 1;
+#line 817
err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
+#line 817
IF (err != NC_EEDGE)
+#line 817
error("bad edge: status = %d", err);
+#line 817
edge[j] = 1;
+#line 817
stride[j] = 0;
+#line 817
err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
+#line 817
IF (err != NC_ESTRIDE)
+#line 817
error("bad stride: status = %d", err);
+#line 817
stride[j] = 1;
+#line 817
}
+#line 817
}
+#line 817
}
+#line 817
/* Choose a random point dividing each dim into 2 parts */
+#line 817
/* Put 2^rank (nslabs) slabs so defined */
+#line 817
nslabs = 1;
+#line 817
for (j = 0; j < var_rank[i]; j++) {
+#line 817
mid[j] = roll( var_shape[i][j] );
+#line 817
nslabs *= 2;
+#line 817
}
+#line 817
/* bits of k determine whether to put lower or upper part of dim */
+#line 817
/* choose random stride from 1 to edge */
+#line 817
for (k = 0; k < nslabs; k++) {
+#line 817
nstarts = 1;
+#line 817
for (j = 0; j < var_rank[i]; j++) {
+#line 817
if ((k >> j) & 1) {
+#line 817
start[j] = 0;
+#line 817
edge[j] = mid[j];
+#line 817
}else{
+#line 817
start[j] = mid[j];
+#line 817
edge[j] = var_shape[i][j] - mid[j];
+#line 817
}
+#line 817
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 817
nstarts *= stride[j];
+#line 817
}
+#line 817
for (m = 0; m < nstarts; m++) {
+#line 817
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 817
IF (err)
+#line 817
error("error in toMixedBase");
+#line 817
nels = 1;
+#line 817
for (j = 0; j < var_rank[i]; j++) {
+#line 817
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 817
nels *= count[j];
+#line 817
index[j] += start[j];
+#line 817
}
+#line 817
/* Random choice of forward or backward */
+#line 817
/* TODO
+#line 817
if ( roll(2) ) {
+#line 817
for (j = 0; j < var_rank[i]; j++) {
+#line 817
index[j] += (count[j] - 1) * stride[j];
+#line 817
stride[j] = -stride[j];
+#line 817
}
+#line 817
}
+#line 817
*/
+#line 817
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 817
err = toMixedBase(j, var_rank[i], count, index2);
+#line 817
IF (err)
+#line 817
error("error in toMixedBase");
+#line 817
for (d = 0; d < var_rank[i]; d++)
+#line 817
index2[d] = index[d] + index2[d] * stride[d];
+#line 817
value[j] = hash_uchar(var_type[i], var_rank[i], index2,
+#line 817
NCT_UCHAR);
+#line 817
allInExtRange = allInExtRange
+#line 817
&& inRange3(value[j], var_type[i], NCT_UCHAR);
+#line 817
}
+#line 817
if (var_rank[i] == 0 && i%2 == 0)
+#line 817
err = nc_put_vars_uchar(ncid, i, NULL, NULL, stride, value);
+#line 817
else
+#line 817
err = nc_put_vars_uchar(ncid, i, index, count, stride, value);
+#line 817
if (canConvert) {
+#line 817
if (allInExtRange) {
+#line 817
IF (err)
+#line 817
error("%s", nc_strerror(err));
+#line 817
} else {
+#line 817
IF (err != NC_ERANGE)
+#line 817
error("range error: status = %d", err);
+#line 817
}
+#line 817
} else {
+#line 817
IF (nels > 0 && err != NC_ECHAR)
+#line 817
error("wrong type: status = %d", err);
+#line 817
}
+#line 817
}
+#line 817
}
+#line 817
}
+#line 817
+#line 817
err = nc_close(ncid);
+#line 817
IF (err)
+#line 817
error("nc_close: %s", nc_strerror(err));
+#line 817
+#line 817
check_vars_uchar(scratch);
+#line 817
+#line 817
err = remove(scratch);
+#line 817
IF (err)
+#line 817
error("remove of %s failed", scratch);
+#line 817
}
+#line 817
void
+#line 818
test_nc_put_vars_schar(void)
+#line 818
{
+#line 818
int ncid;
+#line 818
int d;
+#line 818
int i;
+#line 818
int j;
+#line 818
int k;
+#line 818
int m;
+#line 818
int err;
+#line 818
int nels;
+#line 818
int nslabs;
+#line 818
int nstarts; /* number of different starts */
+#line 818
size_t start[MAX_RANK];
+#line 818
size_t edge[MAX_RANK];
+#line 818
size_t index[MAX_RANK];
+#line 818
size_t index2[MAX_RANK];
+#line 818
size_t mid[MAX_RANK];
+#line 818
size_t count[MAX_RANK];
+#line 818
size_t sstride[MAX_RANK];
+#line 818
ptrdiff_t stride[MAX_RANK];
+#line 818
int canConvert; /* Both text or both numeric */
+#line 818
int allInExtRange; /* all values within external range? */
+#line 818
schar value[MAX_NELS];
+#line 818
+#line 818
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 818
IF (err) {
+#line 818
error("nc_create: %s", nc_strerror(err));
+#line 818
return;
+#line 818
}
+#line 818
def_dims(ncid);
+#line 818
def_vars(ncid);
+#line 818
err = nc_enddef(ncid);
+#line 818
IF (err)
+#line 818
error("nc_enddef: %s", nc_strerror(err));
+#line 818
+#line 818
for (i = 0; i < NVARS; i++) {
+#line 818
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 818
assert(var_rank[i] <= MAX_RANK);
+#line 818
assert(var_nels[i] <= MAX_NELS);
+#line 818
for (j = 0; j < var_rank[i]; j++) {
+#line 818
start[j] = 0;
+#line 818
edge[j] = 1;
+#line 818
stride[j] = 1;
+#line 818
}
+#line 818
err = nc_put_vars_schar(BAD_ID, i, start, edge, stride, value);
+#line 818
IF (err != NC_EBADID)
+#line 818
error("bad ncid: status = %d", err);
+#line 818
err = nc_put_vars_schar(ncid, BAD_VARID, start, edge, stride, value);
+#line 818
IF (err != NC_ENOTVAR)
+#line 818
error("bad var id: status = %d", err);
+#line 818
for (j = 0; j < var_rank[i]; j++) {
+#line 818
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 818
start[j] = var_shape[i][j] + 1;
+#line 818
err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
+#line 818
if(!canConvert) {
+#line 818
IF(err != NC_ECHAR)
+#line 818
error("conversion: status = %d", err);
+#line 818
} else {
+#line 818
IF(err != NC_EINVALCOORDS)
+#line 818
error("bad start: status = %d", err);
+#line 818
start[j] = 0;
+#line 818
edge[j] = var_shape[i][j] + 1;
+#line 818
err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
+#line 818
IF (err != NC_EEDGE)
+#line 818
error("bad edge: status = %d", err);
+#line 818
edge[j] = 1;
+#line 818
stride[j] = 0;
+#line 818
err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
+#line 818
IF (err != NC_ESTRIDE)
+#line 818
error("bad stride: status = %d", err);
+#line 818
stride[j] = 1;
+#line 818
}
+#line 818
}
+#line 818
}
+#line 818
/* Choose a random point dividing each dim into 2 parts */
+#line 818
/* Put 2^rank (nslabs) slabs so defined */
+#line 818
nslabs = 1;
+#line 818
for (j = 0; j < var_rank[i]; j++) {
+#line 818
mid[j] = roll( var_shape[i][j] );
+#line 818
nslabs *= 2;
+#line 818
}
+#line 818
/* bits of k determine whether to put lower or upper part of dim */
+#line 818
/* choose random stride from 1 to edge */
+#line 818
for (k = 0; k < nslabs; k++) {
+#line 818
nstarts = 1;
+#line 818
for (j = 0; j < var_rank[i]; j++) {
+#line 818
if ((k >> j) & 1) {
+#line 818
start[j] = 0;
+#line 818
edge[j] = mid[j];
+#line 818
}else{
+#line 818
start[j] = mid[j];
+#line 818
edge[j] = var_shape[i][j] - mid[j];
+#line 818
}
+#line 818
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 818
nstarts *= stride[j];
+#line 818
}
+#line 818
for (m = 0; m < nstarts; m++) {
+#line 818
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 818
IF (err)
+#line 818
error("error in toMixedBase");
+#line 818
nels = 1;
+#line 818
for (j = 0; j < var_rank[i]; j++) {
+#line 818
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 818
nels *= count[j];
+#line 818
index[j] += start[j];
+#line 818
}
+#line 818
/* Random choice of forward or backward */
+#line 818
/* TODO
+#line 818
if ( roll(2) ) {
+#line 818
for (j = 0; j < var_rank[i]; j++) {
+#line 818
index[j] += (count[j] - 1) * stride[j];
+#line 818
stride[j] = -stride[j];
+#line 818
}
+#line 818
}
+#line 818
*/
+#line 818
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 818
err = toMixedBase(j, var_rank[i], count, index2);
+#line 818
IF (err)
+#line 818
error("error in toMixedBase");
+#line 818
for (d = 0; d < var_rank[i]; d++)
+#line 818
index2[d] = index[d] + index2[d] * stride[d];
+#line 818
value[j] = hash_schar(var_type[i], var_rank[i], index2,
+#line 818
NCT_SCHAR);
+#line 818
allInExtRange = allInExtRange
+#line 818
&& inRange3(value[j], var_type[i], NCT_SCHAR);
+#line 818
}
+#line 818
if (var_rank[i] == 0 && i%2 == 0)
+#line 818
err = nc_put_vars_schar(ncid, i, NULL, NULL, stride, value);
+#line 818
else
+#line 818
err = nc_put_vars_schar(ncid, i, index, count, stride, value);
+#line 818
if (canConvert) {
+#line 818
if (allInExtRange) {
+#line 818
IF (err)
+#line 818
error("%s", nc_strerror(err));
+#line 818
} else {
+#line 818
IF (err != NC_ERANGE)
+#line 818
error("range error: status = %d", err);
+#line 818
}
+#line 818
} else {
+#line 818
IF (nels > 0 && err != NC_ECHAR)
+#line 818
error("wrong type: status = %d", err);
+#line 818
}
+#line 818
}
+#line 818
}
+#line 818
}
+#line 818
+#line 818
err = nc_close(ncid);
+#line 818
IF (err)
+#line 818
error("nc_close: %s", nc_strerror(err));
+#line 818
+#line 818
check_vars_schar(scratch);
+#line 818
+#line 818
err = remove(scratch);
+#line 818
IF (err)
+#line 818
error("remove of %s failed", scratch);
+#line 818
}
+#line 818
void
+#line 819
test_nc_put_vars_short(void)
+#line 819
{
+#line 819
int ncid;
+#line 819
int d;
+#line 819
int i;
+#line 819
int j;
+#line 819
int k;
+#line 819
int m;
+#line 819
int err;
+#line 819
int nels;
+#line 819
int nslabs;
+#line 819
int nstarts; /* number of different starts */
+#line 819
size_t start[MAX_RANK];
+#line 819
size_t edge[MAX_RANK];
+#line 819
size_t index[MAX_RANK];
+#line 819
size_t index2[MAX_RANK];
+#line 819
size_t mid[MAX_RANK];
+#line 819
size_t count[MAX_RANK];
+#line 819
size_t sstride[MAX_RANK];
+#line 819
ptrdiff_t stride[MAX_RANK];
+#line 819
int canConvert; /* Both text or both numeric */
+#line 819
int allInExtRange; /* all values within external range? */
+#line 819
short value[MAX_NELS];
+#line 819
+#line 819
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 819
IF (err) {
+#line 819
error("nc_create: %s", nc_strerror(err));
+#line 819
return;
+#line 819
}
+#line 819
def_dims(ncid);
+#line 819
def_vars(ncid);
+#line 819
err = nc_enddef(ncid);
+#line 819
IF (err)
+#line 819
error("nc_enddef: %s", nc_strerror(err));
+#line 819
+#line 819
for (i = 0; i < NVARS; i++) {
+#line 819
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 819
assert(var_rank[i] <= MAX_RANK);
+#line 819
assert(var_nels[i] <= MAX_NELS);
+#line 819
for (j = 0; j < var_rank[i]; j++) {
+#line 819
start[j] = 0;
+#line 819
edge[j] = 1;
+#line 819
stride[j] = 1;
+#line 819
}
+#line 819
err = nc_put_vars_short(BAD_ID, i, start, edge, stride, value);
+#line 819
IF (err != NC_EBADID)
+#line 819
error("bad ncid: status = %d", err);
+#line 819
err = nc_put_vars_short(ncid, BAD_VARID, start, edge, stride, value);
+#line 819
IF (err != NC_ENOTVAR)
+#line 819
error("bad var id: status = %d", err);
+#line 819
for (j = 0; j < var_rank[i]; j++) {
+#line 819
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 819
start[j] = var_shape[i][j] + 1;
+#line 819
err = nc_put_vars_short(ncid, i, start, edge, stride, value);
+#line 819
if(!canConvert) {
+#line 819
IF(err != NC_ECHAR)
+#line 819
error("conversion: status = %d", err);
+#line 819
} else {
+#line 819
IF(err != NC_EINVALCOORDS)
+#line 819
error("bad start: status = %d", err);
+#line 819
start[j] = 0;
+#line 819
edge[j] = var_shape[i][j] + 1;
+#line 819
err = nc_put_vars_short(ncid, i, start, edge, stride, value);
+#line 819
IF (err != NC_EEDGE)
+#line 819
error("bad edge: status = %d", err);
+#line 819
edge[j] = 1;
+#line 819
stride[j] = 0;
+#line 819
err = nc_put_vars_short(ncid, i, start, edge, stride, value);
+#line 819
IF (err != NC_ESTRIDE)
+#line 819
error("bad stride: status = %d", err);
+#line 819
stride[j] = 1;
+#line 819
}
+#line 819
}
+#line 819
}
+#line 819
/* Choose a random point dividing each dim into 2 parts */
+#line 819
/* Put 2^rank (nslabs) slabs so defined */
+#line 819
nslabs = 1;
+#line 819
for (j = 0; j < var_rank[i]; j++) {
+#line 819
mid[j] = roll( var_shape[i][j] );
+#line 819
nslabs *= 2;
+#line 819
}
+#line 819
/* bits of k determine whether to put lower or upper part of dim */
+#line 819
/* choose random stride from 1 to edge */
+#line 819
for (k = 0; k < nslabs; k++) {
+#line 819
nstarts = 1;
+#line 819
for (j = 0; j < var_rank[i]; j++) {
+#line 819
if ((k >> j) & 1) {
+#line 819
start[j] = 0;
+#line 819
edge[j] = mid[j];
+#line 819
}else{
+#line 819
start[j] = mid[j];
+#line 819
edge[j] = var_shape[i][j] - mid[j];
+#line 819
}
+#line 819
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 819
nstarts *= stride[j];
+#line 819
}
+#line 819
for (m = 0; m < nstarts; m++) {
+#line 819
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 819
IF (err)
+#line 819
error("error in toMixedBase");
+#line 819
nels = 1;
+#line 819
for (j = 0; j < var_rank[i]; j++) {
+#line 819
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 819
nels *= count[j];
+#line 819
index[j] += start[j];
+#line 819
}
+#line 819
/* Random choice of forward or backward */
+#line 819
/* TODO
+#line 819
if ( roll(2) ) {
+#line 819
for (j = 0; j < var_rank[i]; j++) {
+#line 819
index[j] += (count[j] - 1) * stride[j];
+#line 819
stride[j] = -stride[j];
+#line 819
}
+#line 819
}
+#line 819
*/
+#line 819
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 819
err = toMixedBase(j, var_rank[i], count, index2);
+#line 819
IF (err)
+#line 819
error("error in toMixedBase");
+#line 819
for (d = 0; d < var_rank[i]; d++)
+#line 819
index2[d] = index[d] + index2[d] * stride[d];
+#line 819
value[j] = hash_short(var_type[i], var_rank[i], index2,
+#line 819
NCT_SHORT);
+#line 819
allInExtRange = allInExtRange
+#line 819
&& inRange3(value[j], var_type[i], NCT_SHORT);
+#line 819
}
+#line 819
if (var_rank[i] == 0 && i%2 == 0)
+#line 819
err = nc_put_vars_short(ncid, i, NULL, NULL, stride, value);
+#line 819
else
+#line 819
err = nc_put_vars_short(ncid, i, index, count, stride, value);
+#line 819
if (canConvert) {
+#line 819
if (allInExtRange) {
+#line 819
IF (err)
+#line 819
error("%s", nc_strerror(err));
+#line 819
} else {
+#line 819
IF (err != NC_ERANGE)
+#line 819
error("range error: status = %d", err);
+#line 819
}
+#line 819
} else {
+#line 819
IF (nels > 0 && err != NC_ECHAR)
+#line 819
error("wrong type: status = %d", err);
+#line 819
}
+#line 819
}
+#line 819
}
+#line 819
}
+#line 819
+#line 819
err = nc_close(ncid);
+#line 819
IF (err)
+#line 819
error("nc_close: %s", nc_strerror(err));
+#line 819
+#line 819
check_vars_short(scratch);
+#line 819
+#line 819
err = remove(scratch);
+#line 819
IF (err)
+#line 819
error("remove of %s failed", scratch);
+#line 819
}
+#line 819
void
+#line 820
test_nc_put_vars_int(void)
+#line 820
{
+#line 820
int ncid;
+#line 820
int d;
+#line 820
int i;
+#line 820
int j;
+#line 820
int k;
+#line 820
int m;
+#line 820
int err;
+#line 820
int nels;
+#line 820
int nslabs;
+#line 820
int nstarts; /* number of different starts */
+#line 820
size_t start[MAX_RANK];
+#line 820
size_t edge[MAX_RANK];
+#line 820
size_t index[MAX_RANK];
+#line 820
size_t index2[MAX_RANK];
+#line 820
size_t mid[MAX_RANK];
+#line 820
size_t count[MAX_RANK];
+#line 820
size_t sstride[MAX_RANK];
+#line 820
ptrdiff_t stride[MAX_RANK];
+#line 820
int canConvert; /* Both text or both numeric */
+#line 820
int allInExtRange; /* all values within external range? */
+#line 820
int value[MAX_NELS];
+#line 820
+#line 820
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 820
IF (err) {
+#line 820
error("nc_create: %s", nc_strerror(err));
+#line 820
return;
+#line 820
}
+#line 820
def_dims(ncid);
+#line 820
def_vars(ncid);
+#line 820
err = nc_enddef(ncid);
+#line 820
IF (err)
+#line 820
error("nc_enddef: %s", nc_strerror(err));
+#line 820
+#line 820
for (i = 0; i < NVARS; i++) {
+#line 820
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 820
assert(var_rank[i] <= MAX_RANK);
+#line 820
assert(var_nels[i] <= MAX_NELS);
+#line 820
for (j = 0; j < var_rank[i]; j++) {
+#line 820
start[j] = 0;
+#line 820
edge[j] = 1;
+#line 820
stride[j] = 1;
+#line 820
}
+#line 820
err = nc_put_vars_int(BAD_ID, i, start, edge, stride, value);
+#line 820
IF (err != NC_EBADID)
+#line 820
error("bad ncid: status = %d", err);
+#line 820
err = nc_put_vars_int(ncid, BAD_VARID, start, edge, stride, value);
+#line 820
IF (err != NC_ENOTVAR)
+#line 820
error("bad var id: status = %d", err);
+#line 820
for (j = 0; j < var_rank[i]; j++) {
+#line 820
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 820
start[j] = var_shape[i][j] + 1;
+#line 820
err = nc_put_vars_int(ncid, i, start, edge, stride, value);
+#line 820
if(!canConvert) {
+#line 820
IF(err != NC_ECHAR)
+#line 820
error("conversion: status = %d", err);
+#line 820
} else {
+#line 820
IF(err != NC_EINVALCOORDS)
+#line 820
error("bad start: status = %d", err);
+#line 820
start[j] = 0;
+#line 820
edge[j] = var_shape[i][j] + 1;
+#line 820
err = nc_put_vars_int(ncid, i, start, edge, stride, value);
+#line 820
IF (err != NC_EEDGE)
+#line 820
error("bad edge: status = %d", err);
+#line 820
edge[j] = 1;
+#line 820
stride[j] = 0;
+#line 820
err = nc_put_vars_int(ncid, i, start, edge, stride, value);
+#line 820
IF (err != NC_ESTRIDE)
+#line 820
error("bad stride: status = %d", err);
+#line 820
stride[j] = 1;
+#line 820
}
+#line 820
}
+#line 820
}
+#line 820
/* Choose a random point dividing each dim into 2 parts */
+#line 820
/* Put 2^rank (nslabs) slabs so defined */
+#line 820
nslabs = 1;
+#line 820
for (j = 0; j < var_rank[i]; j++) {
+#line 820
mid[j] = roll( var_shape[i][j] );
+#line 820
nslabs *= 2;
+#line 820
}
+#line 820
/* bits of k determine whether to put lower or upper part of dim */
+#line 820
/* choose random stride from 1 to edge */
+#line 820
for (k = 0; k < nslabs; k++) {
+#line 820
nstarts = 1;
+#line 820
for (j = 0; j < var_rank[i]; j++) {
+#line 820
if ((k >> j) & 1) {
+#line 820
start[j] = 0;
+#line 820
edge[j] = mid[j];
+#line 820
}else{
+#line 820
start[j] = mid[j];
+#line 820
edge[j] = var_shape[i][j] - mid[j];
+#line 820
}
+#line 820
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 820
nstarts *= stride[j];
+#line 820
}
+#line 820
for (m = 0; m < nstarts; m++) {
+#line 820
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 820
IF (err)
+#line 820
error("error in toMixedBase");
+#line 820
nels = 1;
+#line 820
for (j = 0; j < var_rank[i]; j++) {
+#line 820
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 820
nels *= count[j];
+#line 820
index[j] += start[j];
+#line 820
}
+#line 820
/* Random choice of forward or backward */
+#line 820
/* TODO
+#line 820
if ( roll(2) ) {
+#line 820
for (j = 0; j < var_rank[i]; j++) {
+#line 820
index[j] += (count[j] - 1) * stride[j];
+#line 820
stride[j] = -stride[j];
+#line 820
}
+#line 820
}
+#line 820
*/
+#line 820
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 820
err = toMixedBase(j, var_rank[i], count, index2);
+#line 820
IF (err)
+#line 820
error("error in toMixedBase");
+#line 820
for (d = 0; d < var_rank[i]; d++)
+#line 820
index2[d] = index[d] + index2[d] * stride[d];
+#line 820
value[j] = hash_int(var_type[i], var_rank[i], index2,
+#line 820
NCT_INT);
+#line 820
allInExtRange = allInExtRange
+#line 820
&& inRange3(value[j], var_type[i], NCT_INT);
+#line 820
}
+#line 820
if (var_rank[i] == 0 && i%2 == 0)
+#line 820
err = nc_put_vars_int(ncid, i, NULL, NULL, stride, value);
+#line 820
else
+#line 820
err = nc_put_vars_int(ncid, i, index, count, stride, value);
+#line 820
if (canConvert) {
+#line 820
if (allInExtRange) {
+#line 820
IF (err)
+#line 820
error("%s", nc_strerror(err));
+#line 820
} else {
+#line 820
IF (err != NC_ERANGE)
+#line 820
error("range error: status = %d", err);
+#line 820
}
+#line 820
} else {
+#line 820
IF (nels > 0 && err != NC_ECHAR)
+#line 820
error("wrong type: status = %d", err);
+#line 820
}
+#line 820
}
+#line 820
}
+#line 820
}
+#line 820
+#line 820
err = nc_close(ncid);
+#line 820
IF (err)
+#line 820
error("nc_close: %s", nc_strerror(err));
+#line 820
+#line 820
check_vars_int(scratch);
+#line 820
+#line 820
err = remove(scratch);
+#line 820
IF (err)
+#line 820
error("remove of %s failed", scratch);
+#line 820
}
+#line 820
void
+#line 821
test_nc_put_vars_long(void)
+#line 821
{
+#line 821
int ncid;
+#line 821
int d;
+#line 821
int i;
+#line 821
int j;
+#line 821
int k;
+#line 821
int m;
+#line 821
int err;
+#line 821
int nels;
+#line 821
int nslabs;
+#line 821
int nstarts; /* number of different starts */
+#line 821
size_t start[MAX_RANK];
+#line 821
size_t edge[MAX_RANK];
+#line 821
size_t index[MAX_RANK];
+#line 821
size_t index2[MAX_RANK];
+#line 821
size_t mid[MAX_RANK];
+#line 821
size_t count[MAX_RANK];
+#line 821
size_t sstride[MAX_RANK];
+#line 821
ptrdiff_t stride[MAX_RANK];
+#line 821
int canConvert; /* Both text or both numeric */
+#line 821
int allInExtRange; /* all values within external range? */
+#line 821
long value[MAX_NELS];
+#line 821
+#line 821
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 821
IF (err) {
+#line 821
error("nc_create: %s", nc_strerror(err));
+#line 821
return;
+#line 821
}
+#line 821
def_dims(ncid);
+#line 821
def_vars(ncid);
+#line 821
err = nc_enddef(ncid);
+#line 821
IF (err)
+#line 821
error("nc_enddef: %s", nc_strerror(err));
+#line 821
+#line 821
for (i = 0; i < NVARS; i++) {
+#line 821
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 821
assert(var_rank[i] <= MAX_RANK);
+#line 821
assert(var_nels[i] <= MAX_NELS);
+#line 821
for (j = 0; j < var_rank[i]; j++) {
+#line 821
start[j] = 0;
+#line 821
edge[j] = 1;
+#line 821
stride[j] = 1;
+#line 821
}
+#line 821
err = nc_put_vars_long(BAD_ID, i, start, edge, stride, value);
+#line 821
IF (err != NC_EBADID)
+#line 821
error("bad ncid: status = %d", err);
+#line 821
err = nc_put_vars_long(ncid, BAD_VARID, start, edge, stride, value);
+#line 821
IF (err != NC_ENOTVAR)
+#line 821
error("bad var id: status = %d", err);
+#line 821
for (j = 0; j < var_rank[i]; j++) {
+#line 821
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 821
start[j] = var_shape[i][j] + 1;
+#line 821
err = nc_put_vars_long(ncid, i, start, edge, stride, value);
+#line 821
if(!canConvert) {
+#line 821
IF(err != NC_ECHAR)
+#line 821
error("conversion: status = %d", err);
+#line 821
} else {
+#line 821
IF(err != NC_EINVALCOORDS)
+#line 821
error("bad start: status = %d", err);
+#line 821
start[j] = 0;
+#line 821
edge[j] = var_shape[i][j] + 1;
+#line 821
err = nc_put_vars_long(ncid, i, start, edge, stride, value);
+#line 821
IF (err != NC_EEDGE)
+#line 821
error("bad edge: status = %d", err);
+#line 821
edge[j] = 1;
+#line 821
stride[j] = 0;
+#line 821
err = nc_put_vars_long(ncid, i, start, edge, stride, value);
+#line 821
IF (err != NC_ESTRIDE)
+#line 821
error("bad stride: status = %d", err);
+#line 821
stride[j] = 1;
+#line 821
}
+#line 821
}
+#line 821
}
+#line 821
/* Choose a random point dividing each dim into 2 parts */
+#line 821
/* Put 2^rank (nslabs) slabs so defined */
+#line 821
nslabs = 1;
+#line 821
for (j = 0; j < var_rank[i]; j++) {
+#line 821
mid[j] = roll( var_shape[i][j] );
+#line 821
nslabs *= 2;
+#line 821
}
+#line 821
/* bits of k determine whether to put lower or upper part of dim */
+#line 821
/* choose random stride from 1 to edge */
+#line 821
for (k = 0; k < nslabs; k++) {
+#line 821
nstarts = 1;
+#line 821
for (j = 0; j < var_rank[i]; j++) {
+#line 821
if ((k >> j) & 1) {
+#line 821
start[j] = 0;
+#line 821
edge[j] = mid[j];
+#line 821
}else{
+#line 821
start[j] = mid[j];
+#line 821
edge[j] = var_shape[i][j] - mid[j];
+#line 821
}
+#line 821
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 821
nstarts *= stride[j];
+#line 821
}
+#line 821
for (m = 0; m < nstarts; m++) {
+#line 821
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 821
IF (err)
+#line 821
error("error in toMixedBase");
+#line 821
nels = 1;
+#line 821
for (j = 0; j < var_rank[i]; j++) {
+#line 821
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 821
nels *= count[j];
+#line 821
index[j] += start[j];
+#line 821
}
+#line 821
/* Random choice of forward or backward */
+#line 821
/* TODO
+#line 821
if ( roll(2) ) {
+#line 821
for (j = 0; j < var_rank[i]; j++) {
+#line 821
index[j] += (count[j] - 1) * stride[j];
+#line 821
stride[j] = -stride[j];
+#line 821
}
+#line 821
}
+#line 821
*/
+#line 821
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 821
err = toMixedBase(j, var_rank[i], count, index2);
+#line 821
IF (err)
+#line 821
error("error in toMixedBase");
+#line 821
for (d = 0; d < var_rank[i]; d++)
+#line 821
index2[d] = index[d] + index2[d] * stride[d];
+#line 821
value[j] = hash_long(var_type[i], var_rank[i], index2,
+#line 821
NCT_LONG);
+#line 821
allInExtRange = allInExtRange
+#line 821
&& inRange3(value[j], var_type[i], NCT_LONG);
+#line 821
}
+#line 821
if (var_rank[i] == 0 && i%2 == 0)
+#line 821
err = nc_put_vars_long(ncid, i, NULL, NULL, stride, value);
+#line 821
else
+#line 821
err = nc_put_vars_long(ncid, i, index, count, stride, value);
+#line 821
if (canConvert) {
+#line 821
if (allInExtRange) {
+#line 821
IF (err)
+#line 821
error("%s", nc_strerror(err));
+#line 821
} else {
+#line 821
IF (err != NC_ERANGE)
+#line 821
error("range error: status = %d", err);
+#line 821
}
+#line 821
} else {
+#line 821
IF (nels > 0 && err != NC_ECHAR)
+#line 821
error("wrong type: status = %d", err);
+#line 821
}
+#line 821
}
+#line 821
}
+#line 821
}
+#line 821
+#line 821
err = nc_close(ncid);
+#line 821
IF (err)
+#line 821
error("nc_close: %s", nc_strerror(err));
+#line 821
+#line 821
check_vars_long(scratch);
+#line 821
+#line 821
err = remove(scratch);
+#line 821
IF (err)
+#line 821
error("remove of %s failed", scratch);
+#line 821
}
+#line 821
void
+#line 822
test_nc_put_vars_float(void)
+#line 822
{
+#line 822
int ncid;
+#line 822
int d;
+#line 822
int i;
+#line 822
int j;
+#line 822
int k;
+#line 822
int m;
+#line 822
int err;
+#line 822
int nels;
+#line 822
int nslabs;
+#line 822
int nstarts; /* number of different starts */
+#line 822
size_t start[MAX_RANK];
+#line 822
size_t edge[MAX_RANK];
+#line 822
size_t index[MAX_RANK];
+#line 822
size_t index2[MAX_RANK];
+#line 822
size_t mid[MAX_RANK];
+#line 822
size_t count[MAX_RANK];
+#line 822
size_t sstride[MAX_RANK];
+#line 822
ptrdiff_t stride[MAX_RANK];
+#line 822
int canConvert; /* Both text or both numeric */
+#line 822
int allInExtRange; /* all values within external range? */
+#line 822
float value[MAX_NELS];
+#line 822
+#line 822
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 822
IF (err) {
+#line 822
error("nc_create: %s", nc_strerror(err));
+#line 822
return;
+#line 822
}
+#line 822
def_dims(ncid);
+#line 822
def_vars(ncid);
+#line 822
err = nc_enddef(ncid);
+#line 822
IF (err)
+#line 822
error("nc_enddef: %s", nc_strerror(err));
+#line 822
+#line 822
for (i = 0; i < NVARS; i++) {
+#line 822
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 822
assert(var_rank[i] <= MAX_RANK);
+#line 822
assert(var_nels[i] <= MAX_NELS);
+#line 822
for (j = 0; j < var_rank[i]; j++) {
+#line 822
start[j] = 0;
+#line 822
edge[j] = 1;
+#line 822
stride[j] = 1;
+#line 822
}
+#line 822
err = nc_put_vars_float(BAD_ID, i, start, edge, stride, value);
+#line 822
IF (err != NC_EBADID)
+#line 822
error("bad ncid: status = %d", err);
+#line 822
err = nc_put_vars_float(ncid, BAD_VARID, start, edge, stride, value);
+#line 822
IF (err != NC_ENOTVAR)
+#line 822
error("bad var id: status = %d", err);
+#line 822
for (j = 0; j < var_rank[i]; j++) {
+#line 822
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 822
start[j] = var_shape[i][j] + 1;
+#line 822
err = nc_put_vars_float(ncid, i, start, edge, stride, value);
+#line 822
if(!canConvert) {
+#line 822
IF(err != NC_ECHAR)
+#line 822
error("conversion: status = %d", err);
+#line 822
} else {
+#line 822
IF(err != NC_EINVALCOORDS)
+#line 822
error("bad start: status = %d", err);
+#line 822
start[j] = 0;
+#line 822
edge[j] = var_shape[i][j] + 1;
+#line 822
err = nc_put_vars_float(ncid, i, start, edge, stride, value);
+#line 822
IF (err != NC_EEDGE)
+#line 822
error("bad edge: status = %d", err);
+#line 822
edge[j] = 1;
+#line 822
stride[j] = 0;
+#line 822
err = nc_put_vars_float(ncid, i, start, edge, stride, value);
+#line 822
IF (err != NC_ESTRIDE)
+#line 822
error("bad stride: status = %d", err);
+#line 822
stride[j] = 1;
+#line 822
}
+#line 822
}
+#line 822
}
+#line 822
/* Choose a random point dividing each dim into 2 parts */
+#line 822
/* Put 2^rank (nslabs) slabs so defined */
+#line 822
nslabs = 1;
+#line 822
for (j = 0; j < var_rank[i]; j++) {
+#line 822
mid[j] = roll( var_shape[i][j] );
+#line 822
nslabs *= 2;
+#line 822
}
+#line 822
/* bits of k determine whether to put lower or upper part of dim */
+#line 822
/* choose random stride from 1 to edge */
+#line 822
for (k = 0; k < nslabs; k++) {
+#line 822
nstarts = 1;
+#line 822
for (j = 0; j < var_rank[i]; j++) {
+#line 822
if ((k >> j) & 1) {
+#line 822
start[j] = 0;
+#line 822
edge[j] = mid[j];
+#line 822
}else{
+#line 822
start[j] = mid[j];
+#line 822
edge[j] = var_shape[i][j] - mid[j];
+#line 822
}
+#line 822
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 822
nstarts *= stride[j];
+#line 822
}
+#line 822
for (m = 0; m < nstarts; m++) {
+#line 822
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 822
IF (err)
+#line 822
error("error in toMixedBase");
+#line 822
nels = 1;
+#line 822
for (j = 0; j < var_rank[i]; j++) {
+#line 822
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 822
nels *= count[j];
+#line 822
index[j] += start[j];
+#line 822
}
+#line 822
/* Random choice of forward or backward */
+#line 822
/* TODO
+#line 822
if ( roll(2) ) {
+#line 822
for (j = 0; j < var_rank[i]; j++) {
+#line 822
index[j] += (count[j] - 1) * stride[j];
+#line 822
stride[j] = -stride[j];
+#line 822
}
+#line 822
}
+#line 822
*/
+#line 822
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 822
err = toMixedBase(j, var_rank[i], count, index2);
+#line 822
IF (err)
+#line 822
error("error in toMixedBase");
+#line 822
for (d = 0; d < var_rank[i]; d++)
+#line 822
index2[d] = index[d] + index2[d] * stride[d];
+#line 822
value[j] = hash_float(var_type[i], var_rank[i], index2,
+#line 822
NCT_FLOAT);
+#line 822
allInExtRange = allInExtRange
+#line 822
&& inRange3(value[j], var_type[i], NCT_FLOAT);
+#line 822
}
+#line 822
if (var_rank[i] == 0 && i%2 == 0)
+#line 822
err = nc_put_vars_float(ncid, i, NULL, NULL, stride, value);
+#line 822
else
+#line 822
err = nc_put_vars_float(ncid, i, index, count, stride, value);
+#line 822
if (canConvert) {
+#line 822
if (allInExtRange) {
+#line 822
IF (err)
+#line 822
error("%s", nc_strerror(err));
+#line 822
} else {
+#line 822
IF (err != NC_ERANGE)
+#line 822
error("range error: status = %d", err);
+#line 822
}
+#line 822
} else {
+#line 822
IF (nels > 0 && err != NC_ECHAR)
+#line 822
error("wrong type: status = %d", err);
+#line 822
}
+#line 822
}
+#line 822
}
+#line 822
}
+#line 822
+#line 822
err = nc_close(ncid);
+#line 822
IF (err)
+#line 822
error("nc_close: %s", nc_strerror(err));
+#line 822
+#line 822
check_vars_float(scratch);
+#line 822
+#line 822
err = remove(scratch);
+#line 822
IF (err)
+#line 822
error("remove of %s failed", scratch);
+#line 822
}
+#line 822
void
+#line 823
test_nc_put_vars_double(void)
+#line 823
{
+#line 823
int ncid;
+#line 823
int d;
+#line 823
int i;
+#line 823
int j;
+#line 823
int k;
+#line 823
int m;
+#line 823
int err;
+#line 823
int nels;
+#line 823
int nslabs;
+#line 823
int nstarts; /* number of different starts */
+#line 823
size_t start[MAX_RANK];
+#line 823
size_t edge[MAX_RANK];
+#line 823
size_t index[MAX_RANK];
+#line 823
size_t index2[MAX_RANK];
+#line 823
size_t mid[MAX_RANK];
+#line 823
size_t count[MAX_RANK];
+#line 823
size_t sstride[MAX_RANK];
+#line 823
ptrdiff_t stride[MAX_RANK];
+#line 823
int canConvert; /* Both text or both numeric */
+#line 823
int allInExtRange; /* all values within external range? */
+#line 823
double value[MAX_NELS];
+#line 823
+#line 823
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 823
IF (err) {
+#line 823
error("nc_create: %s", nc_strerror(err));
+#line 823
return;
+#line 823
}
+#line 823
def_dims(ncid);
+#line 823
def_vars(ncid);
+#line 823
err = nc_enddef(ncid);
+#line 823
IF (err)
+#line 823
error("nc_enddef: %s", nc_strerror(err));
+#line 823
+#line 823
for (i = 0; i < NVARS; i++) {
+#line 823
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 823
assert(var_rank[i] <= MAX_RANK);
+#line 823
assert(var_nels[i] <= MAX_NELS);
+#line 823
for (j = 0; j < var_rank[i]; j++) {
+#line 823
start[j] = 0;
+#line 823
edge[j] = 1;
+#line 823
stride[j] = 1;
+#line 823
}
+#line 823
err = nc_put_vars_double(BAD_ID, i, start, edge, stride, value);
+#line 823
IF (err != NC_EBADID)
+#line 823
error("bad ncid: status = %d", err);
+#line 823
err = nc_put_vars_double(ncid, BAD_VARID, start, edge, stride, value);
+#line 823
IF (err != NC_ENOTVAR)
+#line 823
error("bad var id: status = %d", err);
+#line 823
for (j = 0; j < var_rank[i]; j++) {
+#line 823
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 823
start[j] = var_shape[i][j] + 1;
+#line 823
err = nc_put_vars_double(ncid, i, start, edge, stride, value);
+#line 823
if(!canConvert) {
+#line 823
IF(err != NC_ECHAR)
+#line 823
error("conversion: status = %d", err);
+#line 823
} else {
+#line 823
IF(err != NC_EINVALCOORDS)
+#line 823
error("bad start: status = %d", err);
+#line 823
start[j] = 0;
+#line 823
edge[j] = var_shape[i][j] + 1;
+#line 823
err = nc_put_vars_double(ncid, i, start, edge, stride, value);
+#line 823
IF (err != NC_EEDGE)
+#line 823
error("bad edge: status = %d", err);
+#line 823
edge[j] = 1;
+#line 823
stride[j] = 0;
+#line 823
err = nc_put_vars_double(ncid, i, start, edge, stride, value);
+#line 823
IF (err != NC_ESTRIDE)
+#line 823
error("bad stride: status = %d", err);
+#line 823
stride[j] = 1;
+#line 823
}
+#line 823
}
+#line 823
}
+#line 823
/* Choose a random point dividing each dim into 2 parts */
+#line 823
/* Put 2^rank (nslabs) slabs so defined */
+#line 823
nslabs = 1;
+#line 823
for (j = 0; j < var_rank[i]; j++) {
+#line 823
mid[j] = roll( var_shape[i][j] );
+#line 823
nslabs *= 2;
+#line 823
}
+#line 823
/* bits of k determine whether to put lower or upper part of dim */
+#line 823
/* choose random stride from 1 to edge */
+#line 823
for (k = 0; k < nslabs; k++) {
+#line 823
nstarts = 1;
+#line 823
for (j = 0; j < var_rank[i]; j++) {
+#line 823
if ((k >> j) & 1) {
+#line 823
start[j] = 0;
+#line 823
edge[j] = mid[j];
+#line 823
}else{
+#line 823
start[j] = mid[j];
+#line 823
edge[j] = var_shape[i][j] - mid[j];
+#line 823
}
+#line 823
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 823
nstarts *= stride[j];
+#line 823
}
+#line 823
for (m = 0; m < nstarts; m++) {
+#line 823
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 823
IF (err)
+#line 823
error("error in toMixedBase");
+#line 823
nels = 1;
+#line 823
for (j = 0; j < var_rank[i]; j++) {
+#line 823
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 823
nels *= count[j];
+#line 823
index[j] += start[j];
+#line 823
}
+#line 823
/* Random choice of forward or backward */
+#line 823
/* TODO
+#line 823
if ( roll(2) ) {
+#line 823
for (j = 0; j < var_rank[i]; j++) {
+#line 823
index[j] += (count[j] - 1) * stride[j];
+#line 823
stride[j] = -stride[j];
+#line 823
}
+#line 823
}
+#line 823
*/
+#line 823
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 823
err = toMixedBase(j, var_rank[i], count, index2);
+#line 823
IF (err)
+#line 823
error("error in toMixedBase");
+#line 823
for (d = 0; d < var_rank[i]; d++)
+#line 823
index2[d] = index[d] + index2[d] * stride[d];
+#line 823
value[j] = hash_double(var_type[i], var_rank[i], index2,
+#line 823
NCT_DOUBLE);
+#line 823
allInExtRange = allInExtRange
+#line 823
&& inRange3(value[j], var_type[i], NCT_DOUBLE);
+#line 823
}
+#line 823
if (var_rank[i] == 0 && i%2 == 0)
+#line 823
err = nc_put_vars_double(ncid, i, NULL, NULL, stride, value);
+#line 823
else
+#line 823
err = nc_put_vars_double(ncid, i, index, count, stride, value);
+#line 823
if (canConvert) {
+#line 823
if (allInExtRange) {
+#line 823
IF (err)
+#line 823
error("%s", nc_strerror(err));
+#line 823
} else {
+#line 823
IF (err != NC_ERANGE)
+#line 823
error("range error: status = %d", err);
+#line 823
}
+#line 823
} else {
+#line 823
IF (nels > 0 && err != NC_ECHAR)
+#line 823
error("wrong type: status = %d", err);
+#line 823
}
+#line 823
}
+#line 823
}
+#line 823
}
+#line 823
+#line 823
err = nc_close(ncid);
+#line 823
IF (err)
+#line 823
error("nc_close: %s", nc_strerror(err));
+#line 823
+#line 823
check_vars_double(scratch);
+#line 823
+#line 823
err = remove(scratch);
+#line 823
IF (err)
+#line 823
error("remove of %s failed", scratch);
+#line 823
}
+#line 823
+#line 996
void
+#line 997
test_nc_put_varm_text(void)
+#line 997
{
+#line 997
int ncid;
+#line 997
int d;
+#line 997
int i;
+#line 997
int j;
+#line 997
int k;
+#line 997
int m;
+#line 997
int err;
+#line 997
int nels;
+#line 997
int nslabs;
+#line 997
int nstarts; /* number of different starts */
+#line 997
size_t start[MAX_RANK];
+#line 997
size_t edge[MAX_RANK];
+#line 997
size_t index[MAX_RANK];
+#line 997
size_t index2[MAX_RANK];
+#line 997
size_t mid[MAX_RANK];
+#line 997
size_t count[MAX_RANK];
+#line 997
size_t sstride[MAX_RANK];
+#line 997
ptrdiff_t stride[MAX_RANK];
+#line 997
ptrdiff_t imap[MAX_RANK];
+#line 997
int canConvert; /* Both text or both numeric */
+#line 997
int allInExtRange; /* all values within external range? */
+#line 997
text value[MAX_NELS];
+#line 997
+#line 997
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 997
IF (err) {
+#line 997
error("nc_create: %s", nc_strerror(err));
+#line 997
return;
+#line 997
}
+#line 997
def_dims(ncid);
+#line 997
def_vars(ncid);
+#line 997
err = nc_enddef(ncid);
+#line 997
IF (err)
+#line 997
error("nc_enddef: %s", nc_strerror(err));
+#line 997
+#line 997
for (i = 0; i < NVARS; i++) {
+#line 997
canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
+#line 997
assert(var_rank[i] <= MAX_RANK);
+#line 997
assert(var_nels[i] <= MAX_NELS);
+#line 997
for (j = 0; j < var_rank[i]; j++) {
+#line 997
start[j] = 0;
+#line 997
edge[j] = 1;
+#line 997
stride[j] = 1;
+#line 997
imap[j] = 1;
+#line 997
}
+#line 997
err = nc_put_varm_text(BAD_ID, i, start, edge, stride, imap, value);
+#line 997
IF (err != NC_EBADID)
+#line 997
error("bad ncid: status = %d", err);
+#line 997
err = nc_put_varm_text(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 997
IF (err != NC_ENOTVAR)
+#line 997
error("bad var id: status = %d", err);
+#line 997
for (j = 0; j < var_rank[i]; j++) {
+#line 997
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 997
start[j] = var_shape[i][j] + 1;
+#line 997
err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
+#line 997
if (!canConvert) {
+#line 997
IF(err != NC_ECHAR)
+#line 997
error("conversion: status = %d", err);
+#line 997
} else {
+#line 997
IF (err != NC_EINVALCOORDS)
+#line 997
error("bad start: status = %d", err);
+#line 997
start[j] = 0;
+#line 997
edge[j] = var_shape[i][j] + 1;
+#line 997
err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
+#line 997
IF (err != NC_EEDGE)
+#line 997
error("bad edge: status = %d", err);
+#line 997
edge[j] = 1;
+#line 997
stride[j] = 0;
+#line 997
err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
+#line 997
IF (err != NC_ESTRIDE)
+#line 997
error("bad stride: status = %d", err);
+#line 997
stride[j] = 1;
+#line 997
}
+#line 997
}
+#line 997
}
+#line 997
/* Choose a random point dividing each dim into 2 parts */
+#line 997
/* Put 2^rank (nslabs) slabs so defined */
+#line 997
nslabs = 1;
+#line 997
for (j = 0; j < var_rank[i]; j++) {
+#line 997
mid[j] = roll( var_shape[i][j] );
+#line 997
nslabs *= 2;
+#line 997
}
+#line 997
/* bits of k determine whether to put lower or upper part of dim */
+#line 997
/* choose random stride from 1 to edge */
+#line 997
for (k = 0; k < nslabs; k++) {
+#line 997
nstarts = 1;
+#line 997
for (j = 0; j < var_rank[i]; j++) {
+#line 997
if ((k >> j) & 1) {
+#line 997
start[j] = 0;
+#line 997
edge[j] = mid[j];
+#line 997
}else{
+#line 997
start[j] = mid[j];
+#line 997
edge[j] = var_shape[i][j] - mid[j];
+#line 997
}
+#line 997
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 997
nstarts *= stride[j];
+#line 997
}
+#line 997
for (m = 0; m < nstarts; m++) {
+#line 997
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 997
IF (err)
+#line 997
error("error in toMixedBase");
+#line 997
nels = 1;
+#line 997
for (j = 0; j < var_rank[i]; j++) {
+#line 997
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 997
nels *= count[j];
+#line 997
index[j] += start[j];
+#line 997
}
+#line 997
/* Random choice of forward or backward */
+#line 997
/* TODO
+#line 997
if ( roll(2) ) {
+#line 997
for (j = 0; j < var_rank[i]; j++) {
+#line 997
index[j] += (count[j] - 1) * stride[j];
+#line 997
stride[j] = -stride[j];
+#line 997
}
+#line 997
}
+#line 997
*/
+#line 997
if (var_rank[i] > 0) {
+#line 997
j = var_rank[i] - 1;
+#line 997
imap[j] = 1;
+#line 997
for (; j > 0; j--)
+#line 997
imap[j-1] = imap[j] * count[j];
+#line 997
}
+#line 997
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 997
err = toMixedBase(j, var_rank[i], count, index2);
+#line 997
IF (err)
+#line 997
error("error in toMixedBase");
+#line 997
for (d = 0; d < var_rank[i]; d++)
+#line 997
index2[d] = index[d] + index2[d] * stride[d];
+#line 997
value[j] = hash_text(var_type[i], var_rank[i], index2,
+#line 997
NCT_TEXT);
+#line 997
allInExtRange = allInExtRange
+#line 997
&& inRange3(value[j], var_type[i], NCT_TEXT);
+#line 997
}
+#line 997
if (var_rank[i] == 0 && i%2 == 0)
+#line 997
err = nc_put_varm_text(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 997
else
+#line 997
err = nc_put_varm_text(ncid,i,index,count,stride,imap,value);
+#line 997
if (canConvert) {
+#line 997
if (allInExtRange) {
+#line 997
IF (err)
+#line 997
error("%s", nc_strerror(err));
+#line 997
} else {
+#line 997
IF (err != NC_ERANGE)
+#line 997
error("range error: status = %d", err);
+#line 997
}
+#line 997
} else {
+#line 997
IF (nels > 0 && err != NC_ECHAR)
+#line 997
error("wrong type: status = %d", err);
+#line 997
}
+#line 997
}
+#line 997
}
+#line 997
}
+#line 997
+#line 997
err = nc_close(ncid);
+#line 997
IF (err)
+#line 997
error("nc_close: %s", nc_strerror(err));
+#line 997
+#line 997
check_vars_text(scratch);
+#line 997
+#line 997
err = remove(scratch);
+#line 997
IF (err)
+#line 997
error("remove of %s failed", scratch);
+#line 997
}
+#line 997
void
+#line 998
test_nc_put_varm_uchar(void)
+#line 998
{
+#line 998
int ncid;
+#line 998
int d;
+#line 998
int i;
+#line 998
int j;
+#line 998
int k;
+#line 998
int m;
+#line 998
int err;
+#line 998
int nels;
+#line 998
int nslabs;
+#line 998
int nstarts; /* number of different starts */
+#line 998
size_t start[MAX_RANK];
+#line 998
size_t edge[MAX_RANK];
+#line 998
size_t index[MAX_RANK];
+#line 998
size_t index2[MAX_RANK];
+#line 998
size_t mid[MAX_RANK];
+#line 998
size_t count[MAX_RANK];
+#line 998
size_t sstride[MAX_RANK];
+#line 998
ptrdiff_t stride[MAX_RANK];
+#line 998
ptrdiff_t imap[MAX_RANK];
+#line 998
int canConvert; /* Both text or both numeric */
+#line 998
int allInExtRange; /* all values within external range? */
+#line 998
uchar value[MAX_NELS];
+#line 998
+#line 998
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 998
IF (err) {
+#line 998
error("nc_create: %s", nc_strerror(err));
+#line 998
return;
+#line 998
}
+#line 998
def_dims(ncid);
+#line 998
def_vars(ncid);
+#line 998
err = nc_enddef(ncid);
+#line 998
IF (err)
+#line 998
error("nc_enddef: %s", nc_strerror(err));
+#line 998
+#line 998
for (i = 0; i < NVARS; i++) {
+#line 998
canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
+#line 998
assert(var_rank[i] <= MAX_RANK);
+#line 998
assert(var_nels[i] <= MAX_NELS);
+#line 998
for (j = 0; j < var_rank[i]; j++) {
+#line 998
start[j] = 0;
+#line 998
edge[j] = 1;
+#line 998
stride[j] = 1;
+#line 998
imap[j] = 1;
+#line 998
}
+#line 998
err = nc_put_varm_uchar(BAD_ID, i, start, edge, stride, imap, value);
+#line 998
IF (err != NC_EBADID)
+#line 998
error("bad ncid: status = %d", err);
+#line 998
err = nc_put_varm_uchar(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 998
IF (err != NC_ENOTVAR)
+#line 998
error("bad var id: status = %d", err);
+#line 998
for (j = 0; j < var_rank[i]; j++) {
+#line 998
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 998
start[j] = var_shape[i][j] + 1;
+#line 998
err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
+#line 998
if (!canConvert) {
+#line 998
IF(err != NC_ECHAR)
+#line 998
error("conversion: status = %d", err);
+#line 998
} else {
+#line 998
IF (err != NC_EINVALCOORDS)
+#line 998
error("bad start: status = %d", err);
+#line 998
start[j] = 0;
+#line 998
edge[j] = var_shape[i][j] + 1;
+#line 998
err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
+#line 998
IF (err != NC_EEDGE)
+#line 998
error("bad edge: status = %d", err);
+#line 998
edge[j] = 1;
+#line 998
stride[j] = 0;
+#line 998
err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
+#line 998
IF (err != NC_ESTRIDE)
+#line 998
error("bad stride: status = %d", err);
+#line 998
stride[j] = 1;
+#line 998
}
+#line 998
}
+#line 998
}
+#line 998
/* Choose a random point dividing each dim into 2 parts */
+#line 998
/* Put 2^rank (nslabs) slabs so defined */
+#line 998
nslabs = 1;
+#line 998
for (j = 0; j < var_rank[i]; j++) {
+#line 998
mid[j] = roll( var_shape[i][j] );
+#line 998
nslabs *= 2;
+#line 998
}
+#line 998
/* bits of k determine whether to put lower or upper part of dim */
+#line 998
/* choose random stride from 1 to edge */
+#line 998
for (k = 0; k < nslabs; k++) {
+#line 998
nstarts = 1;
+#line 998
for (j = 0; j < var_rank[i]; j++) {
+#line 998
if ((k >> j) & 1) {
+#line 998
start[j] = 0;
+#line 998
edge[j] = mid[j];
+#line 998
}else{
+#line 998
start[j] = mid[j];
+#line 998
edge[j] = var_shape[i][j] - mid[j];
+#line 998
}
+#line 998
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 998
nstarts *= stride[j];
+#line 998
}
+#line 998
for (m = 0; m < nstarts; m++) {
+#line 998
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 998
IF (err)
+#line 998
error("error in toMixedBase");
+#line 998
nels = 1;
+#line 998
for (j = 0; j < var_rank[i]; j++) {
+#line 998
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 998
nels *= count[j];
+#line 998
index[j] += start[j];
+#line 998
}
+#line 998
/* Random choice of forward or backward */
+#line 998
/* TODO
+#line 998
if ( roll(2) ) {
+#line 998
for (j = 0; j < var_rank[i]; j++) {
+#line 998
index[j] += (count[j] - 1) * stride[j];
+#line 998
stride[j] = -stride[j];
+#line 998
}
+#line 998
}
+#line 998
*/
+#line 998
if (var_rank[i] > 0) {
+#line 998
j = var_rank[i] - 1;
+#line 998
imap[j] = 1;
+#line 998
for (; j > 0; j--)
+#line 998
imap[j-1] = imap[j] * count[j];
+#line 998
}
+#line 998
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 998
err = toMixedBase(j, var_rank[i], count, index2);
+#line 998
IF (err)
+#line 998
error("error in toMixedBase");
+#line 998
for (d = 0; d < var_rank[i]; d++)
+#line 998
index2[d] = index[d] + index2[d] * stride[d];
+#line 998
value[j] = hash_uchar(var_type[i], var_rank[i], index2,
+#line 998
NCT_UCHAR);
+#line 998
allInExtRange = allInExtRange
+#line 998
&& inRange3(value[j], var_type[i], NCT_UCHAR);
+#line 998
}
+#line 998
if (var_rank[i] == 0 && i%2 == 0)
+#line 998
err = nc_put_varm_uchar(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 998
else
+#line 998
err = nc_put_varm_uchar(ncid,i,index,count,stride,imap,value);
+#line 998
if (canConvert) {
+#line 998
if (allInExtRange) {
+#line 998
IF (err)
+#line 998
error("%s", nc_strerror(err));
+#line 998
} else {
+#line 998
IF (err != NC_ERANGE)
+#line 998
error("range error: status = %d", err);
+#line 998
}
+#line 998
} else {
+#line 998
IF (nels > 0 && err != NC_ECHAR)
+#line 998
error("wrong type: status = %d", err);
+#line 998
}
+#line 998
}
+#line 998
}
+#line 998
}
+#line 998
+#line 998
err = nc_close(ncid);
+#line 998
IF (err)
+#line 998
error("nc_close: %s", nc_strerror(err));
+#line 998
+#line 998
check_vars_uchar(scratch);
+#line 998
+#line 998
err = remove(scratch);
+#line 998
IF (err)
+#line 998
error("remove of %s failed", scratch);
+#line 998
}
+#line 998
void
+#line 999
test_nc_put_varm_schar(void)
+#line 999
{
+#line 999
int ncid;
+#line 999
int d;
+#line 999
int i;
+#line 999
int j;
+#line 999
int k;
+#line 999
int m;
+#line 999
int err;
+#line 999
int nels;
+#line 999
int nslabs;
+#line 999
int nstarts; /* number of different starts */
+#line 999
size_t start[MAX_RANK];
+#line 999
size_t edge[MAX_RANK];
+#line 999
size_t index[MAX_RANK];
+#line 999
size_t index2[MAX_RANK];
+#line 999
size_t mid[MAX_RANK];
+#line 999
size_t count[MAX_RANK];
+#line 999
size_t sstride[MAX_RANK];
+#line 999
ptrdiff_t stride[MAX_RANK];
+#line 999
ptrdiff_t imap[MAX_RANK];
+#line 999
int canConvert; /* Both text or both numeric */
+#line 999
int allInExtRange; /* all values within external range? */
+#line 999
schar value[MAX_NELS];
+#line 999
+#line 999
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 999
IF (err) {
+#line 999
error("nc_create: %s", nc_strerror(err));
+#line 999
return;
+#line 999
}
+#line 999
def_dims(ncid);
+#line 999
def_vars(ncid);
+#line 999
err = nc_enddef(ncid);
+#line 999
IF (err)
+#line 999
error("nc_enddef: %s", nc_strerror(err));
+#line 999
+#line 999
for (i = 0; i < NVARS; i++) {
+#line 999
canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
+#line 999
assert(var_rank[i] <= MAX_RANK);
+#line 999
assert(var_nels[i] <= MAX_NELS);
+#line 999
for (j = 0; j < var_rank[i]; j++) {
+#line 999
start[j] = 0;
+#line 999
edge[j] = 1;
+#line 999
stride[j] = 1;
+#line 999
imap[j] = 1;
+#line 999
}
+#line 999
err = nc_put_varm_schar(BAD_ID, i, start, edge, stride, imap, value);
+#line 999
IF (err != NC_EBADID)
+#line 999
error("bad ncid: status = %d", err);
+#line 999
err = nc_put_varm_schar(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 999
IF (err != NC_ENOTVAR)
+#line 999
error("bad var id: status = %d", err);
+#line 999
for (j = 0; j < var_rank[i]; j++) {
+#line 999
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 999
start[j] = var_shape[i][j] + 1;
+#line 999
err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
+#line 999
if (!canConvert) {
+#line 999
IF(err != NC_ECHAR)
+#line 999
error("conversion: status = %d", err);
+#line 999
} else {
+#line 999
IF (err != NC_EINVALCOORDS)
+#line 999
error("bad start: status = %d", err);
+#line 999
start[j] = 0;
+#line 999
edge[j] = var_shape[i][j] + 1;
+#line 999
err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
+#line 999
IF (err != NC_EEDGE)
+#line 999
error("bad edge: status = %d", err);
+#line 999
edge[j] = 1;
+#line 999
stride[j] = 0;
+#line 999
err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
+#line 999
IF (err != NC_ESTRIDE)
+#line 999
error("bad stride: status = %d", err);
+#line 999
stride[j] = 1;
+#line 999
}
+#line 999
}
+#line 999
}
+#line 999
/* Choose a random point dividing each dim into 2 parts */
+#line 999
/* Put 2^rank (nslabs) slabs so defined */
+#line 999
nslabs = 1;
+#line 999
for (j = 0; j < var_rank[i]; j++) {
+#line 999
mid[j] = roll( var_shape[i][j] );
+#line 999
nslabs *= 2;
+#line 999
}
+#line 999
/* bits of k determine whether to put lower or upper part of dim */
+#line 999
/* choose random stride from 1 to edge */
+#line 999
for (k = 0; k < nslabs; k++) {
+#line 999
nstarts = 1;
+#line 999
for (j = 0; j < var_rank[i]; j++) {
+#line 999
if ((k >> j) & 1) {
+#line 999
start[j] = 0;
+#line 999
edge[j] = mid[j];
+#line 999
}else{
+#line 999
start[j] = mid[j];
+#line 999
edge[j] = var_shape[i][j] - mid[j];
+#line 999
}
+#line 999
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 999
nstarts *= stride[j];
+#line 999
}
+#line 999
for (m = 0; m < nstarts; m++) {
+#line 999
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 999
IF (err)
+#line 999
error("error in toMixedBase");
+#line 999
nels = 1;
+#line 999
for (j = 0; j < var_rank[i]; j++) {
+#line 999
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 999
nels *= count[j];
+#line 999
index[j] += start[j];
+#line 999
}
+#line 999
/* Random choice of forward or backward */
+#line 999
/* TODO
+#line 999
if ( roll(2) ) {
+#line 999
for (j = 0; j < var_rank[i]; j++) {
+#line 999
index[j] += (count[j] - 1) * stride[j];
+#line 999
stride[j] = -stride[j];
+#line 999
}
+#line 999
}
+#line 999
*/
+#line 999
if (var_rank[i] > 0) {
+#line 999
j = var_rank[i] - 1;
+#line 999
imap[j] = 1;
+#line 999
for (; j > 0; j--)
+#line 999
imap[j-1] = imap[j] * count[j];
+#line 999
}
+#line 999
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 999
err = toMixedBase(j, var_rank[i], count, index2);
+#line 999
IF (err)
+#line 999
error("error in toMixedBase");
+#line 999
for (d = 0; d < var_rank[i]; d++)
+#line 999
index2[d] = index[d] + index2[d] * stride[d];
+#line 999
value[j] = hash_schar(var_type[i], var_rank[i], index2,
+#line 999
NCT_SCHAR);
+#line 999
allInExtRange = allInExtRange
+#line 999
&& inRange3(value[j], var_type[i], NCT_SCHAR);
+#line 999
}
+#line 999
if (var_rank[i] == 0 && i%2 == 0)
+#line 999
err = nc_put_varm_schar(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 999
else
+#line 999
err = nc_put_varm_schar(ncid,i,index,count,stride,imap,value);
+#line 999
if (canConvert) {
+#line 999
if (allInExtRange) {
+#line 999
IF (err)
+#line 999
error("%s", nc_strerror(err));
+#line 999
} else {
+#line 999
IF (err != NC_ERANGE)
+#line 999
error("range error: status = %d", err);
+#line 999
}
+#line 999
} else {
+#line 999
IF (nels > 0 && err != NC_ECHAR)
+#line 999
error("wrong type: status = %d", err);
+#line 999
}
+#line 999
}
+#line 999
}
+#line 999
}
+#line 999
+#line 999
err = nc_close(ncid);
+#line 999
IF (err)
+#line 999
error("nc_close: %s", nc_strerror(err));
+#line 999
+#line 999
check_vars_schar(scratch);
+#line 999
+#line 999
err = remove(scratch);
+#line 999
IF (err)
+#line 999
error("remove of %s failed", scratch);
+#line 999
}
+#line 999
void
+#line 1000
test_nc_put_varm_short(void)
+#line 1000
{
+#line 1000
int ncid;
+#line 1000
int d;
+#line 1000
int i;
+#line 1000
int j;
+#line 1000
int k;
+#line 1000
int m;
+#line 1000
int err;
+#line 1000
int nels;
+#line 1000
int nslabs;
+#line 1000
int nstarts; /* number of different starts */
+#line 1000
size_t start[MAX_RANK];
+#line 1000
size_t edge[MAX_RANK];
+#line 1000
size_t index[MAX_RANK];
+#line 1000
size_t index2[MAX_RANK];
+#line 1000
size_t mid[MAX_RANK];
+#line 1000
size_t count[MAX_RANK];
+#line 1000
size_t sstride[MAX_RANK];
+#line 1000
ptrdiff_t stride[MAX_RANK];
+#line 1000
ptrdiff_t imap[MAX_RANK];
+#line 1000
int canConvert; /* Both text or both numeric */
+#line 1000
int allInExtRange; /* all values within external range? */
+#line 1000
short value[MAX_NELS];
+#line 1000
+#line 1000
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 1000
IF (err) {
+#line 1000
error("nc_create: %s", nc_strerror(err));
+#line 1000
return;
+#line 1000
}
+#line 1000
def_dims(ncid);
+#line 1000
def_vars(ncid);
+#line 1000
err = nc_enddef(ncid);
+#line 1000
IF (err)
+#line 1000
error("nc_enddef: %s", nc_strerror(err));
+#line 1000
+#line 1000
for (i = 0; i < NVARS; i++) {
+#line 1000
canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
+#line 1000
assert(var_rank[i] <= MAX_RANK);
+#line 1000
assert(var_nels[i] <= MAX_NELS);
+#line 1000
for (j = 0; j < var_rank[i]; j++) {
+#line 1000
start[j] = 0;
+#line 1000
edge[j] = 1;
+#line 1000
stride[j] = 1;
+#line 1000
imap[j] = 1;
+#line 1000
}
+#line 1000
err = nc_put_varm_short(BAD_ID, i, start, edge, stride, imap, value);
+#line 1000
IF (err != NC_EBADID)
+#line 1000
error("bad ncid: status = %d", err);
+#line 1000
err = nc_put_varm_short(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 1000
IF (err != NC_ENOTVAR)
+#line 1000
error("bad var id: status = %d", err);
+#line 1000
for (j = 0; j < var_rank[i]; j++) {
+#line 1000
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 1000
start[j] = var_shape[i][j] + 1;
+#line 1000
err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
+#line 1000
if (!canConvert) {
+#line 1000
IF(err != NC_ECHAR)
+#line 1000
error("conversion: status = %d", err);
+#line 1000
} else {
+#line 1000
IF (err != NC_EINVALCOORDS)
+#line 1000
error("bad start: status = %d", err);
+#line 1000
start[j] = 0;
+#line 1000
edge[j] = var_shape[i][j] + 1;
+#line 1000
err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
+#line 1000
IF (err != NC_EEDGE)
+#line 1000
error("bad edge: status = %d", err);
+#line 1000
edge[j] = 1;
+#line 1000
stride[j] = 0;
+#line 1000
err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
+#line 1000
IF (err != NC_ESTRIDE)
+#line 1000
error("bad stride: status = %d", err);
+#line 1000
stride[j] = 1;
+#line 1000
}
+#line 1000
}
+#line 1000
}
+#line 1000
/* Choose a random point dividing each dim into 2 parts */
+#line 1000
/* Put 2^rank (nslabs) slabs so defined */
+#line 1000
nslabs = 1;
+#line 1000
for (j = 0; j < var_rank[i]; j++) {
+#line 1000
mid[j] = roll( var_shape[i][j] );
+#line 1000
nslabs *= 2;
+#line 1000
}
+#line 1000
/* bits of k determine whether to put lower or upper part of dim */
+#line 1000
/* choose random stride from 1 to edge */
+#line 1000
for (k = 0; k < nslabs; k++) {
+#line 1000
nstarts = 1;
+#line 1000
for (j = 0; j < var_rank[i]; j++) {
+#line 1000
if ((k >> j) & 1) {
+#line 1000
start[j] = 0;
+#line 1000
edge[j] = mid[j];
+#line 1000
}else{
+#line 1000
start[j] = mid[j];
+#line 1000
edge[j] = var_shape[i][j] - mid[j];
+#line 1000
}
+#line 1000
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 1000
nstarts *= stride[j];
+#line 1000
}
+#line 1000
for (m = 0; m < nstarts; m++) {
+#line 1000
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 1000
IF (err)
+#line 1000
error("error in toMixedBase");
+#line 1000
nels = 1;
+#line 1000
for (j = 0; j < var_rank[i]; j++) {
+#line 1000
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 1000
nels *= count[j];
+#line 1000
index[j] += start[j];
+#line 1000
}
+#line 1000
/* Random choice of forward or backward */
+#line 1000
/* TODO
+#line 1000
if ( roll(2) ) {
+#line 1000
for (j = 0; j < var_rank[i]; j++) {
+#line 1000
index[j] += (count[j] - 1) * stride[j];
+#line 1000
stride[j] = -stride[j];
+#line 1000
}
+#line 1000
}
+#line 1000
*/
+#line 1000
if (var_rank[i] > 0) {
+#line 1000
j = var_rank[i] - 1;
+#line 1000
imap[j] = 1;
+#line 1000
for (; j > 0; j--)
+#line 1000
imap[j-1] = imap[j] * count[j];
+#line 1000
}
+#line 1000
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 1000
err = toMixedBase(j, var_rank[i], count, index2);
+#line 1000
IF (err)
+#line 1000
error("error in toMixedBase");
+#line 1000
for (d = 0; d < var_rank[i]; d++)
+#line 1000
index2[d] = index[d] + index2[d] * stride[d];
+#line 1000
value[j] = hash_short(var_type[i], var_rank[i], index2,
+#line 1000
NCT_SHORT);
+#line 1000
allInExtRange = allInExtRange
+#line 1000
&& inRange3(value[j], var_type[i], NCT_SHORT);
+#line 1000
}
+#line 1000
if (var_rank[i] == 0 && i%2 == 0)
+#line 1000
err = nc_put_varm_short(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 1000
else
+#line 1000
err = nc_put_varm_short(ncid,i,index,count,stride,imap,value);
+#line 1000
if (canConvert) {
+#line 1000
if (allInExtRange) {
+#line 1000
IF (err)
+#line 1000
error("%s", nc_strerror(err));
+#line 1000
} else {
+#line 1000
IF (err != NC_ERANGE)
+#line 1000
error("range error: status = %d", err);
+#line 1000
}
+#line 1000
} else {
+#line 1000
IF (nels > 0 && err != NC_ECHAR)
+#line 1000
error("wrong type: status = %d", err);
+#line 1000
}
+#line 1000
}
+#line 1000
}
+#line 1000
}
+#line 1000
+#line 1000
err = nc_close(ncid);
+#line 1000
IF (err)
+#line 1000
error("nc_close: %s", nc_strerror(err));
+#line 1000
+#line 1000
check_vars_short(scratch);
+#line 1000
+#line 1000
err = remove(scratch);
+#line 1000
IF (err)
+#line 1000
error("remove of %s failed", scratch);
+#line 1000
}
+#line 1000
void
+#line 1001
test_nc_put_varm_int(void)
+#line 1001
{
+#line 1001
int ncid;
+#line 1001
int d;
+#line 1001
int i;
+#line 1001
int j;
+#line 1001
int k;
+#line 1001
int m;
+#line 1001
int err;
+#line 1001
int nels;
+#line 1001
int nslabs;
+#line 1001
int nstarts; /* number of different starts */
+#line 1001
size_t start[MAX_RANK];
+#line 1001
size_t edge[MAX_RANK];
+#line 1001
size_t index[MAX_RANK];
+#line 1001
size_t index2[MAX_RANK];
+#line 1001
size_t mid[MAX_RANK];
+#line 1001
size_t count[MAX_RANK];
+#line 1001
size_t sstride[MAX_RANK];
+#line 1001
ptrdiff_t stride[MAX_RANK];
+#line 1001
ptrdiff_t imap[MAX_RANK];
+#line 1001
int canConvert; /* Both text or both numeric */
+#line 1001
int allInExtRange; /* all values within external range? */
+#line 1001
int value[MAX_NELS];
+#line 1001
+#line 1001
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 1001
IF (err) {
+#line 1001
error("nc_create: %s", nc_strerror(err));
+#line 1001
return;
+#line 1001
}
+#line 1001
def_dims(ncid);
+#line 1001
def_vars(ncid);
+#line 1001
err = nc_enddef(ncid);
+#line 1001
IF (err)
+#line 1001
error("nc_enddef: %s", nc_strerror(err));
+#line 1001
+#line 1001
for (i = 0; i < NVARS; i++) {
+#line 1001
canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
+#line 1001
assert(var_rank[i] <= MAX_RANK);
+#line 1001
assert(var_nels[i] <= MAX_NELS);
+#line 1001
for (j = 0; j < var_rank[i]; j++) {
+#line 1001
start[j] = 0;
+#line 1001
edge[j] = 1;
+#line 1001
stride[j] = 1;
+#line 1001
imap[j] = 1;
+#line 1001
}
+#line 1001
err = nc_put_varm_int(BAD_ID, i, start, edge, stride, imap, value);
+#line 1001
IF (err != NC_EBADID)
+#line 1001
error("bad ncid: status = %d", err);
+#line 1001
err = nc_put_varm_int(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 1001
IF (err != NC_ENOTVAR)
+#line 1001
error("bad var id: status = %d", err);
+#line 1001
for (j = 0; j < var_rank[i]; j++) {
+#line 1001
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 1001
start[j] = var_shape[i][j] + 1;
+#line 1001
err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
+#line 1001
if (!canConvert) {
+#line 1001
IF(err != NC_ECHAR)
+#line 1001
error("conversion: status = %d", err);
+#line 1001
} else {
+#line 1001
IF (err != NC_EINVALCOORDS)
+#line 1001
error("bad start: status = %d", err);
+#line 1001
start[j] = 0;
+#line 1001
edge[j] = var_shape[i][j] + 1;
+#line 1001
err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
+#line 1001
IF (err != NC_EEDGE)
+#line 1001
error("bad edge: status = %d", err);
+#line 1001
edge[j] = 1;
+#line 1001
stride[j] = 0;
+#line 1001
err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
+#line 1001
IF (err != NC_ESTRIDE)
+#line 1001
error("bad stride: status = %d", err);
+#line 1001
stride[j] = 1;
+#line 1001
}
+#line 1001
}
+#line 1001
}
+#line 1001
/* Choose a random point dividing each dim into 2 parts */
+#line 1001
/* Put 2^rank (nslabs) slabs so defined */
+#line 1001
nslabs = 1;
+#line 1001
for (j = 0; j < var_rank[i]; j++) {
+#line 1001
mid[j] = roll( var_shape[i][j] );
+#line 1001
nslabs *= 2;
+#line 1001
}
+#line 1001
/* bits of k determine whether to put lower or upper part of dim */
+#line 1001
/* choose random stride from 1 to edge */
+#line 1001
for (k = 0; k < nslabs; k++) {
+#line 1001
nstarts = 1;
+#line 1001
for (j = 0; j < var_rank[i]; j++) {
+#line 1001
if ((k >> j) & 1) {
+#line 1001
start[j] = 0;
+#line 1001
edge[j] = mid[j];
+#line 1001
}else{
+#line 1001
start[j] = mid[j];
+#line 1001
edge[j] = var_shape[i][j] - mid[j];
+#line 1001
}
+#line 1001
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 1001
nstarts *= stride[j];
+#line 1001
}
+#line 1001
for (m = 0; m < nstarts; m++) {
+#line 1001
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 1001
IF (err)
+#line 1001
error("error in toMixedBase");
+#line 1001
nels = 1;
+#line 1001
for (j = 0; j < var_rank[i]; j++) {
+#line 1001
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 1001
nels *= count[j];
+#line 1001
index[j] += start[j];
+#line 1001
}
+#line 1001
/* Random choice of forward or backward */
+#line 1001
/* TODO
+#line 1001
if ( roll(2) ) {
+#line 1001
for (j = 0; j < var_rank[i]; j++) {
+#line 1001
index[j] += (count[j] - 1) * stride[j];
+#line 1001
stride[j] = -stride[j];
+#line 1001
}
+#line 1001
}
+#line 1001
*/
+#line 1001
if (var_rank[i] > 0) {
+#line 1001
j = var_rank[i] - 1;
+#line 1001
imap[j] = 1;
+#line 1001
for (; j > 0; j--)
+#line 1001
imap[j-1] = imap[j] * count[j];
+#line 1001
}
+#line 1001
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 1001
err = toMixedBase(j, var_rank[i], count, index2);
+#line 1001
IF (err)
+#line 1001
error("error in toMixedBase");
+#line 1001
for (d = 0; d < var_rank[i]; d++)
+#line 1001
index2[d] = index[d] + index2[d] * stride[d];
+#line 1001
value[j] = hash_int(var_type[i], var_rank[i], index2,
+#line 1001
NCT_INT);
+#line 1001
allInExtRange = allInExtRange
+#line 1001
&& inRange3(value[j], var_type[i], NCT_INT);
+#line 1001
}
+#line 1001
if (var_rank[i] == 0 && i%2 == 0)
+#line 1001
err = nc_put_varm_int(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 1001
else
+#line 1001
err = nc_put_varm_int(ncid,i,index,count,stride,imap,value);
+#line 1001
if (canConvert) {
+#line 1001
if (allInExtRange) {
+#line 1001
IF (err)
+#line 1001
error("%s", nc_strerror(err));
+#line 1001
} else {
+#line 1001
IF (err != NC_ERANGE)
+#line 1001
error("range error: status = %d", err);
+#line 1001
}
+#line 1001
} else {
+#line 1001
IF (nels > 0 && err != NC_ECHAR)
+#line 1001
error("wrong type: status = %d", err);
+#line 1001
}
+#line 1001
}
+#line 1001
}
+#line 1001
}
+#line 1001
+#line 1001
err = nc_close(ncid);
+#line 1001
IF (err)
+#line 1001
error("nc_close: %s", nc_strerror(err));
+#line 1001
+#line 1001
check_vars_int(scratch);
+#line 1001
+#line 1001
err = remove(scratch);
+#line 1001
IF (err)
+#line 1001
error("remove of %s failed", scratch);
+#line 1001
}
+#line 1001
void
+#line 1002
test_nc_put_varm_long(void)
+#line 1002
{
+#line 1002
int ncid;
+#line 1002
int d;
+#line 1002
int i;
+#line 1002
int j;
+#line 1002
int k;
+#line 1002
int m;
+#line 1002
int err;
+#line 1002
int nels;
+#line 1002
int nslabs;
+#line 1002
int nstarts; /* number of different starts */
+#line 1002
size_t start[MAX_RANK];
+#line 1002
size_t edge[MAX_RANK];
+#line 1002
size_t index[MAX_RANK];
+#line 1002
size_t index2[MAX_RANK];
+#line 1002
size_t mid[MAX_RANK];
+#line 1002
size_t count[MAX_RANK];
+#line 1002
size_t sstride[MAX_RANK];
+#line 1002
ptrdiff_t stride[MAX_RANK];
+#line 1002
ptrdiff_t imap[MAX_RANK];
+#line 1002
int canConvert; /* Both text or both numeric */
+#line 1002
int allInExtRange; /* all values within external range? */
+#line 1002
long value[MAX_NELS];
+#line 1002
+#line 1002
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 1002
IF (err) {
+#line 1002
error("nc_create: %s", nc_strerror(err));
+#line 1002
return;
+#line 1002
}
+#line 1002
def_dims(ncid);
+#line 1002
def_vars(ncid);
+#line 1002
err = nc_enddef(ncid);
+#line 1002
IF (err)
+#line 1002
error("nc_enddef: %s", nc_strerror(err));
+#line 1002
+#line 1002
for (i = 0; i < NVARS; i++) {
+#line 1002
canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
+#line 1002
assert(var_rank[i] <= MAX_RANK);
+#line 1002
assert(var_nels[i] <= MAX_NELS);
+#line 1002
for (j = 0; j < var_rank[i]; j++) {
+#line 1002
start[j] = 0;
+#line 1002
edge[j] = 1;
+#line 1002
stride[j] = 1;
+#line 1002
imap[j] = 1;
+#line 1002
}
+#line 1002
err = nc_put_varm_long(BAD_ID, i, start, edge, stride, imap, value);
+#line 1002
IF (err != NC_EBADID)
+#line 1002
error("bad ncid: status = %d", err);
+#line 1002
err = nc_put_varm_long(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 1002
IF (err != NC_ENOTVAR)
+#line 1002
error("bad var id: status = %d", err);
+#line 1002
for (j = 0; j < var_rank[i]; j++) {
+#line 1002
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 1002
start[j] = var_shape[i][j] + 1;
+#line 1002
err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
+#line 1002
if (!canConvert) {
+#line 1002
IF(err != NC_ECHAR)
+#line 1002
error("conversion: status = %d", err);
+#line 1002
} else {
+#line 1002
IF (err != NC_EINVALCOORDS)
+#line 1002
error("bad start: status = %d", err);
+#line 1002
start[j] = 0;
+#line 1002
edge[j] = var_shape[i][j] + 1;
+#line 1002
err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
+#line 1002
IF (err != NC_EEDGE)
+#line 1002
error("bad edge: status = %d", err);
+#line 1002
edge[j] = 1;
+#line 1002
stride[j] = 0;
+#line 1002
err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
+#line 1002
IF (err != NC_ESTRIDE)
+#line 1002
error("bad stride: status = %d", err);
+#line 1002
stride[j] = 1;
+#line 1002
}
+#line 1002
}
+#line 1002
}
+#line 1002
/* Choose a random point dividing each dim into 2 parts */
+#line 1002
/* Put 2^rank (nslabs) slabs so defined */
+#line 1002
nslabs = 1;
+#line 1002
for (j = 0; j < var_rank[i]; j++) {
+#line 1002
mid[j] = roll( var_shape[i][j] );
+#line 1002
nslabs *= 2;
+#line 1002
}
+#line 1002
/* bits of k determine whether to put lower or upper part of dim */
+#line 1002
/* choose random stride from 1 to edge */
+#line 1002
for (k = 0; k < nslabs; k++) {
+#line 1002
nstarts = 1;
+#line 1002
for (j = 0; j < var_rank[i]; j++) {
+#line 1002
if ((k >> j) & 1) {
+#line 1002
start[j] = 0;
+#line 1002
edge[j] = mid[j];
+#line 1002
}else{
+#line 1002
start[j] = mid[j];
+#line 1002
edge[j] = var_shape[i][j] - mid[j];
+#line 1002
}
+#line 1002
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 1002
nstarts *= stride[j];
+#line 1002
}
+#line 1002
for (m = 0; m < nstarts; m++) {
+#line 1002
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 1002
IF (err)
+#line 1002
error("error in toMixedBase");
+#line 1002
nels = 1;
+#line 1002
for (j = 0; j < var_rank[i]; j++) {
+#line 1002
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 1002
nels *= count[j];
+#line 1002
index[j] += start[j];
+#line 1002
}
+#line 1002
/* Random choice of forward or backward */
+#line 1002
/* TODO
+#line 1002
if ( roll(2) ) {
+#line 1002
for (j = 0; j < var_rank[i]; j++) {
+#line 1002
index[j] += (count[j] - 1) * stride[j];
+#line 1002
stride[j] = -stride[j];
+#line 1002
}
+#line 1002
}
+#line 1002
*/
+#line 1002
if (var_rank[i] > 0) {
+#line 1002
j = var_rank[i] - 1;
+#line 1002
imap[j] = 1;
+#line 1002
for (; j > 0; j--)
+#line 1002
imap[j-1] = imap[j] * count[j];
+#line 1002
}
+#line 1002
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 1002
err = toMixedBase(j, var_rank[i], count, index2);
+#line 1002
IF (err)
+#line 1002
error("error in toMixedBase");
+#line 1002
for (d = 0; d < var_rank[i]; d++)
+#line 1002
index2[d] = index[d] + index2[d] * stride[d];
+#line 1002
value[j] = hash_long(var_type[i], var_rank[i], index2,
+#line 1002
NCT_LONG);
+#line 1002
allInExtRange = allInExtRange
+#line 1002
&& inRange3(value[j], var_type[i], NCT_LONG);
+#line 1002
}
+#line 1002
if (var_rank[i] == 0 && i%2 == 0)
+#line 1002
err = nc_put_varm_long(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 1002
else
+#line 1002
err = nc_put_varm_long(ncid,i,index,count,stride,imap,value);
+#line 1002
if (canConvert) {
+#line 1002
if (allInExtRange) {
+#line 1002
IF (err)
+#line 1002
error("%s", nc_strerror(err));
+#line 1002
} else {
+#line 1002
IF (err != NC_ERANGE)
+#line 1002
error("range error: status = %d", err);
+#line 1002
}
+#line 1002
} else {
+#line 1002
IF (nels > 0 && err != NC_ECHAR)
+#line 1002
error("wrong type: status = %d", err);
+#line 1002
}
+#line 1002
}
+#line 1002
}
+#line 1002
}
+#line 1002
+#line 1002
err = nc_close(ncid);
+#line 1002
IF (err)
+#line 1002
error("nc_close: %s", nc_strerror(err));
+#line 1002
+#line 1002
check_vars_long(scratch);
+#line 1002
+#line 1002
err = remove(scratch);
+#line 1002
IF (err)
+#line 1002
error("remove of %s failed", scratch);
+#line 1002
}
+#line 1002
void
+#line 1003
test_nc_put_varm_float(void)
+#line 1003
{
+#line 1003
int ncid;
+#line 1003
int d;
+#line 1003
int i;
+#line 1003
int j;
+#line 1003
int k;
+#line 1003
int m;
+#line 1003
int err;
+#line 1003
int nels;
+#line 1003
int nslabs;
+#line 1003
int nstarts; /* number of different starts */
+#line 1003
size_t start[MAX_RANK];
+#line 1003
size_t edge[MAX_RANK];
+#line 1003
size_t index[MAX_RANK];
+#line 1003
size_t index2[MAX_RANK];
+#line 1003
size_t mid[MAX_RANK];
+#line 1003
size_t count[MAX_RANK];
+#line 1003
size_t sstride[MAX_RANK];
+#line 1003
ptrdiff_t stride[MAX_RANK];
+#line 1003
ptrdiff_t imap[MAX_RANK];
+#line 1003
int canConvert; /* Both text or both numeric */
+#line 1003
int allInExtRange; /* all values within external range? */
+#line 1003
float value[MAX_NELS];
+#line 1003
+#line 1003
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 1003
IF (err) {
+#line 1003
error("nc_create: %s", nc_strerror(err));
+#line 1003
return;
+#line 1003
}
+#line 1003
def_dims(ncid);
+#line 1003
def_vars(ncid);
+#line 1003
err = nc_enddef(ncid);
+#line 1003
IF (err)
+#line 1003
error("nc_enddef: %s", nc_strerror(err));
+#line 1003
+#line 1003
for (i = 0; i < NVARS; i++) {
+#line 1003
canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
+#line 1003
assert(var_rank[i] <= MAX_RANK);
+#line 1003
assert(var_nels[i] <= MAX_NELS);
+#line 1003
for (j = 0; j < var_rank[i]; j++) {
+#line 1003
start[j] = 0;
+#line 1003
edge[j] = 1;
+#line 1003
stride[j] = 1;
+#line 1003
imap[j] = 1;
+#line 1003
}
+#line 1003
err = nc_put_varm_float(BAD_ID, i, start, edge, stride, imap, value);
+#line 1003
IF (err != NC_EBADID)
+#line 1003
error("bad ncid: status = %d", err);
+#line 1003
err = nc_put_varm_float(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 1003
IF (err != NC_ENOTVAR)
+#line 1003
error("bad var id: status = %d", err);
+#line 1003
for (j = 0; j < var_rank[i]; j++) {
+#line 1003
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 1003
start[j] = var_shape[i][j] + 1;
+#line 1003
err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
+#line 1003
if (!canConvert) {
+#line 1003
IF(err != NC_ECHAR)
+#line 1003
error("conversion: status = %d", err);
+#line 1003
} else {
+#line 1003
IF (err != NC_EINVALCOORDS)
+#line 1003
error("bad start: status = %d", err);
+#line 1003
start[j] = 0;
+#line 1003
edge[j] = var_shape[i][j] + 1;
+#line 1003
err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
+#line 1003
IF (err != NC_EEDGE)
+#line 1003
error("bad edge: status = %d", err);
+#line 1003
edge[j] = 1;
+#line 1003
stride[j] = 0;
+#line 1003
err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
+#line 1003
IF (err != NC_ESTRIDE)
+#line 1003
error("bad stride: status = %d", err);
+#line 1003
stride[j] = 1;
+#line 1003
}
+#line 1003
}
+#line 1003
}
+#line 1003
/* Choose a random point dividing each dim into 2 parts */
+#line 1003
/* Put 2^rank (nslabs) slabs so defined */
+#line 1003
nslabs = 1;
+#line 1003
for (j = 0; j < var_rank[i]; j++) {
+#line 1003
mid[j] = roll( var_shape[i][j] );
+#line 1003
nslabs *= 2;
+#line 1003
}
+#line 1003
/* bits of k determine whether to put lower or upper part of dim */
+#line 1003
/* choose random stride from 1 to edge */
+#line 1003
for (k = 0; k < nslabs; k++) {
+#line 1003
nstarts = 1;
+#line 1003
for (j = 0; j < var_rank[i]; j++) {
+#line 1003
if ((k >> j) & 1) {
+#line 1003
start[j] = 0;
+#line 1003
edge[j] = mid[j];
+#line 1003
}else{
+#line 1003
start[j] = mid[j];
+#line 1003
edge[j] = var_shape[i][j] - mid[j];
+#line 1003
}
+#line 1003
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 1003
nstarts *= stride[j];
+#line 1003
}
+#line 1003
for (m = 0; m < nstarts; m++) {
+#line 1003
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 1003
IF (err)
+#line 1003
error("error in toMixedBase");
+#line 1003
nels = 1;
+#line 1003
for (j = 0; j < var_rank[i]; j++) {
+#line 1003
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 1003
nels *= count[j];
+#line 1003
index[j] += start[j];
+#line 1003
}
+#line 1003
/* Random choice of forward or backward */
+#line 1003
/* TODO
+#line 1003
if ( roll(2) ) {
+#line 1003
for (j = 0; j < var_rank[i]; j++) {
+#line 1003
index[j] += (count[j] - 1) * stride[j];
+#line 1003
stride[j] = -stride[j];
+#line 1003
}
+#line 1003
}
+#line 1003
*/
+#line 1003
if (var_rank[i] > 0) {
+#line 1003
j = var_rank[i] - 1;
+#line 1003
imap[j] = 1;
+#line 1003
for (; j > 0; j--)
+#line 1003
imap[j-1] = imap[j] * count[j];
+#line 1003
}
+#line 1003
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 1003
err = toMixedBase(j, var_rank[i], count, index2);
+#line 1003
IF (err)
+#line 1003
error("error in toMixedBase");
+#line 1003
for (d = 0; d < var_rank[i]; d++)
+#line 1003
index2[d] = index[d] + index2[d] * stride[d];
+#line 1003
value[j] = hash_float(var_type[i], var_rank[i], index2,
+#line 1003
NCT_FLOAT);
+#line 1003
allInExtRange = allInExtRange
+#line 1003
&& inRange3(value[j], var_type[i], NCT_FLOAT);
+#line 1003
}
+#line 1003
if (var_rank[i] == 0 && i%2 == 0)
+#line 1003
err = nc_put_varm_float(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 1003
else
+#line 1003
err = nc_put_varm_float(ncid,i,index,count,stride,imap,value);
+#line 1003
if (canConvert) {
+#line 1003
if (allInExtRange) {
+#line 1003
IF (err)
+#line 1003
error("%s", nc_strerror(err));
+#line 1003
} else {
+#line 1003
IF (err != NC_ERANGE)
+#line 1003
error("range error: status = %d", err);
+#line 1003
}
+#line 1003
} else {
+#line 1003
IF (nels > 0 && err != NC_ECHAR)
+#line 1003
error("wrong type: status = %d", err);
+#line 1003
}
+#line 1003
}
+#line 1003
}
+#line 1003
}
+#line 1003
+#line 1003
err = nc_close(ncid);
+#line 1003
IF (err)
+#line 1003
error("nc_close: %s", nc_strerror(err));
+#line 1003
+#line 1003
check_vars_float(scratch);
+#line 1003
+#line 1003
err = remove(scratch);
+#line 1003
IF (err)
+#line 1003
error("remove of %s failed", scratch);
+#line 1003
}
+#line 1003
void
+#line 1004
test_nc_put_varm_double(void)
+#line 1004
{
+#line 1004
int ncid;
+#line 1004
int d;
+#line 1004
int i;
+#line 1004
int j;
+#line 1004
int k;
+#line 1004
int m;
+#line 1004
int err;
+#line 1004
int nels;
+#line 1004
int nslabs;
+#line 1004
int nstarts; /* number of different starts */
+#line 1004
size_t start[MAX_RANK];
+#line 1004
size_t edge[MAX_RANK];
+#line 1004
size_t index[MAX_RANK];
+#line 1004
size_t index2[MAX_RANK];
+#line 1004
size_t mid[MAX_RANK];
+#line 1004
size_t count[MAX_RANK];
+#line 1004
size_t sstride[MAX_RANK];
+#line 1004
ptrdiff_t stride[MAX_RANK];
+#line 1004
ptrdiff_t imap[MAX_RANK];
+#line 1004
int canConvert; /* Both text or both numeric */
+#line 1004
int allInExtRange; /* all values within external range? */
+#line 1004
double value[MAX_NELS];
+#line 1004
+#line 1004
err = nc_create(scratch, NC_CLOBBER, &ncid);
+#line 1004
IF (err) {
+#line 1004
error("nc_create: %s", nc_strerror(err));
+#line 1004
return;
+#line 1004
}
+#line 1004
def_dims(ncid);
+#line 1004
def_vars(ncid);
+#line 1004
err = nc_enddef(ncid);
+#line 1004
IF (err)
+#line 1004
error("nc_enddef: %s", nc_strerror(err));
+#line 1004
+#line 1004
for (i = 0; i < NVARS; i++) {
+#line 1004
canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
+#line 1004
assert(var_rank[i] <= MAX_RANK);
+#line 1004
assert(var_nels[i] <= MAX_NELS);
+#line 1004
for (j = 0; j < var_rank[i]; j++) {
+#line 1004
start[j] = 0;
+#line 1004
edge[j] = 1;
+#line 1004
stride[j] = 1;
+#line 1004
imap[j] = 1;
+#line 1004
}
+#line 1004
err = nc_put_varm_double(BAD_ID, i, start, edge, stride, imap, value);
+#line 1004
IF (err != NC_EBADID)
+#line 1004
error("bad ncid: status = %d", err);
+#line 1004
err = nc_put_varm_double(ncid, BAD_VARID, start, edge, stride, imap, value);
+#line 1004
IF (err != NC_ENOTVAR)
+#line 1004
error("bad var id: status = %d", err);
+#line 1004
for (j = 0; j < var_rank[i]; j++) {
+#line 1004
if (var_dimid[i][j] > 0) { /* skip record dim */
+#line 1004
start[j] = var_shape[i][j] + 1;
+#line 1004
err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
+#line 1004
if (!canConvert) {
+#line 1004
IF(err != NC_ECHAR)
+#line 1004
error("conversion: status = %d", err);
+#line 1004
} else {
+#line 1004
IF (err != NC_EINVALCOORDS)
+#line 1004
error("bad start: status = %d", err);
+#line 1004
start[j] = 0;
+#line 1004
edge[j] = var_shape[i][j] + 1;
+#line 1004
err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
+#line 1004
IF (err != NC_EEDGE)
+#line 1004
error("bad edge: status = %d", err);
+#line 1004
edge[j] = 1;
+#line 1004
stride[j] = 0;
+#line 1004
err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
+#line 1004
IF (err != NC_ESTRIDE)
+#line 1004
error("bad stride: status = %d", err);
+#line 1004
stride[j] = 1;
+#line 1004
}
+#line 1004
}
+#line 1004
}
+#line 1004
/* Choose a random point dividing each dim into 2 parts */
+#line 1004
/* Put 2^rank (nslabs) slabs so defined */
+#line 1004
nslabs = 1;
+#line 1004
for (j = 0; j < var_rank[i]; j++) {
+#line 1004
mid[j] = roll( var_shape[i][j] );
+#line 1004
nslabs *= 2;
+#line 1004
}
+#line 1004
/* bits of k determine whether to put lower or upper part of dim */
+#line 1004
/* choose random stride from 1 to edge */
+#line 1004
for (k = 0; k < nslabs; k++) {
+#line 1004
nstarts = 1;
+#line 1004
for (j = 0; j < var_rank[i]; j++) {
+#line 1004
if ((k >> j) & 1) {
+#line 1004
start[j] = 0;
+#line 1004
edge[j] = mid[j];
+#line 1004
}else{
+#line 1004
start[j] = mid[j];
+#line 1004
edge[j] = var_shape[i][j] - mid[j];
+#line 1004
}
+#line 1004
sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
+#line 1004
nstarts *= stride[j];
+#line 1004
}
+#line 1004
for (m = 0; m < nstarts; m++) {
+#line 1004
err = toMixedBase(m, var_rank[i], sstride, index);
+#line 1004
IF (err)
+#line 1004
error("error in toMixedBase");
+#line 1004
nels = 1;
+#line 1004
for (j = 0; j < var_rank[i]; j++) {
+#line 1004
count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
+#line 1004
nels *= count[j];
+#line 1004
index[j] += start[j];
+#line 1004
}
+#line 1004
/* Random choice of forward or backward */
+#line 1004
/* TODO
+#line 1004
if ( roll(2) ) {
+#line 1004
for (j = 0; j < var_rank[i]; j++) {
+#line 1004
index[j] += (count[j] - 1) * stride[j];
+#line 1004
stride[j] = -stride[j];
+#line 1004
}
+#line 1004
}
+#line 1004
*/
+#line 1004
if (var_rank[i] > 0) {
+#line 1004
j = var_rank[i] - 1;
+#line 1004
imap[j] = 1;
+#line 1004
for (; j > 0; j--)
+#line 1004
imap[j-1] = imap[j] * count[j];
+#line 1004
}
+#line 1004
for (allInExtRange = 1, j = 0; j < nels; j++) {
+#line 1004
err = toMixedBase(j, var_rank[i], count, index2);
+#line 1004
IF (err)
+#line 1004
error("error in toMixedBase");
+#line 1004
for (d = 0; d < var_rank[i]; d++)
+#line 1004
index2[d] = index[d] + index2[d] * stride[d];
+#line 1004
value[j] = hash_double(var_type[i], var_rank[i], index2,
+#line 1004
NCT_DOUBLE);
+#line 1004
allInExtRange = allInExtRange
+#line 1004
&& inRange3(value[j], var_type[i], NCT_DOUBLE);
+#line 1004
}
+#line 1004
if (var_rank[i] == 0 && i%2 == 0)
+#line 1004
err = nc_put_varm_double(ncid,i,NULL,NULL,NULL,NULL,value);
+#line 1004
else
+#line 1004
err = nc_put_varm_double(ncid,i,index,count,stride,imap,value);
+#line 1004
if (canConvert) {
+#line 1004
if (allInExtRange) {
+#line 1004
IF (err)
+#line 1004
error("%s", nc_strerror(err));
+#line 1004
} else {
+#line 1004
IF (err != NC_ERANGE)
+#line 1004
error("range error: status = %d", err);
+#line 1004
}
+#line 1004
} else {
+#line 1004
IF (nels > 0 && err != NC_ECHAR)
+#line 1004
error("wrong type: status = %d", err);
+#line 1004
}
+#line 1004
}
+#line 1004
}
+#line 1004
}
+#line 1004
+#line 1004
err = nc_close(ncid);
+#line 1004
IF (err)
+#line 1004
error("nc_close: %s", nc_strerror(err));
+#line 1004
+#line 1004
check_vars_double(scratch);
+#line 1004
+#line 1004
err = remove(scratch);
+#line 1004
IF (err)
+#line 1004
error("remove of %s failed", scratch);
+#line 1004
}
+#line 1004
@@ -6917,446 +13688,881 @@ test_nc_put_att_text(void)
}
+#line 1135
void
+#line 1136
test_nc_put_att_uchar(void)
+#line 1136
{
+#line 1136
int ncid;
+#line 1136
int i;
+#line 1136
int j;
+#line 1136
size_t k;
+#line 1136
int err;
+#line 1136
uchar value[MAX_NELS];
+#line 1136
int allInExtRange; /* all values within external range? */
+#line 1136
+#line 1136
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1136
IF (err) {
+#line 1136
error("nc_create: %s", nc_strerror(err));
+#line 1136
return;
+#line 1136
}
+#line 1136
def_dims(ncid);
+#line 1136
def_vars(ncid);
+#line 1136
+#line 1136
for (i = -1; i < NVARS; i++) {
+#line 1136
for (j = 0; j < NATTS(i); j++) {
+#line 1136
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1136
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1136
err = nc_put_att_uchar(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1136
ATT_LEN(i,j), value);
+#line 1136
IF (err != NC_EBADID)
+#line 1136
error("bad ncid: status = %d", err);
+#line 1136
err = nc_put_att_uchar(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1136
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1136
IF (err != NC_ENOTVAR)
+#line 1136
error("bad var id: status = %d", err);
+#line 1136
err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1136
ATT_LEN(i,j), value);
+#line 1136
IF (err != NC_EBADTYPE)
+#line 1136
error("bad type: status = %d", err);
+#line 1136
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1136
value[k] = hash_uchar(ATT_TYPE(i,j), -1, &k, NCT_UCHAR);
+#line 1136
allInExtRange = allInExtRange
+#line 1136
&& inRange3(value[k], ATT_TYPE(i,j), NCT_UCHAR);
+#line 1136
}
+#line 1136
err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1136
ATT_LEN(i,j), value);
+#line 1136
if (allInExtRange) {
+#line 1136
IF (err)
+#line 1136
error("%s", nc_strerror(err));
+#line 1136
} else {
+#line 1136
IF (err != NC_ERANGE)
+#line 1136
error("range error: status = %d", err);
+#line 1136
}
+#line 1136
}
+#line 1136
}
+#line 1136
}
+#line 1136
+#line 1136
check_atts_uchar(ncid);
+#line 1136
err = nc_close(ncid);
+#line 1136
IF (err)
+#line 1136
error("nc_close: %s", nc_strerror(err));
+#line 1136
+#line 1136
err = remove(scratch);
+#line 1136
IF (err)
+#line 1136
error("remove of %s failed", scratch);
+#line 1136
}
+#line 1136
void
+#line 1137
test_nc_put_att_schar(void)
+#line 1137
{
+#line 1137
int ncid;
+#line 1137
int i;
+#line 1137
int j;
+#line 1137
size_t k;
+#line 1137
int err;
+#line 1137
schar value[MAX_NELS];
+#line 1137
int allInExtRange; /* all values within external range? */
+#line 1137
+#line 1137
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1137
IF (err) {
+#line 1137
error("nc_create: %s", nc_strerror(err));
+#line 1137
return;
+#line 1137
}
+#line 1137
def_dims(ncid);
+#line 1137
def_vars(ncid);
+#line 1137
+#line 1137
for (i = -1; i < NVARS; i++) {
+#line 1137
for (j = 0; j < NATTS(i); j++) {
+#line 1137
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1137
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1137
err = nc_put_att_schar(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1137
ATT_LEN(i,j), value);
+#line 1137
IF (err != NC_EBADID)
+#line 1137
error("bad ncid: status = %d", err);
+#line 1137
err = nc_put_att_schar(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1137
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1137
IF (err != NC_ENOTVAR)
+#line 1137
error("bad var id: status = %d", err);
+#line 1137
err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1137
ATT_LEN(i,j), value);
+#line 1137
IF (err != NC_EBADTYPE)
+#line 1137
error("bad type: status = %d", err);
+#line 1137
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1137
value[k] = hash_schar(ATT_TYPE(i,j), -1, &k, NCT_SCHAR);
+#line 1137
allInExtRange = allInExtRange
+#line 1137
&& inRange3(value[k], ATT_TYPE(i,j), NCT_SCHAR);
+#line 1137
}
+#line 1137
err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1137
ATT_LEN(i,j), value);
+#line 1137
if (allInExtRange) {
+#line 1137
IF (err)
+#line 1137
error("%s", nc_strerror(err));
+#line 1137
} else {
+#line 1137
IF (err != NC_ERANGE)
+#line 1137
error("range error: status = %d", err);
+#line 1137
}
+#line 1137
}
+#line 1137
}
+#line 1137
}
+#line 1137
+#line 1137
check_atts_schar(ncid);
+#line 1137
err = nc_close(ncid);
+#line 1137
IF (err)
+#line 1137
error("nc_close: %s", nc_strerror(err));
+#line 1137
+#line 1137
err = remove(scratch);
+#line 1137
IF (err)
+#line 1137
error("remove of %s failed", scratch);
+#line 1137
}
+#line 1137
void
+#line 1138
test_nc_put_att_short(void)
+#line 1138
{
+#line 1138
int ncid;
+#line 1138
int i;
+#line 1138
int j;
+#line 1138
size_t k;
+#line 1138
int err;
+#line 1138
short value[MAX_NELS];
+#line 1138
int allInExtRange; /* all values within external range? */
+#line 1138
+#line 1138
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1138
IF (err) {
+#line 1138
error("nc_create: %s", nc_strerror(err));
+#line 1138
return;
+#line 1138
}
+#line 1138
def_dims(ncid);
+#line 1138
def_vars(ncid);
+#line 1138
+#line 1138
for (i = -1; i < NVARS; i++) {
+#line 1138
for (j = 0; j < NATTS(i); j++) {
+#line 1138
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1138
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1138
err = nc_put_att_short(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1138
ATT_LEN(i,j), value);
+#line 1138
IF (err != NC_EBADID)
+#line 1138
error("bad ncid: status = %d", err);
+#line 1138
err = nc_put_att_short(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1138
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1138
IF (err != NC_ENOTVAR)
+#line 1138
error("bad var id: status = %d", err);
+#line 1138
err = nc_put_att_short(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1138
ATT_LEN(i,j), value);
+#line 1138
IF (err != NC_EBADTYPE)
+#line 1138
error("bad type: status = %d", err);
+#line 1138
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1138
value[k] = hash_short(ATT_TYPE(i,j), -1, &k, NCT_SHORT);
+#line 1138
allInExtRange = allInExtRange
+#line 1138
&& inRange3(value[k], ATT_TYPE(i,j), NCT_SHORT);
+#line 1138
}
+#line 1138
err = nc_put_att_short(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1138
ATT_LEN(i,j), value);
+#line 1138
if (allInExtRange) {
+#line 1138
IF (err)
+#line 1138
error("%s", nc_strerror(err));
+#line 1138
} else {
+#line 1138
IF (err != NC_ERANGE)
+#line 1138
error("range error: status = %d", err);
+#line 1138
}
+#line 1138
}
+#line 1138
}
+#line 1138
}
+#line 1138
+#line 1138
check_atts_short(ncid);
+#line 1138
err = nc_close(ncid);
+#line 1138
IF (err)
+#line 1138
error("nc_close: %s", nc_strerror(err));
+#line 1138
+#line 1138
err = remove(scratch);
+#line 1138
IF (err)
+#line 1138
error("remove of %s failed", scratch);
+#line 1138
}
+#line 1138
void
+#line 1139
test_nc_put_att_int(void)
+#line 1139
{
+#line 1139
int ncid;
+#line 1139
int i;
+#line 1139
int j;
+#line 1139
size_t k;
+#line 1139
int err;
+#line 1139
int value[MAX_NELS];
+#line 1139
int allInExtRange; /* all values within external range? */
+#line 1139
+#line 1139
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1139
IF (err) {
+#line 1139
error("nc_create: %s", nc_strerror(err));
+#line 1139
return;
+#line 1139
}
+#line 1139
def_dims(ncid);
+#line 1139
def_vars(ncid);
+#line 1139
+#line 1139
for (i = -1; i < NVARS; i++) {
+#line 1139
for (j = 0; j < NATTS(i); j++) {
+#line 1139
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1139
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1139
err = nc_put_att_int(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1139
ATT_LEN(i,j), value);
+#line 1139
IF (err != NC_EBADID)
+#line 1139
error("bad ncid: status = %d", err);
+#line 1139
err = nc_put_att_int(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1139
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1139
IF (err != NC_ENOTVAR)
+#line 1139
error("bad var id: status = %d", err);
+#line 1139
err = nc_put_att_int(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1139
ATT_LEN(i,j), value);
+#line 1139
IF (err != NC_EBADTYPE)
+#line 1139
error("bad type: status = %d", err);
+#line 1139
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1139
value[k] = hash_int(ATT_TYPE(i,j), -1, &k, NCT_INT);
+#line 1139
allInExtRange = allInExtRange
+#line 1139
&& inRange3(value[k], ATT_TYPE(i,j), NCT_INT);
+#line 1139
}
+#line 1139
err = nc_put_att_int(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1139
ATT_LEN(i,j), value);
+#line 1139
if (allInExtRange) {
+#line 1139
IF (err)
+#line 1139
error("%s", nc_strerror(err));
+#line 1139
} else {
+#line 1139
IF (err != NC_ERANGE)
+#line 1139
error("range error: status = %d", err);
+#line 1139
}
+#line 1139
}
+#line 1139
}
+#line 1139
}
+#line 1139
+#line 1139
check_atts_int(ncid);
+#line 1139
err = nc_close(ncid);
+#line 1139
IF (err)
+#line 1139
error("nc_close: %s", nc_strerror(err));
+#line 1139
+#line 1139
err = remove(scratch);
+#line 1139
IF (err)
+#line 1139
error("remove of %s failed", scratch);
+#line 1139
}
+#line 1139
void
+#line 1140
test_nc_put_att_long(void)
+#line 1140
{
+#line 1140
int ncid;
+#line 1140
int i;
+#line 1140
int j;
+#line 1140
size_t k;
+#line 1140
int err;
+#line 1140
long value[MAX_NELS];
+#line 1140
int allInExtRange; /* all values within external range? */
+#line 1140
+#line 1140
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1140
IF (err) {
+#line 1140
error("nc_create: %s", nc_strerror(err));
+#line 1140
return;
+#line 1140
}
+#line 1140
def_dims(ncid);
+#line 1140
def_vars(ncid);
+#line 1140
+#line 1140
for (i = -1; i < NVARS; i++) {
+#line 1140
for (j = 0; j < NATTS(i); j++) {
+#line 1140
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1140
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1140
err = nc_put_att_long(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1140
ATT_LEN(i,j), value);
+#line 1140
IF (err != NC_EBADID)
+#line 1140
error("bad ncid: status = %d", err);
+#line 1140
err = nc_put_att_long(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1140
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1140
IF (err != NC_ENOTVAR)
+#line 1140
error("bad var id: status = %d", err);
+#line 1140
err = nc_put_att_long(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1140
ATT_LEN(i,j), value);
+#line 1140
IF (err != NC_EBADTYPE)
+#line 1140
error("bad type: status = %d", err);
+#line 1140
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1140
value[k] = hash_long(ATT_TYPE(i,j), -1, &k, NCT_LONG);
+#line 1140
allInExtRange = allInExtRange
+#line 1140
&& inRange3(value[k], ATT_TYPE(i,j), NCT_LONG);
+#line 1140
}
+#line 1140
err = nc_put_att_long(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1140
ATT_LEN(i,j), value);
+#line 1140
if (allInExtRange) {
+#line 1140
IF (err)
+#line 1140
error("%s", nc_strerror(err));
+#line 1140
} else {
+#line 1140
IF (err != NC_ERANGE)
+#line 1140
error("range error: status = %d", err);
+#line 1140
}
+#line 1140
}
+#line 1140
}
+#line 1140
}
+#line 1140
+#line 1140
check_atts_long(ncid);
+#line 1140
err = nc_close(ncid);
+#line 1140
IF (err)
+#line 1140
error("nc_close: %s", nc_strerror(err));
+#line 1140
+#line 1140
err = remove(scratch);
+#line 1140
IF (err)
+#line 1140
error("remove of %s failed", scratch);
+#line 1140
}
+#line 1140
void
+#line 1141
test_nc_put_att_float(void)
+#line 1141
{
+#line 1141
int ncid;
+#line 1141
int i;
+#line 1141
int j;
+#line 1141
size_t k;
+#line 1141
int err;
+#line 1141
float value[MAX_NELS];
+#line 1141
int allInExtRange; /* all values within external range? */
+#line 1141
+#line 1141
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1141
IF (err) {
+#line 1141
error("nc_create: %s", nc_strerror(err));
+#line 1141
return;
+#line 1141
}
+#line 1141
def_dims(ncid);
+#line 1141
def_vars(ncid);
+#line 1141
+#line 1141
for (i = -1; i < NVARS; i++) {
+#line 1141
for (j = 0; j < NATTS(i); j++) {
+#line 1141
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1141
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1141
err = nc_put_att_float(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1141
ATT_LEN(i,j), value);
+#line 1141
IF (err != NC_EBADID)
+#line 1141
error("bad ncid: status = %d", err);
+#line 1141
err = nc_put_att_float(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1141
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1141
IF (err != NC_ENOTVAR)
+#line 1141
error("bad var id: status = %d", err);
+#line 1141
err = nc_put_att_float(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1141
ATT_LEN(i,j), value);
+#line 1141
IF (err != NC_EBADTYPE)
+#line 1141
error("bad type: status = %d", err);
+#line 1141
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1141
value[k] = hash_float(ATT_TYPE(i,j), -1, &k, NCT_FLOAT);
+#line 1141
allInExtRange = allInExtRange
+#line 1141
&& inRange3(value[k], ATT_TYPE(i,j), NCT_FLOAT);
+#line 1141
}
+#line 1141
err = nc_put_att_float(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1141
ATT_LEN(i,j), value);
+#line 1141
if (allInExtRange) {
+#line 1141
IF (err)
+#line 1141
error("%s", nc_strerror(err));
+#line 1141
} else {
+#line 1141
IF (err != NC_ERANGE)
+#line 1141
error("range error: status = %d", err);
+#line 1141
}
+#line 1141
}
+#line 1141
}
+#line 1141
}
+#line 1141
+#line 1141
check_atts_float(ncid);
+#line 1141
err = nc_close(ncid);
+#line 1141
IF (err)
+#line 1141
error("nc_close: %s", nc_strerror(err));
+#line 1141
+#line 1141
err = remove(scratch);
+#line 1141
IF (err)
+#line 1141
error("remove of %s failed", scratch);
+#line 1141
}
+#line 1141
void
+#line 1142
test_nc_put_att_double(void)
+#line 1142
{
+#line 1142
int ncid;
+#line 1142
int i;
+#line 1142
int j;
+#line 1142
size_t k;
+#line 1142
int err;
+#line 1142
double value[MAX_NELS];
+#line 1142
int allInExtRange; /* all values within external range? */
+#line 1142
+#line 1142
err = nc_create(scratch, NC_NOCLOBBER, &ncid);
+#line 1142
IF (err) {
+#line 1142
error("nc_create: %s", nc_strerror(err));
+#line 1142
return;
+#line 1142
}
+#line 1142
def_dims(ncid);
+#line 1142
def_vars(ncid);
+#line 1142
+#line 1142
for (i = -1; i < NVARS; i++) {
+#line 1142
for (j = 0; j < NATTS(i); j++) {
+#line 1142
if (!(ATT_TYPE(i,j) == NC_CHAR)) {
+#line 1142
assert(ATT_LEN(i,j) <= MAX_NELS);
+#line 1142
err = nc_put_att_double(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1142
ATT_LEN(i,j), value);
+#line 1142
IF (err != NC_EBADID)
+#line 1142
error("bad ncid: status = %d", err);
+#line 1142
err = nc_put_att_double(ncid, BAD_VARID, ATT_NAME(i,j),
+#line 1142
ATT_TYPE(i,j), ATT_LEN(i,j), value);
+#line 1142
IF (err != NC_ENOTVAR)
+#line 1142
error("bad var id: status = %d", err);
+#line 1142
err = nc_put_att_double(ncid, i, ATT_NAME(i,j), BAD_TYPE,
+#line 1142
ATT_LEN(i,j), value);
+#line 1142
IF (err != NC_EBADTYPE)
+#line 1142
error("bad type: status = %d", err);
+#line 1142
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
+#line 1142
value[k] = hash_double(ATT_TYPE(i,j), -1, &k, NCT_DOUBLE);
+#line 1142
allInExtRange = allInExtRange
+#line 1142
&& inRange3(value[k], ATT_TYPE(i,j), NCT_DOUBLE);
+#line 1142
}
+#line 1142
err = nc_put_att_double(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
+#line 1142
ATT_LEN(i,j), value);
+#line 1142
if (allInExtRange) {
+#line 1142
IF (err)
+#line 1142
error("%s", nc_strerror(err));
+#line 1142
} else {
+#line 1142
IF (err != NC_ERANGE)
+#line 1142
error("range error: status = %d", err);
+#line 1142
}
+#line 1142
}
+#line 1142
}
+#line 1142
}
+#line 1142
+#line 1142
check_atts_double(ncid);
+#line 1142
err = nc_close(ncid);
+#line 1142
IF (err)
+#line 1142
error("nc_close: %s", nc_strerror(err));
+#line 1142
+#line 1142
err = remove(scratch);
+#line 1142
IF (err)
+#line 1142
error("remove of %s failed", scratch);
+#line 1142
}
+#line 1142
diff --git a/nc_test/tst_atts.c b/nc_test/tst_atts.c
index 933e0b1..a0b48ae 100644
--- a/nc_test/tst_atts.c
+++ b/nc_test/tst_atts.c
@@ -1191,7 +1191,7 @@ create_file()
/* assign global attributes */
{ /* Gc */
- stat = nc_put_att_text(ncid, NC_GLOBAL, "Gc", 1, "�");
+ stat = nc_put_att_text(ncid, NC_GLOBAL, "Gc", 1, "\177");
check_err(stat,__LINE__,__FILE__);
}
{ /* Gb */
@@ -1293,7 +1293,7 @@ create_file()
stat = nc_put_var1(ncid, d_id, &zero, d_data); check_err(stat,__LINE__,__FILE__);
}
{
- char cr_data[2] = "�\177" ;
+ char cr_data[2] = "\177\177" ;
size_t cr_startset[1] = {0} ;
size_t cr_countset[1] = {2} ;
stat = nc_put_vara(ncid, cr_id, cr_startset, cr_countset, cr_data);
@@ -1341,7 +1341,7 @@ create_file()
}
{
- char c1_data[1] = "�" ;
+ char c1_data[1] = "\177" ;
size_t c1_startset[1] = {0} ;
size_t c1_countset[1] = {1} ;
stat = nc_put_vara(ncid, c1_id, c1_startset, c1_countset, c1_data);
@@ -1389,7 +1389,7 @@ create_file()
}
{
- char c2_data[2] = "�\177" ;
+ char c2_data[2] = "\177\177" ;
size_t c2_startset[1] = {0} ;
size_t c2_countset[1] = {2} ;
stat = nc_put_vara(ncid, c2_id, c2_startset, c2_countset, c2_data);
@@ -1437,7 +1437,7 @@ create_file()
}
{
- char c3_data[3] = "�\177A" ;
+ char c3_data[3] = "\177\177A" ;
size_t c3_startset[1] = {0} ;
size_t c3_countset[1] = {3} ;
stat = nc_put_vara(ncid, c3_id, c3_startset, c3_countset, c3_data);
@@ -1485,7 +1485,7 @@ create_file()
}
{
- char c4_data[4] = "�\177AZ" ;
+ char c4_data[4] = "\177\177AZ" ;
size_t c4_startset[1] = {0} ;
size_t c4_countset[1] = {4} ;
stat = nc_put_vara(ncid, c4_id, c4_startset, c4_countset, c4_data);
diff --git a/nc_test4/Makefile.in b/nc_test4/Makefile.in
index 6511873..f83d38b 100644
--- a/nc_test4/Makefile.in
+++ b/nc_test4/Makefile.in
@@ -855,6 +855,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -930,7 +933,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/nc_test4/tst_h4_lendian.c b/nc_test4/tst_h4_lendian.c
index c81602b..30e34d1 100644
--- a/nc_test4/tst_h4_lendian.c
+++ b/nc_test4/tst_h4_lendian.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <config.h>
+#include <unistd.h>
#include <nc_tests.h>
#include <hdf5.h>
#include <H5DSpublic.h>
@@ -80,10 +81,10 @@ int create_hdf_file(int dtype) {
sds_id = SDcreate(sd_id, SDSNAME, dtype, RANK, edges);
istat = SDendaccess(sds_id);
- if(istat) {printf("Failure %d\n"); SDend(sd_id); return istat;}
+ if(istat) {printf("Failure %d\n", istat); SDend(sd_id); return istat;}
istat = SDend(sd_id);
- if(istat) {printf("Failure %d\n"); SDend(sd_id); return istat;}
+ if(istat) {printf("Failure %d\n", istat); SDend(sd_id); return istat;}
sd_id = SDstart(FILENAME, DFACC_WRITE);
@@ -91,13 +92,13 @@ int create_hdf_file(int dtype) {
sds_id = SDselect(sd_id, sd_index);
istat = SDwritedata(sds_id, start, NULL, edges, (VOIDP)array_data);
- if(istat) {printf("Failure %d\n"); SDend(sd_id); return istat;}
+ if(istat) {printf("Failure %d\n", istat); SDend(sd_id); return istat;}
istat = SDendaccess(sds_id);
- if(istat) {printf("Failure %d\n"); SDend(sd_id); return istat;}
+ if(istat) {printf("Failure %d\n", istat); SDend(sd_id); return istat;}
istat = SDend(sd_id);
- if(istat) {printf("Failure %d\n"); return istat;}
+ if(istat) {printf("Failure %d\n", istat); return istat;}
printf("Success\n");
return 0;
diff --git a/ncdap_test/Makefile.in b/ncdap_test/Makefile.in
index 4629832..ff129b0 100644
--- a/ncdap_test/Makefile.in
+++ b/ncdap_test/Makefile.in
@@ -544,6 +544,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -619,7 +622,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdap_test/expected3/Makefile.in b/ncdap_test/expected3/Makefile.in
index 8e10af1..844b2b0 100644
--- a/ncdap_test/expected3/Makefile.in
+++ b/ncdap_test/expected3/Makefile.in
@@ -157,6 +157,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -232,7 +235,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdap_test/expected4/Makefile.in b/ncdap_test/expected4/Makefile.in
index 4484007..31d08d9 100644
--- a/ncdap_test/expected4/Makefile.in
+++ b/ncdap_test/expected4/Makefile.in
@@ -155,6 +155,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -230,7 +233,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdap_test/expectremote3/Makefile.in b/ncdap_test/expectremote3/Makefile.in
index d504641..f30997c 100644
--- a/ncdap_test/expectremote3/Makefile.in
+++ b/ncdap_test/expectremote3/Makefile.in
@@ -157,6 +157,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -232,7 +235,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdap_test/expectremote4/Makefile.in b/ncdap_test/expectremote4/Makefile.in
index 37f37d5..e03da2b 100644
--- a/ncdap_test/expectremote4/Makefile.in
+++ b/ncdap_test/expectremote4/Makefile.in
@@ -157,6 +157,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -232,7 +235,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdap_test/t_ncf330.c b/ncdap_test/t_ncf330.c
index e557572..64e3a7e 100644
--- a/ncdap_test/t_ncf330.c
+++ b/ncdap_test/t_ncf330.c
@@ -6,6 +6,8 @@
* See https://bugtracking.unidata.ucar.edu/browse/NCF-330
*/
+#include <stdio.h>
+#include <stdlib.h>
#include <netcdf.h>
#ifdef _MSC_VER
diff --git a/ncdap_test/testdata3/Makefile.in b/ncdap_test/testdata3/Makefile.in
index 76f1ae1..8194679 100644
--- a/ncdap_test/testdata3/Makefile.in
+++ b/ncdap_test/testdata3/Makefile.in
@@ -157,6 +157,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -232,7 +235,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt
index 3038e28..eb6c2f3 100644
--- a/ncdump/CMakeLists.txt
+++ b/ncdump/CMakeLists.txt
@@ -4,14 +4,14 @@ IF(BUILD_SHARED_LIBS AND WIN32)
ENDIF()
ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ctest.c
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ctest.c
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/ctest.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/ctest.c"
)
ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ctest64.c
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ctest64.c
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest64.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/ctest64.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/ctest64.c"
)
SET(ncdump_FILES ncdump.c vardata.c dumplib.c indent.c nctime0.c utils.c nciter.c)
diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am
index 395e840..69e05ec 100644
--- a/ncdump/Makefile.am
+++ b/ncdump/Makefile.am
@@ -68,16 +68,16 @@ endif #!USE_NETCDF4
BUILT_SOURCES = ctest.c ctest64.c
if EXTRA_TESTS
ctest.c:
- $(top_builddir)/ncgen/ncgen -lc -o ctest0.nc $(top_srcdir)/ncgen/c0.cdl >$(srcdir)/ctest.c
+ $(top_builddir)/ncgen/ncgen -lc -o ctest0.nc $(top_srcdir)/ncgen/c0.cdl > $(top_builddir)/ncdump/ctest.c
ctest64.c:
- $(top_builddir)/ncgen/ncgen -v2 -lc -o ctest0_64.nc $(top_srcdir)/ncgen/c0.cdl > $(srcdir)/ctest64.c
+ $(top_builddir)/ncgen/ncgen -v2 -lc -o ctest0_64.nc $(top_srcdir)/ncgen/c0.cdl > $(top_builddir)/ncdump/ctest64.c
else
ctest.c:
- cp $(top_srcdir)/ncdump/ref_ctest.c $(top_srcdir)/ncdump/ctest.c
+ cp $(top_srcdir)/ncdump/ref_ctest.c $(top_builddir)/ncdump/ctest.c
ctest64.c:
- cp $(top_srcdir)/ncdump/ref_ctest64.c $(top_srcdir)/ncdump/ctest64.c
+ cp $(top_srcdir)/ncdump/ref_ctest64.c $(top_builddir)/ncdump/ctest64.c
endif
#if !BUILD_DLL
@@ -131,14 +131,13 @@ ref_tst_charfill.cdl tst_charfill.cdl tst_charfill.sh \
tst_iter.sh tst_mud.sh ref_tst_mud4.cdl ref_tst_mud4-bc.cdl \
ref_tst_mud4_chars.cdl \
ref_tst_ncf213.cdl tst_h_scalar.sh \
-tst_formatx3.sh tst_formatx4.sh \
+tst_formatx3.sh tst_formatx4.sh ref_tst_utf8_4.cdl \
CMakeLists.txt XGetopt.c tst_bom.sh tst_inmemory.sh
# CDL files and Expected results
SUBDIRS=cdl expected
EXTRA_DIST += tst_ncgen_shared.sh tst_ncgen4.sh tst_ncgen4_classic.sh \
-tst_ncgen4_diff.sh tst_ncgen4_cycle.sh ref_ctest.c ref_ctest64.c \
-ctest.c ctest64.c
+tst_ncgen4_diff.sh tst_ncgen4_cycle.sh ref_ctest.c ref_ctest64.c
CLEANFILES += results/*.nc results/*.dmp results/*.dmp2 tmp*.cdl tst_bug324.nc
DISTCLEANFILES = results
diff --git a/ncdump/Makefile.in b/ncdump/Makefile.in
index 1a3b5dd..0b08cda 100644
--- a/ncdump/Makefile.in
+++ b/ncdump/Makefile.in
@@ -646,6 +646,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -721,7 +724,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
@@ -854,10 +856,10 @@ EXTRA_DIST = run_tests.sh tst_64bit.sh tst_output.sh test0.cdl \
tst_charfill.cdl tst_charfill.sh tst_iter.sh tst_mud.sh \
ref_tst_mud4.cdl ref_tst_mud4-bc.cdl ref_tst_mud4_chars.cdl \
ref_tst_ncf213.cdl tst_h_scalar.sh tst_formatx3.sh \
- tst_formatx4.sh CMakeLists.txt XGetopt.c tst_bom.sh \
- tst_inmemory.sh tst_ncgen_shared.sh tst_ncgen4.sh \
+ tst_formatx4.sh ref_tst_utf8_4.cdl CMakeLists.txt XGetopt.c \
+ tst_bom.sh tst_inmemory.sh tst_ncgen_shared.sh tst_ncgen4.sh \
tst_ncgen4_classic.sh tst_ncgen4_diff.sh tst_ncgen4_cycle.sh \
- ref_ctest.c ref_ctest64.c ctest.c ctest64.c
+ ref_ctest.c ref_ctest64.c
# CDL files and Expected results
SUBDIRS = cdl expected
@@ -1926,15 +1928,15 @@ uninstall-man: uninstall-man1
.PRECIOUS: Makefile
@BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE at ctest.c:
- at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE@ $(top_builddir)/ncgen/ncgen -lc -o ctest0.nc $(top_srcdir)/ncgen/c0.cdl >$(srcdir)/ctest.c
+ at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE@ $(top_builddir)/ncgen/ncgen -lc -o ctest0.nc $(top_srcdir)/ncgen/c0.cdl > $(top_builddir)/ncdump/ctest.c
@BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE at ctest64.c:
- at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE@ $(top_builddir)/ncgen/ncgen -v2 -lc -o ctest0_64.nc $(top_srcdir)/ncgen/c0.cdl > $(srcdir)/ctest64.c
+ at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE@ $(top_builddir)/ncgen/ncgen -v2 -lc -o ctest0_64.nc $(top_srcdir)/ncgen/c0.cdl > $(top_builddir)/ncdump/ctest64.c
@BUILD_TESTSETS_TRUE@@EXTRA_TESTS_FALSE at ctest.c:
- at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_FALSE@ cp $(top_srcdir)/ncdump/ref_ctest.c $(top_srcdir)/ncdump/ctest.c
+ at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_FALSE@ cp $(top_srcdir)/ncdump/ref_ctest.c $(top_builddir)/ncdump/ctest.c
@BUILD_TESTSETS_TRUE@@EXTRA_TESTS_FALSE at ctest64.c:
- at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_FALSE@ cp $(top_srcdir)/ncdump/ref_ctest64.c $(top_srcdir)/ncdump/ctest64.c
+ at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_FALSE@ cp $(top_srcdir)/ncdump/ref_ctest64.c $(top_builddir)/ncdump/ctest64.c
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/ncdump/cdl/Makefile.in b/ncdump/cdl/Makefile.in
index 12f7774..c138312 100644
--- a/ncdump/cdl/Makefile.in
+++ b/ncdump/cdl/Makefile.in
@@ -157,6 +157,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -232,7 +235,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdump/expected/Makefile.in b/ncdump/expected/Makefile.in
index 9d2f949..bfca65d 100644
--- a/ncdump/expected/Makefile.in
+++ b/ncdump/expected/Makefile.in
@@ -155,6 +155,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -230,7 +233,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncdump/nccopy.c b/ncdump/nccopy.c
index 0242c4c..f3bf1b6 100644
--- a/ncdump/nccopy.c
+++ b/ncdump/nccopy.c
@@ -1132,7 +1132,7 @@ copy_data(int igrp, int ogrp)
/* Count total number of dimensions in ncid and all its descendant subgroups */
int
-count_dims(ncid) {
+count_dims(int ncid) {
int numgrps;
int ndims;
NC_CHECK(nc_inq_ndims(ncid, &ndims));
@@ -1727,4 +1727,4 @@ main(int argc, char**argv)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
-END_OF_MAIN();
+END_OF_MAIN()
diff --git a/ncdump/ncdump.c b/ncdump/ncdump.c
index b0eab18..835d251 100644
--- a/ncdump/ncdump.c
+++ b/ncdump/ncdump.c
@@ -100,15 +100,15 @@ usage(void)
"%s [-c|-h] [-v ...] [[-b|-f] [c|f]] [-l len] [-n name] [-p n[,n]] [-k] [-x] [-s] [-t|-i] [-g ...] [-w] file\n%s",
progname,
USAGE);
-
+
(void) fprintf(stderr,
"netcdf library version %s\n",
nc_inq_libvers());
}
-/*
- * convert pathname of netcdf file into name for cdl unit, by taking
+/*
+ * convert pathname of netcdf file into name for cdl unit, by taking
* last component of path and stripping off any extension.
* DMH: add code to handle OPeNDAP url.
* DMH: I think this also works for UTF8.
@@ -122,10 +122,10 @@ name_path(const char *path)
#ifdef vms
#define FILE_DELIMITER ']'
-#endif
+#endif
#if defined(WIN32) || defined(msdos)
#define FILE_DELIMITER '\\'
-#endif
+#endif
#ifndef FILE_DELIMITER /* default to unix */
#define FILE_DELIMITER '/'
#endif
@@ -210,7 +210,7 @@ static void
tztrim(char *ss)
{
char *cp, *ep;
-
+
cp = ss;
if (*cp == '-')
cp++;
@@ -265,7 +265,7 @@ kind_string_extended(int kind, int mode)
break;
case NC_FORMAT_NC_HDF5:
snprintf(text,sizeof(text),"%s mode=%08x", "HDF5",mode);
- break;
+ break;
case NC_FORMAT_NC_HDF4:
snprintf(text,sizeof(text),"%s mode=%08x", "HDF4",mode);
break;
@@ -296,7 +296,7 @@ fileopen(const char* path, void** memp, size_t* sizep)
int status = NC_NOERR;
int fd = -1;
int oflags = 0;
- size_t size = 0;
+ off_t size = 0;
void* mem = NULL;
off_t red = 0;
char* pos = NULL;
@@ -346,23 +346,31 @@ done:
fflush(stderr);
#endif
}
- if(status != NC_NOERR && mem != NULL)
- free(mem);
- else {
- if(sizep) *sizep = size;
- if(memp) *memp = mem;
+ if(status != NC_NOERR && mem != NULL) {
+ free(mem);
+ mem = NULL;
+ } else {
+ if(sizep) *sizep = size;
+ if(memp) {
+ *memp = mem;
+ } else if(mem) {
+ free(mem);
+ }
+
}
+
+
return status;
}
#endif
-/*
+/*
* Emit initial line of output for NcML
*/
-static void
+static void
pr_initx(int ncid, const char *path)
{
- printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",
+ printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",
path);
}
@@ -395,7 +403,7 @@ pr_att_string(
case '\f':
printf ("\\f");
break;
- case '\n':
+ case '\n':
/* Only generate linebreaks after embedded newlines for
* classic, 64-bit offset, or classic model files. For
* netCDF-4 files, don't generate linebreaks, because that
@@ -495,7 +503,7 @@ pr_attx_string(
* Print list of attribute values, for attributes of primitive types.
* Attribute values must be printed with explicit type tags for
* netCDF-3 primitive types, because CDL doesn't require explicit
- * syntax to declare such attribute types.
+ * syntax to declare such attribute types.
*/
static void
pr_att_valgs(
@@ -707,7 +715,7 @@ pr_att_valsx(
}
}
-/*
+/*
* Print a variable attribute
*/
static void
@@ -720,7 +728,7 @@ pr_att(
)
{
ncatt_t att; /* attribute */
-
+
NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) );
NC_CHECK( nc_inq_att(ncid, varid, att.name, &att.type, &att.len) );
att.tinfo = get_typeinfo(att.type);
@@ -788,7 +796,7 @@ pr_att(
int class, i;
void *data;
- NC_CHECK( nc_inq_user_type(ncid, att.type, type_name, &type_size,
+ NC_CHECK( nc_inq_user_type(ncid, att.type, type_name, &type_size,
&base_nc_type, &nfields, &class));
switch(class)
{
@@ -862,7 +870,7 @@ pr_att(
default:
error("enum must have an integer base type: %d", base_nc_type);
}
- NC_CHECK( nc_inq_enum_ident(ncid, att.type, value,
+ NC_CHECK( nc_inq_enum_ident(ncid, att.type, value,
enum_name));
/* printf("%s%s", enum_name, i < att.len-1 ? ", " : ""); */
print_name(enum_name);
@@ -899,7 +907,7 @@ pr_att_name(
print_name(attname);
}
-/*
+/*
* Print special _Format global attribute, a virtual attribute not
* actually stored in the file.
*/
@@ -917,7 +925,7 @@ pr_att_global_format(
#ifdef USE_NETCDF4
-/*
+/*
* Print special reserved variable attributes, such as _Chunking,
* _DeflateLevel, ... These are virtual, not real, attributes
* generated from the result of inquire calls. They are of primitive
@@ -1026,7 +1034,7 @@ pr_att_specials(
#endif /* USE_NETCDF4 */
-/*
+/*
* Print a variable attribute for NcML
*/
static void
@@ -1073,10 +1081,10 @@ pr_attx(
default:
att.vals = (double *) emalloc((att.len + 1) * sizeof(double));
NC_CHECK( nc_get_att_double(ncid, varid, att.name, att.vals ) );
- attvalslen = 20*att.len; /* max 20 chars for each value and blank separator */
+ attvalslen = PRIM_LEN * att.len; /* max chars for each value and blank separator */
attvals = (char *) emalloc(attvalslen + 1);
pr_att_valsx(att.type, att.len, att.vals, attvals, attvalslen);
- free(att.vals);
+ free(att.vals);
break;
}
@@ -1087,8 +1095,8 @@ pr_attx(
#endif /* USE_NETCDF4 */
) {
/* TODO: XML-ish escapes for special chars in names */
- printf ("%s <attribute name=\"%s\" value=",
- varid != NC_GLOBAL ? " " : "",
+ printf ("%s <attribute name=\"%s\" value=",
+ varid != NC_GLOBAL ? " " : "",
att.name);
/* print attvals as a string with XML escapes */
pr_attx_string(attvalslen, attvals);
@@ -1096,9 +1104,9 @@ pr_attx(
char att_type_name[NC_MAX_NAME + 1];
get_type_name(ncid, att.type, att_type_name);
/* TODO: print full type name with group prefix, when needed */
- printf ("%s <attribute name=\"%s\" type=\"%s\" value=\"",
- varid != NC_GLOBAL ? " " : "",
- att.name,
+ printf ("%s <attribute name=\"%s\" type=\"%s\" value=\"",
+ varid != NC_GLOBAL ? " " : "",
+ att.name,
att_type_name);
printf("%s\"",attvals);
}
@@ -1157,10 +1165,10 @@ print_enum_type(int ncid, nc_type typeid) {
char *esc_mn;
int res;
- NC_CHECK( nc_inq_user_type(ncid, typeid, type_name, &type_size, &base_nc_type,
+ NC_CHECK( nc_inq_user_type(ncid, typeid, type_name, &type_size, &base_nc_type,
&type_nfields, &type_class) );
- get_type_name(ncid, base_nc_type, base_type_name);
+ get_type_name(ncid, base_nc_type, base_type_name);
indent_out();
esc_btn = escaped_name(base_type_name);
esc_tn = escaped_name(type_name);
@@ -1206,7 +1214,7 @@ print_enum_type(int ncid, nc_type typeid) {
break;
}
esc_mn = escaped_name(memname);
- res = snprintf(safe_buf, SAFE_BUF_LEN, "%s = %lld%s", esc_mn,
+ res = snprintf(safe_buf, SAFE_BUF_LEN, "%s = %lld%s", esc_mn,
memval, delim);
assert(res < SAFE_BUF_LEN);
free(esc_mn);
@@ -1218,14 +1226,14 @@ print_enum_type(int ncid, nc_type typeid) {
/* Print a user-defined type declaration */
static void
print_ud_type(int ncid, nc_type typeid) {
-
+
char type_name[NC_MAX_NAME + 1];
char base_type_name[NC_MAX_NAME + 1];
size_t type_nfields, type_size;
nc_type base_nc_type;
int f, type_class;
-
- NC_CHECK( nc_inq_user_type(ncid, typeid, type_name, &type_size, &base_nc_type,
+
+ NC_CHECK( nc_inq_user_type(ncid, typeid, type_name, &type_size, &base_nc_type,
&type_nfields, &type_class) );
switch(type_class) {
case NC_VLEN:
@@ -1257,7 +1265,7 @@ print_ud_type(int ncid, nc_type typeid) {
nc_type field_type;
int field_ndims;
int d;
-
+
indent_out();
/* printf("compound %s {\n", type_name); */
printf("compound ");
@@ -1265,8 +1273,8 @@ print_ud_type(int ncid, nc_type typeid) {
printf(" {\n");
for (f = 0; f < type_nfields; f++)
{
- NC_CHECK( nc_inq_compound_field(ncid, typeid, f, field_name,
- &field_offset, &field_type,
+ NC_CHECK( nc_inq_compound_field(ncid, typeid, f, field_name,
+ &field_offset, &field_type,
&field_ndims, NULL) );
/* TODO: don't bother if field_type_name not needed here */
get_type_name(ncid, field_type, field_type_name);
@@ -1278,8 +1286,8 @@ print_ud_type(int ncid, nc_type typeid) {
print_name(field_name);
if (field_ndims > 0) {
int *field_dim_sizes = (int *) emalloc((field_ndims + 1) * sizeof(int));
- NC_CHECK( nc_inq_compound_field(ncid, typeid, f, NULL,
- NULL, NULL, NULL,
+ NC_CHECK( nc_inq_compound_field(ncid, typeid, f, NULL,
+ NULL, NULL, NULL,
field_dim_sizes) );
printf("(");
for (d = 0; d < field_ndims-1; d++)
@@ -1307,9 +1315,9 @@ get_fill_info(int ncid, int varid, ncvar_t *vp) {
ncatt_t att; /* attribute */
int nc_status; /* return from netcdf calls */
void *fillvalp = NULL;
-
+
vp->has_fillval = 1; /* by default, but turn off for bytes */
-
+
/* get _FillValue attribute */
nc_status = nc_inq_att(ncid,varid,_FillValue,&att.type,&att.len);
fillvalp = emalloc(vp->tinfo->size + 1);
@@ -1378,7 +1386,7 @@ get_fill_info(int ncid, int varid, ncvar_t *vp) {
* files can have groups, so recursion will not take place for classic
* format files.)
*
- * ncid: id of open file (first call) or group (subsequent recursive calls)
+ * ncid: id of open file (first call) or group (subsequent recursive calls)
* path: file path name (first call)
*/
static void
@@ -1470,7 +1478,7 @@ do_ncdump_rec(int ncid, const char *path)
/* Find the number of dimids defined in this group. */
NC_CHECK( nc_inq_ndims(ncid, &ndims_grp) );
dimids_grp = (int *)emalloc((ndims_grp + 1) * sizeof(int));
-
+
/* Find the dimension ids in this group. */
NC_CHECK( nc_inq_dimids(ncid, 0, dimids_grp, 0) );
@@ -1478,7 +1486,7 @@ do_ncdump_rec(int ncid, const char *path)
NC_CHECK( nc_inq_unlimdims(ncid, &nunlim, NULL) );
unlimids = (int *)emalloc((nunlim + 1) * sizeof(int));
NC_CHECK( nc_inq_unlimdims(ncid, &nunlim, unlimids) );
-
+
/* For each dimension defined in this group, get and print out info. */
for (d_grp = 0; d_grp < ndims_grp; d_grp++)
{
@@ -1491,7 +1499,7 @@ do_ncdump_rec(int ncid, const char *path)
if(dimid == unlimids[uld]) {
is_unlimited = 1;
break;
- }
+ }
}
stat = nc_inq_dim(ncid, dimid, dims[d_grp].name, &dims[d_grp].size);
if (stat == NC_EDIMSIZE && SIZEOF_SIZE_T < 8) {
@@ -1505,14 +1513,14 @@ do_ncdump_rec(int ncid, const char *path)
printf (" = ");
if(SIZEOF_SIZE_T >= 8) {
if (is_unlimited) {
- printf ("UNLIMITED ; // (%lu currently)\n",
+ printf ("UNLIMITED ; // (%lu currently)\n",
(unsigned long)dims[d_grp].size);
} else {
printf ("%lu ;\n", (unsigned long)dims[d_grp].size);
}
} else { /* 32-bit platform */
if (is_unlimited) {
- printf ("UNLIMITED ; // (%u currently)\n",
+ printf ("UNLIMITED ; // (%u currently)\n",
(unsigned int)dims[d_grp].size);
} else {
printf ("%u ;\n", (unsigned int)dims[d_grp].size);
@@ -1531,7 +1539,7 @@ do_ncdump_rec(int ncid, const char *path)
print_name(dims[dimid].name);
printf (" = ");
if (dimid == xdimid) {
- printf ("UNLIMITED ; // (%u currently)\n",
+ printf ("UNLIMITED ; // (%u currently)\n",
(unsigned int)dims[dimid].size);
} else {
printf ("%u ;\n", (unsigned int)dims[dimid].size);
@@ -1549,11 +1557,11 @@ do_ncdump_rec(int ncid, const char *path)
* 64-bit offset files. So we need to know the output file type
* to know how to print strings with embedded newlines. */
NC_CHECK( nc_inq_format(ncid, &kind) );
-
+
/* For each var, get and print out info. */
memset((void*)&var,0,sizeof(var));
-
+
for (varid = 0; varid < nvars; varid++) {
NC_CHECK( nc_inq_varndims(ncid, varid, &var.ndims) );
if(var.dims != NULL) free(var.dims);
@@ -1651,7 +1659,7 @@ do_ncdump_rec(int ncid, const char *path)
/* output variable data, unless "-h" option specified header only
* or this group is not in list of groups specified by "-g"
* option */
- if (! formatting_specs.header_only &&
+ if (! formatting_specs.header_only &&
group_wanted(ncid, formatting_specs.nlgrps, formatting_specs.grpids) ) {
if (nvars > 0) {
indent_out();
@@ -1727,13 +1735,13 @@ do_ncdump_rec(int ncid, const char *path)
/* See how many groups there are. */
NC_CHECK( nc_inq_grps(ncid, &numgrps, NULL) );
-
+
/* Allocate memory to hold the list of group ids. */
ncids = emalloc((numgrps + 1) * sizeof(int));
-
+
/* Get the list of group ids. */
NC_CHECK( nc_inq_grps(ncid, NULL, ncids) );
-
+
/* Call this function for each group. */
for (g = 0; g < numgrps; g++)
{
@@ -1753,7 +1761,7 @@ do_ncdump_rec(int ncid, const char *path)
printf ("\n");
indent_less();
}
-
+
free(ncids);
}
#endif /* USE_NETCDF4 */
@@ -1829,10 +1837,10 @@ do_ncdumpx(int ncid, const char *path)
for (dimid = 0; dimid < ndims; dimid++) {
NC_CHECK( nc_inq_dim(ncid, dimid, dims[dimid].name, &dims[dimid].size) );
if (dimid == xdimid)
- printf(" <dimension name=\"%s\" length=\"%d\" isUnlimited=\"true\" />\n",
+ printf(" <dimension name=\"%s\" length=\"%d\" isUnlimited=\"true\" />\n",
dims[dimid].name, (int)dims[dimid].size);
else
- printf (" <dimension name=\"%s\" length=\"%d\" />\n",
+ printf (" <dimension name=\"%s\" length=\"%d\" />\n",
dims[dimid].name, (int)dims[dimid].size);
}
@@ -1880,7 +1888,7 @@ do_ncdumpx(int ncid, const char *path)
}
printf (" </variable>\n");
}
-
+
printf ("</netcdf>\n");
if (vlist)
freeidlist(vlist);
@@ -2057,7 +2065,7 @@ main(int argc, char *argv[])
break;
case 'g': /* group names */
/* make list of names of groups specified */
- make_lgrps (optarg, &formatting_specs.nlgrps, &formatting_specs.lgrps,
+ make_lgrps (optarg, &formatting_specs.nlgrps, &formatting_specs.lgrps,
&formatting_specs.grpids);
break;
case 'd': /* specify precision for floats (deprecated, undocumented) */
@@ -2097,7 +2105,7 @@ main(int argc, char *argv[])
case 'm':
formatting_specs.xopt_inmemory = 1;
break;
- default:
+ default:
error("invalid value for -X option: %s", optarg);
break;
}
@@ -2108,7 +2116,7 @@ main(int argc, char *argv[])
}
set_max_len(max_len);
-
+
argc -= optind;
argv += optind;
@@ -2123,11 +2131,11 @@ main(int argc, char *argv[])
init_epsilons();
- {
+ {
char *path = strdup(argv[i]);
if(!path)
error("out of memory copying argument %s", argv[i]);
- if (!nameopt)
+ if (!nameopt)
formatting_specs.name = name_path(path);
if (argc > 0) {
int ncid, nc_status;
@@ -2151,7 +2159,7 @@ main(int argc, char *argv[])
nc_status = fileopen(path,&mem,&size);
if(nc_status == NC_NOERR)
nc_status = nc_open_mem(path,NC_DISKLESS|NC_INMEMORY,size,mem,&ncid);
- } else
+ } else
#endif
nc_status = nc_open(path, NC_NOWRITE, &ncid);
if (nc_status != NC_NOERR) {
@@ -2198,4 +2206,4 @@ main(int argc, char *argv[])
}
-END_OF_MAIN();
+END_OF_MAIN()
diff --git a/ncdump/ref1.ncml b/ncdump/ref1.ncml
index 72d447c..37c245a 100644
--- a/ncdump/ref1.ncml
+++ b/ncdump/ref1.ncml
@@ -4,8 +4,10 @@
<dimension name="t" length="0" isUnlimited="true" />
<attribute name="gtatt" value="<, >, ', ", and &" />
<attribute name="gnatt" type="int" value="3 4" />
+ <attribute name="gdatt" type="double" value="-7.02788826649782e-09 7.02788826649782e-09" />
<variable name="var" shape="t m" type="float">
<attribute name="tatt" value="text attribute value" />
<attribute name="natt" type="int" value="1 2" />
+ <attribute name="datt" type="double" value="7.02788826649782e-09 -7.02788826649782e-09" />
</variable>
</netcdf>
diff --git a/ncdump/ref_ctest.c b/ncdump/ref_ctest.c
index 95b2199..753c880 100644
--- a/ncdump/ref_ctest.c
+++ b/ncdump/ref_ctest.c
@@ -933,7 +933,7 @@ main() { /* create ctest0.nc */
}
{ /* store c3 */
- static char c3[] = {"\001\300."};
+ static char c3[] = {"\001\177."};
stat = nc_put_var_text(ncid, c3_id, c3);
check_err(stat,__LINE__,__FILE__);
}
diff --git a/ncdump/ref_ctest1_nc4.cdl b/ncdump/ref_ctest1_nc4.cdl
index fbccfe5..e6727da 100644
--- a/ncdump/ref_ctest1_nc4.cdl
+++ b/ncdump/ref_ctest1_nc4.cdl
@@ -167,7 +167,7 @@ data:
d2 = -1e+308, 1e+308 ;
- c3 = "\001\300." ;
+ c3 = "\001\177." ;
b3 = -128, 127, -1 ;
diff --git a/ncdump/ref_ctest1_nc4c.cdl b/ncdump/ref_ctest1_nc4c.cdl
index 5a6bf6c..eeb0567 100644
--- a/ncdump/ref_ctest1_nc4c.cdl
+++ b/ncdump/ref_ctest1_nc4c.cdl
@@ -159,7 +159,7 @@ data:
d2 = -1e+308, 1e+308 ;
- c3 = "\001\300." ;
+ c3 = "\001\177." ;
b3 = -128, 127, -1 ;
diff --git a/ncdump/ref_ctest64.c b/ncdump/ref_ctest64.c
index 0c116a7..ea89614 100644
--- a/ncdump/ref_ctest64.c
+++ b/ncdump/ref_ctest64.c
@@ -933,7 +933,7 @@ main() { /* create ctest0_64.nc */
}
{ /* store c3 */
- static char c3[] = {"\001\300."};
+ static char c3[] = {"\001\177."};
stat = nc_put_var_text(ncid, c3_id, c3);
check_err(stat,__LINE__,__FILE__);
}
diff --git a/ncdump/ref_tst_utf8_4.cdl b/ncdump/ref_tst_utf8_4.cdl
new file mode 100644
index 0000000..3823e54
--- /dev/null
+++ b/ncdump/ref_tst_utf8_4.cdl
@@ -0,0 +1,24 @@
+netcdf utf8 {
+dimensions:
+ xā = 2 ;
+ 㼿y = 2 ;
+ Καλημέρα = 18 ;
+variables:
+ int (xā, 㼿y) ;
+ char Καλημέρα(Καλημέρα) ;
+ Καλημέρα:units = "Καλημέρα" ;
+ string s(xā);
+ string s:satt = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ";
+
+// global attributes:
+ :Gā = "ā㼿y" ;
+data:
+
+ =
+ 1, 2,
+ 3, 4 ;
+
+ Καλημέρα = "\316\232\316\261\316\273\316\267\316\274\341\275\263\317\201\316\261" ;
+
+ s = "キャク", "龥";
+}
diff --git a/ncdump/run_utf8_tests.sh b/ncdump/run_utf8_tests.sh
index a86f2a0..c4eabec 100755
--- a/ncdump/run_utf8_tests.sh
+++ b/ncdump/run_utf8_tests.sh
@@ -6,6 +6,13 @@ set -e
echo ""
echo "*** Testing ncgen and ncdump for UTF8 support..."
+if test "x$builddir" = x ; then
+builddir="."
+fi
+if test "x$srcdir" = x ; then
+srcdir="."
+fi
+
rm -f utf8.nc utf8.cdl
echo "*** creating classic offset file with utf8 characters..."
../ncgen/ncgen -b -o utf8.nc ${srcdir}/ref_tst_utf8.cdl
@@ -14,6 +21,13 @@ echo "*** dump and compare utf8 output..."
diff -b -w utf8.cdl ${srcdir}/ref_tst_utf8.cdl
rm -f utf8.nc utf8.cdl
+echo "*** creating enhanced file with utf8 characters..."
+../ncgen/ncgen -4 -b -o utf8.nc ${srcdir}/ref_tst_utf8_4.cdl
+echo "*** dump and compare utf8 output..."
+./ncdump utf8.nc > utf8.cdl
+diff -b -w utf8.cdl ${srcdir}/ref_tst_utf8_4.cdl
+
+rm -f utf8.nc utf8.cdl
echo "*** creating 64-bit offset file with utf8 characters..."
../ncgen/ncgen -k 64-bit-offset -b -o utf8.nc ${srcdir}/ref_tst_utf8.cdl
echo "*** (64 bit) dump and compare utf8 output..."
diff --git a/ncdump/tst_ncml.cdl b/ncdump/tst_ncml.cdl
index ce2c7db..822646c 100644
--- a/ncdump/tst_ncml.cdl
+++ b/ncdump/tst_ncml.cdl
@@ -6,6 +6,8 @@ variables:
float var (t, m);
var:tatt = "text attribute value" ;
var:natt = 1, 2;
+ var:datt = 7.02788826649782e-09, -7.02788826649782e-09 ;
:gtatt = "<, >, \', \", and &" ;
:gnatt = 3, 4;
+ :gdatt = -7.02788826649782e-09, 7.02788826649782e-09 ;
}
diff --git a/ncdump/tst_output.sh b/ncdump/tst_output.sh
index f47102d..1ce461f 100755
--- a/ncdump/tst_output.sh
+++ b/ncdump/tst_output.sh
@@ -26,7 +26,7 @@ echo "*** test output for ncdump -x"
echo "*** creating tst_ncml.nc from tst_ncml.cdl"
../ncgen/ncgen -b -o tst_ncml.nc $srcdir/tst_ncml.cdl
echo "*** creating c1.ncml from tst_ncml.nc"
-./ncdump -x tst_ncml.nc > c1.ncml
+./ncdump -x tst_ncml.nc | sed 's/e-00/e-0/g' > c1.ncml
echo "*** comparing ncdump -x of generated file with ref1.ncml ..."
diff -b c1.ncml $srcdir/ref1.ncml
diff --git a/ncdump/vardata.c b/ncdump/vardata.c
index 32be695..6131e78 100644
--- a/ncdump/vardata.c
+++ b/ncdump/vardata.c
@@ -503,7 +503,7 @@ print_rows(
}
printf("%s", sbuf_str(sb));
lastdelim (0, lastrow);
- annotate (vp, cor, 0L);
+ annotate (vp, cor, d0);
} else {
for (j = 0; j < marks_pending; j++) {
sbuf_cat(sb, "}");
diff --git a/ncgen/Makefile.in b/ncgen/Makefile.in
index 6c60745..211696d 100644
--- a/ncgen/Makefile.in
+++ b/ncgen/Makefile.in
@@ -436,6 +436,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -511,7 +514,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncgen/c0.cdl b/ncgen/c0.cdl
index b92692d..1bfe245 100644
--- a/ncgen/c0.cdl
+++ b/ncgen/c0.cdl
@@ -159,7 +159,7 @@ data:
d2 = -1e+308, 1e+308 ;
- c3 = "\001\300." ;
+ c3 = "\001\177." ;
b3 = -128, 127, -1 ;
diff --git a/ncgen/c0_4.cdl b/ncgen/c0_4.cdl
index e399d3a..dd425f7 100644
--- a/ncgen/c0_4.cdl
+++ b/ncgen/c0_4.cdl
@@ -167,7 +167,7 @@ data:
d2 = -1e+308, 1e+308 ;
- c3 = "\001\300." ;
+ c3 = "\001\177." ;
b3 = -128, 127, -1 ;
diff --git a/ncgen/genbin.c b/ncgen/genbin.c
index 4597be5..06503aa 100644
--- a/ncgen/genbin.c
+++ b/ncgen/genbin.c
@@ -439,24 +439,30 @@ genbin_writeattr(Generator* generator, Symbol* asym, Bytebuffer* databuf,
/* Use the specialized put_att_XX routines if possible*/
if(isprim(basetype->typ.typecode)) {
- switch (basetype->typ.typecode) {
- case NC_BYTE: {
- signed char* data = (signed char*)bbContents(databuf);
- stat = nc_put_att_schar(grpid,varid,asym->name,typid,len,data);
- check_err(stat,__LINE__,__FILE__);
- } break;
- case NC_CHAR: {
- char* data = (char*)bbContents(databuf);
+ switch (basetype->typ.typecode) {
+ case NC_BYTE: {
+ signed char* data = (signed char*)bbContents(databuf);
+ stat = nc_put_att_schar(grpid,varid,asym->name,typid,len,data);
+ check_err(stat,__LINE__,__FILE__);
+ } break;
+ case NC_CHAR: {
+ char* data = (char*)bbContents(databuf);
size_t slen = bbLength(databuf);
/* Revise length if slen == 0 */
- if(slen == 0) {bbAppend(databuf,'\0'); slen++;}
- stat = nc_put_att_text(grpid,varid,asym->name,slen,data);
- check_err(stat,__LINE__,__FILE__);
- } break;
- case NC_SHORT: {
- short* data = (short*)bbContents(databuf);
- stat = nc_put_att_short(grpid,varid,asym->name,typid,len,data);
- check_err(stat,__LINE__,__FILE__);
+ if(slen == 0) {
+ bbAppend(databuf,'\0');
+ /* bbAppend frees the memory pointed to by char* data,
+ so re-assign. See Coverity issue: 1265731.*/
+ data = (char*)bbContents(databuf);
+ slen++;
+ }
+ stat = nc_put_att_text(grpid,varid,asym->name,slen,data);
+ check_err(stat,__LINE__,__FILE__);
+ } break;
+ case NC_SHORT: {
+ short* data = (short*)bbContents(databuf);
+ stat = nc_put_att_short(grpid,varid,asym->name,typid,len,data);
+ check_err(stat,__LINE__,__FILE__);
} break;
case NC_INT: {
int* data = (int*)bbContents(databuf);
diff --git a/ncgen/main.c b/ncgen/main.c
index d9fbb91..d0b8d4d 100644
--- a/ncgen/main.c
+++ b/ncgen/main.c
@@ -514,7 +514,7 @@ main(
return 0;
}
-END_OF_MAIN();
+END_OF_MAIN()
void
init_netcdf(void) /* initialize global counts, flags */
diff --git a/ncgen/ncgentab.c b/ncgen/ncgentab.c
index fed41d0..6622e18 100644
--- a/ncgen/ncgentab.c
+++ b/ncgen/ncgentab.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 3.0. */
+/* A Bison parser, made by GNU Bison 2.5. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -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 "3.0"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -58,19 +58,23 @@
/* Pull parsers. */
#define YYPULL 1
+/* Using locations. */
+#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
#define yyparse ncgparse
#define yylex ncglex
#define yyerror ncgerror
+#define yylval ncglval
+#define yychar ncgchar
#define yydebug ncgdebug
#define yynerrs ncgnerrs
-#define yylval ncglval
-#define yychar ncgchar
/* Copy the first part of user declarations. */
-#line 11 "ncgen.y" /* yacc.c:339 */
+
+/* Line 268 of yacc.c */
+#line 11 "ncgen.y"
/*
static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
@@ -188,15 +192,14 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl;
extern int lex_init(void);
-#line 192 "ncgentab.c" /* yacc.c:339 */
-# ifndef YY_NULL
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULL nullptr
-# else
-# define YY_NULL 0
-# endif
-# endif
+/* Line 268 of yacc.c */
+#line 198 "ncgentab.c"
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
@@ -206,80 +209,77 @@ extern int lex_init(void);
# define YYERROR_VERBOSE 1
#endif
-/* In a future release of Bison, this section will be replaced
- by #include "ncgentab.h". */
-#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
-# define YY_NCG_NCGEN_TAB_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-#if YYDEBUG
-extern int ncgdebug;
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
#endif
-/* Token type. */
+
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- NC_UNLIMITED_K = 258,
- CHAR_K = 259,
- BYTE_K = 260,
- SHORT_K = 261,
- INT_K = 262,
- FLOAT_K = 263,
- DOUBLE_K = 264,
- UBYTE_K = 265,
- USHORT_K = 266,
- UINT_K = 267,
- INT64_K = 268,
- UINT64_K = 269,
- IDENT = 270,
- TERMSTRING = 271,
- CHAR_CONST = 272,
- BYTE_CONST = 273,
- SHORT_CONST = 274,
- INT_CONST = 275,
- INT64_CONST = 276,
- UBYTE_CONST = 277,
- USHORT_CONST = 278,
- UINT_CONST = 279,
- UINT64_CONST = 280,
- FLOAT_CONST = 281,
- DOUBLE_CONST = 282,
- DIMENSIONS = 283,
- VARIABLES = 284,
- NETCDF = 285,
- DATA = 286,
- TYPES = 287,
- COMPOUND = 288,
- ENUM = 289,
- OPAQUE = 290,
- OPAQUESTRING = 291,
- GROUP = 292,
- PATH = 293,
- FILLMARKER = 294,
- NIL = 295,
- _FILLVALUE = 296,
- _FORMAT = 297,
- _STORAGE = 298,
- _CHUNKSIZES = 299,
- _DEFLATELEVEL = 300,
- _SHUFFLE = 301,
- _ENDIANNESS = 302,
- _NOFILL = 303,
- _FLETCHER32 = 304,
- DATASETID = 305
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NC_UNLIMITED_K = 258,
+ CHAR_K = 259,
+ BYTE_K = 260,
+ SHORT_K = 261,
+ INT_K = 262,
+ FLOAT_K = 263,
+ DOUBLE_K = 264,
+ UBYTE_K = 265,
+ USHORT_K = 266,
+ UINT_K = 267,
+ INT64_K = 268,
+ UINT64_K = 269,
+ IDENT = 270,
+ TERMSTRING = 271,
+ CHAR_CONST = 272,
+ BYTE_CONST = 273,
+ SHORT_CONST = 274,
+ INT_CONST = 275,
+ INT64_CONST = 276,
+ UBYTE_CONST = 277,
+ USHORT_CONST = 278,
+ UINT_CONST = 279,
+ UINT64_CONST = 280,
+ FLOAT_CONST = 281,
+ DOUBLE_CONST = 282,
+ DIMENSIONS = 283,
+ VARIABLES = 284,
+ NETCDF = 285,
+ DATA = 286,
+ TYPES = 287,
+ COMPOUND = 288,
+ ENUM = 289,
+ OPAQUE = 290,
+ OPAQUESTRING = 291,
+ GROUP = 292,
+ PATH = 293,
+ FILLMARKER = 294,
+ NIL = 295,
+ _FILLVALUE = 296,
+ _FORMAT = 297,
+ _STORAGE = 298,
+ _CHUNKSIZES = 299,
+ _DEFLATELEVEL = 300,
+ _SHUFFLE = 301,
+ _ENDIANNESS = 302,
+ _NOFILL = 303,
+ _FLETCHER32 = 304,
+ DATASETID = 305
+ };
#endif
-/* Value type. */
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
+typedef union YYSTYPE
{
-#line 131 "ncgen.y" /* yacc.c:355 */
+
+/* Line 293 of yacc.c */
+#line 131 "ncgen.y"
Symbol* sym;
unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/
@@ -288,22 +288,22 @@ int nctype; /* for tracking attribute list type*/
Datalist* datalist;
NCConstant constant;
-#line 292 "ncgentab.c" /* yacc.c:355 */
-};
+
+
+/* Line 293 of yacc.c */
+#line 295 "ncgentab.c"
+} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-extern YYSTYPE ncglval;
-
-int ncgparse (void);
-
-#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */
-
/* Copy the second part of user declarations. */
-#line 307 "ncgentab.c" /* yacc.c:358 */
+
+/* Line 343 of yacc.c */
+#line 307 "ncgentab.c"
#ifdef short
# undef short
@@ -317,8 +317,11 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#else
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -338,7 +341,8 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -352,49 +356,39 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
# endif
# endif
# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if (! defined __GNUC__ || __GNUC__ < 2 \
- || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
-# define __attribute__(Spec) /* empty */
+# define YY_(msgid) msgid
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YYUSE(e) ((void) (e))
#else
-# define YYUSE(E) /* empty */
+# define YYUSE(e) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(n) (n)
#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+ int yyi;
#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+{
+ return yyi;
+}
#endif
-
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -412,9 +406,9 @@ typedef short int yytype_int16;
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
@@ -424,8 +418,8 @@ typedef short int yytype_int16;
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -441,7 +435,7 @@ typedef short int yytype_int16;
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -449,13 +443,15 @@ typedef short int yytype_int16;
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -465,7 +461,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
@@ -490,35 +486,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 (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 (YYID (0))
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
+/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (0)
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -534,19 +530,17 @@ union yyalloc
#define YYNNTS 67
/* YYNRULES -- Number of rules. */
#define YYNRULES 150
-/* YYNSTATES -- Number of states. */
+/* YYNRULES -- Number of states. */
#define YYNSTATES 251
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 305
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -583,7 +577,79 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint16 yyprhs[] =
+{
+ 0, 0, 3, 7, 9, 14, 20, 21, 24, 25,
+ 26, 36, 37, 39, 42, 44, 47, 49, 51, 54,
+ 57, 60, 63, 66, 67, 69, 76, 78, 82, 86,
+ 92, 98, 104, 107, 111, 114, 116, 118, 120, 122,
+ 124, 126, 128, 130, 132, 134, 136, 137, 139, 142,
+ 145, 149, 151, 153, 155, 159, 163, 167, 171, 175,
+ 177, 178, 180, 183, 186, 190, 192, 194, 197, 199,
+ 203, 206, 207, 211, 213, 217, 219, 221, 225, 228,
+ 229, 233, 235, 239, 241, 243, 245, 247, 249, 251,
+ 252, 256, 261, 268, 274, 280, 287, 293, 299, 305,
+ 311, 317, 323, 329, 334, 336, 338, 339, 341, 344,
+ 347, 351, 355, 357, 359, 360, 362, 366, 368, 372,
+ 374, 376, 378, 380, 382, 384, 386, 391, 393, 397,
+ 399, 401, 403, 405, 407, 409, 411, 413, 415, 417,
+ 419, 421, 423, 427, 429, 431, 433, 435, 437, 439,
+ 441
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 61, 0, -1, 30, 62, 63, -1, 50, -1, 51,
+ 64, 65, 52, -1, 107, 69, 84, 90, 110, -1,
+ -1, 65, 66, -1, -1, -1, 37, 126, 51, 67,
+ 64, 65, 68, 52, 107, -1, -1, 32, -1, 32,
+ 70, -1, 72, -1, 70, 72, -1, 126, -1, 73,
+ -1, 108, 53, -1, 75, 74, -1, 80, 74, -1,
+ 79, 74, -1, 78, 74, -1, -1, 53, -1, 83,
+ 34, 71, 51, 76, 52, -1, 77, -1, 76, 54,
+ 77, -1, 126, 55, 123, -1, 35, 56, 20, 57,
+ 71, -1, 105, 56, 58, 57, 71, -1, 33, 71,
+ 51, 81, 52, -1, 82, 53, -1, 81, 82, 53,
+ -1, 105, 99, -1, 4, -1, 5, -1, 6, -1,
+ 7, -1, 8, -1, 9, -1, 10, -1, 11, -1,
+ 12, -1, 13, -1, 14, -1, -1, 28, -1, 28,
+ 85, -1, 86, 53, -1, 85, 86, 53, -1, 87,
+ -1, 108, -1, 88, -1, 87, 54, 88, -1, 89,
+ 55, 24, -1, 89, 55, 20, -1, 89, 55, 27,
+ -1, 89, 55, 3, -1, 126, -1, -1, 29, -1,
+ 29, 91, -1, 92, 53, -1, 91, 92, 53, -1,
+ 93, -1, 108, -1, 105, 94, -1, 95, -1, 94,
+ 54, 95, -1, 126, 96, -1, -1, 56, 97, 57,
+ -1, 98, -1, 97, 54, 98, -1, 109, -1, 100,
+ -1, 99, 54, 100, -1, 126, 101, -1, -1, 56,
+ 102, 57, -1, 103, -1, 102, 54, 103, -1, 24,
+ -1, 20, -1, 106, -1, 106, -1, 109, -1, 83,
+ -1, -1, 108, 53, 107, -1, 59, 126, 55, 113,
+ -1, 105, 106, 59, 126, 55, 113, -1, 106, 59,
+ 126, 55, 113, -1, 106, 59, 41, 55, 113, -1,
+ 105, 106, 59, 41, 55, 113, -1, 106, 59, 43,
+ 55, 124, -1, 106, 59, 44, 55, 122, -1, 106,
+ 59, 49, 55, 125, -1, 106, 59, 45, 55, 123,
+ -1, 106, 59, 46, 55, 125, -1, 106, 59, 47,
+ 55, 124, -1, 106, 59, 48, 55, 125, -1, 59,
+ 42, 55, 124, -1, 126, -1, 38, -1, -1, 31,
+ -1, 31, 111, -1, 112, 53, -1, 111, 112, 53,
+ -1, 104, 55, 113, -1, 114, -1, 115, -1, -1,
+ 116, -1, 113, 54, 116, -1, 117, -1, 51, 113,
+ 52, -1, 121, -1, 36, -1, 39, -1, 40, -1,
+ 118, -1, 119, -1, 109, -1, 126, 56, 120, 57,
+ -1, 121, -1, 120, 54, 121, -1, 17, -1, 18,
+ -1, 19, -1, 20, -1, 21, -1, 22, -1, 23,
+ -1, 24, -1, 25, -1, 26, -1, 27, -1, 16,
+ -1, 123, -1, 122, 54, 123, -1, 20, -1, 24,
+ -1, 21, -1, 25, -1, 16, -1, 124, -1, 123,
+ -1, 15, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 208, 208, 214, 216, 223, 230, 230, 233, 242,
@@ -605,7 +671,7 @@ static const yytype_uint16 yyrline[] =
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || 1
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@@ -632,13 +698,13 @@ static const char *const yytname[] =
"attrdecllist", "attrdecl", "path", "datasection", "datadecls",
"datadecl", "datalist", "datalist0", "datalist1", "dataitem",
"constdata", "econstref", "function", "arglist", "simpleconstant",
- "intlist", "constint", "conststring", "constbool", "ident", YY_NULL
+ "intlist", "constint", "conststring", "constbool", "ident", 0
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -650,51 +716,51 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -124
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-124)))
-
-#define YYTABLE_NINF -105
-
-#define yytable_value_is_error(Yytable_value) \
- 0
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 60, 61, 62, 63, 64, 65, 65, 67, 68,
+ 66, 69, 69, 69, 70, 70, 71, 72, 72, 73,
+ 73, 73, 73, 74, 74, 75, 76, 76, 77, 78,
+ 79, 80, 81, 81, 82, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 84, 84, 84, 85,
+ 85, 86, 86, 87, 87, 88, 88, 88, 88, 89,
+ 90, 90, 90, 91, 91, 92, 92, 93, 94, 94,
+ 95, 96, 96, 97, 97, 98, 99, 99, 100, 101,
+ 101, 102, 102, 103, 103, 104, 105, 106, 106, 107,
+ 107, 108, 108, 108, 108, 108, 108, 108, 108, 108,
+ 108, 108, 108, 108, 109, 109, 110, 110, 110, 111,
+ 111, 112, 113, 113, 114, 115, 115, 116, 116, 117,
+ 117, 117, 117, 117, 117, 118, 119, 120, 120, 121,
+ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
+ 121, 122, 122, 123, 123, 123, 123, 124, 125, 125,
+ 126
+};
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int16 yypact[] =
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
{
- -17, -16, 44, -124, 3, -124, 213, -124, -124, -124,
- -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
- -124, -6, -124, -124, 329, -4, 36, 25, -124, -124,
- 27, 50, 0, 31, 15, 157, 63, 213, 83, 281,
- 92, -124, -124, -3, 53, 54, 56, 61, 62, 65,
- 66, 67, 69, 92, 59, 157, -124, -124, 70, 70,
- 70, 70, 84, 225, 72, 213, 97, -124, -124, -124,
- -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
- -124, -124, -124, -124, -124, 281, -124, 74, -124, -124,
- -124, -124, -124, -124, -124, 73, 81, 79, 85, 281,
- 83, 68, 68, 60, 83, 60, 60, 281, 87, -124,
- 116, -124, -124, -124, -124, -124, -124, 92, 86, -124,
- 213, 93, 91, -124, 94, -124, 99, 213, 108, -26,
- 281, 330, -124, 281, 281, 74, -124, -124, -124, -124,
- -124, 98, -124, -124, -124, -124, -124, -124, -124, -124,
- 74, 329, 90, 104, 100, 95, -124, 92, 19, 213,
- 120, -124, 329, -124, 329, -124, -124, -124, -39, -124,
- 213, 74, 74, 68, 278, 122, 92, -124, 92, 92,
- 92, -124, -124, -124, -124, -124, -124, -124, 123, -124,
- 124, -124, 13, 125, -124, 329, 126, 330, -124, -124,
- -124, -124, 128, -124, 129, -124, 121, -124, 52, -124,
- 130, -124, -124, 92, 2, -124, 281, 133, -124, -124,
- 150, -124, 92, 5, -124, -124, 92, 68, -124, 132,
- -22, -124, -124, 74, -124, 137, -124, -124, -124, 29,
- -124, -124, -124, 2, -124, 213, 5, -124, -124, -124,
- -124
+ 0, 2, 3, 1, 4, 5, 0, 2, 0, 0,
+ 9, 0, 1, 2, 1, 2, 1, 1, 2, 2,
+ 2, 2, 2, 0, 1, 6, 1, 3, 3, 5,
+ 5, 5, 2, 3, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 1, 2, 2,
+ 3, 1, 1, 1, 3, 3, 3, 3, 3, 1,
+ 0, 1, 2, 2, 3, 1, 1, 2, 1, 3,
+ 2, 0, 3, 1, 3, 1, 1, 3, 2, 0,
+ 3, 1, 3, 1, 1, 1, 1, 1, 1, 0,
+ 3, 4, 6, 5, 5, 6, 5, 5, 5, 5,
+ 5, 5, 5, 4, 1, 1, 0, 1, 2, 2,
+ 3, 3, 1, 1, 0, 1, 3, 1, 3, 1,
+ 1, 1, 1, 1, 1, 1, 4, 1, 3, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
+ 1
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint8 yydefact[] =
{
0, 0, 0, 3, 0, 1, 89, 2, 35, 36,
@@ -725,19 +791,7 @@ static const yytype_uint8 yydefact[] =
82
};
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
-{
- -124, -124, -124, -124, 21, -5, -124, -124, -124, -124,
- -124, -107, 142, -124, 35, -124, -124, -28, -124, -124,
- -124, -124, 26, -14, -124, -124, 89, -124, 42, -124,
- -124, -124, 45, -124, -124, -12, -124, -124, -40, -124,
- -15, -124, -124, -41, -124, -24, -21, -37, -8, -32,
- -124, -124, 17, -83, -124, -124, 80, -124, -124, -124,
- -124, -123, -124, -96, -34, -57, -20
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 2, 4, 7, 22, 32, 42, 170, 235, 36,
@@ -749,9 +803,55 @@ static const yytype_int16 yydefgoto[] =
168, 94, 141, 144, 145, 146, 29
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -124
+static const yytype_int16 yypact[] =
+{
+ -17, -16, 44, -124, 3, -124, 213, -124, -124, -124,
+ -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+ -124, -6, -124, -124, 329, -4, 36, 25, -124, -124,
+ 27, 50, 0, 31, 15, 157, 63, 213, 83, 281,
+ 92, -124, -124, -3, 53, 54, 56, 61, 62, 65,
+ 66, 67, 69, 92, 59, 157, -124, -124, 70, 70,
+ 70, 70, 84, 225, 72, 213, 97, -124, -124, -124,
+ -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+ -124, -124, -124, -124, -124, 281, -124, 74, -124, -124,
+ -124, -124, -124, -124, -124, 73, 81, 79, 85, 281,
+ 83, 68, 68, 60, 83, 60, 60, 281, 87, -124,
+ 116, -124, -124, -124, -124, -124, -124, 92, 86, -124,
+ 213, 93, 91, -124, 94, -124, 99, 213, 108, -26,
+ 281, 330, -124, 281, 281, 74, -124, -124, -124, -124,
+ -124, 98, -124, -124, -124, -124, -124, -124, -124, -124,
+ 74, 329, 90, 104, 100, 95, -124, 92, 19, 213,
+ 120, -124, 329, -124, 329, -124, -124, -124, -39, -124,
+ 213, 74, 74, 68, 278, 122, 92, -124, 92, 92,
+ 92, -124, -124, -124, -124, -124, -124, -124, 123, -124,
+ 124, -124, 13, 125, -124, 329, 126, 330, -124, -124,
+ -124, -124, 128, -124, 129, -124, 121, -124, 52, -124,
+ 130, -124, -124, 92, 2, -124, 281, 133, -124, -124,
+ 150, -124, 92, 5, -124, -124, 92, 68, -124, 132,
+ -22, -124, -124, 74, -124, 137, -124, -124, -124, 29,
+ -124, -124, -124, 2, -124, 213, 5, -124, -124, -124,
+ -124
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
+{
+ -124, -124, -124, -124, 21, -5, -124, -124, -124, -124,
+ -124, -107, 142, -124, 35, -124, -124, -28, -124, -124,
+ -124, -124, 26, -14, -124, -124, 89, -124, 42, -124,
+ -124, -124, 45, -124, -124, -12, -124, -124, -40, -124,
+ -15, -124, -124, -41, -124, -24, -21, -37, -8, -32,
+ -124, -124, 17, -83, -124, -124, 80, -124, -124, -124,
+ -124, -123, -124, -96, -34, -57, -20
+};
+
+/* 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 -105
static const yytype_int16 yytable[] =
{
67, 31, 129, 33, 69, 142, 143, 86, 169, 19,
@@ -793,6 +893,12 @@ static const yytype_int16 yytable[] =
0, 0, 0, 0, 0, 0, 0, 20
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-124))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int16 yycheck[] =
{
37, 21, 85, 24, 38, 101, 102, 39, 131, 15,
@@ -834,8 +940,8 @@ static const yytype_int16 yycheck[] =
-1, -1, -1, -1, -1, -1, -1, 38
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 30, 61, 50, 62, 0, 51, 63, 4, 5,
@@ -866,83 +972,94 @@ static const yytype_uint8 yystos[] =
103
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 60, 61, 62, 63, 64, 65, 65, 67, 68,
- 66, 69, 69, 69, 70, 70, 71, 72, 72, 73,
- 73, 73, 73, 74, 74, 75, 76, 76, 77, 78,
- 79, 80, 81, 81, 82, 83, 83, 83, 83, 83,
- 83, 83, 83, 83, 83, 83, 84, 84, 84, 85,
- 85, 86, 86, 87, 87, 88, 88, 88, 88, 89,
- 90, 90, 90, 91, 91, 92, 92, 93, 94, 94,
- 95, 96, 96, 97, 97, 98, 99, 99, 100, 101,
- 101, 102, 102, 103, 103, 104, 105, 106, 106, 107,
- 107, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 108, 108, 108, 108, 109, 109, 110, 110, 110, 111,
- 111, 112, 113, 113, 114, 115, 115, 116, 116, 117,
- 117, 117, 117, 117, 117, 118, 119, 120, 120, 121,
- 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
- 121, 122, 122, 123, 123, 123, 123, 124, 125, 125,
- 126
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 3, 1, 4, 5, 0, 2, 0, 0,
- 9, 0, 1, 2, 1, 2, 1, 1, 2, 2,
- 2, 2, 2, 0, 1, 6, 1, 3, 3, 5,
- 5, 5, 2, 3, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 0, 1, 2, 2,
- 3, 1, 1, 1, 3, 3, 3, 3, 3, 1,
- 0, 1, 2, 2, 3, 1, 1, 2, 1, 3,
- 2, 0, 3, 1, 3, 1, 1, 3, 2, 0,
- 3, 1, 3, 1, 1, 1, 1, 1, 1, 0,
- 3, 4, 6, 5, 5, 6, 5, 5, 5, 5,
- 5, 5, 5, 4, 1, 1, 0, 1, 2, 2,
- 3, 3, 1, 1, 0, 1, 3, 1, 3, 1,
- 1, 1, 1, 1, 1, 1, 4, 1, 3, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
- 1
-};
-
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. 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 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 yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
+#define YYRECOVERING() (!!yyerrstatus)
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (1); \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (YYID (0))
+
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
-#define YYRECOVERING() (!!yyerrstatus)
+/* This macro is provided for backward compatibility. */
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+/* YYLEX -- calling `yylex' with the right arguments. */
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -952,46 +1069,54 @@ while (0)
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
# endif
- YYUSE (yytype);
+ switch (yytype)
+ {
+ default:
+ break;
+ }
}
@@ -999,11 +1124,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
@@ -1014,8 +1150,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
| TOP (included). |
`------------------------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *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++)
@@ -1026,42 +1170,49 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
{
- unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
+ unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1075,7 +1226,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1098,8 +1249,15 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1115,8 +1273,16 @@ yystrlen (const char *yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1146,27 +1312,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1189,11 +1355,12 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULL;
+ const char *yyformat = 0;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1201,6 +1368,10 @@ 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
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ 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
@@ -1249,13 +1420,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
}
}
}
@@ -1275,12 +1444,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
if (*yymsg_alloc < yysize)
{
@@ -1317,20 +1484,48 @@ 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)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
{
YYUSE (yyvaluep);
+
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
}
+/* Prevent warnings from -Wmissing-prototypes. */
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
/* The lookahead symbol. */
@@ -1338,6 +1533,7 @@ int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
+
/* Number of syntax errors so far. */
int yynerrs;
@@ -1346,18 +1542,37 @@ int yynerrs;
| yyparse. |
`----------*/
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
+ `yyss': related to states.
+ `yyvs': related to semantic values.
- Refer to the stacks through separate pointers, to allow yyoverflow
+ Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
@@ -1375,7 +1590,7 @@ yyparse (void)
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -1393,8 +1608,9 @@ yyparse (void)
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1403,6 +1619,14 @@ yyparse (void)
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;
/*------------------------------------------------------------.
@@ -1423,23 +1647,23 @@ yyparse (void)
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1447,22 +1671,22 @@ yyparse (void)
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_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 */
@@ -1471,10 +1695,10 @@ yyparse (void)
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));
@@ -1503,7 +1727,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex ();
+ yychar = YYLEX;
}
if (yychar <= YYEOF)
@@ -1543,9 +1767,7 @@ yybackup:
yychar = YYEMPTY;
yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
@@ -1568,7 +1790,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
@@ -1582,84 +1804,95 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 211 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 211 "ncgen.y"
{if (error_count > 0) YYABORT;}
-#line 1588 "ncgentab.c" /* yacc.c:1646 */
break;
case 3:
-#line 214 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 214 "ncgen.y"
{createrootgroup(datasetname);}
-#line 1594 "ncgentab.c" /* yacc.c:1646 */
break;
case 8:
-#line 233 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 233 "ncgen.y"
{
- Symbol* id = (yyvsp[-1].sym);
+ Symbol* id = (yyvsp[(2) - (3)].sym);
markcdf4("Group specification");
if(creategroup(id) == NULL)
yyerror("duplicate group declaration within parent group for %s",
id->name);
}
-#line 1606 "ncgentab.c" /* yacc.c:1646 */
break;
case 9:
-#line 242 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 242 "ncgen.y"
{listpop(groupstack);}
-#line 1612 "ncgentab.c" /* yacc.c:1646 */
break;
case 12:
-#line 248 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 248 "ncgen.y"
{}
-#line 1618 "ncgentab.c" /* yacc.c:1646 */
break;
case 13:
-#line 250 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 250 "ncgen.y"
{markcdf4("Type specification");}
-#line 1624 "ncgentab.c" /* yacc.c:1646 */
break;
case 16:
-#line 256 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 256 "ncgen.y"
{ /* Use when defining a type */
- (yyvsp[0].sym)->objectclass = NC_TYPE;
- if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym)))
+ (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE;
+ if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym)))
yyerror("duplicate type declaration for %s",
- (yyvsp[0].sym)->name);
- listpush(typdefs,(void*)(yyvsp[0].sym));
+ (yyvsp[(1) - (1)].sym)->name);
+ listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym));
}
-#line 1636 "ncgentab.c" /* yacc.c:1646 */
break;
case 17:
-#line 265 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 265 "ncgen.y"
{}
-#line 1642 "ncgentab.c" /* yacc.c:1646 */
break;
case 18:
-#line 265 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 265 "ncgen.y"
{}
-#line 1648 "ncgentab.c" /* yacc.c:1646 */
break;
case 25:
-#line 279 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 279 "ncgen.y"
{
int i;
- addtogroup((yyvsp[-3].sym)); /* sets prefix*/
- (yyvsp[-3].sym)->objectclass=NC_TYPE;
- (yyvsp[-3].sym)->subclass=NC_ENUM;
- (yyvsp[-3].sym)->typ.basetype=(yyvsp[-5].sym);
- (yyvsp[-3].sym)->typ.size = (yyvsp[-5].sym)->typ.size;
- (yyvsp[-3].sym)->typ.alignment = (yyvsp[-5].sym)->typ.alignment;
- stackbase=(yyvsp[-1].mark);
+ addtogroup((yyvsp[(3) - (6)].sym)); /* sets prefix*/
+ (yyvsp[(3) - (6)].sym)->objectclass=NC_TYPE;
+ (yyvsp[(3) - (6)].sym)->subclass=NC_ENUM;
+ (yyvsp[(3) - (6)].sym)->typ.basetype=(yyvsp[(1) - (6)].sym);
+ (yyvsp[(3) - (6)].sym)->typ.size = (yyvsp[(1) - (6)].sym)->typ.size;
+ (yyvsp[(3) - (6)].sym)->typ.alignment = (yyvsp[(1) - (6)].sym)->typ.alignment;
+ stackbase=(yyvsp[(5) - (6)].mark);
stacklen=listlength(stack);
- (yyvsp[-3].sym)->subnodes = listnew();
+ (yyvsp[(3) - (6)].sym)->subnodes = listnew();
/* Variety of field fixups*/
/* 1. add in the enum values*/
/* 2. make this type be their container*/
@@ -1669,89 +1902,95 @@ yyreduce:
Symbol* eid = (Symbol*)listget(stack,i);
assert(eid->subclass == NC_ECONST);
addtogroup(eid);
- listpush((yyvsp[-3].sym)->subnodes,(void*)eid);
- eid->container = (yyvsp[-3].sym);
- eid->typ.basetype = (yyvsp[-3].sym)->typ.basetype;
+ listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid);
+ eid->container = (yyvsp[(3) - (6)].sym);
+ eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype;
}
listsetlength(stack,stackbase);/* remove stack nodes*/
}
-#line 1679 "ncgentab.c" /* yacc.c:1646 */
break;
case 26:
-#line 308 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 1685 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 308 "ncgen.y"
+ {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));}
break;
case 27:
-#line 310 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 310 "ncgen.y"
{
int i;
- (yyval.mark)=(yyvsp[-2].mark);
+ (yyval.mark)=(yyvsp[(1) - (3)].mark);
/* check for duplicates*/
- stackbase=(yyvsp[-2].mark);
+ stackbase=(yyvsp[(1) - (3)].mark);
stacklen=listlength(stack);
for(i=stackbase;i<stacklen;i++) {
Symbol* elem = (Symbol*)listget(stack,i);
- if(strcmp((yyvsp[0].sym)->name,elem->name)==0)
+ if(strcmp((yyvsp[(3) - (3)].sym)->name,elem->name)==0)
yyerror("duplicate enum declaration for %s",
elem->name);
}
- listpush(stack,(void*)(yyvsp[0].sym));
+ listpush(stack,(void*)(yyvsp[(3) - (3)].sym));
}
-#line 1704 "ncgentab.c" /* yacc.c:1646 */
break;
case 28:
-#line 327 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 327 "ncgen.y"
{
- (yyvsp[-2].sym)->objectclass=NC_TYPE;
- (yyvsp[-2].sym)->subclass=NC_ECONST;
- (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant);
- (yyval.sym)=(yyvsp[-2].sym);
+ (yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE;
+ (yyvsp[(1) - (3)].sym)->subclass=NC_ECONST;
+ (yyvsp[(1) - (3)].sym)->typ.econst=(yyvsp[(3) - (3)].constant);
+ (yyval.sym)=(yyvsp[(1) - (3)].sym);
}
-#line 1715 "ncgentab.c" /* yacc.c:1646 */
break;
case 29:
-#line 336 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 336 "ncgen.y"
{
vercheck(NC_OPAQUE);
- addtogroup((yyvsp[0].sym)); /*sets prefix*/
- (yyvsp[0].sym)->objectclass=NC_TYPE;
- (yyvsp[0].sym)->subclass=NC_OPAQUE;
- (yyvsp[0].sym)->typ.typecode=NC_OPAQUE;
- (yyvsp[0].sym)->typ.size=int32_val;
- (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
+ addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/
+ (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE;
+ (yyvsp[(5) - (5)].sym)->subclass=NC_OPAQUE;
+ (yyvsp[(5) - (5)].sym)->typ.typecode=NC_OPAQUE;
+ (yyvsp[(5) - (5)].sym)->typ.size=int32_val;
+ (yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
}
-#line 1729 "ncgentab.c" /* yacc.c:1646 */
break;
case 30:
-#line 348 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 348 "ncgen.y"
{
- Symbol* basetype = (yyvsp[-4].sym);
+ Symbol* basetype = (yyvsp[(1) - (5)].sym);
vercheck(NC_VLEN);
- addtogroup((yyvsp[0].sym)); /*sets prefix*/
- (yyvsp[0].sym)->objectclass=NC_TYPE;
- (yyvsp[0].sym)->subclass=NC_VLEN;
- (yyvsp[0].sym)->typ.basetype=basetype;
- (yyvsp[0].sym)->typ.typecode=NC_VLEN;
- (yyvsp[0].sym)->typ.size=VLENSIZE;
- (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_VLEN);
+ addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/
+ (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE;
+ (yyvsp[(5) - (5)].sym)->subclass=NC_VLEN;
+ (yyvsp[(5) - (5)].sym)->typ.basetype=basetype;
+ (yyvsp[(5) - (5)].sym)->typ.typecode=NC_VLEN;
+ (yyvsp[(5) - (5)].sym)->typ.size=VLENSIZE;
+ (yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_VLEN);
}
-#line 1745 "ncgentab.c" /* yacc.c:1646 */
break;
case 31:
-#line 362 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 362 "ncgen.y"
{
int i,j;
vercheck(NC_COMPOUND);
- addtogroup((yyvsp[-3].sym));
+ addtogroup((yyvsp[(2) - (5)].sym));
/* check for duplicate field names*/
- stackbase=(yyvsp[-1].mark);
+ stackbase=(yyvsp[(4) - (5)].mark);
stacklen=listlength(stack);
for(i=stackbase;i<stacklen;i++) {
Symbol* elem1 = (Symbol*)listget(stack,i);
@@ -1762,168 +2001,189 @@ yyreduce:
}
}
}
- (yyvsp[-3].sym)->objectclass=NC_TYPE;
- (yyvsp[-3].sym)->subclass=NC_COMPOUND;
- (yyvsp[-3].sym)->typ.basetype=NULL;
- (yyvsp[-3].sym)->typ.typecode=NC_COMPOUND;
- (yyvsp[-3].sym)->subnodes = listnew();
+ (yyvsp[(2) - (5)].sym)->objectclass=NC_TYPE;
+ (yyvsp[(2) - (5)].sym)->subclass=NC_COMPOUND;
+ (yyvsp[(2) - (5)].sym)->typ.basetype=NULL;
+ (yyvsp[(2) - (5)].sym)->typ.typecode=NC_COMPOUND;
+ (yyvsp[(2) - (5)].sym)->subnodes = listnew();
/* Add in the fields*/
for(i=stackbase;i<stacklen;i++) {
Symbol* fsym = (Symbol*)listget(stack,i);
- fsym->container = (yyvsp[-3].sym);
- listpush((yyvsp[-3].sym)->subnodes,(void*)fsym);
+ fsym->container = (yyvsp[(2) - (5)].sym);
+ listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym);
}
listsetlength(stack,stackbase);/* remove stack nodes*/
}
-#line 1779 "ncgentab.c" /* yacc.c:1646 */
break;
case 32:
-#line 394 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-1].mark);}
-#line 1785 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 394 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(1) - (2)].mark);}
break;
case 33:
-#line 395 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-2].mark);}
-#line 1791 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 395 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(1) - (3)].mark);}
break;
case 34:
-#line 399 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 399 "ncgen.y"
{
int i;
- (yyval.mark)=(yyvsp[0].mark);
- stackbase=(yyvsp[0].mark);
+ (yyval.mark)=(yyvsp[(2) - (2)].mark);
+ stackbase=(yyvsp[(2) - (2)].mark);
stacklen=listlength(stack);
/* process each field in the fieldlist*/
for(i=stackbase;i<stacklen;i++) {
Symbol* f = (Symbol*)listget(stack,i);
- f->typ.basetype = (yyvsp[-1].sym);
+ f->typ.basetype = (yyvsp[(1) - (2)].sym);
}
}
-#line 1807 "ncgentab.c" /* yacc.c:1646 */
break;
case 35:
-#line 412 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 412 "ncgen.y"
{ (yyval.sym) = primsymbols[NC_CHAR]; }
-#line 1813 "ncgentab.c" /* yacc.c:1646 */
break;
case 36:
-#line 413 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 413 "ncgen.y"
{ (yyval.sym) = primsymbols[NC_BYTE]; }
-#line 1819 "ncgentab.c" /* yacc.c:1646 */
break;
case 37:
-#line 414 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 414 "ncgen.y"
{ (yyval.sym) = primsymbols[NC_SHORT]; }
-#line 1825 "ncgentab.c" /* yacc.c:1646 */
break;
case 38:
-#line 415 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 415 "ncgen.y"
{ (yyval.sym) = primsymbols[NC_INT]; }
-#line 1831 "ncgentab.c" /* yacc.c:1646 */
break;
case 39:
-#line 416 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 416 "ncgen.y"
{ (yyval.sym) = primsymbols[NC_FLOAT]; }
-#line 1837 "ncgentab.c" /* yacc.c:1646 */
break;
case 40:
-#line 417 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 417 "ncgen.y"
{ (yyval.sym) = primsymbols[NC_DOUBLE]; }
-#line 1843 "ncgentab.c" /* yacc.c:1646 */
break;
case 41:
-#line 418 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 418 "ncgen.y"
{ vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; }
-#line 1849 "ncgentab.c" /* yacc.c:1646 */
break;
case 42:
-#line 419 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 419 "ncgen.y"
{ vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; }
-#line 1855 "ncgentab.c" /* yacc.c:1646 */
break;
case 43:
-#line 420 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 420 "ncgen.y"
{ vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; }
-#line 1861 "ncgentab.c" /* yacc.c:1646 */
break;
case 44:
-#line 421 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 421 "ncgen.y"
{ vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; }
-#line 1867 "ncgentab.c" /* yacc.c:1646 */
break;
case 45:
-#line 422 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 422 "ncgen.y"
{ vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; }
-#line 1873 "ncgentab.c" /* yacc.c:1646 */
break;
case 47:
-#line 426 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 426 "ncgen.y"
{}
-#line 1879 "ncgentab.c" /* yacc.c:1646 */
break;
case 48:
-#line 427 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 427 "ncgen.y"
{}
-#line 1885 "ncgentab.c" /* yacc.c:1646 */
break;
case 51:
-#line 434 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 434 "ncgen.y"
{}
-#line 1891 "ncgentab.c" /* yacc.c:1646 */
break;
case 52:
-#line 434 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 434 "ncgen.y"
{}
-#line 1897 "ncgentab.c" /* yacc.c:1646 */
break;
case 55:
-#line 442 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 442 "ncgen.y"
{
- (yyvsp[-2].sym)->dim.declsize = (size_t)uint32_val;
+ (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)uint32_val;
#ifdef GENDEBUG1
-fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize);
+fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long)(yyvsp[(1) - (3)].sym)->dim.declsize);
#endif
}
-#line 1908 "ncgentab.c" /* yacc.c:1646 */
break;
case 56:
-#line 449 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 449 "ncgen.y"
{
if(int32_val <= 0) {
derror("dimension size must be positive");
YYABORT;
}
- (yyvsp[-2].sym)->dim.declsize = (size_t)int32_val;
+ (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)int32_val;
#ifdef GENDEBUG1
-fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize);
+fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long)(yyvsp[(1) - (3)].sym)->dim.declsize);
#endif
}
-#line 1923 "ncgentab.c" /* yacc.c:1646 */
break;
case 57:
-#line 460 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 460 "ncgen.y"
{ /* for rare case where 2^31 < dimsize < 2^32 */
if (double_val <= 0)
yyerror("dimension length must be positive");
@@ -1931,69 +2191,76 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyv
yyerror("dimension too large");
if (double_val - (size_t) double_val > 0)
yyerror("dimension length must be an integer");
- (yyvsp[-2].sym)->dim.declsize = (size_t)double_val;
+ (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)double_val;
#ifdef GENDEBUG1
-fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize);
+fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long)(yyvsp[(1) - (3)].sym)->dim.declsize);
#endif
}
-#line 1940 "ncgentab.c" /* yacc.c:1646 */
break;
case 58:
-#line 473 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 473 "ncgen.y"
{
- (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED;
- (yyvsp[-2].sym)->dim.isunlimited = 1;
+ (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED;
+ (yyvsp[(1) - (3)].sym)->dim.isunlimited = 1;
#ifdef GENDEBUG1
-fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
+fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
#endif
}
-#line 1952 "ncgentab.c" /* yacc.c:1646 */
break;
case 59:
-#line 483 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 483 "ncgen.y"
{
- (yyvsp[0].sym)->objectclass=NC_DIM;
- if(dupobjectcheck(NC_DIM,(yyvsp[0].sym)))
+ (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM;
+ if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym)))
yyerror( "Duplicate dimension declaration for %s",
- (yyvsp[0].sym)->name);
- addtogroup((yyvsp[0].sym));
- (yyval.sym)=(yyvsp[0].sym);
- listpush(dimdefs,(void*)(yyvsp[0].sym));
+ (yyvsp[(1) - (1)].sym)->name);
+ addtogroup((yyvsp[(1) - (1)].sym));
+ (yyval.sym)=(yyvsp[(1) - (1)].sym);
+ listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym));
}
-#line 1966 "ncgentab.c" /* yacc.c:1646 */
break;
case 61:
-#line 495 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 495 "ncgen.y"
{}
-#line 1972 "ncgentab.c" /* yacc.c:1646 */
break;
case 62:
-#line 496 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 496 "ncgen.y"
{}
-#line 1978 "ncgentab.c" /* yacc.c:1646 */
break;
case 65:
-#line 503 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 503 "ncgen.y"
{}
-#line 1984 "ncgentab.c" /* yacc.c:1646 */
break;
case 66:
-#line 503 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 503 "ncgen.y"
{}
-#line 1990 "ncgentab.c" /* yacc.c:1646 */
break;
case 67:
-#line 506 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 506 "ncgen.y"
{
int i;
- stackbase=(yyvsp[0].mark);
+ stackbase=(yyvsp[(2) - (2)].mark);
stacklen=listlength(stack);
/* process each variable in the varlist*/
for(i=stackbase;i<stacklen;i++) {
@@ -2003,40 +2270,43 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
yyerror("Duplicate variable declaration for %s",
sym->name);
} else {
- sym->typ.basetype = (yyvsp[-1].sym);
+ sym->typ.basetype = (yyvsp[(1) - (2)].sym);
addtogroup(sym);
listpush(vardefs,(void*)sym);
}
}
listsetlength(stack,stackbase);/* remove stack nodes*/
}
-#line 2014 "ncgentab.c" /* yacc.c:1646 */
break;
case 68:
-#line 528 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 528 "ncgen.y"
{(yyval.mark)=listlength(stack);
- listpush(stack,(void*)(yyvsp[0].sym));
+ listpush(stack,(void*)(yyvsp[(1) - (1)].sym));
}
-#line 2022 "ncgentab.c" /* yacc.c:1646 */
break;
case 69:
-#line 532 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2028 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 532 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));}
break;
case 70:
-#line 536 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 536 "ncgen.y"
{
int i;
Dimset dimset;
stacklen=listlength(stack);
- stackbase=(yyvsp[0].mark);
+ stackbase=(yyvsp[(2) - (2)].mark);
count = stacklen - stackbase;
if(count >= NC_MAX_VAR_DIMS) {
- yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name);
+ yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name);
count = NC_MAX_VAR_DIMS - 1;
stacklen = stackbase + count;
}
@@ -2047,78 +2317,86 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
Symbol* dsym = (Symbol*)listget(stack,stackbase+i);
dimset.dimsyms[i] = dsym;
}
- (yyvsp[-1].sym)->typ.dimset = dimset;
+ (yyvsp[(1) - (2)].sym)->typ.dimset = dimset;
}
- (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/
- (yyvsp[-1].sym)->objectclass=NC_VAR;
+ (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/
+ (yyvsp[(1) - (2)].sym)->objectclass=NC_VAR;
listsetlength(stack,stackbase);/* remove stack nodes*/
}
-#line 2057 "ncgentab.c" /* yacc.c:1646 */
break;
case 71:
-#line 562 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 562 "ncgen.y"
{(yyval.mark)=listlength(stack);}
-#line 2063 "ncgentab.c" /* yacc.c:1646 */
break;
case 72:
-#line 563 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-1].mark);}
-#line 2069 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 563 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(2) - (3)].mark);}
break;
case 73:
-#line 566 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2075 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 566 "ncgen.y"
+ {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));}
break;
case 74:
-#line 568 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2081 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 568 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));}
break;
case 75:
-#line 572 "ncgen.y" /* yacc.c:1646 */
- {Symbol* dimsym = (yyvsp[0].sym);
+
+/* Line 1806 of yacc.c */
+#line 572 "ncgen.y"
+ {Symbol* dimsym = (yyvsp[(1) - (1)].sym);
dimsym->objectclass = NC_DIM;
/* Find the actual dimension*/
dimsym = locate(dimsym);
if(dimsym == NULL) {
- derror("Undefined or forward referenced dimension: %s",(yyvsp[0].sym)->name);
+ derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name);
YYABORT;
}
(yyval.sym)=dimsym;
}
-#line 2096 "ncgentab.c" /* yacc.c:1646 */
break;
case 76:
-#line 586 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 586 "ncgen.y"
{(yyval.mark)=listlength(stack);
- listpush(stack,(void*)(yyvsp[0].sym));
+ listpush(stack,(void*)(yyvsp[(1) - (1)].sym));
}
-#line 2104 "ncgentab.c" /* yacc.c:1646 */
break;
case 77:
-#line 590 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2110 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 590 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));}
break;
case 78:
-#line 595 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 595 "ncgen.y"
{
int i;
Dimset dimset;
- stackbase=(yyvsp[0].mark);
+ stackbase=(yyvsp[(2) - (2)].mark);
stacklen=listlength(stack);
count = stacklen - stackbase;
if(count >= NC_MAX_VAR_DIMS) {
- yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name);
+ yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name);
count = NC_MAX_VAR_DIMS - 1;
stacklen = stackbase + count;
}
@@ -2129,43 +2407,48 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
Symbol* dsym = (Symbol*)listget(stack,stackbase+i);
dimset.dimsyms[i] = dsym;
}
- (yyvsp[-1].sym)->typ.dimset = dimset;
+ (yyvsp[(1) - (2)].sym)->typ.dimset = dimset;
}
- (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/
- (yyvsp[-1].sym)->objectclass=NC_TYPE;
- (yyvsp[-1].sym)->subclass=NC_FIELD;
+ (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/
+ (yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE;
+ (yyvsp[(1) - (2)].sym)->subclass=NC_FIELD;
listsetlength(stack,stackbase);/* remove stack nodes*/
- (yyval.sym) = (yyvsp[-1].sym);
+ (yyval.sym) = (yyvsp[(1) - (2)].sym);
}
-#line 2141 "ncgentab.c" /* yacc.c:1646 */
break;
case 79:
-#line 623 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 623 "ncgen.y"
{(yyval.mark)=listlength(stack);}
-#line 2147 "ncgentab.c" /* yacc.c:1646 */
break;
case 80:
-#line 624 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-1].mark);}
-#line 2153 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 624 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(2) - (3)].mark);}
break;
case 81:
-#line 628 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2159 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 628 "ncgen.y"
+ {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));}
break;
case 82:
-#line 630 "ncgen.y" /* yacc.c:1646 */
- {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2165 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 630 "ncgen.y"
+ {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));}
break;
case 83:
-#line 635 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 635 "ncgen.y"
{ /* Anonymous integer dimension.
Can only occur in type definitions*/
char anon[32];
@@ -2175,11 +2458,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyval.sym)->dim.isconstant = 1;
(yyval.sym)->dim.declsize = uint32_val;
}
-#line 2179 "ncgentab.c" /* yacc.c:1646 */
break;
case 84:
-#line 645 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 645 "ncgen.y"
{ /* Anonymous integer dimension.
Can only occur in type definitions*/
char anon[32];
@@ -2193,36 +2477,39 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyval.sym)->dim.isconstant = 1;
(yyval.sym)->dim.declsize = int32_val;
}
-#line 2197 "ncgentab.c" /* yacc.c:1646 */
break;
case 85:
-#line 665 "ncgen.y" /* yacc.c:1646 */
- {Symbol* vsym = (yyvsp[0].sym);
+
+/* Line 1806 of yacc.c */
+#line 665 "ncgen.y"
+ {Symbol* vsym = (yyvsp[(1) - (1)].sym);
if(vsym->objectclass != NC_VAR) {
derror("Undefined or forward referenced variable: %s",vsym->name);
YYABORT;
}
(yyval.sym)=vsym;
}
-#line 2209 "ncgentab.c" /* yacc.c:1646 */
break;
case 86:
-#line 676 "ncgen.y" /* yacc.c:1646 */
- {Symbol* tsym = (yyvsp[0].sym);
+
+/* Line 1806 of yacc.c */
+#line 676 "ncgen.y"
+ {Symbol* tsym = (yyvsp[(1) - (1)].sym);
if(tsym->objectclass != NC_TYPE) {
derror("Undefined or forward referenced type: %s",tsym->name);
YYABORT;
}
(yyval.sym)=tsym;
}
-#line 2221 "ncgentab.c" /* yacc.c:1646 */
break;
case 87:
-#line 687 "ncgen.y" /* yacc.c:1646 */
- {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym;
+
+/* Line 1806 of yacc.c */
+#line 687 "ncgen.y"
+ {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym;
/* disambiguate*/
tvsym->objectclass = NC_VAR;
sym = locate(tvsym);
@@ -2230,401 +2517,461 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
tvsym->objectclass = NC_TYPE;
sym = locate(tvsym);
if(tvsym == NULL) {
- derror("Undefined or forward referenced name: %s",(yyvsp[0].sym)->name);
+ derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name);
YYABORT;
} else tvsym = sym;
} else tvsym = sym;
if(tvsym == NULL) {
- derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name);
+ derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name);
YYABORT;
}
(yyval.sym)=tvsym;
}
-#line 2244 "ncgentab.c" /* yacc.c:1646 */
break;
case 88:
-#line 705 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym)=(yyvsp[0].sym);}
-#line 2250 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 705 "ncgen.y"
+ {(yyval.sym)=(yyvsp[(1) - (1)].sym);}
break;
case 89:
-#line 712 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 712 "ncgen.y"
{}
-#line 2256 "ncgentab.c" /* yacc.c:1646 */
break;
case 90:
-#line 712 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 712 "ncgen.y"
{}
-#line 2262 "ncgentab.c" /* yacc.c:1646 */
break;
case 91:
-#line 716 "ncgen.y" /* yacc.c:1646 */
- { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
-#line 2268 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 716 "ncgen.y"
+ { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);}
break;
case 92:
-#line 718 "ncgen.y" /* yacc.c:1646 */
- {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym);
+
+/* Line 1806 of yacc.c */
+#line 718 "ncgen.y"
+ {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym);
if(vsym->objectclass == NC_VAR) {
- (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR);
+ (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR);
} else {
derror("Doubly typed attribute: %s",asym->name);
YYABORT;
}
}
-#line 2281 "ncgentab.c" /* yacc.c:1646 */
break;
case 93:
-#line 727 "ncgen.y" /* yacc.c:1646 */
- {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym);
+
+/* Line 1806 of yacc.c */
+#line 727 "ncgen.y"
+ {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym);
if(sym->objectclass == NC_VAR) {
- (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR);
+ (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR);
} else if(sym->objectclass == NC_TYPE) {
- (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[0].datalist),ATTRGLOBAL);
+ (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL);
} else {
derror("Attribute prefix not a variable or type: %s",asym->name);
YYABORT;
}
}
-#line 2296 "ncgentab.c" /* yacc.c:1646 */
break;
case 94:
-#line 738 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
-#line 2302 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 738 "ncgen.y"
+ {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);}
break;
case 95:
-#line 740 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);}
-#line 2308 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 740 "ncgen.y"
+ {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),0);}
break;
case 96:
-#line 742 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2314 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 742 "ncgen.y"
+ {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);}
break;
case 97:
-#line 744 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
-#line 2320 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 744 "ncgen.y"
+ {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);}
break;
case 98:
-#line 746 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2326 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 746 "ncgen.y"
+ {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);}
break;
case 99:
-#line 748 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2332 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 748 "ncgen.y"
+ {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);}
break;
case 100:
-#line 750 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2338 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 750 "ncgen.y"
+ {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);}
break;
case 101:
-#line 752 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2344 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 752 "ncgen.y"
+ {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);}
break;
case 102:
-#line 754 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2350 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 754 "ncgen.y"
+ {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);}
break;
case 103:
-#line 756 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2356 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 756 "ncgen.y"
+ {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),1);}
break;
case 104:
-#line 761 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 761 "ncgen.y"
{
- (yyval.sym)=(yyvsp[0].sym);
- (yyvsp[0].sym)->ref.is_ref=1;
- (yyvsp[0].sym)->is_prefixed=0;
- setpathcurrent((yyvsp[0].sym));
+ (yyval.sym)=(yyvsp[(1) - (1)].sym);
+ (yyvsp[(1) - (1)].sym)->ref.is_ref=1;
+ (yyvsp[(1) - (1)].sym)->is_prefixed=0;
+ setpathcurrent((yyvsp[(1) - (1)].sym));
}
-#line 2367 "ncgentab.c" /* yacc.c:1646 */
break;
case 105:
-#line 768 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 768 "ncgen.y"
{
- (yyval.sym)=(yyvsp[0].sym);
- (yyvsp[0].sym)->ref.is_ref=1;
- (yyvsp[0].sym)->is_prefixed=1;
+ (yyval.sym)=(yyvsp[(1) - (1)].sym);
+ (yyvsp[(1) - (1)].sym)->ref.is_ref=1;
+ (yyvsp[(1) - (1)].sym)->is_prefixed=1;
/* path is set in ncgen.l*/
}
-#line 2378 "ncgentab.c" /* yacc.c:1646 */
break;
case 107:
-#line 777 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 777 "ncgen.y"
{}
-#line 2384 "ncgentab.c" /* yacc.c:1646 */
break;
case 108:
-#line 778 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 778 "ncgen.y"
{}
-#line 2390 "ncgentab.c" /* yacc.c:1646 */
break;
case 111:
-#line 786 "ncgen.y" /* yacc.c:1646 */
- {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);}
-#line 2396 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 786 "ncgen.y"
+ {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);}
break;
case 112:
-#line 789 "ncgen.y" /* yacc.c:1646 */
- {(yyval.datalist) = (yyvsp[0].datalist);}
-#line 2402 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 789 "ncgen.y"
+ {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);}
break;
case 113:
-#line 790 "ncgen.y" /* yacc.c:1646 */
- {(yyval.datalist) = (yyvsp[0].datalist);}
-#line 2408 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 790 "ncgen.y"
+ {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);}
break;
case 114:
-#line 794 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 794 "ncgen.y"
{(yyval.datalist) = builddatalist(0);}
-#line 2414 "ncgentab.c" /* yacc.c:1646 */
break;
case 115:
-#line 798 "ncgen.y" /* yacc.c:1646 */
- {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
-#line 2420 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 798 "ncgen.y"
+ {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));}
break;
case 116:
-#line 800 "ncgen.y" /* yacc.c:1646 */
- {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
-#line 2426 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 800 "ncgen.y"
+ {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);}
break;
case 117:
-#line 804 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=(yyvsp[0].constant);}
-#line 2432 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 804 "ncgen.y"
+ {(yyval.constant)=(yyvsp[(1) - (1)].constant);}
break;
case 118:
-#line 805 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));}
-#line 2438 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 805 "ncgen.y"
+ {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));}
break;
case 119:
-#line 809 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=(yyvsp[0].constant);}
-#line 2444 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 809 "ncgen.y"
+ {(yyval.constant)=(yyvsp[(1) - (1)].constant);}
break;
case 120:
-#line 810 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 810 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_OPAQUE);}
-#line 2450 "ncgentab.c" /* yacc.c:1646 */
break;
case 121:
-#line 811 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 811 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_FILLVALUE);}
-#line 2456 "ncgentab.c" /* yacc.c:1646 */
break;
case 122:
-#line 812 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 812 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_NIL);}
-#line 2462 "ncgentab.c" /* yacc.c:1646 */
break;
case 123:
-#line 813 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=(yyvsp[0].constant);}
-#line 2468 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 813 "ncgen.y"
+ {(yyval.constant)=(yyvsp[(1) - (1)].constant);}
break;
case 125:
-#line 818 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant) = makeenumconstref((yyvsp[0].sym));}
-#line 2474 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 818 "ncgen.y"
+ {(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));}
break;
case 126:
-#line 822 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));}
-#line 2480 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 822 "ncgen.y"
+ {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));}
break;
case 127:
-#line 827 "ncgen.y" /* yacc.c:1646 */
- {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
-#line 2486 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 827 "ncgen.y"
+ {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));}
break;
case 128:
-#line 829 "ncgen.y" /* yacc.c:1646 */
- {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
-#line 2492 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 829 "ncgen.y"
+ {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);}
break;
case 129:
-#line 833 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 833 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_CHAR);}
-#line 2498 "ncgentab.c" /* yacc.c:1646 */
break;
case 130:
-#line 834 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 834 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_BYTE);}
-#line 2504 "ncgentab.c" /* yacc.c:1646 */
break;
case 131:
-#line 835 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 835 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_SHORT);}
-#line 2510 "ncgentab.c" /* yacc.c:1646 */
break;
case 132:
-#line 836 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 836 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_INT);}
-#line 2516 "ncgentab.c" /* yacc.c:1646 */
break;
case 133:
-#line 837 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 837 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_INT64);}
-#line 2522 "ncgentab.c" /* yacc.c:1646 */
break;
case 134:
-#line 838 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 838 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_UBYTE);}
-#line 2528 "ncgentab.c" /* yacc.c:1646 */
break;
case 135:
-#line 839 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 839 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_USHORT);}
-#line 2534 "ncgentab.c" /* yacc.c:1646 */
break;
case 136:
-#line 840 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 840 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_UINT);}
-#line 2540 "ncgentab.c" /* yacc.c:1646 */
break;
case 137:
-#line 841 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 841 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_UINT64);}
-#line 2546 "ncgentab.c" /* yacc.c:1646 */
break;
case 138:
-#line 842 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 842 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_FLOAT);}
-#line 2552 "ncgentab.c" /* yacc.c:1646 */
break;
case 139:
-#line 843 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 843 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_DOUBLE);}
-#line 2558 "ncgentab.c" /* yacc.c:1646 */
break;
case 140:
-#line 844 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 844 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_STRING);}
-#line 2564 "ncgentab.c" /* yacc.c:1646 */
break;
case 141:
-#line 848 "ncgen.y" /* yacc.c:1646 */
- {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
-#line 2570 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 848 "ncgen.y"
+ {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));}
break;
case 142:
-#line 849 "ncgen.y" /* yacc.c:1646 */
- {(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));}
-#line 2576 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 849 "ncgen.y"
+ {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant)));}
break;
case 143:
-#line 854 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 854 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_INT);}
-#line 2582 "ncgentab.c" /* yacc.c:1646 */
break;
case 144:
-#line 856 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 856 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_UINT);}
-#line 2588 "ncgentab.c" /* yacc.c:1646 */
break;
case 145:
-#line 858 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 858 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_INT64);}
-#line 2594 "ncgentab.c" /* yacc.c:1646 */
break;
case 146:
-#line 860 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 860 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_UINT64);}
-#line 2600 "ncgentab.c" /* yacc.c:1646 */
break;
case 147:
-#line 864 "ncgen.y" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 864 "ncgen.y"
{(yyval.constant)=makeconstdata(NC_STRING);}
-#line 2606 "ncgentab.c" /* yacc.c:1646 */
break;
case 148:
-#line 868 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=(yyvsp[0].constant);}
-#line 2612 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 868 "ncgen.y"
+ {(yyval.constant)=(yyvsp[(1) - (1)].constant);}
break;
case 149:
-#line 869 "ncgen.y" /* yacc.c:1646 */
- {(yyval.constant)=(yyvsp[0].constant);}
-#line 2618 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 869 "ncgen.y"
+ {(yyval.constant)=(yyvsp[(1) - (1)].constant);}
break;
case 150:
-#line 875 "ncgen.y" /* yacc.c:1646 */
- {(yyval.sym)=(yyvsp[0].sym);}
-#line 2624 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 875 "ncgen.y"
+ {(yyval.sym)=(yyvsp[(1) - (1)].sym);}
break;
-#line 2628 "ncgentab.c" /* yacc.c:1646 */
+
+/* Line 1806 of yacc.c */
+#line 2975 "ncgentab.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2646,7 +2993,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
*++yyvsp = yyval;
- /* Now 'shift' the result of the reduction. Determine what state
+ /* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -2661,9 +3008,9 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
goto yynewstate;
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -2714,20 +3061,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);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -2746,7 +3093,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -2759,37 +3106,35 @@ 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);
+ yystos[yystate], yyvsp);
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. */
@@ -2813,7 +3158,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#if !defined yyoverflow || YYERROR_VERBOSE
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -2832,14 +3177,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
+ yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -2850,9 +3195,14 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- return yyresult;
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
-#line 878 "ncgen.y" /* yacc.c:1906 */
+
+
+
+/* Line 2067 of yacc.c */
+#line 878 "ncgen.y"
#ifndef NO_STDARG
@@ -3256,19 +3606,19 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
}
attr = makeattribute(install("_FillValue"),vsym,tsym,list,ATTRVAR);
} else switch (tag) {
- // These will be output as attributes later
- case _STORAGE_FLAG:
- if(!sdata)
- derror("_Storage: illegal NULL value");
- else if(strcmp(sdata,"contiguous") == 0)
- special->_Storage = NC_CONTIGUOUS;
- else if(strcmp(sdata,"chunked") == 0)
- special->_Storage = NC_CHUNKED;
- else
- derror("_Storage: illegal value: %s",sdata);
- special->flags |= _STORAGE_FLAG;
- break;
- case _FLETCHER32_FLAG:
+ // These will be output as attributes later
+ case _STORAGE_FLAG:
+ if(!sdata)
+ derror("_Storage: illegal NULL value");
+ else if(strcmp(sdata,"contiguous") == 0)
+ special->_Storage = NC_CONTIGUOUS;
+ else if(strcmp(sdata,"chunked") == 0)
+ special->_Storage = NC_CHUNKED;
+ else
+ derror("_Storage: illegal value: %s",sdata);
+ special->flags |= _STORAGE_FLAG;
+ break;
+ case _FLETCHER32_FLAG:
special->_Fletcher32 = tf;
special->flags |= _FLETCHER32_FLAG;
break;
@@ -3282,7 +3632,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
break;
case _ENDIAN_FLAG:
if(!sdata)
- derror("_Endianness: NULL value.");
+ derror("_Endianness: illegal NULL value");
else if(strcmp(sdata,"little") == 0)
special->_Endianness = 1;
else if(strcmp(sdata,"big") == 0)
@@ -3462,3 +3812,4 @@ evaluate(Symbol* fcn, Datalist* arglist)
done:
return result;
}
+
diff --git a/ncgen/ncgentab.h b/ncgen/ncgentab.h
index 0b93cdc..09bc5fa 100644
--- a/ncgen/ncgentab.h
+++ b/ncgen/ncgentab.h
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 3.0. */
+/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,82 +26,76 @@
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. */
-#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
-# define YY_NCG_NCGEN_TAB_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-#if YYDEBUG
-extern int ncgdebug;
-#endif
-/* Token type. */
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- NC_UNLIMITED_K = 258,
- CHAR_K = 259,
- BYTE_K = 260,
- SHORT_K = 261,
- INT_K = 262,
- FLOAT_K = 263,
- DOUBLE_K = 264,
- UBYTE_K = 265,
- USHORT_K = 266,
- UINT_K = 267,
- INT64_K = 268,
- UINT64_K = 269,
- IDENT = 270,
- TERMSTRING = 271,
- CHAR_CONST = 272,
- BYTE_CONST = 273,
- SHORT_CONST = 274,
- INT_CONST = 275,
- INT64_CONST = 276,
- UBYTE_CONST = 277,
- USHORT_CONST = 278,
- UINT_CONST = 279,
- UINT64_CONST = 280,
- FLOAT_CONST = 281,
- DOUBLE_CONST = 282,
- DIMENSIONS = 283,
- VARIABLES = 284,
- NETCDF = 285,
- DATA = 286,
- TYPES = 287,
- COMPOUND = 288,
- ENUM = 289,
- OPAQUE = 290,
- OPAQUESTRING = 291,
- GROUP = 292,
- PATH = 293,
- FILLMARKER = 294,
- NIL = 295,
- _FILLVALUE = 296,
- _FORMAT = 297,
- _STORAGE = 298,
- _CHUNKSIZES = 299,
- _DEFLATELEVEL = 300,
- _SHUFFLE = 301,
- _ENDIANNESS = 302,
- _NOFILL = 303,
- _FLETCHER32 = 304,
- DATASETID = 305
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NC_UNLIMITED_K = 258,
+ CHAR_K = 259,
+ BYTE_K = 260,
+ SHORT_K = 261,
+ INT_K = 262,
+ FLOAT_K = 263,
+ DOUBLE_K = 264,
+ UBYTE_K = 265,
+ USHORT_K = 266,
+ UINT_K = 267,
+ INT64_K = 268,
+ UINT64_K = 269,
+ IDENT = 270,
+ TERMSTRING = 271,
+ CHAR_CONST = 272,
+ BYTE_CONST = 273,
+ SHORT_CONST = 274,
+ INT_CONST = 275,
+ INT64_CONST = 276,
+ UBYTE_CONST = 277,
+ USHORT_CONST = 278,
+ UINT_CONST = 279,
+ UINT64_CONST = 280,
+ FLOAT_CONST = 281,
+ DOUBLE_CONST = 282,
+ DIMENSIONS = 283,
+ VARIABLES = 284,
+ NETCDF = 285,
+ DATA = 286,
+ TYPES = 287,
+ COMPOUND = 288,
+ ENUM = 289,
+ OPAQUE = 290,
+ OPAQUESTRING = 291,
+ GROUP = 292,
+ PATH = 293,
+ FILLMARKER = 294,
+ NIL = 295,
+ _FILLVALUE = 296,
+ _FORMAT = 297,
+ _STORAGE = 298,
+ _CHUNKSIZES = 299,
+ _DEFLATELEVEL = 300,
+ _SHUFFLE = 301,
+ _ENDIANNESS = 302,
+ _NOFILL = 303,
+ _FLETCHER32 = 304,
+ DATASETID = 305
+ };
#endif
-/* Value type. */
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
+typedef union YYSTYPE
{
-#line 131 "ncgen.y" /* yacc.c:1909 */
+
+/* Line 2068 of yacc.c */
+#line 131 "ncgen.y"
Symbol* sym;
unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/
@@ -110,15 +104,16 @@ int nctype; /* for tracking attribute list type*/
Datalist* datalist;
NCConstant constant;
-#line 114 "ncgentab.h" /* yacc.c:1909 */
-};
+
+
+/* Line 2068 of yacc.c */
+#line 111 "ncgentab.h"
+} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-
extern YYSTYPE ncglval;
-int ncgparse (void);
-#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */
diff --git a/ncgen3/Makefile.in b/ncgen3/Makefile.in
index 3c1012e..5c71726 100644
--- a/ncgen3/Makefile.in
+++ b/ncgen3/Makefile.in
@@ -429,6 +429,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -504,7 +507,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/ncgen3/c0.cdl b/ncgen3/c0.cdl
index ebc6cd9..5a1455c 100644
--- a/ncgen3/c0.cdl
+++ b/ncgen3/c0.cdl
@@ -159,7 +159,7 @@ data:
d2 = -1e+308, 1e+308 ;
- c3 = "\001\300." ;
+ c3 = "\001\177." ;
b3 = -128, 127, -1 ;
diff --git a/ncgen3/main.c b/ncgen3/main.c
index 1436612..f86e720 100644
--- a/ncgen3/main.c
+++ b/ncgen3/main.c
@@ -242,4 +242,4 @@ main(
return 1;
return 0;
}
-END_OF_MAIN();
+END_OF_MAIN()
diff --git a/nctest/Makefile.in b/nctest/Makefile.in
index cc22016..58b087c 100644
--- a/nctest/Makefile.in
+++ b/nctest/Makefile.in
@@ -438,6 +438,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -513,7 +516,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/oc2/Make0 b/oc2/Make0
index 206a919..e2991fe 100755
--- a/oc2/Make0
+++ b/oc2/Make0
@@ -49,6 +49,9 @@ makeoc::
bison --debug -d -p dap dap.y
mv dap.tab.c daptab.c; mv dap.tab.h daptab.h
+changed:
+ ${MAKE} -f Make0 NAMEONLY=1 diffoc
+
diffoc::
@if ! test -e ${OCDIR} ; then echo "${OCDIR} not found"; exit ; fi
@for file in ${FILES} ; do \
@@ -60,8 +63,12 @@ diffoc::
fi ; \
if test -e ${THISDIR}/$$x -a -e ${OCDIR}/$$x ; then \
if ! diff --brief -wBb ${THISDIR}/$$x $$f > /dev/null ; then \
- echo diff -wBb ${THISDIR}/$$x $$f ;\
- diff -w ${THISDIR}/$$x $$f ; \
+ if test "x${NAMEONLY}" = x1 ; then \
+ echo "$$x" ;\
+ else \
+ echo diff -wBb ${THISDIR}/$$x $$f ;\
+ diff -w ${THISDIR}/$$x $$f ; \
+ fi; \
fi; \
fi; \
done
diff --git a/oc2/Makefile.in b/oc2/Makefile.in
index 1d3dd05..eeca5f9 100644
--- a/oc2/Makefile.in
+++ b/oc2/Makefile.in
@@ -230,6 +230,9 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
+DOXYGEN_CSS_FILE = @DOXYGEN_CSS_FILE@
+DOXYGEN_HEADER_FILE = @DOXYGEN_HEADER_FILE@
+DOXYGEN_SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -305,7 +308,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
-SERVER_SIDE_SEARCH = @SERVER_SIDE_SEARCH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHOW_DOXYGEN_TAG_LIST = @SHOW_DOXYGEN_TAG_LIST@
diff --git a/oc2/occurlfunctions.c b/oc2/occurlfunctions.c
index daeb8ca..c946f18 100644
--- a/oc2/occurlfunctions.c
+++ b/oc2/occurlfunctions.c
@@ -213,22 +213,19 @@ ocset_flags_perlink(OCstate* state)
{
OCerror stat = OC_NOERR;
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_ENCODING);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_NETRC);
-// if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_VERBOSE);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_TIMEOUT);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USERAGENT);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_COOKIEJAR);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USERPWD);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_PROXY);
- if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USE_SSL);
- if(stat != OC_NOERR)
- return stat;
-
/* Following are always set */
- ocset_curlflag(state, CURLOPT_FOLLOWLOCATION);
- ocset_curlflag(state, CURLOPT_MAXREDIRS);
- ocset_curlflag(state, CURLOPT_ERRORBUFFER);
+ stat = ocset_curlflag(state,CURLOPT_ENCODING);
+ stat = ocset_curlflag(state,CURLOPT_NETRC);
+ stat = ocset_curlflag(state,CURLOPT_TIMEOUT);
+ stat = ocset_curlflag(state,CURLOPT_USERAGENT);
+ stat = ocset_curlflag(state,CURLOPT_COOKIEJAR);
+ stat = ocset_curlflag(state,CURLOPT_USERPWD);
+ stat = ocset_curlflag(state,CURLOPT_PROXY);
+ stat = ocset_curlflag(state,CURLOPT_USE_SSL);
+
+ stat = ocset_curlflag(state, CURLOPT_FOLLOWLOCATION);
+ stat = ocset_curlflag(state, CURLOPT_MAXREDIRS);
+ stat = ocset_curlflag(state, CURLOPT_ERRORBUFFER);
/* Set the CURL. options */
stat = oc_set_curl_options(state);
diff --git a/oc2/ocinternal.c b/oc2/ocinternal.c
index 7d2a67c..500dd5a 100644
--- a/oc2/ocinternal.c
+++ b/oc2/ocinternal.c
@@ -617,7 +617,7 @@ ocset_curlproperties(OCstate* state)
int stat;
pid_t pid = getpid();
snprintf(tmp,sizeof(tmp)-1,"%s/%s.%ld/",ocglobalstate.tempdir,OCDIR,(long)pid);
-#ifdef _MSC_VER
+#ifdef _WIN32
stat = mkdir(tmp);
#else
stat = mkdir(tmp,S_IRUSR | S_IWUSR | S_IXUSR);
diff --git a/oc2/ocrc.c b/oc2/ocrc.c
index 042e8fe..8e6a074 100644
--- a/oc2/ocrc.c
+++ b/oc2/ocrc.c
@@ -125,8 +125,10 @@ static void
rctrim(char* text)
{
char* p = text;
- size_t len = strlen(text);
+ size_t len;
int i;
+
+ len = strlen(text);
/* locate first non-trimchar */
for(;*p;p++) {
if(strchr(TRIMCHARS,*p) == NULL) break; /* hit non-trim char */
@@ -371,7 +373,7 @@ ocrc_load(void)
2. set by DAPRCFILE env variable
3. '.'
4. $HOME
- */
+ */
if(ocglobalstate.rc.rcfile != NULL) { /* always use this */
path = strdup(ocglobalstate.rc.rcfile);
} else if(getenv(OCRCFILEENV) != NULL && strlen(getenv(OCRCFILEENV)) > 0) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/netcdf.git
More information about the Pkg-grass-devel
mailing list